User:KokoroSenshi/MediaWiki:Gadget-Sandbox1.js: Difference between revisions
Jump to navigation
Jump to search
KokoroSenshi (talk | contribs) m (Replaced: className -> addClass (since jQuery nodes are different)) |
KokoroSenshi (talk | contribs) m (Converted to use tabs; Changed description) |
||
Line 1: | Line 1: | ||
// -------------------------------------------------------- | // -------------------------------------------------------- | ||
// | // Staff Highlighting (adapted from http://en.wikipedia.org/wiki/User:Ais523/adminrights.js) | ||
// This script changes the color of links to staffs' userpages in the bodyContent of Special, History pages, diff pages, | // This script changes the color of links to staffs' userpages in the bodyContent of | ||
// various pages including Special, History pages, diff pages, and old page revisions. | |||
// ("bodyContent" being | // ("bodyContent" being the content below the page title). | ||
// | // Based on [[User:ais523/highlightmyname.js]]. | ||
// -------------------------------------------------------- | // -------------------------------------------------------- | ||
Line 13: | Line 12: | ||
botrights = {}, | botrights = {}, | ||
retiredrights = {}; | retiredrights = {}; | ||
adminrights = { | adminrights = { | ||
"52katie" :1, | |||
Clefairy52 :1, | |||
Androidos18 :1, | |||
Astroninja1 :1, | |||
AzelleAx :1, | |||
Azelleax :1, | |||
Chuck :1, | |||
Caralista :1, | |||
EzloSpirit :1, | |||
Ezlospirit :1, | |||
KokoroSenshi :1, | |||
Link_Lab :1, | |||
Midoro :1, | |||
Pixel :1, | |||
SnorlaxMonster :1, | |||
Snorlaxmonster :1, | |||
Vaati_The_Wind_Demon :1 | |||
}; | }; | ||
traineerights = { | traineerights = { | ||
Barquero :1, | |||
Mrbarquero :1, | |||
Barquero13095 :1, | |||
Bwar :1, | |||
Bwar1133 :1, | |||
Tralinde :1, | |||
Ganman3 :1, | |||
Djanonx :1, | |||
Legend_of_Zelda_Freak :1, | |||
Hylian_Pi :1, | |||
Hylian_pi :1, | |||
Paragonfishhead :1, | |||
Jjgodden :1, | |||
benfitzy :1, | |||
Benfitzy :1, | |||
MannedTooth :1 | |||
}; | }; | ||
execrights = { | execrights = { | ||
Calebzw :1, | |||
Cody :1, | |||
Cody2958 :1, | |||
Codydaviestv :1, | |||
GoldenChaos :1, | |||
Hylian_King :1, | |||
HylianKing :1, | |||
Jason :1, | |||
Joshua :1, | |||
Justin :1, | |||
Justin4408 :1, | |||
Shona :1, | |||
Shona3212 :1, | |||
Tony :1, | |||
TriforceTony :1 | |||
}; | }; | ||
botrights = { | botrights = { | ||
Ashler89 :1, | |||
KaeporaGaebora :1, | |||
KaeporaGaebora4988 :1, | |||
Redirect_fixer :1, | |||
The_Groosenator :1, | |||
Yuga :1, | |||
Yuga17953 :1, | |||
Rescue_Knight :1, | |||
}; | }; | ||
retiredrights = { | retiredrights = { | ||
Abdullah :1, | |||
Abdullah5599 :1, | |||
Adam :1, | |||
Adam660 :1, | |||
Alexander :1, | |||
Ando :1, | |||
Aranok :1, | |||
AtrumLevis :1, | |||
Autydi :1, | |||
Axiomist :1, | |||
Axle_the_Beast :1, | |||
Bob23 :1, | |||
Captain_Cornflake :1, | |||
Captain_Desdinova :1, | |||
Cartoons :1, | |||
Chocoroko :1, | |||
Chrono :1, | |||
Cipriano :1, | |||
Dannyboy601 :1, | |||
Dany36 :1, | |||
Davogones :1, | |||
Deku_Link :1, | |||
DIUM :1, | |||
Dustin :1, | |||
EA :1, | |||
Einstein95 :1, | |||
Eientei95 :1, | |||
Embyr_75 :1, | |||
EpicFaceLOL991 :1, | |||
Fizzle :1, | |||
Fox :1, | |||
Fury_Three :1, | |||
Gateway2Drillbit :1, | |||
"Hammer_Bro._Mike" :1, | |||
Henhouse :1, | |||
Ice_Medallion :1, | |||
Jin :1, | |||
JohnGames :1, | |||
K2L :1, | |||
Kain :1, | |||
Lahvu :1, | |||
Lars :1, | |||
Lee :1, | |||
LegendZelda :1, | |||
Leminnes :1, | |||
Liyuanzao :1, | |||
"Lord-of-shadow" :1, | |||
Lord_of_the_Twilight :1, | |||
Lozzie :1, | |||
Mandi :1, | |||
Mases :1, | |||
Matt :1, | |||
Melchizedek :1, | |||
Minish_Link :1, | |||
"Mr._Wiggles" :1, | |||
Nathan :1, | |||
Noble_Wrot :1, | |||
Nox :1, | |||
Owl :1, | |||
Peefy :1, | |||
Petenu :1, | |||
PPLToast :1, | |||
Sadida :1, | |||
Sagasaki :1, | |||
Scott :1, | |||
SearanoX :1, | |||
Shetani :1, | |||
Shiningpikablu252 :1, | |||
Sluzorz :1, | |||
Steven :1, | |||
Steven2113 :1, | |||
Tappy :1, | |||
The_Forbidden_One :1, | |||
TheDarkHunter :1, | |||
Thewindmaker :1, | |||
Toby :1, | |||
Trico :1, | |||
Triforce_of_the_Gods :1, | |||
Wielder_of_the_Sword :1, | |||
WilliamLC :1, | |||
Xizor :1, | |||
Yami :1 | |||
}; | }; | ||
var action = mw.config.get("wgAction"), | var action = mw.config.get("wgAction"), | ||
canonicalNamespace = mw.config.get("wgCanonicalNamespace"); | canonicalNamespace = mw.config.get("wgCanonicalNamespace"); | ||
if ( | if ( canonicalNamespace == 'Special' | ||
|| canonicalNamespace == 'Help' | |||
|| action == 'history' | |||
|| document.URL.indexOf('&diff=') > 0 | |||
|| document.URL.indexOf('&oldid=') > 0) { | |||
$(document).ready(function() { | |||
$("#bodyContent a").each(function() { | |||
var n = $(this), | |||
u = null, | |||
linkHref = $(this).attr('href'); | |||
if (linkHref.substr(0,6) === "/User:") { | |||
u = linkHref.substr(6); | |||
} else if (linkHref.substr(0,22) === "/index.php?title=User:") { | |||
u = linkHref.substr(22); | |||
} | |||
if (u !== null) { | |||
if (adminrights[u] === 1) n.addClass("admin"); | |||
else if (traineerights[u] === 1) n.addClass("trainee admin"); | |||
else if (execrights[u] === 1) n.addClass("executive"); | |||
else if (botrights[u] === 1) n.addClass("bot"); | |||
else if (retiredrights[u] === 1) n.addClass("retired"); | |||
} | |||
}); | |||
}); | |||
} | } |
Revision as of 13:04, 7 April 2017
// --------------------------------------------------------
// Staff Highlighting (adapted from http://en.wikipedia.org/wiki/User:Ais523/adminrights.js)
// This script changes the color of links to staffs' userpages in the bodyContent of
// various pages including Special, History pages, diff pages, and old page revisions.
// ("bodyContent" being the content below the page title).
// Based on [[User:ais523/highlightmyname.js]].
// --------------------------------------------------------
var adminrights = {},
traineerights = {},
execrights = {},
botrights = {},
retiredrights = {};
adminrights = {
"52katie" :1,
Clefairy52 :1,
Androidos18 :1,
Astroninja1 :1,
AzelleAx :1,
Azelleax :1,
Chuck :1,
Caralista :1,
EzloSpirit :1,
Ezlospirit :1,
KokoroSenshi :1,
Link_Lab :1,
Midoro :1,
Pixel :1,
SnorlaxMonster :1,
Snorlaxmonster :1,
Vaati_The_Wind_Demon :1
};
traineerights = {
Barquero :1,
Mrbarquero :1,
Barquero13095 :1,
Bwar :1,
Bwar1133 :1,
Tralinde :1,
Ganman3 :1,
Djanonx :1,
Legend_of_Zelda_Freak :1,
Hylian_Pi :1,
Hylian_pi :1,
Paragonfishhead :1,
Jjgodden :1,
benfitzy :1,
Benfitzy :1,
MannedTooth :1
};
execrights = {
Calebzw :1,
Cody :1,
Cody2958 :1,
Codydaviestv :1,
GoldenChaos :1,
Hylian_King :1,
HylianKing :1,
Jason :1,
Joshua :1,
Justin :1,
Justin4408 :1,
Shona :1,
Shona3212 :1,
Tony :1,
TriforceTony :1
};
botrights = {
Ashler89 :1,
KaeporaGaebora :1,
KaeporaGaebora4988 :1,
Redirect_fixer :1,
The_Groosenator :1,
Yuga :1,
Yuga17953 :1,
Rescue_Knight :1,
};
retiredrights = {
Abdullah :1,
Abdullah5599 :1,
Adam :1,
Adam660 :1,
Alexander :1,
Ando :1,
Aranok :1,
AtrumLevis :1,
Autydi :1,
Axiomist :1,
Axle_the_Beast :1,
Bob23 :1,
Captain_Cornflake :1,
Captain_Desdinova :1,
Cartoons :1,
Chocoroko :1,
Chrono :1,
Cipriano :1,
Dannyboy601 :1,
Dany36 :1,
Davogones :1,
Deku_Link :1,
DIUM :1,
Dustin :1,
EA :1,
Einstein95 :1,
Eientei95 :1,
Embyr_75 :1,
EpicFaceLOL991 :1,
Fizzle :1,
Fox :1,
Fury_Three :1,
Gateway2Drillbit :1,
"Hammer_Bro._Mike" :1,
Henhouse :1,
Ice_Medallion :1,
Jin :1,
JohnGames :1,
K2L :1,
Kain :1,
Lahvu :1,
Lars :1,
Lee :1,
LegendZelda :1,
Leminnes :1,
Liyuanzao :1,
"Lord-of-shadow" :1,
Lord_of_the_Twilight :1,
Lozzie :1,
Mandi :1,
Mases :1,
Matt :1,
Melchizedek :1,
Minish_Link :1,
"Mr._Wiggles" :1,
Nathan :1,
Noble_Wrot :1,
Nox :1,
Owl :1,
Peefy :1,
Petenu :1,
PPLToast :1,
Sadida :1,
Sagasaki :1,
Scott :1,
SearanoX :1,
Shetani :1,
Shiningpikablu252 :1,
Sluzorz :1,
Steven :1,
Steven2113 :1,
Tappy :1,
The_Forbidden_One :1,
TheDarkHunter :1,
Thewindmaker :1,
Toby :1,
Trico :1,
Triforce_of_the_Gods :1,
Wielder_of_the_Sword :1,
WilliamLC :1,
Xizor :1,
Yami :1
};
var action = mw.config.get("wgAction"),
canonicalNamespace = mw.config.get("wgCanonicalNamespace");
if ( canonicalNamespace == 'Special'
|| canonicalNamespace == 'Help'
|| action == 'history'
|| document.URL.indexOf('&diff=') > 0
|| document.URL.indexOf('&oldid=') > 0) {
$(document).ready(function() {
$("#bodyContent a").each(function() {
var n = $(this),
u = null,
linkHref = $(this).attr('href');
if (linkHref.substr(0,6) === "/User:") {
u = linkHref.substr(6);
} else if (linkHref.substr(0,22) === "/index.php?title=User:") {
u = linkHref.substr(22);
}
if (u !== null) {
if (adminrights[u] === 1) n.addClass("admin");
else if (traineerights[u] === 1) n.addClass("trainee admin");
else if (execrights[u] === 1) n.addClass("executive");
else if (botrights[u] === 1) n.addClass("bot");
else if (retiredrights[u] === 1) n.addClass("retired");
}
});
});
}