emlog简单js实现复制弹窗加文字版权
  • 内容
  • 相关
<script type="text/javascript">$("body").bind('copy', function (e){if(typeof window.getSelection == "undefined") return;var body_element = document.getElementsByTagName('body')[0];var selection = window.getSelection();if (("" + selection).length < 30) return;var newdiv = document.createElement('div');newdiv.style.position = 'absolute';newdiv.style.left = '-99999px';body_element.appendChild(newdiv);newdiv.appendChild(selection.getRangeAt(0).cloneContents());if(selection.getRangeAt(0).commonAncestorContainer.nodeName == "PRE"){newdiv.innerHTML = "<pre>" + newdiv.innerHTML + "</pre>";}
newdiv.innerHTML += "来自吾爱搜-原文地址:" + document.location.href + "";
selection.selectAllChildren(newdiv);window.setTimeout(function(){body_element.removeChild(newdiv);},200);});function warning(){ 
if(navigator.userAgent.indexOf("MSIE")>0) { 
art.dialog.alert('我复制成功!若要转载请务必保留原文链接,申明来源,谢谢合作!'); } 
	else { alert("复制成功!若要转载请务必保留原文链接,申明来源,谢谢合作!"); }}
document.body.oncopy=function(){warning();}

</script>

请将上面代码插入你网站的footer或者head文件里面。即可实现复制弹窗提醒加文字版权。。


emlog简单js实现复制弹窗加文字版权-下载页面
评论后还是无法显示下载地址?清理缓存-点我试试
热度:5778° 评分:9.6 发布时间: 2018年5月2日

本文标签:这篇文章木有标签

版权声明:若无特殊注明,本文皆为《小洋vier》原创,转载请保留文章出处。

本文链接:emlog简单js实现复制弹窗加文字版权

发表评论

电子邮件地址不会被公开。 必填项已用*标注