MediaWiki:Common.js : Différence entre versions
Sauter à la navigation
Sauter à la recherche
Ligne 14 : | Ligne 14 : | ||
}); | }); | ||
*/ | */ | ||
+ | var customizeToolbar = function () { | ||
+ | /* Your code goes here */ | ||
+ | }; | ||
+ | |||
+ | /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */ | ||
+ | if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { | ||
+ | mw.loader.using( 'user.options' ).then( function () { | ||
+ | // This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]]) | ||
+ | if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) { | ||
+ | $.when( | ||
+ | mw.loader.using( 'ext.wikiEditor' ), $.ready | ||
+ | ).then( customizeToolbar ); | ||
+ | } | ||
+ | } ); | ||
+ | } |
Version du 9 mars 2020 à 15:22
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. jQuery(document).ready(function($){ if ($('#pt-logout').length) { $("body").addClass("connected"); } else $("body").addClass("disconnected"); $("div.nomobile > big > big > b").appendTo("div#mw-head").wrap("<div id='menu-lettres' />").wrap("<div class='lettres' />"); $("div#menu-lettres > div.lettres > b").contents().unwrap(); $("a[title='Spécial:Statistiques']").appendTo("div#menu-lettres").addClass("entrees").after("<span> entrées</span>"); $("div#accueil_titre").remove(); }); */ var customizeToolbar = function () { /* Your code goes here */ }; /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */ if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { mw.loader.using( 'user.options' ).then( function () { // This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]]) if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) { $.when( mw.loader.using( 'ext.wikiEditor' ), $.ready ).then( customizeToolbar ); } } ); }