Bienvenue sur le wiki de Nuit debout, nous sommes le 2972 mars.
Utilisateur:Tuxun/common.js
De NuitDebout
< Utilisateur:Tuxun
Révision de 17 juillet 2016 à 05:29 par Tuxun (discussion | contributions) (Page créée avec « ///////////////////////////////// var customizeToolbar = function() { →start toolbar section : $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': { 'emo... »)
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 : Videz le cache dans Outils → Préférences.
/////////////////////////////////
var customizeToolbar = function() {
/*start toolbar section*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'emoticons': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Emoticons'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'categs': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Catégories'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'templates': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Raccourcis'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'codesources': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'code source'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'filetools': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'fichiers'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'videos': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'video'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
/*end toolbar section*/
/*start group section*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'groups': {
'faces': {
'label': 'Faces' // or use labelMsg for a localized label, see above
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'groups': {
'licenses': {
'label': 'licences' // or use labelMsg for a localized label, see above
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'groups': {
'shorts': {
'label': 'raccourci' // or use labelMsg for a localized label, see above
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'filetools',
'groups': {
'3dtools': {
'label': 'stl' // or use labelMsg for a localized label, see above
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'videos',
'groups': {
'video': {
'label': 'video' // or use labelMsg for a localized label, see above
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'codesources',
'groups': {
'sources': {
'label': 'Code source' // or use labelMsg for a localized label, see above
}
}
} );
/*end groups section*/
/*start button group section*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'faces',
'tools': {
'smile': {
label: 'Smile!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'encapsulate',
options: {
pre: ":)" // text to be inserted
}
}
}
}
} );
//code butttons
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'codesources',
'group': 'sources',
'tools': {
'code': {
label: 'code!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'replace',
options: {
'pre': "<code name='nom.ino'>",
'periMsg': 'votre code ici',
'post': "</code>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'codesources',
'group': 'sources',
'tools': {
'code': {
label: 'code!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'replace',
options: {
'pre': "<code name='nom.ino' lang='cpp' download linenumbers>",
'periMsg': 'wikieditor-toolbar-tool-bold-example',
'post': "</code>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'licenses',
'tools': {
'code': {
label: 'CC-by-sa', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/9/96/CC-BY-SA-icon-80x15.png',
action: {
type: 'encapsulate',
options: {
pre: "== Conditions d'utilisation == \n {{CC-by-sa-3.0}}" // text to be inserted
}
}
}
}
} );
//UploadWizard
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'shorts',
'tools': {
'code': {
label: 'Liste de sous-pages', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "{{Special:Index/{{FULLPAGENAME}}/}}" // text to be inserted
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'shorts',
'tools': {
'shortlinks': {
label: 'liste de composants!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'encapsulate',
options: {
'pre':
"{| class='wikitable' border='1' "+
"|-! Composant "+
"! Valeur/TYPE"+
"! quantité "+
"|-"+
"| Résistance:"+
"| 1K Ohm"+
"| 5"+
"|-"+
"| Résistance:"+
"| 100 Ohm"+
"| 5"+
"|-"+
"| Résistance:"+
"| 10K Ohm"+
"| 1"+
"|-"+
"| Potentiomètre:"+
"| 10K Ohm Linéaire"+
"| 1"+
"|-"+
"| Transistor:"+
"| 2N2222"+
"| 4"+
"|-"+
"| Condensateur:"+
"| 100 µF"+
"| 1"+
"|-"+
"| Condensateur:"+
"| 0.01 µF"+
"| 5"+
"|-"+
"| Arduino:"+
"| Uno ou + (à adapter)"+
"| 1"+
"|}",
}
}
}
}
} );
//github3Dviewer
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'filetools',
'group': '3dtools',
'tools': {
'stlgithubview': {
label: 'git3d!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'replace',
options: {
'pre': "<script src='https://embed.github.com/view/3d/",
'periMsg': 'USER/REPO/BRANCH/PATH/FILE.stl',
'post': "'></script>"
}
}
}
}
} );
//video buttons
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'videos',
'group': 'video',
'tools': {
'archive': {
label: 'Archive.org!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//wiki.funlab.fr/images/d/d0/Logovideo.png',
action: {
type: 'replace',
options: {
'pre': "{{#Widget:Archive.org|id=",
'periMsg': 'idvideo',
'post': "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'videos',
'group': 'video',
'tools': {
'vimeo': {
label: 'Vimeo', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//wiki.funlab.fr/images/d/d0/Logovideo.png',
action: {
type: 'replace',
options: {
'pre': "{{#Widget:Vimeo|id=",
'periMsg': 'idvideo',
'post': "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'videos',
'group': 'video',
'tools': {
'youtube': {
label: 'Youtube', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//wiki.funlab.fr/images/d/d0/Logovideo.png',
action: {
type: 'replace',
options: {
'pre': "{{#Widget:Youtube|id=",
'periMsg': 'idvideo',
'post': "}}"
}
}
}
}
} );
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
mw.loader.using( 'user.options', 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.toolbar' ), $.ready
).then( customizeToolbar );
}
} );
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );
$("div.portal h3").click(function() {
$("this").next().toggle(500);
});