MediaWiki:Gadget-highlightTable-core.js: Difference between revisions

No edit summary
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
/** <pre>
* highlightTable.js
*
* Description:
* Adds highlighting to tables
*
*/
/**
/**
  * DATA STORAGE STRUCTURE
  * DATA STORAGE STRUCTURE
Line 91: Line 99:
             * Perform initial checks on the page and browser.
             * Perform initial checks on the page and browser.
             */
             */
             init: function() {
             init: function(sorted) {
                 var $tables = $('table.' + TABLE_CLASS),
                 var $tables = $('table.' + TABLE_CLASS),
                     hashedPageName = self.hashString(mw.config.get('wgPageName'));
                     hashedPageName = self.hashString(mw.config.get('wgPageName'));
Line 102: Line 110:
                 if (!gs.hasLocalStorage()) {
                 if (!gs.hasLocalStorage()) {
                     return;
                     return;
                }
                // check if any of the tables are autosort tables
                // and, if so, ensure the autosort gadget runs first
                if (!sorted && $tables.filter('[class*="autosort="]').length) {
                mw.hook('gadget.autosort.sorted').add(function delayInit() {
                self.init(true);
               
                // only run once
                mw.hook('gadget.autosort.sorted').remove(delayInit);
                });
               
                return;
                 }
                 }