fmy 发表于 2010-8-27 11:30

是不是装了Greasemonkey就不需要stylish了?

userstyle.org上所有的样式都提供以脚本形式安装到GM上.

问题是, 那些没在userstyle上的野生样式该怎么办? 求个转换到GM脚本的方法.

比如这个

/*
*显示缺失图像占位符
*/
@-moz-document url-prefix(http), url-prefix(file)
{
img:-moz-broken
{
-moz-force-broken-image-icon: 1 !important;
width: 24px;
height: 24px;
}
}

fmy 发表于 2010-8-27 11:44

本帖最后由 fmy 于 2010-8-27 11:45 编辑

// ==UserScript==
// @name         显示缺失图像占位符
// @namespace      http://userstyles.org
// @description    显示缺失图像占位符
// @include      *
// ==/UserScript==
/*
*显示缺失图像占位符
*/
(function() {
var css = \\"img:-moz-broken\\n{\\n-moz-force-broken-image-icon: 1 !important;\\nwidth: 24px;\\nheight: 24px;\\n}\\"


if (typeof GM_addStyle != \\"undefined\\") {
        GM_addStyle(css);
} else if (typeof PRO_addStyle != \\"undefined\\") {
        PRO_addStyle(css);
} else if (typeof addStyle != \\"undefined\\") {
        addStyle(css);
} else {
        var heads = document.getElementsByTagName(\\"head\\");
        if (heads.length > 0) {
                var node = document.createElement(\\"style\\");
                node.type = \\"text/css\\";
                node.appendChild(document.createTextNode(css));
                heads.appendChild(node);
        }
}
})();自己搞定了... 不过貌似效果不如stylish... 用stylish占位符是根据容器大小? 而greasemonkey则乖乖地24px * 24px了?


实际上就是把stylish的css 全都扔到 var css=\"\"里面.其他的全是通用

Junichoon 发表于 2010-8-27 11:48

我还是习惯用stylish

木犸 发表于 2010-8-27 12:00

我两个都用,各司其职

dreamz 发表于 2010-8-27 17:42

Greasemonkey用不上,装Stylish也只是用这个显示缺失图片占位符的功能,Orz...
页: [1]
查看完整版本: 是不是装了Greasemonkey就不需要stylish了?