Greasy Fork is available in English.

Discussions » Développement

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

§
Posté le: 25/12/2017

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
§
Posté le: 25/12/2017

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.

§
Posté le: 25/12/2017
Édité le: 25/12/2017

thanks

Poster une réponse

Connectez-vous pour poster une réponse.