Advertisement
falkirks

JavaScript Copy/Paste annoyer

Apr 18th, 2013
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2. function addLink() {
  3.     var body_element = document.getElementsByTagName('body')[0];
  4.     var selection;
  5.     selection = window.getSelection();
  6.     var pagelink = "So we hear you link PLAIGRISM. Well it's wrong people work hard. Find your stolen content below.<br /><br />------BEGIN COPIED WORK--------- <br />"; // change this if you want
  7.     var copytext = pagelink + selection;
  8.     var newdiv = document.createElement('div');
  9.     newdiv.style.position='absolute';
  10.     newdiv.style.left='-99999px';
  11.     body_element.appendChild(newdiv);
  12.     newdiv.innerHTML = copytext;
  13.     selection.selectAllChildren(newdiv);
  14.     window.setTimeout(function() {
  15.         body_element.removeChild(newdiv);
  16.     },0);
  17. }
  18. document.oncopy = addLink;
  19. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement