MediaWiki:ContribsButtons.js

/** * @Name           ContribsButtons * @Version        v1.0 * @Author         TheGoldenPatrik1 * @Description    Adds wiki-specific ContribsButtons styling. */ (function {    var config = mw.config.get([ 'wgCanonicalSpecialPageName', 'wgSassParams' ]);   if ( window.ContribsButtonsLoaded || config.wgCanonicalSpecialPageName !== 'Contributions' ) {       return;    }    var colors;    /**     * @class Main     * @classdesc Main ContribsButtons class     */    var Main = {        /**         * @method addCSS         * @description Adds the button CSS         */        addCSS: function  {            var color = config.wgSassParams['color-buttons'];            mw.util.addCSS( 'body.mw-special-Contributions #VSTFReportButtons .VSTFReportButton,\ body.mw-special-Contributions #contentSub:not(.contentSub) a,\ body.mw-special-Contributions #contentSub #contentSubSub a {\ background:' + color + ';\ }\ body.mw-special-Contributions #VSTFReportButtons .VSTFReportButton:active,\ body.mw-special-Contributions #VSTFReportButtons .VSTFReportButton:focus,\ body.mw-special-Contributions #VSTFReportButtons .VSTFReportButton:hover,\ body.mw-special-Contributions #contentSub:not(.contentSub) a:active,\ body.mw-special-Contributions #contentSub:not(.contentSub) a:focus,\ body.mw-special-Contributions #contentSub:not(.contentSub) a:hover,\ body.mw-special-Contributions #contentSub #contentSubSub a:active,\ body.mw-special-Contributions #contentSub #contentSubSub a:focus,\ body.mw-special-Contributions #contentSub #contentSubSub a:hover {\ background:' + colors.parse(color).lighten(12) + ';\ }'           );        },        /**         * @method hookHandler         * @description Handles the dev.colors hook         * @param {String} colorData - Variable for adding Colors support         */        hookHandler: function (colorData) {            colors = colorData;            Main.addCSS;        },        /**         * @method init         * @description Adds the dev.colors hook and imports Colors         */        init: function  {            mw.hook('dev.colors').add(this.hookHandler);            importArticle({ type: 'script', article: 'u:dev:MediaWiki:Colors/code.js' });       }    };    Main.init; });