diff --git a/weixin/pay.user.js b/weixin/pay.user.js new file mode 100644 index 0000000..07da588 --- /dev/null +++ b/weixin/pay.user.js @@ -0,0 +1,37 @@ +// ==UserScript== +// @name 微信商户登录通知 +// @namespace https://miaowoo.cc/ +// @version 0.1 +// @description 自动化登录通知 +// @author MiaoWoo +// @match https://pay.weixin.qq.com/index.php/core/home/login** +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + async function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)) + } + async function post(url, data) { + return await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(data) + }).then(r => r.json()) + } + async function main() { + let qrcode = null + while (!(qrcode = document.getElementById('IDQrcodeImg'))) { + await sleep(100) + } + let url = null + while (!(url = qrcode.getAttribute('title'))) { + await sleep(100) + } + await post('https://oauthtest.yumc.pw/qr/wxpay', {url}) + } + main() +})(); \ No newline at end of file