MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/* tabindex attribute for .status-row */

function statusTabindex { var x = document.getElementsByClassName("status-row"); var i;   for (i = 0; i < x.length; i++) { x[i].tabIndex = "0"; } }

window.onload = statusTabindex;

/* Imported scripts */

/* User tags */

//Core configuration window.UserTagsJS = { modules: {}, tags: { bureaucrat: { u:'Bureaucrat', link: 'Project:Administrators', order: -5 },       sysop: { link: 'Project:Administrators', order:-4 },       rollback: { link: 'Project:Rollback users', order:-3 },       threadmoderator: { u:'Forum moderator', link:'Special:Forum', order:-2 },       chatmoderator: { link:'Special:Chat', order:-1 },       bot: { u:'Bot', link: 'Project:Task Board/Bot' }

} };

// Adds users' MediaWiki groups to the internal group list UserTagsJS.modules.mwGroups = [ 'bureaucrat', 'sysop', 'rollback', 'threadmoderator', 'chatmoderator', 'bot'];

// Removes certain groups UserTagsJS.modules.metafilter = { 'sysop': ['bot'], // Removes admin tag from all bots };

/* AutoEditDropdown */

window.AutoEditDropdownConfig = { expandedAreaContribute: true, expandedAreaEdit: true };

/* Auto Refresh */

AjaxRCRefreshText = 'Auto-Refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = [ "Special:WikiActivity", "Special:RecentChanges", "Special:Log", "Special:ListUsers", ];

/* List of imports */

importArticles({   type: 'script',    articles: [        // ...        'w:c:dev:UserTags/code.js', // User tags        'u:dev:AjaxRC/code.js', //Auto Refresh        'u:dev:ReferencePopups/code.js', //Displays content of references on hover        'u:dev:Countdown/code.js', //Countdown clock        'u:dev:BackToTopButton/code.js', //Adds "Back to top" button in pages        'u:dev:DupImageList/code.js', // Creates list of duplicate images        'u:dev:View_Source/code.js', // Adds "view source" link to edit dropdown        'u:dev:PurgeButton/code.js', // Adds "refresh" link to edit dropdown        'u:dev:RevealAnonIP/code.js', // Replace "a wikia contributor" with IP address        'u:dev:AutoEditDropdown/code.js', // Automatically opens edit menu on hover    ] });

// /* Replaces with the name of the user browsing the page. Requires copying Template:USERNAME. */

function UserNameReplace { if (typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName === null) return; $("span.insertusername").html(wgUserName); } addOnloadHook(UserNameReplace);

// BEGIN JavaScript title rewrite -- jQuery version and new wikia skin fixes by Grunny

function rewriteTitle { if (typeof(window.SKIP_TITLE_REWRITE) != 'undefined' && window.SKIP_TITLE_REWRITE) { return; }

if ($('#title-meta').length === 0) { return; }

var newTitle = $('#title-meta').html; if (skin == "oasis") { $('header.WikiaPageHeader > h1').html(' ' + newTitle + ' '); $('header.WikiaPageHeader > h1').attr('style', 'text-align:' + $('#title-align').html + ';'); } else { $('.firstHeading').html(' ' + newTitle + ' '); $('.firstHeading').attr('style', 'text-align:' + $('#title-align').html + ';'); } }

// END JavaScript title rewrite addOnloadHook(rewriteTitle);

$(function { /* Run a bunch of display tweaks and fixes */  //Change this colour to verify that your browser is loading updated js   $('.jsupdate').css('background-color','lime');

$('#mw-content-text > .noarticletext a').not('a[href*="action=edit"]').off('click');

$(".category-gallery-item-text .snippet").each( function { //loop text items in gallery     this.innerHTML ="";      this.removeAttribute("class");   }); $(".articleSnippet").each( function { //loop text items in gallery     this.innerHTML ="";      this.removeAttribute("class");   });

$("#WikiaRecentActivity li").each( function { //add diff links to images in Recent Wiki Activity module.     link = $("a", this)[0].getAttribute('href', 2); //get link      image = $("img", this)[0]; //get image //      image.src = "http://images.wikia.com/shingekinokyojin/images/b/b8/Policia_Militar.png";      newNode = document.createElement("a"); //create anchor for image link      newNode.innerHTML = image.outerHTML; //copy image inside anchor      newNode.href = link+"?diff=cur"; //append diff to url      newNode.title="show me the change on this page";      replacedNode = this.replaceChild(newNode, image);    }); });

function collapsercexpanded { $(".rc-conntent span.mw-collapsible-toggle-expanded").each( function {     this.click; //collapsing expanded sections on recentchanges by default.  Wikia has been notified about this problem, but have not fixed it.   }); } addOnloadHook(collapsercexpanded);

// BEGINNING: JavaScript for placing the fair use rationale template inside the summary box on Special:Upload. Code by "wikipedia:User:Pinky49", created and coded specifically for Duty & Valour. function FairUseRationale { if((wgPageName == 'Special:Upload' || wgPageName == 'Special:MultipleUpload') && document.getElementById('wpDestFile').value == '') { document.getElementById('wpUploadDescription').value = ''; }   }    addOnloadHook(FairUseRationale); // ****** END: JavaScript for Special:Upload ******

$(function{    if ($('#WikiaRail').length ) {            $(window).load(function{ $('.ChatModule').after(' '); });    } });