MemeFI web

Running TapSwap in a browser

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/511452/1459040/MemeFI%20web.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         MemeFI web
// @version      1.0
// @description  Running TapSwap in a browser
// @author       amir-homous
// @match        https://tg-app.memefi.club/*
// @grant        none
// @icon         https://s2.coinmarketcap.com/static/img/coins/64x64/29373.png
// @downloadURL  https://github.com/amir-homous/MemeFi-Coin/raw/main/memefi-web.user.js
// @updateURL    https://github.com/amir-homous/MemeFi-Coin/raw/main/memefi-web.user.js
// @homepage     https://github.com/amir-homous/MemeFi-Coin
// ==/UserScript==

(function() {
    'use strict';

    const originalUrl = 'https://telegram.org/js/telegram-web-app.js';
    const newUrl = 'https://ktnff.tech/universal/telegram-web-app.js';

    // Create a MutationObserver to watch for script tags being added to the DOM
    const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            mutation.addedNodes.forEach((node) => {
                if (node.tagName === 'SCRIPT' && node.src === originalUrl) {
                    node.src = newUrl;
                }
            });
        });
    });

    // Start observing the document for script tags being added
    observer.observe(document.documentElement, { childList: true, subtree: true });

    // Override the appendChild method to replace the script URL
    const originalAppendChild = Node.prototype.appendChild;
    Node.prototype.appendChild = function(child) {
        if (child.tagName === 'SCRIPT' && child.src === originalUrl) {
            child.src = newUrl;
        }
        return originalAppendChild.call(this, child);
    };

})();