Created
August 9, 2018 13:18
-
-
Save lucahammer/faef8f5cf91293e4961f917ae761f4b9 to your computer and use it in GitHub Desktop.
Copy first names of all visible users 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
javascript:(function()%7B%2F*https%3A%2F%2Fhackernoon.com%2Fcopying-text-to-clipboard-with-javascript-df4d4988697f*%2Fconst%20copyToClipboard%20%3D%20str%20%3D%3E%20%7Bconst%20el%20%3D%20document.createElement('textarea')%3Bel.value%20%3D%20str%3Bel.setAttribute('readonly'%2C%20'')%3Bel.style.position%20%3D%20'absolute'%3Bel.style.left%20%3D%20'-9999px'%3Bdocument.body.appendChild(el)%3Bel.select()%3Bdocument.execCommand('copy')%3Bdocument.body.removeChild(el)%3B%7D%3Bvar%20names%20%3D%20%5B%5D%3B%20for%20(var%20item%20of%20document.querySelectorAll(%22.UFICommentActorName%22))%7Bnames.push(item.innerText.split(%22%20%22)%5B0%5D)%7D%3BcopyToClipboard(names.join('%2C'))%7D)() | |
javascript:(function(){ | |
/*https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f*/ | |
const copyToClipboard = str => { | |
const el = document.createElement('textarea'); | |
el.value = str; | |
el.setAttribute('readonly', ''); | |
el.style.position = 'absolute'; | |
el.style.left = '-9999px'; | |
document.body.appendChild(el); | |
el.select(); | |
document.execCommand('copy'); | |
document.body.removeChild(el); | |
}; | |
var names = []; for (var item of document.querySelectorAll(".UFICommentActorName")){names.push(item.innerText.split(" ")[0])}; | |
copyToClipboard(names.join(',')); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment