(bug 15436) Support more currency types for sortable tables
authorAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 2 Sep 2008 22:59:58 +0000 (22:59 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 2 Sep 2008 22:59:58 +0000 (22:59 +0000)
Patch by Mike Horvath.

RELEASE-NOTES
skins/common/wikibits.js

index 19b60ce..75fafd9 100644 (file)
@@ -115,7 +115,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Added an on-wiki external image whitelist. Items in this whitelist are
   treated as regular expression fragments to match for when possibly
   displaying an external image inline.
-* (bug 15405) Sort yen correctly in sortable tables
+* (bugs 15405, 15436) Sort more currency types correctly in sortable tables
 
 === Bug fixes in 1.14 ===
 
index bc72334..717553c 100644 (file)
@@ -613,7 +613,8 @@ function ts_resortTable(lnk) {
                sortfn = ts_sort_date;
        if (itm.match(/^\d\d[\/.-]\d\d[\/.-]\d\d$/))
                sortfn = ts_sort_date;
-       if (itm.match(/^[\u00a3$\u20ac\u00a5]/)) // pound dollar euro yen
+       // pound dollar euro yen currency cents
+       if (itm.match(/(^[\u00a3$\u20ac\u00a4\u00a5]|\u00a2$)/))
                sortfn = ts_sort_currency;
        if (itm.match(/^[\d.,]+\%?$/))
                sortfn = ts_sort_numeric;
@@ -719,8 +720,8 @@ function ts_sort_date(a,b) {
 }
 
 function ts_sort_currency(a,b) {
-       var aa = ts_parseFloat(a[1].replace(/[^0-9.]/g,''));
-       var bb = ts_parseFloat(b[1].replace(/[^0-9.]/g,''));
+       var aa = ts_parseFloat(a[1].replace(/[^0-9.,]/g,''));
+       var bb = ts_parseFloat(b[1].replace(/[^0-9.,]/g,''));
        return (aa != bb ? aa - bb : a[2] - b[2]);
 }