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
livebranch) 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.jsfile. - 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.clipboardItemitem and set it to true.
- Install dependencies with
yarn install. - Run unit tests with
yarn test. - Generate userscript with
yarn run build. - Import generated userscript to Tampermonkey by local file URI.
Using the Node.js container
To avoid having to install anything (except Podman!), just prefix any node or yarn command with ./podman_node. For example: ./podman_node yarn install
Allow Tampermonkey's access to local file URIs (Tampermonkey FAQs) and import built userscript's file URL.
- The
release.shscript has 2 actions:createBranchfor 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"createPatchfor 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
livebranch with a release:bash prepublish.sh v1.2.0 - Finally, we push the
livebranch:git push origin live