123网盘去广告

123网盘去广告,并将下载文件按钮移动到底部

目前为 2024-03-21 提交的版本。查看 最新版本

// ==UserScript==
// @name         123网盘去广告
// @namespace    https://www.123pan.com/
// @version      0.2
// @description  123网盘去广告,并将下载文件按钮移动到底部
// @author       You
// @match        https://www.123pan.com/s/*
// @grant        none
// @grant        GM_addStyle
// @run-at       document-start
// ==/UserScript==


document.addEventListener('copy', function(e) {
    // 阻止默认行为
    e.preventDefault();
    // 阻止事件传播
    e.stopPropagation();
});

// 定义目标元素选择器数组
var targetSelectors = ['.banner_all_wrap', '.appBottomBtnRight', 'img[src="https://statics.123pan.com/share-static/dist/static/logo_top.d37b304d.svg"]', '.pointer', '.qrcode_btn', 'share-time-wrap__operate', 'img[src="https://statics.123pan.com/share-static/dist/static/H5_logo_top.2b680600.svg"]'];

// 创建 MutationObserver 实例
var observer = new MutationObserver(function(mutationsList) {
    // 检查每个变动
    for (var mutation of mutationsList) {
        // 检查是否有新增节点
        if (mutation.type === 'childList') {
            // 对每个目标选择器进行操作
            targetSelectors.forEach(function(selector) {
                // 查找目标元素
                var targetElements = document.querySelectorAll(selector);
                // 移除所有匹配到的元素
                targetElements.forEach(function(targetElement) {
                    targetElement.remove();
                });
            });
        }
    }
});

// 监听根节点和子节点的变化
observer.observe(document.documentElement, {
    childList: true,
    subtree: true
});


GM_addStyle(`
.appBottomBtn {
    position: fixed !important;
    bottom: 0 !important; 
}

.appBottomBtnLeft {
    width: 98% !important;
}

#xxl {
    position: fixed !important;
    top: 1% !important;
    right: 1% !important;
    width: 98% !important;
}

`);

setTimeout(function() {
    var pageTitle = document.title;
    var index = pageTitle.indexOf("官方版下载丨");
    if (index !== -1) {
        var newTitle = pageTitle.substring(0, index);
        document.title = newTitle;
    }
}, 1000);

QingJ © 2025

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