What to write in the console to hide was originally an open field for entering comments to the article?

Yes, I know that if you click on any "Reply" button, then the main field for entering the comment itself is minimized. But you can't do that. So this cheat do not offer, please:
Cheat
document.querySelector('.comment__footer-link').click();
The point is just to turn the spoiler, but other Windows comment not open at the same time.
How to do it?
March 19th 20 at 09:13
1 answer
March 19th 20 at 09:15
Solution
<details>
<summary>Spoiler</summary>
<p>Soderzhimoe</p>
</details>


Will not work?
Thanks for the idea.
I was ready to avail itself of this option, but slowly began to pick and pick open. But you set the direction (though not exactly). In the end I managed to do without the wrapper, but I had to write my svarichevska razvorachivat, which is not contrary to Habro.
The decision
//Hide the comments by default
hideCommentFormByDefault function() {
 let comment_text = document.querySelector('.comment-form__title-text'); //the Text "Write comment" (span)
 let editor = document.querySelector('.comment-form_wrapper'); //Editor floats between the responses. It is one and the same element always.
 if (!(comment_text && editor)) return console.log('TC Error: comment_text or editor no found');
 let comment_div = comment_text.parentNode;
 const CLOSED = 'comment-form__title comment-form__title_listened';
 const OPENED = 'comment-form__title';
 if (!(comment_div && comment_div.className == OPENED))
 return console.log('Error TC: comment form not found!',comment_div && comment_div.className);
 let spoiler_status = true; //true means hidden --> we will hide it below
 let remove_fn = function() { //any click --> we must show the form
 if (!spoiler_status) return;
 editor.style.display = ";
comment_text.removeEventListener('click',onclick);
 spoiler_status = false;
}
 let onclick = function() {
remove_fn();
 comment_div.className = OPENED; //If clicked on labels, then you need to change the text.
}
 document.querySelectorAll('.comment__footer-link').forEach(e=>e.addEventListener('click',()=>{ //WTF?? Need neat fix!
remove_fn();
}));
comment_text.addEventListener('click',onclick);
 //Change the text style button and concealed editor
 comment_div.className = "CLOSED";
 editor.style.display = 'none';
}

hideCommentFormByDefault();

PS I Added the extension to chrome. - Anya.Reichel27 commented on March 19th 20 at 09:18

Find more questions by tags HabrJavaScript