Created
August 22, 2016 21:05
-
-
Save devinhalladay/19af0303f4452532fe3a9c345fed1db7 to your computer and use it in GitHub Desktop.
Copies the entire DOM to the clipboard, for use in the development of Spotio
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
window.addEventListener("keydown", checkKeyPressed, false); | |
function checkKeyPressed(e) { | |
if (e.keyCode == "17") { | |
var markup = document.documentElement.innerHTML; | |
input = document.createElement('input'); | |
input.style.position = 'fixed'; | |
input.style.opacity = 0; | |
input.value = markup; | |
document.body.appendChild(input); | |
input.select(); | |
document.execCommand('Copy'); | |
document.body.removeChild(input); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment