Ir al contenido

Usuario:Kizar/common.js

De Wikipedia, la enciclopedia libre

Nota: Después de guardar, debes refrescar la caché de tu navegador para ver los cambios. Internet Explorer: mantén presionada Ctrl mientras pulsas Actualizar. Firefox: mientras presionas Mayús pulsas el botón Actualizar, (o presiona Ctrl-Shift-R). Los usuarios de Google Chrome y Safari pueden simplemente pulsar el botón Recargar. Para más detalles e instrucciones acerca de otros exploradores, véase Ayuda:Cómo limpiar la caché.

importScript('Usuario:Kizar/FastButtons.js');

/*
// Will do all resources stuff for multiple modules at once
mw.loader.load( ['mediawiki.util', 'jquery.ui', 'jquery.tipsy'] );

importScript('Usuario:Kizar/Twinkle/morebits.js');
importStylesheet('Usuario:Kizar/Twinkle/morebits.css');

importScript('Usuario:Kizar/Twinkle/moment.js'); // para un plugin de twinkle
importScript('Usuario:Kizar/Twinkle/alltwinkle.js'); // todos los modulos de twinkle

//importScript('Usuario:Kizar/Twinkle/twinkle.js');
*/

// Añadir los botones de listados en la barra de herramientas
// <nowiki>
var customizeToolbar = function() {
$( function() {
             if ( typeof $.fn.wikiEditor != 'undefined' ) {
                   $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
                          'section': 'main',
                          'group': 'insert',
                          'tool': 'reference'
                   });
             }
        });

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'groups': {
                'kbuttons': {
                        'label': 'KB' // or use labelMsg for a localized label, see above
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/c/c0/Button_link.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '[[',
                                        post: ']]' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/e/ec/Button_extlink.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '[',
                                        post: ']' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Button_redirect.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '#REDIRECCIÓN [[',
                                        post: ']]' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/a/a0/Button_references_alt.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '<ref>',
                                        post: '</ref>' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/0/0d/Button_wikification.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{wikificar|t={{subst:CURRENTTIMESTAMP}}}}',
                                        post: '' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/5/5c/Button_references2.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{referencias|t={{subst:CURRENTTIMESTAMP}}}}',
                                        post: '' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/9/9a/Button_references.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{Añadir referencias}}',
                                        post: '' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/f/f0/Bouton_Vandale0.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{destruir|',
                                        post: '}}' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/b/ba/Button_carton_jaune.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{subst:Bienvenido usuario}} --~~~~',
                                        post: '' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/3/39/Button_carton_rouge.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{subst:Usuario:Kizar/Bienvenida registro}} --~~~~',
                                        post: '' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'kbuttons',
        'tools': {
                'Listings': {
                        label: '', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'https://upload.wikimedia.org/wikipedia/commons/3/39/Button_carton_rouge.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{subst:Usuario:Kizar/Enlaces interlingüísticos}} --~~~~',
                                        post: '' // text to be inserted
                                }
                        }
                }
        }
} );
}

/* 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 () {
                if ( mw.user.options.get('usebetatoolbar') ) {
                        mw.loader.using( 'ext.wikiEditor', function () {
                                $(document).ready( customizeToolbar );
                        } );
                }
        } );
}
// </nowiki>