User:Jultrun121/wikia.js

/* Script for adding commonly used action buttons to Oasis' bottom toolbar * Version 0.3 * Script by User:Porter21 (http://fallout.wikia.com) * i18n function by User:Dantman * only subpage/solo subpaginas */ function addOasisToolbarButtons { if (skin == "oasis") { // Configuration var config = window.OasisToolbarButtonsConfig = $.extend(true, {        userLang: true,           // Español         es: {            viewSource: "Código fuente",            editWithForm: "form.",            Prefix: "Subpag"         }      }, window.OasisToolbarButtonsConfig || {}); var encodedPagename = encodeURI(wgPageName); var pageControls = (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) ? $('#WikiaUserPagesHeader') : $('#WikiaPageHeader'); var toolbarButtons = ''; // Function for multi-language support (by Daniel Friesen aka User:Dantman) function msg(name) { if ( config.userLang && wgUserLanguage in config && name in config[wgUserLanguage] ) return config[wgUserLanguage][name]; if ( wgContentLanguage in config && name in config[wgContentLanguage] ) return config[wgContentLanguage][name]; return config.en[name]; }     // Function for adding a custom toolbar button function createToolbarLink (createButton, buttonName, linkAction, linkPrefix, addText) { var result = '' + msg((buttonName) ? buttonName : ) + '' + ((addText) ? addText : ); if (createButton) { toolbarButtons = '' + result + '' + toolbarButtons; } else { return result; }     }      // Remove now-duplicate links from "My Tools" menu // $('#my-tools-menu > li.default').remove; // Adding buttons if (wgNamespaceNumber != -1) {

// "subpages" button if (!(wgRestrictionMove[0] && $.inArray(wgRestrictionMove[0], wgUserGroups) == -1)) { createToolbarLink (true, 'Prefix', '', 'Special:PrefixIndex/'); }

// Add buttons to toolbar $('div.toolbar > ul.tools').before('' + toolbarButtons + ''); }  } } addOnloadHook (addOasisToolbarButtons);