Jump to content

User talk:Evad37/TimestampDiffs.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by ProcrastinatingReader (talk | contribs) at 10:45, 25 February 2021 (Other archive pages: further notes). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

TimestampDiffs broken

Hey Evad. User:Evad37/TimestampDiffs seems to be broken with the Wikipedia:Comments in Local Time gadget, which produces the following broken HTML:

<span class="localcomments" timestamp="1609083791472" title="<span class='tsdiffs-timestamp tsdiffs-unlinked'>15:43, 27 December 2020 (UTC)</span>" style="font-size: 95%; white-space: nowrap;">Yesterday, 3:43 pm (UTC+0)</span>

Without TimestampDiffs:

<span class="localcomments" timestamp="1609083786525" title="15:43, 27 December 2020 (UTC)" style="font-size: 95%; white-space: nowrap;">Yesterday, 3:43 pm (UTC+0)</span>

As a secondary issue, having the script enab;ed seems to cause clicking on an anchored (eg section title) link to the page to scroll to the top of the page right after loading finishes. ProcrastinatingReader (talk) 22:17, 28 December 2020 (UTC)[reply]

Yeah, they're both trying to modify the HTML around timestamps, but the gadget gets to run first, and then this script isn't (yet) smart enough to recognise those changes, or to only act on actual text and not html tag attributes. The second problem is probably also related to the "dumb" way this script is adding the diff links. - Evad37 [talk] 00:43, 29 December 2020 (UTC)[reply]
@ProcrastinatingReader: Should be fixed now - Evad37 [talk] 02:53, 29 December 2020 (UTC)[reply]
Works now. Thanks very much Evad! ProcrastinatingReader (talk) 14:11, 29 December 2020 (UTC)[reply]
@Evad37 now I get a pop-up on pages that don't exist - viewing https://en.wikipedia.org/wiki/Wikipedia:Copyright_problems/2020_December_23 (which doesn't exist) notifies me that the script failed to load because there weren't any revisions. Would it be possible to stop earlier if the page doesn't exist? DannyS712 (talk) 07:00, 30 December 2020 (UTC)[reply]
@DannyS712:  Fixed - Evad37 [talk] 09:03, 30 December 2020 (UTC)[reply]
Maybe this is a bit far, but is it possible for the script to (for archive pages) search the original page instead? Since on an archive the edits were actually made on the parent page. Example: Wikipedia talk:Edit warring/Archives/2017/May, the script can't detect any of the diffs on this page, presumably because the edits were never made there? ProcrastinatingReader (talk) 11:47, 4 January 2021 (UTC)[reply]
@ProcrastinatingReader:  Done! Will work for any archive subpage naming scheme that begins with /Archive (case insensitive) - Evad37 [talk] 02:00, 5 January 2021 (UTC)[reply]

Other archive pages

@Evad37: Your script is a lifesaver! Another feature request, though. Could this handle non-standard archive page names? For example, Wikipedia:Administrators' noticeboard/Archive330 and Wikipedia:Administrators' noticeboard/IncidentArchive1059 do not follow the standard archive naming scheme. Would it be possible to have the tool detect these, too? ProcrastinatingReader (talk) 14:57, 23 February 2021 (UTC)[reply]

@Evad37: I've made these changes, and some other tweaks (eg was 'rvStartId' a typo? seems to keep returning the same results. changed to rvstartid) in User:ProcrastinatingReader/TimestampDiffs.js. Seem to work for me, but please check them over if you have time and possibly merge them into here? ProcrastinatingReader (talk) 10:43, 25 February 2021 (UTC)[reply]
Adding: there are some issues though. First, localcomments support still seems to be broken when it changes it into a non-UTC+0 timezone. Second, my change changing the revstartid fixes the archives issue but causes "TimestampDiffs failed to load. Error: badid_rvstartid" on e.g. the "edit source" page. Probably just needs a validation check somewhere. ProcrastinatingReader (talk) 10:45, 25 February 2021 (UTC)[reply]