Difference between revisions of "User:Aemony/common.js"
From PCGamingWiki, the wiki about fixing PC games
m (clear) Tag: Replaced |
m (test) |
||
Line 1: | Line 1: | ||
console.log("User:Aemony/common.js executing..."); | console.log("User:Aemony/common.js executing..."); | ||
console.log("-- Link: https://pcgamingwiki.com/wiki/User:Aemony/common.js"); | console.log("-- Link: https://pcgamingwiki.com/wiki/User:Aemony/common.js"); | ||
+ | |||
+ | |||
+ | // Check if we're editing a page. | ||
+ | if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) { | ||
+ | // Add a hook handler. | ||
+ | mw.hook('wikiEditor.toolbarReady').add(function($textarea) { | ||
+ | |||
+ | // Adds custom byttons to the advanced > insert group | ||
+ | $textarea.wikiEditor('addToToolbar', { | ||
+ | 'section': 'advanced', | ||
+ | 'group': 'insert', | ||
+ | 'tools': { | ||
+ | 'fixbox': { | ||
+ | label: 'Fixbox', | ||
+ | type: 'button', | ||
+ | icon: '//images.pcgamingwiki.com/d/d8/Editor_Icon_-_Fixbox.svg', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "{{Fixbox|description=", | ||
+ | peri: "Name", | ||
+ | post: "|ref=<ref>Reference</ref>|fix=\n}}", | ||
+ | ownline: true | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | } |
Revision as of 08:56, 5 September 2022
console.log("User:Aemony/common.js executing..."); console.log("-- Link: https://pcgamingwiki.com/wiki/User:Aemony/common.js"); // Check if we're editing a page. if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) { // Add a hook handler. mw.hook('wikiEditor.toolbarReady').add(function($textarea) { // Adds custom byttons to the advanced > insert group $textarea.wikiEditor('addToToolbar', { 'section': 'advanced', 'group': 'insert', 'tools': { 'fixbox': { label: 'Fixbox', type: 'button', icon: '//images.pcgamingwiki.com/d/d8/Editor_Icon_-_Fixbox.svg', action: { type: 'encapsulate', options: { pre: "{{Fixbox|description=", peri: "Name", post: "|ref=<ref>Reference</ref>|fix=\n}}", ownline: true } } } } }); }); }