Remove Experimental / Deprecated Useless APIs

to remove useless APIs (either experimental or deprecated) like IdleDetector

  1. // ==UserScript==
  2. // @name Remove Experimental / Deprecated Useless APIs
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.2
  5. // @description to remove useless APIs (either experimental or deprecated) like IdleDetector
  6. // @author CY Fung
  7. // @match https://*/*
  8. // @match http://*/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=gf.qytechs.cn
  10. // @grant none
  11. // @run-at document-start
  12. // @license MIT
  13. // @compatible chrome
  14. // @compatible edge
  15. // @compatible firefox
  16. // @compatible safari
  17. // @compatible opera
  18. // @unwrap
  19. // @allFrames
  20. // @inject-into page
  21. // ==/UserScript==
  22.  
  23. (function () {
  24. 'use strict';
  25.  
  26. if (typeof IdleDetector === 'function') {
  27. try {
  28. IdleDetector = undefined;
  29. } catch (e) { }
  30. delete window.IdleDetector;
  31. }
  32.  
  33. if (typeof webkitCancelAnimationFrame === 'function') {
  34. try {
  35. webkitCancelAnimationFrame = undefined;
  36. } catch (e) { }
  37. delete window.webkitCancelAnimationFrame;
  38. }
  39.  
  40. if (typeof webkitRequestAnimationFrame === 'function') {
  41. try {
  42. webkitRequestAnimationFrame = undefined;
  43. } catch (e) { }
  44. delete window.webkitRequestAnimationFrame;
  45. }
  46.  
  47. if (typeof styleMedia === 'function') {
  48. // This feature is deprecated/obsolete and should not be used.
  49. try {
  50. styleMedia = undefined;
  51. } catch (e) { }
  52. delete window.styleMedia;
  53. }
  54.  
  55. if (typeof launchQueue === 'object') {
  56. // This feature is experimental. Use caution before using in production.
  57. try {
  58. launchQueue = undefined;
  59. } catch (e) { }
  60. delete window.launchQueue;
  61. }
  62.  
  63. if (typeof webkitRequestFileSystem === 'function') {
  64. // This feature is deprecated/obsolete and should not be used.
  65. try {
  66. webkitRequestFileSystem = undefined;
  67. } catch (e) { }
  68. delete window.webkitRequestFileSystem;
  69. }
  70.  
  71. if (typeof webkitResolveLocalFileSystemURL === 'function') {
  72. // This feature is non-standard and should not be used without careful consideration.
  73. try {
  74. webkitResolveLocalFileSystemURL = undefined;
  75. } catch (e) { }
  76. delete window.webkitResolveLocalFileSystemURL;
  77. }
  78.  
  79. if (typeof VRDisplayEvent === 'function') {
  80. // This feature is deprecated/obsolete and should not be used.
  81. try {
  82. VRDisplayEvent = undefined;
  83. } catch (e) { }
  84. delete window.VRDisplayEvent;
  85. }
  86.  
  87. if (typeof HTMLFrameSetElement === 'function') {
  88. // This feature is deprecated/obsolete and should not be used.
  89. try {
  90. HTMLFrameSetElement = undefined;
  91. } catch (e) { }
  92. delete window.HTMLFrameSetElement;
  93. }
  94.  
  95. if (typeof CanMakePaymentEvent === 'function') {
  96. // This feature is experimental. Use caution before using in production.
  97. try {
  98. CanMakePaymentEvent = undefined;
  99. } catch (e) { }
  100. delete window.CanMakePaymentEvent;
  101. }
  102.  
  103.  
  104. if (typeof PositionSensorVRDevice === 'function') {
  105. // This feature is deprecated/obsolete and should not be used.
  106. try {
  107. PositionSensorVRDevice = undefined;
  108. } catch (e) { }
  109. delete window.PositionSensorVRDevice;
  110. }
  111.  
  112. if (typeof PerformanceTiming === 'function') {
  113. // This feature is deprecated/obsolete and should not be used.
  114. try {
  115. PerformanceTiming = undefined;
  116. } catch (e) { }
  117. delete window.PerformanceTiming;
  118. }
  119.  
  120. if (typeof navigation === 'function') {
  121. // This feature is experimental. Use caution before using in production.
  122. try {
  123. navigation = undefined;
  124. } catch (e) { }
  125. delete window.navigation;
  126. }
  127.  
  128.  
  129.  
  130.  
  131. /*
  132.  
  133. let arr = ["navigation", "onsearch", "trustedTypes",
  134. "onappinstalled", "onbeforeinstallprompt", "onbeforexrselect", "oncancel", "oncontextlost",
  135. "oncontextrestored", "onmousewheel", "onpointerrawupdate",
  136. "scheduler", "chrome", "credentialless", "launchQueue",
  137. "onbeforematch", "onbeforetoggle", "originAgentCluster",
  138. "oncontentvisibilityautostatechange", "openDatabase", "webkitRequestFileSystem", "webkitResolveLocalFileSystemURL"];
  139.  
  140. */
  141.  
  142. // Your code here...
  143. })();

QingJ © 2025

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