diff --git a/index.html b/index.html
index daebfb1..2f53983 100644
--- a/index.html
+++ b/index.html
@@ -14,7 +14,7 @@
@@ -93,8 +93,11 @@
if(obj.spoiler_text.length > 0){
const myCW = document.createElement('summary');
const myButton = document.createElement('button');
- myButton.textContent = "+";
+ myButton.addEventListener("click", showHide);
+ myButton.textContent = "\u{1F648}";
myCW.textContent = obj.spoiler_text;
+ myButton.classList.toggle("show");
+
myHeader.appendChild(myCW);
myHeader.appendChild(myButton);
@@ -109,6 +112,9 @@
const mySection = document.createElement('section');
mySection.innerHTML = `${obj['content']}`;
+ if(obj.spoiler_text.length > 0){
+ mySection.style.display="none";
+ }
item.appendChild(mySection);
}
@@ -144,7 +150,22 @@
}
buildCommentTree("107735248507147283");
-// buildCommentTree("107724981153178707");
+ // buildCommentTree("107724981153178707");
+
+ function showHide(){
+ button = event.srcElement;
+ article = button.parentNode.parentNode;
+ section = article.querySelector('section');
+
+ if( section.style.display == "none" ){
+ section.style.display = "block";
+ button.classList.toggle("hide");
+ }
+ else {
+ section.style.display = "none";
+ button.classList.toggle("show");
+ }
+ }