Usuario:King of Herdaz/common.js
< Usuario:King of Herdaz
Revisión del 01:47 19 ene 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: 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-art': { 'label': 'Art stuff', 'layout': 'characters', 'characters': [ { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{'+'{artist' + '\n' + '|image=' + '\n' + '|alias=' + '\n' + '|as=' + '\n' + '|behance=' + '\n' + '|da=' + '\n' + '|fb=' + '\n' + '|ig=' + '\n' + '|reddit=' + '\n' + '|tumblr=' + '\n' + '|twitter=' + '\n' + '|site=' + '\n' + '|license=all|some|none|official' + '\n' + '|contact=' + '\n' + '|type=fan|interior|cover|multimedia' + '\n' + '|no-notify=y' + '\n' + '}}' } }, 'label': '{' + '{artist}}' }, { 'action': { 'type': 'encapsulate', 'options': { 'pre':'#' + 'REDIRECT [[Coppermind:Artists/{' + '{subst:FULLPAGENAME}}]]' + '\n' + '[' + '[Category: Structural redirects]]', } }, 'label': 'Artist redirect' }, { 'action': { 'type': 'encapsulate', 'options': { 'pre': '<small><center>by {' + '{a|', 'post': '}}</center></small>' } }, 'label': 'Artist heading' }, '{' + '{cat tag|Books|book cover}}', '|official=y' + '\n', { 'action': { 'type': 'encapsulate', 'options': { 'pre':'<gallery caption="Gallery" mode="packed" heights=200px>' + '\n', } }, 'label': 'Gallery header' }, { 'action': { 'type': 'encapsulate', 'options': { 'pre': '[mailto:', 'post': ' Email]' } }, 'label': 'Email' }, '<br style="clear:right;"/>', ] }, //page of commonly used infoboxes 'section-infoboxes': { 'label': 'Infoboxes', 'layout': 'characters', 'characters': [ '{'+'{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': [ '\n' + '|residence=', '\n' + '|profession=', '\n' + '|#profession=', '\n' + '|species=', '\n' + '|abilities=', '\n' + '|ethnicity=', '\n' + '|born=', '\n' + '|died=', '\n' + '|nationality=', '\n' + '|image=', '\n' + '|residence=', '\n' + '|world=Scadrial', '\n' + '|world=Roshar', '\n' + '|world=Nalthis', '\n' + '|world=Taldain', '\n' + '|earth=Alcatraz', '\n' + '|universe=[[Cosmere]]', '\n' + '|books=[[Mistborn Era 1]]', '\n' + '|books=[[Mistborn Era 2]]', '\n' + '|books=[[The Stormlight Archive]]', '\n' + '|books=[[Warbreaker]]', //alcatraz is very long so I had to do it differently { 'action': { 'type': 'encapsulate', 'options': { 'pre': '\n' + '|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 ==', '\n' + '<' + 'references/>', '\n' + '{' + '{stub}}', '\n' + '{' + '{partial}}', '\n' + '{' + '{complete}}', '\n' + '{' + '{Alcatraz}}', '\n' + '{' + '{Elantris}}', '\n' + '{' + '{Mistborn|Era 1}}', '\n' + '{' + '{Mistborn|Era 2}}', '\n' + '{' + '{Reckoners}}', '\n' + '{' + '{Skyward}}', '\n' + '{' + '{Stormlight}}', '\n' + '{' + '{Warbreaker}}', '\n' + '{' + '{White Sand}}', ] }, //page of other useful stuff 'section-tags': { 'label': 'Other Stuff', 'layout': 'characters', 'characters': [ '\n' + '{' + '{spoiler|sa4}}', '\n' + '{' + '{update|sa4}}', '{' + '{for|/Gallery|more images}}', '\n' + '{' + '{columns|count=2|', '<br/>', '\n' + '{' + '{for|:Category:Residents of {' + '{SUBST: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': '{' + '{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/1/1b/Button_hide_wiki_tag.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); } }); }