views:

138

answers:

2

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!

A: 

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

ANeves
Unfortunately that didn't work either.
Dave C
Bummer, I see what you mean. It removes the current image but the new one doesn't show up either. That's a very awkward solution you had to find. (Mark it as answer.)
ANeves
A: 

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

Dave C