Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.


Warning for game developers: PCGamingWiki staff members will only ever reach out to you using the official press@pcgamingwiki.com mail address.
Be aware of scammers claiming to be representatives or affiliates of PCGamingWiki who promise a PCGW page for a game key.

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
                        }
                    }
                }
            }
        });
    });
}