User talk:Nardog/CopySectLink

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

Thanks[edit]

Thanks again for making this. I use it daily, saves a lot of hand moves from mouse to keyboard. GreenC 16:22, 24 December 2021 (UTC)[reply]

Conflicts with "Add an [edit] link for the lead section of a page"[edit]

Love this script but sometimes (on page load), the script interferes with the "Add an [edit] link for the lead section of a page" gadget, and the spot next to the lead header reads as [ copy | copy ] rather than [ edit | copy ]. When it's messed up, clicking on the first "copy" runs this CopySectLink and copies to clipboard, and clicking the second "copy" reloads the page. Hard refreshing the page resolves the issue, but it happens pretty often—anyone else getting the same thing and any easy fixes? czar 01:20, 18 January 2022 (UTC)[reply]

I'm aware of this issue. It occurs when this script is run before the edittop gadget. It can be fixed by making sure the script is loaded after the gadget, as in:
mw.loader.using('ext.gadget.edittop', function () {
	mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Nardog/CopySectLink.js&action=raw&ctype=text/javascript');
});
I'll update the documentation. Nardog (talk) 01:59, 18 January 2022 (UTC)[reply]
@Czar: Seeing how popular the gadget seems to be across wikis, I've decided to make the script automatically avoid the conflict. You no longer have to use the above code. Nardog (talk) 08:34, 19 January 2022 (UTC)[reply]

Thanks & Request?[edit]

I love this script! Could the "copy" button be renamed to "link", though? I get that users who install this script know what they expect, but it could be slightly confusing- in screenshots, I guess? Aaron Liu (talk) 02:21, 20 December 2023 (UTC)[reply]

I don't know how that could be the case. "edit" initiates the process of editing the section, and "copy" initiates the process of copying the section path. It's pretty self-explanatory, more so than "link". Anyway, you can always fork a script yourself if you don't like something about it. Nardog (talk) 14:15, 20 December 2023 (UTC)[reply]

Request #2[edit]

Could the script perhaps make the "copy" link's href be something like just "#" so it doesn't look like it's been visited? Aaron Liu (talk) 21:51, 12 January 2024 (UTC)[reply]

As the documentation says, it's deliberately linked to the section itself so you can also copy the full URL by right-clicking it and selecting the browser's native "Copy link". Nardog (talk) 21:57, 12 January 2024 (UTC)[reply]
Ah, that makes sense, I'll have to read better next time :p Should this thing have a style that removes the purple (or even better, only show purple when you've copied) then? Aaron Liu (talk) 22:03, 12 January 2024 (UTC)[reply]

Copy link not displaying on Firefox[edit]

Nardog, I have been using your tool for a while now, but recently it stopped displaying on desktop firefox, for no reason. It works fine on Chrome and desktop mode on mobile. I use the legacy vector skin. I reinstalled and still nothing. Do you know why it would stop working? Qwerty284651 (talk) 21:19, 30 May 2024 (UTC)[reply]

No idea, it's working for me on Firefox/Vector legacy. Do you see any console error? Nardog (talk) 22:49, 30 May 2024 (UTC)[reply]
I only see the copy link in the lead section, does not show up elsewhere. 2 errors popped up. Qwerty284651 (talk) 22:59, 30 May 2024 (UTC)[reply]
What version of Firefox are you using? Nardog (talk) 23:10, 30 May 2024 (UTC)[reply]
An old one. Qwerty284651 (talk) 23:19, 30 May 2024 (UTC)[reply]
Well, there's your reason. Nardog (talk) 23:27, 30 May 2024 (UTC)[reply]
It worked normally for several months. Not sure why it suddenly stopped working. Qwerty284651 (talk) 23:41, 30 May 2024 (UTC)[reply]
It's because I used something that has been supported by all major browsers for more than three years now when I updated the script in preparation for the mw:Heading HTML changes. Why can't you just update it? Nardog (talk) 23:46, 30 May 2024 (UTC)[reply]
Have an old pc. Qwerty284651 (talk) 23:55, 30 May 2024 (UTC)[reply]