MediaWiki:Common.js : Différence entre versions

De AGX
Aller à : navigation, rechercher
 
(16 révisions intermédiaires par le même utilisateur non affichées)
Ligne 5 : Ligne 5 :
 
'tools': {
 
'tools': {
 
'smile': {
 
'smile': {
label: 'Smile!',  
+
label: 'Fonctions AGX',  
type: 'button',
+
type: 'select',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
+
list: {
action: {
+
'AGX Bleu': {
type: 'encapsulate',
+
labelMsg: 'AGX Bleu',
options: {
+
action: {
pre: ":)"
+
type: 'encapsulate',
}
+
options: {
}
+
pre: '<p class="bleuAGX">',
 +
periMsg: 'wikieditor-toolbar-tool-nowiki-example',
 +
post: '</p>'
 +
}
 +
}
 +
},
 +
'AGX Violet': {
 +
labelMsg: 'AGX Violet',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
pre: '<p class="violetAGX">',
 +
periMsg: 'wikieditor-toolbar-tool-nowiki-example',
 +
post: '</p>'
 +
}
 +
}
 +
},
 +
'AGX Orange': {
 +
labelMsg: 'AGX Orange',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
pre: '<p class="orangeAGX">',
 +
periMsg: 'wikieditor-toolbar-tool-nowiki-example',
 +
post: '</p>'
 +
}
 +
}
 +
},
 +
'AGX Vert': {
 +
labelMsg: 'AGX Vert',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
pre: '<p class="vertAGX">',
 +
periMsg: 'wikieditor-toolbar-tool-nowiki-example',
 +
post: '</p>'
 +
}
 +
}
 +
},
 +
 
 +
                                                                                'AGX Remarque': {
 +
labelMsg: 'AGX Remarque',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
pre: '<div class="remarque">[[Fichier:remarque.png]]',
 +
periMsg: 'wikieditor-toolbar-tool-nowiki-example',
 +
post: '</div>'
 +
}
 +
}
 +
},
 +
'AGX Astuce': {
 +
labelMsg: 'AGX Astuce',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
pre: '<div class="astuce">[[Fichier:astuce.png]]',
 +
periMsg: 'wikieditor-toolbar-tool-nowiki-example',
 +
post: '</div>'
 +
}
 +
}
 +
},
 +
 
 +
 
 +
 
 +
                                                                       
 +
}
 
}
 
}
 
}
 
}

Version actuelle datée du 23 avril 2021 à 10:26

var customizeToolbar = function () {
	$('#wpTextbox1').wikiEditor('addToToolbar', {
		'section': 'advanced',
		'group': 'format',
		'tools': {
			'smile': {
				label: 'Fonctions AGX', 
				type: 'select',
				list: {
										'AGX Bleu': {
											labelMsg: 'AGX Bleu',
											action: {
												type: 'encapsulate',
												options: {
													pre: '<p class="bleuAGX">',
													periMsg: 'wikieditor-toolbar-tool-nowiki-example',
													post: '</p>'
												}
											}
										},
										'AGX Violet': {
											labelMsg: 'AGX Violet',
											action: {
												type: 'encapsulate',
												options: {
													pre: '<p class="violetAGX">',
													periMsg: 'wikieditor-toolbar-tool-nowiki-example',
													post: '</p>'
												}
											}
										},
										'AGX Orange': {
											labelMsg: 'AGX Orange',
											action: {
												type: 'encapsulate',
												options: {
													pre: '<p class="orangeAGX">',
													periMsg: 'wikieditor-toolbar-tool-nowiki-example',
													post: '</p>'
												}
											}
										},
										'AGX Vert': {
											labelMsg: 'AGX Vert',
											action: {
												type: 'encapsulate',
												options: {
													pre: '<p class="vertAGX">',
													periMsg: 'wikieditor-toolbar-tool-nowiki-example',
													post: '</p>'
												}
											}
										},

                                                                                'AGX Remarque': {
											labelMsg: 'AGX Remarque',
											action: {
												type: 'encapsulate',
												options: {
													pre: '<div class="remarque">[[Fichier:remarque.png]]',
													periMsg: 'wikieditor-toolbar-tool-nowiki-example',
													post: '</div>'
												}
											}
										},
 'AGX Astuce': {
											labelMsg: 'AGX Astuce',
											action: {
												type: 'encapsulate',
												options: {
													pre: '<div class="astuce">[[Fichier:astuce.png]]',
													periMsg: 'wikieditor-toolbar-tool-nowiki-example',
													post: '</div>'
												}
											}
										},



                                                                         
									}
			}
		}
	} );
};

/* 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 );