mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Dynamically update show more title
This commit is contained in:
@@ -73,7 +73,7 @@
|
|||||||
{{/with}}
|
{{/with}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{#if more}}
|
{{#if more}}
|
||||||
<button class="menu_button menu_button_icon showMoreChats" data-i18n="[title]Show more recent chats" title="Show more recent chats">
|
<button class="menu_button menu_button_icon showMoreChats">
|
||||||
<small class="fa-solid fa-chevron-down fa-fw fa-1x"></small>
|
<small class="fa-solid fa-chevron-down fa-fw fa-1x"></small>
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@@ -135,12 +135,17 @@ async function sendWelcomePanel() {
|
|||||||
});
|
});
|
||||||
const hiddenChats = fragment.querySelectorAll('.recentChat.hidden');
|
const hiddenChats = fragment.querySelectorAll('.recentChat.hidden');
|
||||||
fragment.querySelectorAll('button.showMoreChats').forEach((button) => {
|
fragment.querySelectorAll('button.showMoreChats').forEach((button) => {
|
||||||
|
const showRecentChatsTitle = t`Show more recent chats`;
|
||||||
|
const hideRecentChatsTitle = t`Show less recent chats`;
|
||||||
|
|
||||||
|
button.setAttribute('title', showRecentChatsTitle);
|
||||||
button.addEventListener('click', () => {
|
button.addEventListener('click', () => {
|
||||||
const rotate = button.classList.contains('rotated');
|
const rotate = button.classList.contains('rotated');
|
||||||
hiddenChats.forEach((chatItem) => {
|
hiddenChats.forEach((chatItem) => {
|
||||||
chatItem.classList.toggle('hidden', rotate);
|
chatItem.classList.toggle('hidden', rotate);
|
||||||
});
|
});
|
||||||
button.classList.toggle('rotated', !rotate);
|
button.classList.toggle('rotated', !rotate);
|
||||||
|
button.setAttribute('title', rotate ? showRecentChatsTitle : hideRecentChatsTitle);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
fragment.querySelectorAll('button.openTemporaryChat').forEach((button) => {
|
fragment.querySelectorAll('button.openTemporaryChat').forEach((button) => {
|
||||||
|
Reference in New Issue
Block a user