3264 |
rexy |
1 |
/*! © SpryMedia Ltd, Dominique Fournier, Brad Wasson, Peter Vilhan, Kevin Gilkey-Graham - datatables.net/license */
|
|
|
2 |
|
|
|
3 |
(function( factory ){
|
|
|
4 |
if ( typeof define === 'function' && define.amd ) {
|
|
|
5 |
// AMD
|
|
|
6 |
define( ['jquery', 'datatables.net'], function ( $ ) {
|
|
|
7 |
return factory( $, window, document );
|
|
|
8 |
} );
|
|
|
9 |
}
|
|
|
10 |
else if ( typeof exports === 'object' ) {
|
|
|
11 |
// CommonJS
|
|
|
12 |
var jq = require('jquery');
|
|
|
13 |
var cjsRequires = function (root, $) {
|
|
|
14 |
if ( ! $.fn.dataTable ) {
|
|
|
15 |
require('datatables.net')(root, $);
|
|
|
16 |
}
|
|
|
17 |
};
|
|
|
18 |
|
|
|
19 |
if (typeof window === 'undefined') {
|
|
|
20 |
module.exports = function (root, $) {
|
|
|
21 |
if ( ! root ) {
|
|
|
22 |
// CommonJS environments without a window global must pass a
|
|
|
23 |
// root. This will give an error otherwise
|
|
|
24 |
root = window;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
if ( ! $ ) {
|
|
|
28 |
$ = jq( root );
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
cjsRequires( root, $ );
|
|
|
32 |
return factory( $, root, root.document );
|
|
|
33 |
};
|
|
|
34 |
}
|
|
|
35 |
else {
|
|
|
36 |
cjsRequires( window, jq );
|
|
|
37 |
module.exports = factory( jq, window, window.document );
|
|
|
38 |
}
|
|
|
39 |
}
|
|
|
40 |
else {
|
|
|
41 |
// Browser
|
|
|
42 |
factory( jQuery, window, document );
|
|
|
43 |
}
|
|
|
44 |
}(function( $, window, document ) {
|
|
|
45 |
'use strict';
|
|
|
46 |
var DataTable = $.fn.dataTable;
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
/**
|
|
|
50 |
* Sorts a column containing IP addresses (IPv4 and IPv6) or IPv4 address and port delimited by ':' in typical dot
|
|
|
51 |
* notation / colon. This can be most useful when using DataTables for a
|
|
|
52 |
* networking application, and reporting information containing IP address.
|
|
|
53 |
*
|
|
|
54 |
* @name IP addresses
|
|
|
55 |
* @summary Sort IP addresses numerically
|
|
|
56 |
* @author Dominique Fournier
|
|
|
57 |
* @author Brad Wasson
|
|
|
58 |
* @author Peter Vilhan
|
|
|
59 |
* @author Kevin Gilkey-Graham
|
|
|
60 |
*
|
|
|
61 |
* @example
|
|
|
62 |
* $('#example').dataTable( {
|
|
|
63 |
* columnDefs: [
|
|
|
64 |
* { type: 'ip-address', targets: 0 }
|
|
|
65 |
* ]
|
|
|
66 |
* } );
|
|
|
67 |
*/
|
|
|
68 |
DataTable.ext.type.order['ip-address-pre'] = function (a) {
|
|
|
69 |
var i, item;
|
|
|
70 |
var m, n, t, p;
|
|
|
71 |
var x, xa;
|
|
|
72 |
if (!a) {
|
|
|
73 |
return '000000000000';
|
|
|
74 |
}
|
|
|
75 |
a = a.replace(/<[\s\S]*?>/g, '');[\s\S]*?>
|
|
|
76 |
<[\s\S]*?> //IPv4:Port[\s\S]*?>
|
|
|
77 |
<[\s\S]*?> t = a.split(':');[\s\S]*?>
|
|
|
78 |
<[\s\S]*?> if (t.length == 2) {[\s\S]*?>
|
|
|
79 |
<[\s\S]*?> m = t[0].split('.');[\s\S]*?>
|
|
|
80 |
<[\s\S]*?> p = t[1];[\s\S]*?>
|
|
|
81 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
82 |
<[\s\S]*?> else {[\s\S]*?>
|
|
|
83 |
<[\s\S]*?> m = a.split('.');[\s\S]*?>
|
|
|
84 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
85 |
<[\s\S]*?> n = a.split(':');[\s\S]*?>
|
|
|
86 |
<[\s\S]*?> x = '';[\s\S]*?>
|
|
|
87 |
<[\s\S]*?> xa = '';[\s\S]*?>
|
|
|
88 |
<[\s\S]*?> if (m.length == 4) {[\s\S]*?>
|
|
|
89 |
<[\s\S]*?> // IPV4[\s\S]*?>
|
|
|
90 |
<[\s\S]*?> for (i = 0; i < m.length; i++) {[\s\S]*?>
|
|
|
91 |
<[\s\S]*?> item = m[i];[\s\S]*?>
|
|
|
92 |
<[\s\S]*?> x += '000'.substr(item.length) + item;[\s\S]*?>
|
|
|
93 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
94 |
<[\s\S]*?> if (p) {[\s\S]*?>
|
|
|
95 |
<[\s\S]*?> x += ':' + '00000'.substr(p.length) + p;[\s\S]*?>
|
|
|
96 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
97 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
98 |
<[\s\S]*?> else if (n.length > 0) {[\s\S]*?>
|
|
|
99 |
<[\s\S]*?> // IPV6[\s\S]*?>
|
|
|
100 |
<[\s\S]*?> var count = 0;[\s\S]*?>
|
|
|
101 |
<[\s\S]*?> for (i = 0; i < n.length; i++) {[\s\S]*?>
|
|
|
102 |
<[\s\S]*?> item = n[i];[\s\S]*?>
|
|
|
103 |
<[\s\S]*?> if (i > 0) {[\s\S]*?>
|
|
|
104 |
<[\s\S]*?> xa += ':';[\s\S]*?>
|
|
|
105 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
106 |
<[\s\S]*?> if (item.length === 0) {[\s\S]*?>
|
|
|
107 |
<[\s\S]*?> count += 0;[\s\S]*?>
|
|
|
108 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
109 |
<[\s\S]*?> else {[\s\S]*?>
|
|
|
110 |
<[\s\S]*?> xa += '0000'.substr(item.length) + item;[\s\S]*?>
|
|
|
111 |
<[\s\S]*?> count += 4;[\s\S]*?>
|
|
|
112 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
113 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
114 |
<[\s\S]*?> // Padding the ::[\s\S]*?>
|
|
|
115 |
<[\s\S]*?> n = xa.split(':');[\s\S]*?>
|
|
|
116 |
<[\s\S]*?> var paddDone = 0;[\s\S]*?>
|
|
|
117 |
<[\s\S]*?> for (i = 0; i < n.length; i++) {[\s\S]*?>
|
|
|
118 |
<[\s\S]*?> item = n[i];[\s\S]*?>
|
|
|
119 |
<[\s\S]*?> if (item.length === 0 && paddDone === 0) {[\s\S]*?>
|
|
|
120 |
<[\s\S]*?> for (var padding = 0; padding < 32 - count; padding++) {[\s\S]*?>
|
|
|
121 |
<[\s\S]*?> x += '0';[\s\S]*?>
|
|
|
122 |
<[\s\S]*?> paddDone = 1;[\s\S]*?>
|
|
|
123 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
124 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
125 |
<[\s\S]*?> else {[\s\S]*?>
|
|
|
126 |
<[\s\S]*?> x += item;[\s\S]*?>
|
|
|
127 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
128 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
129 |
<[\s\S]*?> }[\s\S]*?>
|
|
|
130 |
<[\s\S]*?> return x;[\s\S]*?>
|
|
|
131 |
<[\s\S]*?>};[\s\S]*?>
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
<[\s\S]*?>return DataTable;[\s\S]*?>
|
|
|
135 |
<[\s\S]*?>}));[\s\S]*?>
|