您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
让腾讯企业邮箱支持浏览器通知
// ==UserScript== // @name exmail.qq.com_notification_plus // @description 让腾讯企业邮箱支持浏览器通知 // @version 1.1 // @namespace https://wanyaxing.com/blog/20181203203742.html // @author [email protected] // @include https://exmail.qq.com/* // ==/UserScript== function setCheckout(check,fuc,time){ if (check()) { fuc(); } else { setTimeout(function(){ setCheckout(check,fuc,time); },time); } } // 新邮件通知 if (document.getElementById("useraddr") && document.getElementById("useraddrcontainer") ) { function receiveTheNewest() { console.log("尝试收取最新邮件!!!",document.getElementById('folder_1'),document.getElementById('readmailbtn_link')); if (document.getElementById('folder_1')) { document.getElementById('folder_1').click(); } if (document.getElementById('readmailbtn_link')) { document.getElementById('readmailbtn_link').click(); eval(document.getElementById('readmailbtn_link').getAttribute('onclick')); } } function notifyMail(title,body) { // 收到来信就刷新收件箱。 receiveTheNewest(); var tag = "sds"+Math.random(); Notification.requestPermission(function (perm) { if (perm == "granted") { var notify = new Notification(title.replace(/ /g,''), { tag: tag, // icon: "https://exmail.qq.com/favicon.ico", body: body.replace(/ /g,'') }); notify.onclick=function(){ notify.close(); window.focus(); //如果通知消息被点击,通知窗口将被激活。 }; notify.onerror = function () { console.log("桌面消息出错!!!"); }; notify.onshow = function () { console.log("桌面消息成功"); }; notify.onclose = function () { console.log("桌面消息关闭!!!"); }; } }); } setCheckout(function(){ return (unsafeWindow.QMWebpushTip && unsafeWindow.QMWebpushTip._addData) },function(){ var oldUpdateTip = unsafeWindow.QMWebpushTip._addData; unsafeWindow.QMWebpushTip._addData = function(g,h){ console.log('_addData',g,h); // setTimeout(function(){ if (h && h[0] && h[0]['subject'] && h[0]['summary'] ) { notifyMail(h[0]['subject'] , h[0]['summary']); } // },2000); return oldUpdateTip(g,h); } console.log('unsafeWindow.QMWebpushTip hooked'); var checkStatusNode = document.createElement('span'); checkStatusNode.style.cssText = 'margin-left: 10px;'; checkStatusNode.innerHTML = '☑︎收到新邮件时使用桌面通知。'; checkStatusNode.onclick=function(){ receiveTheNewest(); } document.getElementById("useraddrcontainer").parentNode.appendChild(checkStatusNode); },1000); //每小时刷新一次 // setTimeout(function(){ // window.history.go(0); // },1000 * 60 * 60); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址