NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @namespace https://openuserjs.org/users/lieszkol // @name ClickUp - Copy Issue Link & Description // @description Add a button to your ClickUp Tasks pages to easily copy the task URL & Title to the browser clipboard // @copyright 2020, lieszkol (https://openuserjs.org/users/lieszkol) // @license MIT // @version 1.0.0 // @match https://app.clickup.com/* // @grant GM_setClipboard // ==/UserScript== // ==OpenUserJR== // @author lieszkol // ==/OpenUserJR== (function () { 'use strict'; // Could get the task name this way as well: $('.task-name').value; // For this to work also do: // @require http://code.jquery.com/jquery-3.4.1.min.js window.addEventListener("load", () => { let cssObj = { position: "absolute", top: 0, width: "160px", left: "calc(50% - 80px)", "z-index": 9999, fontWeight: "600", fontSize: "12px", backgroundColor: "rgb(0, 170, 210)", color: "white", border: "none", padding: "5px 0", "border-radius": "0 0 5px 5px", display: "none" }; let button = document.createElement("button"), btnStyle = button.style; document.body.appendChild(button); button.innerHTML = "Copy Link & Title"; button.onclick = () => { GM_setClipboard(window.location.href + ' - ' + document.title); btnStyle.backgroundColor = "rgb(0, 170, 210, 0.5)"; } Object.keys(cssObj).forEach(key => (btnStyle[key] = cssObj[key])); window.addEventListener('locationchange', function () { btnStyle.backgroundColor = "rgb(0, 170, 210)"; if (window.location.href.startsWith("https://app.clickup.com/t/")) { btnStyle.display = "block"; } else { btnStyle.display = "none"; } }) }); /* https://stackoverflow.com/questions/6390341/how-to-detect-url-change-in-javascript */ history.pushState = (f => function pushState() { var ret = f.apply(this, arguments); window.dispatchEvent(new Event('pushstate')); window.dispatchEvent(new Event('locationchange')); return ret; })(history.pushState); history.replaceState = (f => function replaceState() { var ret = f.apply(this, arguments); window.dispatchEvent(new Event('replacestate')); window.dispatchEvent(new Event('locationchange')); return ret; })(history.replaceState); window.addEventListener('popstate', () => { window.dispatchEvent(new Event('locationchange')) }); })();