Forums: Index → General Discussion → Adding User Group boxes help
Fandom's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
To contact staff directly or to report bugs, please use Special:Contact.
Is there anything wrong with the below code? It works on Terraria Wiki.
//<source lang="javascript">
$(function() {
var rights = {};
// BEGIN LIST OF ACCOUNTS GIVEN EXTRA USER RIGHTS ICONS
// FOUNDER - even though it's TimmyD I'm saying it's Mpardiolo's. He helped
// A LOT.
rights["Mpardaiolo"] = ["Former Administrator","Recognized user"];
// MANAGEMENT/BUREAUCRATS
rights["Jeffwang16"] = ["Manager","Administrator","Recognized user"];
// ADMINISTRATORS
rights["X~Calibur95"] = ["Administrator","Recognized user"];
// ROLLBACKERS
rights["Jeffwang16"] = ["Rollback","Chatmod"];
// TEST ACCTS, BOTS, & AWB
rights["Jeffwangbot"] = ["AWB Bot"];
rights["X~Bot95"] = ["AWB Bot"];
rights["Anarchybot"] = ["Former AWB Bot"];
// FORMER ADMINS AND MANAGERS
rights["Anarchyuk"] = ["Former Administrator","BLOCKED"],
rights["Rangerkid51"] = ["Former Administrator"],
rights["Revme"] = ["Former Administrator","BLOCKED"];
// END LIST OF ACCOUNTS GIVEN EXTRA USER RIGHTS ICONS
if (typeof rights[wgTitle] != "undefined") {
// remove old rights
$('.UserProfileMasthead .masthead-info span.group').remove();
for( var i=0, len=rights[wgTitle].length; i < len; i++) {
// add new rights
$('<span class="group">' + rights[wgTitle][i] +
'</span>').appendTo('.masthead-info hgroup');
}
}
});
//</source>
Thanks. --..Jeff (Talk!) (Contribs!) (Email!) (Blog!).. 18:20, February 5, 2012 (UTC)
- Bump --..Jeff (Talk!) (Contribs!) (Email!) (Blog!).. 23:37, February 7, 2012 (UTC)
- More context would be helpful. Like, what is the code supposed to do? Is there any CSS that needs to go with it? Were did you put the code on your wiki? Where does the code live on the wiki where it works?
- It looks like it's supposed to change the label on user profiles. -- Fandyllic (talk · contr) 8 Feb 2012 4:03 PM Pacific
- Should look like this. --..Jeff (Talk!) (Contribs!) (Email!) (Blog!).. 01:01, February 9, 2012 (UTC)
- BUMP --..Jeff (Talk!) (Contribs!) (Email!) (Blog!).. 12:34, February 9, 2012 (UTC)
- It looks like the code can't be used directly, but as an import. I put a version at User:Fandyllic/wikia.js/userRightsIcons.js and imported it in my User:Fandyllic/wikia.js like this:
// Additional UserRights Icons in profile mastheads importScript('User:Fandyllic/wikia.js/userRightsIcons.js'); // END Additional UserRights Icons in profile mastheads
- It worked for me. Try putting the code in a sub-page (like MediaWiki:wikia.js/userRightsIcons.js) and then import it from there like on the Terraria wiki. -- Fandyllic (talk · contr) 9 Feb 2012 4:52 PM Pacific
- w:c:music:MediaWiki:Wikia.js, w:c:music:MediaWiki:Wikia.js/userRightsIcons.js - it's still not functioning. --..Jeff (Talk!) (Contribs!) (Email!) (Blog!).. 02:52, February 10, 2012 (UTC)
- It worked for me. Try putting the code in a sub-page (like MediaWiki:wikia.js/userRightsIcons.js) and then import it from there like on the Terraria wiki. -- Fandyllic (talk · contr) 9 Feb 2012 4:52 PM Pacific
- I did credit you. Thanks! But it's still not working. --..Jeff (Talk!) (Contribs!) (Email!) (Blog!).. 12:57, February 10, 2012 (UTC)
(Reset indent) Ah. The code above omitted the credit line. The code works. According to music.wikia.com, the JS isn't even loading. I've heard a bunch of people complain about this in the last week. I will be contacting Wikia about it. It seems like a simple caching issue. How long has it been imported into your JS? Rappy 15:56, February 10, 2012 (UTC)
- Yeah, makes sure the code has the following:
// WRITTEN BY USER:Rappy_4187
- I guess there are some wiki specific JS loading issues. It worked for me. -- Fandyllic (talk · contr) 10 Feb 2012 1:02 PM Pacific
- Yeah there is. I've reported it. Once again it seems that personal CSS/JS is loading fine, but site-wide isn't. Just hold for a day or so Jeff. Wikia will hopefully solve the issue. Rappy 21:33, February 10, 2012 (UTC)