MediaWiki:Gadget-RfDLink.js

/** * Adds WD:RfD on above personal links and if "Compact Personal Links" is enabled, puts count of deletion requests also */ /*jslint white: true*/ /*global jQuery, mediaWiki, setTimeout*/ $(function {	'use strict';	mw.util.addPortletLink('p-personal', mw.util.getUrl('Gratisdata:Requests for deletions'), ({		da: 'Sletningsanmodninger',		de: 'Löschanträge',		el: 'Αιτήσεις διαγραφής',			en: 'Deletion requests',		fa: 'درخواست\u200cهای حذف',		fr: 'Demande de suppression',		mk: 'Барања за бришење',		pl: 'Wnioski o usunięcie',		pt: 'Pedidos de eliminação'	}[mw.config.get('wgUserLanguage').split('-')[0]] || 'Deletion requests'), 'pt-rfd', undefined, undefined, '#pt-logout');

/*	// 200ms delay for "Compact Personal Links" to be loaded? setTimeout(function {		return;		// discontinue the rest if "Compact Personal Links" is not available		if ($('#pt-flyout').length === 0) { return; }

$(' ', { id: 'pt-rfd-count' }).appendTo('#pt-rfd a'); $.when(			new mw.Api.get({ action: 'query', prop: 'revisions', titles: 'User:BeneBot*' + '/RfD-stats', rvprop: 'content', format: 'json' }).then(function (data) { return $.map(data.query.pages, function (value) { return value; })[0].revisions[0]['*']; }),			mw.loader.using('mediawiki.language')		).then(function (num) {			var rfdCount = $('#pt-rfd-count');			rfdCount.text(mw.language.convertNumber(num));			if (num > 100) { rfdCount.css('color', 'red'); }		}); }, 200);*/ });