DC - Digimobile

Let player to interact with digicode when browsing from touchscreen

当前为 2019-11-06 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         DC - Digimobile
// @namespace    http://tampermonkey.net/
// @version      0.8
// @description  Let player to interact with digicode when browsing from touchscreen
// @author       Ajira
// @match        https://www.dreadcast.net/Main
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // Trigger fix only if a dialogbox is popup
    document.getElementById("zone_lightBox").addEventListener('DOMNodeInserted', function() {
        // Check if the dialogbox contains a digicode input
        var digiInput = document.getElementById("lb_textinput_digicode");
        if (digiInput === null) { return; }
        // Search the parent form of the digicode
        var digiForm = digiInput.parentNode.parentNode;
        if (digiForm === null) { return; }
        // Search the dialogbox which contains the form
        var digiBox = digiForm.parentNode.parentNode;
        if (digiBox === null) { return; }
        // Disable draggable event which are in conflict with input click on mobile
        digiBox.addEventListener("touchstart", function (event) {
            event.stopPropagation();
        }, true);
    }, false);
})();