diff options
author | Ted Trask <ttrask01@yahoo.com> | 2019-09-18 17:57:37 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2019-09-18 18:04:45 +0000 |
commit | d3b95ba6d0b69f9d23caa1e665425931835b582b (patch) | |
tree | 3467ce5612908346d1ae0aa13f44b90dda4b5310 /parsers | |
parent | 77487684e62bbec074943cc5ec2c0de87b291124 (diff) | |
download | acf-jquery-d3b95ba6d0b69f9d23caa1e665425931835b582b.tar.bz2 acf-jquery-d3b95ba6d0b69f9d23caa1e665425931835b582b.tar.xz |
Upgrade to jquery 1.12.4 and tablesorter 2.31.1
https://code.jquery.com
https://github.com/Mottie/tablesorter/releases
Diffstat (limited to 'parsers')
-rw-r--r-- | parsers/parser-network.js | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/parsers/parser-network.js b/parsers/parser-network.js index 7175578..148f53a 100644 --- a/parsers/parser-network.js +++ b/parsers/parser-network.js @@ -1,7 +1,7 @@ -/*! Parser: network - updated 5/17/2015 (v2.22.0) */ +/*! Parser: network - updated 2018-01-10 (v2.29.3) */ /* IPv4, IPv6 and MAC Addresses */ /*global jQuery: false */ -;(function($){ +;(function($) { 'use strict'; var ts = $.tablesorter, @@ -23,32 +23,37 @@ ipv6Validate : /^\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/i }); + // used for internal testing; it's not useful to set this to true because the natural sort algorithm + // is set up to only sort solitary hex values ("ffff") vs separated hex values ("ffff.ffff") + ts.defaults.ipv6HexFormat = false; + ts.addParser({ id: 'ipv6Address', is: function(s) { return ts.regex.ipv6Validate.test(s); }, format: function(address, table) { - // code modified from http://forrst.com/posts/JS_Expand_Abbreviated_IPv6_Addresses-1OR + // code modified from http://zurb.com/forrst/posts/JS_Expand_Abbreviated_IPv6_Addresses-1OR + // Saved to https://gist.github.com/Mottie/7018157 var i, t, sides, groups, groupsPresent, hex = table ? (typeof table === 'boolean' ? table : table && table.config.ipv6HexFormat || false) : false, fullAddress = '', expandedAddress = '', - validGroupCount = 8, - validGroupSize = 4; + validGroupCount = 8; + // validGroupSize = 4; <- removed while loop // remove any extra spaces address = address.replace(/\s*/g, ''); // look for embedded ipv4 if (ts.regex.ipv4Validate.test(address)) { groups = address.match(ts.regex.ipv4Extract); t = ''; - for (i = 1; i < groups.length; i++){ + for (i = 1; i < groups.length; i++) { t += ('00' + (parseInt(groups[i], 10).toString(16)) ).slice(-2) + ( i === 2 ? ':' : '' ); } address = address.replace( ts.regex.ipv4Extract, t ); } - if (address.indexOf('::') == -1) { + if (address.indexOf('::') === -1) { // All eight groups are present fullAddress = address; } else { @@ -69,12 +74,12 @@ // it's fastest & easiest for tablesorter to sort decimal values (vs hex) groups[i] = hex ? ('0000' + groups[i]).slice(-4) : ('00000' + (parseInt(groups[i], 16) || 0)).slice(-5); - expandedAddress += ( i != validGroupCount-1) ? groups[i] + ':' : groups[i]; + expandedAddress += ( i !== validGroupCount - 1) ? groups[i] + ':' : groups[i]; } - return hex ? expandedAddress : expandedAddress.replace(/:/g, ''); + return expandedAddress; }, // uses natural sort hex compare - type: 'numeric' + type: 'text' }); // ipv4 address @@ -82,14 +87,15 @@ ipv4Is = function(s) { return (/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/).test(s); }; - ipv4Format = function(s, table) { - var i, a = s ? s.split('.') : '', - r = '', + ipv4Format = function(s) { + var i, + a = s ? s.split('.') : '', + r = [], l = a.length; for (i = 0; i < l; i++) { - r += ('000' + a[i]).slice(-3); + r.push(('000' + a[i]).slice(-3)); } - return s ? ts.formatFloat(r, table) : s; + return s ? r.join('.') : s; }; /*! Parser: ipv4Address (a.k.a. ipAddress) */ @@ -98,13 +104,13 @@ id: 'ipAddress', is: ipv4Is, format: ipv4Format, - type: 'numeric' + type: 'text' }); ts.addParser({ id: 'ipv4Address', is: ipv4Is, format: ipv4Format, - type: 'numeric' + type: 'text' }); /*! Parser: MAC address */ @@ -112,26 +118,26 @@ */ ts.addParser({ id : 'MAC', - is : function( str ) { + is : function() { return false; }, format : function( str ) { var indx, len, - mac = '', + mac = [], val = ( str || '' ).replace( /[:.-]/g, '' ).match( /\w{2}/g ); if ( val ) { // not assuming all mac addresses in the column will end up with six // groups of two to process, so it's not actually validating the address len = val.length; for ( indx = 0; indx < len; indx++ ) { - mac += ( '000' + parseInt( val[ indx ], 16 ) ).slice( -3 ); + mac.push(( '000' + parseInt( val[ indx ], 16 ) ).slice( -3 )); } - return mac; + return mac.join('.'); } return str; }, // uses natural sort hex compare - type : 'numeric' + type : 'text' }); })( jQuery ); |