Files
ST-Amily2-Chat-Optimisation…/ui/drawer.js
2025-07-21 07:20:16 +08:00

2 lines
9.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(_0x4c8aba,_0xe33216){const _0x4cfc8d=_0x3ffa,_0x4e575a=_0x4c8aba();while(!![]){try{const _0x19f9b6=parseInt(_0x4cfc8d(0xe4))/0x1*(parseInt(_0x4cfc8d(0x10b))/0x2)+parseInt(_0x4cfc8d(0x115))/0x3*(parseInt(_0x4cfc8d(0x123))/0x4)+parseInt(_0x4cfc8d(0xff))/0x5+-parseInt(_0x4cfc8d(0x122))/0x6+parseInt(_0x4cfc8d(0x119))/0x7*(-parseInt(_0x4cfc8d(0x109))/0x8)+-parseInt(_0x4cfc8d(0x120))/0x9*(parseInt(_0x4cfc8d(0xf0))/0xa)+-parseInt(_0x4cfc8d(0x11c))/0xb*(-parseInt(_0x4cfc8d(0x114))/0xc);if(_0x19f9b6===_0xe33216)break;else _0x4e575a['push'](_0x4e575a['shift']());}catch(_0x53cfe0){_0x4e575a['push'](_0x4e575a['shift']());}}}(_0x2854,0x411df));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';function _0x3ffa(_0xa8b44b,_0x3a5ac7){const _0x285448=_0x2854();return _0x3ffa=function(_0x3ffa26,_0x43e8dd){_0x3ffa26=_0x3ffa26-0xe2;let _0x97c7cc=_0x285448[_0x3ffa26];return _0x97c7cc;},_0x3ffa(_0xa8b44b,_0x3a5ac7);}import{updateUI,setAvailableModels,populateModelDropdown,applyUpdateIndicator}from'./state.js';import{bindModalEvents}from'./bindings.js';import{fetchSupportedModels}from'../core/api.js';import{bindHistoriographyEvents}from'./historiography-bindings.js';function _0x2854(){const _0x576230=['extensions','/assets/hanlinyuan.html','initialized','#amily2_drawer_icon','stringify','iconLocation','3386652NmKakJ','721653FSAXaY','closedIcon\x20openIcon','.drawerPinnedOpen','addClass','7994MPwCWH','/assets/amily2-modal.html','resizing','11gWosbh','#expiry_info','stopPropagation','authorized','432387GgUyAP','/assets/Amily2-AdditionalFeatures.html','230196AEXeLg','4ygYVUK','#sys-settings-button','toggleClass','append','<div\x20id=\x22amily2_hanlinyuan_panel\x22\x20style=\x22display:\x20none;\x22>','true','html','</div>','data','303ACPKym','[Amily-重构]\x20顶栏宫殿已按模块化蓝图竣工。','.drawer-content','setItem','get','cached_models_amily2','error','#extensions_settings2','[Amily-重构]\x20收到指令开始在\x27扩展\x27官方区域模块化建造宫殿。','closedDrawer\x20openDrawer','log','not','90vSpTjo','.openDrawer','each','#amily2_extension_frame\x20.inline-drawer-content','[Amily2号]\x20从缓存加载模型列表\x20(','length','mousedown.amily2Drawer','#amily2_main_drawer','remove','topbar','.pinnedOpen','parse','[Amily2-调试]\x20授权状态:\x20','closest','[Amily-建设部]\x20紧急报告加载模块化蓝图时发生意外:','426705MmdxfL','find','#amily2_chat_optimiser','info','getItem','\x0a\x20\x20\x20\x20\x20\x20<div\x20id=\x22amily2_extension_frame\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22inline-drawer\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22inline-drawer-toggle\x20inline-drawer-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<b><i\x20class=\x22fas\x20fa-crown\x22\x20style=\x22color:\x20#ffc107;\x22></i>\x20Amily2号\x20优化中枢</b>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22inline-drawer-icon\x20fa-solid\x20fa-circle-chevron-down\x20down\x22></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22inline-drawer-content\x22\x20style=\x22display:\x20none;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<!--\x20宫殿的真正内室将在这里安家\x20-->\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20','#extensions_settings2\x20#amily2_chat_optimiser','#amily2_drawer_content','off','after','136NbfQqZ','<p\x20style=\x22color:red;\x20padding:\x2020px;\x22>紧急报告无法加载Amily2号府邸内饰。</p>','982PaKrZF','classList','<div\x20id=\x22amily2_additional_features_panel\x22\x20style=\x22display:\x20none;\x22>'];_0x2854=function(){return _0x576230;};return _0x2854();}import{bindHanlinyuanEvents}from'./hanlinyuan-bindings.js';import{showContentModal}from'./page-window.js';const extensionFolderPath='scripts/extensions/third-party/'+extensionName;async function loadSettings(){const _0x3cdebb=_0x3ffa;extension_settings[extensionName]={...defaultSettings,...extension_settings[extensionName]||{}},checkAuthorization();const _0xfc2ae2=localStorage['getItem']('plugin_auto_login')===_0x3cdebb(0x128);console['log'](_0x3cdebb(0xfc)+pluginAuthStatus['authorized']+',\x20自动登录标志:\x20'+_0xfc2ae2);_0xfc2ae2&&pluginAuthStatus[_0x3cdebb(0x11f)]&&console[_0x3cdebb(0xee)]('[Amily2号]\x20检测到有效授权将执行自动UI更新。');$(_0x3cdebb(0x11d))['html'](displayExpiryInfo()),updateUI();if(pluginAuthStatus[_0x3cdebb(0x11f)]&&extension_settings[extensionName]['apiUrl']){const _0x1786cb=localStorage[_0x3cdebb(0x103)](_0x3cdebb(0xe9));if(_0x1786cb){const _0xf18e7b=JSON[_0x3cdebb(0xfb)](_0x1786cb);console['log'](_0x3cdebb(0xf4)+_0xf18e7b[_0x3cdebb(0xf5)]+'个)'),setAvailableModels(_0xf18e7b),populateModelDropdown();}else toastr[_0x3cdebb(0x102)]('正在自动加载模型列表...','Amily2号'),setTimeout(async()=>{const _0x421823=_0x3cdebb,_0x5e9993=await fetchSupportedModels();_0x5e9993['length']>0x0&&(setAvailableModels(_0x5e9993),localStorage[_0x421823(0xe7)](_0x421823(0xe9),JSON[_0x421823(0x112)](_0x5e9993)),populateModelDropdown());},0x1f4);}}export function createDrawer(){const _0x138774=_0x3ffa,_0x3aa065=extension_settings[extensionName],_0x522034=_0x3aa065[_0x138774(0x113)]||_0x138774(0xf9);if(_0x522034===_0x138774(0xf9)){if($(_0x138774(0xf7))[_0x138774(0xf5)]>0x0)return;const _0x18e07d='\x0a\x20\x20\x20\x20\x20\x20<div\x20id=\x22amily2_main_drawer\x22\x20class=\x22drawer\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22amily2_drawer_icon\x22\x20class=\x22drawer-toggle\x20drawer-header\x20closedIcon\x20interactable\x22\x20title=\x22Amily2号优化助手\x22\x20tabindex=\x220\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<i\x20class=\x22drawer-icon\x20fa-solid\x20fa-magic\x20fa-fw\x22></i>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22amily2_drawer_content\x22\x20class=\x22drawer-content\x20closedDrawer\x22\x20style=\x22display:\x20none;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20';$(_0x138774(0x124))[_0x138774(0x108)](_0x18e07d),$(document)[_0x138774(0x107)](_0x138774(0xf6))['on'](_0x138774(0xf6),_0x138774(0x111),async function(_0x51f12c){const _0x50552b=_0x138774;_0x51f12c['preventDefault'](),_0x51f12c[_0x50552b(0x11e)]();const _0x986d2c=$(this),_0x41efad=$(_0x50552b(0x106));$(_0x50552b(0xf1))[_0x50552b(0xef)](_0x41efad)[_0x50552b(0xef)]('.pinnedOpen')[_0x50552b(0x118)](_0x50552b(0x11b))[_0x50552b(0xf2)]((_0x2fbf9a,_0x59d262)=>{slideToggle(_0x59d262,{...getSlideToggleOptions(),'onAnimationEnd':function(_0x4f193c){const _0x269401=_0x3ffa;_0x4f193c[_0x269401(0xfd)](_0x269401(0xe6))[_0x269401(0x10c)][_0x269401(0xf8)](_0x269401(0x11b));}});}),$('.openIcon')[_0x50552b(0xef)](_0x986d2c)[_0x50552b(0xef)](_0x50552b(0x117))[_0x50552b(0x125)](_0x50552b(0x116)),$(_0x50552b(0xf1))[_0x50552b(0xef)](_0x41efad)[_0x50552b(0xef)](_0x50552b(0xfa))[_0x50552b(0x125)]('closedDrawer\x20openDrawer'),_0x986d2c[_0x50552b(0x125)](_0x50552b(0x116)),_0x41efad[_0x50552b(0x125)](_0x50552b(0xed)),_0x41efad['addClass'](_0x50552b(0x11b))['each']((_0x2111b9,_0x1a28fd)=>{slideToggle(_0x1a28fd,{...getSlideToggleOptions(),'onAnimationEnd':function(_0x3f6692){const _0x4b2821=_0x3ffa;_0x3f6692[_0x4b2821(0xfd)](_0x4b2821(0xe6))[_0x4b2821(0x10c)][_0x4b2821(0xf8)](_0x4b2821(0x11b));}});});const _0x2deacc=_0x41efad[_0x50552b(0xe3)](_0x50552b(0x110));if(_0x986d2c['hasClass']('openIcon')&&!_0x2deacc)try{const _0x4f224f=await $[_0x50552b(0xe8)](extensionFolderPath+_0x50552b(0x11a));_0x41efad[_0x50552b(0x129)](_0x4f224f);const _0x316c2f=_0x41efad[_0x50552b(0x100)](_0x50552b(0x101));if(_0x316c2f[_0x50552b(0xf5)]){const _0x4d89f6=await $[_0x50552b(0xe8)](extensionFolderPath+_0x50552b(0x121)),_0x40580b=_0x50552b(0x10d)+_0x4d89f6+'</div>';_0x316c2f['append'](_0x40580b);const _0x556c7=await $['get'](extensionFolderPath+'/assets/hanlinyuan.html'),_0x4a9413='<div\x20id=\x22amily2_hanlinyuan_panel\x22\x20style=\x22display:\x20none;\x22>'+_0x556c7+'</div>';_0x316c2f[_0x50552b(0x126)](_0x4a9413);}await loadSettings(),bindModalEvents(),bindHistoriographyEvents(),bindHanlinyuanEvents(),_0x41efad[_0x50552b(0xe3)](_0x50552b(0x110),!![]),console[_0x50552b(0xee)](_0x50552b(0xe5)),applyUpdateIndicator();}catch(_0x466a58){console[_0x50552b(0xea)](_0x50552b(0xfe),_0x466a58),_0x41efad[_0x50552b(0x129)](_0x50552b(0x10a));}});}else{if(_0x522034===_0x138774(0x10e)){if($(_0x138774(0x105))[_0x138774(0xf5)]>0x0)return;const _0x401072=_0x138774(0x104);$('#extensions_settings2')['append'](_0x401072),((async()=>{const _0x49da05=_0x138774;try{console['log'](_0x49da05(0xec));const _0x5b0187=$(_0x49da05(0xf3)),_0x281118=await $[_0x49da05(0xe8)](extensionFolderPath+_0x49da05(0x11a));_0x5b0187['html'](_0x281118);const _0x30b131=_0x5b0187['find'](_0x49da05(0x101));if(_0x30b131[_0x49da05(0xf5)]){const _0x39de08=await $[_0x49da05(0xe8)](extensionFolderPath+_0x49da05(0x121)),_0x2ecea9=_0x49da05(0x10d)+_0x39de08+'</div>';_0x30b131[_0x49da05(0x126)](_0x2ecea9);const _0x5d706f=await $[_0x49da05(0xe8)](extensionFolderPath+_0x49da05(0x10f)),_0x592312=_0x49da05(0x127)+_0x5d706f+_0x49da05(0xe2);_0x30b131[_0x49da05(0x126)](_0x592312);}await loadSettings(),bindModalEvents(),bindHistoriographyEvents(),bindHanlinyuanEvents(),applyUpdateIndicator();}catch(_0x3ca450){console[_0x49da05(0xea)](_0x49da05(0xfe),_0x3ca450),$(_0x49da05(0xeb))[_0x49da05(0x126)]('<p\x20style=\x22color:red;\x20padding:10px;\x20border:1px\x20solid\x20red;\x20border-radius:5px;\x22>紧急报告在扩展区域建造Amily2号府邸时发生意外。</p>');}})());}}}