r87244 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87243‎ | r87244 | r87245 >
Date:11:55, 2 May 2011
Author:diebuche
Status:ok
Tags:
Comment:
Tablesorter: use mw.config.get() to access globals; force mdy for english contentlang
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.tablesorter.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.tablesorter.js
@@ -405,15 +405,16 @@
406406
407407 function buildTransformTable() {
408408 var digits = '0123456789,.'.split('');
409 -
410 - if ( typeof wgSeparatorTransformTable == 'undefined' || ( wgSeparatorTransformTable[0] == '' && wgDigitTransformTable[2] == '' ) ) {
 409+ var separatorTransformTable = mw.config.get( 'wgSeparatorTransformTable' );
 410+ var digitTransformTable = mw.config.get( 'wgDigitTransformTable' );
 411+ if ( separatorTransformTable == null || ( separatorTransformTable[0] == '' && digitTransformTable[2] == '' ) ) {
411412 ts.transformTable = false;
412413 } else {
413414 ts.transformTable = {};
414415
415416 // Unpack the transform table
416 - var ascii = wgSeparatorTransformTable[0].split( "\t" ).concat( wgDigitTransformTable[0].split( "\t" ) );
417 - var localised = wgSeparatorTransformTable[1].split( "\t" ).concat( wgDigitTransformTable[1].split( "\t" ) );
 417+ var ascii = separatorTransformTable[0].split( "\t" ).concat( digitTransformTable[0].split( "\t" ) );
 418+ var localised = separatorTransformTable[1].split( "\t" ).concat( digitTransformTable[1].split( "\t" ) );
418419
419420 // Construct regex for number identification
420421 for ( var i = 0; i < ascii.length; i++ ) {
@@ -438,9 +439,9 @@
439440 ];
440441 ts.dateRegex = [];
441442
442 - for ( i = 1; i < 13; i++ ) {
443 - ts.monthNames[0][i] = wgMonthNames[i].toLowerCase();
444 - ts.monthNames[1][i] = wgMonthNamesShort[i].toLowerCase().replace( '.', '' );
 443+ for ( var i = 1; i < 13; i++ ) {
 444+ ts.monthNames[0][i] = mw.config.get( 'wgMonthNames' )[i].toLowerCase();
 445+ ts.monthNames[1][i] = mw.config.get( 'wgMonthNamesShort' )[i].toLowerCase().replace( '.', '' );
445446 r += $.escapeRE( ts.monthNames[0][i] ) + '|';
446447 r += $.escapeRE( ts.monthNames[1][i] ) + '|';
447448 }
@@ -820,10 +821,10 @@
821822 }
822823 }
823824 //Resort array depending on preferences
824 - if ( wgDefaultDateFormat == "mdy" ) {
 825+ if ( mw.config.get( 'wgDefaultDateFormat' ) == "mdy" || mw.config.get('wgContentLanguage') == 'en' ) {
825826 s.push( s.shift() );
826827 s.push( s.shift() );
827 - } else if ( wgDefaultDateFormat == "dmy" ) {
 828+ } else if ( mw.config.get( 'wgDefaultDateFormat' ) == "dmy" ) {
828829 var d = s.shift();
829830 s.push( s.shift() );
830831 s.push(d);

Follow-up revisions

RevisionCommit summaryAuthorDate
r90630Followup r86088, r87244, r90612: fix jquery.tablesorter for null collation ta...brion23:19, 22 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86088Completely rewritten table sorting script....diebuche21:47, 14 April 2011

Status & tagging log