// ==UserScript== // @name 网址监控通知 // @namespace http://tampermonkey.net/ // @version 0.3 // @description 监控是否跳转到特殊网址,如果跳转则通过webhook(飞书等)通知,可用于登录失效识别等 // @author Austin.Young // @match * // @include * // @grant GM_registerMenuCommand // @grant GM_notification // @grant GM_xmlhttpRequest // @grant GM.xmlHttpRequest // @connect self // @connect localhost // @connect www.feishu.cn // @connect open.feishu.cn // @connect * // 不支持 * 匹配 // @grant GM_getValue // @grant GM_setValue // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/492515/%E7%BD%91%E5%9D%80%E7%9B%91%E6%8E%A7%E9%80%9A%E7%9F%A5.user.js // @updateURL https://update.greasyfork.icu/scripts/492515/%E7%BD%91%E5%9D%80%E7%9B%91%E6%8E%A7%E9%80%9A%E7%9F%A5.meta.js // ==/UserScript== let webHookList = [] let matchUrlList = [] let historyList = [] let detectDelay = 1000; const preIdName = 'austinConfig_'; (function () { 'use strict'; const menu_command_id_1 = GM_registerMenuCommand("设置通知规则", function (event) { addConfig() }, { accessKey: "U", autoClose: true }); // 进行检测 getPara(); setTimeout(detectUrl,detectDelay); })(); var newElement =null,myshadowRoot =null; function getDom(){ let dom; if(myshadowRoot!=null){ dom = myshadowRoot }else{ dom = document } return dom } // 所有对象增加 austinConfig 前缀 function $(id,ignore) { let domId = preIdName + id let obj = getDom().getElementById(domId) if (obj == null) { if(ignore) { // 忽略提醒,返回失败 return false } alert('找不到DOM对象:' + domId) return {}; } return obj } function addConfig() { if(newElement!=null)return;// 已经创建过 newElement = document.createElement("div"); // 创建 Shadow Root // myshadowRoot = document.body.attachShadow({ mode: 'open' }); // myshadowRoot.appendChild(newElement) // newElement.style.color="black" // newElement.style.textAlign="left" // newElement.style.padding="2px" // newElement.style.margin="0px" newElement.style.all ="initial" myshadowRoot = newElement.attachShadow({ mode: 'closed' }); myshadowRoot.innerHTML = `
序号 | 通知名称(name,不能重复) | Webhook地址(url) | 发送内容(text,发送的内容,{MatchName}=监控名称,{Url}=当时访问的网址) | 操作 |
序号 | 监控名称(name) | 处理类型(type,0=包含,1=正则) | 匹配内容(strMatch,字符串或正则表达式) | 通知名(notice,对应的通知名称) |