是不是装了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: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=\"\"里面.其他的全是通用 我还是习惯用stylish 我两个都用,各司其职 Greasemonkey用不上,装Stylish也只是用这个显示缺失图片占位符的功能,Orz...
页:
[1]