diff --git a/resources/sorttable.js b/resources/sorttable.js
index 63cf739..bfdf2db 100644
--- a/resources/sorttable.js
+++ b/resources/sorttable.js
@@ -3,19 +3,19 @@
version 2
7th April 2007
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
-
+
Instructions:
Download this file
Add to your HTML
Add class="sortable" to any table you'd like to make sortable
Click on the headers to sort
-
+
Thanks to many, many people for contributions and suggestions.
Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
This basically means: do what you want with it.
*/
-
+
var stIsIE = /*@cc_on!@*/false;
sorttable = {
@@ -26,19 +26,19 @@ sorttable = {
arguments.callee.done = true;
// kill the timer
if (_timer) clearInterval(_timer);
-
+
if (!document.createElement || !document.getElementsByTagName) return;
-
+
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
-
+
forEach(document.getElementsByTagName('table'), function(table) {
if (table.className.search(/\bsortable\b/) != -1) {
sorttable.makeSortable(table);
}
});
-
+
},
-
+
makeSortable: function(table) {
if (table.getElementsByTagName('thead').length == 0) {
// table doesn't have a tHead. Since it should have, create one and
@@ -49,9 +49,9 @@ sorttable = {
}
// Safari doesn't support table.tHead, sigh
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
-
+
if (table.tHead.rows.length != 1) return; // can't cope with two header rows
-
+
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
// "total" rows, for example). This is B&R, since what you're supposed
// to do is put them in a tfoot. So, if there are sortbottom rows,
@@ -73,7 +73,7 @@ sorttable = {
}
delete sortbottomrows;
}
-
+
// work through each column and calculate its type
headrow = table.tHead.rows[0].cells;
for (var i=0; i fields.
-
+
+ if (!node) return "";
+
hasInputs = (typeof node.getElementsByTagName == 'function') &&
node.getElementsByTagName('input').length;
-
+
if (node.getAttribute("sorttable_customkey") != null) {
return node.getAttribute("sorttable_customkey");
}
@@ -240,7 +242,7 @@ sorttable = {
}
}
},
-
+
reverse: function(tbody) {
// reverse the rows in a tbody
newrows = [];
@@ -252,14 +254,14 @@ sorttable = {
}
delete newrows;
},
-
+
/* sort functions
each sort function takes two parameters, a and b
you are comparing a[0] and b[0] */
sort_numeric: function(a,b) {
aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
if (isNaN(aa)) aa = 0;
- bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
+ bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
if (isNaN(bb)) bb = 0;
return aa-bb;
},
@@ -308,7 +310,7 @@ sorttable = {
if (dt1