Unblur Text for studeersnel.nl

Unblur text

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Unblur Text for studeersnel.nl
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Unblur text
// @author       cvolt
// @license      GPL3
// @match        https://www.studeersnel.nl/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to remove an element by XPath
    function removeElementByXPath(xpath) {
        const result = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        const element = result.singleNodeValue;
        if (element) {
            element.style.display = 'none';
        }
    }

    // Function to remove elements by a dynamic pattern
    function removeElementsByDynamicPattern() {
        const dynamicXPath = `//*[starts-with(@id, 'pf')]/div[2]`;
        const elements = document.evaluate(dynamicXPath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

        for (let i = 0; i < elements.snapshotLength; i++) {
            let element = elements.snapshotItem(i);
            if (element) {
                element.style.display = 'none';
            }
        }
    }

    // Function to inject custom style for unblurring text and enabling text selection
    function injectStyle() {
        const style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = `
            .page-content { filter: none !important; }
            * { user-select: text !important; }
        `;
        document.head.appendChild(style);
    }

    // Function to run all actions after the page is fully loaded
    window.onload = function() {
        injectStyle();
        removeElementsByDynamicPattern();
        removeElementByXPath('//*[@id="document-wrapper"]/div[1]/div');

        // Observe for future DOM changes
        observer.observe(document.body, { childList: true, subtree: true });

        // Additional delayed execution if needed
        delayedExecution();
    };
})();