From: Aryeh Gregor Date: Tue, 2 Sep 2008 22:59:58 +0000 (+0000) Subject: (bug 15436) Support more currency types for sortable tables X-Git-Tag: 1.31.0-rc.0~45521 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=a624915057d64a9868a8a876647a80310484952d;p=lhc%2Fweb%2Fwiklou.git (bug 15436) Support more currency types for sortable tables Patch by Mike Horvath. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 19b60ceb1b..75fafd977c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index bc72334999..717553c3e3 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -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]); }