bleutools

UI XHR

当前为 2022-03-10 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/441249/1026343/bleutools.js

function swalForInfo(satitle, satime, saposition) {
    return Swal.fire({
        title: satitle,
        position: saposition,
        showConfirmButton: false,
        timer: satime,
        customClass: {
            title: 'bleu_sa_title_min',
            popup: 'bleu_sa_popup_min'
        }
    })
}

function swalForUI(title, html, width) {
    return swal.fire({
        title: title,
        html: html,
        width: width,
        showConfirmButton: false,
        showCloseButton: true,
        allowOutsideClick: false,
        footer: ' ',
        customClass: {
            title: 'bleu_sa_title',
            popup: 'bleu_sa_popup',
            closeButton: 'bleu_sa_close',
            htmlContainer: 'bleu_sa_container',
            footer: 'bleu_sa_footer'
        },
    })
}

function bleuXHR(TYPE, URL, DATA, HEADER, rtype) {
    return new Promise((resolve, reject) => {
        GM_xmlhttpRequest({
            method: TYPE,
            timeout: 2000,
            headers: HEADER || reqHeaders,
            url: URL,
            data: DATA,
            responseType: rtype || "json",
            onload: function (res) {
                resolve(res.response || res.responseText || res);
            },
            onerror: function (err) {
                reject(err);
            }
        });
    })
}

function addCssStyle(cssStyle) {
    if (cssStyle === undefined || cssStyle === null) cssStyle = '';
    let initStyle = `
            .bleu_sa_close {width: 30px;height: 30px;font-size: 30px;}
            .bleu_sa_title {font-size: 25px;}
            .bleu_sa_container{margin: 0;font-size: 20px;}
            .bleu_sa_popup {padding: 0 0 0;}
            .bleu_sa_footer{margin: 0;padding-top: 20px;}
            .bleu_sa_title_min{font-size: 20px;padding: 0;}
            .bleu_sa_popup_min{padding: 0 0 0;width: auto;}
            `
    let style = document.createElement('style');
    style.innerHTML = initStyle + cssStyle;
    document.querySelector('head').appendChild(style);
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址