Add files via upload

This commit is contained in:
2025-11-30 23:07:04 +08:00
committed by GitHub
parent d269924531
commit b8aad886bc
3 changed files with 4697 additions and 2547 deletions

View File

@@ -629,6 +629,26 @@ export function bindModalEvents() {
}
});
container
.off("click.amily2.reset_auth")
.on("click.amily2.reset_auth", "#amily2_reset_auth", function() {
if (!pluginAuthStatus.authorized) return;
if (confirm("确定要清除本地授权码吗?\n这将使您的授权失效需要重新验证。\n\n这通常用于\n1. 升级为高级用户\n2. 解决授权异常问题")) {
localStorage.removeItem("plugin_auth_code");
localStorage.removeItem("plugin_activated");
localStorage.removeItem("plugin_auto_login");
localStorage.removeItem("plugin_user_type");
localStorage.removeItem("plugin_valid_until");
toastr.success("授权已清除,即将重新加载以生效...", "Amily2号");
setTimeout(() => {
location.reload();
}, 1500);
}
});
container
.off("click.amily2.update")
.on("click.amily2.update", "#amily2_update_button", function() {
@@ -705,7 +725,7 @@ export function bindModalEvents() {
container
.off("click.amily2.chamber_nav")
.on("click.amily2.chamber_nav",
"#amily2_open_plot_optimization, #amily2_open_additional_features, #amily2_open_rag_palace, #amily2_open_memorisation_forms, #amily2_open_character_world_book, #amily2_open_world_editor, #amily2_open_glossary, #amily2_open_renderer, #amily2_back_to_main_settings, #amily2_back_to_main_from_hanlinyuan, #amily2_back_to_main_from_forms, #amily2_back_to_main_from_optimization, #amily2_back_to_main_from_cwb, #amily2_back_to_main_from_world_editor, #amily2_back_to_main_from_glossary, #amily2_renderer_back_button", function () {
"#amily2_open_plot_optimization, #amily2_open_additional_features, #amily2_open_rag_palace, #amily2_open_memorisation_forms, #amily2_open_character_world_book, #amily2_open_world_editor, #amily2_open_glossary, #amily2_open_renderer, #amily2_open_super_memory, #amily2_back_to_main_settings, #amily2_back_to_main_from_hanlinyuan, #amily2_back_to_main_from_forms, #amily2_back_to_main_from_optimization, #amily2_back_to_main_from_cwb, #amily2_back_to_main_from_world_editor, #amily2_back_to_main_from_glossary, #amily2_renderer_back_button, #amily2_back_to_main_from_super_memory", function () {
if (!pluginAuthStatus.authorized) return;
const mainPanel = container.find('.plugin-features');
@@ -717,6 +737,7 @@ container
const worldEditorPanel = container.find('#amily2_world_editor_panel');
const glossaryPanel = container.find('#amily2_glossary_panel');
const rendererPanel = container.find('#amily2_renderer_panel');
const superMemoryPanel = container.find('#amily2_super_memory_panel');
mainPanel.hide();
additionalPanel.hide();
@@ -727,8 +748,18 @@ container
worldEditorPanel.hide();
glossaryPanel.hide();
rendererPanel.hide();
superMemoryPanel.hide();
switch (this.id) {
case 'amily2_open_super_memory':
const userType = parseInt(localStorage.getItem("plugin_user_type") || "0");
if (userType < 2) {
toastr.warning("此功能为内测功能,仅限我看顺眼的用户使用。", "权限不足");
mainPanel.show();
return;
}
superMemoryPanel.show();
break;
case 'amily2_open_renderer':
rendererPanel.show();
break;
@@ -761,6 +792,7 @@ container
case 'amily2_back_to_main_from_world_editor':
case 'amily2_back_to_main_from_glossary':
case 'amily2_renderer_back_button':
case 'amily2_back_to_main_from_super_memory':
mainPanel.show();
break;
}

View File

@@ -20,6 +20,7 @@ import { bindHanlinyuanEvents } from "./hanlinyuan-bindings.js";
import { bindTableEvents } from './table-bindings.js';
import { showContentModal } from "./page-window.js";
import { initializeRendererBindings } from "../core/tavern-helper/renderer-bindings.js";
import { bindSuperMemoryEvents } from "../core/super-memory/bindings.js";
const extensionFolderPath = `scripts/extensions/third-party/${extensionName}`;
@@ -106,6 +107,10 @@ async function initializePanel(contentPanel, errorContainer) {
const rendererPanelHtml = `<div id="amily2_renderer_panel" style="display: none;">${rendererContent}</div>`;
mainContainer.append(rendererPanelHtml);
const superMemoryContent = await $.get(`${extensionFolderPath}/core/super-memory/index.html`);
const superMemoryPanelHtml = `<div id="amily2_super_memory_panel" style="display: none;">${superMemoryContent}</div>`;
mainContainer.append(superMemoryPanelHtml);
// 在面板创建后,加载世界书编辑器脚本
const worldEditorScriptId = 'world-editor-script';
if (!document.getElementById(worldEditorScriptId)) {
@@ -123,6 +128,7 @@ async function initializePanel(contentPanel, errorContainer) {
bindHanlinyuanEvents();
bindTableEvents();
initializeRendererBindings();
bindSuperMemoryEvents();
contentPanel.data("initialized", true);
console.log("[Amily-重构] 宫殿模块已按蓝图竣工。");
applyUpdateIndicator();

File diff suppressed because one or more lines are too long