Studocu_Remove_Blur

Remove blur in studocu.com and other annoying things.

目前為 2022-03-28 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Studocu_Remove_Blur
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  Remove blur in studocu.com and other annoying things.
// @author       You
// @match        https://www.studocu.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=studocu.com
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    // alert("Trying lol");
    let waitTime = 3000; // 3000ms to start
    let intervalTime = 10000; // 3000ms once

    const timeout = setTimeout(() => {
        main();
    }, waitTime);

    function main(){
        let frontShit = document.querySelectorAll('#document-wrapper')[0].childNodes[0];
        frontShit.remove();
        let frontShit2 = document.querySelectorAll('h2');
        for (let i = 0; i < frontShit2.length; i++) {
            const shit = frontShit2[i];
            let shitWords = "Why is this page out of focus?";
            if (shit.innerHTML.indexOf(shitWords) != -1) { // shitWords in innerHTML
                console.log(shit);
                shit.parentElement.parentElement.remove();
            }
        }

        let count = 0;
        const interval = setInterval(()=>{
            count++;
            alert("Count: " + count);
            clearBlur();
        }, intervalTime)

        let clearBlur = ()=>{
            let blurDivs = document.querySelectorAll('.page-content');
            for (let i = 0; i < blurDivs.length; i++) {
                const blurDiv = blurDivs[i];
                let blurWords = "filter: blur(4px);";
                if (blurDiv.outerHTML.indexOf(blurWords) != -1) {
                    console.log(blurDiv);
                    while (blurDiv.hasChildNodes()){// lifting all the children
                        blurDiv.parentNode.insertBefore(blurDiv.firstChild,blurDiv);
                    }
                    blurDiv.parentNode.removeChild(blurDiv);
                }
            }
        };

        //Repeated execution will result in a blank page for unknown reasons.
        // 如果重复执行会导致页面空白,原因未知。
    }

})();