Skip to content

Instantly share code, notes, and snippets.

@nicolae-olariu
Created March 9, 2016 13:25
Show Gist options
  • Save nicolae-olariu/8952d856b8c8c3a1fb66 to your computer and use it in GitHub Desktop.
Save nicolae-olariu/8952d856b8c8c3a1fb66 to your computer and use it in GitHub Desktop.
add read more at address clipboard
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