If you go to https://en.wikipedia.org/wiki/Special:Contributions/Example and look at the block log/uploads/etc links at the top (in the #contentSub element) you'll see that they don't have IDs, which makes it hard to apply JS and CSS to, making it so that people have to use workarounds (such as checking the url of the link) in order to apply JS and CSS, which seems hacky and makes it hard for non-EN languages, which use different urls then EN.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Adds classes to links in mw-contributions-user-tools | mediawiki/core | master | +18 -10 |
Event Timeline
Hi @TerraCodes, please read https://www.mediawiki.org/wiki/How_to_report_a_bug and always provide a clear list of exact steps to reproduce.
I have no idea which exact "contribs pages" this task is about. Special:Log/block ? Special:Uploads ? The latter redirects me to Special:ListFiles instead?
Please don't make people guess - thanks. :)
Yeah I probably could have been clearer, I'll edit the task a bit. Also its not really a bug unless they're intentionally supposed to have IDs but don't, but I'll add steps to reproduce anyhow.
So this seems to be about:
<div class="mw-contributions-user-tools"> For <a href="/wiki/User:Example" title="User:Example">Example</a> <span class="mw-changeslist-links"> <span><a href="/wiki/User_talk:Example" title="User talk:Example">talk</a></span> <span><a href="/w/index.php?title=Special:Log/block&page=User%3AExample" title="Special:Log/block">block log</a></span> <span><a href="/wiki/Special:ListFiles/Example" title="Special:ListFiles/Example">uploads</a></span> <span><a href="/wiki/Special:Log/Example" title="Special:Log/Example">logs</a></span> <span><a href="/w/index.php?title=Special:AbuseLog&wpSearchUser=Example" title="Edit Filter log for this user">filter log</a></span> </span> </div>
What's wrong with a little jQuery and JavaScript?
children = $(".mw-changeslist-links")[0].children;
Now you have an array of the five spans, with which you can apply styling. No?
$(children[0]).css("background-color", "red");
I don't see why these elements need ids.
@Guywan: The OP brings up the fact that, since the only thing available to distinguish each individual item are the href and title, it can be difficult to style any one in particular, since those are localized. The set of links isn't the same, mind you; they vary according to the viewing user's usergroups. children[1], etc. isn't the same for everyone, everywhere (maybe 0 and -1 are?).
Yeah, and I'd like a way that doesn't feel hacky (like trying to match the url of a page), or hoping that the elements are in the same order everytime, which might not be true if you inject custom links.
This turns out to be pretty easy to do (atleast for MW core, I haven't tried messing with AbuseFilter or etc yet), so I'm gonna take a crack at this.
Change 603941 had a related patch set uploaded (by TerraCodes; owner: TerraCodes):
[mediawiki/core@master] Adds IDs to links in mw-contributions-user-tools
@Aklapper would this be something that needs to go in the CHANGELOG file or nah? (and if so would I need to add it, or does someone else add them?)
@TerraCodes: Please provide a link to "CHANGELOG" to make sure we talk about the same thing.
Patches is discussed in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/603941 I'd say.
@TerraCodes: I meant that it's better to ask questions about your patch in Gerrit in the discussion about the patch in Gerrit.
HI @Volker_E could you respond to my reply to your messages on my patch when you get a chance please?
Change 603941 merged by jenkins-bot:
[mediawiki/core@master] Adds classes to links in mw-contributions-user-tools
@Aklapper Since change 603941 was merged, should I leave this open when I work on AF and CU and etc, or should I close it as resolved?
All of the patches I've opened have been merged, so I'm going to go ahead and close this.