kiic / 收藏站酷图片到Eagle

// ==UserScript==
// @name                收藏站酷图片到Eagle
// @version             0.3
// @description         收集图片到Eagle
// @namespace           http://tampermonkey.net/
// @match               http://localhost:41595*
// @match               www.zcool.com.cn/work/*
// @match               *://kiic.top/*
// @connect             http://localhost:41595
// @connect             127.0.0.1:41595
// @connect             kiic.top
// @icon                https://cos.kiic.top/_APP__SDK/taobaozhushuo-icon.png
// @grant               GM_setValue
// @grant               GM_getValue
// @grant               unsafeWindow
// @grant               GM_listValues
// @grant               GM_addValueChangeListener
// @grant               GM_registerMenuCommand
// @grant               GM_unregisterMenuCommand
// @connect             *
// @compatible          chrome
// @compatible          edge
// @license             MIT
// @run-at              document-body
// @require             https://cdn.bootcdn.net/ajax/libs/nprogress/0.2.0/nprogress.min.js
// @RequireNote         涓流进度条
// @require             https://cdn.bootcdn.net/ajax/libs/zepto/1.2.0/zepto.min.js
// @RequireNote         jq方法精简版
// @require             https://greasyfork.org/scripts/430351-eagle%E4%BA%A4%E4%BA%92%E8%84%9A%E6%9C%AC/code/Eagle%E4%BA%A4%E4%BA%92%E8%84%9A%E6%9C%AC.js?version=957317
// @RequireNote         EagleAPI封装
// @namespace           https://greasyfork.org/users/710095
// @date                2022/4/14
// ==/UserScript==
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
;
~(function () {
    return __awaiter(this, void 0, void 0, function* () {
        let APIPreset = {
            /**所有需要加载CSS都会在这里压入 */
            "CSS": ["https://cdn.bootcdn.net/ajax/libs/nprogress/0.2.0/nprogress.css",],
            /**Eagle唤醒 */
            "OpenEagle": "eagle:\/\/"
        };
        function SetObjectValue(target, key, newValue) {
            return Object.defineProperty(target, key, { value: newValue, writable: true, enumerable: true, configurable: true });
        }
        function GetObjectValue(target, key) {
            var _a;
            return ((_a = Object.getOwnPropertyDescriptor(target, key)) === null || _a === void 0 ? void 0 : _a.value) || undefined;
        }
        let Store = (function () {
            class Store {
                constructor() {
                    this._data = {};
                    let StoreClassThis = this;
                    this._data = this.Get();
                    // 对本脚本设置数据变化进行实时监听
                    for (const on_key of GM_listValues()) {
                        this.on(on_key, function (key, OidValue, NewValue, remote) {
                            SetObjectValue(StoreClassThis._data, key, NewValue);
                        });
                    }
                }
                get data() {
                    return this._data;
                }
                Get(KeyName, defaultValue) {
                    if (typeof KeyName == "undefined") {
                        let StoreData = {};
                        for (const key of GM_listValues()) {
                            SetObjectValue(StoreData, key, GM_getValue(key));
                        }
                        return StoreData;
                    }
                    if (KeyName != undefined)
                        return GM_getValue(KeyName, defaultValue);
                }
                remove(KeyName) {
                    return GM_deleteValue(KeyName);
                }
                on(key, Callback) {
                    let StoreClassThis = this;
                    return GM_addValueChangeListener(key, function (...a) {
                        Callback.apply(StoreClassThis._data, a);
                    });
                }
                Set(name, value) {
                    return GM_setValue(name, value);
                }
            }
            return new Store();
        })();
        //注销了脚本
        if (Store.Get("User_OFF_Script")) {
            return;
        }
        ;
        GM_registerMenuCommand(typeof Store.Get("User_OFF_Script") === "boolean" && Store.Get("User_OFF_Script") === false ? "撤销用户协议" : "重置用户协议", function (MouseEvent) {
            Store.Set("User_OFF_Script", undefined);
            alert("已撤销用户协议 点击主要模块后将重新询问您");
        });
        /**
         *  代码阻塞
         *
         * @param {*} ms 毫秒
         * @return undefined
         * 调用: await this._Sleep(500);
         */
        function Sleep(ms) {
            return new Promise((resolve) => setTimeout(resolve, ms));
        }
        /**顺序数值编号器 参数:开始数字,位数(2=01,3=001) */
        function MIU_NUM(num, n) {
            return (Array(n).join(String(0)) + num).slice(-n);
        }
        /**
    * 添加CSS代码/CSS链接
    * @param Code 代码或者链接/或者数组(多个代码)
    * @param LinkMode 是否以href链接方式写入
    */
        function AddStyle(Code, LinkMode) {
            let Head = document.querySelector('head');
            function AddAdjStyle(Code) {
                if (!LinkMode) {
                    let NewElement = document.createElement('style');
                    NewElement.setAttribute("type", "text/css");
                    NewElement.setAttribute("Signer", "Kiic");
                    Head === null || Head === void 0 ? void 0 : Head.appendChild(NewElement);
                    return NewElement;
                }
                let NewElement = document.createElement('link');
                NewElement.setAttribute("rel", "stylesheet");
                NewElement.setAttribute("href", Code);
                NewElement.setAttribute("type", "text/css");
                Head === null || Head === void 0 ? void 0 : Head.appendChild(NewElement);
                return NewElement;
            }
            if (Code instanceof String)
                return AddAdjStyle(String(Code));
            let RunElementList = [];
            if (Code instanceof Array || Code instanceof Set) {
                for (const ForCode of Code) {
                    RunElementList.push(AddAdjStyle(ForCode));
                }
            }
            if (Code instanceof Array)
                return RunElementList;
            if (Code instanceof Set)
                return new Set(RunElementList);
        }
        function IsDef(value) {
            return typeof value == "undefined" && value !== null;
        }
        // 防抖节流
        const shake = {
            Data: new Set(),
            /**
             * 到期后自动删除 如果被添加将会返回true
             * - 使用方法: if (shake.isset("scroll", 1500)) return;
             * @param key 防抖的名称
             * @param time 毫秒
             * @return {boolean}
             */
            isset(key, time = 1200) {
                if (this.Data.has(key))
                    return true;
                this.Data.add(key);
                time && setTimeout(() => this.Data.delete(key), time);
                return false;
            },
        };
        /**脚本主界面 */
        class ClassAPP_Main {
            constructor() {
                let UI = {
                    ICON() {
                        return "https://cos.kiic.top/_APP__SDK/taobaozhushuo-icon.svg";
                    },
                    /**主界面 */
                    Main: () => `<div HM-ScriptMain id="_K9V7O30D4GHO7_HM_ScriptMain_APP">\n    <div class="ScriptMain-box">\n     <div class="shadow"></div>\n     <img class="Center" src="${UI.ICON()}">\n    </div>\n </div>\n \n <style>\n     [HM-ScriptMain]#_K9V7O30D4GHO7_HM_ScriptMain_APP {\n         position: fixed;\n         right: 3.5em;\n         bottom: 5em;\n         width: 50px;\n         height: 50px;\n         background-color: rgb(255, 255, 255);\n         z-index: 9999999999999999999999;\n         cursor: pointer;\n         overflow: hidden;\n         border-radius: 50px;\n \n     }\n \n     [HM-ScriptMain] .ScriptMain-box{\n         position: relative;\n         width: 100%;\n         height: 100%;\n     }\n     [HM-ScriptMain] .shadow {\n         width: 50px;\n         height: 50px;\n         left: 0px;\n         right: 0px;\n         position: absolute;\n     }\n \n     [HM-ScriptMain]#_K9V7O30D4GHO7_HM_ScriptMain_APP * {\n         margin: 0;\n         padding: 0;\n     }\n \n     [HM-ScriptMain] .Center {\n         display: grid;\n         align-content: center;\n         justify-content: center;\n         align-items: center;\n     }\n \n     [HM-ScriptMain] img {\n         width: 100%;\n         height: auto;\n \n     }\n \n     [HM-ScriptMain] * {\n         -webkit-user-drag: none;\n         user-select: none;\n     }\n \n     [HM-ScriptMain]#_K9V7O30D4GHO7_HM_ScriptMain_APP:hover{\n         width: 55px;\n         height: 55px;\n         right: 3.2em;\n         bottom: 4.6em;\n     }\n \n     [HM-ScriptMain] .shadow:active {\n         width: 55px;\n         height: 55px;\n         box-shadow: inset 0px 3px 6px rgba(0, 0, 0, 0.43);\n         border-radius: 50px;\n \n     }\n </style>`,
                };
                AddStyle(`#nprogress .bar {background: #29d;position: fixed;z-index: 999999999999999999999999;top: 0;left: 0;width: 100%;height: 2px;}`);
                // AddStyle(APIPreset.CSS, true);
                // 添加按钮到页面
                let WinMain = $("body");
                let APPMain = $(UI.Main());
                WinMain.append(APPMain);
                this.Main = APPMain;
            }
            API_Failure() {
                return __awaiter(this, void 0, void 0, function* () {
                    return new Promise(((resolve, reject) => {
                        let Add_HTML_Mian = $("body");
                        let AgreementMain = $(`<div id="HM_API_Failure_K9D546DPG">\n                <div id="InfoFrame">\n                    \x3C!-- 左上角关闭按钮 -->\n                    <div class="Menu">\n                        <svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" fill-opacity=".01" d="M0 0h48v48H0z"/><path d="M14 14l20 20M14 34l20-20" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>\n                    </div>\n                    <div class="HM-TextMain">\n                        <h1>无法连接API</h1>\n                        <a>已经对API发送了处理的请求</a>\n                        <a>但是API并未返回处理结果</a>\n                        <a></br></a>\n                        <a>您可以检查以下内容</a>\n                        <a>①检查Eagle软件是否已经启动</a>\n                        <a>②已允许脚本链接网络(需要连接EagleAPI)</a>\n                        <a>③依然失败则重启Eagle</a>\n                        <a>④检查脚本是否是最新版本</a>\n                    </div>\n                    <div class="HM-info-images">\n                        <img src="https://cos.kiic.top/_APP__SDK/ScriptsAPP/404_Error.svg">\n                    </div>\n                    <div class="HMbutton" >\n                        <cii>尝试唤醒</cii>\n                    </div>\n            \n                </div>\n            \n                <style>\n                    #HM_API_Failure_K9D546DPG {\n                        backdrop-filter: blur(2px);\n                        top: 0px;\n                        left: 0px;\n                        animation: prompt_boxMainBackkk 0.5s;\n                        width: 100vw;\n                        height: 100vh;\n                        position: fixed;\n                        z-index: 999999999999999;\n                        display: flex;\n                        align-content: center;\n                        justify-content: center;\n                        align-items: center;\n                    }\n            \n                    #HM_API_Failure_K9D546DPG a {\n                        text-decoration: none;\n                        font-family: auto;\n                    }\n            \n                    #HM_API_Failure_K9D546DPG h1,\n                    h2,\n                    h3,\n                    h4,\n                    h5,\n                    h6 {\n                        font-size: 200%;\n                        font-weight: normal;\n                        font-family: auto;\n                    }\n            \n                    #HM_API_Failure_K9D546DPG * {\n                        -webkit-user-drag: none;\n                        user-select: none;\n                    }\n            \n                    @keyframes prompt_boxMainBackkk {\n                        0% {\n                            backdrop-filter: blur(0.2px);\n                            opacity: 0.25;\n                        }\n            \n                        25% {\n                            backdrop-filter: blur(0.5px);\n                            opacity: 0.5;\n                        }\n            \n                        50% {\n                            backdrop-filter: blur(1px);\n                            opacity: 1;\n                        }\n            \n                        100% {\n                            backdrop-filter: blur(2px);\n                            opacity: 1;\n                        }\n                    }\n            \n                    #HM_API_Failure_K9D546DPG  #InfoFrame {\n                        border-radius: 40px;\n                        overflow: hidden;\n                        background: linear-gradient(131.46deg, #f6f7fb 2.97%, rgb(246 247 251) 150.02%);\n                        box-shadow: 0px 2px 27px rgb(25 32 56 / 9%);\n                        height: 423px;\n                        width: 534px;\n                        position: relative;\n                        z-index: 99999;\n                    }\n            \n                    #HM_API_Failure_K9D546DPG  .Menu {\n                        background: #0000;\n                        position: absolute;\n                        width: 24px;\n                        height: 24px;\n                        right: 25px;\n                        top: 25px;\n                        border: 1px solid #7E8C95;\n                        border-radius: 15px;\n                        display: flex;\n                        flex-direction: row;\n                        align-content: center;\n                        justify-content: center;\n                        align-items: center;\n                        z-index: 100000;\n                    }\n            \n                    #HM_API_Failure_K9D546DPG  .Menu:hover {\n                        cursor: pointer;\n                        border: 1px solid #505b62;\n                    }\n                    #HM_API_Failure_K9D546DPG  .HM-TextMain h1{\n                        padding-bottom: 30px;\n                    }\n                    #HM_API_Failure_K9D546DPG  .HM-TextMain {\n                        position: absolute;\n                        width: 282px;\n                        height: 92px;\n                        left: 42px;\n                        top: 75px;\n                        font-family: 'Roboto';\n                        font-style: normal;\n                        font-weight: 500;\n                        font-size: 14px;\n                        line-height: 15px;\n                        color: #1C3177;\n                        display: flex;\n                        flex-direction: column;\n                        align-content: flex-start;\n                        align-items: flex-start;\n                    }\n            \n                    #HM_API_Failure_K9D546DPG  .HM-TextMain a {\n                        padding: 3.9px;\n                    }\n            \n                    #HM_API_Failure_K9D546DPG  .HM-info-images {\n                        width: 230px;\n                        height: 230px;\n                        position: absolute;\n                        top: 11%;\n                        right: 5%\n                    }\n            \n                    #HM_API_Failure_K9D546DPG  .HM-info-images img {\n                        width: 100%;\n                        height: 100%;\n                        object-fit: cover;\n                    }\n            \n                    #HM_API_Failure_K9D546DPG  .HMbutton:hover {\n                        transform: scale(1.15)\n                    }\n            \n                    #HM_API_Failure_K9D546DPG  .HMbutton {\n                        position: absolute;\n                        z-index: 999999;\n                        background: linear-gradient(274.42deg, #92A3FD 0%, #9DCEFF 124.45%);\n                        border-radius: 86.8684px;\n                        width: 115px;\n                        height: 40px;\n                        color: white;\n                        letter-spacing: 0.06em;\n                        font-size: 17px;\n                        border-width: 0px;\n                        cursor: pointer;\n                        bottom: 116px;\n                        right: 68px;\n                        display: flex;\n                        align-items: center;\n                        justify-content: center;\n                        align-content: center;\n                        font-family: auto;\n                    }\n                </style>\n                        </div>`);
                        let CloseMenu = AgreementMain.find("div.Menu");
                        let OpenEagleMenu = AgreementMain.find(".HMbutton");
                        CloseMenu.one("click", function () {
                            AgreementMain.get()[0].remove();
                            reject();
                        });
                        OpenEagleMenu.one("click", function () {
                            unsafeWindow.open(APIPreset.OpenEagle);
                            AgreementMain.get()[0].remove();
                            resolve();
                        });
                        Add_HTML_Mian.append(AgreementMain);
                    }));
                });
            }
            /**用户协议 */
            Agreement() {
                return __awaiter(this, void 0, void 0, function* () {
                    return new Promise(function (resolve, reject) {
                        return __awaiter(this, void 0, void 0, function* () {
                            let User_OFF_Script = Store.Get("User_OFF_Script");
                            if ((typeof User_OFF_Script === "boolean") && User_OFF_Script === true)
                                return reject();
                            if ((typeof User_OFF_Script === "boolean") && User_OFF_Script === false)
                                return resolve();
                            function ShowAgreement() {
                                return new Promise(function (resolve, reject) {
                                    return __awaiter(this, void 0, void 0, function* () {
                                        let Add_HTML_Mian = $("body");
                                        let AgreementMain = $('<div style="display: block;" id="HM_news_-UserAgreement_____Mian">\n    <div style="position: fixed; max-width: 0.1px; max-height: 0.1px; overflow: hidden;top: 900vh;left: 900vw;">\n        \x3C!-- 导入图片 -->\n        <img src="https://cos.kiic.top/_APP__SDK/ScriptsAPP/FirstUse_TextMain_UserAgreement_background%40Text.svg">\n        <img src="https://cos.kiic.top/_APP__SDK/ScriptsAPP/FirstUse_TextMain_UserAgreement_background.svg">\n    </div>\n    <div class="prompt_boxMain_Center">\n        <div class="prompt_Main">\n            \x3C!-- 左上角关闭按钮 -->\n            <div class="Menu">\n                <svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n                    <rect width="48" height="48" fill="white" fill-opacity="0.01"></rect>\n                    <path d="M14 14L34 34" stroke="#333" stroke-width="4" stroke-linecap="round"\n                        stroke-linejoin="round"></path>\n                    <path d="M14 34L34 14" stroke="#333" stroke-width="4" stroke-linecap="round"\n                        stroke-linejoin="round"></path>\n                </svg>\n            </div>\n            <div class="NextMenu_Default">\n                <cii>下一步</cii>\n            </div>\n            <div class="prompt_boxBox_Main">\n                <div id="FirstUse">\n                    <div class="FirstUse_TextMain">\n                        <h1>欢迎使用!</h1>\n                        <a>这是您第一次试用</a>\n                        <a>为了您更加清楚插件用途</a>\n                        <a>您需要阅读并且同意用户协议</a>\n                        <a>我们仅会询问一次</a>\n                        <a>当您关闭此协议我们将不再启用脚本</a>\n                        <a>第一次使用该版本也会收到该消息</a>\n                    </div>\n                    <img style="margin: 15px 0 0 0;" alt="欢迎使用.svg" id="FirstUse"\n                        src="https://cos.kiic.top/_APP__SDK/ScriptsAPP/FirstUse_TextMain_UserAgreement_background.svg">\n                </div>\n                <div id="FirstUse_Next" style="display: none;">\n                    <div class="study">\n                        <img\n                            src="https://cos.kiic.top/_APP__SDK/ScriptsAPP/FirstUse_TextMain_UserAgreement_background%40Text.svg">\n                    </div>\n                    <div class="FirstUse_TextMain">\n                        <h1 style="font-size: 1.5em;">用户协议</h1>\n                        <a class="NextText_1">点击开始使用后则认为我同意以下内容</a>\n                        <a class="NextText_2">仅作为查看,学习,观赏图片用途</br>\n                            本脚本也作为学习使用</br>\n                            我将在稍后移除引用</br>\n                            我不会查看所属页面不提供的内容</br>\n                            在本网页关闭后我将移除引用</a>\n                        <a class="NextText_3">以下为名称解释:</a>\n                        <a class="NextText_4">我:用户或使用者,</br>\n                            引用:包含但不限于查看,保存,储存,展示</br>\n                            本站:当前域名当前网页包含但不限于相关页面</a>\n                    </div>\n                </div>\n            </div>\n\n        </div>\n        <style>\n            #HM_news_-UserAgreement_____Mian .NextMenu_Default {\n                position: absolute;\n                z-index: 999999;\n                background: linear-gradient(274.42deg, #92A3FD 0%, #9DCEFF 124.45%);\n                border-radius: 86.8684px;\n                width: 95px;\n                height: 40px;\n                color: white;\n                font-size: 17px;\n                border-width: 0px;\n                cursor: pointer;\n                bottom: 46px;\n                left: 40px;\n            }\n\n            #HM_news_-UserAgreement_____Mian .NextMenu {\n                position: absolute;\n                z-index: 999999;\n                bottom: 90px;\n                right: 70px;\n                background: linear-gradient(274.42deg, #92A3FD 0%, #9DCEFF 124.45%);\n                border-radius: 86.8684px;\n                width: 95px;\n                height: 40px;\n                color: white;\n                font-size: 17px;\n                border-width: 0px;\n                cursor: pointer;\n            }\n\n            #HM_news_-UserAgreement_____Mian h1,\n            h2,\n            h3,\n            h4,\n            h5,\n            h6 {\n                font-size: 200%;\n                font-weight: normal;\n                font-family: auto;\n            }\n\n            #HM_news_-UserAgreement_____Mian a {\n                text-decoration: none;\n                font-family: auto;\n            }\n\n            #HM_news_-UserAgreement_____Mian #FirstUse_Next a,\n            h1 {\n                color: #4A707A;\n            }\n\n            #HM_news_-UserAgreement_____Mian .FirstUse_TextMain {\n                display: flex;\n                flex-direction: column;\n                align-items: flex-start;\n            }\n\n            #HM_news_-UserAgreement_____Mian .NextText_1 {\n                font-size: 14px;\n                text-decoration-line: underline;\n                height: 1;\n            }\n\n            #HM_news_-UserAgreement_____Mian .NextText_2 {\n                font-size: 13px;\n                padding-top: 30px;\n            }\n\n            #HM_news_-UserAgreement_____Mian .NextText_3 {\n                font-size: 13px;\n                padding-top: 30px;\n            }\n\n            #HM_news_-UserAgreement_____Mian .NextText_4 {\n                font-size: 11px;\n                padding-top: 7px;\n            }\n\n            #HM_news_-UserAgreement_____Mian #FirstUse_Next>div.FirstUse_TextMain a {\n                line-height: 175%;\n            }\n\n            #HM_news_-UserAgreement_____Mian .FirstUse_TextMain {\n                position: absolute;\n                top: 50px;\n                left: 50px;\n            }\n\n            #HM_news_-UserAgreement_____Mian #FirstUse_Next .study {\n                width: 100px;\n                height: 100px;\n                position: absolute;\n                right: 150px;\n                top: 60px;\n            }\n\n            #HM_news_-UserAgreement_____Mian #FirstUse .FirstUse_TextMain {\n                color: rgb(28, 49, 119);\n                display: flex;\n                flex-direction: column;\n                justify-content: flex-start;\n                position: absolute;\n                left: 40px;\n                top: 57px;\n\n            }\n\n            #HM_news_-UserAgreement_____Mian #FirstUse h1 {\n                color: #1C3177;\n                padding-bottom: 20px;\n            }\n\n            #HM_news_-UserAgreement_____Mian #FirstUse .FirstUse_TextMain a {\n                font-size: 13px;\n                padding: 0 0 8px 0;\n            }\n\n            #HM_news_-UserAgreement_____Mian .NextMenu:hover,\n            .NextMenu_Default:hover {\n                transform: scale(1.15)\n            }\n\n            #HM_news_-UserAgreement_____Mian .prompt_boxMain_Center {\n                backdrop-filter: blur(2px);\n                top: 0px;\n                left: 0px;\n                animation: prompt_boxMainBackkk 0.5s;\n                width: 100vw;\n                height: 100vh;\n                position: fixed;\n                z-index: 999999999999999;\n                display: flex;\n                align-content: center;\n                justify-content: center;\n                align-items: center;\n            }\n\n            #HM_news_-UserAgreement_____Mian .prompt_boxMain_Center * {\n                -webkit-user-drag: none;\n                user-select: none;\n            }\n\n            #HM_news_-UserAgreement_____Mian .prompt_Main {\n                border-radius: 40px;\n                overflow: hidden;\n                background: linear-gradient(131.46deg, #f6f7fb 2.97%, rgb(246 247 251) 150.02%);\n                box-shadow: 0px 2px 27px rgb(25 32 56 / 9%);\n                height: 423px;\n                width: 534px;\n                position: relative;\n                z-index: 99999;\n            }\n\n            #HM_news_-UserAgreement_____Mian .NextMenu,\n            .NextMenu_Default {\n                display: grid;\n                justify-content: center;\n                align-items: center;\n            }\n\n            #HM_news_-UserAgreement_____Mian .prompt_boxMain_Center .Menu {\n                background: #0000;\n                position: absolute;\n                width: 24px;\n                height: 24px;\n                right: 25px;\n                top: 25px;\n                border: 1px solid #7E8C95;\n                border-radius: 15px;\n                display: flex;\n                flex-direction: row;\n                align-content: center;\n                justify-content: center;\n                align-items: center;\n                z-index: 100000;\n            }\n\n            #HM_news_-UserAgreement_____Mian .prompt_boxMain_Center .Menu:hover {\n                cursor: pointer;\n                border: 1px solid #505b62;\n            }\n\n            #HM_news_-UserAgreement_____Mian .prompt_boxMain_Center img,\n            i {\n                -webkit-user-drag: none;\n            }\n\n            @keyframes prompt_boxMainBackkk {\n                0% {\n                    backdrop-filter: blur(0.2px);\n                    opacity: 0.25;\n                }\n\n                25% {\n                    backdrop-filter: blur(0.5px);\n                    opacity: 0.5;\n                }\n\n                50% {\n                    backdrop-filter: blur(1px);\n                    opacity: 1;\n                }\n\n                100% {\n                    backdrop-filter: blur(2px);\n                    opacity: 1;\n                }\n            }\n\n            #HM_news_-UserAgreement_____Mian .prompt_boxBox_Main {\n                display: flex;\n                position: absolute;\n                bottom: 0px;\n                width: 100%;\n                height: 100%;\n                align-content: center;\n                justify-content: center;\n                align-items: center;\n                z-index: 99999;\n            }\n        </style>\n    </div>\n</div>');
                                        let NextMenu_Default = AgreementMain.find(".NextMenu_Default");
                                        let Menu = AgreementMain.find("div.Menu");
                                        // 监听按下关闭
                                        Menu.one("click", () => {
                                            // @ts-expect-error
                                            AgreementMain[0].remove();
                                            reject();
                                            Store.Set("User_OFF_Script", true);
                                        });
                                        // 第二次监听开始使用按钮
                                        NextMenu_Default.one("click", function () {
                                            return __awaiter(this, void 0, void 0, function* () {
                                                NextMenu_Default.one("click", function () {
                                                    return __awaiter(this, void 0, void 0, function* () {
                                                        Store.Set("User_OFF_Script", false);
                                                        // @ts-expect-error
                                                        AgreementMain[0].remove();
                                                        resolve();
                                                    });
                                                });
                                                NextMenu_Default.attr("next", '');
                                                AgreementMain.find('#FirstUse').hide();
                                                NextMenu_Default.css({
                                                    bottom: 80,
                                                    left: 363
                                                });
                                                NextMenu_Default.text("开始使用");
                                                AgreementMain.find('#FirstUse_Next').show();
                                            });
                                        });
                                        Add_HTML_Mian.append(AgreementMain);
                                    });
                                });
                            }
                            ShowAgreement().then(resolve).catch(reject);
                        });
                    });
                });
            }
        }
        yield Sleep(600);
        let APP_Main = new ClassAPP_Main;
        // 用户选择不同意时退出脚本
        Store.on("User_OFF_Script", function (key, OidValue, NewValue, remote) {
            if (!IsDef(NewValue) && NewValue === true) {
                APP_Main.Main.remove();
            }
        });
        yield Sleep(200);
        function APP_Main_Click_Add_Images_itmes_To_Eagle(Event) {
            if (shake.isset("CLICK_MAIN_BTN_SHAKE_1000MS", 1000))
                return;
            APP_Main.Agreement().then(function () {
                var _a, _b;
                NProgress.start();
                // 从全局可读的数据获取用户可见信息
                let IMAGE_SURL_LIST = [];
                let IMAGE_URL_String_LIST = [];
                let data = (_a = unsafeWindow === null || unsafeWindow === void 0 ? void 0 : unsafeWindow.zData) === null || _a === void 0 ? void 0 : _a.data;
                let shareProductImages = data === null || data === void 0 ? void 0 : data.shareProductImages;
                let productImages = (data === null || data === void 0 ? void 0 : data.productImages) || [];
                if (!shareProductImages && !productImages.length)
                    return;
                let Index = 0;
                let tags = [];
                if (shareProductImages.split("||"))
                    for (const ImagesURL of shareProductImages.split("||"))
                        ImagesURL && IMAGE_URL_String_LIST.push(ImagesURL.replace(/\?x-oss.+/i, ''));
                else
                    for (const ImagesURLcontent of productImages)
                        ImagesURLcontent.url && IMAGE_URL_String_LIST.push(ImagesURLcontent.url.replace(/\?x-oss.+/i, ''));
                // 视频
                if (data.productVideos && Array.isArray(data.productVideos))
                    for (const { url } of data.productVideos)
                        IMAGE_URL_String_LIST.push(url);
                // 压入数据
                for (const ImagesURL of IMAGE_URL_String_LIST)
                    IMAGE_SURL_LIST.push({
                        annotation: `
                版权(copyright):${(data === null || data === void 0 ? void 0 : data.copyrightStr) || "未找到请联系作者或自行查看"}
                分类(classify):${(data === null || data === void 0 ? void 0 : data.cateName) || "未知"}
                推荐(recommendStr):${(data === null || data === void 0 ? void 0 : data.recommendStr) || "未知"}
                类型(WorksType):${(data === null || data === void 0 ? void 0 : data.typeStr) || "未知"}
                描述(description):${((_b = data === null || data === void 0 ? void 0 : data.description) === null || _b === void 0 ? void 0 : _b.replace(/<[ a-z0-9\t]+>/ig, "")) || "未知"}
                `.replace(/^\s+/img, ''),
                        url: ImagesURL,
                        name: MIU_NUM(Index += 1, 2),
                        tags: tags,
                        website: location.href,
                        modificationTime: (data === null || data === void 0 ? void 0 : data.updateTime) || +new Date()
                    });
                /**
                 * 发送API 失败就重试队列
                 * @returns
                 */
                function Add_To_EAGLE() {
                    return ToEagle.SetNewFolder(data === null || data === void 0 ? void 0 : data.title).then(data => {
                        NProgress.set(0.3);
                        ToEagle.AddImagesURLAll({
                            items: IMAGE_SURL_LIST,
                            "folderId": data.data.id
                        }).finally(function () {
                            NProgress.done();
                            // 成功后移除失败记录
                            shake.Data.delete("API_Failure");
                        });
                    }).catch((_) => __awaiter(this, void 0, void 0, function* () {
                        if (shake.Data.has("API_Failure"))
                            return;
                        APP_Main.API_Failure().then((_) => __awaiter(this, void 0, void 0, function* () {
                            yield Sleep(5000);
                            Add_To_EAGLE();
                        }));
                        // 告知本次失败,重试并只重试一次
                        shake.Data.add("API_Failure");
                    }));
                }
                Add_To_EAGLE();
            })
                // 用户不同意协议  结束并且移除按钮
                .catch(NProgress.done);
        }
        APP_Main.Main.on("click", APP_Main_Click_Add_Images_itmes_To_Eagle);
    });
})();