MooMoo.io Click Through Store

Click Through Store

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         MooMoo.io Click Through Store
// @description  Click Through Store
// @author       KOOKY WARRIOR
// @icon         https://moomoo.io/img/favicon.png?v=1
// @match        *://*.moomoo.io/*
// @run-at       document-start
// @grant        unsafeWindow
// @license      MIT
// @version      0.5
// @namespace    https://greasyfork.org/users/999838
// ==/UserScript==

;(() => {
	unsafeWindow.clickThroughStore = true

	const checkTrustedSymbol = Symbol("checkTrusted")
	Object.defineProperty(Object.prototype, "checkTrusted", {
		get() {
			return this[checkTrustedSymbol]
		},
		set() {
			delete Object.prototype.checkTrusted
			this.checkTrusted = (e) => e
		},
		configurable: true
	})

	unsafeWindow.addEventListener("DOMContentLoaded", () => {
		unsafeWindow.addEventListener("contextmenu", (e) => e.preventDefault())

		unsafeWindow.addEventListener("mousedown", (event) => {
			if (
				event.target?.className == "storeItem" ||
				(event.target?.className != "joinAlBtn" &&
					event.target?.parentElement?.className == "storeItem")
			) {
				document.getElementById("touch-controls-fullscreen").dispatchEvent(
					new MouseEvent("mousedown", {
						button: event.button
					})
				)
			}
		})

		unsafeWindow.addEventListener("mouseup", (event) => {
			if (
				event.target?.className == "storeItem" ||
				event.target?.parentElement?.className == "storeItem"
			) {
				document.getElementById("touch-controls-fullscreen").dispatchEvent(
					new MouseEvent("mouseup", {
						button: event.button
					})
				)
			}
		})

		unsafeWindow.addEventListener("mousemove", (event) => {
			document.getElementById("touch-controls-fullscreen").dispatchEvent(
				new MouseEvent("mousemove", {
					clientX: event.clientX,
					clientY: event.clientY
				})
			)
		})
	})
})()