1(function (jQuery, app) { 2 // Custom Natural Sort Function 3 // see https://datatables.net/plug-ins/sorting/natural 4 function naturalSort (a, b, html) { 5 var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?%?$|^0x[0-9a-f]+$|[0-9]+)/gi, 6 sre = /(^[ ]*|[ ]*$)/g, 7 dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, 8 hre = /^0x[0-9a-f]+$/i, 9 ore = /^0/, 10 htmre = /(<([^>]+)>)/ig, 11 // convert all to strings and trim() 12 x = a.toString().replace(sre, '') || '', 13 y = b.toString().replace(sre, '') || ''; 14 // remove html from strings if desired 15 if (!html) { 16 x = x.replace(htmre, ''); 17 y = y.replace(htmre, ''); 18 } 19 // chunk/tokenize 20 var xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), 21 yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), 22 // numeric, hex or date detection 23 xD = parseInt(x.match(hre), 10) || (xN.length !== 1 && x.match(dre) && Date.parse(x)), 24 yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null; 25 26 // first try and sort Hex codes or Dates 27 if (yD) { 28 if ( xD < yD ) { 29 return -1; 30 } 31 else if ( xD > yD ) { 32 return 1; 33 } 34 } 35 36 // natural sorting through split numeric strings and default strings 37 for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) { 38 // find floats not starting with '0', string or 0 if not defined (Clint Priest) 39 40 /*supsystic*/ 41 //var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc], 10) || xN[cLoc] || 0; 42 //var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc], 10) || yN[cLoc] || 0; 43 var oFxNcL = parseFloat(xN[cLoc], 10) || xN[cLoc] || undefined; 44 var oFyNcL = parseFloat(yN[cLoc], 10) || yN[cLoc] || undefined; 45 /*****/ 46 47 // handle numeric vs string comparison - number < string - (Kyle Adams) 48 if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { 49 return (isNaN(oFxNcL)) ? 1 : -1; 50 } 51 // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2' 52 else if (typeof oFxNcL !== typeof oFyNcL) { 53 oFxNcL += ''; 54 oFyNcL += ''; 55 } 56 if (oFxNcL < oFyNcL) { 57 return -1; 58 } 59 if (oFxNcL > oFyNcL) { 60 return 1; 61 } 62 } 63 return 0; 64 } 65 66 jQuery.fn.dataTableExt.oApi.fnFakeRowspan = function (oSettings) { 67 if(oSettings) { 68 var cells; 69 jQuery.each(oSettings.aoData, function(index, rowData) { 70 app.setCellAttributes(rowData.anCells); 71 }); 72 if (oSettings.aoHeader.length) { 73 cells = []; 74 jQuery.each(oSettings.aoHeader, function(index, rowData) { 75 jQuery.each(rowData, function(index, cellData) { 76 cells.push(cellData.cell); 77 }); 78 }); 79 app.setCellAttributes(cells); 80 } 81 if (oSettings.aoFooter.length) { 82 cells = []; 83 jQuery.each(oSettings.aoFooter, function(index, rowData) { 84 jQuery.each(rowData, function(index, cellData) { 85 cells.push(cellData.cell); 86 }); 87 }); 88 app.setCellAttributes(cells); 89 } 90 } 91 return this; 92 }; 93 jQuery.fn.dataTableExt.oApi.fnResetFakeRowspan = function (oSettings) { 94 if(oSettings) { 95 var displayRows = oSettings.aiDisplay, 96 mergedData = jQuery(oSettings.nTable).data('merged'); 97 if(!mergedData || mergedData.length == 0 || displayRows.length == 0) return this; 98 99 var rows = oSettings.aoData, 100 table = jQuery(oSettings.nTable), 101 autoHiding = table.attr('data-auto-hiding'), 102 rowNums = {}, 103 first = table.attr('data-auto-index') == 'new' ? 1 : 0; 104 autoHiding = (typeof(autoHiding) != 'undefined' && autoHiding.length > 0) ? autoHiding.split(',').map(Number) : []; 105 106 jQuery.each(displayRows, function(index, rowNum) { 107 var cells = rows[rowNum].anCells; 108 rowNums[cells[first].getAttribute('data-y')] = rowNum; 109 for(var i = 0; i < cells.length; i++) { 110 if(cells[i].getAttribute('data-hide') == "true" && (autoHiding.length <= i || autoHiding[i] == 1)) { 111 jQuery(cells[i]).css('display', ''); 112 } 113 cells[i].setAttribute('rowspan', 1); 114 cells[i].setAttribute('colspan', 1); 115 } 116 }); 117 jQuery.each(mergedData, function(index, value) { 118 var firstRow = Number(value.row) + 1, 119 lastRow = firstRow + Number(value.rowspan) - 1, 120 colspan = Number(value.colspan), 121 firstCol = Number(value.col) + first, 122 lastCol = firstCol + colspan - 1, 123 rowspan = 0; 124 for(var r = firstRow; r <= lastRow; r++) { 125 if(r in rowNums) { 126 if(rowspan == 0) { 127 firstRow = r; 128 } 129 for(var c = firstCol + (firstRow == r ? 1 : 0); c <= lastCol; c++) { 130 var cell = rows[rowNums[r]].anCells[c]; 131 if (typeof cell !== "undefined" && typeof cell.style !== "undefined" && typeof cell.style.display !== "undefined") { 132 cell.style.display = 'none'; 133 } 134 if(autoHiding[c] === 0) { 135 colspan--; 136 } 137 } 138 rowspan++; 139 } 140 } 141 if(rowspan > 0) { 142 var mergedCell = rows[rowNums[firstRow]].anCells[firstCol]; 143 if(rowspan > 1) { 144 mergedCell.setAttribute('rowspan', rowspan); 145 } 146 if(colspan > 1) { 147 mergedCell.setAttribute('colspan', colspan); 148 } 149 } 150 }); 151 } 152 return this; 153 }; 154 155 jQuery.extend( jQuery.fn.dataTableExt.oSort, { 156 "natural-asc": function ( a, b ) { 157 return naturalSort(a,b,true); 158 }, 159 "natural-desc": function ( a, b ) { 160 return naturalSort(a,b,true) * -1; 161 }, 162 "natural-nohtml-asc": function( a, b ) { 163 return naturalSort(a,b,false); 164 }, 165 "natural-nohtml-desc": function( a, b ) { 166 return naturalSort(a,b,false) * -1; 167 }, 168 "natural-ci-asc": function( a, b ) { 169 a = a.toString().toLowerCase(); 170 b = b.toString().toLowerCase(); 171 172 return naturalSort(a,b,true); 173 }, 174 "natural-ci-desc": function( a, b ) { 175 a = a.toString().toLowerCase(); 176 b = b.toString().toLowerCase(); 177 178 return naturalSort(a,b,true) * -1; 179 }, 180 "natural-nohtml-ci-asc": function( a, b ) { 181 a = a.toString().toLowerCase(); 182 b = b.toString().toLowerCase(); 183 184 return naturalSort(a,b,false); 185 }, 186 "natural-nohtml-ci-desc": function( a, b ) { 187 a = a.toString().toLowerCase(); 188 b = b.toString().toLowerCase(); 189 190 return naturalSort(a,b,false) * -1; 191 } 192 } ); 193 194}(window.jQuery, window.supsystic.Tables));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.