var currentpath = self.location.href; try { currentpath = decodeURIComponent(currentpath); } catch(e) { }; var addlinkMsg = 'Read more at'; function addLink() { var body_element = document.body; var selection; if (window.clipboardData) { // Internet Explorer // selection = window.clipboardData.getData("Text"); selection = document.selection.createRange().text; var selectiontxt = selection.toString(); var pagelink = "\r\n"+addlinkMsg+": "+currentpath; // var copytext = selection + pagelink; var copytext = selectiontxt.substring(0,250)+pagelink; window.clipboardData.setData ("Text", copytext); return false; } else { selection = window.getSelection(); var selectiontxt = selection.toString(); var pagelink = "
"+addlinkMsg+": "+currentpath; // var copytext = selection + pagelink; var copytext = selectiontxt.substring(0,250)+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.body.oncopy=addLink;