mirror of
https://github.com/corca-ai/EVAL
synced 2024-10-30 09:20:44 +00:00
28 lines
678 B
JavaScript
28 lines
678 B
JavaScript
const highlightActiveNavItem = () => {
|
|
const navItems = document.querySelectorAll("#nav-sidebar > li > a");
|
|
const currentPath = window.location.pathname;
|
|
navItems.forEach((item) => {
|
|
if (item.getAttribute("href") === currentPath) {
|
|
item.classList.add("active");
|
|
}
|
|
});
|
|
};
|
|
|
|
highlightActiveNavItem();
|
|
|
|
const getNumber = (str) => Number(str.replace("px", ""));
|
|
|
|
function expandTextarea(id) {
|
|
document.getElementById(id).addEventListener(
|
|
"keyup",
|
|
function () {
|
|
this.style.overflow = "hidden";
|
|
this.style.height =
|
|
Math.max(getNumber(this.style.height), this.scrollHeight) + "px";
|
|
},
|
|
false
|
|
);
|
|
}
|
|
|
|
expandTextarea("prompt");
|