Revision de038a27
Added by Stephen Beaver over 9 years ago
src/etc/pfSense.obsoletedfiles | ||
---|---|---|
837 | 837 |
/usr/local/www/services_proxyarp_edit.php |
838 | 838 |
/usr/local/www/services_usermanager.php |
839 | 839 |
/usr/local/www/shortcuts/pkg_upnp.inc |
840 |
/usr/local/www/sortable/sortable.min.js |
|
840 | 841 |
/usr/local/www/status_slbd_pool.php |
841 | 842 |
/usr/local/www/status_slbd_vs.php |
842 | 843 |
/usr/local/www/system_advanced.php |
src/usr/local/www/foot.inc | ||
---|---|---|
26 | 26 |
<script src="/bootstrap/js/bootstrap.min.js"></script> |
27 | 27 |
<script src="/jquery/pfSense.js"></script> |
28 | 28 |
<script src="/jquery/pfSenseHelpers.js"></script> |
29 |
<script src="sortable/sortable.min.js"></script>
|
|
29 |
<script src="sortable/sortable.js"></script> |
|
30 | 30 |
|
31 | 31 |
<script> |
32 | 32 |
// Un-hide the "Top of page" icons if the page is larger than the window |
src/usr/local/www/services_unbound.php | ||
---|---|---|
429 | 429 |
<?=strtolower($hostent['domain'])?> |
430 | 430 |
</td> |
431 | 431 |
<td> |
432 |
<?=$hostent['ip']?>
|
|
432 |
<?=$hostent['ip']?> |
|
433 | 433 |
</td> |
434 | 434 |
<td> |
435 | 435 |
<?=htmlspecialchars($hostent['descr'])?> |
src/usr/local/www/sortable/sortable.js | ||
---|---|---|
1 |
(function() { |
|
2 |
var SELECTOR, addEventListener, clickEvents, numberRegExp, sortable, touchDevice, trimRegExp; |
|
3 |
|
|
4 |
SELECTOR = 'table[data-sortable]'; |
|
5 |
|
|
6 |
numberRegExp = /^-?[£$¤]?[\d,.]+%?$/; |
|
7 |
|
|
8 |
trimRegExp = /^\s+|\s+$/g; |
|
9 |
|
|
10 |
clickEvents = ['click']; |
|
11 |
|
|
12 |
touchDevice = 'ontouchstart' in document.documentElement; |
|
13 |
|
|
14 |
if (touchDevice) { |
|
15 |
clickEvents.push('touchstart'); |
|
16 |
} |
|
17 |
|
|
18 |
addEventListener = function(el, event, handler) { |
|
19 |
if (el.addEventListener != null) { |
|
20 |
return el.addEventListener(event, handler, false); |
|
21 |
} else { |
|
22 |
return el.attachEvent("on" + event, handler); |
|
23 |
} |
|
24 |
}; |
|
25 |
|
|
26 |
sortable = { |
|
27 |
init: function(options) { |
|
28 |
var table, tables, _i, _len, _results; |
|
29 |
if (options == null) { |
|
30 |
options = {}; |
|
31 |
} |
|
32 |
|
|
33 |
if (options.selector == null) { |
|
34 |
options.selector = SELECTOR; |
|
35 |
} |
|
36 |
|
|
37 |
tables = document.querySelectorAll(options.selector); |
|
38 |
_results = []; |
|
39 |
|
|
40 |
for (_i = 0, _len = tables.length; _i < _len; _i++) { |
|
41 |
table = tables[_i]; |
|
42 |
_results.push(sortable.initTable(table)); |
|
43 |
} |
|
44 |
|
|
45 |
return _results; |
|
46 |
}, |
|
47 |
|
|
48 |
initTable: function(table) { |
|
49 |
var i, th, ths, _i, _len, _ref; |
|
50 |
|
|
51 |
if (((_ref = table.tHead) != null ? _ref.rows.length : void 0) !== 1) { |
|
52 |
return; |
|
53 |
} |
|
54 |
|
|
55 |
if (table.getAttribute('data-sortable-initialized') === 'true') { |
|
56 |
return; |
|
57 |
} |
|
58 |
|
|
59 |
table.setAttribute('data-sortable-initialized', 'true'); |
|
60 |
ths = table.querySelectorAll('th'); |
|
61 |
|
|
62 |
for (i = _i = 0, _len = ths.length; _i < _len; i = ++_i) { |
|
63 |
th = ths[i]; |
|
64 |
|
|
65 |
if (th.getAttribute('data-sortable') !== 'false') { |
|
66 |
sortable.setupClickableTH(table, th, i); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
return table; |
|
71 |
}, |
|
72 |
|
|
73 |
setupClickableTH: function(table, th, i) { |
|
74 |
var eventName, onClick, type, _i, _len, _results; |
|
75 |
type = sortable.getColumnType(table, i); |
|
76 |
onClick = function(e) { |
|
77 |
var compare, item, newSortedDirection, position, row, rowArray, sorted, sortedDirection, tBody, ths, value, _compare, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1; |
|
78 |
|
|
79 |
if (e.handled !== true) { |
|
80 |
e.handled = true; |
|
81 |
} else { |
|
82 |
return false; |
|
83 |
} |
|
84 |
|
|
85 |
sorted = this.getAttribute('data-sorted') === 'true'; |
|
86 |
sortedDirection = this.getAttribute('data-sorted-direction'); |
|
87 |
|
|
88 |
if (sorted) { |
|
89 |
newSortedDirection = sortedDirection === 'ascending' ? 'descending' : 'ascending'; |
|
90 |
} else { |
|
91 |
newSortedDirection = type.defaultSortDirection; |
|
92 |
} |
|
93 |
|
|
94 |
ths = this.parentNode.querySelectorAll('th'); |
|
95 |
|
|
96 |
for (_i = 0, _len = ths.length; _i < _len; _i++) { |
|
97 |
th = ths[_i]; |
|
98 |
th.setAttribute('data-sorted', 'false'); |
|
99 |
th.removeAttribute('data-sorted-direction'); |
|
100 |
} |
|
101 |
|
|
102 |
this.setAttribute('data-sorted', 'true'); |
|
103 |
this.setAttribute('data-sorted-direction', newSortedDirection); |
|
104 |
tBody = table.tBodies[0]; |
|
105 |
rowArray = []; |
|
106 |
|
|
107 |
if (!sorted) { |
|
108 |
if (type.compare != null) { |
|
109 |
_compare = type.compare; |
|
110 |
} else { |
|
111 |
_compare = function(a, b) { |
|
112 |
return b - a; |
|
113 |
}; |
|
114 |
} |
|
115 |
|
|
116 |
compare = function(a, b) { |
|
117 |
if (a[0] === b[0]) { |
|
118 |
return a[2] - b[2]; |
|
119 |
} |
|
120 |
|
|
121 |
if (type.reverse) { |
|
122 |
return _compare(b[0], a[0]); |
|
123 |
} else { |
|
124 |
return _compare(a[0], b[0]); |
|
125 |
} |
|
126 |
}; |
|
127 |
|
|
128 |
_ref = tBody.rows; |
|
129 |
|
|
130 |
for (position = _j = 0, _len1 = _ref.length; _j < _len1; position = ++_j) { |
|
131 |
row = _ref[position]; |
|
132 |
value = sortable.getNodeValue(row.cells[i]); |
|
133 |
|
|
134 |
if (type.comparator != null) { |
|
135 |
value = type.comparator(value); |
|
136 |
} |
|
137 |
|
|
138 |
rowArray.push([value, row, position]); |
|
139 |
} |
|
140 |
|
|
141 |
rowArray.sort(compare); |
|
142 |
|
|
143 |
for (_k = 0, _len2 = rowArray.length; _k < _len2; _k++) { |
|
144 |
row = rowArray[_k]; |
|
145 |
tBody.appendChild(row[1]); |
|
146 |
} |
|
147 |
} else { |
|
148 |
_ref1 = tBody.rows; |
|
149 |
|
|
150 |
for (_l = 0, _len3 = _ref1.length; _l < _len3; _l++) { |
|
151 |
item = _ref1[_l]; |
|
152 |
rowArray.push(item); |
|
153 |
} |
|
154 |
|
|
155 |
rowArray.reverse(); |
|
156 |
|
|
157 |
for (_m = 0, _len4 = rowArray.length; _m < _len4; _m++) { |
|
158 |
row = rowArray[_m]; |
|
159 |
tBody.appendChild(row); |
|
160 |
} |
|
161 |
} |
|
162 |
|
|
163 |
if (typeof window['CustomEvent'] === 'function') { |
|
164 |
return typeof table.dispatchEvent === "function" ? table.dispatchEvent(new CustomEvent('Sortable.sorted', { |
|
165 |
bubbles: true |
|
166 |
})) : void 0; |
|
167 |
} |
|
168 |
}; |
|
169 |
|
|
170 |
_results = []; |
|
171 |
|
|
172 |
for (_i = 0, _len = clickEvents.length; _i < _len; _i++) { |
|
173 |
eventName = clickEvents[_i]; |
|
174 |
_results.push(addEventListener(th, eventName, onClick)); |
|
175 |
} |
|
176 |
|
|
177 |
return _results; |
|
178 |
}, |
|
179 |
|
|
180 |
getColumnType: function(table, i) { |
|
181 |
var row, specified, text, type, _i, _j, _len, _len1, _ref, _ref1, _ref2; |
|
182 |
specified = (_ref = table.querySelectorAll('th')[i]) != null ? _ref.getAttribute('data-sortable-type') : void 0; |
|
183 |
|
|
184 |
if (specified != null) { |
|
185 |
return sortable.typesObject[specified]; |
|
186 |
} |
|
187 |
|
|
188 |
_ref1 = table.tBodies[0].rows; |
|
189 |
|
|
190 |
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { |
|
191 |
row = _ref1[_i]; |
|
192 |
text = sortable.getNodeValue(row.cells[i]); |
|
193 |
_ref2 = sortable.types; |
|
194 |
|
|
195 |
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { |
|
196 |
type = _ref2[_j]; |
|
197 |
if (type.match(text)) { |
|
198 |
return type; |
|
199 |
} |
|
200 |
} |
|
201 |
} |
|
202 |
|
|
203 |
return sortable.typesObject.alpha; |
|
204 |
}, |
|
205 |
|
|
206 |
getNodeValue: function(node) { |
|
207 |
var dataValue; |
|
208 |
|
|
209 |
if (!node) { |
|
210 |
return ''; |
|
211 |
} |
|
212 |
|
|
213 |
dataValue = node.getAttribute('data-value'); |
|
214 |
if (dataValue !== null) { |
|
215 |
return dataValue; |
|
216 |
} |
|
217 |
|
|
218 |
if (typeof node.innerText !== 'undefined') { |
|
219 |
return node.innerText.replace(trimRegExp, ''); |
|
220 |
} |
|
221 |
|
|
222 |
return node.textContent.replace(trimRegExp, ''); |
|
223 |
}, |
|
224 |
|
|
225 |
setupTypes: function(types) { |
|
226 |
var type, _i, _len, _results; |
|
227 |
sortable.types = types; |
|
228 |
sortable.typesObject = {}; |
|
229 |
_results = []; |
|
230 |
|
|
231 |
for (_i = 0, _len = types.length; _i < _len; _i++) { |
|
232 |
type = types[_i]; |
|
233 |
_results.push(sortable.typesObject[type.name] = type); |
|
234 |
} |
|
235 |
|
|
236 |
return _results; |
|
237 |
} |
|
238 |
}; |
|
239 |
|
|
240 |
// ip type needs to go first to prevent 'numeric" from catching it |
|
241 |
// 3 dots = IPv4 |
|
242 |
// 2 colons = IPv6 |
|
243 |
// Crude but sufficient here |
|
244 |
sortable.setupTypes([ |
|
245 |
{ |
|
246 |
name: 'ip', |
|
247 |
defaultSortDirection: 'ascending', |
|
248 |
match: function(a) { |
|
249 |
v4 = a.split(".").length; |
|
250 |
v6 = a.split(":").length; |
|
251 |
return ((v4 == 4) || (v6 > 2)); |
|
252 |
}, |
|
253 |
compare: function(a, b) { |
|
254 |
a = padip(a); |
|
255 |
b = padip(b); |
|
256 |
return ((a < b) ? -1 : ((a > b) ? 1 : 0)); |
|
257 |
} |
|
258 |
}, { |
|
259 |
name: 'numeric', |
|
260 |
defaultSortDirection: 'descending', |
|
261 |
|
|
262 |
match: function(a) { |
|
263 |
return a.match(numberRegExp); |
|
264 |
}, |
|
265 |
|
|
266 |
comparator: function(a) { |
|
267 |
return parseFloat(a.replace(/[^0-9.-]/g, ''), 10) || 0; |
|
268 |
} |
|
269 |
}, { |
|
270 |
name: 'date', |
|
271 |
defaultSortDirection: 'ascending', |
|
272 |
reverse: true, |
|
273 |
match: function(a) { |
|
274 |
return !isNaN(Date.parse(a)); |
|
275 |
}, |
|
276 |
|
|
277 |
comparator: function(a) { |
|
278 |
return Date.parse(a) || 0; |
|
279 |
} |
|
280 |
}, { |
|
281 |
name: 'alpha', |
|
282 |
defaultSortDirection: 'ascending', |
|
283 |
match: function() { |
|
284 |
return true; |
|
285 |
}, |
|
286 |
|
|
287 |
compare: function(a, b) { |
|
288 |
return a.localeCompare(b); |
|
289 |
} |
|
290 |
} |
|
291 |
]); |
|
292 |
|
|
293 |
setTimeout(sortable.init, 0); |
|
294 |
|
|
295 |
if (typeof define === 'function' && define.amd) { |
|
296 |
define(function() { |
|
297 |
return sortable; |
|
298 |
}); |
|
299 |
} else if (typeof exports !== 'undefined') { |
|
300 |
module.exports = sortable; |
|
301 |
} else { |
|
302 |
window.Sortable = sortable; |
|
303 |
} |
|
304 |
}).call(this); |
|
305 |
|
|
306 |
// pad function is based on work by Dominique Fournier |
|
307 |
// https://www.datatables.net/plug-ins/sorting/ip-address |
|
308 |
function padip ( a ) { |
|
309 |
var i, item; |
|
310 |
var m = a.split("."), |
|
311 |
n = a.split(":"), |
|
312 |
x = "", |
|
313 |
xa = ""; |
|
314 |
|
|
315 |
if (m.length == 4) { |
|
316 |
// IPV4 |
|
317 |
for(i = 0; i < m.length; i++) { |
|
318 |
item = m[i]; |
|
319 |
|
|
320 |
if(item.length == 1) { |
|
321 |
x += "00" + item; |
|
322 |
} |
|
323 |
else if(item.length == 2) { |
|
324 |
x += "0" + item; |
|
325 |
} |
|
326 |
else { |
|
327 |
x += item; |
|
328 |
} |
|
329 |
} |
|
330 |
} else if (n.length > 0) { |
|
331 |
// IPV6 |
|
332 |
var count = 0; |
|
333 |
for(i = 0; i < n.length; i++) { |
|
334 |
item = n[i]; |
|
335 |
|
|
336 |
if (i > 0) { |
|
337 |
xa += ":"; |
|
338 |
} |
|
339 |
|
|
340 |
if(item.length === 0) { |
|
341 |
count += 0; |
|
342 |
} |
|
343 |
else if(item.length == 1) { |
|
344 |
xa += "000" + item; |
|
345 |
count += 4; |
|
346 |
} |
|
347 |
else if(item.length == 2) { |
|
348 |
xa += "00" + item; |
|
349 |
count += 4; |
|
350 |
} |
|
351 |
else if(item.length == 3) { |
|
352 |
xa += "0" + item; |
|
353 |
count += 4; |
|
354 |
} |
|
355 |
else { |
|
356 |
xa += item; |
|
357 |
count += 4; |
|
358 |
} |
|
359 |
} |
|
360 |
|
|
361 |
// Padding the :: |
|
362 |
n = xa.split(":"); |
|
363 |
var paddDone = 0; |
|
364 |
|
|
365 |
for (i = 0; i < n.length; i++) { |
|
366 |
item = n[i]; |
|
367 |
|
|
368 |
if (item.length === 0 && paddDone === 0) { |
|
369 |
for (var padding = 0 ; padding < (32-count) ; padding++) { |
|
370 |
x += "0"; |
|
371 |
paddDone = 1; |
|
372 |
} |
|
373 |
} |
|
374 |
else { |
|
375 |
x += item; |
|
376 |
} |
|
377 |
} |
|
378 |
} |
|
379 |
|
|
380 |
return x; |
|
381 |
} |
src/usr/local/www/sortable/sortable.min.js | ||
---|---|---|
1 |
/*! sortable.js 0.8.0 */ |
|
2 |
(function(){var a,b,c,d,e,f,g;a="table[data-sortable]",d=/^-?[£$¤]?[\d,.]+%?$/,g=/^\s+|\s+$/g,c=["click"],f="ontouchstart"in document.documentElement,f&&c.push("touchstart"),b=function(a,b,c){return null!=a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},e={init:function(b){var c,d,f,g,h;for(null==b&&(b={}),null==b.selector&&(b.selector=a),d=document.querySelectorAll(b.selector),h=[],f=0,g=d.length;g>f;f++)c=d[f],h.push(e.initTable(c));return h},initTable:function(a){var b,c,d,f,g,h;if(1===(null!=(h=a.tHead)?h.rows.length:void 0)&&"true"!==a.getAttribute("data-sortable-initialized")){for(a.setAttribute("data-sortable-initialized","true"),d=a.querySelectorAll("th"),b=f=0,g=d.length;g>f;b=++f)c=d[b],"false"!==c.getAttribute("data-sortable")&&e.setupClickableTH(a,c,b);return a}},setupClickableTH:function(a,d,f){var g,h,i,j,k,l;for(i=e.getColumnType(a,f),h=function(b){var c,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D;if(b.handled===!0)return!1;for(b.handled=!0,m="true"===this.getAttribute("data-sorted"),n=this.getAttribute("data-sorted-direction"),h=m?"ascending"===n?"descending":"ascending":i.defaultSortDirection,p=this.parentNode.querySelectorAll("th"),s=0,w=p.length;w>s;s++)d=p[s],d.setAttribute("data-sorted","false"),d.removeAttribute("data-sorted-direction");if(this.setAttribute("data-sorted","true"),this.setAttribute("data-sorted-direction",h),o=a.tBodies[0],l=[],m){for(D=o.rows,v=0,z=D.length;z>v;v++)g=D[v],l.push(g);for(l.reverse(),B=0,A=l.length;A>B;B++)k=l[B],o.appendChild(k)}else{for(r=null!=i.compare?i.compare:function(a,b){return b-a},c=function(a,b){return a[0]===b[0]?a[2]-b[2]:i.reverse?r(b[0],a[0]):r(a[0],b[0])},C=o.rows,j=t=0,x=C.length;x>t;j=++t)k=C[j],q=e.getNodeValue(k.cells[f]),null!=i.comparator&&(q=i.comparator(q)),l.push([q,k,j]);for(l.sort(c),u=0,y=l.length;y>u;u++)k=l[u],o.appendChild(k[1])}return"function"==typeof window.CustomEvent&&"function"==typeof a.dispatchEvent?a.dispatchEvent(new CustomEvent("Sortable.sorted",{bubbles:!0})):void 0},l=[],j=0,k=c.length;k>j;j++)g=c[j],l.push(b(d,g,h));return l},getColumnType:function(a,b){var c,d,f,g,h,i,j,k,l,m,n;if(d=null!=(l=a.querySelectorAll("th")[b])?l.getAttribute("data-sortable-type"):void 0,null!=d)return e.typesObject[d];for(m=a.tBodies[0].rows,h=0,j=m.length;j>h;h++)for(c=m[h],f=e.getNodeValue(c.cells[b]),n=e.types,i=0,k=n.length;k>i;i++)if(g=n[i],g.match(f))return g;return e.typesObject.alpha},getNodeValue:function(a){var b;return a?(b=a.getAttribute("data-value"),null!==b?b:"undefined"!=typeof a.innerText?a.innerText.replace(g,""):a.textContent.replace(g,"")):""},setupTypes:function(a){var b,c,d,f;for(e.types=a,e.typesObject={},f=[],c=0,d=a.length;d>c;c++)b=a[c],f.push(e.typesObject[b.name]=b);return f}},e.setupTypes([{name:"numeric",defaultSortDirection:"descending",match:function(a){return a.match(d)},comparator:function(a){return parseFloat(a.replace(/[^0-9.-]/g,""),10)||0}},{name:"date",defaultSortDirection:"ascending",reverse:!0,match:function(a){return!isNaN(Date.parse(a))},comparator:function(a){return Date.parse(a)||0}},{name:"alpha",defaultSortDirection:"ascending",match:function(){return!0},compare:function(a,b){return a.localeCompare(b)}}]),setTimeout(e.init,0),"function"==typeof define&&define.amd?define(function(){return e}):"undefined"!=typeof exports?module.exports=e:window.Sortable=e}).call(this); |
Also available in: Unified diff
Completed #5407