User:Callofduty4/OldFilePages.js

/* This is not to be enabled wiki-wide */

function RevertToOldFilePages { FixPageModules; AddWhatLinksHere; }

function FixPageModules { $('.more-info-wrapper').css('display', 'block'); $('.SeeMore').remove; $('.page-listings').remove; FileName = mw.config.get('wgTitle'); html = 'Upload a new version of this file File usage  '; $('.more-info-wrapper').append(html); }

function AddWhatLinksHere { 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 {		NoOfPages = Pages.length;		if (NoOfPages == 0) { 			html = ' There are no pages that link to this file. ';		}		else {			ListOfPages = Pages.join('');			if (NoOfPages > 1) {				html = 'The following ' + NoOfPages + ' pages use this file: ' + ListOfPages + '';			}			else {				html = 'The following page uses this file: ' + ListOfPages + '</ul>';			}		}		$('.TransclusionsLoading').remove;		$('.more-info-wrapper').append(html);	}) .fail(function {		html = '<p style="color:red;">There was an error fetching the transclusions list. ';			$('.TransclusionsLoading').remove;		$('.more-info-wrapper').append(html);	}); }

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