diff --git a/html/main.js b/html/main.js new file mode 100644 index 0000000..7c786f7 --- /dev/null +++ b/html/main.js @@ -0,0 +1,23 @@ +const toggleView = () => { + const postsSection = document.querySelector(".posts-section"); + const commentsSection = document.querySelector(".comments-section"); + if (commentsSection.style.display === "none") { + commentsSection.style.display = "block"; + postsSection.style.display = "none"; + } else { + postsSection.style.display = "block"; + commentsSection.style.display = "none"; + } +} + +window.addEventListener("load", function() { +const postsSection = document.querySelector(".posts-section"); +const commentsSection = document.querySelector(".comments-section"); +if (commentsSection) { + commentsSection.style.display = "none"; + const toggleButton = document.createElement("button"); + toggleButton.innerText = "toggle"; + toggleButton.addEventListener("click", toggleView); + document.body.insertBefore(toggleButton, postsSection); +} +}) \ No newline at end of file diff --git a/html/post.html b/html/post.html index e3053c4..8869b2c 100644 --- a/html/post.html +++ b/html/post.html @@ -3,8 +3,8 @@
Saved Posts
+Saved Comments
+