MediaWiki:Gadget-highlightTable-core.js: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 1: | Line 1: | ||
/** <pre> | |||
* highlightTable.js | * highlightTable.js | ||
* | * | ||
| Line 5: | Line 5: | ||
* Adds highlighting to tables | * Adds highlighting to tables | ||
* | * | ||
*/ | */ | ||
| Line 110: | 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 121: | 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; | |||
} | } | ||
| Line 437: | Line 438: | ||
// guarantee 8-bit chars | // guarantee 8-bit chars | ||
input = window. | input = window.unescape(window.encodeURI(input)); | ||
// calculate the crc (cyclic redundancy check) for all 8-bit data | // calculate the crc (cyclic redundancy check) for all 8-bit data | ||