Unlimit-Web

解除网页限制: 恢复文字的选中和复制, 去除复制时的小尾巴, 恢复页面右键菜单. Remove webpage restrictions: restore the selection and copy of text, remove the text tail, and restore the right-click menu.

当前为 2022-05-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Unlimit-Web
  3. // @namespace https://github.com/xcanwin/
  4. // @version 1.0
  5. // @description 解除网页限制: 恢复文字的选中和复制, 去除复制时的小尾巴, 恢复页面右键菜单. Remove webpage restrictions: restore the selection and copy of text, remove the text tail, and restore the right-click menu.
  6. // @author xcanwin
  7. // @license MIT
  8. // @supportURL https://github.com/xcanwin/Unlimit-Web/
  9. // @match *://www.bilibili.com/read/*
  10. // @match *://www.360doc.com/*
  11. // @match *://www.cnblogs.com/*
  12. // @match *://read.qidian.com/*
  13. // @match *://shushan.zhangyue.net/*
  14. //
  15. // @match *://*/*
  16. // @run-at document-end
  17. //
  18. // @grant none
  19. // ==/UserScript==
  20.  
  21. (function() {
  22. 'use strict';
  23. //Test in: https://dafrok.github.io/vue-iscroll-view/
  24. //Test in: https://www.cnblogs.com/LyShark/p/12411435.html
  25. //Test in: https://www.bilibili.com/read/cv5496952
  26. //Test in: http://www.360doc.com/content/20/0406/19/1575720_904264035.shtml
  27. //Test in: https://www.cnblogs.com/k8gege/p/11223393.html
  28. //Test in: http://shushan.zhangyue.net/book/89159/13507319/
  29.  
  30. var main = function(){
  31. Array.prototype.forEach.call(document.getElementsByTagName("*"), function(el) {
  32. console.log(el.childNodes.length);
  33.  
  34. [
  35. "user-select", "-webkit-user-select", "-moz-user-select", "-ms-user-select", "-khtml-user-select"
  36. ].forEach(xcanwin => {
  37. var filterstyle = document.defaultView.getComputedStyle(el, null)[xcanwin];
  38. if (filterstyle && filterstyle == 'none') {
  39. el.style = xcanwin + ": text";
  40. }
  41. });
  42.  
  43. [
  44. "pointer-events"
  45. ].forEach(xcanwin => {
  46. var filterstyle = document.defaultView.getComputedStyle(el, null)[xcanwin];
  47. if (filterstyle && filterstyle != 'auto') {
  48. el.style = xcanwin + ": auto !important";
  49. }
  50. });
  51.  
  52. [
  53. "onselect", "onselectstart", "onselectionchange",
  54. "oncontextmenu",
  55. "oncopy", "onbeforecopy",
  56. "onkeypress", "onkeyup", "onkeydown",
  57. "onpaste", "onbeforepaste", "oncut", "onbeforecut",
  58. "onmousedown", "onmouseenter", "onmouseleave", "onmousemove", "onmouseout", "onmouseover", "onmouseup",
  59. "onpointercancel", "onpointerdown", "onpointerenter", "onpointerleave", "onpointerlockchange", "onpointerlockerror", "onpointermove", "onpointerout", "onpointerover", "onpointerrawupdate", "onpointerup"
  60. ].forEach(xcanwin => {
  61. el[xcanwin] = function(e) {
  62. e.stopImmediatePropagation();
  63. }
  64. });
  65. });
  66. };
  67.  
  68. main();
  69. })();