FANDOM


  • HighlightUsers has been unmaintained for over 2 years. Several issues user have suggested have not been fixed.

    Here I suggest a few changes:

    • Use auto-generated CSS instead of adding color to elements one by one. - Using Ajax to color elements is slow and elements loaded after the script are not colored. CSS stylesheet ensures all matched elements are colored whenever they are loaded.
      • Neither $(document).ready(); nor $(window).load(): is able to solve this problem.
    • Use caches to save loading time. Load from the cached stylesheet after the stylesheet has been generated. (You don't want to generate the same stylesheet every time you load a page, right?)
    • Detect user rights changes so that the stylesheets are updated once there are any changes.
    • Suggested by mfaizsyahmi and leviathan_89: Give each user group a specific class.
    • Exclude links in "My favorite wikis".
      Loading editor
    • Agreed with using a stylesheet, and caching said stylesheet. Perhaps caching can be done with localStorage, and fall back to cookies. That said, I tend to use one or the other but not both, supporting both bloats the code and makes it harder to maintain IMO.

      I'm not sure how to properly do "detect user rights changes" without making AJAX calls on every page load.

      Adding user group classes is the natural step forward IMO.

        Loading editor
    • Working on it.

        Loading editor
    • Colouratura wrote: Working on it.

      Thanks. ;)

        Loading editor
    • Cqm

      Probably the easiest thing is to make a js script that queries the API for a set list of groups which can regenerate the css as required. The API call would be something like http://dev.wikia.com/api.php?action=query&list=allusers&augroup=vanguard&aulimit=max&format=jsonfm (in this case I've used vanguard) and in rough terms of code it would end up with something like the following:

      var groups = [
              'vanguard',
              'voldev',
              'vstf',
              'helper',
              'staff'
          ];
          users = {};
      
      function generateCSS() {
          // generate css here and add to the css page
      }
      
      function getUsers(i) {}
          group = groups[i];
          // get list of users
          (new mw.Api()).get({
              // params go here, including group name
          }).done(function (res) {
              // access list of users from api result
              users[group[i]] = listOfUsers;
              if ([i + 1 === group.length) { generateCSS(); return; }
              getUsers(i + 1);
          })
      });
      

      Things to remember include handling needing to re-query the api if the list of users isn't in a single set of results, encoding certain user names for older browsers and not deleting the list of bots current in the stylesheet.

        Loading editor
    • It has been over a month and... any progress?

        Loading editor
    • The author of the script is inactive (or he doesn't have time, I don't remember), so if anyone has the skill and the will to improve the script, please do so.

        Loading editor
    • I believe the best approach is the one used by RecentChangesMultiple: adding a class to the username link for each user group it belongs to. By doing that, people will have more freedom to customize the link then just changing the colors.

        Loading editor
    • It has been 8 months since I created this thread... still no progress. Sad.

        Loading editor
    • Rudimentary version. I added quite a bit of validation, the caching idea, and ideas from Highlight.

        Loading editor
    • Does that version uses CSS classes? Doesn't it still style through JS?

        Loading editor
    • Adding it depends on what form of extensibility would be helpful here. Colors are a given, while text formatting would be good. Both seem doable with just JS, but I need to tweak the config.

      Classes might be hard to implement - bearing in mind that lots of elements are sideloaded. Maybe users could add badges, with classes? Use pseudoselectors?

        Loading editor
    • If it's possible to add CSS classes, then using them is far superior to just CSS because it will enable user to customize anyway they want and without going through the JS review process. I'm a bit surprised that's hard to do, since I would've imagined that if you can target those element to change colors/formatting then you could also add classes, however if that's the case then too bad.

        Loading editor
    • do u talking about adding data to user? somethning like data-user-group="sysop", and style via [data-user-group="sysop"] {style}? i believe i saw such script somewhere on dev wiki.

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message