MediaWiki talk:Gadget-Mark as patrolled.js

From Wikidata
Jump to navigation Jump to search

Lokalizace[edit]

@Petr Matas: Udělátko by mohlo být lokalizováno pomocí Mark as patrolled. Matěj Suchánek (talk) 12:42, 10 January 2015 (UTC)[reply]

@Matěj Suchánek: Znáš nějaké udělátko, které něco takového používá, abych se mohl inspirovat? V JavaScriptu totiž nemůžu použít wikitext. Petr Matas 12:53, 10 January 2015 (UTC)[reply]
Řekl bych, že když prohledáš skripty a udělátka v WD:Tools, něco najdeš (u mnohých některých udělátek je napsané, jakou lokalizaci užívají)... ještě se porozhlédnu. 12:56, 10 January 2015 (UTC)
Jediný, který jsem našel, je User:Ricordisamoa/DMYdates.js. Matěj Suchánek (talk) 13:12, 10 January 2015 (UTC)[reply]
Zatím se nedaří. Petr Matas 16:15, 10 January 2015 (UTC)[reply]
✓ Done, už mi na supportu poradili. :) Petr Matas 06:41, 11 January 2015 (UTC)[reply]

Not working[edit]

@Petr Matas: This is not working for me. Is it the tool that is broken, or is it just for me? Jon Harald Søby (talk) 14:54, 13 February 2015 (UTC)[reply]

It works for me. Try including it with importScript('User:Petr Matas/Mark as patrolled.js');. If it doesn't help, please try to describe the issue in more detail and I hope to be able to look into it soon. Petr Matas 16:10, 13 February 2015 (UTC)[reply]
You already saw my reply in Project chat, I see. Don't bother if it's too much work, it works the way it is as well. :-) Jon Harald Søby (talk) 16:28, 13 February 2015 (UTC)[reply]
Thanks again for the fix, Petr Matas! However, one small problem – it doesn't work with the edits that are grouped together. I figured out why, but I don't know how to fix it myself. The reason is that the script looks for the diff link with the tabindex property; however, in the grouped edits, it is the link to the current revision (marked "cur") that has the tabindex, not the link to the previous revision "prev". The "prev" link only has the "title" property, not "taxindex". Jon Harald Søby (talk) 13:45, 17 February 2015 (UTC)[reply]
✓ Fixed. Thanks for your testing and bug reporting, Jon. Petr Matas 16:13, 17 February 2015 (UTC)[reply]

Broken again. MediaWiki changed so the diff link doesn't use the tabindex attribute any more, which previously was the best way to identify it. Since there still is no class or ID for that link either, I tried to identify it analyzing the href itself. This works fine if I run it in the console, but it somehow doesn't in the gadget. Anyway, my approach was probably to narrow, as the link later is analyzed by the script anyway, and there is a fallback case where there is "oldid=" in the link instead of "diff=" - this won't be reached any more with my solution, probably breaking some other scenario. Who knows what to do? --YMS (talk) 08:39, 4 June 2016 (UTC)[reply]

Aborting[edit]

Since a couple of months, I often face this gadget aborting its work of creating the "Mark as patrolled" links in the middle. If I open a larger list of unpatrolled edits, e.g. [1], then sometimes only the first half or so of the entries end up with having the "Mark as patrolled" link. If I reload the same page immediately, the "Mark as patrolled" links may be or not be more or less complete, so it doesn't seem to fail at specific items. The problem is browser-independent (Firefox, Chrome, Opera Mobile, Mercury), and for those of them that have an error console, there's nothing in them. It doesn't seem to be depending on other custom scripts or settings, as I just had the chance to try out with a different and relatively virgin (though patroller) account, and the same problem appeared. The "!" icons (abbr.unpatrolled), which the gadgets uses to identify unpatrolled edits are there for all entries. I don't really have a clue what's going wrong, so I would appreciate if someone else could investigate. Thank you very much! --YMS (talk) 11:55, 2 February 2017 (UTC)[reply]

New Pages[edit]

@Fomafix, Matěj Suchánek: Hello.The tool works only with edits not with new pages.Can you expand its work? Thanks David (talk) 12:20, 19 November 2018 (UTC)[reply]

ER June 17, 2022[edit]

{{Edit protected}}

Hi, please merge this change to the gadget. It resolves David's problem above and help reducing the risk of inaccuracy in parsing URLs using regexes. NguoiDungKhongDinhDanh 16:25, 17 June 2022 (UTC)[reply]

@NguoiDungKhongDinhDanh: Thanks for your patch! Unfortunately it is not compatible with option "Group changes by page in recent changes and watchlist" enabled in preference - if there's no grouping, the acquired `this` (which is actually a <tr>) element contains no data-mw-revid attribute. Would you like to make some amendment? Stang 19:42, 28 June 2022 (UTC)[reply]

──────────────────────────────────────────────────────────────────────────────────────────────────── @Stang: Of course. Here they are:

I added two fallbacks. NguoiDungKhongDinhDanh 20:12, 28 June 2022 (UTC)[reply]

@NguoiDungKhongDinhDanh: ReferenceError: href is not defined at revid = href.match( /&oldid=(\d*)/ )[ 1 ];. Stang 20:34, 28 June 2022 (UTC)[reply]

──────────────────────────────────────────────────────────────────────────────────────────────────── @Stang: My bad. Sorry.

NguoiDungKhongDinhDanh 20:37, 28 June 2022 (UTC)[reply]

@NguoiDungKhongDinhDanh: Merged, thanks for your help! I thought there's no need to "double-check" if revid is undefined, so I remove the second condition. Stang 20:45, 28 June 2022 (UTC)[reply]
Fine by me. You can now nowiki the template. NguoiDungKhongDinhDanh 20:48, 28 June 2022 (UTC)[reply]