MediaWiki:Common.js

var $UT = UtilityTools; if (!window.$G){ window.$G = $UT.get; } window.bodyContentId = 'bodyContent';

/* Compatibilidad, al inicio del resto de carga de elementos. Necesario para que todas las utilidades que funcionan en Monobook y Monaco funcionen en oasis function oasisCompatElements { $(document.body).append(' '); } if (window.skin == 'oasis' || document.location.toString.indexOf('useskin=wikia') != -1) { window.skin = 'oasis'; // Error de Wikia cuando se usa useskin window.bodyContentId = 'WikiaArticle'; $(oasisCompatElements); }
 * Wikia: ¿Quién tuvo la estupenda idea de no respetar los ID's comunes del wiki? */

/* Any JavaScript here will be loaded for all users on every page load. */ importScriptPage('ShowHide/code.js', 'dev'); importScriptPage('EditIntroButton/code.js', 'dev' ); //importScriptPage('AjaxBatchDelete/code.js', 'dev'); //importScriptPage('DisableArchiveEdit/code.js', 'dev'); importScriptPage('DupImageList/code.js', 'dev'); // importScriptPage('AdvancedOasisUI/code.js', 'dev'); violates Wikia TOU but is okay for individual users to use importScriptPage('PurgeButton/code.js', 'dev'); //importScriptPage('ShowAdsButton/code.js', 'dev');

var ArchiveToolConfig = { archiveListTemplate: 'ArchCat', archivePageTemplate: 'ArchPage', archiveSubpage: 'Archive', userLang: true }; importScriptPage('ArchiveTool/code.js', 'dev');

/********************************************
 * PRELOADABLE TEMPLATE SYSTEM ***********
 * from starwars:User:Sikon/preload.js **
 * from starwars:User:Sikon/preload.js **

document.write(' ');

function fillPreloads {   var div = document.getElementById("lf-preload");

if(div == null) return;

div.style.display = 'block'; var span = document.getElementById('lf-preload-cbox');

var comboString = ""; comboString += " "; span.innerHTML = comboString; span = document.getElementById('lf-preload-pagename'); span.innerHTML = ''; span = document.getElementById('lf-preload-button'); span.innerHTML = '';

requestComboFill('stdPreloads', "Template:Stdpreloads"); }

function doCustomPreload {   doPreload(document.getElementById('lf-preload-pagename').getElementsByTagName('input')[0].value); }

function onPreloadChange {   var combo = document.getElementById("stdPreloads"); var value = combo.options[combo.selectedIndex].value;

if(value == "") return;

value = "Template:" + value + "/preload"; value = value.replace(" ", "_"); doPreload(value); }

addOnloadHook(fillPreloads);

/* Preload system ends */

/* MOS box from Brickipedia */ importScript('MediaWiki:Common.js/mosbox.js');

/** Dynamic Navigation Bars (experimental) ************************************* * From: wikipedia:wikipedia:MediaWiki:Common.js * Description: See wikipedia:Wikipedia:NavFrame. * Maintainers: UNMAINTAINED on wikipedia */ // set up the words in your language var NavigationBarHide = '[' + collapseCaption + ']'; var NavigationBarShow = '[' + expandCaption + ']'; // shows and hides content and picture (if available) of navigation bars // Parameters: //    indexNavigationBar: the index of navigation bar to be toggled function toggleNavigationBar(indexNavigationBar){ var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); if (!NavFrame || !NavToggle) { return false; }   // if shown now if (NavToggle.firstChild.data == NavigationBarHide) { for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) { NavChild.style.display = 'none'; }       }    NavToggle.firstChild.data = NavigationBarShow; // if hidden now } else if (NavToggle.firstChild.data == NavigationBarShow) { for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) { NavChild.style.display = 'block'; }       }        NavToggle.firstChild.data = NavigationBarHide; } } // adds show/hide-button to navigation bars function createNavigationBarToggleButton{ var indexNavigationBar = 0; // iterate over all -elements var divs = document.getElementsByTagName("div"); for (var i = 0; NavFrame = divs[i]; i++) { // if found a navigation bar if (hasClass(NavFrame, "NavFrame")) { indexNavigationBar++; var NavToggle = document.createElement("a"); NavToggle.className = 'NavToggle'; NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); var isCollapsed = hasClass( NavFrame, "collapsed" ); /*            * Check if any children are already hidden. This loop is here for backwards compatibility: * the old way of making NavFrames start out collapsed was to manually add style="display:none" * to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make            * the content visible without JavaScript support), the new recommended way is to add the class * "collapsed" to the NavFrame itself, just like with collapsible tables. */           for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) { if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) { if ( NavChild.style.display == 'none' ) { isCollapsed = true; }               }            }            if (isCollapsed) { for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) { NavChild.style.display = 'none'; }               }            }            var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide); NavToggle.appendChild(NavToggleText); // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) for(var j=0; j < NavFrame.childNodes.length; j++) { if (hasClass(NavFrame.childNodes[j], "NavHead")) { NavToggle.style.color = NavFrame.childNodes[j].style.color; NavFrame.childNodes[j].appendChild(NavToggle); }           }            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); }   } } $( createNavigationBarToggleButton );