"Fossies" - the Fresh Open Source Software Archive 
Member "squidanalyzer-6.6/resources/sa-sorttable.diff" (7 May 2017, 1039 Bytes) of package /linux/privat/squidanalyzer-6.6.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 --- sorttable.js 2012-10-15 21:11:14.000000000 +0200
2 +++ ../sorttable.js 2017-02-19 12:09:38.499610414 +0100
3 @@ -151,6 +151,8 @@
4 //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
5 /* and comment out this one */
6 row_array.sort(this.sorttable_sortfunction);
7 + // SquidAnalyzer: Sort in descending order first
8 + row_array.reverse();
9
10 tb = this.sorttable_tbody;
11 for (var j=0; j<row_array.length; j++) {
12 @@ -266,8 +268,18 @@
13 return aa-bb;
14 },
15 sort_alpha: function(a,b) {
16 - if (a[0]==b[0]) return 0;
17 - if (a[0]<b[0]) return -1;
18 + // SquidAnalyzer: remove percentage for numeric sort
19 + if (a[0].replace(/ <.*\(.*%\).*/, '')) {
20 + b[0].replace(/ <.*\(.*%\).*/,'');
21 + aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
22 + if (isNaN(aa)) aa = 0;
23 + bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
24 + if (isNaN(bb)) bb = 0;
25 + return aa-bb;
26 + } else {
27 + if (a[0]==b[0]) return 0;
28 + if (a[0]<b[0]) return -1;
29 + }
30 return 1;
31 },
32 sort_ddmm: function(a,b) {