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 = /(<([^>]+)>)/gi, 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 } else if (xD > yD) { 31 return 1; 32 } 33 } 34 35 // natural sorting through split numeric strings and default strings 36 for (var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++) { 37 // find floats not starting with '0', string or 0 if not defined (Clint Priest) 38 39 /*supsystic*/ 40 //var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc], 10) || xN[cLoc] || 0; 41 //var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc], 10) || yN[cLoc] || 0; 42 var oFxNcL = parseFloat(xN[cLoc], 10) || xN[cLoc] || undefined; 43 var oFyNcL = parseFloat(yN[cLoc], 10) || yN[cLoc] || undefined; 44 /*****/ 45 46 // handle numeric vs string comparison - number < string - (Kyle Adams) 47 if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { 48 return isNaN(oFxNcL) ? 1 : -1; 49 } 50 // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2' 51 else if (typeof oFxNcL !== typeof oFyNcL) { 52 oFxNcL += ''; 53 oFyNcL += ''; 54 } 55 if (oFxNcL < oFyNcL) { 56 return -1; 57 } 58 if (oFxNcL > oFyNcL) { 59 return 1; 60 } 61 } 62 return 0; 63 } 64 65 jQuery.fn.dataTableExt.oApi.fnFakeRowspan = function (oSettings) { 66 if (oSettings) { 67 var cells; 68 jQuery.each(oSettings.aoData, function (index, rowData) { 69 app.setCellAttributes(rowData.anCells); 70 }); 71 if (oSettings.aoHeader.length) { 72 cells = []; 73 jQuery.each(oSettings.aoHeader, function (index, rowData) { 74 jQuery.each(rowData, function (index, cellData) { 75 cells.push(cellData.cell); 76 }); 77 }); 78 app.setCellAttributes(cells); 79 } 80 if (oSettings.aoFooter.length) { 81 cells = []; 82 jQuery.each(oSettings.aoFooter, function (index, rowData) { 83 jQuery.each(rowData, function (index, cellData) { 84 cells.push(cellData.cell); 85 }); 86 }); 87 app.setCellAttributes(cells); 88 } 89 } 90 return this; 91 }; 92 jQuery.fn.dataTableExt.oApi.fnResetFakeRowspan = function (oSettings) { 93 if (oSettings) { 94 var displayRows = oSettings.aiDisplay, 95 mergedData = jQuery(oSettings.nTable).data('merged'); 96 if (!mergedData || mergedData.length == 0 || displayRows.length == 0) return this; 97 98 var rows = oSettings.aoData, 99 table = jQuery(oSettings.nTable), 100 autoHiding = table.attr('data-auto-hiding'), 101 rowNums = {}, 102 first = table.attr('data-auto-index') == 'new' ? 1 : 0; 103 autoHiding = typeof autoHiding != 'undefined' && autoHiding.length > 0 ? autoHiding.split(',').map(Number) : []; 104 105 jQuery.each(displayRows, function (index, rowNum) { 106 var cells = rows[rowNum].anCells; 107 rowNums[cells[first].getAttribute('data-y')] = rowNum; 108 for (var i = 0; i < cells.length; i++) { 109 if (cells[i].getAttribute('data-hide') == 'true' && (autoHiding.length <= i || autoHiding[i] == 1)) { 110 jQuery(cells[i]).css('display', ''); 111 } 112 cells[i].setAttribute('rowspan', 1); 113 cells[i].setAttribute('colspan', 1); 114 } 115 }); 116 jQuery.each(mergedData, function (index, value) { 117 var firstRow = Number(value.row) + 1, 118 lastRow = firstRow + Number(value.rowspan) - 1, 119 colspan = Number(value.colspan), 120 firstCol = Number(value.col) + first, 121 lastCol = firstCol + colspan - 1, 122 rowspan = 0; 123 for (var r = firstRow; r <= lastRow; r++) { 124 if (r in rowNums) { 125 if (rowspan == 0) { 126 firstRow = r; 127 } 128 for (var c = firstCol + (firstRow == r ? 1 : 0); c <= lastCol; c++) { 129 var cell = rows[rowNums[r]].anCells[c]; 130 if (typeof cell !== 'undefined' && typeof cell.style !== 'undefined' && typeof cell.style.display !== 'undefined') { 131 cell.style.display = 'none'; 132 } 133 if (autoHiding[c] === 0) { 134 colspan--; 135 } 136 } 137 rowspan++; 138 } 139 } 140 if (rowspan > 0) { 141 var mergedCell = rows[rowNums[firstRow]].anCells[firstCol]; 142 if (rowspan > 1) { 143 mergedCell.setAttribute('rowspan', rowspan); 144 } 145 if (colspan > 1) { 146 mergedCell.setAttribute('colspan', colspan); 147 } 148 } 149 }); 150 } 151 return this; 152 }; 153 154 jQuery.extend(jQuery.fn.dataTableExt.oSort, { 155 'natural-asc': function (a, b) { 156 return naturalSort(a, b, true); 157 }, 158 'natural-desc': function (a, b) { 159 return naturalSort(a, b, true) * -1; 160 }, 161 'natural-nohtml-asc': function (a, b) { 162 return naturalSort(a, b, false); 163 }, 164 'natural-nohtml-desc': function (a, b) { 165 return naturalSort(a, b, false) * -1; 166 }, 167 'natural-ci-asc': function (a, b) { 168 a = a.toString().toLowerCase(); 169 b = b.toString().toLowerCase(); 170 171 return naturalSort(a, b, true); 172 }, 173 'natural-ci-desc': function (a, b) { 174 a = a.toString().toLowerCase(); 175 b = b.toString().toLowerCase(); 176 177 return naturalSort(a, b, true) * -1; 178 }, 179 'natural-nohtml-ci-asc': function (a, b) { 180 a = a.toString().toLowerCase(); 181 b = b.toString().toLowerCase(); 182 183 return naturalSort(a, b, false); 184 }, 185 'natural-nohtml-ci-desc': function (a, b) { 186 a = a.toString().toLowerCase(); 187 b = b.toString().toLowerCase(); 188 189 return naturalSort(a, b, false) * -1; 190 }, 191 }); 192})(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.