Jump to content

User:andrybak/Scripts/copy-section-link

From Wikipedia, the free encyclopedia
copy-section-link
DescriptionSimplifies creating links to sections
Author(s)Enterprisey, The Earwig, andrybak
First released2024-07-01
UpdatedDecember 5, 2024
    (0 days ago)
SkinsVector 2022, Vector (2010), MonoBook, Timeless, Modern, Minerva Neue (mobile) (partial)
SourceUser:Andrybak/Scripts/copy-section-link.js

copy-section-link is a user script that adds a pilcrow (¶ symbol) to section headings that, when clicked, shows a popup with an appropriate wikilink and external link.

How to install

[edit]

On English Wikipedia it is recommended to install this script using the script-installer gadget, which can be turned on at:

Preferences → Gadgets → Advanced → Tick Install scripts without having to manually edit JavaScript files (documentation) (direct link)

Then you can go back to this page and click the big blue "Install" button in the infobox.

To install the script on another wiki (including your global.js), use the following snippet:

mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Andrybak/Scripts/copy-section-link.js&action=raw&ctype=text/javascript');

Configuration

[edit]

Add the following code to your common.js to get rid of the square brackets:

window.copySectionLinkNoSquareBrackets = true;

History

[edit]

This script is a fork of User:Enterprisey/copy-section-link, which was inspired by User:Bility/copySectionLink. Forking was necessary due to changes in HTML layout, which broke Enterprisey's version. This fork also includes fixes by User:The Earwig, and a fix for braces and brackets in section headings.