mirror of
https://github.com/SilenceLurker/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 14:45:51 +00:00
Merge branch 'Wx-2025:main' into main
This commit is contained in:
5
index.js
5
index.js
@@ -488,6 +488,11 @@ jQuery(async () => {
|
|||||||
eventSource.on(event_types.IMPERSONATE_READY, onMessageReceived);
|
eventSource.on(event_types.IMPERSONATE_READY, onMessageReceived);
|
||||||
eventSource.on(event_types.MESSAGE_RECEIVED, (chat_id) => handleTableUpdate(chat_id));
|
eventSource.on(event_types.MESSAGE_RECEIVED, (chat_id) => handleTableUpdate(chat_id));
|
||||||
eventSource.on(event_types.MESSAGE_SWIPED, (chat_id) => {
|
eventSource.on(event_types.MESSAGE_SWIPED, (chat_id) => {
|
||||||
|
const context = getContext();
|
||||||
|
if (context.chat.length < 2) {
|
||||||
|
log(`【监察系统】检测到消息滑动,但聊天记录不足2条,已跳过状态回退。`, 'info');
|
||||||
|
return;
|
||||||
|
}
|
||||||
log(`【监察系统】检测到消息滑动 (SWIPED),开始执行状态回退...`, 'warn');
|
log(`【监察系统】检测到消息滑动 (SWIPED),开始执行状态回退...`, 'warn');
|
||||||
rollbackState();
|
rollbackState();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { getMemoryState, getHighlights } from '../core/table-system/manager.js';
|
import { getMemoryState, getHighlights } from '../core/table-system/manager.js';
|
||||||
import { extension_settings } from '/scripts/extensions.js';
|
import { extension_settings } from '/scripts/extensions.js';
|
||||||
import { extensionName } from '../utils/settings.js';
|
import { extensionName } from '../utils/settings.js';
|
||||||
|
import { getContext } from '/scripts/extensions.js';
|
||||||
|
|
||||||
const TABLE_CONTAINER_ID = 'amily2-chat-table-container';
|
const TABLE_CONTAINER_ID = 'amily2-chat-table-container';
|
||||||
const isTouchDevice = () => window.matchMedia('(pointer: coarse)').matches;
|
const isTouchDevice = () => window.matchMedia('(pointer: coarse)').matches;
|
||||||
@@ -82,6 +83,12 @@ function bindSwipePreventer(container) {
|
|||||||
export function updateOrInsertTableInChat() {
|
export function updateOrInsertTableInChat() {
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
const context = getContext();
|
||||||
|
if (!context || !context.chat || context.chat.length < 2) {
|
||||||
|
removeTableContainer();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const settings = extension_settings[extensionName];
|
const settings = extension_settings[extensionName];
|
||||||
removeTableContainer();
|
removeTableContainer();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user