Spelling Bee Unblocker

Removes NYT Spelling Bee unregistered user rank Limit

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Spelling Bee Unblocker
// @namespace    http://tampermonkey.net/
// @version      0.02
// @description  Removes NYT Spelling Bee unregistered user rank Limit
// @author       You
// @match        https://www.nytimes.com/puzzles/spelling-bee
// @match        https://www.nytimes.com/puzzles/spelling-bee/*
// @match        https://www.nytimes.com/puzzles/spelling-bee*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nytimes.com
// @grant        unsafeWindow
// @run-at       document-start
// @license      MIT
// ==/UserScript==

const mockedResponse = {
    "hitPaywall": false,
    "counted": false,
    "loggedIn": false,
    "hash": "9E22265122E1FBC5FFC6AA815E33AF6D",
    "gateway": true,
    "meter": true,
    "isCookieValid": true,
    "gatewayExempt": true,
    "hitRegiwall": false,
    "regiwall": true,
    "v": 0,
    "t": 0,
    "hitSoftPaywall": false,
    "hitSoftRegiwall": false,
    "showGrowl": false,
    "nytsNeedsRefresh": false,
    "ab": [],
    "assetType": null,
    "version": "e8c9a38",
    "rulesVersion": "d0a9acf",
    "grantReason": "WHITELISTED",
    "granted": true,
    "gatewayType": "",
    "gatewayTypeVariation": "",
    "countable": false,
    "gatewayEligible": false,
    "section": "spelling_bee",
    "extraData": []
};

const origOpen = XMLHttpRequest.prototype.open;
const origSend = XMLHttpRequest.prototype.send;

XMLHttpRequest.prototype.open = function(method, url, async, user, password) {
    this._url = url;
    origOpen.call(this, method, url, async, user, password);
};

XMLHttpRequest.prototype.send = function(body) {
    this.addEventListener('readystatechange', function() {
        if (this.readyState === 4 && this._url.includes("/meter.js?sourceApp=Games-web&url=https://www.nytimes.com/puzzles/spelling-bee")) {
            const mockedText = JSON.stringify(mockedResponse);
            Object.defineProperty(this, 'responseText', { value: mockedText });
            Object.defineProperty(this, 'response', { value: mockedText });
            Object.defineProperty(this, 'status', { value: 200 });
            Object.defineProperty(this, 'statusText', { value: 'OK' });
        }
    });
    origSend.call(this, body);
};

console.log('Ready.');