auto restart level (gpop.io)

auto restarts your gpop.io levels

作者
oliver (Marvin)
今日安裝
0
安裝總數
0
評價
0 0 0
版本
v1.0.0
建立日期
2025-10-10
更新日期
2025-10-10
尺寸
1.0 KB
授權條款
MIT
腳本執行於

// ==UserScript==
// @name Gpop.io Auto Submit to Leaderboard
// @namespace http://tampermonkey.net/
// @version v2.03
// @author pandy
// @match https://gpop.io/play/*
// @grant none
// @run-at document-idle
// @license MIT
// ==/UserScript==

(function () {
'use strict';

// --- CONFIG ---
// Try a list of selectors that might match the "send to leaderboard" button.
// Edit/add selectors if the site uses different classes/IDs.
const CANDIDATE_SELECTORS = [
'button.submit-score',
'button#submitScoreBtn',
'button[data-action="submit-score"]',
'button[data-action="send-score"]',
'button.leaderboard-submit',
'button:contains("send")', // note: :contains may not work in querySelector; kept as hint
'button' // last-resort: check all buttons
];

// How many times to attempt clicking (some flows need multiple clicks/confirmations)
const MAX_CLICK_ATTEMPTS = 3;
// Delay between click attempts (ms)
const CLICK_RETRY_DELAY = 450;

// Optional: custom logic to test eligibility.
// Return true if we should click the provided button element.
function isButtonEligible(btn) {
if (!btn) return false;
// Visible?
if (btn.offsetParent === null && btn.getClientRects().length === 0) return false;
// Disabled attribute?
if (btn.disabled) return false;
if (btn.getAttribute && btn.getAttribute('aria-disabled') === 'true') return false;
// If the button has a data-eligible flag, respect that if present
const de = btn.getAttribute && btn.getAttribute('data-eligible');
if (de === 'false') return false;
// Heuristic: text likely contains 'leader', 'submit', 'score', or 'send'
const txt = (btn.innerText || btn.textContent || '').toLowerCase();
if (txt.includes('leader') || txt.includes('submit') || txt.includes('score') || txt.includes('send')) {
return true;
}
// If selector matched an obvious class/id above, it's ok; otherwise, be conservative
return false;
}

// Click helper that retries a few times (in case UI needs confirm)
function clickWithRetries(btn, attempts = 0) {
if (!btn || attempts >= MAX_CLICK_ATTEMPTS) return;
try {
btn.click();
console.log(`Auto-leaderboard: clicked attempt #${attempts + 1}`);
} catch (e) {
console.warn('Auto-leaderboard: click failed', e);
}
// Try again after a short delay in case confirmation is needed
setTimeout(() => {
// If the button still exists & seems clickable, try again one more time
if (attempts + 1 < MAX_CLICK_ATTEMPTS && isButtonEligible(btn)) {
clickWithRetries(btn, at

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址