Block online_current.js

Blocks the online_current.js script from loading

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

// ==UserScript==
// @name         Block online_current.js
// @namespace    https://instructure-uploads.s3.amazonaws.com/
// @version      1.0
// @description  Blocks the online_current.js script from loading
// @match        *://*.instructure.com/*
// @match        *://instructure-uploads.s3.amazonaws.com/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    var observer = new MutationObserver(function(mutations, observer) {
        var scripts = document.querySelectorAll("script[src*='online_current.js']");
        scripts.forEach(script => {
            script.remove(); // Remove the script if found
            console.log("Blocked: " + script.src);
        });
    });

    observer.observe(document, { childList: true, subtree: true });

    // Prevent the script from being added dynamically
    const originalCreateElement = document.createElement;
    document.createElement = function(tagName, options) {
        if (tagName.toLowerCase() === 'script') {
            const scriptElement = originalCreateElement.apply(this, arguments);
            Object.defineProperty(scriptElement, 'src', {
                set: function(value) {
                    if (value.includes('online_current.js')) {
                        console.log("Blocked script injection: " + value);
                        return;
                    }
                    scriptElement.setAttribute('src', value);
                },
                get: function() {
                    return scriptElement.getAttribute('src');
                }
            });
            return scriptElement;
        }
        return originalCreateElement.apply(this, arguments);
    };
})();