« MediaWiki:Common.js » : différence entre les versions

De Adadov.net wiki
(Page blanchie)
(Page créée avec « →‎Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. : var customizeToolbar = function() { $('#wpTextbox1').wikiEditor('addTo... »)
Ligne 1 : Ligne 1 :
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */


var customizeToolbar = function() {
$('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
                "strikethrough": {
                        label: 'Strike',
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "<s>",
                                        post: "</s>"
                                }
                        }
                }
        }
});
};
/* 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.toolbar', function () {
                                $(document).ready( customizeToolbar; );
                        } );
                }
        } );
}

Version du 18 avril 2012 à 15:44

/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */

var customizeToolbar = function() {
$('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
                "strikethrough": {
                        label: 'Strike',
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "<s>",
                                        post: "</s>"
                                }
                        }
                }
        }
});
};
 
/* 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.toolbar', function () {
                                $(document).ready( customizeToolbar; );
                        } );
                }
        } );
}