// ==UserScript== // @name 陈Sir事件提醒定时脚本 // @namespace https://bbs.tampermonkey.net.cn/ // @version 1.0.1 // @description 定时工作提示 // @author chen // @grant GM_notification // @grant GM_getValue // @crontab * * * * * // ==/UserScript== /* ==UserConfig== 基础配置: Hour: title: Hour description: 23时 填写23即可 default: Minutes: title: Minutes description: 分钟参数 23:03 此位置填写3即可 大于10填写两位 default: 桌面通知: IswindowNotice: title: 开启桌面通知 default: true Title: title: Title description: 桌面通知标题,此处填写桌面通知的标题 default: 定时脚本提示您: Text: title: Text description: 桌面通知文本内容,此处填写桌面通知的文本内容 default: 陈公子的话 Image_Url: title: Image_Url description: 桌面通知logo链接 default: https://bbs.tampermonkey.net.cn/uc_server/avatar.php?uid=722&size=small&ts=1 音频通知: IsMusicNotice: title: 开启音频通知 default: true music_url: title: music_url description: 音乐链接 default: http://chhzll.gitee.io/xiaochen/music/ren.mp3 ==/UserConfig== */ return new Promise((resolve, reject) => { if (new Date().getHours() == GM_getValue("基础配置.Hour") && new Date().getMinutes() == GM_getValue("基础配置.Minutes")) { //桌面通知 if (GM_getValue("桌面通知.IswindowNotice") == true) { GM_notification({ title: GM_getValue("桌面通知.Title"), text: GM_getValue("桌面通知.Text"), image: GM_getValue("桌面通知.Image_Url"), }); } if (GM_getValue("音频通知.IsMusicNotice") == true) { //音频通知 let audio = new Audio(GM_getValue("音频通知.music_url")); play = audio.play(); if (play) { play.then(() => { setTimeout(() => { audio.pause(); }, 20000); }).catch((e) => { // 音频播放失败 console.log("音频播放失败") }) } } } });