User:Eladkse/global.js

/* File Usage List - thanks to Callofduty4 */ function AddWhatLinksHere { html = ' File usage  '; $('#mw-imagepage-content').append(html); Pages = []; PageTitle = mw.config.get('wgPageName'); $.getJSON('/api.php?action=query&list=imageusage&iutitle=' + PageTitle + '&iulimit=max&format=json', function(data) { 		$.each(data.query.imageusage, function(index, value) { Page = value.title; Pages.push('' + Page + ''); });	})	.done(function {		if (Pages.length == 0) { 			html = ' There are no pages that link to this file. ';		}		else {			ListOfPages = Pages.join('');			html = ' The following ' + (Pages.length == 1 ? 'page uses' : Pages.length + ' pages use') + ' this file: ' + ListOfPages + ' ';		}		$('.TransclusionsLoading').remove;		$('#mw-imagepage-content').append(html);	}) .fail(function {		html = ' There was an error fetching this list. For a list of pages which use this file, see here. ';			$('#mw-imagepage-content').append(html);	}); }

$(document).ready(function {	Namespace = mw.config.get('wgCanonicalNamespace');	if (Namespace == 'File') {		AddWhatLinksHere;	} });

/* Focus cursor on file delete */ $(document).ready(function {	Namespace = mw.config.get('wgCanonicalNamespace');	Action = mw.config.get('wgAction');	if (Namespace == 'File' && Action == 'delete') {		$('input[name="wpReason"]').focus	} });

/* User Dropdown Items */ function UserItems { $('.wds-global-navigation__dropdown-controls ul.wds-list li:nth-child(2)').after('My ContributionsMy Watchlist</li>');

var watchlistlink = '<li data-id="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); }

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

$(document).ready(function {	UserItems;	PhotoTooltip; });