篡改猴脚本

篡改猴下载教程

Edge 浏览器

1.点击该 下载链接 后,得到一个名为 安装包 的压缩包。
2.将名为 4.13.6138_0 的文件夹解压到桌面。
3.输入该网址 edge://extensions/
4.将 开发人员模式允许来自其他应用商店的扩展 打开。
5.点击加载解压缩的扩展,选择文件夹 4.13.6138_0。
篡改猴就下载好了

示例脚本

No.1
屏蔽vjudge赛内讨论:

// ==UserScript==
// @name         VJudge 隐藏赛内讨论
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  隐藏VJudge比赛页面中的讨论区,减少干扰
// @author       YourName
// @match        https://vjudge.net/contest/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // 主函数:隐藏讨论区元素
    function hideDiscussion() {
        // 1. 隐藏讨论区标签页
        const discussionTab = document.querySelector('a[href*="#discuss"]');
        if (discussionTab) {
            discussionTab.style.display = 'none';
        }

        // 2. 隐藏讨论内容区域
        const discussionPanel = document.getElementById('discuss');
        if (discussionPanel) {
            discussionPanel.style.display = 'none';
        }

        // 3. 隐藏任何可能包含讨论内容的其他元素
        const discussionElements = document.querySelectorAll('.discussion, .chat, .comment, .forum');
        discussionElements.forEach(el => {
            el.style.display = 'none';
        });

        // 4. 移除讨论区的iframe(如果有)
        const discussionIframes = document.querySelectorAll('iframe[src*="discuss"], iframe[src*="chat"]');
        discussionIframes.forEach(iframe => {
            iframe.remove();
        });

        console.log('VJudge 讨论区已隐藏');
    }

    // 初始执行
    hideDiscussion();

    // 监听页面变化(针对SPA动态加载内容)
    const observer = new MutationObserver(hideDiscussion);
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

    // 添加一个按钮以便临时显示讨论区(可选)
    function addToggleButton() {
        const btn = document.createElement('button');
        btn.textContent = '显示/隐藏讨论区';
        btn.style.position = 'fixed';
        btn.style.bottom = '20px';
        btn.style.right = '20px';
        btn.style.zIndex = '9999';
        btn.style.padding = '5px 10px';
        btn.style.backgroundColor = '#f0f0f0';
        btn.style.border = '1px solid #ccc';
        btn.style.borderRadius = '3px';
        btn.style.cursor = 'pointer';

        btn.addEventListener('click', function() {
            const discussionPanel = document.getElementById('discuss');
            if (discussionPanel) {
                discussionPanel.style.display = discussionPanel.style.display === 'none' ? 'block' : 'none';
            }
        });

        document.body.appendChild(btn);
    }

    // 延迟添加切换按钮以避免干扰页面加载
    setTimeout(addToggleButton, 3000);
})();

No.2 屏蔽摸鱼网站

// ==UserScript==
// @name         摸鱼网站屏蔽器
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  屏蔽一系列摸鱼网站,提高工作效率
// @author       willAK
// @match        *://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // 摸鱼网站列表,可以自行添加
    const blockedSites = [
        "weibo.com",
        "bilibili.com",
        "douyin.com",
        "tiktok.com",
        "zhihu.com",
        "qq.com",
        "taobao.com",
        "jd.com",
        "youku.com",
        "iqiyi.com",
        "netflix.com",
        "youtube.com",
        "facebook.com",
        "twitter.com",
        "instagram.com",
        "reddit.com",
        "9gag.com",
        "pinterest.com",
        "tumblr.com",
        "twitch.tv"
    ];

    // 重定向的目标网站,默认为Google
    const redirectUrl = "https://vjudge.net";

    // 检查当前URL是否在屏蔽列表中
    const currentHost = window.location.hostname;
    const isBlocked = blockedSites.some(site => currentHost.includes(site));

    if (isBlocked) {
        window.location.href = redirectUrl;
    }
})();

No.3 比赛防作弊

// ==UserScript==
// @name         比赛防作弊
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  屏蔽一系列比赛作弊网站
// @author       willAK
// @match        *://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    const blockedSites = [
        "yuantiji.ac",
        "zhihu.com",
        "cnblogs.com",
        "csdn.net",
        "luogu.com.cn"
    ];

    // 重定向的目标网站,默认为Google
    const redirectUrl = "https://vjudge.net";

    // 检查当前URL是否在屏蔽列表中
    const currentHost = window.location.hostname;
    const isBlocked = blockedSites.some(site => currentHost.includes(site));

    if (isBlocked) {
        window.location.href = redirectUrl;
    }
})();

No.4 集训倒计时

