您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Notification script for NFT Panda
// ==UserScript== // @name NFT Panda Notifications // @namespace http://tampermonkey.net/ // @version 0.4 // @description Notification script for NFT Panda // @author Xortrox // @match https://game.nftpanda.space/* // @icon https://www.google.com/s2/favicons?domain=cryptureworld.com // @grant none // @license MIT // ==/UserScript== (async function() { const icon = 'https://www.google.com/s2/favicons?domain=nftpanda.space'; const notifyTimerInterval = 60000; await hasPermission(); setInterval(() => { const notificationSpans = document.querySelectorAll('.one-slot span.button-name-in'); /** We send notification only once if any panda's are inactive */ if (notificationSpans && notificationSpans.length > 0) { for (let span of notificationSpans) { const text = span.innerText; if (text.toLowerCase().includes('send to adventure')) { notify('You have at least one ready hero'); break; } } } }, notifyTimerInterval); function notify(text) { hasPermission().then(function (result) { if (result === true) { let popup = new window.Notification('NFT PAnda', { body: text, icon: icon }); popup.onclick = function () { window.focus(); } } }); } function hasPermission() { return new Promise(function (resolve) { if ('Notification' in window) { if (window.Notification.permission === 'granted') { resolve(true); } else { window.Notification.requestPermission().then(function (permission) { if (permission === 'granted') { resolve(true); } else { resolve(false); } }); } } else { resolve(true); } }); } })();