Last active
June 4, 2018 06:38
-
-
Save bitzip/1173743d2884dce0b8b1dd4b60125f23 to your computer and use it in GitHub Desktop.
Fontawesome click icon to copy icon name to clipboard
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 fontawesome copy icon name | |
// @namespace https://gist.github.com/kelly-apollo/1173743d2884dce0b8b1dd4b60125f23 | |
// @version 0.2 | |
// @description try to take over the world! | |
// @author Kelly Apollo | |
// @match http://fontawesome.io/icons/ | |
// @grant GM_setClipboard | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.querySelector('#icons').addEventListener('click', e => { | |
var target = e.target; | |
var match = target.href && target.href.match(/icon\/(.*)/); | |
if (match) { | |
target.style.color = '#000'; | |
setTimeout(()=>target.style.color = '', 200); | |
GM_setClipboard(match[1]); | |
e.stopPropagation(); | |
e.preventDefault(); | |
} | |
}, true); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this still work for you? The page seems to 'reload' which seems to cause Greasemonkey scripts to not work correctly.
I'm trying to write a similar script to change the quotation marks on the 'embed code' to single quotes instead of double.