Handy Image

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

< Handy Image 피드백

질문/댓글

§
작성: 2017-10-06

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.

Owyn개발자
§
작성: 2017-10-06

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

§
작성: 2017-10-09

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;}');
Owyn개발자
§
작성: 2017-10-09
수정: 2017-10-09

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

§
작성: 2017-10-10

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

Owyn개발자
§
작성: 2017-10-10

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

댓글 남기기

댓글을 남기려면 로그인하세요.