Created
September 4, 2018 14:44
-
-
Save jamesgecko/d9d5da84323877d6b52f430eb1e522a0 to your computer and use it in GitHub Desktop.
For use in Violentmonkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Copy link to TP issue | |
// @namespace Violentmonkey Scripts | |
// @match https://callrail.tpondemand.com/* | |
// @grant GM_setClipboard | |
// @grant GM_registerMenuCommand | |
// @include https://callrail.tpondemand.com/* | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js | |
// ==/UserScript== | |
function getTpTitle() { | |
return 'TP' + $('.entity-id').text() + ': ' + $('.view-header__name').text() | |
} | |
function getTpUrl() { | |
return 'https://callrail.tpondemand.com/entity/' + $('.entity-id').text().replace('#', '') | |
} | |
function copyTpLink() { | |
GM_setClipboard(`${getTpTitle()} - ${getTpUrl()}`); | |
} | |
function copyTpMarkdown() { | |
GM_setClipboard(`[${getTpTitle()}](${getTpUrl()})`); | |
} | |
GM_registerMenuCommand("Copy for plaintext", copyTpLink); | |
GM_registerMenuCommand("Copy markdown link", copyTpMarkdown); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment