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 449381e commit a2cd481
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
6 changes: 6 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@
"matches": ["<all_urls>"],
"extension_ids": ["*"]
}
],
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["content.js"]
}
]
}
16 changes: 0 additions & 16 deletions new-tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,4 @@ <h2 id="greet">

<!-- JavaScript -->
<script src="script.js"></script>

<script>
document.addEventListener("keydown", (event) => {
if (event.ctrlKey && event.altKey) {
const pg1 = document.getElementById("pg1");
const pg2 = document.getElementById("pg2");
if (pg1.style.opacity === "0") {
pg1.style.opacity = 1;
pg2.style.opacity = 0;
} else {
pg1.style.opacity = 0;
pg2.style.opacity = 1;
}
}
});
</script>
</html>
15 changes: 14 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function addZero(n) {
return (parseInt(n, 10) < 10 ? "0" : "") + n;
}


// Shortcuts
fetch("/config.json")
.then((response) => response.json())
Expand Down Expand Up @@ -463,6 +462,20 @@ document.addEventListener("keydown", function (event) {
}
});

document.addEventListener("keydown", (event) => {
if (event.ctrlKey && event.altKey) {
const pg1 = document.getElementById("pg1");
const pg2 = document.getElementById("pg2");
if (pg2.style.opacity == 0) {
pg2.style.opacity = 1;
pg1.style.opacity = 0;
} else {
pg2.style.opacity = 0;
pg1.style.opacity = 1;
}
}
});

// Protection
document.addEventListener("contextmenu", (event) => event.preventDefault());
document.onkeydown = function (e) {
Expand Down

0 comments on commit a2cd481

Please sign in to comment.