Jump to content

User talk:Ale jrb/Scripts/userhist.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

@Amorymeltzer: your latest edit to this script seems to have caused a conflict with User:Markhurd/hidetopcontrib.js, so that neither of them work if both are enabled. ansh666 16:58, 12 April 2018 (UTC)[reply]

Ansh666 Indeed, thanks for the catch! It seems that increasing 'b' by one does the trick. I want to test around a bit more, but I think it would work to 1. add a class to the "all" links added by userhist and then 2. add a line to hidetopcontrib a la revdel to increase the variable accordingly. ~ Amory (utc) 17:29, 12 April 2018 (UTC)[reply]
@Ansh666: Does importing User:Amorymeltzer/vector.js work for you? It works for me, but I want to confirm before I go changing these two scripts. ~ Amory (utc) 17:36, 12 April 2018 (UTC)[reply]
It works when I put it in my vector.js but not my common.js (which was where I'd had them before), but that's probably because it's your vector.js. Thanks for looking into it! ansh666 18:51, 12 April 2018 (UTC)[reply]
@Ansh666: Should work now. ~ Amory (utc) 20:12, 12 April 2018 (UTC)[reply]
Yes it does, thanks! ansh666 20:50, 12 April 2018 (UTC)[reply]

Using wgRelevantUserName

[edit]

Hi Ale jrb, I hope you don't mind, but I just made this minor edit, which avoids throwing an error if you end up on Special:Contributions without any username specified.

With that in mind, the first block of code in that section seems designed just to get the username (via regContent, regTest, and regMatch). You wrote this (excellent script) nearly a decade ago, well before wgRelevantUserName existed. That whole block could be simplified by replacing it with var user = mw.config.get('wgRelevantUserName'); but wanted to post here before making a somewhat significant code change in your script. ~ Amory (utc) 19:43, 7 September 2018 (UTC)[reply]

Oh, cool. Yes, the purpose of those regexes is to determine the user to load, so replacing it with the value from `wgRelevantUserName` seems like a good idea to me. Ale_Jrbtalk 14:07, 9 September 2018 (UTC)[reply]
 Done. I didn't realize it before, but the regex was out of date anyway, so it should work for IPv6 addresses now. ~ Amory (utc) 16:29, 9 September 2018 (UTC)[reply]

Fix for broken namespace menu on Special:Contributions

[edit]

Hey Ale jrb, after the above, I hope you don't mind that I made a few improvements and bugfixes to this while you were less active; I'm a big fan of this script, and there have been a number of changes to contributions and history pages in the past year or so. I noticed today that the current system used by the script breaks the appearance of the "invert selection" and "associated namespace" checkboxes on Special:Contributions; bodyContent.innerHTML.replace freezes whatever status existed upon load, which is hidden, hence I only just discovered they even existed! There are a few ways to do this, but replacing the last three lines of the contributions section ( bodyContent) with the following seems like it should work:

var list = $('.mw-changeslist-history');
list.each(function(idx, el) {
	el.parentNode.innerHTML = el.parentNode.innerHTML + " | <a class=\"mw-changeslist-all\" href=\"/w/index.php?title=" + encodeURIComponent(el.title) + "&action=history&isolate=" + user + "\">all</a>";
});

I can take care of it if you like, but I noticed that coincidentally you've been making a number of edits today, so I wanted to check with you before doing it. ~ Amory (utc) 21:12, 10 May 2019 (UTC)[reply]

 Done ~ Amory (utc) 16:27, 13 May 2019 (UTC)[reply]
Thanks for this! Ale_Jrbtalk 00:20, 14 May 2019 (UTC)[reply]

Minor fix for history of a deleted page

[edit]

Might I suggest changing line 167 from:

if (mw.config.get('wgAction') == 'history') {

to:

if (mw.config.get('wgAction') == 'history' && mw.config.get('wgArticleId')) {

It's unlikely, but if someone attempts to view the history of nonexistant or deleted page, document.getElementById( 'mw-history-search' ).appendChild(span); complains since #mw-history-search doesn't exist. There are other work arounds but this seems the smoothest. ~ Amory (utc) 14:52, 4 October 2019 (UTC)[reply]

I've gone and made this change, hope you don't mind. I've also changed my work from the above section so that it's a separate span, matching the other links rather than being nested within one. ~ Amory (utc) 14:55, 9 October 2019 (UTC)[reply]
Makes sense, thanks! Ale_Jrbtalk 12:40, 16 October 2019 (UTC)[reply]

Occasional waLib failures

[edit]

I occasionally get this when clicking on an "all" link, do other folks? AFAICT the waLib is only used at that point, so what about putting off loading until then, and using mw.loader.getScript since it returns a promise? That should ensure no errors. ~ Amory (utc) 21:35, 7 February 2021 (UTC)[reply]