A button to toggle them all...
This commit is contained in:
33
index.html
33
index.html
@@ -14,7 +14,10 @@
|
||||
|
||||
<main id="comments">
|
||||
<link rel="stylesheet" href="fontawesome/css/all.css">
|
||||
<link rel="stylesheet" href="style.css?v=1.21">
|
||||
<link rel="stylesheet" href="style.css?v=1.22">
|
||||
<header>
|
||||
<h1>Comments from the Fediverse</h1>
|
||||
<button onclick="showHideAll()" class="hide" title="Show/Hide all statuses"></button></header>
|
||||
|
||||
|
||||
</main>
|
||||
@@ -166,7 +169,33 @@
|
||||
else {
|
||||
section.style.display = "none";
|
||||
button.classList.add("hide");
|
||||
buttom.classList.remove("show");
|
||||
button.classList.remove("show");
|
||||
}
|
||||
}
|
||||
|
||||
function showHideAll(){
|
||||
button = event.srcElement;
|
||||
commentArea = document.getElementById('comments');
|
||||
articles = commentArea.querySelectorAll('article section');
|
||||
|
||||
if( button.classList.contains("hide") ) {
|
||||
for( article of articles ) {
|
||||
article.style.display = "block";
|
||||
button.classList.add("show");
|
||||
button.classList.remove("hide");
|
||||
article.parentNode.querySelector("button").classList.add("show");
|
||||
article.parentNode.querySelector("button").classList.remove("hide");
|
||||
}
|
||||
}
|
||||
else {
|
||||
for( article of articles ) {
|
||||
article.style.display = "none";
|
||||
button.classList.add("hide");
|
||||
button.classList.remove("show");
|
||||
article.parentNode.querySelector("button").classList.add("hide");
|
||||
article.parentNode.querySelector("button").classList.remove("show");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user