2

ユーザースタイルを作成しようとしています(ユーザースクリプトとしてGoogle Chromeにインストールされています)。ページ上のすべてを非表示にし、画像のみを表示する CSSです。

html { height:100%; 
       background:url(http://i.imgur.com/oqhgG.png) no-repeat center fixed #FFFFFF !important; 
       overflow:hidden; 
     }
*:not(html) { display:none; }

ここでの CSS の理解には何か問題があると思いますが、これMozilla Firefoxで機能します (このコードをuserContent.cssに貼り付けると、期待どおりに動作します)。

bodyの代わりにhtml、より具体的なセレクターも試しました。visibility:collapse;display:none;:not

userstyles.orgがこの CSS をユーザースクリプトにする方法は次のとおりです。

ここに何があるか説明してください!どうもありがとう!

4

1 に答える 1

2

次のコードは私のChromeで正常に動作します。@namespace行を削除し、html要素にスタイルを適用しました。

// @description   Block entire websites in style!
// @author        monn43
// @homepage      http://userstyles.org/styles/53487
// @run-at        document-start
// ==/UserScript==
(function() {
var css = "";
if (false || (document.domain == "perezhilton.com" ||document.domain.substring(document.domain.indexOf(".perezhilton.com") + 1) == "perezhilton.com") || (document.domain == "fitperez.com" || document.domain.substring(document.domain.indexOf(".fitperez.com") + 1) == "fitperez.com") || (document.domain == "cocoperez.com" || document.domain.substring(document.domain.indexOf(".cocoperez.com") + 1) == "cocoperez.com") || (document.location.href.indexOf("http://perezhilton.com/") == 0))
css += "html { height:100%; background:url(http://i.imgur.com/oqhgG.png) no-repeat center fixed #FFFFFF !important; overflow:hidden; }\n*:not(html) { visibility:hidden; }";
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[0].appendChild(node); 
}
}
})();
于 2012-04-07T04:46:46.077 に答える