}
}
+const resizeTextHeights = () => {
+
+ const resizeHelper = (element) => {
+
+ element.style.height = "0";
+ element.style.height = element.scrollHeight + "px";
+ }
+
+ for (const element of document.querySelectorAll("textarea")) {
+
+ resizeHelper(element);
+ element.addEventListener("focus", () => resizeHelper(element));
+ element.addEventListener("input", () => resizeHelper(element));
+ }
+}
+
+resizeTextHeights();
+
override_css.addEventListener("input", (event) => {
theme.css = event.target.value;
({todos, archived, theme} = JSON.parse(decodeURIComponent(atob(window.location.hash.substring(1))))); // using parenthesis around this is required because we're doing object literal destructuring without a declaration
backupData();
+ window.location.replace("./");
} catch (e) {
console.error(e);
theme.showCompleted = !theme.showCompleted;
doShowCompleted(true);
- resizeTextHeights();
+ if (theme.showCompleted) resizeTextHeights();
});
const todoElement = (item, index, isCompleted = false) => {
const resizeTextHeights = () => {
- for (const element of document.querySelectorAll("todo textarea")) {
+ const resizeHelper = (element) => {
element.style.height = "0";
element.style.height = element.scrollHeight + "px";
}
+
+ for (const element of document.querySelectorAll("todo textarea")) {
+
+ resizeHelper(element);
+ element.addEventListener("focus", () => resizeHelper(element));
+ element.addEventListener("input", () => resizeHelper(element));
+ }
}
const applyListeners = () => {