Utilisateur:Ayack/common.js
Apparence
Note : après avoir enregistré 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 pressez Ctrl-F5 ou Ctrl-R (⌘-R sur un Mac) ;
- Google Chrome : Appuyez sur Ctrl-Maj-R (⌘-Shift-R sur un Mac) ;
- Internet Explorer : Maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5 ;
- Opera : Allez dans Menu → Settings (Opera → Préférences sur un Mac) et ensuite à Confidentialité & sécurité → Effacer les données d'exploration → Images et fichiers en cache.
importScript('Utilisateur:Seudo/resize.js');
/**
* Direct imagelinks to Commons
*
* @source mediawiki.org/wiki/Snippets/Direct_imagelinks_to_Commons
* @author [[commons:User:Krinkle]]
* @version 9
*/
if ( mw.config.get( 'wgNamespaceNumber', 0 ) >= 0 ) {
$( function () {
var
uploadBaseRe = /^\/\/upload\.wikimedia\.org\/wikipedia\/commons/,
localBasePath = mw.util.getUrl( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ),
localBaseScript = mw.util.wikiScript() + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ),
commonsBasePath = '//commons.wikimedia.org/wiki/File:',
commonsBaseScript = '//commons.wikimedia.org/w/index.php?title=File:';
$( 'a.image, a.mw-file-description' ).attr( 'href', function ( i, currVal ) {
if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) {
return currVal
.replace( localBasePath, commonsBasePath )
.replace( localBaseScript, commonsBaseScript );
}
});
});
}
/* Fin Direct imagelinks to Commons */
importScript('User:Seudo/wikidatafy.js');
// <source lang="JavaScript">
var customizeToolbar = function () {
if ( typeof jQuery.fn.wikiEditor !== 'undefined' ) {
jQuery( function ($) {
// Barre principale
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'local1': {
'type': 'toolbar',
'label': 'LFZP'
}
}
} );
// Barre secondaire : Titres
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'groups': { 'deco': { 'label': 'Décorations' }
}
} );
// Barre secondaire : Boutons groupe 1
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'group': 'deco',
'tools': {
'PieIX': {
label: 'Pie IX',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/f/fb/Gaston_de_Vill%C3%A8le_et_Charles_de_La_Noue_-_Les_Fran%C3%A7ais_zouaves_pontificaux_%281903%29_-_p._10_-_Pie_IX-22px.png',
action: {
type: 'encapsulate',
options: {
pre: '{{LFZP/Pie IX}}',
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'group': 'deco',
'tools': {
'StGrg': {
label: 'Saint-Grégoire',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/a/a8/Gaston_de_Vill%C3%A8le_et_Charles_de_La_Noue_-_Les_Fran%C3%A7ais_zouaves_pontificaux_%281903%29_-_p._10_-_Saint-Gr%C3%A9goire-22px.png',
action: {
type: 'encapsulate',
options: {
pre: '{{LFZP/Saint-Grégoire}}',
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'group': 'deco',
'tools': {
'StSyl': {
label: 'Saint-Sylvestre',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/d/d7/Gaston_de_Vill%C3%A8le_et_Charles_de_La_Noue_-_Les_Fran%C3%A7ais_zouaves_pontificaux_%281903%29_-_p._10_-_Saint-Sylvestre-22px.png',
action: {
type: 'encapsulate',
options: {
pre: '{{LFZP/Saint-Sylvestre}}',
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'group': 'deco',
'tools': {
'LH': {
label: 'Légion d\'Honneur',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/b/b9/Gaston_de_Vill%C3%A8le_et_Charles_de_La_Noue_-_Les_Fran%C3%A7ais_zouaves_pontificaux_%281903%29_-_p._10_-_L%C3%A9gion_d%27Honneur-22px.png',
action: {
type: 'encapsulate',
options: {
pre: '{{LFZP/Légion d\'Honneur}}',
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'group': 'deco',
'tools': {
'PPS': {
label: 'Pro Petri Sede',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/f/f5/Gaston_de_Vill%C3%A8le_et_Charles_de_La_Noue_-_Les_Fran%C3%A7ais_zouaves_pontificaux_%281903%29_-_p._10_-_Pro_Petri_Sede-22px.png',
action: {
type: 'encapsulate',
options: {
pre: '{{LFZP/Pro Petri Sede}}',
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'group': 'deco',
'tools': {
'FEV': {
label: 'Fidei et Virtuti',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/11/Gaston_de_Vill%C3%A8le_et_Charles_de_La_Noue_-_Les_Fran%C3%A7ais_zouaves_pontificaux_%281903%29_-_p._10_-_Fidei_et_Virtuti-22px.png',
action: {
type: 'encapsulate',
options: {
pre: '{{LFZP/Fidei et Virtuti}}',
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'group': 'deco',
'tools': {
'PEEP': {
label: 'Pro Ecclesia et Pontifice',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/1a/Gaston_de_Vill%C3%A8le_et_Charles_de_La_Noue_-_Les_Fran%C3%A7ais_zouaves_pontificaux_%281903%29_-_p._10_-_Pro_Ecclesia_et_Pontifice-22px.png',
action: {
type: 'encapsulate',
options: {
pre: '{{LFZP/Pro Ecclesia et Pontifice}}',
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'group': 'deco',
'tools': {
'MIA': {
label: 'Mort à l\'ennemi',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/6/69/Gaston_de_Vill%C3%A8le_et_Charles_de_La_Noue_-_Les_Fran%C3%A7ais_zouaves_pontificaux_%281903%29_-_p._10_-_Mort_%C3%A0_l%27ennemi-22px.png',
action: {
type: 'encapsulate',
options: {
pre: '{{LFZP/Mort à l\'ennemi}}',
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'local1',
'group': 'deco',
'tools': {
'DCD': {
label: 'Décédé',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/a/a5/Gaston_de_Vill%C3%A8le_et_Charles_de_La_Noue_-_Les_Fran%C3%A7ais_zouaves_pontificaux_%281903%29_-_p._10_-_D%C3%A9c%C3%A9d%C3%A9-22px.png',
action: {
type: 'encapsulate',
options: {
pre: '{{LFZP/Décédé}}',
}
}
}
}
} );
} );
}
};
/* Check if we are in edit mode and the required modules are available and then customize the toolbar */
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
mw.loader.using( 'user.options', function () {
if ( mw.user.options.get('usebetatoolbar') ) {
mw.loader.using( 'ext.wikiEditor', function () {
$(document).ready( customizeToolbar );
} );
}
} );
}
// </source>