-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
315 lines (287 loc) · 16 KB
/
index.html
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 Cookie 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>DOMAIN</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://adobe.com", "value": ""},{"id": 2, "name": "https://linkedin.com", "value": ""},{"id": 3, "name": "https://github.com", "value": ""},{"id": 4, "name": "https://medium.com", "value": ""},{"id": 5, "name": "https://cnn.com", "value": ""},{"id": 6, "name": "https://nytimes.com", "value": ""},{"id": 7, "name": "https://dropbox.com", "value": ""},{"id": 8, "name": "https://paypal.com", "value": ""},{"id": 9, "name": "https://imdb.com", "value": ""},{"id": 10, "name": "https://www.yahoo.com", "value": ""},{"id": 11, "name": "https://aliexpress.com", "value": ""},{"id": 12, "name": "https://aol.com", "value": ""},{"id": 13, "name": "https://ft.com", "value": ""},{"id": 14, "name": "https://techcrunch.com", "value": ""},{"id": 15, "name": "https://issuu.com", "value": ""},{"id": 16, "name": "https://ebay.com", "value": ""},{"id": 17, "name": "https://huffingtonpost.com", "value": ""},{"id": 18, "name": "https://wsj.com", "value": ""},{"id": 19, "name": "https://bit.ly", "value": ""},{"id": 20, "name": "https://wired.com", "value": ""},{"id": 21, "name": "https://amazon.de", "value": ""},{"id": 22, "name": "https://ok.ru", "value": ""},{"id": 23, "name": "https://amazon.co.jp", "value": ""},{"id": 24, "name": "https://twitter.com", "value": ""},{"id": 25, "name": "https://terra.com.br", "value": ""},{"id": 26, "name": "https://amazon.co.uk", "value": ""},{"id": 27, "name": "https://thesun.co.uk", "value": ""},{"id": 28, "name": "https://amazon.it", "value": ""},{"id": 29, "name": "https://walmart.com", "value": ""},{"id": 30, "name": "https://dell.com", "value": ""},{"id": 31, "name": "https://www.weebly.com", "value": ""},{"id": 32, "name": "https://theatlantic.com", "value": ""},{"id": 33, "name": "https://yandex.ru", "value": ""},{"id": 34, "name": "https://foursquare.com", "value": ""},{"id": 35, "name": "https://huffpost.com", "value": ""},{"id": 36, "name": "https://spotify.com", "value": ""},{"id": 37, "name": "https://amazon.es", "value": ""},{"id": 38, "name": "https://channel4.com", "value": ""},{"id": 39, "name": "https://tes.com", "value": ""},{"id": 40, "name": "https://www.ikea.com", "value": ""},{"id": 41, "name": "https://www.wikipedia.org", "value": ""},{"id": 42, "name": "https://en.unesco.org", "value": ""},{"id": 43, "name": "https://surveymonkey.com", "value": ""},{"id": 44, "name": "https://target.com", "value": ""},{"id": 45, "name": "https://amazon.fr", "value": ""},{"id": 46, "name": "https://yelp.com", "value": ""},{"id": 47, "name": "https://engadget.com", "value": ""},{"id": 48, "name": "https://cornell.edu", "value": ""},{"id": 49, "name": "https://www.wix.com", "value": ""},{"id": 50, "name": "https://britannica.com", "value": ""},{"id": 51, "name": "https://sciencedirect.com", "value": ""},{"id": 52, "name": "https://shutterstock.com", "value": ""},{"id": 53, "name": "https://scoop.it", "value": ""},{"id": 54, "name": "https://cnbc.com", "value": ""},{"id": 55, "name": "https://rambler.ru", "value": ""},{"id": 56, "name": "https://instagram.com", "value": ""},{"id": 57, "name": "https://researchgate.net", "value": ""},{"id": 58, "name": "https://ted.com", "value": ""},{"id": 59, "name": "https://4shared.com", "value": ""},{"id": 60, "name": "https://tripadvisor.com", "value": ""},{"id": 61, "name": "https://netflix.com", "value": ""},{"id": 62, "name": "https://my.yahoo.com", "value": ""},{"id": 63, "name": "https://box.com", "value": ""},{"id": 64, "name": "https://quora.com", "value": ""},{"id": 65, "name": "https://economist.com", "value": ""},{"id": 66, "name": "https://thoughtco.com", "value": ""},{"id": 67, "name": "https://billboard.com", "value": ""},{"id": 68, "name": "https://evernote.com", "value": ""},{"id": 69, "name": "https://ebay.co.uk", "value": ""},{"id": 70, "name": "https://offset.com", "value": ""},{"id": 71, "name": "https://xing.com", "value": ""},{"id": 72, "name": "https://newyorker.com", "value": ""},{"id": 73, "name": "https://mixcloud.com", "value": ""},{"id": 74, "name": "https://amazon.in", "value": ""},{"id": 75, "name": "https://www.pizzahut.com", "value": ""},{"id": 76, "name": "https://www.lyft.com", "value": ""},{"id": 77, "name": "https://zoom.us", "value": ""},{"id": 78, "name": "https://www.salesforce.com", "value": ""},{"id": 79, "name": "https://www.ultimatesoftware.com", "value": ""},{"id": 80, "name": "https://www.vmware.com", "value": ""}],
lookup: { "1": "https://adobe.com", "2": "https://linkedin.com", "3": "https://github.com", "4": "https://medium.com", "5": "https://cnn.com", "6": "https://nytimes.com", "7": "https://dropbox.com", "8": "https://paypal.com", "9": "https://imdb.com", "10": "https://www.yahoo.com", "11": "https://aliexpress.com", "12": "https://aol.com", "13": "https://ft.com", "14": "https://techcrunch.com", "15": "https://issuu.com", "16": "https://ebay.com", "17": "https://huffingtonpost.com", "18": "https://wsj.com", "19": "https://bit.ly", "20": "https://wired.com", "21": "https://amazon.de", "22": "https://ok.ru", "23": "https://amazon.co.jp", "24": "https://twitter.com", "25": "https://terra.com.br", "26": "https://amazon.co.uk", "27": "https://thesun.co.uk", "28": "https://amazon.it", "29": "https://walmart.com", "30": "https://dell.com", "31": "https://www.weebly.com", "32": "https://theatlantic.com", "33": "https://yandex.ru", "34": "https://foursquare.com", "35": "https://huffpost.com", "36": "https://spotify.com", "37": "https://amazon.es", "38": "https://channel4.com", "39": "https://tes.com", "40": "https://www.ikea.com", "41": "https://www.wikipedia.org", "42": "https://en.unesco.org", "43": "https://surveymonkey.com", "44": "https://target.com", "45": "https://amazon.fr", "46": "https://yelp.com", "47": "https://engadget.com", "48": "https://cornell.edu", "49": "https://www.wix.com", "50": "https://britannica.com", "51": "https://sciencedirect.com", "52": "https://shutterstock.com", "53": "https://scoop.it", "54": "https://cnbc.com", "55": "https://rambler.ru", "56": "https://instagram.com", "57": "https://researchgate.net", "58": "https://ted.com", "59": "https://4shared.com", "60": "https://tripadvisor.com", "61": "https://netflix.com", "62": "https://my.yahoo.com", "63": "https://box.com", "64": "https://quora.com", "65": "https://economist.com", "66": "https://thoughtco.com", "67": "https://billboard.com", "68": "https://evernote.com", "69": "https://ebay.co.uk", "70": "https://offset.com", "71": "https://xing.com", "72": "https://newyorker.com", "73": "https://mixcloud.com", "74": "https://amazon.in", "75": "https://www.pizzahut.com", "76": "https://www.lyft.com", "77": "https://zoom.us", "78": "https://www.salesforce.com", "79": "https://www.ultimatesoftware.com", "80": "https://www.vmware.com" },
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>