mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 04:35:51 +00:00
ci: auto build & obfuscate [2026-04-06 00:50:28] (Jenkins #7)
This commit is contained in:
@@ -1,36 +1,36 @@
|
||||
(function(){
|
||||
if (window.frameElement) {
|
||||
window.frameElement.style.height = 'auto';
|
||||
}
|
||||
function getGlobal() {
|
||||
if (typeof self !== 'undefined') { return self; }
|
||||
if (typeof window !== 'undefined') { return window; }
|
||||
if (typeof global !== 'undefined') { return global; }
|
||||
throw new Error('unable to locate global object');
|
||||
}
|
||||
const globalScope = getGlobal();
|
||||
if (globalScope.generate_send_button_onclick) {
|
||||
globalScope.generate_send_button_onclick_old = globalScope.generate_send_button_onclick;
|
||||
globalScope.generate_send_button_onclick = function(event) {
|
||||
try {
|
||||
const textarea = document.getElementById('send_textarea');
|
||||
if (textarea && textarea.value) {
|
||||
const customEvent = new CustomEvent('xb-send-message', {
|
||||
detail: {
|
||||
message: textarea.value,
|
||||
event: event
|
||||
},
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
if (!window.dispatchEvent(customEvent)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error in xb-send-message event dispatch:', e);
|
||||
}
|
||||
globalScope.generate_send_button_onclick_old(event);
|
||||
};
|
||||
}
|
||||
})();
|
||||
(function(){
|
||||
if (window.frameElement) {
|
||||
window.frameElement.style.height = 'auto';
|
||||
}
|
||||
function getGlobal() {
|
||||
if (typeof self !== 'undefined') { return self; }
|
||||
if (typeof window !== 'undefined') { return window; }
|
||||
if (typeof global !== 'undefined') { return global; }
|
||||
throw new Error('unable to locate global object');
|
||||
}
|
||||
const globalScope = getGlobal();
|
||||
if (globalScope.generate_send_button_onclick) {
|
||||
globalScope.generate_send_button_onclick_old = globalScope.generate_send_button_onclick;
|
||||
globalScope.generate_send_button_onclick = function(event) {
|
||||
try {
|
||||
const textarea = document.getElementById('send_textarea');
|
||||
if (textarea && textarea.value) {
|
||||
const customEvent = new CustomEvent('xb-send-message', {
|
||||
detail: {
|
||||
message: textarea.value,
|
||||
event: event
|
||||
},
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
if (!window.dispatchEvent(customEvent)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error in xb-send-message event dispatch:', e);
|
||||
}
|
||||
globalScope.generate_send_button_onclick_old(event);
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
|
||||
function initializeAmilyClient() {
|
||||
console.log('[Amily2-IframeClient] 正在初始化...');
|
||||
|
||||
document.body.addEventListener('click', function(event) {
|
||||
const target = event.target.closest('[data-amily-action]');
|
||||
|
||||
if (target) {
|
||||
const action = target.dataset.amilyAction;
|
||||
const detail = { ...target.dataset };
|
||||
|
||||
delete detail.amilyAction;
|
||||
|
||||
console.log(`[Amily2-IframeClient] 触发动作: ${action}`, detail);
|
||||
|
||||
if (window.AmilySimpleAPI && typeof window.AmilySimpleAPI.post === 'function') {
|
||||
window.AmilySimpleAPI.post(action, detail);
|
||||
} else {
|
||||
console.error('[Amily2-IframeClient] AmilySimpleAPI 不可用。');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log('[Amily2-IframeClient] 客户端脚本已加载并就绪。');
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initializeAmilyClient);
|
||||
} else {
|
||||
initializeAmilyClient();
|
||||
}
|
||||
|
||||
function initializeAmilyClient() {
|
||||
console.log('[Amily2-IframeClient] 正在初始化...');
|
||||
|
||||
document.body.addEventListener('click', function(event) {
|
||||
const target = event.target.closest('[data-amily-action]');
|
||||
|
||||
if (target) {
|
||||
const action = target.dataset.amilyAction;
|
||||
const detail = { ...target.dataset };
|
||||
|
||||
delete detail.amilyAction;
|
||||
|
||||
console.log(`[Amily2-IframeClient] 触发动作: ${action}`, detail);
|
||||
|
||||
if (window.AmilySimpleAPI && typeof window.AmilySimpleAPI.post === 'function') {
|
||||
window.AmilySimpleAPI.post(action, detail);
|
||||
} else {
|
||||
console.error('[Amily2-IframeClient] AmilySimpleAPI 不可用。');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log('[Amily2-IframeClient] 客户端脚本已加载并就绪。');
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initializeAmilyClient);
|
||||
} else {
|
||||
initializeAmilyClient();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,51 +1,51 @@
|
||||
import { renderAllIframes, clearAllIframes, initializeRenderer } from './renderer.js';
|
||||
import { extension_settings } from "/scripts/extensions.js";
|
||||
import { extensionName } from "../../utils/settings.js";
|
||||
import { saveSettingsDebounced } from "/script.js";
|
||||
|
||||
let isRendererInitialized = false;
|
||||
|
||||
export function initializeRendererBindings() {
|
||||
const container = $("#amily2_drawer_content").length
|
||||
? $("#amily2_drawer_content")
|
||||
: $("#amily2_chat_optimiser");
|
||||
|
||||
if (!container.length) {
|
||||
console.warn("[Amily2-Renderer] Could not find the settings container.");
|
||||
return;
|
||||
}
|
||||
container.on('change', '#amily-render-enable-toggle', function() {
|
||||
const isChecked = this.checked;
|
||||
|
||||
if (!extension_settings[extensionName]) {
|
||||
extension_settings[extensionName] = {};
|
||||
}
|
||||
extension_settings[extensionName].amily_render_enabled = isChecked;
|
||||
saveSettingsDebounced();
|
||||
|
||||
if (isChecked && !isRendererInitialized) {
|
||||
initializeRenderer();
|
||||
isRendererInitialized = true;
|
||||
console.log("[Amily2-Renderer] Renderer has been initialized on-demand.");
|
||||
}
|
||||
|
||||
if (isChecked) {
|
||||
renderAllIframes();
|
||||
} else {
|
||||
clearAllIframes();
|
||||
}
|
||||
});
|
||||
|
||||
container.on('change', '#render-depth', function() {
|
||||
const depth = parseInt(this.value, 10);
|
||||
if (!extension_settings[extensionName]) {
|
||||
extension_settings[extensionName] = {};
|
||||
}
|
||||
extension_settings[extensionName].render_depth = depth;
|
||||
saveSettingsDebounced();
|
||||
|
||||
toastr.success(`渲染深度已保存为: ${depth}`);
|
||||
});
|
||||
|
||||
console.log("[Amily2-Renderer] Renderer UI events have been successfully bound.");
|
||||
}
|
||||
import { renderAllIframes, clearAllIframes, initializeRenderer } from './renderer.js';
|
||||
import { extension_settings } from "/scripts/extensions.js";
|
||||
import { extensionName } from "../../utils/settings.js";
|
||||
import { saveSettingsDebounced } from "/script.js";
|
||||
|
||||
let isRendererInitialized = false;
|
||||
|
||||
export function initializeRendererBindings() {
|
||||
const container = $("#amily2_drawer_content").length
|
||||
? $("#amily2_drawer_content")
|
||||
: $("#amily2_chat_optimiser");
|
||||
|
||||
if (!container.length) {
|
||||
console.warn("[Amily2-Renderer] Could not find the settings container.");
|
||||
return;
|
||||
}
|
||||
container.on('change', '#amily-render-enable-toggle', function() {
|
||||
const isChecked = this.checked;
|
||||
|
||||
if (!extension_settings[extensionName]) {
|
||||
extension_settings[extensionName] = {};
|
||||
}
|
||||
extension_settings[extensionName].amily_render_enabled = isChecked;
|
||||
saveSettingsDebounced();
|
||||
|
||||
if (isChecked && !isRendererInitialized) {
|
||||
initializeRenderer();
|
||||
isRendererInitialized = true;
|
||||
console.log("[Amily2-Renderer] Renderer has been initialized on-demand.");
|
||||
}
|
||||
|
||||
if (isChecked) {
|
||||
renderAllIframes();
|
||||
} else {
|
||||
clearAllIframes();
|
||||
}
|
||||
});
|
||||
|
||||
container.on('change', '#render-depth', function() {
|
||||
const depth = parseInt(this.value, 10);
|
||||
if (!extension_settings[extensionName]) {
|
||||
extension_settings[extensionName] = {};
|
||||
}
|
||||
extension_settings[extensionName].render_depth = depth;
|
||||
saveSettingsDebounced();
|
||||
|
||||
toastr.success(`渲染深度已保存为: ${depth}`);
|
||||
});
|
||||
|
||||
console.log("[Amily2-Renderer] Renderer UI events have been successfully bound.");
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<div class="flex-container">
|
||||
<button id="amily2_renderer_back_button" class="menu_button wide_button"><i class="fas fa-arrow-left"></i> 返回主殿</button>
|
||||
</div>
|
||||
<div class="extension-content-item">
|
||||
<div class="name">启用前端渲染</div>
|
||||
<div class="description">在聊天消息中渲染HTML内容。</div>
|
||||
<input id="amily-render-enable-toggle" type="checkbox" class="slider">
|
||||
</div>
|
||||
<div class="extension-content-item">
|
||||
<div class="name">渲染深度</div>
|
||||
<div class="description">设置要渲染的最新消息的数量。0表示无限制。</div>
|
||||
<input id="render-depth" type="number" class="text_pole" value="5">
|
||||
</div>
|
||||
<div class="amily2-renderer-info-container">
|
||||
<p class="emo-statement">“想给温柔的人奏响一段温柔的小插曲。”</p>
|
||||
<p class="description-text">
|
||||
当开启Amily前端渲染后,务必关闭酒馆助手的前端渲染,借鉴了酒馆助手的渲染和交互逻辑,实现了更加轻量级,渲染更快,降低卡顿。
|
||||
<br><br>
|
||||
与酒馆助手的脚本、变量等功能,完全无冲突,可并存使用。
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex-container">
|
||||
<button id="amily2_renderer_back_button" class="menu_button wide_button"><i class="fas fa-arrow-left"></i> 返回主殿</button>
|
||||
</div>
|
||||
<div class="extension-content-item">
|
||||
<div class="name">启用前端渲染</div>
|
||||
<div class="description">在聊天消息中渲染HTML内容。</div>
|
||||
<input id="amily-render-enable-toggle" type="checkbox" class="slider">
|
||||
</div>
|
||||
<div class="extension-content-item">
|
||||
<div class="name">渲染深度</div>
|
||||
<div class="description">设置要渲染的最新消息的数量。0表示无限制。</div>
|
||||
<input id="render-depth" type="number" class="text_pole" value="5">
|
||||
</div>
|
||||
<div class="amily2-renderer-info-container">
|
||||
<p class="emo-statement">“想给温柔的人奏响一段温柔的小插曲。”</p>
|
||||
<p class="description-text">
|
||||
当开启Amily前端渲染后,务必关闭酒馆助手的前端渲染,借鉴了酒馆助手的渲染和交互逻辑,实现了更加轻量级,渲染更快,降低卡顿。
|
||||
<br><br>
|
||||
与酒馆助手的脚本、变量等功能,完全无冲突,可并存使用。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user