我想推迟一个特定网页(这里指的是Google)的页面浏览时间, 以便用户在倒计时计时完成之前无法查看网页。
这个问题受到启发"http://xkcd.com/862/" rel="nofollown noreferrer">>xkcd ,类似的问题是"https://stackoverflow.com/ questions/5043233/javascript-page-load-delay-flue-of-com-set-pages" >“特定页面的积页延迟”。
我尝试过一个修改版本的 Jonathan s Greasemonkey 脚本(见下文),
如果Google在一个新标签中打开,或者用户从Google的链接中打开,然后返回,脚本又会再次打开。 但是,如果用户从不远离Google(比如,他们在每个搜索结果的简短摘要中找到了他们所寻找的答案,然后只是搜索其它东西),他们可以毫不迟延地搜索。
是否有办法迫使延迟屏幕在每次搜索后出现(而不是每次访问页面后出现)? -- -- 最好使用Greasemonkey或铬插件?
Script currently used:
(first sets blocked addresses to a value of "1" and all other addresses to a value of "0," then, if block>0, the script kicks in...)
(function(){
// Note: This doesn t actually stop the page from loading, but hides it, so you know its
// there, waiting; The dopamine of internet candy becomes a torture. Better to clean
// your room or open an irb prompt instead.
window.seconds = 30;
function resetCountDown()
{
seconds = 30;
}
// You can has cybersauce
window.clearDelay = function()
{
document.getElementById( eightSixTwoDelay ).style.display = none ;
}
var overlay = document.createElement( div );
overlay.id = eightSixTwoDelay ;
overlay.style.backgroundColor = #000 ;
overlay.style.color = #FFF ;
overlay.style.fontSize = 56px ;
overlay.style.fontFamily = Helvetica, Arial, Sans ;
overlay.style.fontWeight = bold ;
overlay.style.textDecoration = none ;
overlay.style.position = absolute ;
overlay.style.top = 0px ;
overlay.style.left = 0px ;
overlay.style.width = 100% ;
// clientHeight changes as content loads, and JS, like the PHX Valley Metro system, does not wait for you to run.
overlay.style.height = document.body.clientHeight + px ; // 100% ;
overlay.style.paddingTop = 10px ;
overlay.style.paddingLeft = 10px ;
overlay.style.textAlign = left ;
overlay.style.zIndex = 10000 ; // OVER 9000
overlay.addEventListener("click", resetCountDown, true); // THERE IS NO ESCAPE
document.getElementsByTagName( body )[0].appendChild(overlay);
window.displayDelay = function()
{
if (seconds > -1)
{
document.getElementById( eightSixTwoDelay ).innerHTML = Page ready in + seconds + seconds. ;
seconds -= 1;
setTimeout(window.displayDelay, 1000);
}
else
{
clearDelay();
}
}
window.onload = displayDelay();
})();
}