You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plugins/sorting/ip-address.min.mjs

2 lines
785 B
JavaScript

/*! © SpryMedia Ltd, Dominique Fournier, Brad Wasson, Peter Vilhan, Kevin Gilkey-Graham - datatables.net/license */
import $ from"jquery";import DataTable from"datatables.net";DataTable.ext.order["ip-address-pre"]=function(t){var e,r,l,a,s,n;if(!t)return"000000000000";if(2==(l=(t=t.replace(/<[\s\S]*?>/g,"")).split(":")).length?(r=l[0].split("."),a=l[1]):r=t.split("."),g=t.split(":"),n=s="",4==r.length){for(f=0;f<r.length;f++)e=r[f],s+="000".substr(e.length)+e;a&&(s+=":"+"00000".substr(a.length)+a)}else if(0<g.length){for(var i=0,f=0;f<g.length;f++)0<f&&(n+=":"),0===(e=g[f]).length?i+=0:(n+="0000".substr(e.length)+e,i+=4);var g=n.split(":"),h=0;for(f=0;f<g.length;f++)if(0===(e=g[f]).length&&0===h)for(var o=0;o<32-i;o++)s+="0",h=1;else s+=e}return s};export default DataTable;