MediaWiki:InitialSort.js
Aller à la navigation
Aller à la recherche
Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
- Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
- Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
- Internet Explorer / Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
- Opera : appuyez sur Ctrl + F5.
/*<nowiki>*/ /**** class InitialSort.js * By Chriskang (2011) * Inspired by the code of CollapsibleTables by Patrick Westerhoff [poke]. * * */ (function (window, undefined) { var classInitialSort = 'initial_sort'; var regexInitialSort = new RegExp( '(?:\\s|^)' + classInitialSort + '(?:\\s|$)' ); var sections = new Array(); initialize(); /** private void initialize () :: initializes InitialSort class **/ function initialize () { if ( mw.config.get('wgIsArticle')== false && window.location.href.indexOf( 'action=submit' ) < 0 && mw.config.get( 'wgNamespaceNumber' ) != -1 ) return; var docContent = document.getElementById( 'bodyContent' ) || document.getElementById( 'article' ) || document.getElementById( 'mw_contentholder' ); var tableheaders = docContent.getElementsByTagName( 'th' ); var sectionId = -1; var defaultStatus; for ( var i = 0, n = tableheaders.length; i < n; i++ ) { if ( regexInitialSort.test( tableheaders[i].className ) ) { ts_resortTable(tableheaders[i].lastChild); } } } })(window) /*</nowiki>*/