User:Eladkse/global.js

importArticles({	type: 'script',	articles: [		"external:eladkse:MediaWiki:RelatedDiscussionsModule.js",		"external:kangaroopower:MediaWiki:Scope.js",		"external:dev:SearchSuggest/code.js",		"external:runescape:User:Joeytje50/tabkey.js"	] });

//$(".wall-action-reason").keyup(function(event){ //   if(event.keyCode == 13){ //        $("#WikiaConfirmOk").click; //    } //});

$(function changeimagelinks {   if (window.skin == 'oasis') {        var article = $('#WikiaArticle, .LatestPhotosModule, #article-comments');    }    else {        var article = $('#bodyContent');    }    article.unbind('click.lightbox');    var a = document.getElementsByTagName("a");    for ( var t = 0; t < a.length; ++t ) {        var a2 = a[t];        var img = a2.getElementsByTagName("img");        if ( img[0] != null ) {            if ( a2.href.indexOf("wikia.nocookie.net") != -1 ) {                var link = wgServer + '/wiki/File:' + a2.getAttribute('data-image-name');                a2.setAttribute('href',link);            }        }    } });

function HideAdminDashboard { if ($('.AdminDashboardHeader').length) { // Get 'friendly' page title var title = ($('.mw-special-Browse').length ? 'Browse' : document.title.split(" -", 1)); // Add wiki-style header $('header.AdminDashboardHeader').replaceWith(' ' + title + ' Special page '); // Add default toolset to Special:Watchlist $('.page-Special_Watchlist .HideAdminDashboard').append($('#contentSub').addClass("subtitle").removeAttr("id")); $('.page-Special_EditWatchlist .HideAdminDashboard').append($('#contentSub').addClass("subtitle").removeAttr("id")); } } addOnloadHook(HideAdminDashboard);

/* Recent Changes Links */ function RecentChanges { $('.WikiaActivityModule a.more').replaceWith('See more &gt;'); $('nav.contribute').after(' Recent Changes'); } addOnloadHook(RecentChanges);

/* Purge Button */ function PurgeDropdownMenuItem { function addPurgeButton { var theText = 'Purge';

switch( skin ) { case 'uncyclopedia': case 'monobook': $('#p-cactions > .pBody > ul').append(''+ theText + ''); break;

case 'oasis': case 'wikia': $(((wgNamespaceNumber == 2 || wgNamespaceNumber == 3) ? '.UserProfileActionButton' : (wgNamespaceNumber == 500 ? '.WikiaBlogPostHeader' : '#WikiaPageHeader')) + ' > .wikia-menu-button > ul').append(''+ theText + ''); break;

}	}

if( wgNamespaceNumber >= 0 && !window.PurgeButtonsLoaded && document.getElementById('control_purge') == null) { addOnloadHook( addPurgeButton ); }

var PurgeButtonsLoaded = true; // prevent duplicate running (but not dupe buttons from outside this code) } addOnloadHook(PurgeDropdownMenuItem);

/* User Dropdown Items */ function UserItems { $('#AccountNavigation ul.subnav li:first-child').after('My blog</a></li><a href="/wiki/Special:Contributions/Eladkse">My contributions</a></li><a href="/wiki/Special:Watchlist">My watchlist</a></li>');

var watchlistlink = '<a href="/wiki/Special:Watchlist" title="Special:Watchlist">Watchlist</a></li>';

$('.page-User_Eladkse li[data-id="following"]').replaceWith(watchlistlink); $('.page-User_talk_Eladkse li[data-id="following"]').replaceWith(watchlistlink); $('.page-Special_Contributions_Eladkse li[data-id="following"]').replaceWith(watchlistlink); $('.page-User_blog_Eladkse li[data-id="following"]').replaceWith(watchlistlink); $('.page-Message_Wall_Eladkse li[data-id="following"]').replaceWith(watchlistlink); } addOnloadHook(UserItems);

/* Editor Dropdown */ function EditorDropdown { if (wgCanonicalNamespace != 'Special') { $('section#EditPage nav.wikia-menu-button ul').prepend('<a id="wpHistory" href="/wiki/'+ encodeURI(wgPageName) +'?action=history" target="_blank"> History </a></li>'); } } addOnloadHook(EditorDropdown);

/* Disable Photo Tooltip */ function PhotoTooltip { $('.wikia-button.upphotos').removeAttr("data-original-title"); } addOnloadHook(PhotoTooltip);

/* AJAX RC */ var	ajaxTimer, ajaxRefresh = 30000, doRefresh = true;

if ( !window.ajaxCallAgain ) { var ajaxCallAgain = []; }

function preloadAJAXRL { $( '#ajaxLoadProgress' ).ajaxSend( function ( event, xhr, settings ) {		if ( location.href == settings.url ) {			$( this ).show;		}	} ).ajaxComplete ( function ( event, xhr, settings ) {		var	$collapsibleElements = $( '#mw-content-text' ).find( '.mw-collapsible' );		if ( location.href == settings.url ) {			$( this ).hide;			for ( var i = 0; i < ajaxCallAgain.length; i++ ) {				ajaxCallAgain[i];			}			if ( $collapsibleElements.length ) {				$collapsibleElements.makeCollapsible;			}			if ( mw.config.get( 'wgNamespaceNumber' ) === -1 && mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Recentchanges' ) {				mw.special.recentchanges.init;			}		}	} ); loadPageData; }

function loadPageData { var cC = '#mw-content-text'; $('#mw-content-text').load( location.href + " #mw-content-text > *", function ( data ) {		if ( doRefresh ) {			ajaxTimer = setTimeout( loadPageData, ajaxRefresh );		}	} ); }

$( function {	if ( wgPageName == 'Special:RecentChanges' ) {		preloadAJAXRL;	} } );