FANDOM


This is the talk page for discussing improvements to the HighlightUsers page.

Internationalization

Hey, I saw some people copied the script for i18n, I apologize for not including that functionality. I will add in a customization tomorrow (apparently my dad doesn't consider helping people a good use of five minutes) -- I can try finding something tomorrow, but does anyone know if there's a way I could accomplish it without requiring people to specify the name of the User namespace when importing the script? Also, there's currently an issue with the script where it will not always choose the appropriate (highest) color for a user; I will fix this as soon as possible (not sure when - things are a little crazy). ~Bobogoobo (talk) 05:43, November 19, 2013 (UTC)

You might just want to get the User ns using API:
new mw.Api().get({
	action:'query',
	meta:'siteinfo',
	siprop:'namespaces',
	format:'json'
}, function(data) {
    var user = mw.util.rawurlencode(data.query.namespaces["2"]["*"]);
	console.log(user);
});
--~UltimateSupreme 19:37, November 19, 2013 (UTC)
Assuming the namespace only chnages names with the wiki language, as opposed to the user language, you could try wgNamespaceIds which seem to be in the same order on every wiki:
var x = 0;
for ( i in wgNamespaceIds ) {
    if ( x === 4 ) {
        console.log( i );
    }
    x++;
}
as demonstrated by the above code. I wouldn't call it elegant or foolproof, but it seems to work. cqm 00:43, 20 Nov 2013 (UTC)

sorry to bother you guys but the highlight thing still isn't fully functional, the color keeps jumping between different levels of user rights (rollback, chat moderator, admin). i don't want to have to go back to using css and update every promotion.Nerfmaster8 (talk) 19:13, December 18, 2013 (UTC)

Example

Hi!

Emh... could you give me an example of how you should place the code so that administrators (sysop) be highlighted with a green color?

Thanks!
P[ntor Kagam]ne [ talk me!117 contribs.] 01:38, February 6, 2014 (UTC)

If you wanted to highlight admins green, and nothing else you'd use this:
highlight = {
    sysop: 'green'
};
 
importArticles({
    type: 'script',
    articles: [
        'u:dev:HighlightUsers/code.js'
    ]
});
However there are many other options and things you can do. —RyaNayR (talkcontribs) 02:22, February 06, 2014 (UTC)
Thank you so much. My question was really if all lines require a comma at the end or the last was the only one not :) P[ntor Kagam]ne [ talk me!117 contribs.] 03:31, February 6, 2014 (UTC)
Ah. Yeah, any kind of list will require commas after each item, except for the last one (or if it's only one). Technically you could put it all on one line, but that would be ugly and hard to read. It's also worth mentioning that you can use either single quotes (') or double quotes (") for strings and such, and it usually doesn't make any difference. The only time it matters is something like 'This string won't work because of the apostrophe in won't.', in which case you could use double-quotes like "this works 'cause it's surrounded with double-quotes." or 'This\'ll also work because it\'s escaping the single quotes with backslashes.'.
Also note that the last (or only) line can have a comma after it, and it will not cause an error. It's not really proper technique to put a comma when it's not necessary, but it will still work. Same with semicolons, the javascript interpreter will attempt to add them where it expects to see them, so they're not strictly necessary, but it's probably better to do so, for safety's sake and clarity's sake. —RyaNayR (talkcontribs) 05:59, February 06, 2014 (UTC)

strange error

i set chatmoderators to orange "#FF6600", now its making wikia's global bots and a standard user have this color. no idea why.Dartmaster8 (talk) 17:10, August 8, 2014 (UTC)

group classes, and forum support

How about adding group classes to the highlighted links? This will make it easier still to separately style the various user groups highlighted by the script. One thing I'd like to achieve with this is adding FontAwesome icons beside the user names - at least for my personal use.

Another suggestion is to have this work on the forum threads, so that people will have another choice than using MessageWallUserTags and manually adding (and more painstakingly maintaining) users to a list. I guess this would have been easy enough to implement, just add a few other selectors.

Also I've seen this script hitting-and-missing the user links on the Wiki Activity sidebar module. I'm not sure if it's a bug, but theoretically this script should work on those. — mfaizsyahmi (message wall) 11:43, October 7, 2015 (UTC)

Change color of message wall/talk links

How to change the settings in order to change the color of links to message walls/user talk pages? yhynerson1talk 16:34, July 23, 2016 (UTC) selectAll: true

Flaw

I have just browsed the wiki, and found that if the user link is created later than the highlight script loads, the link color won't change. I suggest using an auto-generated CSS stylesheet. (Is this script unmaintained?) KurwaAnticstalk 10:56, August 24, 2016 (UTC) P.S. The wikia rail seems to load later than the highlight script, so the links on the recent activity module cannot be highlighted. KurwaAnticstalk 15:40, August 24, 2016 (UTC)

Can this be solved with a $(document).ready or even a $(window).load function? — Original Authority (talk) 16:02, August 24, 2016 (UTC)
I tested $(window).load, but the comments are still not highlighted. KurwaAnticsTalk 01:09, February 19, 2017 (UTC)
I saw in the code that the HighlightUsers namespace has been isolated but it has put itself in the ajaxCallAgain array used by AjaxRC. Try and execute every function in the array - one of it is definitely HighlightUsers's main function. — mfaizsyahmi (message wall) 17:17, March 4, 2017 (UTC)

Content Moderators

On the JS, it has an error bc content-moderator has a "-" in it.

Is there a solution to this? WolfLord315

01:04, October 14, 2016 (UTC)

Content-moderator isn't anywhere on the code.js page... --Sharkie 01:12, October 14, 2016 (UTC)
That's not really what I meant :P. For example,
   sysop: 'purple',
   bot: '#00FF00',
but putting 'content-moderator' would result in an error because of the "-". Is there a solution to making this not happen but at the same time, allow me to achieve what I want? WolfLord315
10:44, October 14, 2016 (UTC)
If I understand correctly, you are writing something like content-moderator: '#0000FF',, try adding quotations like 'content-moderator': '#0000FF',. leviathan_89 @fandom 16:19, October 14, 2016 (UTC)
Okay, I've tried it and it works. Thanks!! :D WolfLord315
21:36, October 14, 2016 (UTC)

AjaxrC

I believe

window.ajaxCallAgain = window.ajaxCallAgain || [];
window.ajaxCallAgain.push(highlightUsers);

should be added directly in your code, not on the user side. That's because you have to place that after the imports contrary to what's written in the page (otherwise highlightUsers will throw an error saying it's not defined).

Last, I think the script should also add a specific user group CSS class, like "highlight-users-NAMEOFTHEGROUP", to allow further customizations beside the plain color. leviathan_89 @fandom 16:14, October 14, 2016 (UTC)

Well I can't make it work with AjaxRC, however it's true that if you add the callback function before it will cause an error. (actually even after) leviathan_89 @fandom 17:25, October 14, 2016 (UTC)

Ok solved with:

window.ajaxCallAgain = window.ajaxCallAgain || [];
window.ajaxCallAgain.push( function() {
   if (typeof highlightUsers == 'function') highlightUsers();
});

leviathan_89 @fandom 16:58, October 15, 2016 (UTC)

Suggestions

(copying from the secton above to make it more clear) I think the script should also add a specific user group CSS class, like "highlight-users-NAMEOFTHEGROUP", to allow further customizations beside the plain color. Also, maybe the script should avoid talk pages and wiki forums? (or have an option for doing so) I mean, you don't really want to change user signatures, you want to change their user link on RC, logs, special pages, blogs activity modules and ?action=history leviathan_89 @fandom 16:58, October 15, 2016 (UTC)

HighlightUsers using auto-generated CSS

See this thread. –– KurwaAntics (talk) 08:51, February 25, 2017 (UTC)

Very slow

Apparently this script make RC extremely slow, almost unresponsive if paired up with AjaxRC (which will callback the script every time). leviathan_89 @fandom 14:17, November 8, 2017 (UTC)

I've marked it as unstable. leviathan_89 @fandom 19:56, November 8, 2017 (UTC)

Is this still the case? I never retired but stopped checking my watchlist, and nothing about this script was put on my talk page. In the interim someone seems to have rewritten in it in completely the opposite paradigm to how I do things, then split. ~Bobogoobo (talk) 23:57, April 6, 2020 (UTC)

Regarding latest update

A recent update has given user groups highlighted names by default. It would preferable if the default state remained uncustomised.

Also, I would imagine that the script should only be assigning colours to links which are siblings of .WikiaPage and .modalContent and not .wds-global-navigation-wrapper or #WikiaBar.

Hackey5 (talk) 00:49, November 18, 2018 (UTC)

Late, but I've scoped it to .WikiaPage and removed the default configuration. speedy🔔︎🚀︎ 16:58, December 4, 2018 (UTC)

Functioning?

Is it just me, or did this script stop working a fair while ago?

Hackey5 (talk) 09:14, June 13, 2020 (UTC)

Small Issue

Hi!! I'm having a bit of an issue:

window.highlightUsersConfig = {
    colors: {
        // 'group-name': 'color',
        'bureaucrat': '#db3737',
        'sysop': '#db3737',
        'bot': '#4299eb',
    },
    styles: {
        // 'group-name': 'styles',
        'staff': 'font-weight: bold;'
    }
};

The 'bot' line is what's killing it for some reason. When I add that line, it messes the rest of them up like the bureaucrat and sysop ones don't work when the bot line is there.

Any idea what could be causing this?
Zacatero 18:43, July 14, 2020 (UTC)

Language wikis

So a user discovered an issue when using this script on a language wiki where the highlight would randomly not work. After some testing, I noticed that dev.highlightUsers.cache actually shows the English users for me. So my assumption is that because language wikis no longer have thier own subdomain, the localStorage object is shared between English and language wikis, which results in cache errors if someone visits both. My best guess would be to store cache based on language (perhaps dev.highlightUsers.cache[lang] or something). Fewfre 🔎 K🧀16:35 Fri, 28 Aug 2020

Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+