Sakyvo

LanzouCloud Elements Remover

Jul 26th, 2025
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. // ==UserScript==
  2.  
  3. // @name LanzouCloud Elements Remover
  4.  
  5. // @namespace http://tampermonkey.net/
  6.  
  7. // @version 0.2
  8.  
  9. // @description Remove specific elements from LanzouCloud sites
  10.  
  11. // @author Claude
  12.  
  13. // @match *://*.lanzoua.com/*
  14. // @match *://*.lanzoub.com/*
  15. // @match *://*.lanzouc.com/*
  16. // @match *://*.lanzoud.com/*
  17. // @match *://*.lanzoue.com/*
  18. // @match *://*.lanzouf.com/*
  19. // @match *://*.lanzoug.com/*
  20. // @match *://*.lanzouh.com/*
  21. // @match *://*.lanzoui.com/*
  22. // @match *://*.lanzouj.com/*
  23. // @match *://*.lanzouk.com/*
  24. // @match *://*.lanzoul.com/*
  25. // @match *://*.lanzoum.com/*
  26. // @match *://*.lanzoun.com/*
  27. // @match *://*.lanzouo.com/*
  28. // @match *://*.lanzoup.com/*
  29. // @match *://*.lanzouq.com/*
  30. // @match *://*.lanzour.com/*
  31. // @match *://*.lanzous.com/*
  32. // @match *://*.lanzout.com/*
  33. // @match *://*.lanzouu.com/*
  34. // @match *://*.lanzouv.com/*
  35. // @match *://*.lanzouw.com/*
  36. // @match *://*.lanzoux.com/*
  37. // @match *://*.lanzouy.com/*
  38. // @match *://*.lanzouz.com/*
  39. // @match *://*.lanzn.com/*
  40. // @match *://*.lanpv.com/*
  41.  
  42. // @grant none
  43.  
  44. // @run-at document-start
  45.  
  46. // ==/UserScript==
  47.  
  48.  
  49.  
  50. (function() {
  51.  
  52. 'use strict';
  53.  
  54. // Elements to remove
  55.  
  56. const selectors = [
  57.  
  58. '.appdes',
  59. '.jingshi',
  60. '.mdo',
  61. '#mh_save1',
  62. '.pc',
  63. '#save',
  64. '.top',
  65. '.user-radio'
  66.  
  67. ];
  68.  
  69. // Function to remove elements
  70.  
  71. function removeElements() {
  72.  
  73. selectors.forEach(selector => {
  74.  
  75. const elements = document.querySelectorAll(selector);
  76.  
  77. elements.forEach(element => {
  78.  
  79. if (element) {
  80.  
  81. element.remove();
  82.  
  83. console.log(`Removed: ${selector}`);
  84.  
  85. }
  86.  
  87. });
  88.  
  89. });
  90.  
  91. }
  92.  
  93. // Add CSS to hide elements immediately
  94.  
  95. function addHidingCSS() {
  96.  
  97. const style = document.createElement('style');
  98.  
  99. style.type = 'text/css';
  100.  
  101. let cssRules = '';
  102.  
  103. selectors.forEach(selector => {
  104.  
  105. cssRules += `${selector} { display: none !important; }\n`;
  106.  
  107. });
  108.  
  109. style.textContent = cssRules;
  110.  
  111. // Insert style as soon as possible
  112.  
  113. const insertStyle = () => {
  114.  
  115. if (document.head) {
  116.  
  117. document.head.appendChild(style);
  118.  
  119. } else {
  120.  
  121. setTimeout(insertStyle, 0);
  122.  
  123. }
  124.  
  125. };
  126.  
  127. insertStyle();
  128.  
  129. }
  130.  
  131. // Add CSS immediately
  132.  
  133. addHidingCSS();
  134.  
  135. // Initialize removal at different page load stages
  136.  
  137. function initializeRemoval() {
  138.  
  139. // Initial removal
  140.  
  141. removeElements();
  142.  
  143. // Set up the MutationObserver
  144.  
  145. const observer = new MutationObserver(() => {
  146.  
  147. removeElements();
  148.  
  149. });
  150.  
  151. // Start observing once body is available
  152.  
  153. if (document.body) {
  154.  
  155. observer.observe(document.body, { childList: true, subtree: true });
  156.  
  157. } else {
  158.  
  159. document.addEventListener('DOMContentLoaded', () => {
  160.  
  161. observer.observe(document.body, { childList: true, subtree: true });
  162.  
  163. });
  164.  
  165. }
  166.  
  167. // Periodic check for missed elements
  168.  
  169. setInterval(removeElements, 1000);
  170.  
  171. }
  172.  
  173. // Run when DOM is interactive
  174.  
  175. if (document.readyState === 'loading') {
  176.  
  177. document.addEventListener('DOMContentLoaded', initializeRemoval);
  178.  
  179. } else {
  180.  
  181. initializeRemoval();
  182.  
  183. }
  184.  
  185. // Also run when window is fully loaded
  186.  
  187. window.addEventListener('load', removeElements);
  188.  
  189. })();
Advertisement
Add Comment
Please, Sign In to add comment