mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +00:00
Parsers: include "ipv4Address" parser in parser-network file
This commit is contained in:
parent
81133dfdc0
commit
a611f5d5a6
@ -3,7 +3,9 @@
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter;
|
||||
var ts = $.tablesorter,
|
||||
ipv4Format,
|
||||
ipv4Is;
|
||||
|
||||
/*! IPv6 Address parser (WIP)
|
||||
* IPv6 Address (ffff:0000:0000:0000:0000:0000:0000:0000)
|
||||
@ -76,12 +78,10 @@
|
||||
|
||||
// ipv4 address
|
||||
// moved here from jquery.tablesorter.js (core file)
|
||||
ts.addParser({
|
||||
id: 'ipAddress',
|
||||
is: function(s) {
|
||||
ipv4Is = function(s) {
|
||||
return (/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/).test(s);
|
||||
},
|
||||
format: function(s, table) {
|
||||
};
|
||||
ipv4Format = function(s, table) {
|
||||
var i, a = s ? s.split('.') : '',
|
||||
r = '',
|
||||
l = a.length;
|
||||
@ -89,7 +89,19 @@
|
||||
r += ('000' + a[i]).slice(-3);
|
||||
}
|
||||
return s ? ts.formatFloat(r, table) : s;
|
||||
},
|
||||
};
|
||||
|
||||
// duplicate "ipAddress" as "ipv4Address" (to maintain backwards compatility)
|
||||
ts.addParser({
|
||||
id: 'ipAddress',
|
||||
is: ipv4Is,
|
||||
format: ipv4Format,
|
||||
type: 'numeric'
|
||||
});
|
||||
ts.addParser({
|
||||
id: 'ipv4Address',
|
||||
is: ipv4Is,
|
||||
format: ipv4Format,
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user