超简易解除网页限制

解除网页的复制 、拖动 、选中 、右键 、粘贴等限制。没有多余的代码,仅28行,尽量做到不占资源.

  1. // ==UserScript==
  2. // @name 超简易解除网页限制
  3. // @namespace http://xhunter.org
  4. // @version 1.0.4
  5. // @description 解除网页的复制 、拖动 、选中 、右键 、粘贴等限制。没有多余的代码,仅28行,尽量做到不占资源.
  6. // @author hunter
  7. // @include *
  8. // @exclude *baidu.com*
  9. // @run-at document-end
  10. // ==/UserScript==
  11. var eventArr = ['contextmenu', 'dragstart', 'mouseup', 'copy', 'beforecopy', 'selectstart', 'select', 'keydown'];
  12. function runScript(window) {
  13. var document = window["document"],
  14. $ = window["jQuery"],
  15. unbind = function(ele) {
  16. eventArr.forEach(function(evt) {
  17. ele['on' + evt] = null;
  18. if ($) {
  19. $(ele).unbind(evt);
  20. }
  21. try {
  22. if (/frame/i.test(ele.tagName)) {
  23. runScript(ele.contentWindow);
  24. }
  25. } catch (err) {}
  26. });
  27. };
  28. [window, document].forEach(unbind);
  29. for (var i = 0, all = document.all, len = all.length; i < len; i++) {
  30. var ele = all[i];
  31. if (ele && ele.nodeType === 1) {
  32. unbind(ele);
  33. }
  34. }
  35. }
  36. window.onload = function(){
  37. runScript(window);
  38. };
  39. window.onhashchange = function(){
  40. setTimeout(
  41. function(){
  42. runScript(window);
  43. },400);
  44. };

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址