mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-12-25 13:58:56 +01:00
UI: remove no longer necessary js in Default/Notebook tabs
This commit is contained in:
parent
7a84d7b2da
commit
aa200f8723
50
js/main.js
50
js/main.js
@ -155,56 +155,6 @@ const config = {
|
||||
// Start observing the target element
|
||||
observer.observe(targetElement, config);
|
||||
|
||||
//------------------------------------------------
|
||||
// Notebook box scrolling
|
||||
//------------------------------------------------
|
||||
const notebookElement = document.querySelector("#textbox-notebook textarea");
|
||||
let notebookScrolled = false;
|
||||
|
||||
notebookElement.addEventListener("scroll", function() {
|
||||
let diff = notebookElement.scrollHeight - notebookElement.clientHeight;
|
||||
if(Math.abs(notebookElement.scrollTop - diff) <= 10 || diff == 0) {
|
||||
notebookScrolled = false;
|
||||
} else {
|
||||
notebookScrolled = true;
|
||||
}
|
||||
});
|
||||
|
||||
const notebookObserver = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
if(!notebookScrolled) {
|
||||
notebookElement.scrollTop = notebookElement.scrollHeight;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
notebookObserver.observe(notebookElement.parentNode.parentNode.parentNode, config);
|
||||
|
||||
//------------------------------------------------
|
||||
// Default box scrolling
|
||||
//------------------------------------------------
|
||||
const defaultElement = document.querySelector("#textbox-default textarea");
|
||||
let defaultScrolled = false;
|
||||
|
||||
defaultElement.addEventListener("scroll", function() {
|
||||
let diff = defaultElement.scrollHeight - defaultElement.clientHeight;
|
||||
if(Math.abs(defaultElement.scrollTop - diff) <= 10 || diff == 0) {
|
||||
defaultScrolled = false;
|
||||
} else {
|
||||
defaultScrolled = true;
|
||||
}
|
||||
});
|
||||
|
||||
const defaultObserver = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
if(!defaultScrolled) {
|
||||
defaultElement.scrollTop = defaultElement.scrollHeight;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
defaultObserver.observe(defaultElement.parentNode.parentNode.parentNode, config);
|
||||
|
||||
//------------------------------------------------
|
||||
// Add some scrollbars
|
||||
//------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user