// ==UserScript== // @name 打地鼠自定义分数 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 只在ads_mole.php显示面板,修改ads_api.php的score // @author assistant // @match *://718zf.xyz/ads_mole.php // @match *://718zf.xyz/ads_api.php // @grant none // @run-at document-start // ==/UserScript== (function() { 'use strict'; // 自定义分数 window.CUSTOM_SCORE = '100'; // 只在 ads_mole.php 显示面板 if (location.pathname === '/ads_mole.php') { function createPanel() { const panel = document.createElement('div'); panel.style.position = 'fixed'; panel.style.top = '20px'; panel.style.right = '20px'; panel.style.padding = '10px 15px'; panel.style.background = '#fff'; panel.style.border = '1px solid #ccc'; panel.style.borderRadius = '8px'; panel.style.zIndex = '999999'; panel.style.boxShadow = '0 0 10px rgba(0,0,0,0.3)'; panel.style.display = 'flex'; panel.style.gap = '8px'; panel.style.alignItems = 'center'; const label = document.createElement('span'); label.textContent = '分数:'; label.style.fontSize = '14px'; const input = document.createElement('input'); input.type = 'number'; input.value = window.CUSTOM_SCORE; input.style.padding = '4px 8px'; input.style.width = '80px'; input.addEventListener('input', () => { window.CUSTOM_SCORE = input.value.trim(); }); panel.appendChild(label); panel.appendChild(input); document.body.appendChild(panel); } window.addEventListener('DOMContentLoaded', createPanel); } // 拦截提交接口 const origOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(method, url) { this._targetUrl = url; origOpen.apply(this, arguments); }; const origSend = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.send = function(data) { const url = this._targetUrl || ''; // 拦截 ads_api.php 并修改 score if (url.includes('ads_api.php')) { const score = window.CUSTOM_SCORE || '100'; // 处理 FormData if (data instanceof FormData) { data.set('score', score); } // 处理普通字符串表单 else if (typeof data === 'string' && data.includes('score=')) { data = data.replace(/score=\d+/g, `score=${score}`); } } origSend.call(this, data); }; })();