Discussions » Development

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

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

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

§
Posted: 2017-12-25
Edited: 2017-12-25

thanks

Post reply

Sign in to post a reply.