谷歌浏览器 - 覆盖网页加载之间的白色空白页面 [英] Google Chrome - Override White Blank page between webpage loads
问题描述
我正在寻找不同的Chrome应用程序,以使我的页面变暗/倒置以减轻眼睛疲劳,我发现有些应用程序可以正常工作,但唯一剩下的应用程序似乎无法覆盖,是白色空白页。
在加载新页面时,Chrome会首先显示一个白色空白页面,而页面正在加载,然后显示该网站的内容。有没有办法来覆盖这个虽然页面说黑色?目前,每次点击链接或打开新网页时,屏幕会从深色(通过倒置/变暗的页面应用程序)到白色空白屏幕一会儿,然后新页面再次以暗色加载。每当新页面加载时,屏幕就会像屏幕上出现白色闪光灯一样,并导致进一步的眼睛疲劳。这就是为什么我想知道是否有办法将这种白色覆盖为黑色。
Ps。如果这篇文章是在错误的论坛上,我很抱歉,谷歌Chrome开发者页面有一个链接到论坛,它把我带到这里:)
谢谢。
manifest.json
{
name:Background,
permissions:[http:// * / *,https:// * / *],
version:1.0 ,
content_scripts:[{
matches:[http:// * / *,https:// * / *],
js:[ script.js],
all_frames:false,
run_at:document_start
}],
manifest_version:2
}
script.js
var color = document.documentElement.style.backgroundColor;
document.documentElement.style.backgroundColor =black;
var observer = new MutationObserver(function(mutations){
mutations.forEach(function(mutation){
if(mutation.target.nodeName ==BODY)){
observer.disconnect();
document.documentElement.style.backgroundColor = color ||;
}
});
});
observer.observe(document,{childList:true,subtree:true});
将所有文件放在一个文件夹中。在Chrome中,进入设置 - >扩展 - >打开开发者模式 - >加载解压后的扩展名 - >选择刚创建的文件夹。
I'm looking for different Chrome apps to make my pages darker/inverted to reduce eye strain, I found some apps that work but the only thing left, which these apps doesn't seem to override, is the White Blank page.
When a new page is loaded, Chrome first displays a White Blank page, while the page is loading then displays the website's content. Is there a way to override this While page to say Black? At the moment, everytime I click on a link or open a new webpage, the screen goes from darkcoloured (through inverted/darkening page apps) to the White Blank screen for a brief second then the new page loads in a dark colour again. This acts like a "White Flash" by the screen everytime a new page is loaded and causes further eye strain. This is why I want to know if there is a way to override this White colour to Black.
Ps. If this post is in the wrong forum, I apologise, Google Chrome Developers page had a link to Forums which brought me here :)
Thanks.
manifest.json
{
"name": "Background",
"permissions" : ["http://*/*", "https://*/*"],
"version": "1.0",
"content_scripts": [{
"matches": ["http://*/*", "https://*/*"],
"js": ["script.js"],
"all_frames": false,
"run_at": "document_start"
}],
"manifest_version": 2
}
script.js
var color = document.documentElement.style.backgroundColor;
document.documentElement.style.backgroundColor = "black";
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.target.nodeName == "BODY") {
observer.disconnect();
document.documentElement.style.backgroundColor = color || "";
}
});
});
observer.observe(document, { childList: true, subtree: true });
Put all of the files in a folder. In chrome, go to Settings -> Extensions -> turn on Developer Mode -> Load unpacked extension -> Choose the folder you just created.
这篇关于谷歌浏览器 - 覆盖网页加载之间的白色空白页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!