EMLOG复制后字段自动加入版权信息并提示

把这段代码加在footr.php即可

<script type="text/javascript">  document.body.oncopy=function(){warning();}  function addCopyright() {      var Original = "本文来源:" + location.href; //修改你的网站名称      if ("function" == typeof window.getSelection) {          var c = window.getSelection();          if ("Microsoft Internet Explorer" == navigator.appName && navigator.appVersion.match(/MSIE ([d.]+)/)[1] >= 10 || "Opera" == navigator.appName) {              var g = c.getRangeAt(0),              h = document.createElement("span");              h.appendChild(g.cloneContents()),              g.insertNode(h);              var i = h.innerHTML.replace(/(?:n|rn|r)/gi, "").replace(/<s*script[^>]*>[sS]*?</script>/gim, "").replace(/<s*style[^>]*>[sS]*?</style>/gim, "").replace(/<!--.*?-->/gim, "").replace(/<!DOCTYPE.*?>/gi, "");              try {                  document.getElementsByTagName("body")[0].removeChild(h)              } catch(f) {                  h.style.display = "none",                  h.innerHTML = ""              }          } else var d = "" + c;          var e = document.getElementsByTagName("body")[0],          f = document.createElement("div");          f.style.position = "absolute",          f.style.left = "-99999px",          e.appendChild(f),          f.innerHTML = d.replace(/([^>rn]?)(rn|nr|r|n)/g, "$1<br />$2") + "<br />" + Original,          c.selectAllChildren(f),          setTimeout(function() {              e.removeChild(f)          },          0)      } else if ("object" == typeof document.selection.createRange) {          event.returnValue = !1;          var c = document.selection.createRange().text;          window.clipboardData.setData("Text", c + "n" + Original)      }  alert("陌路人温馨提示:复制成功!若要转载请务必保留原文链接,申明来源,谢谢合作!");  };  document.body.oncopy = addCopyright;     </script>

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享
评论 抢沙发