Created
March 9, 2016 13:25
-
-
Save nicolae-olariu/8952d856b8c8c3a1fb66 to your computer and use it in GitHub Desktop.
add read more at address 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
function addLink(event) { | |
event.preventDefault(); | |
var pagelink = '\n\n Read more at: ' + document.location.href, | |
copytext = window.getSelection() + pagelink; | |
if (window.clipboardData) { | |
window.clipboardData.setData('Text', copytext); | |
} | |
} | |
document.addEventListener('copy', addLink); | |
// http://stackoverflow.com/questions/2026335/how-to-add-extra-info-to-copied-web-text | |
// http://stackoverflow.com/users/577541/cronoss |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment