Dave C
Dave C

Reputation: 794

Replacement background image not showing when using GreaseMonkey

I'm trying to use GreaseMonkey to replace the background image of a DIV on bing.com. It's a pretty straightforward call to GM_addstyle:

GM_addStyle(".sw_logo "
+"{background:url('http://www.kpao.org/blog/kpao-bing-logo-inverse.png') "
+"no-repeat 21px 7px transparent}");

However, the image doesn't show up. It's clearly visible in Firebug, and as I twiddle with the CSS in Firebug, I can get it to show up. But it doesn't stay. Any thoughts on why? Maybe it's a bug, but then maybe I'm missing something obvious. Thanks!

Upvotes: 2

Views: 1104

Answers (2)

Dave C
Dave C

Reputation: 794

I ended up working around it by Using a binary to base64 tool to get an ASCII stream of my image and embedding it directly into the script. http://www.greywyvern.com/code/php/binary2base64

Upvotes: 1

ANeves
ANeves

Reputation: 6365

It seems like something's overriding it... maybe some JS, I don't know. I see the same problem changing it with Stylish too.

Use this:

GM_addStyle(".sw_logo "
+"{background:url('http://www.kpao.org/blog/kpao-bing-logo-inverse.png') "
+"no-repeat 21px 7px transparent ! important;}");

But know that using ! important is generally not what you want, even though it works: http://www.w3.org/TR/CSS2/cascade.html#important-rules

Upvotes: 0

Related Questions