Sleazy Fork is available in English.

Handy Image

Shows just fullsize Image with hotkeys & without pop-ups on many image-hosting sites

< Valutazione su Handy Image

Domanda/commento

§
Pubblicato: 06/10/2017

Custom JS Action not working in Tampermonkey and Firefox

Trying to add some custom styling but it doesn't work in Tampermonkey v4.5.5564 and Firefox 56. It worked in Greasemonkey 3.17.

OwynAutore
§
Pubblicato: 06/10/2017

I have Firefox 56 and it works here. alert("hi");

Try asking on Tampermonkey forum ( https://forum.tampermonkey.net/ ), maybe they just blocked custom js actions cuz it was not safe by their judgment

§
Pubblicato: 09/10/2017

Are you able to use the code below? I can't. I think it's because of this https://stackoverflow.com/questions/2303147/injecting-js-functions-into-the-page-from-a-greasemonkey-script-on-chrome.

function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
addGlobalStyle('body{background-image:url("chrome://global/skin/media/imagedoc-darknoise.png")!important;}');
addGlobalStyle('body>img:only-of-type{margin:8px auto!important;display:block;max-width:100%;height:auto!important;width:auto!important;}');
OwynAutore
§
Pubblicato: 09/10/2017
Modificato: 09/10/2017

Are you able to use the code below? I can't.

but does alert("hi"); work fine for you? - if so then it's the problem of the code itself

document.createElement()

it's protected by the script against aggressive ads, try using protected_createElement(), it should be accessible from custom js action cuz it is executed from inside the script

§
Pubblicato: 10/10/2017

alert("hi"); works, but the code I'm trying doesn't work. I tried using protected_createElement() but got the error TypeError: document.protected_createElement is not a function

OwynAutore
§
Pubblicato: 10/10/2017

You'r right, for some reason original createdocument works in js action,

and I've tested your original code - it adds two <style> elements to the head fine in my firefox

Pubblica risposta

Accedi per pubblicare una risposta.