Greasy Fork is available in English.
限制访问某些网站的时间段,防止自己在工作时间上网浪费时间
< 脚本 学术自律模式 的反馈
脚本修改方案对于一些有iframe的网址,会重复弹窗,检查上次弹窗的时间,如果与当前时间相差不到 60 秒,就不再弹窗。 // 新增:检查上次弹窗时间,60秒内只询问一次 function shouldShowPrompt() { const lastPromptTime = localStorage.getItem('lastPromptTime'); const now = Date.now(); // 如果没有记录,或者距离上次弹窗超过60秒,则返回true if (!lastPromptTime || (now - lastPromptTime) > 60000) { // 更新时间戳 localStorage.setItem('lastPromptTime', now); return true; } return false; } const currentHostname = window.location.origin; if (check_url(currentHostname) && checkTime()) { if (shouldShowPrompt()) { btn_confirm(); } }
登录以发布留言。
脚本修改方案
对于一些有iframe的网址,会重复弹窗,检查上次弹窗的时间,如果与当前时间相差不到 60 秒,就不再弹窗。
// 新增:检查上次弹窗时间,60秒内只询问一次
function shouldShowPrompt() {
const lastPromptTime = localStorage.getItem('lastPromptTime');
const now = Date.now();
// 如果没有记录,或者距离上次弹窗超过60秒,则返回true
if (!lastPromptTime || (now - lastPromptTime) > 60000) {
// 更新时间戳
localStorage.setItem('lastPromptTime', now);
return true;
}
return false;
}
const currentHostname = window.location.origin;
if (check_url(currentHostname) && checkTime()) {
if (shouldShowPrompt()) {
btn_confirm();
}
}