豆瓣竟然有网友用我的脚本了,还希望我加个次数限制,所以升级了一下,刚看到,复制到博客里了。
// 检查间隔
var interval = 30000;
// 是否开启提醒计数,0关闭,>0为几次停止
var open_count = 4;
// ==UserScript==
// @name 豆瓣豆油提醒脚本
// @namespace http://0x55aa.com/
// @version 0.2
// @description 豆瓣豆油提醒脚本,来豆油后进行弹窗提醒!
// @author 0x55aa
// @match https://*.douban.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 检查间隔
var interval = 30000;
// 是否开启提醒计数,0关闭,>0为几次停止
var open_count = 4;
var count = Number(window.localStorage.getItem("count")) || 0;
// 提醒
if (Notification && Notification.permission !== "granted") {
Notification.requestPermission(function (status) {
if (Notification.permission !== status) {
Notification.permission = status;
}
});
}
function notify() {
var titleText = "豆油来啦";
var options = {
dir: "ltr",
lang: "utf-8",
icon: "https://img3.doubanio.com/favicon.ico",
body: "请赶快处理!!!!!"
};
if (Notification && Notification.permission === "granted") {
var n = new Notification(titleText, options);
}
window.localStorage.setItem("count", count+1);
window.location.reload();
}
function check() {
console.log($('#top-nav-doumail-link').children().text());
console.log(count);
if ($('#top-nav-doumail-link').children().text()){
if (!open_count){
notify();
}else{
if (count < open_count){
notify();
}else{
window.location.reload();
}
}
}else{
window.localStorage.setItem("count", 0);
count = 0;
}
}
var timer = setInterval(check, interval);
})();
上一篇: 币圈的坑爹手法
下一篇: ipmi远程控制,Error: Unable to establish IPMI v2 / RMCP+ session
0 Responses so far.