Content deleted Content added
Pythoncoder (talk | contribs) Added Jimbo, tweaked colors |
Pythoncoder (talk | contribs) better brown |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1:
//<nowiki>
/**
* User highlighter 3.
* ---------------------
* A jQuery/mediawiki-heavy rewrite of [[User:Amalthea/userhighlighter.js]]
Line 10:
* and higher-ranked permissions.
*
* The
* intermediate-level groups) and Amorymeltzer's (adds advanced-level groups)
* versions of the script. You may be interested in
Line 18:
* times; please see my documentation page for a full chart of these forks.
*
* TODO: Rollback
*
* @author Ais523
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( $.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/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;▼
▲
}),▼
function(data){
$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Bellezzasolo Bot/userhighlighter.js/excon.js', function(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')+
'/index.php?action=raw&ctype=application/json&title=User:AmoryBot/crathighlighter.js/interface-admin.json',
}),▼
function(data){
}
}),▼
$.getJSON(mw.config.get('wgScriptPath')+
▲
}),▼
function(data){
}
}),▼
// Reviewer, Pagemover, and Template Editor data is outdated!
// TODO: Extract from User:MDanielsBot/markAdmins-Data.js instead
$.getJSON(mw.config.get('wgScriptPath')+
'/index.php?action=raw&ctype=application/json&title=User: function(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')+
▲
▲ })).then(function() {
function(data){
}
$.getJSON(mw.config.get('wgScriptPath')+
▲
function(data){
}
// End outdated data
$.getJSON(
mw.config.get("wgScriptPath") +
"/index.php?action=raw&ctype=application/json&title=User:NovemBot/userlist.js",
function (data) {
bureaucratData = data.bureaucrat;
adminData = data.sysop;
formerAdminData = data.formeradmin;
nppData = data.patroller;
ecdata = data.extendedconfirmed;
ipdata = data.productiveIPs;
//tenKData = data['10k'];
}
)).then(function() {
ADMINHIGHLIGHT_EXTLINKS = window.ADMINHIGHLIGHT_EXTLINKS || false;
ADMINHIGHLIGHT_NAMESPACES = [-1,2,3];
mw.loader.using(['mediawiki.util',
mw.util.addCSS("[class~=userhighlighter_excon], [class~=userhighlighter_trusted-ip] {background-color: #99f}");
mw.util.addCSS("[class~=userhighlighter_pcusr] {background-color: #ddd}");
mw.util.addCSS("[class~=userhighlighter_ptusr] {background-color: #9c9}");
mw.util.addCSS("[class~=userhighlighter_pgmvr] {background-color: #bf9}");
mw.util.addCSS("[class~=userhighlighter_temop] {background-color: #
mw.util.addCSS("[class~=userhighlighter_former-admin] {background-color: #db9}");
mw.util.addCSS("[class~=userhighlighter_sysop] {background-color: #9ff}");
mw.util.addCSS("[class~=userhighlighter_checkuser][class~=userhighlighter_sysop] {background-color: #9cf}");
Line 81 ⟶ 117:
mw.util.addCSS("[class~=userhighlighter_bureaucrat][class~=userhighlighter_sysop] {background-color: #fb9}");
mw.util.addCSS("[class~=userhighlighter_steward] {background-color: #9cc}");
mw.util.addCSS("[class~=userhighlighter_jimbo][class~=userhighlighter_sysop] {background-color: #
$('#article a, #bodyContent a, #mw_contentholder a').each(function(index,linkraw){
try {
Line 87 ⟶ 123:
var url = link.attr('href');
if (!url || url.charAt(0) === '#') return; // Skip <a> elements that aren't actually links; skip anchors
if (url.lastIndexOf("http://", 0) !== 0 && url.lastIndexOf("https://", 0) !== 0 && url.lastIndexOf("/", 0) !== 0) return; //require http(s) links, avoid "javascript:..." etc.
var uri = new
if (!ADMINHIGHLIGHT_EXTLINKS &&
if (uri.host == 'en.wikipedia.org') {
var mwtitle = new mw.Title(mw.util.getParamValue('title',url) || decodeURIComponent(uri.
if ($.inArray(mwtitle.getNamespaceId(), ADMINHIGHLIGHT_NAMESPACES)>=0) {
var user = mwtitle.getMain().replace(/_/g," ");
Line 97 ⟶ 133:
if (mwtitle.getNamespaceId() === -1) user = user.replace('Contribs/',''); // The Contribs abbreviation too
if (
link.addClass(link.attr('class') + ' userhighlighter_steward');
}
if(
link.addClass(link.attr('class') + ' userhighlighter_bureaucrat');
}
Line 115 ⟶ 151:
link.addClass(link.attr('class') + ' userhighlighter_checkuser');
}
if (
link.addClass(link.attr('class') + ' userhighlighter_sysop');
}
if(formerAdminData[user] == 1) {
link.addClass(link.attr('class') + ' userhighlighter_former-admin');
}
if(tpdata[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_temop");
}
if(mvdata[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_pgmvr");
}
if(
link.addClass(link.attr('class') + " userhighlighter_ptusr");
}
if(pcdata[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_pcusr");
}
if(ecdata[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_excon");
}
if(ipdata[user] == 1) {
link.addClass(link.attr('class') + " userhighlighter_trusted-ip");
}
if(user == 'Jimbo Wales') {
link.addClass(link.attr('class') + " userhighlighter_jimbo");
}
}
Line 145 ⟶ 187:
});
});
}(jQuery, mediaWiki));
//</nowiki>
|