Sleazy Fork is available in English.

Handy Image

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

< Feedback on Handy Image

Question/comment

§
Posted: 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.

OwynAuthor
§
Posted: 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

§
Posted: 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;}');
OwynAuthor
§
Posted: 09.10.2017.
Edited: 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

§
Posted: 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

OwynAuthor
§
Posted: 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

Post reply

Sign in to post a reply.