Unblock GameModels3D

2020/6/28 15:39:04

当前为 2021-08-04 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Unblock GameModels3D
// @namespace   Violentmonkey Scripts
// @match       *://gamemodels3d.com/*
// @grant       none
// @version     1.7
// @author      WengH
// @run-at      document-idle
// @description 2020/6/28 15:39:04
// ==/UserScript==

(function () {
    if (typeof viewer !== 'undefined') {
        viewer.saveButton.onclick = function () {
            self.saveModel(document.title.split(':')[0].trim())
        }
    }

    if (typeof loginForm !== 'undefined') {
        const _loginForm = loginForm;
        loginForm = function (a, b) {
            console.log(a, b);

            if (a === undefined && b === undefined) {
                _loginForm();
            }

            else if (['visual', 'armor', 'hitbox'].includes(a))
                go(a);

            else if (b !== undefined)
                SetModule(a, b);

            else if (a in VIEW.components)
                CONTROLLER.setComponents(a);

            else if (a in VIEW.characteristics)
                CONTROLLER.setCharacteristics(a);

            else if (a instanceof PointerEvent)
                CONTROLLER.setModule();
        }
    }

    if (typeof ELEMENTS !== 'undefined') {
        let isFirst = true;
        ELEMENTS.openModalDialog = function (params) {
            console.log(params)
            if (params.id === "LoginDialog" && isFirst) {
                isFirst = false;
                return;
            }
            params.type = "modaldialog";
            ELEMENTS.open(params);
        }
    }

    function fixModules() {
        document.querySelectorAll('.button.unit-item').forEach(x => {
            x.onclick = CONTROLLER.setModule;
            x.addEventListener('click', fixModules);
        });
    }

    fixModules();
})();