437
modifications
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 1 : | Ligne 1 : | ||
if ( [ ' | /* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */ | ||
// | |||
mw. | // gestion du Menu Toolbox | ||
function ModifySidebar( action, section, name, link ) { | |||
try { | |||
switch ( section ) { | |||
case 'languages': | |||
var target = 'p-lang'; | |||
break; | |||
case 'toolbox': | |||
var target = 'p-tb'; | |||
break; | |||
case 'navigation': | |||
var target = 'p-navigation'; | |||
break; | |||
default: | |||
var target = 'p-' + section; | |||
break; | |||
} | |||
if ( action == 'add' ) { | |||
var node = document.getElementById( target ) | |||
.getElementsByTagName( 'div' )[0] | |||
.getElementsByTagName( 'ul' )[0]; | |||
var aNode = document.createElement( 'a' ); | |||
var liNode = document.createElement( 'li' ); | |||
aNode.appendChild( document.createTextNode( name ) ); | |||
aNode.setAttribute( 'href', link ); | |||
liNode.appendChild( aNode ); | |||
liNode.className = 'plainlinks'; | |||
node.appendChild( liNode ); | |||
} | |||
if ( action == 'remove' ) { | |||
var list = document.getElementById( target ) | |||
.getElementsByTagName( 'div' )[0] | |||
.getElementsByTagName( 'ul' )[0]; | |||
var listelements = list.getElementsByTagName( 'li' ); | |||
for ( var i = 0; i < listelements.length; i++ ) { | |||
if ( | |||
listelements[i].getElementsByTagName( 'a' )[0].innerHTML == name || | |||
listelements[i].getElementsByTagName( 'a' )[0].href == link | |||
) | |||
{ | |||
list.removeChild( listelements[i] ); | |||
} | |||
} | |||
} | |||
} catch( e ) { | |||
// let's just ignore what's happened | |||
return; | |||
} | |||
} | |||
function SetUserToolbox() { | |||
// adds [[Special:CategoryTree|Special:CategoryTree]] to toolbox | |||
//ModifySidebar( 'add', 'toolbox', 'CategoryTree', 'https://en.wikipedia.org/wiki/Special:CategoryTree' ); | |||
// removes [[Special:Upload|Special:Upload]] from toolbox | |||
ModifySidebar( 'remove', 'toolbox', 'Téléverser un fichier', '' ); | |||
ModifySidebar( 'remove', 'toolbox', 'Pages spéciales', '' ); | |||
ModifySidebar( 'remove', 'toolbox', 'Informations sur la page', '' ); | |||
ModifySidebar( 'remove', 'toolbox', 'Suivi des pages liées', '' ); | |||
ModifySidebar( 'remove', 'toolbox', 'Pages liées', '' ); | |||
} | |||
function SetAdminToolbox() { | |||
// adds [[Special:CategoryTree|Special:CategoryTree]] to toolbox | |||
//ModifySidebar( 'add', 'toolbox', 'CategoryTree', 'https://en.wikipedia.org/wiki/Special:CategoryTree' ); | |||
// removes [[Special:Upload|Special:Upload]] from toolbox | |||
ModifySidebar( 'add', 'toolbox', 'Aide', 'http://keyla-project.com/index.php?title=Admin:Aide_%26_maintenance' ); | |||
} | |||
if ( mw.config.get( 'wgUserGroups', [] ).indexOf( 'user' ) === -1 ) {jQuery( SetUserToolbox ) } | |||
if ( mw.config.get( 'wgUserGroups', [] ).indexOf( 'sysop' ) !== -1 ) {jQuery( SetAdminToolbox ) } | |||
// -------------------------- | |||
// Customisation du Wikicode | |||
var customizeToolbar = function () { | |||
/* début code boutons */ | |||
$('#wpTextbox1').wikiEditor('addToToolbar', { | |||
section: 'main', | |||
group: 'format', | |||
tools: { | |||
"strikethrough": { | |||
label: 'Barrer', | label: 'Barrer', | ||
type: 'button', | type: 'button', | ||
Ligne 21 : | Ligne 102 : | ||
} | } | ||
} | } | ||
}); | }); | ||
$('#wpTextbox1').wikiEditor('addToToolbar', { | |||
section: 'main', | section: 'main', | ||
group: 'format', | group: 'format', | ||
tools: { | tools: { | ||
" | "underline": { | ||
label: ' | label: 'Souligner', | ||
type: 'button', | |||
icon: '/skins/DarkVector/images/cjnext_toolbar/underline_icon.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<u>", | |||
post: "</u>" | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'main', | |||
group: 'insert', | |||
tools: { | |||
"hline": { | |||
label: 'Insérer une ligne horizontale', | |||
type: 'button', | |||
icon: '/skins/DarkVector/images/cjnext_toolbar/hr_icon.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "----", | |||
ownline: true | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', | |||
{ | |||
'sections': | |||
{ | |||
'catalog': | |||
{ | |||
'type': 'booklet', | |||
'label': 'Catalogues', | |||
'pages': | |||
{ | |||
'section-personnages': | |||
{ | |||
'label': 'Personnages', | |||
'layout': 'characters', | |||
'characters': | |||
[ | |||
{ | |||
'label': "Autre (personnage)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Autre (personnage)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Allié", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Allié]]").replace('!',''), | |||
'ownline': true | |||
} | |||
} | |||
}, | |||
{ | |||
'label': "Antagoniste", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Antagoniste]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Catalyseur", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Catalyseur]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Gardien du seuil", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Gardien du seuil]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Héros", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Héros]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Love interest", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Love interest]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Mentor", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Mentor]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Messager", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Messager]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Métamorphe", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Métamorphe]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Ombre", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Ombre]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Protagoniste", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Protagoniste]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Trickster", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Trickster]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
} | |||
] | |||
}, | |||
'section-Objets': | |||
{ | |||
'label': 'Objets', | |||
'layout': 'characters', | |||
'characters': | |||
[ | |||
{ | |||
'label': "Autre (objet)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Autre (objet)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Arme", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Arme]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Domestique (objet)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Domestique (objet)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Communication (objet)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Communication (objet)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Extraterrestre (objet)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Extraterrestre (objet)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Industriel (objet)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Industriel (objet)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Instrument de musique", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Instrument de musique]]").replace('!',''), | |||
'ownline': true | |||
} | |||
} | |||
}, | |||
{ | |||
'label': "Matériel & ressource", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Matériel & ressource]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Médecine (objet)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Médecine (objet)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Transport", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Transport]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Vètement", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Vètement]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
} | |||
] | |||
}, | |||
'section-LieuxEvenements': | |||
{ | |||
'label': 'Lieux & évènements', | |||
'layout': 'characters', | |||
'characters': | |||
[ | |||
{ | |||
'label': "Autre (lieu & évènement)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Autre (lieu & évènement)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Abandonné - vestige (lieu)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Abandonné - vestige (lieu)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
} | |||
}, | |||
{ | |||
'label': "Culturel (lieu & évènement)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Culturel (lieu & évènement)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Disparu (lieu)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Disparu (lieu)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Extraterrestre (lieu & évènement)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Extraterrestre (lieu & évènement)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Historique (lieu & évènement)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Historique (lieu & évènement)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Inexploré (lieu)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Inexploré (lieu)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Social (lieu & évènement)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Social (lieu & évènement)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Sportif (lieu & évènement)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Sportif (lieu & évènement)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Vierge (lieu)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Vierge (lieu)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
} | |||
] | |||
}, | |||
'section-OrganisationsPolitiques': | |||
{ | |||
'label': 'Organisations Politiques', | |||
'layout': 'characters', | |||
'characters': | |||
[ | |||
{ | |||
'label': "Autre (organisation politique)", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Autre (organisation politique)]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Alliance", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Alliance]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Archiconfrérie", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Archiconfrérie]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Assemblée", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Assemblée]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Association", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Association]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Cartel", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Cartel]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Coalition", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Coalition]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Communauté", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Communauté]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Confrérie", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Confrérie]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Corporation", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Corporation]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Faction", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Faction]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Front", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Front]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Fédération", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Fédération]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Ligue", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Ligue]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Ordre", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Ordre]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Fédération", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Fédération]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Régime", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Régime]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Secte", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Secte]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Syndicat", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Syndicat]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Trust", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Trust]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
}, | |||
{ | |||
'label': "Union", | |||
'action': { | |||
'type': "replace", | |||
'options': { | |||
'pre' : ("[![category:Union]]").replace('!',''), | |||
'ownline': true | |||
} | |||
}, | |||
} | |||
] | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'insert', | |||
tools: { | |||
"embed": { | |||
label: 'Intégre un média', | |||
type: 'button', | |||
icon: '/skins/DarkVector/images/cjnext_toolbar/media_icon.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "{{EmbedMedia|Mediakey=<mediakey>|Idmedia=<idmedia>}}", | |||
ownline: true | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'insert', | |||
tools: { | |||
"gdoc": { | |||
label: 'Intégre un document google', | |||
type: 'button', | type: 'button', | ||
icon: '/skins/DarkVector/images/cjnext_toolbar/ | icon: '/skins/DarkVector/images/cjnext_toolbar/gdocs_icon.png', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
pre: "< | pre: "{{EmbedGoogleDoc|GoogleDocId =<google_doc_id>|Width = 100%|Height = <height>}}", | ||
ownline: true | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
'section': 'advanced', | |||
'groups': { | |||
'Cat': { | |||
'label': 'Catégories' // or use labelMsg for a localized label, see above | |||
} | |||
} | |||
} ) | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'Cat', | |||
tools: { | |||
"Todoby": { | |||
label: 'Lien vers la catégorie "A faire par ' + wgUserName + '"', | |||
type: 'button', | |||
icon: '/skins/DarkVector/images/cjnext_toolbar/todoby_icon.png', | |||
action: { | |||
type: 'replace', | |||
options: { | |||
pre: '<span class="plainlinks">[' + wgServer + wgScript + '?title=Catégorie:A_faire_par_'+ wgUserName + ' A faire par '+ wgUserName+']</span>', | |||
ownline: true | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'Cat', | |||
tools: { | |||
"Todoaskby": { | |||
label: 'Lien vers la catégorie "Tâche(s) demandée(s) par ' + wgUserName + '"', | |||
type: 'button', | |||
icon: '/skins/DarkVector/images/cjnext_toolbar/todoaskby_icon.png', | |||
action: { | |||
type: 'replace', | |||
options: { | |||
pre: '<span class="plainlinks">[' + wgServer + wgScript + '?title=Catégorie:Tâche(s)_demandée(s)_par_'+ wgUserName + ' Tâche(s) demandée(s) par '+ wgUserName+']</span>', | |||
ownline: true | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'Cat', | |||
tools: { | |||
"Todoby": { | |||
label: 'Lien vers la catégorie "Post-it"', | |||
type: 'button', | |||
icon: '/skins/DarkVector/images/cjnext_toolbar/todo_icon.png', | |||
action: { | |||
type: 'replace', | |||
options: { | |||
pre: '<span class="plainlinks">[' + wgServer + wgScript + '?title=Catégorie:Post-it Post-it]</span>', | |||
ownline: true | |||
} | } | ||
} | } | ||
} | } | ||
} | } | ||
}); | } ); | ||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'Cat', | |||
tools: { | |||
"cat": { | |||
label: 'Insérer une catégorie', | |||
type: 'button', | |||
icon: '/skins/DarkVector/images/cjnext_toolbar/category_icon.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "[[category:", | |||
peri: "Exemple de catégorie", | |||
post: "]]", | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group:'insert', | |||
tools: { | |||
templates: { | |||
label: 'Marque-page', | |||
type: 'select', | |||
list: { | |||
'blue-bookmak': { | |||
label: 'Marque-page bleu', | |||
action: { | |||
type: 'replace', | |||
options: { | |||
pre : ('{!{Marque-page|1|').replace('!',''), | |||
peri : 'Texte du marque-page', | |||
post : '}}' | |||
} | |||
} | |||
}, | |||
'orange-bookmak': { | |||
label: 'Marque-page orange', | |||
action: { | |||
type: 'replace', | |||
options: { | |||
pre : ('{!{Marque-page|2|').replace('!',''), | |||
peri : 'Texte du marque-page', | |||
post : '}}' | |||
} | |||
} | |||
}, | |||
'red-bookmak': { | |||
label: 'Marque-page-rouge', | |||
action: { | |||
type: 'replace', | |||
options: { | |||
pre : ('{!{Marque-page|3|').replace('!',''), | |||
peri : 'Texte du marque-page', | |||
post : '}}' | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} ); | } ); | ||
/* fin code boutons */ | |||
}; | |||
/* 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 ); | |||
} | |||
} ); | |||
} | } |