1
2
3/* block copy right*/
4function addLink() {
5 var body_element = document.getElementsByTagName('body')[0];
6 var selection;
7 selection = window.getSelection();
8 var getSelection = selection + '';
9 var pagelink = "<br /><br /> اقرأ المزيد على موقع ميدطب: <a href='" + document.location.href + "'>" + document.location.href + "</a><br />"; // change this if you want
10 var copytext = getSelection.substring(0, 70).concat('....') + pagelink;
11 var newdiv = document.createElement('div');
12 newdiv.style.position = 'absolute';
13 newdiv.style.left = '-99999px';
14 body_element.appendChild(newdiv);
15 newdiv.innerHTML = copytext;
16 selection.selectAllChildren(newdiv);
17 window.setTimeout(function () {
18 body_element.removeChild(newdiv);
19 }, 0);
20}
21
22document.oncopy = addLink;