Usuario:King of Herdaz/common.js
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: 30, } //customize toolbar var customizeToolbar = function() { /* Your code goes here */ //add new section to editing toolbar $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': { 'snippets': { 'type': 'booklet', 'label': 'Useful Stuff', 'pages': { //page of commonly used infoboxes 'section-infoboxes': { 'label': 'Infoboxes', 'layout': 'characters', 'characters': [ { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{'+'{artist|image=|alias=|as=|behance=|da=|fb=|ig=|reddit=|tumblr=|twitter=|site=|license=all|some|none|official|contact=|type=fan|interior|cover|multimedia}}' } }, 'label': '{' + '{artist}}' }, '{'+'{architecture', '{'+'{business', '{'+'{character', '{'+'{event', '{'+'{food', '{'+'{geography', '{'+'{group', '{'+'{item', '{'+'{lifeform', '{'+'{literature', '{'+'{location', '{'+'{settlement', '{'+'{vehicle', ] }, //page of commonly used infobox parameters 'section-params': { 'label': 'Infobox Parameters', 'layout': 'characters', 'characters': [ '|residence=', '|profession=', '|#profession=', '|species=', '|abilities=', '|ethnicity=', '|born=', '|died=', '|nationality=', '|image=', '|residence=', '|world=Scadrial', '|world=Roshar', '|world=Nalthis', '|world=Taldain', '|earth=Alcatraz', '|universe=[[Cosmere]]', '|books=[[Mistborn Era 1]]', '|books=[[Mistborn Era 2]]', '|books=[[The Stormlight Archive]]', '|books=[[Warbreaker]]', //alcatraz is very long so I had to do it differently { 'action': { 'type': 'encapsulate', 'options': { 'pre': '|books=[[Alcatraz Versus the Evil Librarians (series)|Alcatraz Versus the Evil Librarians]]' } }, 'label': '|books=Alcatraz' }, ] }, //page of stuff commonly used at the end of a page 'section-bottom': { 'label': 'Bottom of Page', 'layout': 'characters', 'characters': [ '== Notes ==', '<' + 'references/>', '{' + '{stub}}', '{' + '{partial}}', '{' + '{complete}}', '{' + '{Alcatraz}}', '{' + '{Elantris}}', '{' + '{Mistborn|Era 1}}', '{' + '{Mistborn|Era 2}}', '{' + '{Reckoners}}', '{' + '{Skyward}}', '{' + '{Stormlight}}', '{' + '{Warbreaker}}', '{' + '{White Sand}}', ] }, //page of other useful stuff 'section-tags': { 'label': 'Other Stuff', 'layout': 'characters', 'characters': [ '{' + '{spoiler|sa4}}', '{' + '{update|sa4}}', '{' + '{for|/Gallery|more images}}', '{' + '{columns|count=2|', '<br/>', '{' + '{for|:Category:Residents of {{PAGENAME}}|a full list see}}', '{' + '{Special:PrefixIndex/{{FULLPAGENAME}}/|stripprefix=1}}', '{' + '{expand}}', '{' + '{cite}}', '{' + '{clarify}}', '{' + '{disputed}}', '{' + '{delete}}', '{' + '{move|}}', '{' + '{merge|}}', '{' + '{anchor|}}', '{' + '{theory}}', '{' + '{uncanonical}}', '{' + '{copyright}}', { 'action': { 'type': 'encapsulate', 'options': { 'pre': '<small><center>by {' + '{a|', 'post': '}}</center></small>' } }, 'label': 'Artist heading' }, { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{' + '{cat tag|', 'post': '|}}' } }, 'label': '{' + '{cat tag}}' }, { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{' + '{tag+|', 'post': '}}' } }, 'label': '{' + '{tag+}}' }, { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{' + '{tag|', 'post': '}}' } }, 'label': '{' + '{tag}}' }, { 'action': { 'type': 'encapsulate', 'options': { 'pre': '<pre>', 'post': '</pre>' } }, 'label': '<pre></pre>' }, { 'action': { 'type': 'encapsulate', 'options': { 'pre': '<code>', 'post': '</code>' } }, 'label': '<code></code>' }, { 'action': { 'type': 'encapsulate', 'options': { 'pre': '<strike>', 'post': '</strike>' } }, 'label': '<strike></strike>' } ] } } } } }); // Add category button to the "advanced" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'advanced', 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: "]]" } } } } }); // Add image template button to the "advanced" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'advanced', 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}}' } } } } }); // Add Wikipedia link button to the "advanced" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'advanced', 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: "|]]" } } } } }); // Add signature button to the "advanced" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'advanced', group: 'format', tools: { "category": { label: 'Signature', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/d/d1/Button_mysignature.png', action: { type: 'encapsulate', options: { pre: '--' + '~~' + '~~' } } } } }); // Add hidden text button to the "advanced" section $('#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Hidden text', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png', action: { type: 'encapsulate', options: { pre: "<!-- ", post: " -->" } } } } }); //Remove default references button $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'reference' }); //Add new references dropdown to the "advanced" section $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', groups: { list: { tools: { references: { label: 'References', type: 'select', list: { 'book-button': { label: '{' + '{book ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{book ref|', post: '}}' } } }, 'wob-button': { label: '{' + '{wob ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{wob ref|', post: '}}' } } }, 'ref-button': { label: '{' + '{ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{ref|text=', post: '}}' } } }, 'epigraph-button': { label: '{' + '{epigraph ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{epigraph ref|', post: '}}' } } }, 'au-button': { label: '{' + '{au ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{au ref|', post: '}}' } } }, 'msh-button': { label: '{' + '{msh ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{msh ref|', post: '}}' } } }, 'file-button': { label: '{' + '{file ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{file ref|', post: '}}' } } }, 'url-button': { label: '{' + '{url ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{url ref|url=', post: '|text=|date=|site=}}' } } }, '17s-button': { label: '{' + '{17s ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{17s ref|topic/news/post', post: '|id#|description|date=}}' } } } } } } } } } ); }; /* * 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); } }); }