Greasy Fork is available in English.

Discussions » Development

How to auto stop bootstrap.js from auto clearing the console log?

§
Posted: 2021.07.24.
Edited: 2021.07.24.

None of the things I've tried worked.

// ==UserScript== // @name ...........................
// @namespace hacker09
// @version 0.1
// @description ..
// @author hacker09
// @noframes
// @include https://www.comandotorrent.tv/*
// @require https://raw.githubusercontent.com/sindresorhus/devtools-detect/main/index.js
// @run-at document-idle
// ==/UserScript==

new MutationObserver(async function() {
console.clear = () => {}
}).observe(document.body, {
attributes: true,
attributeOldValue: true,
characterData: true,
characterDataOldValue: true,
childList: true,
subtree: true
});

setInterval(function(){
console.clear = () => {}
}, 500);

window.onresize = function(){
console.clear = () => {}
}

window.addEventListener('devtoolschange', event => {
console.clear = () => {}
});

wOxxOmMod
§
Posted: 2021.07.24.

One solution is to use unsafeWindow instead of window. Another one is to add // @grant none, which will run the script in the page context, but you won't be able to use GM_ functions.

§
Posted: 2021.07.24.
Edited: 2021.07.24.

@wOxxOmMOD

// @grant GM_registerMenuCommand

// @grant GM_setValue

// @grant GM_getValue

// @grant window.close

// @run-at document-idle

This is the actual script and it can't be changed, but adding unsafewindow won't be a problem.

§
Posted: 2021.07.24.

Thanks, that worked

Post reply

Sign in to post a reply.