Greasy Fork

Greasy Fork is available in English.

打破一切更新了吗

马桶哥~"MITE:打破一切"更新了吗?

当前为 2021-05-17 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         打破一切更新了吗
// @namespace    DidMiteDPYQUpdate
// @version      1.2
// @description  马桶哥~"MITE:打破一切"更新了吗?
// @author       Rortenfeat
// @license      MulanPSL-2.0
// @include      *
// @grant        GM_xmlhttpRequest
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_openInTab
// @grant        GM_notification
// @connect      www.mitedpyq.com
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

	const dpyqURL = 'https://www.mitedpyq.com';
	// 每次检查更新间隔(单位:毫秒);默认值:3600000(一小时)
	const checkInterval = 3600000;

	let lastCheck = new Date(GM_getValue('dpyqTime', 0));
	let checkTime = new Date();
	let interval = checkTime.getTime() - lastCheck.getTime();
	if (!(interval < checkInterval)) {
		checkUpdate();
	}
	function checkUpdate(){
		GM_xmlhttpRequest({
			method: 'GET',
			url: dpyqURL,
			headers: {
				'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36'
			},
			onload: (data)=>{
				let html = new DOMParser().parseFromString(data.responseText, "text/html");
				let info = {
					name: html.getElementsByClassName('gon_zai_li xoa_zai')[0].innerText,
					size: html.getElementsByClassName('gon_zai_li xoa_zai')[1].innerText,
					time: html.getElementsByClassName('gon_zai_li xoa_da')[0].innerText,
					link: html.getElementsByClassName('gon_zai_li xia_an')[0].parentNode.attributes.href.value
				}
				console.log(info);
				GM_setValue('dpyqTime', checkTime);
				if ( !GM_getValue('dpyqInfo') || info.time !== GM_getValue('dpyqInfo').time ) {
					GM_setValue('dpyqInfo', info);
					let noti = {
						title: '检测到MITE:打破一切有更新!',
						text: `${info.name}\n${info.size}\n${info.time}`,
						image: 'https://www.mitedpyq.com/uploads/img/20210404/66e55b1bc7417ba57a997ad81e439256.png'
					}
					GM_notification(noti, ()=>GM_openInTab(dpyqURL, {active: true}));
				}
			}
		});
	}
})();