User talk:Evad37/WikidataWatchlistLabels.js

Latest comment: 5 years ago by Evad37 in topic Needs updates for selectors
WikiProject iconWikidata
WikiProject iconThis page is within the scope of WikiProject Wikidata, a collaborative effort to improve Wikipedia's integration with Wikidata.
If you would like to participate, please visit the project page.

Not working?

edit

Originally posted at User talk:Evad37/ToDoLister.js

By the way, I have just installed WikidataWatchlistLabels, but it does not work. I still see in my watch list:

Moon‎ (Q405) (diff | hist) . . Infovarius (talk | contribs) (‎Changed [be] label: Месяц; ‎Added [be] alias: Месяц, спадарожнік Зямлі; ‎Created claim: Property:P1552: Q1037706)

Alexei Kopylov (talk) 20:27, 4 May 2018 (UTC)

I added Moon to my watchlist, and it worked for me. But watchlists can be tricky to make scripts for because there's so many different preferences. @Alexei Kopylov: Did you try bypassing your cache? If that doesn't fix it, what setting do you have in Special:Preferences#mw-prefsection-watchlist? And do you get any errors in your browser console (how to open) ? - Evad37 [talk] 01:21, 5 May 2018 (UTC)Reply
Yes, I bypassed cache. I have the following checked in my preferences:
  • Expand watchlist to show all changes, not just the most recent
  • Reload the watchlist automatically whenever a filter is changed (JavaScript required)
  • Show Wikidata edits in your watchlist
  • Add pages... options
I don't see any errors only warnings. Below is a copy of console. Alexei Kopylov (talk) 05:21, 5 May 2018 (UTC)Reply
Well, I really don't know what's going wrong for you. Maybe another script or gadget is interfering with the watchlist before this script loads? - Evad37 [talk] 13:12, 6 May 2018 (UTC)Reply
I think the problem is with the option: "Group changes by page in recent changes and watchlist" on Special:Preferences#mw-prefsection-rc. When I unchecked this, your script works fine, and when I checked this even on clean account without any other scripts, it does not work. Alexei Kopylov (talk) 19:49, 6 May 2018 (UTC)Reply
@Alexei Kopylov: Yeah, that was the problem (that preference gives the watchlist a different html structure).   Fixed now. - Evad37 [talk] 05:22, 7 May 2018 (UTC)Reply
Thank you. Your fix works if there is only one change during the day. But if there are more than one change (and this changes are grouped) then it does not do anything. Example:
m  D 03:42 	Gottfried Wilhelm Leibniz‎‎ (3 changes | history) . . (0)‎ . . [24.205.86.178‎; Alexei Kopylov‎; Ghuron‎]
   m  D 		03:42 Q9047 (diff | hist) . . 24.205.86.178 (talk) (‎Created claim: Property:P800: Q2166858)
   m  D 		03:38 Q9047 (diff | hist) . . Alexei Kopylov (talk | contribs) (‎Created claim: Property:P800: Q3030194)
   m  D 		01:09 Q9047 (diff | hist) . . Ghuron (talk | contribs) (‎Changed claim: Property:P106: Q333634, because included in the Q7035995)
Alexei Kopylov (talk) 04:08, 16 July 2018 (UTC)Reply
@Evad37: Sorry for pinging you, but is it possible to fix this bug? Thanks. Alexei Kopylov (talk) 19:08, 28 September 2018 (UTC)Reply

@Alexei Kopylov:   Fixed, sorry for the long delay, and thanks for the ping reminder. - Evad37 [talk] 06:04, 29 September 2018 (UTC)Reply

Thank you, very much. Alexei Kopylov (talk) 15:58, 29 September 2018 (UTC)Reply

Needs updates for selectors

edit

@Evad37: hey, thank you for developing such a useful script! It seems like it stopped working (both in comments and after page titles) someday with watchlist in multi-column layout (new watchlist or enhanced RC, as I believe it’s called) due to update in selectors. The code still fetches Wikidata information, but doesn’t display the results. Can you update the script inserting it with new selectors? New code for reference (beautified):

<td class="mw-changeslist-line-inner" data-target-page="Шаблон:Судно/Начало">
	<span class="mw-changeslist-line-inner-articleLink">
		<span class="mw-title">
			<a href="/wiki/%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:%D0%A1%D1%83%D0%B4%D0%BD%D0%BE/%D0%9D%D0%B0%D1%87%D0%B0%D0%BB%D0%BE" class="mw-changeslist-title" title="Шаблон:Судно/Начало">Шаблон:Судно/Начало</a>
		</span>‎ (<a class="extiw wb-entity-link" href="https://www.wikidata.org/wiki/Special:EntityPage/Q5925798">Q5925798</a>)
	</span>
	<span class="mw-changeslist-line-inner-historyLink"> (<a tabindex="-1" class="extiw" href="https://www.wikidata.org/w/index.php?title=Special%3AEntityPage%2FQ5925798&amp;curid=5697873&amp;diff=969867135&amp;oldid=958994773">разн.</a> | <a class="extiw" href="https://www.wikidata.org/w/index.php?title=Special%3AEntityPage%2FQ5925798&amp;curid=5697873&amp;action=history">история</a>)</span>
	<span class="mw-changeslist-line-inner-separatorAfterLinks"> <span class="mw-changeslist-separator">. .</span> </span>
	<span class="mw-changeslist-line-inner-userLink"><a class="extiw mw-userlink" href="https://www.wikidata.org/wiki/User:NMW03">NMW03</a></span>
	<span class="mw-changeslist-line-inner-userTalkLink"> <span class="mw-usertoollinks">(<a class="extiw" href="https://www.wikidata.org/wiki/User_talk:NMW03">обсуждение</a> | <a class="extiw" href="https://www.wikidata.org/wiki/Special:Contributions/NMW03">вклад</a>)</span></span>
	<span class="mw-changeslist-line-inner-comment"> <span class="comment">(Интервики-ссылка добавлена: <a href="https://az.wiki.x.io/wiki/%C5%9Eablon:G%C9%99mi/Ba%C5%9Fl%C4%B1q" class="extiw" title="az:Şablon:Gəmi/Başlıq">az:Şablon:Gəmi/Başlıq</a>.)</span></span>
	<span class="mw-changeslist-line-inner-rollback"></span>
	<span class="mw-changeslist-line-inner-tags"></span>
	<span class="mw-changeslist-line-inner-watchingUsers"></span>
</td>

Also, just want to add an idea: can it be done so that if page title matches title on Wikidata, the link won’t be changed in some cases? The script is most useful when Wikidata item doesn’t match page title, so this would be a nice-to-have. stjn[ru] 18:50, 27 June 2019 (UTC)Reply

@Saint Johann:   Done. Fixed the selectors, and labels will now be hidden if they match the local page title. - Evad37 [talk] 01:15, 28 June 2019 (UTC)Reply