MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */ // switched to Wikia's new method //importScriptPage( 'ShowHide/code.js', 'dev' ); //importScriptPage('AjaxBatchDelete/code.js', 'dev'); //importScript('User:Quarenon/massrollback.js'); // doesn't seem to work anyway //importScriptPage('BackToTopButton/code.js', 'dev'); //importScriptPage('CollapsibleEdittools/code.js', 'dev'); //importScriptPage('DupImageList/code.js', 'dev'); //importScriptPage('User:Jgjake2/js/DISPLAYTITLE.js', 'deadisland'); // switching to Wikia's new method importArticles({   type: "script",    articles: [        "w:c:dev:ShowHide/code.js",        "w:c:dev:CollapsibleEdittools/code.js",        "w:c:deadisland:User:Jgjake2/js/DISPLAYTITLE.js",        "MediaWiki:FloatingTableHeader.js",        "w:c:dev:Countdown/code.js", // things only admins should use        "w:c:dev:AjaxBatchDelete/code.js",        "w:c:dev:DupImageList/code.js", // testing if multiple calls to same script is causing the commenting bugs       "w:c:dev:SkinSwitchButton/code.js",       "w:c:dev:PurgeButton/code.js",       "w:c:dev:AjaxRC/code.js",       "w:c:dev:BackToTopButton/code.js", // PRIME SUSPECT FOR COMMENTING BUGS       "w:c:dev:HideRail/code.js",       "w:c:dev:VisualSpellCheck/code.js",    ] });

$('textarea#wpSummary').val('just fulfilling the 90% filthy edit quota...');//.attr('readonly','readonly');

// SocialBlade Widget (now supports multiple tags) $('.SocialBladeWidget').each(function {   var sbname=$(this).text;    $(this).html(' ').show; });

/* * CODE FOR LIST OF UNTERGANGERS * NOW MOVED TO MediaWiki:UntergangerList.js * TO IMPROVE PERFORMANCE */ // since the verbatim proved to be useless, opted to use this instead // to load the script for the List of Untergangers page // // 13.9.12 Disabled for debugging - rows at bottom not being parsed correctly // 25.9.12 added button to load the script manually so that users can get back some functionality even as the script's being debugged // ==== // $(".page-List_of_Untergangers").append(' '); $('table.untergangers').after('Enable list enhancements '); function importUntergangerListScript { importScriptPage('MediaWiki:UntergangerList.js', 'hitlerparody'); $('button#ULscriptimport').remove; } // execute if not mfaizsyahmi logged in if ( $('#AccountNavigation a[href*="/User:Mfaizsyahmi"]').length == 0) importUntergangerListScript;

// I want to put stuff directly beneath the infobox! :@ // 6 Jan 13 - this seemed to be interfering with Infobox Extensions //$(".infobox").wrap(' '); //$(".underinfobox").appendTo(".infoboxcolumn");

// Marquee text, might come in handy for main page announcements $('div.marquee').wrapInner(' ');

// *********** Grand Unified Downfall Scenes Database ************************** $(".scenes.list ol").find("ol, ul, dl").remove; $(".scenes.list+.alt-text").hide; $(".scenes.list").show;

function RepeatText(text, times) { return (new Array(times + 1)).join(text); }

