Aller au contenu

Utilisateur:Ginger FoxB/common.js

La bibliothèque libre.

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.
var customizeToolbar = function() {

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
           
            'nl': {
                label: 'nl',
                type: 'button',
                icon: 'https://upload.wikimedia.org/wikipedia/commons/9/9b/Linebreak_button.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "
"
                    }
                }
            },
            'hyph': {
                label: 'hyph',
                type: 'button',
                icon: 'https://upload.wikimedia.org/wikipedia/commons/3/35/Highway_gothic_font_Armenian_hyphen.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "­"
                    }
                }
            }
        }
    } );
    // To add a special characters page
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'sections': {
            'touareg': {
                'type': 'booklet',
                'label': 'Touareg'
            }
        },
        'section': 'touareg',
        'pages': {
            'touareg': {
                'layout': 'characters',
                'label': 'Touareg',
                'characters': [ 'ⴰ', 'ⴱ', 'ⵛ', 'ⴷ', 'ⴹ', 'ⴼ', 'ⴳ', 'ⴶ', 'ⵂ', 'ⵉ', 'ⵋ', 'ⴾ', 'ⵈ', 'ⵆ', 'ⵍ', 'ⵎ', 'ⵏ', 'ⵐ', 'ⵓ', 'ⵔ', 'ⵗ', 'ⵙ', 'ⵜ', 'ⵟ', 'ⵣ', 'ⵥ', '⵿', 'Ă', 'ă', 'Ạ', 'ạ', 'Ḍ', 'ḍ', 'D̤', 'd̤', 'Ĕ', 'ĕ', 'É̆', 'é̆', 'Ġ', 'ġ', 'Ḥ', 'ḥ', 'Ĭ', 'ĭ', 'Ḳ', 'ḳ', 'K̤', 'k̤', 'Ñ', 'ñ', 'Ṅ', 'ṅ', 'Ŏ', 'ŏ', 'Ṛ', 'ṛ', 'Ṣ', 'ṣ', 'Ṭ', 'ṭ', 'Ŭ', 'ŭ', 'Ż', 'ż', '‖', '√', '⁂', '✳', '⁒', '″', 'α', 'μ', 'π', 'φ', 'ω', 'ρ' ]
            }
        }
    } );
};
            
/* 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' ).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 );
        }
    } );
}