text-generation-webui/js/switch_tabs.js

39 lines
907 B
JavaScript
Raw Permalink Normal View History

2023-08-14 03:48:15 +02:00
function scrollToTop() {
2025-06-18 19:22:36 +02:00
window.scrollTo({ top: 0 });
2023-08-14 03:48:15 +02:00
}
2023-08-29 22:22:15 +02:00
function findButtonsByText(buttonText) {
2023-10-08 04:07:57 +02:00
const buttons = document.getElementsByTagName("button");
2023-08-29 22:22:15 +02:00
const matchingButtons = [];
for (let i = 0; i < buttons.length; i++) {
2025-06-18 19:22:36 +02:00
if (buttons[i].textContent.trim() === buttonText) {
matchingButtons.push(buttons[i]);
2023-08-29 22:22:15 +02:00
}
}
return matchingButtons;
}
function switch_to_chat() {
2025-06-18 19:22:36 +02:00
document.getElementById("chat-tab-button").click();
2023-10-08 04:07:57 +02:00
scrollToTop();
}
function switch_to_notebook() {
2025-06-18 19:22:36 +02:00
document.getElementById("notebook-parent-tab-button").click();
2023-10-08 04:07:57 +02:00
findButtonsByText("Raw")[1].click();
scrollToTop();
}
function switch_to_generation_parameters() {
2025-06-18 19:22:36 +02:00
document.getElementById("parameters-button").click();
2023-10-08 04:07:57 +02:00
findButtonsByText("Generation")[0].click();
scrollToTop();
}
function switch_to_character() {
2025-06-18 19:22:36 +02:00
document.getElementById("character-tab-button").click();
2023-10-08 04:07:57 +02:00
scrollToTop();
}