User:Useddenim/common.js

// Add the result-line-count at the bottom of Special:GlobalUsage $(function { if ('GlobalUsage' !== mw.config.get('wgCanonicalSpecialPageName')) return;  mw.util.$content.append($(' ', { text: 'Count: ' + $('#mw-globalusage-result').find('ul > li').length })); });

// Add the result-line-count at the bottom of Special:WhatLinksHere $(function { if ('WhatLinksHere' !== mw.config.get('wgCanonicalSpecialPageName')) return;  mw.util.$content.append($(' ', { text: 'Count: ' + $('#mw-whatlinkshere-result').find('ul > li').length })); });

/** * Ajax Undo links * * Adds an Ajax undo link next to the normal undo link on page histories * and on diff pages * Based on User:Abelmoschus Esculentus/AjaxRollback.js */ // //Modified from User:BenjaminWillJS/AjaxRollback.js jQuery(document).ready(function ($) {	function CreateUndoLink(parentObj) {		var rollbackLink = $( '' ).text( 'Rollback Summary' ).attr( 'href', '#' ).click(function(e) { e.preventDefault; var $rblink = $(parentObj); var href = parentObj.href; console.log(href); var summary = prompt("Enter optional summary", ""); if (summary === null) {				return; }			var summarystr = ""; if (summary !== "") {				summarystr = "&summary=" + summary; }			this.innerHTML = '';			$.ajax({				url: href + summarystr,				success: function {					$rblink.text(function (i, val) {return val + '[reverted]';});				},				error: function {					$rblink.text(function (i, val) {return val + '[rollback failed]';});				}			}); });		return rollbackLink;	}	function SetAjaxRollback {		$( '.mw-rollback-link > a' ).each( function { $ajaxUndoLink = CreateUndoLink( this ); $( this ).parent.after( ' | ', $ajaxUndoLink ); } );	}	mw.loader.using(['mediawiki.util', 'mediawiki.api', 'mediawiki.Title', 'mediawiki.RegExp'], function { SetAjaxRollback; }); }); //