HuangQS

自用,一些页面的优化

当前为 2024-03-20 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         HuangQS
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  自用,一些页面的优化
// @author       You
// @match        *://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 获取当前页面的URL
    const currentURL = window.location.href;

    // 亡灵增量
    if (currentURL.includes('www.mhhf.com') || currentURL.includes('www.json1.cn')) {
        document.title = '测试-Canvas绘制展示';

        setInterval(()=>{
            // 找到包含所有按钮的父元素
            let spellsContainer = document.querySelector('.spells');

            // 找到所有按钮元素
            let spellButtons = spellsContainer? spellsContainer.querySelectorAll('.spell') : undefined;

            // 循环点击每个按钮
            if(spellButtons){
                for(let i =0 ; i<spellButtons.length ; i++){
                    //仅点击前两个
                    if(i>=2)break;
                    let button = spellButtons[i];
                    // 触发点击事件
                    button.dispatchEvent( new MouseEvent('click', { bubbles: true,cancelable: true, view: window }));
                }

            }
        },1000)

    }

    //json在线解析去广告 进入后全屏
    else if (currentURL.includes('www.json.cn')) {
        document.title = 'JSON';

        // 找到对应的按钮元素 触发点击事件
        let clickEvent = new MouseEvent('click', { bubbles: true, cancelable: true, view: window });
        document.getElementById('formatFullScreen').dispatchEvent(clickEvent);
    }
    //文本比对 进入后全屏
    else if(currentURL.includes('https://tool.lu/diff')){
        let clickEvent = new MouseEvent('click', { bubbles: true, cancelable: true, view: window });
        document.getElementById('js-webfullscreen').dispatchEvent(clickEvent);
    }

})();