A Tampermonkey userscript to copy nice-looking URLs to the clipboard.
- First, you need to install the Tampermonkey extension for your browser, which can be found at: https://www.tampermonkey.net/
- If you are using Firefox, follow the one-time configuration in the sub-section below.
- You have to decide whether you want to always track the latest version (known as the
live
branch) or one of the release branches (which start withrelease/
). Go to https://github.com/olivierdagenais/tampermonkey-copy-url/branches/all and make your choice. - Navigate to the
userscript/index.user.js
file. - Activate the Raw link. Tampermonkley should detect that a UserScript is there and prompt you to install it.
- Tampermonkey will check for updates and prompt you to upgrade when a new version is released.
Since version 87, Firefox's Clipboard API is disabled by default and will result in an error like:
Uncaught ReferenceError: ClipboardItem is not defined
Clipboard support can be enabled by following these steps:
- Open a new tab and navigate to about:config
- Find the
dom.events.asyncClipboard.clipboardItem
item and set it to true.
- Install dependencies with
npm install
ornpm ci
. - Run unit tests with
npm test
. - Generate userscript with
npm run build
. - Import generated userscript to Tampermonkey by local file URI.
Using the Node.js container
To avoid having to install anything (except the Docker Engine CLI!), just prefix any node
or npm
command with ./docker_node
. For example: ./docker_node npm install
Allow Tampermonkey's access to local file URIs (Tampermonkey FAQs) and import built userscript's file URL.
- The
release.sh
script has 2 actions:createBranch
for when we're ready to prepare a release for a new minor or major version, by branching off of the contents ofmain
:bash release.sh createBranch "1.2"
createPatch
for when we want to prepare a release for a new patch version (after adding fixes to the release branch); we just need to provide tha MAJOR.MINOR portions and the PATCH portion will be automatically incremented:bash release.sh createPatch "1.2"
- Next we push the branch and its release tag:
git push origin release/1.2 --tags
- Optionally, we can update the
live
branch with a release:bash prepublish.sh v1.2.0
- Finally, we push the
live
branch:git push origin live