Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name LanzouCloud Elements Remover
- // @namespace http://tampermonkey.net/
- // @version 0.2
- // @description Remove specific elements from LanzouCloud sites
- // @author Claude
- // @match *://*.lanzoua.com/*
- // @match *://*.lanzoub.com/*
- // @match *://*.lanzouc.com/*
- // @match *://*.lanzoud.com/*
- // @match *://*.lanzoue.com/*
- // @match *://*.lanzouf.com/*
- // @match *://*.lanzoug.com/*
- // @match *://*.lanzouh.com/*
- // @match *://*.lanzoui.com/*
- // @match *://*.lanzouj.com/*
- // @match *://*.lanzouk.com/*
- // @match *://*.lanzoul.com/*
- // @match *://*.lanzoum.com/*
- // @match *://*.lanzoun.com/*
- // @match *://*.lanzouo.com/*
- // @match *://*.lanzoup.com/*
- // @match *://*.lanzouq.com/*
- // @match *://*.lanzour.com/*
- // @match *://*.lanzous.com/*
- // @match *://*.lanzout.com/*
- // @match *://*.lanzouu.com/*
- // @match *://*.lanzouv.com/*
- // @match *://*.lanzouw.com/*
- // @match *://*.lanzoux.com/*
- // @match *://*.lanzouy.com/*
- // @match *://*.lanzouz.com/*
- // @match *://*.lanzn.com/*
- // @match *://*.lanpv.com/*
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (function() {
- 'use strict';
- // Elements to remove
- const selectors = [
- '.appdes',
- '.jingshi',
- '.mdo',
- '#mh_save1',
- '.pc',
- '#save',
- '.top',
- '.user-radio'
- ];
- // Function to remove elements
- function removeElements() {
- selectors.forEach(selector => {
- const elements = document.querySelectorAll(selector);
- elements.forEach(element => {
- if (element) {
- element.remove();
- console.log(`Removed: ${selector}`);
- }
- });
- });
- }
- // Add CSS to hide elements immediately
- function addHidingCSS() {
- const style = document.createElement('style');
- style.type = 'text/css';
- let cssRules = '';
- selectors.forEach(selector => {
- cssRules += `${selector} { display: none !important; }\n`;
- });
- style.textContent = cssRules;
- // Insert style as soon as possible
- const insertStyle = () => {
- if (document.head) {
- document.head.appendChild(style);
- } else {
- setTimeout(insertStyle, 0);
- }
- };
- insertStyle();
- }
- // Add CSS immediately
- addHidingCSS();
- // Initialize removal at different page load stages
- function initializeRemoval() {
- // Initial removal
- removeElements();
- // Set up the MutationObserver
- const observer = new MutationObserver(() => {
- removeElements();
- });
- // Start observing once body is available
- if (document.body) {
- observer.observe(document.body, { childList: true, subtree: true });
- } else {
- document.addEventListener('DOMContentLoaded', () => {
- observer.observe(document.body, { childList: true, subtree: true });
- });
- }
- // Periodic check for missed elements
- setInterval(removeElements, 1000);
- }
- // Run when DOM is interactive
- if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', initializeRemoval);
- } else {
- initializeRemoval();
- }
- // Also run when window is fully loaded
- window.addEventListener('load', removeElements);
- })();
Advertisement
Add Comment
Please, Sign In to add comment