User:RinasaurusRex/common.js

// User Tags Test ===================== // User Tags config window.UserTagsJS = { modules: {}, extensions: {}, tags: { // group: { associated tag data } // Standard tags sysop: { link: 'Dragon Cave Wiki:Administrators' }, bureaucrat: { link: 'Dragon Cave Wiki:Administrators' }, 'content-moderator': { link: 'Dragon Cave Wiki:Administrators' }, threadmoderator: { link: 'Dragon Cave Wiki:Administrators' }, bot: { link: 'Dragon Cave Wiki:Administrators' }, // Custom tags dcstaff: { u:'Dragon Cave staff', link:'Personnel List' }, dcspriter: { u:'Dragon Cave artist', link:'Category:Dragon Spriter' }, },	debug: true, }; /** * Contributor Badges Module * Adds badge and tag to users based on number of edits. * Scale: *  50+   = Bronze *  200+  = Silver *  500+  = Gold *  1000+ = Platinum * * TODO: Add other namespaces to api request to get actual edit total *      Or find out how to get a real total so i don't have to calculate it */ window.UserTagsJS.extensions.ContributorBadges = { start: function(config, username) { // Get edit totals for namespaces 1-15 var buildText = function(username) { var namespaces = []; for (var i = 0; i <= 15; i++) { namespaces.push("}"); }			return namespaces.join('||'); };		var promise = $.ajax({			url: mw.util.wikiScript('api'),			data: {				action: 'parse',				format: 'json',				text: buildText(username),				prop: 'text',				disablepp: 1			},			dataType: 'json'		}).then(function(json) {			var num = $(json.parse.text['*'])				.text				.split('||')				.map(function(str) {return str.replace(/[^\d]/g, '')})				.reduce(function(total,value){return total + (+value)}, 0);			debugger;			if (num) {				if (+num >= 1000) {					return ['platinum-editor-badge', 'platinum-editor'];				} else if (+num >= 500 ){					return ['gold-editor-badge', 'gold-editor'];				} else if (+num >= 200) {					return ['silver-editor-badge', 'silver-editor'];				} else if (+num >= 50) {					return ['bronze-editor-badge', 'bronze-editor'];				}			}			return null;		}); var link = 'Special:Contributions/' + username; return { tags: { 'platinum-editor': { u: '1000+ Contributions!', order: -2, link: link }, 'platinum-editor-badge': { u: '1000+', order: -3, link: link }, 'gold-editor': { u: '500+ Contributions!', order: -2, link: link }, 'gold-editor-badge': { u: '500+', order: -3, link: link }, 'silver-editor': { u: '200+ Contributions!', order: -2, link: link }, 'silver-editor-badge': { u: '200+', order: -3, link: link }, 'bronze-editor': { u: '50+ Contributions!', order: -2, link: link }, 'bronze-editor-badge': { u: '50+', order: -3, link: link }, },			promise: promise };	} }; window.UserTagsJS.modules.ContributorBadges = true; // Enable the module

// Custom Tags UserTagsJS.modules.custom = { 'TJ09': ['dcstaff', 'dcspriter'], 'Sunstar of Cybertron': ['dcstaff'], 'Kilaicious': ['dcspriter'], 'Lythiaren': ['dcspriter'], 'Marrionetta': ['dcspriter'], 'Skinst': ['dcspriter'], 'Skinst-spriter': ['dcspriter'], 'Earthgirl': ['dcspriter'], 'JereduLevenin': ['dcspriter'], 'JaziandCo': ['dcspriter'], 'Komodo Gallant': ['dcspriter'], 'Nakase': ['dcspriter'], 'Angziety': ['dcspriter'], 'TCAnimorph': ['dcspriter'], 'Vicats': ['dcspriter'], 'Pixellation': ['dcspriter'], 'Birdzy': ['dcspriter'], 'Corteo': ['dcspriter'], 'Dispippy': ['dcspriter'], 'LaughingDove': ['dcspriter'], 'OdeenKitty': ['dcspriter'], 'Shajana': ['dcspriter'], 'Verridith': ['dcspriter'], 'Bluesonic1': ['bureaucrat'], 'BluesonicBot': ['bot'], 'RinasaurusRex': ['dcspriter'], };

importScriptPage('UserTags/code.js', 'dev'); // User Tags Test =====================

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:FindAndReplace/code.js', // Find and Replace tool        'u:dev:MediaWiki:Tooltips.js', // Tooltips        'u:dev:MediaWiki:RedirectManagement/code.js', //Redirect management    ] });