舔狗日记
// ==UserScript==
// @name 舔狗日记
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description 每天9点-23:59之间运行一次,点击通知弹窗可复制!
// @author 张仨
// @crontab * 9-23 once * *
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
// @grant GM_notification
// @grant GM_log
// @connect api.gmit.vip
// ==/UserScript==
return new Promise((resolve, reject) => {
GM_xmlhttpRequest({
method: "GET",
responseType: "json",
url: "https://api.gmit.vip/Api/Dog?",
onload: function (xhr) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
if (xhr.response.code == 200) {
console.log(xhr)
let text = xhr.response.data.text
GM_log(text, "舔狗日记")
GM_notification({
title: "舔狗日记 -- 点击可复制",
text: text,
image: "https://gitee.com/MarHangover/images/raw/master/image/234.jpg",
timeout: 8000,
onclick: function () {
GM_setClipboard(text)
},
ondone() {
resolve();
}
})
} else {
GM_notification("获取数据失败,请稍后重试!")
resolve();
}
} else {
GM_notification("获取数据失败,请稍后重试!")
resolve();
}
} else {
GM_notification("获取数据失败,请稍后重试!")
resolve();
}
}
})
});