HuangQS

自用,一些页面的优化

目前為 2024-03-20 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
    }

})();