User:Pythoncoder/Scripts/userHighlighter.js: Difference between revisions

Content deleted Content added
migrate from mw.uri to URL per instructions at Wikipedia:Village_pump_(technical)#Tech_News:_2025-08
code cleanup (some code taken from User:Anne_drew/admintagger-plus.js)
Line 1:
//<nowiki>
/**
* User highlighter 3.01
* ---------------------
* A jQuery/mediawiki-heavy rewrite of [[User:Amalthea/userhighlighter.js]]
Line 10:
* and higher-ranked permissions.
*
* The directoriginal source for this script is a combination of Bellezzasolo's (adds
* intermediate-level groups) and Amorymeltzer's (adds advanced-level groups)
* versions of the script. You may be interested in
Line 26:
* @author Amorymeltzer
* @author Pythoncoder
*
* Version 3.1 will be released in 2025. In addition to removing deprecated
* MediaWiki functionality (which originally prompted the update),
* I'm taking the time to backport some features from forks of this script,
* so I guess I should add more credits:
*
* @author Anne_drew
*/
(function($, mw){
mw.hook('wikipage.content').add(function(){
var ecdata, pcdata, mvdata, tpdata, addata;
$.when(
$.getJSON(mw.config.get('wgScriptPath')+
'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/arbcom.json',
function(data){
acdata = data;
}
}),
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/bureaucrat.json', function(data){
$.getJSON(mw.config.get('wgScriptPath')+
crdata = data;
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/bureaucratoversight.json', function(data){
}),
})).then( function(data) {
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/oversight.json', function(data){
osdata = data;
}
}),
}),
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/checkuser.json', function(data){
$.getJSON(mw.config.get('wgScriptPath')+
cudata = data;
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/oversightcheckuser.json', function(data){
}),
function(data){
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/excon.js', function(data){
ecdata cudata = data;
}
}),
}),
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/pcusr.js', function(data){
$.getJSON(mw.config.get('wgScriptPath')+
pcdata = data;
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/exconpcusr.js', function(data){
}),
function(data){
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/pgmvr.js', function(data){
mvdata pcdata = data;
}
}),
}),
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/temop.js', function(data){
$.getJSON(mw.config.get('wgScriptPath')+
tpdata = data;
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/pcusrpgmvr.js', function(data){
}),
function(data){
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/sysop.json', function(data){
addata mvdata = data;
}
}),
}),
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/ptusr.js', function(data){
$.getJSON(mw.config.get('wgScriptPath')+
ptdata = data;
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/pgmvrtemop.js', function(data){
}),
function(data){
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/interface-admin.json', function(data){
iadata tpdata = data;
}
}),
}),
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/steward.json', function(data){
$.getJSON(mw.config.get('wgScriptPath')+
swdata = data;
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/temopptusr.js', function(data){
})).then(function() {
function(data){
crdata ptdata = data;
}
}),
$.getJSON(mw.config.get('wgScriptPath')+
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/checkuserinterface-admin.json', function(data){
function(data){
cudata iadata = data;
}
}),
$.getJSON(
mw.config.get("wgScriptPath") +
"/index.php?action=raw&ctype=application/json&title=User:NovemBot/userlist.js",
function (data) {
bureaucratData = data.bureaucrat;
stewardData = data.steward;
adminData = data.sysop;
formerAdminData = data.formeradmin;
extendedConfirmedData = data.extendedconfirmed;
tenKData = data['10k'];
}
)).then(function() {
ADMINHIGHLIGHT_EXTLINKS = window.ADMINHIGHLIGHT_EXTLINKS || false;
ADMINHIGHLIGHT_NAMESPACES = [-1,2,3];
Line 98 ⟶ 128:
if (mwtitle.getNamespaceId() === -1) user = user.replace('Contribs/',''); // The Contribs abbreviation too
if (swdatastewardData[user] == 1) {
link.addClass(link.attr('class') + ' userhighlighter_steward');
}
if(crdatabureaucratData[user] == 1) {
link.addClass(link.attr('class') + ' userhighlighter_bureaucrat');
}
Line 116 ⟶ 146:
link.addClass(link.attr('class') + ' userhighlighter_checkuser');
}
if (addataadminData[user] == 1) {
link.addClass(link.attr('class') + ' userhighlighter_sysop');
}
if(tpdata[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_temop"); // Override the above color by using `a.userhighlighter_temop.userhighlighter_temop {background-color: COLOR !important}`
}
if(mvdata[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_pgmvr"); // Override the above color by using `a.userhighlighter_pgmvr.userhighlighter_pgmvr {background-color: COLOR !important}`
}
if(ptdata[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_ptusr"); // Override the above color by using `a.userhighlighter_ptusr.userhighlighter_ptusr {background-color: COLOR !important}`
}
if(pcdata[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_pcusr"); // Override the above color by using `a.userhighlighter_pcusr.userhighlighter_pcusr {background-color: COLOR !important}`
}
if(ecdataextendedConfirmedData[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_excon"); // Override the above color by using `a.userhighlighter_excon.userhighlighter_excon {background-color: COLOR !important}`
}
if(user == 'Jimbo Wales') {
link.addClass(link.attr('class') + " userhighlighter_jimbo"); // Override the above color by using `a.userhighlighter_jimbo.userhighlighter_jimbo {background-color: COLOR !important}`
}
}