mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-05 06:43:21 +00:00
hide all comments logic fix
This commit is contained in:
parent
dcc3cd4d49
commit
ca47acec84
|
@ -165,6 +165,11 @@ function loadMore(e) {
|
||||||
function hideAllChildComments(e) {
|
function hideAllChildComments(e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
var comments = document.getElementsByClassName("comment")
|
var comments = document.getElementsByClassName("comment")
|
||||||
|
if (e.target.innerHTML == "hide all child comments") {
|
||||||
|
e.target.innerHTML = "show all child comments"
|
||||||
|
} else {
|
||||||
|
e.target.innerHTML = "hide all child comments"
|
||||||
|
}
|
||||||
for (var i = 0; i < comments.length; i++) {
|
for (var i = 0; i < comments.length; i++) {
|
||||||
var comment = comments[i]
|
var comment = comments[i]
|
||||||
var btn = comment.getElementsByClassName("hidechildren")
|
var btn = comment.getElementsByClassName("hidechildren")
|
||||||
|
@ -172,14 +177,12 @@ function hideAllChildComments(e) {
|
||||||
btn = btn[0]
|
btn = btn[0]
|
||||||
if (btn.getAttribute("for") != comment.id) { continue }
|
if (btn.getAttribute("for") != comment.id) { continue }
|
||||||
var children = comment.getElementsByClassName("children")[0]
|
var children = comment.getElementsByClassName("children")[0]
|
||||||
if (children.className.indexOf("hidden") == -1) {
|
if (e.target.innerHTML == "show all child comments") {
|
||||||
children.className = "children hidden"
|
children.className = "children hidden"
|
||||||
btn.className = "hidechildren hidden"
|
btn.className = "hidechildren hidden"
|
||||||
e.target.innerHTML = "show all child comments"
|
|
||||||
} else {
|
} else {
|
||||||
children.className = "children"
|
children.className = "children"
|
||||||
btn.className = "hidechildren"
|
btn.className = "hidechildren"
|
||||||
e.target.innerHTML = "hide all child comments"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<script src="/_/static/utils.js?v=15"></script>
|
<script src="/_/static/utils.js?v=16"></script>
|
||||||
{{ template "sidebar.html" . }}
|
{{ template "sidebar.html" . }}
|
||||||
</main>
|
</main>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in a new issue