Page MenuHomePhabricator

On Special:Contributions, add IDs to items under mw-contributions-user-tools / mw-changeslist-links
Open, Needs TriagePublic

Description

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.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptWed, Mar 25, 3:19 AM
Aklapper changed the task status from Open to Stalled.Wed, Mar 25, 9:09 AM

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.

TerraCodes updated the task description. (Show Details)Thu, Mar 26, 4:14 AM
Aklapper changed the task status from Stalled to Open.Thu, Mar 26, 11:35 AM

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&amp;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&amp;wpSearchUser=Example" title="Edit Filter log for this user">filter log</a></span>
  </span>
</div>
Aklapper renamed this task from ContentSub links on contribs pages should have IDs to On Special:Contributions, add IDs to items under mw-contributions-user-tools / mw-changeslist-links.Thu, Mar 26, 11:36 AM
Guywan added a subscriber: Guywan.EditedThu, Mar 26, 9:23 PM

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.