-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
315 lines (287 loc) · 22.3 KB
/
Copy pathindex.html
File metadata and controls
315 lines (287 loc) · 22.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>HTML Header Counts</title>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css'>
<link rel="stylesheet" href="/static/css/style.css">
<script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap" rel="stylesheet">
<style>
/* Colors for badges */
h1 { font-family: 'Bebas Neue', cursive;}
.badge-red {
background-color: #d54625;
}
.badge-green {
background-color: #35bd4a;
}
.badge-blue {
background-color: #357ebd;
}
.table-sortable > thead > tr > th {
cursor: pointer;
}
.table-sortable > thead > tr > th[data-sorting="disabled"] {
cursor: default;
}
.table-sortable > thead > tr > th[data-sorting="disabled"]:hover,
.table-sortable > thead > tr > th[data-sorting="disabled"]:active {
background: inherit;
}
.table-sortable > thead > tr > th:hover,
.table-sortable > thead > tr > th:active {
background: #F5F5F5;
}
.table-sortable > tbody > tr > td mark,
.table-sortable > tbody > tr > td .mark {
padding-left: 0;
padding-right: 0;
}
</style>
</head>
<body>
<div class='container-fluid'>
<div class='row'>
<div class='col-sm-12'>
<br>
<div class='form-horizontal'>
<div class='form-group has-feedback'>
<div class='col-sm-12'>
<input class='form-control table-sortable-search' placeholder='Search...' type='search'>
<span class='glyphicon glyphicon-remove form-control-feedback search-cancel-button'></span>
</div>
</div>
</div>
<br>
<div class='panel panel-default'>
<div class='table-responsive' id="app">
<h1 style="margin-left:5px">Sites for <b>AGE</b> ⭐️</h1>
<hr>
<label>Rows per page</label>
<select v-model="pageSizeModel">
<option value="3">3</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="25">25</option>
</select>
<table class="table table-sortable">
<thead>
<tr>
<th :class="{ sorted: sort === 'id' }" @click="sortBy('id')">
Id
</th>
<th :class="{ sorted: sort === 'name' }" @click="sortBy('name')">
Name
</th>
<th :class="{ sorted: sort === 'value' }" @click="sortBy('value')" >
Value
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in sortedRows">
<td>{{ row.id }}</td>
<td>{{ row.name }}</td>
<td>{{ row.value }}</td>
<td data-id="{{ row.id }}">
<div class='btn-group btn-group-xs'>
<button v-on:click="viewRow" class="btn btn-default" title="View">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
<div class="controls">
<button class="btn btn-sm" :disabled="!hasPage(-1)" @click="prevPage">←</button>
<button class="btn btn-sm" :disabled="!hasPage(1)" @click="nextPage">→</button>
<span style="float:right; margin-right:30px; margin-top:20px" class="badge badge-primary"><span class="glyphicon glyphicon-heart"></span> vsoch</span>
</div>
<hr>
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js'></script>
<script>
// Handle socket to send /receive messages from server without refresh
$(document).ready(function(){
});
// tables.js
function preg_quote( str ) {
// http://kevin.vanzonneveld.net
// + original by: booeyOH
// + improved by: Ates Goral (http://magnetiq.com)
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// * example 1: preg_quote("$40");
// * returns 1: '\$40'
// * example 2: preg_quote("*RRRING* Hello?");
// * returns 2: '\*RRRING\* Hello\?'
// * example 3: preg_quote("\\.+*?[^]$(){}=!<>|:");
// * returns 3: '\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:'
return (str+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
}
function highlight(data, search){
return data.replace(new RegExp( "(" + preg_quote( search ) + ")" , 'gi' ), "<mark>$1</mark>" );
}
// Table
function Table($table,$input){
$table.find("th").each(function($key, el){
if ($(el).attr("data-sorting")!="disabled"){
$("<span/>").attr("class","fa").attr("row-id",$key+1).appendTo(el);
}}).click(function(){
var asc=true;
if ($(this).find("span.fa").attr("class")=="fa"||$(this).find("span.fa").attr("class")=="fa fa-caret-up fa-fw"){
$table.find("th[data-sorting!=disabled] span.fa").attr("class","fa");
$(this).find("span.fa").attr("class","fa fa-caret-down fa-fw");
asc=true;
}
else if ($(this).find("span.fa").attr("class")=="fa fa-caret-down fa-fw"){
$table.find("th[data-sorting!=disabled] span.fa").attr("class","fa");
$(this).find("span.fa").attr("class","fa fa-caret-up fa-fw");
asc=false
}
value=$.map($table.find("td:nth-child("+($(this).find("span.fa").attr("row-id"))+")"),function(el){
return {text:$(el).text().trim(),row:$(el).parent()};
});
value.sort(function(x, y){
if (asc){
if (x.text < y.text) {
return -1;
}
if (x.text > y.text) {
return 1;
}
} else {
if (x.text < y.text) {
return 1;
}
if (x.text > y.text) {
return -1;
}
}
return 0;
});
$table.find("tr:gt(0)").remove();
$.each(value,function(key,value){
$(value.row).appendTo($table);
});
});
$table.find("th:first").click();
$input.on("keyup change",function(){
var newText=$(this).val();
$table.find("span.text-wrap").each(function(key,value){
$(value).html($(value).text());
$(value).contents().unwrap();
});
if (newText.trim()!=""){
$table.find("tr:gt(0)").hide();
var textNode=$table.find("tr:gt(0) *")
.contents()
.filter(function() {
return this.nodeType === 3; //Node.TEXT_NODE
}).each(function(key,value){
var nodeText=value.data;
if (nodeText.toLowerCase().indexOf(newText.toLowerCase())!=-1){
$(value).closest("tr").show();
if ($(value).parent().attr("class")!="text-wrap")
$(value).wrap("<span class='text-wrap'></span>");
$(value).parent().html(highlight(nodeText ,newText));
}
});;
}else{
$table.find("tr").show();
}
});
}
$(function(){
Table($(".table-sortable"),$(".table-sortable-search"));
});
// Search
$('input[type="search"]').keyup(function () {
var t = $(this);
t.next('span').toggle(Boolean(t.val()));
});
$('input[type="search"] + .search-cancel-button').hide($(this).prev('input').val()).click(function () {
$(this).prev('input').val('').focus();
$(this).hide();
});
const app = new Vue({
data: () => ({
rows: [{"id": 1, "name": "https://cloudflare.com", "value": "23"},{"id": 2, "name": "https://en.wikipedia.org", "value": "543"},{"id": 3, "name": "https://vimeo.com", "value": "0"},{"id": 4, "name": "https://mozilla.org", "value": "472"},{"id": 5, "name": "https://es.wikipedia.org", "value": "29385"},{"id": 6, "name": "https://cnn.com", "value": "99"},{"id": 7, "name": "https://nytimes.com", "value": "48"},{"id": 8, "name": "https://jimdofree.com", "value": "93332"},{"id": 9, "name": "https://theguardian.com", "value": "30"},{"id": 10, "name": "https://who.int", "value": "1937"},{"id": 11, "name": "https://bbc.com", "value": "33"},{"id": 12, "name": "https://nih.gov", "value": "3911"},{"id": 13, "name": "https://reuters.com", "value": "59"},{"id": 14, "name": "https://pt.wikipedia.org", "value": "439"},{"id": 15, "name": "https://fr.wikipedia.org", "value": "12706"},{"id": 16, "name": "https://uol.com.br", "value": "4"},{"id": 17, "name": "https://creativecommons.org", "value": "0"},{"id": 18, "name": "https://wikimedia.org", "value": "2385"},{"id": 19, "name": "https://forbes.com", "value": "241"},{"id": 20, "name": "https://www.yahoo.com", "value": "1"},{"id": 21, "name": "https://businessinsider.com", "value": "15"},{"id": 22, "name": "https://aol.com", "value": "2"},{"id": 23, "name": "https://ft.com", "value": "4"},{"id": 24, "name": "https://wikia.com", "value": "441"},{"id": 25, "name": "https://techcrunch.com", "value": "36"},{"id": 26, "name": "https://huffingtonpost.com", "value": "0"},{"id": 27, "name": "https://wired.com", "value": "162"},{"id": 28, "name": "https://bloomberg.com", "value": "0, 0"},{"id": 29, "name": "https://independent.co.uk", "value": "229"},{"id": 30, "name": "https://themeforest.net", "value": "143"},{"id": 31, "name": "https://harvard.edu", "value": "680"},{"id": 32, "name": "https://latimes.com", "value": "173"},{"id": 33, "name": "https://mirror.co.uk", "value": "53"},{"id": 34, "name": "https://usatoday.com", "value": "43"},{"id": 35, "name": "https://fandom.com", "value": "31"},{"id": 36, "name": "https://www.gov.uk", "value": "1732"},{"id": 37, "name": "https://de.wikipedia.org", "value": "47"},{"id": 38, "name": "https://time.com", "value": "20"},{"id": 39, "name": "https://it.wikipedia.org", "value": "6615"},{"id": 40, "name": "https://bandcamp.com", "value": "0"},{"id": 41, "name": "https://sciencedaily.com", "value": "430"},{"id": 42, "name": "https://sedo.com", "value": "0"},{"id": 43, "name": "https://www.noaa.gov", "value": "154"},{"id": 44, "name": "https://m.wikipedia.org", "value": "29796"},{"id": 45, "name": "https://blackberry.com", "value": "470"},{"id": 46, "name": "https://vox.com", "value": "298"},{"id": 47, "name": "https://ign.com", "value": "20"},{"id": 48, "name": "https://theatlantic.com", "value": "15"},{"id": 49, "name": "https://ox.ac.uk", "value": "119"},{"id": 50, "name": "https://fortune.com", "value": "1285"},{"id": 51, "name": "https://www.worldbank.org/", "value": "7023"},{"id": 52, "name": "https://huffpost.com", "value": "0"},{"id": 53, "name": "https://lemonde.fr", "value": "0"},{"id": 54, "name": "https://parallels.com", "value": "13"},{"id": 55, "name": "https://imageshack.us", "value": "20"},{"id": 56, "name": "https://bt.com", "value": "230"},{"id": 57, "name": "https://yale.edu", "value": "17048"},{"id": 58, "name": "https://express.co.uk", "value": "164"},{"id": 59, "name": "https://ja.wikipedia.org", "value": "3534"},{"id": 60, "name": "https://tes.com", "value": "0, 0"},{"id": 61, "name": "https://smh.com.au", "value": "9"},{"id": 62, "name": "https://hollywoodreporter.com", "value": "86"},{"id": 63, "name": "https://www.wikipedia.org", "value": "29862"},{"id": 64, "name": "https://en.unesco.org", "value": "683"},{"id": 65, "name": "https://namecheap.com", "value": "60"},{"id": 66, "name": "https://id.wikipedia.org", "value": "8774"},{"id": 67, "name": "https://sfgate.com", "value": "60"},{"id": 68, "name": "https://addtoany.com", "value": "10352"},{"id": 69, "name": "https://target.com", "value": "522"},{"id": 70, "name": "https://metro.co.uk", "value": "8"},{"id": 71, "name": "https://yelp.com", "value": "0, 0"},{"id": 72, "name": "https://psychologytoday.com", "value": "462"},{"id": 73, "name": "https://engadget.com", "value": "2"},{"id": 74, "name": "https://buzzfeed.com", "value": "21"},{"id": 75, "name": "https://cbsnews.com", "value": "48"},{"id": 76, "name": "https://fastcompany.com", "value": "192"},{"id": 77, "name": "https://guardian.co.uk", "value": "133"},{"id": 78, "name": "https://yahoo.co.jp", "value": "0"},{"id": 79, "name": "https://nature.com", "value": "0"},{"id": 80, "name": "https://bloglovin.com", "value": "0"},{"id": 81, "name": "https://wikihow.com", "value": "2575"},{"id": 82, "name": "https://eventbrite.com", "value": "57"},{"id": 83, "name": "https://princeton.edu", "value": "5"},{"id": 84, "name": "https://disqus.com", "value": "10"},{"id": 85, "name": "https://loc.gov", "value": "0"},{"id": 86, "name": "https://urbandictionary.com", "value": "2419"},{"id": 87, "name": "https://vice.com", "value": "88"},{"id": 88, "name": "https://ted.com", "value": "40"},{"id": 89, "name": "https://pl.wikipedia.org", "value": "4606"},{"id": 90, "name": "https://finance.yahoo.com", "value": "1"},{"id": 91, "name": "https://kickstarter.com", "value": "0"},{"id": 92, "name": "https://www.elmundo.es", "value": "16"},{"id": 93, "name": "https://theverge.com", "value": "104"},{"id": 94, "name": "https://about.com", "value": "439362"},{"id": 95, "name": "https://my.yahoo.com", "value": "0"},{"id": 96, "name": "https://standard.co.uk", "value": "2"},{"id": 97, "name": "https://gizmodo.com", "value": "43"},{"id": 98, "name": "https://columbia.edu", "value": "92"},{"id": 99, "name": "https://imageshack.com", "value": "47"},{"id": 100, "name": "https://ru.wikipedia.org", "value": "127"},{"id": 101, "name": "https://www.over-blog.com", "value": "2806"},{"id": 102, "name": "https://newsweek.com", "value": "102"},{"id": 103, "name": "https://economist.com", "value": "345"},{"id": 104, "name": "https://zendesk.com", "value": "73"},{"id": 105, "name": "https://utexas.edu", "value": "36"},{"id": 106, "name": "https://boston.com", "value": "239"},{"id": 107, "name": "https://sina.com.cn", "value": "2"},{"id": 108, "name": "https://corriere.it", "value": "15"},{"id": 109, "name": "https://chron.com", "value": "9"},{"id": 110, "name": "https://airbnb.com", "value": "275"},{"id": 111, "name": "https://billboard.com", "value": "1"},{"id": 112, "name": "https://venturebeat.com", "value": "1048"},{"id": 113, "name": "https://groups.yahoo.com", "value": "0"},{"id": 114, "name": "https://history.com", "value": "2239"},{"id": 115, "name": "https://ap.org", "value": "237"},{"id": 116, "name": "https://imgur.com", "value": "495"},{"id": 117, "name": "https://prnewswire.com", "value": "13774"},{"id": 118, "name": "https://answers.yahoo.com", "value": "0"},{"id": 119, "name": "https://dictionary.com", "value": "6636"},{"id": 120, "name": "https://example.com", "value": "425732"},{"id": 121, "name": "https://broadcom.com", "value": "3322"},{"id": 122, "name": "https://inc.com", "value": "10203"},{"id": 123, "name": "https://trustpilot.com", "value": "41"},{"id": 124, "name": "https://cbslocal.com", "value": "227"},{"id": 125, "name": "https://newyorker.com", "value": "92"},{"id": 126, "name": "https://adweek.com", "value": "68"},{"id": 127, "name": "https://wiktionary.org", "value": "29451"},{"id": 128, "name": "https://politico.com", "value": "57"},{"id": 129, "name": "https://usgs.gov", "value": "246"},{"id": 130, "name": "https://dribbble.com", "value": "0"},{"id": 131, "name": "https://sports.yahoo.com", "value": "3"},{"id": 132, "name": "https://upenn.edu", "value": "683, 683, 683"},{"id": 133, "name": "https://csmonitor.com", "value": "134"},{"id": 134, "name": "https://20minutos.es", "value": "24"},{"id": 135, "name": "https://mystrikingly.com", "value": "32914"},{"id": 136, "name": "https://mozilla.com", "value": "76"},{"id": 137, "name": "https://scientificamerican.com", "value": "3, 3, 3"},{"id": 138, "name": "https://psu.edu", "value": "1983"},{"id": 139, "name": "https://entrepreneur.com", "value": "49, 49"},{"id": 140, "name": "https://techradar.com", "value": "12"},{"id": 141, "name": "https://gitlab.com", "value": "569"},{"id": 142, "name": "https://sylabs.io", "value": "0"},{"id": 143, "name": "https://www.observe.ai", "value": "401"},{"id": 144, "name": "https://www.hellosign.com", "value": "2229"},{"id": 145, "name": "https://www.docusign.com", "value": "1655"},{"id": 146, "name": "https://www.docker.com", "value": "9381"},{"id": 147, "name": "https://us-rse.org", "value": "0"}],
lookup: { "1": "https://cloudflare.com", "2": "https://en.wikipedia.org", "3": "https://vimeo.com", "4": "https://mozilla.org", "5": "https://es.wikipedia.org", "6": "https://cnn.com", "7": "https://nytimes.com", "8": "https://jimdofree.com", "9": "https://theguardian.com", "10": "https://who.int", "11": "https://bbc.com", "12": "https://nih.gov", "13": "https://reuters.com", "14": "https://pt.wikipedia.org", "15": "https://fr.wikipedia.org", "16": "https://uol.com.br", "17": "https://creativecommons.org", "18": "https://wikimedia.org", "19": "https://forbes.com", "20": "https://www.yahoo.com", "21": "https://businessinsider.com", "22": "https://aol.com", "23": "https://ft.com", "24": "https://wikia.com", "25": "https://techcrunch.com", "26": "https://huffingtonpost.com", "27": "https://wired.com", "28": "https://bloomberg.com", "29": "https://independent.co.uk", "30": "https://themeforest.net", "31": "https://harvard.edu", "32": "https://latimes.com", "33": "https://mirror.co.uk", "34": "https://usatoday.com", "35": "https://fandom.com", "36": "https://www.gov.uk", "37": "https://de.wikipedia.org", "38": "https://time.com", "39": "https://it.wikipedia.org", "40": "https://bandcamp.com", "41": "https://sciencedaily.com", "42": "https://sedo.com", "43": "https://www.noaa.gov", "44": "https://m.wikipedia.org", "45": "https://blackberry.com", "46": "https://vox.com", "47": "https://ign.com", "48": "https://theatlantic.com", "49": "https://ox.ac.uk", "50": "https://fortune.com", "51": "https://www.worldbank.org/", "52": "https://huffpost.com", "53": "https://lemonde.fr", "54": "https://parallels.com", "55": "https://imageshack.us", "56": "https://bt.com", "57": "https://yale.edu", "58": "https://express.co.uk", "59": "https://ja.wikipedia.org", "60": "https://tes.com", "61": "https://smh.com.au", "62": "https://hollywoodreporter.com", "63": "https://www.wikipedia.org", "64": "https://en.unesco.org", "65": "https://namecheap.com", "66": "https://id.wikipedia.org", "67": "https://sfgate.com", "68": "https://addtoany.com", "69": "https://target.com", "70": "https://metro.co.uk", "71": "https://yelp.com", "72": "https://psychologytoday.com", "73": "https://engadget.com", "74": "https://buzzfeed.com", "75": "https://cbsnews.com", "76": "https://fastcompany.com", "77": "https://guardian.co.uk", "78": "https://yahoo.co.jp", "79": "https://nature.com", "80": "https://bloglovin.com", "81": "https://wikihow.com", "82": "https://eventbrite.com", "83": "https://princeton.edu", "84": "https://disqus.com", "85": "https://loc.gov", "86": "https://urbandictionary.com", "87": "https://vice.com", "88": "https://ted.com", "89": "https://pl.wikipedia.org", "90": "https://finance.yahoo.com", "91": "https://kickstarter.com", "92": "https://www.elmundo.es", "93": "https://theverge.com", "94": "https://about.com", "95": "https://my.yahoo.com", "96": "https://standard.co.uk", "97": "https://gizmodo.com", "98": "https://columbia.edu", "99": "https://imageshack.com", "100": "https://ru.wikipedia.org", "101": "https://www.over-blog.com", "102": "https://newsweek.com", "103": "https://economist.com", "104": "https://zendesk.com", "105": "https://utexas.edu", "106": "https://boston.com", "107": "https://sina.com.cn", "108": "https://corriere.it", "109": "https://chron.com", "110": "https://airbnb.com", "111": "https://billboard.com", "112": "https://venturebeat.com", "113": "https://groups.yahoo.com", "114": "https://history.com", "115": "https://ap.org", "116": "https://imgur.com", "117": "https://prnewswire.com", "118": "https://answers.yahoo.com", "119": "https://dictionary.com", "120": "https://example.com", "121": "https://broadcom.com", "122": "https://inc.com", "123": "https://trustpilot.com", "124": "https://cbslocal.com", "125": "https://newyorker.com", "126": "https://adweek.com", "127": "https://wiktionary.org", "128": "https://politico.com", "129": "https://usgs.gov", "130": "https://dribbble.com", "131": "https://sports.yahoo.com", "132": "https://upenn.edu", "133": "https://csmonitor.com", "134": "https://20minutos.es", "135": "https://mystrikingly.com", "136": "https://mozilla.com", "137": "https://scientificamerican.com", "138": "https://psu.edu", "139": "https://entrepreneur.com", "140": "https://techradar.com", "141": "https://gitlab.com", "142": "https://sylabs.io", "143": "https://www.observe.ai", "144": "https://www.hellosign.com", "145": "https://www.docusign.com", "146": "https://www.docker.com", "147": "https://us-rse.org" },
sort: 'id',
sortDir:'asc',
page: 0,
pageSize: 25
}),
methods: {
viewRow: function(event) {
var rowId = $(event.target).closest('tr').find('td:first').text()
var site = this.lookup[rowId].replace(/(^\w+:|^)\/\//, '');
document.location = "/url-headers/site/" + site
},
sortBy: function(s) {
if (s === this.sort) {
this.sortDir = (this.sortDir === 'asc') ? 'desc' : 'asc';
} else {
this.sortDir = 'asc';
}
this.sort = s;
},
isActiveSort: function(s) {
return this.sort === s;
},
hasPage: function(dir) {
if (dir === -1 && (this.page > 0)) return true;
if (dir === 1 && (((this.page+1)*this.pageSize) < this.rows.length)) return true;
return false;
},
prevPage: function() {
if (this.hasPage(-1)) this.page--;
},
nextPage: function() {
if (this.hasPage(1)) this.page++;
}
},
computed: {
sortedRows: function() {
return this.rows.sort((a, b) => {
let dir = (this.sortDir === 'asc') ? 1 : -1;
if (a[this.sort] < b[this.sort]) {
return -1 * dir;
} else if (a[this.sort] > b[this.sort]) {
return 1 * dir;
} else {
return 0;
}
}).filter((row, idx) => {
let s = this.page*this.pageSize;
let e = (this.page+1)*this.pageSize;
return (idx >= s && idx < e);
});
},
pageSizeModel: {
get() {
return this.pageSize;
},
set(v) {
this.pageSize = v;
this.page = 0;
}
}
},
filters: {
capitalize: function (v) {
if (!v) return ''
v = v.toString()
return v.charAt(0).toUpperCase() + v.slice(1)
}
}
}).$mount('#app');
</script>
</body>
</html>