if ( $("table.scenes").length && $("div.scenes.db").length ) {

$("div.scenes.db>ol").addClass("master"); $db = $("div.scenes.db").eq(0).clone; scenecount = $("ol.master>li", $db).length

$("table.scenes").each( function {       col = $("tr:first-child th", this).length;        rowstring = ' '+ RepeatText('  ',col) + ' ';        $(this).append( RepeatText(rowstring, scenecount) );

// applying header classes to cells, one column at a time for (j=1; j <= col; j++) { $( "td:nth-child(" +j+ ")", this).attr("class", $( "th:nth-child(" +j+ ")", this).attr("class") ); }       $(this).append( ' List retrieved from the Grand Unified Downfall Scenes Database.  ' ); });   $("ol.master>li", $db).each( function { idx = $(this).index+1; $desc = $("ul",this); // notes = $("dt",this).text; $link = $("dd a",this); id = $("ol>li", this); // haven't figured out how to use this $("ul, dl, ol", this).remove; scenename = $(this).html;

$row = $("table.scenes tr").eq(idx); $("td.index", $row).text(idx); $("td.name", $row).html(scenename); $("td.desc", $row).prepend($desc); // $("td.notes", $row).append(notes); $("td.links", $row).html( $link ); $("td.links a", $row).wrap(""); $("td.links", $row).wrapInner(""); }); } // ***************************************************************************

//MAINPAGE NEWS $(".scrollbox-news").after(' [Expand All] '); $(".newsExpander").click(function{   if ($(this).hasClass("newsExpander-collapsed")){        $(".scrollbox-news .mw-collapsible-toggle-collapsed").trigger("click");        $(this).removeClass("newsExpander-collapsed").addClass("newsExpander-expanded");        $(this).text("[Collapse All]");    } else {        $(".scrollbox-news .mw-collapsible-toggle-expanded").trigger("click");        $(this).removeClass("newsExpander-expanded").addClass("newsExpander-collapsed");        $(this).text("[Expand All]");    } }); $(".scrollbox-news").prepend(' '); $(".scrollbox-news h3").append(' ↑top ');

// moved here as this should be applied last... $('a.external').attr({ target: '_blank' });

// Hidden Jodl Head. Random position. probability of occurring is 0.1% if (Math.random < 0.001) { $('body').append(' '); $('#jodl').css({"background-image":"url(http://images2.wikia.nocookie.net/hitlerparody/images/9/99/Jodlhead.png)"}); $('#jodl').css({"position":"absolute","width":"80px","height":"80px","z-index":"2012"}); jodltop = Math.random * ($('body').height-80); jodlleft = Math.random * ($('body').width-80); $('#jodl').css({"top":jodltop + "px","left":jodlleft + "px"});

// This has been causing problems with IDM for far too long $('#jodl').append('     ');

$('#jodl').click(function{       num=Math.floor(Math.random*3);        if (num==0) {            $('audio#jodl1').get(0).play;        } else if (num==1) {            $('audio#jodl2').get(0).play;        } else if (num==2) {            $('audio#jodl3').get(0).play;        }        jodltop = Math.random * ($('body').height-80);        jodlleft = Math.random * ($('body').width-80);        $('#jodl').css({"top":jodltop + "px","left":jodlleft + "px"});    }); }

/* ************************ From the Jodl Files ************************* */ // something for rob and his hobo piret ;) // $(".page-Notoriousrob01, .page-PiretBCN, .page-Downfall_Parody_Awards").append('  ');

/** Extra toolbar options ****************************************************** *  *  Description: Adds extra buttons to the old (non-enhanced) editing toolbar. *  *  Maintainers: User:MarkS, User:Voice of All, User:R. Koot */ mw.loader.using( 'mediawiki.action.edit', function {	var buttons, i, len;	buttons = ;	for ( i = 0, len = buttons.length; i < len; i++ ) {		mw.toolbar.addButton( buttons[i].imageFile, buttons[i].speedTip, buttons[i].tagOpen, buttons[i].tagClose, buttons[i].sampleText, buttons[i].id, buttons[i].id		);	} });

if (document.URL.indexOf("PiretBCN")!=-1) { $('body').append('  '); $("body").css('background', 'white url("http://blog.wtfconcept.com/wp-content/uploads/2011/04/trololol.gif") repeat scroll center top'); } else { //   $("body").css('background', 'black url("http://images3.wikia.nocookie.net/__cb20121106134932/hitlerparody/images/e/e5/Antics-L-anim.gif") repeat scroll center top'); }