Diferencia entre revisiones de «Usuario:Taln Fan/common.js»
Ir a la navegación
Ir a la búsqueda
m (Chaos2651 moved page User:Co-president of the Taln Fanclub/common.js to User:Taln Fan/common.js: Automatically moved page while renaming the user "Co-president of the Taln Fanclub" to "Taln Fan") |
|
(Sin diferencias)
|
Revisión actual del 06:40 2 ene 2022
//customize toolbar var customizeToolbar = function() { /* Your code goes here */ // Adding Artist header button for galleries to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "Artist-header": { label: 'Artist header', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/3/3a/Button_av-img.png', action: { type: 'encapsulate', options: { pre: '| <small><center>by {' + '{a|', post: '}}</center></small>' } } } } }); // Adding an art infobox button to the "main" section $('#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'insert', tools: { "code": { label: 'Art infobox', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/5/5a/Vector_toolbar_insert_picture_gallery_button.png', action: { type: 'encapsulate', options: { pre: '{' + '{art' + '\n' + '|#artist=' + '\n' + '|series=' + '\n' + '|#source=', post: '\n' + '|type=' + '\n' + '}}' } } } } }); // Adding artist attribution button for galleries to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "artist-attribution": { label: 'Artist Attribution', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/1/1b/Button_miss_signature.png', action: { type: 'encapsulate', options: { pre: '| <small><center>by {{a|', post: '}}</center></small>' } } } } }); // Adding artist page button to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "artist-page": { label: 'Artist Page', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/7/76/Button_atelier_graphique.PNG', action: { type: 'encapsulate', options: { pre: '{'+'{artist' + '\n' + '|image=' + '\n' + '|alias=' + '\n' + '|fb=' + '\n' + '|reddit=' + '\n' + '|behance=' + '\n' + '|da=' + '\n' + '|ig=' + '\n' + '|as=' + '\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' + '}}' + '\n\n' + '<br style="clear:right;"/>' + '\n' + '== Gallery ==' + '\n' + '<gallery caption="Gallery" mode="packed" heights=200px>' + '\n\n' + '</gallery>' + '\n' + '{{meta/done}}' } } } } }); // Adding image template button to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "image": { 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 link button to the "main" section $('#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'insert', tools: { "link": { label: 'Link', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/9/97/Button_int_link.png', action: { type: 'encapsulate', options: { pre: "[[", post: "]]" } } } } }); // Adding Wikipedia link button to the "main" section $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "wikipedia": { label: 'Wikipedia', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/c/cb/Button_wikipedia.png', action: { type: 'encapsulate', options: { pre: "[[Wikipedia:", post: "|]]" } } } } }); //Add new references dropdown to the "advanced" section $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', groups: { list: { tools: { references: { label: 'references', type: 'select', list: { 'book-ref': { label: '{' + '{book ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{book ref|', post: '}}' } } }, 'wob-ref': { label: '{' + '{wob ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{wob ref|', post: '}}' } } }, 'ref-plaintext': { label: '{' + '{ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{ref|text=', post: '}}' } } }, 'epigraph-ref': { label: '{' + '{epigraph ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{epigraph ref|', post: '}}' } } }, 'au-ref': { label: '{' + '{au ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{au ref|', post: '}}' } } }, 'msh-ref': { label: '{' + '{msh ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{msh ref|', post: '}}' } } }, 'tes-ref': { label: '{' + '{tes ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{tes ref|', post: '}}' } } }, 'file-ref': { label: '{' + '{file ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{file ref|', post: '}}' } } }, 'map-ref': { label: '{' + '{map ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{map ref|', post: '}}' } } }, 'url-ref': { label: '{' + '{url ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{url ref|url=', post: '|text=|date=|site=}}' } } }, '17s-ref': { label: '{' + '{17s ref}}', action: { type: 'encapsulate', options: { pre: '{' + '{17s ref|topic/news/post', post: '|id#|description|date=}}' } } } } } } } } } ); //Add new build-a-box dropdown to the "advanced" section $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', groups: { list: { tools: { simplecharacterinfobox: { label: 'build-a-box', type: 'select', list: { 'start': { label: '{' + '{character', action: { type: 'encapsulate', options: { pre: '{' + '{character' } } }, 'residence': { label: '|residence=', action: { type: 'encapsulate', options: { pre: '\n' + '|residence=' } } }, 'imageparam': { label: '|image=', action: { type: 'encapsulate', options: { pre: '\n' + '|image=' } } }, 'profession': { label: '|profession=', action: { type: 'encapsulate', options: { pre: '\n' + '|profession=' } } }, '#profession': { label: '|#profession=', action: { type: 'encapsulate', options: { pre: '\n' + '|#profession=' } } }, 'skills': { label: '|skills=', action: { type: 'encapsulate', options: { pre: '\n' + '|skills=' } } }, 'species': { label: '|species=', action: { type: 'encapsulate', options: { pre: '\n' + '|species=' } } }, 'abilities': { label: '|abilities=', action: { type: 'encapsulate', options: { pre: '\n' + '|abilities=' } } }, 'ethnicity': { label: '|ethnicity=', action: { type: 'encapsulate', options: { pre: '\n' + '|ethnicity=' } } }, 'born': { label: '|born=', action: { type: 'encapsulate', options: { pre: '\n' + '|born=' } } }, 'died': { label: '|died=', action: { type: 'encapsulate', options: { pre: '\n' + '|died=' } } }, 'nationality': { label: '|nationality=', action: { type: 'encapsulate', options: { pre: '\n' + '|nationality=' } } }, 'bonded': { label: '|bonded=', action: { type: 'encapsulate', options: { pre: '\n' + '|bonded=' } } } } } } } } } ); //Add new infobox endings dropdown to the "advanced" section $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', groups: { list: { tools: { endings: { label: 'ends', type: 'select', list: { 'sa': { label: 'Stormlight', action: { type: 'encapsulate', options: { pre: '\n' + '|world=Roshar' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[The Stormlight Archive]]' + '\n' + '}}' } } }, 'mbe1': { label: 'MB Era 1', action: { type: 'encapsulate', options: { pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 1]]' + '\n' + '}}' } } }, 'mbe2': { label: 'MB Era 2', action: { type: 'encapsulate', options: { pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 2]]' + '\n' + '}}' } } }, 'wb': { label: 'Warbreaker', action: { type: 'encapsulate', options: { pre: '\n' + '|world=Nalthis' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Warbreaker]]' + '\n' + '}}' } } }, 'ela': { label: 'Elantris', action: { type: 'encapsulate', options: { pre: '\n' + '|world=Sel' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Elantris (book)|Elantris]]' + '\n' + '}}' } } }, 'alc': { label: 'Alcatraz', action: { type: 'encapsulate', options: { pre: '\n' + '|earth=Alcatraz' + '\n' + '|books=[[Alcatraz Versus the Evil Librarians (series)|Alcatraz Versus the Evil Librarians]]' + '\n' + '}}' } } }, 'ws': { label: 'White Sand', action: { type: 'encapsulate', options: { pre: '\n' + '|world=Taldain' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[White Sand]]' + '\n' + '}}' } } }, 'skyward': { label: 'Skyward', action: { type: 'encapsulate', options: { pre: '\n' + '|world=', post: '\n' + '|universe=[[Cytoverse]]' + '\n' + '|books=[[Skyward (series)]]' + '\n' + '}}' } } } } } } } } } ); //Add new page ends dropdown to the "advanced" section $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', groups: { list: { tools: { bottoms: { label: 'bottoms', type: 'select', list: { 'pagename': { label: '{' + '{SUBST:PAGENAME}}', action: { type: 'encapsulate', options: { pre: '\n' + '\'\'\'{' + '{SUBST:PAGENAME}}\'\'\'' } } }, 'notes': { label: '== Notes ==', action: { type: 'encapsulate', options: { pre: '\n\n' + '== Notes ==' } } }, 'refsection': { label: '<' + 'references/>', action: { type: 'encapsulate', options: { pre: '\n' + '<' + 'references />' } } }, 'stub': { label: '{' + '{stub}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{stub}}' } } }, 'partial': { label: '{' + '{partial}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{partial}}' } } }, 'complete': { label: '{' + '{complete}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{complete}}' } } }, 'alcatraz': { label: '{' + '{Alcatraz}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{Alcatraz}}' } } }, 'elantris': { label: '{' + '{Elantris}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{Elantris}}' } } }, 'mbera1': { label: '{' + '{Mistborn|Era 1}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{Mistborn|Era 1}}' } } }, 'mbera2': { label: '{' + '{Mistborn|Era 2}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{Mistborn|Era 2}}' } } }, 'reckoners': { label: '{' + '{Reckoners}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{Reckoners}}' } } }, 'sky': { label: '{' + '{Skyward}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{Skyward}}' } } }, 'stormlight': { label: '{' + '{Stormlight}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{Stormlight}}' } } }, 'warbreaker': { label: '{' + '{Warbreaker}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{Warbreaker}}' } } }, 'whitesand': { label: '{' + '{White Sand}}', action: { type: 'encapsulate', options: { pre: '\n' + '{' + '{White Sand}}' } } } } } } } } } ); //add new section to editing toolbar $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': { 'useful-stuff': { 'type': 'booklet', 'label': 'Useful Stuff', 'pages': { //Page of commonly used reference templates 'section-refs': { 'label': 'References', 'layout': 'characters', 'characters': [ '{' + '{book ref|}}', '{' + '{wob ref|}}', '{' + '{ref|text=}}', '{' + '{epigraph ref|}}', '{' + '{au ref|}}', '{' + '{msh ref|}}', '{' + '{tes ref|}}', '{' + '{file ref|}}', '{' + '{map ref|}}', //These next two reference templates are very long so they are done differently { 'action': { 'type': 'encapsulate', options: { pre: '{' + '{url ref|url=', post: '|text=|date=|site=}}' } }, 'label': '{' + '{url ref}}' }, { 'action': { 'type': 'encapsulate', options: { pre: '{' + '{17s ref|topic/news/post', post: '|id#|description|date=}}' } }, 'label': '{' + '{17s ref}}' }, ] }, //Page to quickly build character infoboxes 'section-Build-a-Box': { 'label': 'Build-a-Box', 'layout': 'characters', 'characters': [ '{' + '{character', '\n' + '|image=', '\n' + '|residence=', '\n' + '|profession=', '\n' + '|#profession=', '\n' + '|species=', '\n' + '|abilities=', '\n' + '|ethnicity=', '\n' + '|born=', '\n' + '|died=', '\n' + '|nationality=', '\n' + '|residence=', ] }, //Page of infobox endings 'section-end': { 'label': 'Endings', 'layout': 'characters', 'characters': [ '\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 it has to be done 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 to finish a page after making the infobox 'section-bottom': { 'label': 'Bottom of Page', 'layout': 'characters', 'characters': [ '\n' + '\'\'\'{' + '{SUBST:PAGENAME}}\'\'\'', '\n\n' + '== 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}}', ] } } } } }); }; /* * 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); } }); }