Greasy Fork is available in English.

Discussioni » Sviluppo

I need to limit my script to work on only one page. (Not the whole URL)

§
Pubblicato: 14/09/2020

A website I frequent has a poorly formatted home page. (It's hard to read.) The other pages are better. I've made a script to change the appearance, turning off the background image, setting a solid background color and white text. The problem is it acts on the other pages, too, and their text is inside a white div. When I fix the home page, I break the others. I'm seeing this problem on my phone in xbrowser. On PC in firefox it works as expected.

I've tinkered with @include, @exclude and @match. Whatever I try, it seems to either work or not work on the whole site.

The page I want this to work on is the homepage at elmbranch.org. My script is here. I'll post the code here on request, but I don't know if that's how things are done here, so I'll wait.

Anyone know a solution that will be compatible for everyone? (I could recode it for a light background and black text, but that's a last resort.)

wOxxOmMod
§
Pubblicato: 14/09/2020
Modificato: 14/09/2020

Your code is already correct, no change needed. It works only on the homepage in any userscript extension that properly implements userscripts. Sounds like xbrowser is broken.

§
Pubblicato: 14/09/2020

Come to think of it, I guess this means that xbrowser handles it differently than firefox. Maybe I'm not looking to fix it, but for a work-around. I'll probably test in some other browsers and see what I get. Thank you for taking a look.

§
Pubblicato: 14/09/2020
Modificato: 14/09/2020

You didn't add the wildcard * in the end of the url, this makes the script run only on that page, if there's anything missing or added to the url the script won't run.

You used @include, but you can change to @match and you will get the same result

§
Pubblicato: 14/09/2020

That was how I expected it to work. So like wOxxOm said, I guess I have an xbrowser problem, not a script problem. Thank you for taking a look.

§
Pubblicato: 14/09/2020

I found that work around. Then I put both versions out in the wild. Thanks for helping me get on the right track, folks!

Pubblica risposta

Accedi per pubblicare una risposta.