关闭宝塔离线弹窗错误

1111

// ==UserScript==
// @name         关闭宝塔离线弹窗错误
// @license      MIT
// @version      0.1
// @description  1111
// @author       111
// @match        http://192.215.140.41:8808/*
// @grant        111
// @namespace https://greasyfork.org/users/416601
// ==/UserScript==

(function() {
    'use strict';
    function removeDialog(shader, dialog) {

    shader.style.display = 'none'
    dialog.style.display = 'none'

    console.log(dialog.style.display)
    console.log(shader.style.display)
}


function checkDialog() {
    let shader = document.getElementsByClassName("layui-layer-shade")[0]
    let dialog = document.getElementsByClassName("layui-layer layui-layer-dialog  layer-anim")[0]

    if (shader && dialog) {
        console.log("出现,直接删除")
        removeDialog(shader, dialog)

        return true
    } else {
        return false;
    }
}

let count = 3


let timer = setInterval(() => {
    if (count > 0 ) {
        console.log("检查一次:"+checkDialog())
    } else {

        console.log("结束")
        clearInterval(timer)
    }
    count--
}, 200)

})();