Greasy Fork is available in English.

게시판 » 개발

Is it possible to run userscripts on css files instead of html sites?

§
작성: 2017-12-25

Is it possible to run userscripts on css files instead of html sites?

I know that you can override a style with js but that wont work for me. want to check style for class names being on a white or blacklist and if they contain position:absolut or position:fixed. this works but only for stylesheets that are hosted on the same server because of cross site scripting protection. is there a way to inject the script directly into the css file or to get around this protection mechanism? it also has to work generically on every site.

here is the project: https://github.com/elypter/BlockHead
walking over styles in the stylesheets is currently disabled. you have to change walk_elements to false and walk_styles to true

woxxom관리자
§
작성: 2017-12-25

No, scripts can only run in DOM, but CSS stylesheets aren't documents. You'll have to use GM_xmlhttpRequest to download the stylesheets and analyze them.

§
작성: 2017-12-25
수정: 2017-12-25

thanks

댓글 남기기

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