From aa200f872311f298a0c369adf6c8ef4938616913 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sat, 16 Dec 2023 19:37:25 -0800 Subject: [PATCH] UI: remove no longer necessary js in Default/Notebook tabs --- js/main.js | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/js/main.js b/js/main.js index 5c05b394..9f10915d 100644 --- a/js/main.js +++ b/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 //------------------------------------------------