Created
February 11, 2021 09:08
-
-
Save mreq/6fda6c196f184077297583706ef094be to your computer and use it in GitHub Desktop.
Copies number and issue title to clipboard on click
This file contains 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 github issue title | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://github.com/* | |
// @grant GM_setClipboard | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.addEventListener('click', (e) => { | |
let title | |
if (e.target.classList.contains('gh-header-title') && e.target.firstElementChild.classList.contains('js-issue-title')) { | |
title = e.target.firstElementChild | |
} else if (e.target.classList.contains('js-issue-title')) { | |
title = e.target | |
} else { | |
return | |
} | |
title.parentElement.style.backgroundColor = '#c2e5f9' | |
setTimeout(() => { title.parentElement.style.backgroundColor = '' }, 300) | |
let number = (title.nextElementSibling && title.nextElementSibling.classList.contains('f1-light')) ? `${title.nextElementSibling.innerText}: ` : '' | |
GM_setClipboard(`${number}${title.innerText}`) | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment