开发者

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!


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