« MediaWiki:Common.js » : différence entre les versions
De Fab Labs Québec
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 6 : | Ligne 6 : | ||
mw.loader.using( 'jquery.tablesorter', function() { | mw.loader.using( 'jquery.tablesorter', function() { | ||
console.log("sorting table"); | console.log("sorting table"); | ||
$( '#autosortthistableplz' ).tablesorter( { | $( '#autosortthistableplz' ).tablesorter( {sortForce: [[1,0]]}) | ||
} ); | } ); | ||
} ); | } ); |
Version du 18 mars 2021 à 07:42
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
//Autosort tables using first row when table ID is autosortthistableplz
jQuery( document ).ready( function( $ ) {
// wrapped in "mw.loader.using" so this doesn't execute until Tablesorter has loaded
mw.loader.using( 'jquery.tablesorter', function() {
console.log("sorting table");
$( '#autosortthistableplz' ).tablesorter( {sortForce: [[1,0]]})
} );
} );
var no_tree = document.querySelector(".__NOTREE__");
if (no_tree) {
subpage_tree = document.querySelector("#contentSub");
if (subpage_tree){
subpage_tree.style.display = "none"
}
}
$(function () {
//Make tabs linkable
var tabnav = document.getElementById('mw-flq-tabnav');
if (tabnav){
console.log("tabnav found");
// Javascript to enable link to tab
var url = document.location.toString();
if (url.match('#')) {
var tab = $('.nav-tabs a[href="#' + url.split('#')[1] + '"]');
tab.ready( function () {tab.click();});
}
// Change hash for page-reload
$('.nav-tabs a').on('click', function (e) {
window.location.hash = e.target.hash;
})
}
}());
$(function () {
//hide the TOOLBOX from sidebar
if(document.querySelector("#sidebar-left .btn-group .dropdown-menu #t-smwbrowselink")){
console.log("found TOOLBOX");
//remove TOOLBOX from sidebar
var toRemoveChild= document.querySelector("#sidebar-left .btn-group .dropdown-menu #t-smwbrowselink");
var toRemove = toRemoveChild.parentElement.parentElement;
toRemove.style.display = "none";
}
}());