User:SizableShrimp/common.js

// See totals at the top of WLH pages // Author: RheingoldRiver

$(function {	if (mw.config.get('wgCanonicalSpecialPageName') !== 'Whatlinkshere') return;	var title = $('#mw-whatlinkshere-target').val;	var ns = $('#namespace').val;	title = title ? title : mw.config.get('wgTitle').replace('WhatLinksHere/', '');	return new mw.Api.get({ action : 'query', prop : 'linkshere|transcludedin', titles : title, lhlimit : 'max', tilimit : 'max', tishow : '!redirect', lhshow : '!redirect', // lhnamespace : ns == 'all' ? '' : ns, // tinamespace : ns == 'all' ? '' : ns, }).then(function(data) { var lh, ti; for (p in data.query.pages) { var page = data.query.pages[p]; lh = page.linkshere ? page.linkshere.length : 0; ti = page.transcludedin ? page.transcludedin.length : 0; }		var display = [ 'Total links: ' + lh, 'Total transclusions: ' + ti, 'Redirects and links to redirects are NOT included!' ];		var el = document.createElement('div'); $(el).html(display.join(' ')).insertAfter($('#firstHeading')); }); });

$('mw-headline').click(function{	window.location.href = window.location.href + '#' + $('mw-headline').val; });