-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
315 lines (287 loc) · 10.8 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>Site: https://netvibes.com</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">Headers and Cookies for <b>https://netvibes.com</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": "server", "value": "nginx"},{"id": 2, "name": "date", "value": "Tue, 26 May 2020 18:04:38 GMT"},{"id": 3, "name": "content-type", "value": "text/html; charset=utf-8"},{"id": 4, "name": "transfer-encoding", "value": "chunked"},{"id": 5, "name": "connection", "value": "keep-alive"},{"id": 6, "name": "vary", "value": "Accept-Encoding"},{"id": 7, "name": "x-powered-by", "value": "PHP/7.3.6"},{"id": 8, "name": "expires", "value": "Sun, 19 Nov 1978 05:00:00 GMT"},{"id": 9, "name": "cache-control", "value": "no-cache, must-revalidate"},{"id": 10, "name": "x-content-type-options", "value": "nosniff"},{"id": 11, "name": "content-language", "value": "en"},{"id": 12, "name": "x-frame-options", "value": "SAMEORIGIN"},{"id": 13, "name": "x-generator", "value": "Netvibes"},{"id": 14, "name": "link", "value": "<https://www.netvibes.com/en>; rel='canonical'"},{"id": 15, "name": "x-men", "value": "nvhome2.vm"},{"id": 16, "name": "content-encoding", "value": "gzip"},{"id": 17, "name": "x-slb", "value": "slb5"}],
lookup: { "1": "server", "2": "date", "3": "content-type", "4": "transfer-encoding", "5": "connection", "6": "vary", "7": "x-powered-by", "8": "expires", "9": "cache-control", "10": "x-content-type-options", "11": "content-language", "12": "x-frame-options", "13": "x-generator", "14": "link", "15": "x-men", "16": "content-encoding", "17": "x-slb" },
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]
document.location = "/url-headers/header/" + 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>