Usuario:King of Herdaz/common.js
< Usuario:King of Herdaz
Revisión del 04:17 7 oct 2021 de King of Herdaz (discusión | contribs.)
Nota: tras guardar, quizás necesites actualizar la caché de tu navegador para ver los cambios.
- Firefox/Safari: Mantén presionada la tecla Mayús mientras pulsas el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
- Google Chrome: presiona Ctrl+Shift+R (⌘+Mayús+R en Mac)
- Internet Explorer: mantén presionada Ctrl mientras pulsas Actualizar, o presiona Ctrl+F5
- Opera: dirígete a Menú → Configuración (Opera → Preferencias en Mac) y luego a Privacidad y seguridad → Borrar datos de navegación → Imágenes y archivos en caché.
//change syntax highlighter timeout time ('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript'); syntaxHighlighterConfig = { timeout: 45, } //customize toolbar var customizeToolbar = function() { /* Your code goes here */ //removing original buttons I don't want //Remove default references button $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'reference' }); //remove bulleted list button $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'advanced', 'group': 'format', 'tool': 'ulist' }); //remove numbered list button $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'advanced', 'group': 'format', 'tool': 'olist' }); //remove <br> button so I can replace it with my own <br/> button $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'advanced', 'group': 'format', 'tool': 'newline' }); //remove table button $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'advanced', 'group': 'insert', 'tool': 'table' }); //remove File button $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'file' }); //remove original link button $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'link' }); //Adding various buttons // Adding category button to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "category": { label: 'Category', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png', action: { type: 'encapsulate', options: { pre: "[[Category: ", post: "]]" } } } } }); // Adding image template button to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "category": { label: 'Image template', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/d/d8/Vector_toolbar_insert_image_button.png', action: { type: 'encapsulate', options: { pre: '{' + '{image|', post: '|side=|width=|caption}}' } } } } }); // Adding Wikipedia link button to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "category": { label: 'Wikipedia', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/c/cb/Button_wikipedia.png', action: { type: 'encapsulate', options: { pre: "[[Wikipedia: ", post: "|]]" } } } } }); // Adding signature button to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'format', tools: { "category": { label: 'Signature', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/6/6d/Button_sig.png', action: { type: 'encapsulate', options: { pre: '~~' + '~~' } } } } }); // Adding <br/> button to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "category": { label: 'Break tag', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/1/13/Button_enter.png', action: { type: 'encapsulate', options: { pre: '<' + 'br />', } } } } }); // Adding link button to the "main" section $('#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'format', tools: { "comment": { label: 'Link', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/9/97/Button_int_link.png', action: { type: 'encapsulate', options: { pre: "[[", post: "]]" } } } } }); // Adding hidden text button to the "main" section $('#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'format', tools: { "comment": { label: 'Hidden text', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/1/1b/Button_hide_wiki_tag.png', action: { type: 'encapsulate', options: { pre: "<!--", post: "-->" } } } } }); // Adding columns button to the "main" section $('#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'format', tools: { "comment": { label: 'Columns', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/2/25/Vector_toolbar_bulleted_list_button.png', action: { type: 'encapsulate', options: { pre: '{' + '{columns|' + '\n', post: '\n' + '}}' } } } } }); /* * Check if view is in edit mode and that the required modules are available. Then, customize the toolbar... * Don't touch below this line! */ if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -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); } }); }