From 4c1ba172acf5eda3fc8ee82114aabf8bec1c3f48 Mon Sep 17 00:00:00 2001 From: Wx-2025 <351320169@qq.com> Date: Sun, 13 Jul 2025 18:27:26 +0800 Subject: [PATCH] Update drawer.js --- ui/drawer.js | 183 +-------------------------------------------------- 1 file changed, 1 insertion(+), 182 deletions(-) diff --git a/ui/drawer.js b/ui/drawer.js index 0c5157d..20151e4 100644 --- a/ui/drawer.js +++ b/ui/drawer.js @@ -1,182 +1 @@ -import { getSlideToggleOptions } from '/script.js'; -import { slideToggle } from '/lib.js'; -import { extension_settings } from "/scripts/extensions.js"; -import { extensionName, defaultSettings } from "../utils/settings.js"; -import { - checkAuthorization, - displayExpiryInfo, - pluginAuthStatus, -} from "../utils/auth.js"; -import { - updateUI, - setAvailableModels, - populateModelDropdown, - applyUpdateIndicator, -} from "./state.js"; -import { bindModalEvents } from "./bindings.js"; -import { fetchSupportedModels } from "../core/api.js"; - -const extensionFolderPath = `scripts/extensions/third-party/${extensionName}`; - - -async function loadSettings() { - extension_settings[extensionName] = { - ...defaultSettings, - ...(extension_settings[extensionName] || {}), - }; - - - checkAuthorization(); - - - const autoLogin = localStorage.getItem("plugin_auto_login") === "true"; - console.log( - `[Amily2-调试] 授权状态: ${pluginAuthStatus.authorized}, 自动登录标志: ${autoLogin}`, - ); - if (autoLogin && pluginAuthStatus.authorized) { - console.log("[Amily2号] 检测到有效授权,将执行自动UI更新。"); - } - - $("#expiry_info").html(displayExpiryInfo()); - updateUI(); - - if (pluginAuthStatus.authorized && extension_settings[extensionName].apiUrl) { - const cachedModels = localStorage.getItem("cached_models_amily2"); - if (cachedModels) { - const models = JSON.parse(cachedModels); - console.log(`[Amily2号] 从缓存加载模型列表 (${models.length}个)`); - setAvailableModels(models); - populateModelDropdown(); - } else { - toastr.info("正在自动加载模型列表...", "Amily2号"); - setTimeout(async () => { - const models = await fetchSupportedModels(); - if (models.length > 0) { - setAvailableModels(models); - localStorage.setItem("cached_models_amily2", JSON.stringify(models)); - populateModelDropdown(); - } - }, 500); - } - } -} - -export function createDrawer() { - const settings = extension_settings[extensionName]; - const location = settings.iconLocation || 'topbar'; - - if (location === 'topbar') { - if ($("#amily2_main_drawer").length > 0) return; - - - const amily2DrawerHtml = ` -
紧急报告:无法加载Amily2号府邸内饰。
'); - } - } - }, - ); - - } else if (location === 'extensions') { - if ($("#extensions_settings2 #amily2_chat_optimiser").length > 0) return; - const amilyFrameHtml = ` -紧急报告:在扩展区域建造Amily2号府邸时发生意外。
'); - } - })(); - } -} +const _0x31a483=_0x5dac;(function(_0x1b8c0e,_0x3e3eed){const _0x434c80=_0x5dac,_0x714d33=_0x1b8c0e();while(!![]){try{const _0x3651cf=-parseInt(_0x434c80(0x1c4))/0x1*(-parseInt(_0x434c80(0x1bf))/0x2)+-parseInt(_0x434c80(0x1a2))/0x3+-parseInt(_0x434c80(0x19c))/0x4+parseInt(_0x434c80(0x1ce))/0x5*(-parseInt(_0x434c80(0x1d0))/0x6)+parseInt(_0x434c80(0x1cb))/0x7+parseInt(_0x434c80(0x1e1))/0x8*(parseInt(_0x434c80(0x1c7))/0x9)+parseInt(_0x434c80(0x1ca))/0xa*(parseInt(_0x434c80(0x1b9))/0xb);if(_0x3651cf===_0x3e3eed)break;else _0x714d33['push'](_0x714d33['shift']());}catch(_0x5de41f){_0x714d33['push'](_0x714d33['shift']());}}}(_0x5d68,0x7ee1a));import{getSlideToggleOptions}from'/script.js';import{slideToggle}from'/lib.js';import{extension_settings}from'/scripts/extensions.js';import{extensionName,defaultSettings}from'../utils/settings.js';function _0x5dac(_0x1618c2,_0x1f27ff){const _0x5d684d=_0x5d68();return _0x5dac=function(_0x5dac56,_0x7e72bf){_0x5dac56=_0x5dac56-0x19b;let _0x4df030=_0x5d684d[_0x5dac56];return _0x4df030;},_0x5dac(_0x1618c2,_0x1f27ff);}import{checkAuthorization,displayExpiryInfo,pluginAuthStatus}from'../utils/auth.js';function _0x5d68(){const _0x5ae81f=['each','stringify','after','cached_models_amily2','extensions','remove','error','#extensions_settings2\x20#amily2_chat_optimiser','plugin_auto_login','#amily2_extension_frame\x20.inline-drawer-content','openIcon',',\x20自动登录标志:\x20','','.pinnedOpen','closedIcon\x20openIcon','mousedown.amily2Drawer','find','log','.drawer-content','[Amily-建设部]\x20紧急报告:加载模块化蓝图时发生意外:','get','22wwegKJ','apiUrl','.drawerPinnedOpen','紧急报告:在扩展区域建造Amily2号府邸时发生意外。
','not','[Amily-重构]\x20收到指令,开始在\x27扩展\x27官方区域模块化建造宫殿。','4UuCZSv','off','/assets/Amily2-AdditionalFeatures.html','4347oLIfqA','.openIcon','getItem','6339290TpLkEU','1942864QjhmtB','preventDefault','#amily2_drawer_icon','125BCteic','authorized','196584oPmKvf','closedDrawer\x20openDrawer','closest','addClass','length','#expiry_info','[Amily2-调试]\x20授权状态:\x20','[Amily2号]\x20从缓存加载模型列表\x20(','toggleClass','setItem','/assets/amily2-modal.html','classList','topbar','#extensions_settings2','info','[Amily2号]\x20检测到有效授权,将执行自动UI更新。','hasClass','16904eolfOR','iconLocation','#amily2_chat_optimiser','data','true','html','3628172sTtBPA','#amily2_drawer_content','\x0a\x20\x20\x20\x20\x20\x20紧急报告:无法加载Amily2号府邸内饰。
');}});}else{if(_0x332264===_0x472473(0x1a8)){if($(_0x472473(0x1ab))[_0x472473(0x1d4)]>0x0)return;const _0x3dc542=_0x472473(0x19e);$(_0x472473(0x1dd))['append'](_0x3dc542),((async()=>{const _0xc0bd6a=_0x472473;try{console[_0xc0bd6a(0x1b5)](_0xc0bd6a(0x1c3));const _0x3b183=$(_0xc0bd6a(0x1ad)),_0x24d1c4=await $[_0xc0bd6a(0x1b8)](extensionFolderPath+'/assets/amily2-modal.html');_0x3b183[_0xc0bd6a(0x19b)](_0x24d1c4);const _0x2a4426=_0x3b183[_0xc0bd6a(0x1b4)](_0xc0bd6a(0x1e3));if(_0x2a4426['length']){const _0x10ac8e=await $['get'](extensionFolderPath+_0xc0bd6a(0x1c6)),_0x34aacf=_0xc0bd6a(0x1bc)+_0x10ac8e+_0xc0bd6a(0x1b0);_0x2a4426[_0xc0bd6a(0x1c0)](_0x34aacf);}await loadSettings(),bindModalEvents(),bindHistoriographyEvents(),applyUpdateIndicator();}catch(_0x28d8a2){console[_0xc0bd6a(0x1aa)]('[Amily-建设部]\x20紧急报告:加载模块化蓝图时发生意外:',_0x28d8a2),$(_0xc0bd6a(0x1dd))[_0xc0bd6a(0x1c0)](_0xc0bd6a(0x1c1));}})());}}}