您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
修改绝地求生简体中文兑换网页,使兑换错误不会出现倒计时
当前为
// ==UserScript== // @name PUBG网页兑换cdk解除倒计时限制 // @namespace http://tampermonkey.net/ // @version 2.1 // @description 修改绝地求生简体中文兑换网页,使兑换错误不会出现倒计时 // @author L // @match https://pubg.com/zh-cn/events/redeem // @license MIT // @grant none // ==/UserScript== (function() { 'use strict'; window.addEventListener('load', () => { const originalFetch = window.fetch; window.fetch = function(...args) { if (args[0].includes('https://api-foc.krafton.com/redeem/v3/register') && args[1]?.method === 'POST') { return originalFetch(...args).then(response => { if (response.status !== 200) { return response.json().then(data => { const errorCode = data.code || '未知错误'; const errorMessage = data.message || '发生未知错误'; // 修改弹窗内容 modifyAlertContent(`这是经过脚本篡改的,并没有兑换成功。错误代码:${errorCode},错误信息:${errorMessage}`); // 返回篡改后的响应 return new Response( JSON.stringify({ message: '兑换码已成功注册(不可用)!' }), { status: 200, headers: { 'Content-Type': 'application/json' } } ); }); } return response; }); } return originalFetch(...args); }; const originalXhrOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(method, url) { this._url = url; return originalXhrOpen.apply(this, arguments); }; const originalXhrSend = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.send = function() { const xhr = this; const checkResponse = function() { if (xhr.readyState === 4 && xhr.status !== 200) { const responseData = JSON.parse(xhr.responseText); const errorCode = responseData.code || '未知错误'; const errorMessage = responseData.message || '发生未知错误'; Object.defineProperty(xhr, 'status', { value: 200 }); Object.defineProperty(xhr, 'responseText', { value: JSON.stringify({ message: '兑换码已成功注册(不可用)!' }) }); // 修改弹窗内容 modifyAlertContent(`这是经过脚本篡改的,并没有兑换成功。错误代码:${errorCode},错误信息:${errorMessage}`); } }; this.addEventListener('readystatechange', checkResponse); return originalXhrSend.apply(this, arguments); }; }); function modifyAlertContent(message) { const alertModal = document.querySelector('.alert.modal__component.only-title'); if (alertModal) { const titleElement = alertModal.querySelector('.alert__title span'); if (titleElement) { titleElement.textContent = message; // 修改内容 } } else { const observer = new MutationObserver(() => { const newAlertModal = document.querySelector('.alert.modal__component.only-title'); if (newAlertModal) { modifyAlertContent(message); observer.disconnect(); // 停止观察 } }); observer.observe(document.body, { childList: true, subtree: true }); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址