« MediaWiki:Common.js » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| (36 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */ | /* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */ | ||
/* Penser à aligner Mobile.js et Common.js pour la version bureau */ | |||
//alert("common.js"); | |||
//--------------------------------------------------------------------------- | |||
// Javascript nécessaire en exploitation | |||
// Version en exploitation : cette importation doit être dans les deux pages | |||
// Mediawiki:Common.js et Mediawiki:Mobile.js qui sont mutuellement exclusives | |||
// Pour les tests utiliser la connexion Daniel pour mise au point du script dans la | |||
// page Utilisateur:Daniel/common.js | |||
//--------------------------------------------------------------------------- | |||
importScript('MediaWiki:Catpat.js'); | |||
/*******************************************************************************/ | /*******************************************************************************/ | ||
// Les scripts suivants sont spécifiques de la mise en page en version bureau | |||
/********************************************************************************/ | |||
/********************************************************************************/ | |||
/* Javascript applicable à la catégorie des recettes (voir if... plus bas) | /* Javascript applicable à la catégorie des recettes (voir if... plus bas) | ||
/* Javascript pour modifier la navigation Outils */ | /* Javascript pour modifier la navigation Outils */ | ||
| Ligne 77 : | Ligne 97 : | ||
} | } | ||
if($.inArray('Recettes', | dsg_wgCategories = mw.config.get("wgCategories"); | ||
addOnloadHook( CustomizeModificationsOfSidebar ); | if($.inArray('Recettes', dsg_wgCategories) !== -1){ | ||
//alert("105"); | |||
// addOnloadHook( CustomizeModificationsOfSidebar ); deprecated | |||
jQuery( CustomizeModificationsOfSidebar ); | |||
} | } | ||
/******************************************************************************/ | /******************************************************************************/ | ||
| Ligne 153 : | Ligne 117 : | ||
var d_dsg = new Date(); | var d_dsg = new Date(); | ||
var curr_date_dsg = d_dsg.getDate(); | var curr_date_dsg = d_dsg.getDate(); | ||
var curr_month_dsg = d_dsg.getMonth(); | var curr_month_dsg = d_dsg.getMonth() + 1; | ||
var curr_year_dsg = d_dsg.getFullYear(); | var curr_year_dsg = d_dsg.getFullYear(); | ||
| Ligne 224 : | Ligne 188 : | ||
'labelMsg': 'A1', | 'labelMsg': 'A1', | ||
'type': 'button', | 'type': 'button', | ||
'icon': 'button_head_A1.png', | 'icon': 'resources/assets/button_head_A1.png', | ||
'action': { | 'action': { | ||
'type': 'encapsulate', | 'type': 'encapsulate', | ||
| Ligne 237 : | Ligne 201 : | ||
'labelMsg': 'A2', | 'labelMsg': 'A2', | ||
'type': 'button', | 'type': 'button', | ||
'icon': 'button_head_A2.png', | 'icon': 'resources/assets/button_head_A2.png', | ||
'action': { | 'action': { | ||
'type': 'encapsulate', | 'type': 'encapsulate', | ||
| Ligne 250 : | Ligne 214 : | ||
'labelMsg': 'Galerie', | 'labelMsg': 'Galerie', | ||
'type': 'button', | 'type': 'button', | ||
'icon': 'btn_toolbar_gallery.png', | 'icon': 'resources/assets/btn_toolbar_gallery.png', | ||
'action': { | 'action': { | ||
'type': 'encapsulate', | 'type': 'encapsulate', | ||
| Ligne 263 : | Ligne 227 : | ||
'labelMsg': 'Date', | 'labelMsg': 'Date', | ||
'type': 'button', | 'type': 'button', | ||
'icon': 'button_date.png', | 'icon': 'resources/assets/button_date.png', | ||
'action': { | 'action': { | ||
'type': 'encapsulate', | 'type': 'encapsulate', | ||
| Ligne 274 : | Ligne 238 : | ||
'labelMsg': 'Attention', | 'labelMsg': 'Attention', | ||
'type': 'button', | 'type': 'button', | ||
'icon': 'button_aviso.png', | 'icon': 'resources/assets/button_aviso.png', | ||
'action': { | 'action': { | ||
'type': 'encapsulate', | 'type': 'encapsulate', | ||
| Ligne 286 : | Ligne 250 : | ||
'labelMsg': 'Retour ligne', | 'labelMsg': 'Retour ligne', | ||
'type': 'button', | 'type': 'button', | ||
'icon': 'button_br.png', | 'icon': 'resources/assets/button_br.png', | ||
'action': { | 'action': { | ||
'type': 'encapsulate', | 'type': 'encapsulate', | ||
| Ligne 297 : | Ligne 261 : | ||
label: 'Liens vers', | label: 'Liens vers', | ||
type: 'button', | type: 'button', | ||
icon: 'button_liens.png', | icon: 'resources/assets/button_liens.png', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
| Ligne 310 : | Ligne 274 : | ||
label: 'Catégorie', | label: 'Catégorie', | ||
type: 'button', | type: 'button', | ||
icon: 'button_categorie.png', | icon: 'resources/assets/button_categorie.png', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
| Ligne 322 : | Ligne 286 : | ||
label: 'Box', | label: 'Box', | ||
type: 'button', | type: 'button', | ||
icon: 'button_box.png', | icon: 'resources/assets/button_box.png', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
| Ligne 335 : | Ligne 299 : | ||
label: 'Code', | label: 'Code', | ||
type: 'button', | type: 'button', | ||
icon: 'button_code.png', | icon: 'resources/assets/button_code.png', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
| Ligne 350 : | Ligne 314 : | ||
}; | }; | ||
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar | /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */ | ||
if ( | if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { | ||
mw.loader.using( 'user.options' | mw.loader.using( 'user.options' ).then( function () { | ||
// This can be the string "0" if the user disabled the preference ([[ | // This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]]) | ||
if ( mw.user.options.get( 'usebetatoolbar | if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) { | ||
$.when( | $.when( | ||
mw.loader.using( 'ext.wikiEditor | mw.loader.using( 'ext.wikiEditor' ), $.ready | ||
).then( customizeToolbar ); | ).then( customizeToolbar ); | ||
} | } | ||
} ); | } ); | ||
} | } | ||
// Add the customizations to LiquidThreads' edit toolbar, if available | // Add the customizations to LiquidThreads' edit toolbar, if available | ||
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar ); | mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar ); | ||