Files
ST-Amily2-Chat-Optimisation/index.js
2025-07-16 13:30:07 +08:00

2 lines
6.2 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.
const _0x5088d7=_0x3f49;(function(_0x1dea8f,_0x1b5639){const _0x2e4e0e=_0x3f49,_0x3369e3=_0x1dea8f();while(!![]){try{const _0x5084d7=parseInt(_0x2e4e0e(0x165))/0x1+-parseInt(_0x2e4e0e(0x179))/0x2*(-parseInt(_0x2e4e0e(0x14e))/0x3)+parseInt(_0x2e4e0e(0x14b))/0x4*(-parseInt(_0x2e4e0e(0x16d))/0x5)+parseInt(_0x2e4e0e(0x16e))/0x6*(-parseInt(_0x2e4e0e(0x156))/0x7)+parseInt(_0x2e4e0e(0x175))/0x8*(-parseInt(_0x2e4e0e(0x167))/0x9)+parseInt(_0x2e4e0e(0x15d))/0xa+parseInt(_0x2e4e0e(0x14f))/0xb;if(_0x5084d7===_0x1b5639)break;else _0x3369e3['push'](_0x3369e3['shift']());}catch(_0x188db3){_0x3369e3['push'](_0x3369e3['shift']());}}}(_0x5056,0xc0146));import{createDrawer}from'./ui/drawer.js';import{registerSlashCommands}from'./core/commands.js';import{onMessageReceived,onChatChanged}from'./core/events.js';import{eventSource,event_types}from'/script.js';function _0x5056(){const _0x15e8e2=['2686BgWWYd','[Amily2号-帝国枢密院]\x20SillyTavern宫殿主体已确认开国大典正式开始','assign','addEventListener','error','map','严重错误','[Amily2号-开国大典]\x20步骤一为宫殿披上华服...','220468bOhgbu','?v=','#sys-settings-button','2631HkoKyE','16194343KJVAFK','CHAT_CHANGED','href','style.css','[Amily2号-帝国枢密院]\x20开始执行开国大典...','\x20超时。','type','2505251nvsxoQ','amily2-style-','getElementById','MESSAGE_RECEIVED','version','log','[Amily2号-开国大典]\x20步骤二皇家仪仗队就位...','2259100vdjVjx','rel','stack','【Amily2号-情报部】捷报!发现新版本:\x20','historiography.css','/assets/','stylesheet','!!!【开国大典失败】在执行系列法令时发生严重错误:','1319039ZrHVLm','head','9AYycCc','[Amily2号-皇家制衣局]\x20已为帝国披上华服:\x20','createElement','【Amily2号】帝国秩序已完美建立。Amily2号的府邸已恭候陛下的莅临。','text/css','未知错误','140uZbpbA','24LNXDun','appendChild','split','now','[Amily2号-开国大典]\x20步骤三开始召唤府邸...','[Amily2-全局卫队]\x20捕获到严重错误:','ST-Amily2-Chat-Optimisation','3466936xQfNYE','Amily2插件错误:\x20','message','[Amily2号-开国大典]\x20步骤四部署帝国哨兵网络...'];_0x5056=function(){return _0x15e8e2;};return _0x5056();}import{checkForUpdates}from'./core/api.js';import{setUpdateInfo}from'./ui/state.js';import{pluginVersion,extensionName,defaultSettings}from'./utils/settings.js';function _0x3f49(_0x250062,_0x159425){const _0x5056d1=_0x5056();return _0x3f49=function(_0x3f49e4,_0x4fa28c){_0x3f49e4=_0x3f49e4-0x146;let _0x29eff6=_0x5056d1[_0x3f49e4];return _0x29eff6;},_0x3f49(_0x250062,_0x159425);}import{extension_settings}from'/scripts/extensions.js';function compareVersions(_0x3200ff,_0x4fd85f){const _0x25927e=_0x3f49,_0x228291=_0x3200ff[_0x25927e(0x170)]('.')[_0x25927e(0x148)](Number),_0x22ef74=_0x4fd85f['split']('.')[_0x25927e(0x148)](Number),_0x417148=Math['max'](_0x228291['length'],_0x22ef74['length']);for(let _0x514352=0x0;_0x514352<_0x417148;_0x514352++){const _0x4104e3=_0x228291[_0x514352]||0x0,_0x70fbba=_0x22ef74[_0x514352]||0x0;if(_0x4104e3>_0x70fbba)return!![];if(_0x4104e3<_0x70fbba)return![];}return![];}async function handleUpdateCheck(){const _0x13546b=_0x3f49;console['log']('【Amily2号】帝国已就绪现派遣外交官为陛下探查外界新情报...');const _0x5a40cd=await checkForUpdates();if(_0x5a40cd&&_0x5a40cd[_0x13546b(0x15a)]){const _0x2d1870=compareVersions(_0x5a40cd[_0x13546b(0x15a)],pluginVersion);_0x2d1870?console[_0x13546b(0x15b)](_0x13546b(0x160)+_0x5a40cd[_0x13546b(0x15a)]+'。情报已转交内务府。'):console['log']('【Amily2号-情报部】一切安好,帝国已是最新版本。情报已转交内务府备案。'),setUpdateInfo(_0x2d1870,_0x5a40cd);}}function loadPluginStyles(){const _0x220777=_0x3f49,_0x264df3=_0x294399=>{const _0x5c0470=_0x3f49,_0x518ba1=_0x5c0470(0x157)+_0x294399['split']('.')[0x0];if(document[_0x5c0470(0x158)](_0x518ba1))return;const _0x229f94='scripts/extensions/third-party/'+extensionName+_0x5c0470(0x162)+_0x294399+_0x5c0470(0x14c)+Date[_0x5c0470(0x171)](),_0x450af1=document[_0x5c0470(0x169)]('link');_0x450af1['id']=_0x518ba1,_0x450af1[_0x5c0470(0x15e)]=_0x5c0470(0x163),_0x450af1[_0x5c0470(0x155)]=_0x5c0470(0x16b),_0x450af1[_0x5c0470(0x151)]=_0x229f94,document[_0x5c0470(0x166)][_0x5c0470(0x16f)](_0x450af1),console[_0x5c0470(0x15b)](_0x5c0470(0x168)+_0x294399);};_0x264df3(_0x220777(0x152)),_0x264df3(_0x220777(0x161));}window[_0x5088d7(0x146)](_0x5088d7(0x147),_0x5bb56f=>{const _0x275b9d=_0x5088d7,_0x351a0c=_0x5bb56f['error']?.[_0x275b9d(0x15f)]||'';_0x351a0c['includes'](_0x275b9d(0x174))&&(console['error'](_0x275b9d(0x173),_0x5bb56f[_0x275b9d(0x147)]),toastr[_0x275b9d(0x147)](_0x275b9d(0x176)+(_0x5bb56f[_0x275b9d(0x147)]?.[_0x275b9d(0x177)]||_0x275b9d(0x16c)),_0x275b9d(0x149),{'timeOut':0x2710}));}),jQuery(async()=>{const _0x536d4c=_0x5088d7;console[_0x536d4c(0x15b)](_0x536d4c(0x153));!extension_settings[extensionName]&&(extension_settings[extensionName]={});Object[_0x536d4c(0x17b)](extension_settings[extensionName],{...defaultSettings,...extension_settings[extensionName]}),console[_0x536d4c(0x15b)]('[Amily2号-帝国枢密院]\x20帝国基本法已确认档案室已与国库对接完毕。');let _0x430724=0x0;const _0xca644d=0x64,_0x372484=0x64,_0x3351b7=_0x536d4c(0x14d),_0x1146b5=setInterval(async()=>{const _0x8eb9fc=_0x536d4c;if($(_0x3351b7)['length']>0x0){clearInterval(_0x1146b5),console[_0x8eb9fc(0x15b)](_0x8eb9fc(0x17a));try{console['log'](_0x8eb9fc(0x14a)),loadPluginStyles(),console[_0x8eb9fc(0x15b)](_0x8eb9fc(0x15c)),await registerSlashCommands(),console[_0x8eb9fc(0x15b)](_0x8eb9fc(0x172)),createDrawer(),console[_0x8eb9fc(0x15b)](_0x8eb9fc(0x178)),!window['amily2EventsRegistered']&&(eventSource['on'](event_types[_0x8eb9fc(0x159)],onMessageReceived),eventSource['on'](event_types['IMPERSONATE_READY'],onMessageReceived),eventSource['on'](event_types[_0x8eb9fc(0x150)],onChatChanged),window['amily2EventsRegistered']=!![]),console[_0x8eb9fc(0x15b)](_0x8eb9fc(0x16a)),handleUpdateCheck();}catch(_0x3b86bb){console['error'](_0x8eb9fc(0x164),_0x3b86bb);}}else _0x430724++,_0x430724>=_0xca644d&&(clearInterval(_0x1146b5),console[_0x8eb9fc(0x147)]('[Amily2号]\x20部署失败等待\x20'+_0x3351b7+_0x8eb9fc(0x154)));},_0x372484);});