-
Notifications
You must be signed in to change notification settings - Fork 3
/
memefi-web.user.js
43 lines (37 loc) · 1.58 KB
/
memefi-web.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// ==UserScript==
// @name MemeFI web
// @version 1.0
// @description Running TapSwap in a browser
// @author mudachyo
// @match https://tg-app.memefi.club/*
// @grant none
// @icon https://s2.coinmarketcap.com/static/img/coins/64x64/29373.png
// @downloadURL https://github.com/mudachyo/MemeFi-Coin/raw/main/memefi-web.user.js
// @updateURL https://github.com/mudachyo/MemeFi-Coin/raw/main/memefi-web.user.js
// @homepage https://github.com/mudachyo/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);
};
})();