wf.xuerian.net Wishlist Fix

Fixes localization issues forcing English properly

// ==UserScript==
// @name         wf.xuerian.net Wishlist Fix
// @namespace    http://tampermonkey.net/
// @version      3.0
// @description  Fixes localization issues forcing English properly
// @match        https://wf.xuerian.net/*
// @grant        none
// @run-at       document-end
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    setTimeout(() => {
        if (document._L) {

            const L = {
                "en-US": document._L,
                [navigator.language]: document._L
            };

            Object.defineProperty(document, 'L', {
                configurable: true,
                get: () => L,
                set: () => {}
            });


            Object.defineProperty(window, 'L', {
                configurable: true,
                get: () => L,
                set: () => {}
            });

            onTokenDataUpdate()
            setTab(tabFromUrl())

            console.log("Localization fixed");
        } else {
            console.warn("document._L not found");
        }
    }, 1000);
})();