From e6a214d9f9e0f54426f8e7e46b7a6f2c8ea6b664 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Mon, 20 Aug 2018 19:27:18 +0200 Subject: [PATCH 1/2] Cleanup pre function Put variable declarations before any actual code to improve readability. Signed-off-by: Olliver Schinagl --- sorting/ip-address.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sorting/ip-address.js b/sorting/ip-address.js index 48c1398..4022403 100644 --- a/sorting/ip-address.js +++ b/sorting/ip-address.js @@ -18,12 +18,18 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { "ip-address-pre": function ( a ) { - if (!a) { return 0 } var i, item; - var m = a.split("."), - n = a.split(":"), - x = "", - xa = ""; + var m, n; + var x, xa; + + if (!a) { + return 0 + } + + m = a.split("."); + n = a.split(":"); + x = ""; + xa = ""; if (m.length == 4) { // IPV4 From 67fc59870d2930d04e302f1b9a4951cd25521d36 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Mon, 20 Aug 2018 19:28:05 +0200 Subject: [PATCH 2/2] Also search in HTML formed cells IP addresses can easily be hidden in HTML formed cells. For example an IP that links to the IP via an href. As such, add the naive and basic, but fast html tag stripper from the core code. Signed-off-by: Olliver Schinagl --- sorting/ip-address.js | 1 + 1 file changed, 1 insertion(+) diff --git a/sorting/ip-address.js b/sorting/ip-address.js index 4022403..8f389de 100644 --- a/sorting/ip-address.js +++ b/sorting/ip-address.js @@ -26,6 +26,7 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { return 0 } + a = a.replace(/<[\s\S]*?>/g, ""); m = a.split("."); n = a.split(":"); x = "";