UI: remove no longer necessary js in Default/Notebook tabs

This commit is contained in:
oobabooga 2023-12-16 19:37:25 -08:00
parent 7a84d7b2da
commit aa200f8723

View File

@ -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
//------------------------------------------------