r40346 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40345‎ | r40346 | r40347 >
Date:22:59, 2 September 2008
Author:simetrical
Status:old
Tags:
Comment:
(bug 15436) Support more currency types for sortable tables

Patch by Mike Horvath.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/wikibits.js
@@ -613,7 +613,8 @@
614614 sortfn = ts_sort_date;
615615 if (itm.match(/^\d\d[\/.-]\d\d[\/.-]\d\d$/))
616616 sortfn = ts_sort_date;
617 - if (itm.match(/^[\u00a3$\u20ac\u00a5]/)) // pound dollar euro yen
 617+ // pound dollar euro yen currency cents
 618+ if (itm.match(/(^[\u00a3$\u20ac\u00a4\u00a5]|\u00a2$)/))
618619 sortfn = ts_sort_currency;
619620 if (itm.match(/^[\d.,]+\%?$/))
620621 sortfn = ts_sort_numeric;
@@ -719,8 +720,8 @@
720721 }
721722
722723 function ts_sort_currency(a,b) {
723 - var aa = ts_parseFloat(a[1].replace(/[^0-9.]/g,''));
724 - var bb = ts_parseFloat(b[1].replace(/[^0-9.]/g,''));
 724+ var aa = ts_parseFloat(a[1].replace(/[^0-9.,]/g,''));
 725+ var bb = ts_parseFloat(b[1].replace(/[^0-9.,]/g,''));
725726 return (aa != bb ? aa - bb : a[2] - b[2]);
726727 }
727728
Index: trunk/phase3/RELEASE-NOTES
@@ -115,7 +115,7 @@
116116 * Added an on-wiki external image whitelist. Items in this whitelist are
117117 treated as regular expression fragments to match for when possibly
118118 displaying an external image inline.
119 -* (bug 15405) Sort yen correctly in sortable tables
 119+* (bugs 15405, 15436) Sort more currency types correctly in sortable tables
120120
121121 === Bug fixes in 1.14 ===
122122