From: Leo Koppelkamm Date: Tue, 3 May 2011 11:44:35 +0000 (+0000) Subject: Tablesorter: Add a title attribute to sort arrows ( Bug 21453 ) X-Git-Tag: 1.31.0-rc.0~30439 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=abc88c1561bbd19c5014610af112e5b0bd699312;p=lhc%2Fweb%2Fwiklou.git Tablesorter: Add a title attribute to sort arrows ( Bug 21453 ) --- diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index e4f0007ea1..da90ef7944 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -933,6 +933,8 @@ See [[Special:Version|version page]].', 'anonnotice' => '-', # do not translate or duplicate this message to other languages 'newsectionheaderdefaultlevel' => '== $1 ==', # do not translate or duplicate this message to other languages 'red-link-title' => '$1 (page does not exist)', +'sort-descending' => 'Sort descending', +'sort-ascending' => 'Sort ascending', # Short words for each namespace, by default used in the namespace tab in monobook 'nstab-main' => 'Page', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 1695d10b35..663dc9ca09 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -338,6 +338,9 @@ $wgMessageStructure = array( 'anonnotice', 'newsectionheaderdefaultlevel', 'red-link-title', + 'sort-descending', + 'sort-ascending', + ), 'nstab' => array( 'nstab-main', diff --git a/resources/Resources.php b/resources/Resources.php index b61fa81001..107daacebb 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -137,7 +137,8 @@ return array( 'scripts' => 'resources/jquery/jquery.tabIndex.js', ), 'jquery.tablesorter' => array( - 'scripts' => 'resources/jquery/jquery.tablesorter.js' + 'scripts' => 'resources/jquery/jquery.tablesorter.js', + 'messages' => array( 'sort-descending', 'sort-ascending' ), ), 'jquery.textSelection' => array( 'scripts' => 'resources/jquery/jquery.textSelection.js', diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index 50865659d5..500447ba17 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -141,6 +141,7 @@ // Check next parser, reset rows i++; rowIndex = 0; + concurrent = 0; } } else { // Empty cell @@ -255,7 +256,7 @@ // } } - function buildHeaders( table ) { + function buildHeaders( table, msg ) { var maxSeen = 0; var longest; // if ( table.config.debug ) { @@ -289,7 +290,8 @@ if ( $( this ).is( '.unsortable' ) ) this.sortDisabled = true; if ( !this.sortDisabled ) { - var $th = $( this ).addClass( table.config.cssHeader ); + var $th = $( this ).addClass( table.config.cssHeader ).attr( 'title', msg[1] ); + //if ( table.config.onRenderHeader ) table.config.onRenderHeader.apply($th); } @@ -316,7 +318,7 @@ return false; } - function setHeadersCss( table, $headers, list, css ) { + function setHeadersCss( table, $headers, list, css, msg ) { // remove all header information $headers.removeClass( css[0] ).removeClass( css[1] ); @@ -329,7 +331,7 @@ var l = list.length; for ( var i = 0; i < l; i++ ) { - h[list[i][0]].addClass( css[list[i][1]] ); + h[ list[i][0] ].addClass( css[ list[i][1] ] ).attr( 'title', msg[ list[i][1] ] ); } } @@ -515,8 +517,13 @@ $this = $( this ); // save the settings where they read $.data( this, "tablesorter", config ); + + // get the css class names, could be done else where. + var sortCSS = [ config.cssDesc, config.cssAsc ]; + var sortMsg = [ mw.msg( 'sort-descending' ), mw.msg( 'sort-ascending' ) ]; + // build headers - $headers = buildHeaders( this ); + $headers = buildHeaders( this, sortMsg ); // Grab and process locale settings buildTransformTable(); buildDateTable(); @@ -526,8 +533,6 @@ //performance improvements in some browsers cacheRegexs(); - // get the css class names, could be done else where. - var sortCSS = [config.cssDesc, config.cssAsc]; // apply event handling to headers // this is to big, perhaps break it out? $headers.click( @@ -584,7 +589,7 @@ } setTimeout( function () { // set css for headers - setHeadersCss( $this[0], $headers, config.sortList, sortCSS ); + setHeadersCss( $this[0], $headers, config.sortList, sortCSS, sortMsg ); appendToTable( $this[0], multisort( $this[0], config.sortList, cache ) );