From 458496a9ed5fe79f50397f3641f514f3bbe52080 Mon Sep 17 00:00:00 2001 From: Xtao_dada <1344089750@qq.com> Date: Tue, 13 Aug 2019 23:11:29 +0800 Subject: [PATCH] Add files via upload --- copyr.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 copyr.js diff --git a/copyr.js b/copyr.js new file mode 100644 index 0000000..7ba868a --- /dev/null +++ b/copyr.js @@ -0,0 +1,17 @@ +function addLink() { + var body_element = document.getElementsByTagName('body')[0]; + var selection; + selection = window.getSelection(); + var pagelink = "

著作权归作者所有。
商业转载请联系作者获得授权,非商业转载请注明出处。
作者:深海小涛
来源:"+document.location.href+""; + var copy_text = selection + pagelink; + var new_div = document.createElement('div'); + new_div.style.left='-99999px'; + new_div.style.position='absolute'; + body_element.appendChild(new_div ); + new_div.innerHTML = copy_text ; + selection.selectAllChildren(new_div ); + window.setTimeout(function() { + body_element.removeChild(new_div ); + },0); +} +document.oncopy = addLink; \ No newline at end of file