Skip to content

Commit

Permalink
Fixed Notepad
Browse files Browse the repository at this point in the history
  • Loading branch information
AR1VU committed Sep 20, 2023
1 parent a2cd481 commit 9832dc1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
10 changes: 1 addition & 9 deletions new-tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,7 @@ <h2 id="greet">
></textarea>

<script>
const notepad = document.getElementById("notepad");

// Load saved text from local storage
notepad.value = localStorage.getItem("text");

// Autosave text to local storage
notepad.addEventListener("input", () => {
localStorage.setItem("text", notepad.value);
});

</script>
</div>
</div>
Expand Down
11 changes: 11 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,17 @@ fetch("/config.json")
getWeatherData();
});

// Notepad
const notepad = document.getElementById("notepad");

// Load saved text from local storage
notepad.value = localStorage.getItem("text");

// Autosave text to local storage
notepad.addEventListener("input", () => {
localStorage.setItem("text", notepad.value);
});

// Keybinds
document.addEventListener("keydown", function (event) {
const pg1 = document.getElementById("pg1");
Expand Down

0 comments on commit 9832dc1

Please sign in to comment.