Skip to content

Instantly share code, notes, and snippets.

@AbhishekGhosh
Created December 23, 2014 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhishekGhosh/bda8e68c0ca507821da8 to your computer and use it in GitHub Desktop.
Save AbhishekGhosh/bda8e68c0ca507821da8 to your computer and use it in GitHub Desktop.
copy-paste-notice.js
<script type="text/javascript">/*<![CDATA[*/function addLink(){var body_element=document.getElementsByTagName('body')[0];var selection;selection=window.getSelection();var pagelink="<br /><br /> Read more at: <a href='"+document.location.href+"'>"+document.location.href+"</a><br />Copyright © Richard M. Stallman";var copytext=selection+pagelink;var newdiv=document.createElement('div');newdiv.style.position='absolute';newdiv.style.left='-99999px';body_element.appendChild(newdiv);newdiv.innerHTML=copytext;selection.selectAllChildren(newdiv);window.setTimeout(function(){body_element.removeChild(newdiv);},0);}
document.oncopy=addLink;/*]]>*/</script>
@AbhishekGhosh
Copy link
Author

Change that Copyright © Richard M. Stallman to your name. Be careful about " and variant of curly quotation. You need to paste this within <head></head> to get backlink from copied text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment