Mildom layout deformer

It change Mildom's layout.(ミルダムのレイアウトを変えます)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Mildom layout deformer
// @namespace    Mildom layout deformer
// @version      0.5
// @description  It change Mildom's layout.(ミルダムのレイアウトを変えます)
// @author       meguru
// @match        https://www.mildom.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function getEle(x) {
        const res1 = document.evaluate(x, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
        if (res1.snapshotLength < 1) {
            return null;
        }
        return res1.snapshotItem(0);
    }

    setTimeout(function() {
        console.log('-------- start tamper ------------');

        const chat = getEle('//*[@id="root"]/div/div/div[2]/div[2]/div[2]');
        if (!chat) {
            console.log('not found chat');
            return;
        }
        chat.style.position = 'absolute';
        chat.style.top = '55%';
        chat.style.height = '45%';

        const chatHeader = getEle('//*[@id="root"]/div/div/div[2]/div[2]/div[2]/div[2]/div[1]');
        if (!chatHeader) {
            console.log('not found chat header');
            return;
        }
        chatHeader.style.display = 'none';

        const premiumComment = getEle('//*[@id="root"]/div/div/div[2]/div[2]/div[2]/div[2]/div[2]');
        if (!premiumComment) {
            console.log('not found premium comment');
            return;
        }
        premiumComment.style.display = 'none';

        const chatBody = getEle('//*[@id="root"]/div/div/div[2]/div[2]/div[2]/div[2]');
        if (!chatBody) {
            console.log('not found chatBody');
            return;
        }
        chatBody.style.paddingTop = '0px';

        const stamp = getEle('//*[@id="root"]/div/div/div[2]/div[2]/div[1]/div/div[2]/div[2]');
        if (!stamp) {
            console.log('not found stamp');
            return;
        }
        const streamerHeader = getEle('//*[@id="root"]/div/div/div[2]/div[2]/div[1]/div/div[1]');
        if (!streamerHeader) {
            console.log('not found streamerHeader');
            return;
        }
        stamp.parentNode.insertBefore(streamerHeader, stamp);

        console.log('--------- end tamper -------------');
    }, 3000);

})();