// ==UserScript==
// @name         集训倒计时
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  集训倒计时 
// @author       willAK 
// @match        https://vjudge.net/*
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function() {
    'use strict';
    if (window.vjCountdownInitialized) return;
    window.vjCountdownInitialized = true;
    const startTime = new Date('2025-07-21T08:00:00');
    const endTime = new Date('2025-08-10T15:00:00');
    function createPersistentButton()
    {
        if (document.getElementById('vj-countdown-btn-container')) return;

        const btnContainer = document.createElement('div');
        btnContainer.id = 'vj-countdown-btn-container';
        btnContainer.style.position = 'fixed';
        btnContainer.style.bottom = '0';
        btnContainer.style.left = '0';
        btnContainer.style.right = '0';
        btnContainer.style.textAlign = 'center';
        btnContainer.style.zIndex = '10000';
        btnContainer.style.padding = '5px 0';
        btnContainer.style.backgroundColor = 'rgba(245,245,245,0.9)';
        btnContainer.style.borderTop = '1px solid #ddd';

        const toggleBtn = document.createElement('button');
        toggleBtn.id = 'vj-countdown-toggle';
        toggleBtn.textContent = '显示集训进度 ▲';
        toggleBtn.style.padding = '5px 15px';
        toggleBtn.style.border = '1px solid #4CAF50';
        toggleBtn.style.borderRadius = '15px';
        toggleBtn.style.backgroundColor = '#fff';
        toggleBtn.style.cursor = 'pointer';
        toggleBtn.style.fontSize = '14px';
        toggleBtn.style.color = '#4CAF50';
        toggleBtn.style.fontWeight = 'bold';
        toggleBtn.style.boxShadow = '0 2px 5px rgba(0,0,0,0.2)';
        toggleBtn.style.transition = 'all 0.3s';

        toggleBtn.onmouseover = function() {
            this.style.backgroundColor = '#4CAF50';
            this.style.color = '#fff';
        };
        toggleBtn.onmouseout = function() {
            this.style.backgroundColor = '#fff';
            this.style.color = '#4CAF50';
        };
        const isHidden = GM_getValue('countdownHidden', false);
        if (!isHidden) {
            toggleBtn.textContent = '隐藏集训进度 ▼';
            createCountdownPanel();
        }

        toggleBtn.onclick = function() {
            const panel = document.getElementById('vj-countdown-panel');
            const isNowHidden = !panel || panel.style.display === 'none';

            if (isNowHidden) {
                createCountdownPanel();
                this.textContent = '隐藏集训进度 ▼';
                GM_setValue('countdownHidden', false);
            } else {
                if (panel) panel.style.display = 'none';
                this.textContent = '显示集训进度 ▲';
                GM_setValue('countdownHidden', true);
            }
        };

        btnContainer.appendChild(toggleBtn);
        document.body.appendChild(btnContainer);
    }
    function createCountdownPanel() {
        let panel = document.getElementById('vj-countdown-panel');

        if (!panel) {
            panel = document.createElement('div');
            panel.id = 'vj-countdown-panel';
            panel.style.position = 'fixed';
            panel.style.bottom = '40px';
            panel.style.left = '0';
            panel.style.right = '0';
            panel.style.backgroundColor = 'rgba(245,245,245,0.95)';
            panel.style.padding = '15px 10px 10px';
            panel.style.borderTop = '1px solid #ddd';
            panel.style.zIndex = '9999';
            panel.style.fontFamily = 'Arial, sans-serif';
            panel.style.textAlign = 'center';
            panel.style.boxShadow = '0 -2px 10px rgba(0,0,0,0.1)';

            document.body.appendChild(panel);
        } else {
            panel.style.display = 'block';
            return;
        }
        const title = document.createElement('h3');
        title.textContent = '集训倒计时 (' + formatDate(startTime) + ' 至 ' + formatDate(endTime) + ')';
        title.style.margin = '0 0 15px 0';
        title.style.color = '#333';
        title.style.fontSize = '16px';
        panel.appendChild(title);
        const timeInfo = document.createElement('div');
        timeInfo.style.display = 'flex';
        timeInfo.style.justifyContent = 'space-around';
        timeInfo.style.marginBottom = '15px';
        timeInfo.style.flexWrap = 'wrap';
        timeInfo.style.gap = '10px';
        const endTimeDiv = document.createElement('div');
        endTimeDiv.innerHTML = `<strong>结束时间:</strong> <span id="end-time">${formatDate(endTime)}</span>`;
        timeInfo.appendChild(endTimeDiv);
        const currentTimeDiv = document.createElement('div');
        currentTimeDiv.innerHTML = `<strong>当前时间:</strong> <span id="current-time">${formatDate(new Date())}</span>`;
        timeInfo.appendChild(currentTimeDiv);
        const remainingTimeDiv = document.createElement('div');
        remainingTimeDiv.innerHTML = `<strong>剩余时间:</strong> <span id="remaining-time">计算中...</span>`;
        timeInfo.appendChild(remainingTimeDiv);

        panel.appendChild(timeInfo);
        const progressContainer = document.createElement('div');
        progressContainer.style.height = '20px';
        progressContainer.style.backgroundColor = '#e0e0e0';
        progressContainer.style.borderRadius = '10px';
        progressContainer.style.margin = '10px 0 15px';
        progressContainer.style.overflow = 'hidden';

        const progressBar = document.createElement('div');
        progressBar.id = 'progress-bar';
        progressBar.style.height = '100%';
        progressBar.style.width = '0%';
        progressBar.style.backgroundColor = '#4CAF50';
        progressBar.style.transition = 'width 0.5s ease';
        progressBar.style.borderRadius = '10px';

        progressContainer.appendChild(progressBar);
        panel.appendChild(progressContainer);
        const percentageDiv = document.createElement('div');
        percentageDiv.id = 'percentage';
        percentageDiv.style.fontWeight = 'bold';
        percentageDiv.style.color = '#333';
        percentageDiv.style.marginBottom = '10px';
        panel.appendChild(percentageDiv);
        updateCountdown();
    }

    function updateCountdown() {
        const now = new Date();
        const totalDuration = endTime - startTime;
        const elapsed = now - startTime;
        const remaining = endTime - now;

        if (document.getElementById('current-time')) {
            document.getElementById('current-time').textContent = formatDate(now);
        }

        if (now < startTime) {
            if (document.getElementById('remaining-time')) {
                const timeUntilStart = startTime - now;
                const days = Math.floor(timeUntilStart / (1000 * 60 * 60 * 24));
                const hours = Math.floor((timeUntilStart % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
                const minutes = Math.floor((timeUntilStart % (1000 * 60 * 60)) / (1000 * 60));
                const seconds = Math.floor((timeUntilStart % (1000 * 60)) / 1000);

                document.getElementById('remaining-time').textContent = `集训未开始 (${days}天 ${hours}小时 ${minutes}分 ${seconds}秒后开始)`;
                if (document.getElementById('progress-bar')) {
                    document.getElementById('progress-bar').style.width = '0%';
                }
                if (document.getElementById('percentage')) {
                    document.getElementById('percentage').textContent = '未开始: 0%';
                }
            }
            return;
        } else if (remaining <= 0) {
            if (document.getElementById('remaining-time')) {
                document.getElementById('remaining-time').textContent = '集训已结束';
                if (document.getElementById('progress-bar')) {
                    document.getElementById('progress-bar').style.width = '100%';
                }
                if (document.getElementById('percentage')) {
                    document.getElementById('percentage').textContent = '已完成: 100%';
                }
            }
            return;
        }

        if (document.getElementById('remaining-time')) {
            const days = Math.floor(remaining / (1000 * 60 * 60 * 24));
            const hours = Math.floor((remaining % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            const minutes = Math.floor((remaining % (1000 * 60 * 60)) / (1000 * 60));
            const seconds = Math.floor((remaining % (1000 * 60)) / 1000);

            document.getElementById('remaining-time').textContent = `${days}天 ${hours}小时 ${minutes}分 ${seconds}秒`;

            const progressPercentage = (elapsed / totalDuration) * 100;
            const roundedPercentage = Math.min(100, Math.max(0, progressPercentage.toFixed(2)));

            if (document.getElementById('progress-bar')) {
                document.getElementById('progress-bar').style.width = `${roundedPercentage}%`;

                if (progressPercentage > 80) {
                    document.getElementById('progress-bar').style.backgroundColor = '#f44336';
                } else if (progressPercentage > 60) {
                    document.getElementById('progress-bar').style.backgroundColor = '#FFC107';
                } else {
                    document.getElementById('progress-bar').style.backgroundColor = '#4CAF50';
                }
            }
            if (document.getElementById('percentage')) {
                document.getElementById('percentage').textContent = `已完成: ${roundedPercentage}%`;
            }
        }
    }

    function formatDate(date) {
        const year = date.getFullYear();
        const month = String(date.getMonth() + 1).padStart(2, '0');
        const day = String(date.getDate()).padStart(2, '0');
        const hours = String(date.getHours()).padStart(2, '0');
        const minutes = String(date.getMinutes()).padStart(2, '0');
        const seconds = String(date.getSeconds()).padStart(2, '0');

        return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    }
    window.addEventListener('load', function() {
        createPersistentButton();
        setInterval(updateCountdown, 1000);
    });
})();

No.5 JKFZ联网器

// ==UserScript==
// @name         JKFZ自动登录网络
// @namespace    http://tampermonkey.net/
// @version      2025-07-08
// @description  try to take over the world!
// @author       Snoozing_QwQ&Groygh
// @match        *://192.168.197.21:801
// @icon         http://192.168.197.21:801/eportal/extern/hhLmZa1740119712/6Cw0081740119733/e6d51d1614c2d5b9c880e630f07389ee.png
// @grant        none
// ==/UserScript==
function sleep(ms) {
    return new Promise(function (resolve, reject) {
        setTimeout(() => {
            console.log('sleep end');
            resolve();
        }, ms);
    });
};
(async function() {
    'use strict';
    try{
        await sleep(114);
        document.querySelector('input[placeholder="账号"]').value = "20230387";
        document.querySelector('input[placeholder="密码"]').value = "20000305";
        await sleep(114);
        document.querySelector('input[value="登录"]').click();
    }catch(err) {}
    await sleep(3000);
    window.location.href = window.location.href;
})();
posted @ 2025-07-30 18:37  willAK  阅读(898)  评论(0)    收藏  举报