MediaWiki:QuickAccessToCSSAndJS/code.js

/* QuickAccessToGlobalPages * Original code by User:JPhil2.0 (can be found in http://community.wikia.com/wiki/User:JPhil2.0/global.js?diff=2017878&oldid=2017872) * Modified and fixed by User:Ultragustavo25 */ if(!window.CustomButtonsLoaded) addOnloadHook(addCustomLinks); var CustomButtonsLoaded = true; var i18n = { en: { js: "Global JS", css: "Global CSS", localcommoncss: "Local Common CSS", localcommonjs: "Local Common JS", localchatcss: "Local Chat CSS", localchatjs: "Local Chat JS" },   es: { js: 'JS global', css: 'CSS global', localcommoncss: "CSS Común local", localcommonjs: "JS Común local", localchatcss: "Local Chat CSS", localchatjs: "Local Chat JS" },   'pt-br': { js: "JS global", css: "CSS global", localcommoncss: "CSS Comum local", localcommonjs: "JS Comum local", localchatcss: "CSS local Chat", localchatjs: "JS local Chat" },   pt: { js: "JS global", css: "CSS global", localcommoncss: "CSS Comum local", localcommonjs: "JS Comum local", localchatcss: "CSS local Chat", localchatjs: "JS local Chat" } }; i18n = i18n[mw.config.get("wgUserLanguage")] || i18n[mw.config.get("wgContentLanguage")] || i18n.en; function addCustomLinks { $('' + i18n.js + '').insertBefore('.wds-global-navigation__user-menu li:last'); $('' + i18n.css + '').insertBefore('.wds-global-navigation__user-menu li:last'); $('' + i18n.localcommoncss + '').insertBefore('.wds-global-navigation__user-menu li:last'); $('' + i18n.localcommonjs + '').insertBefore('.wds-global-navigation__user-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="/Special:Mypage/chat.css">' + i18n.localchatcss + '</a></li>').insertBefore('.wds-global-navigation__user-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="/Special:Mypage/chat.js">' + i18n.localchatjs + '</a></li>').insertBefore('.wds-global-navigation__user-menu li:last'); }