mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-05 06:43:21 +00:00
hide child comments button
This commit is contained in:
parent
2b5349466a
commit
88457d0818
|
@ -389,9 +389,10 @@ form.nsfw div {
|
|||
.buttons a, .buttons form input, .comment .buttons form input {
|
||||
text-decoration: none;
|
||||
color: #888;
|
||||
padding-right: 4px;
|
||||
display: inline-block;
|
||||
margin-right: 8px !important;
|
||||
}
|
||||
.buttons a:hover, .title a:hover, .buttons input:hover {
|
||||
.buttons a:hover, .title a:hover, .buttons form input:hover, .comment .buttons form input:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.entry {
|
||||
|
@ -431,7 +432,16 @@ form.nsfw div {
|
|||
.expando-button:hover{
|
||||
background-color: #466599;
|
||||
}
|
||||
.expando-button.hidden {
|
||||
.expando-button.hidden, .children.hidden {
|
||||
display: none;
|
||||
}
|
||||
.hidechildren .show {
|
||||
display: none;
|
||||
}
|
||||
.hidechildren.hidden .show {
|
||||
display: inline;
|
||||
}
|
||||
.hidechildren.hidden .hide {
|
||||
display: none;
|
||||
}
|
||||
.expando {
|
||||
|
|
|
@ -64,6 +64,20 @@ function commentClick(e) {
|
|||
}
|
||||
return false
|
||||
}
|
||||
if (e.target.className.indexOf("hidechildren") != -1) {
|
||||
if (e.target.getAttribute("for") != targ.id) { return }
|
||||
e.preventDefault()
|
||||
var btn = targ.getElementsByClassName("hidechildren")[0]
|
||||
var children = targ.getElementsByClassName("children")[0]
|
||||
if (children.className.indexOf("hidden") == -1) {
|
||||
children.className = "children hidden"
|
||||
btn.className = "hidechildren hidden"
|
||||
} else {
|
||||
children.className = "children"
|
||||
btn.className = "hidechildren"
|
||||
}
|
||||
return false
|
||||
}
|
||||
if ((e.target.className.indexOf("loadmore") != -1) ||
|
||||
(e.target.className.indexOf("edit") != -1) ||
|
||||
(e.target.className.indexOf("source") != -1) ||
|
||||
|
@ -77,6 +91,26 @@ function commentClick(e) {
|
|||
return false
|
||||
}
|
||||
}
|
||||
function hideAllChildComments(e) {
|
||||
e.preventDefault()
|
||||
var comments = document.getElementsByClassName("comment")
|
||||
for (var i = 0; i < comments.length; i++) {
|
||||
var comment = comments[i]
|
||||
var btn = comment.getElementsByClassName("hidechildren")
|
||||
if (!btn.length) { continue }
|
||||
btn = btn[0]
|
||||
if (btn.getAttribute("for") != comment.id) { continue }
|
||||
var children = comment.getElementsByClassName("children")[0]
|
||||
if (children.className.indexOf("hidden") == -1) {
|
||||
children.className = "children hidden"
|
||||
btn.className = "hidechildren hidden"
|
||||
} else {
|
||||
children.className = "children"
|
||||
btn.className = "hidechildren"
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
function formSubmit(e) {
|
||||
e = e || window.event;
|
||||
var targ = e.currentTarget || e.srcElement || e;
|
||||
|
|
|
@ -79,6 +79,9 @@
|
|||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if gt .ChildCount 0 }}
|
||||
<li><a class="hidechildren" for="c{{.P.Comment.ID}}" href=""><span class="hide">hide</span><span class="show">show {{ .ChildCount }}</span> child comments</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<div class="children">
|
||||
|
|
|
@ -8,10 +8,9 @@
|
|||
<body{{ if .Dark }} class="dark"{{end}}>
|
||||
<noscript>
|
||||
<style>
|
||||
.expando-button {
|
||||
display: none;
|
||||
}
|
||||
.comment .meta a.minimize {
|
||||
.expando-button,
|
||||
.minimize,
|
||||
.hidechildren {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -66,6 +66,9 @@
|
|||
{{ end }}
|
||||
</form>
|
||||
{{end}}
|
||||
{{ if .State.PostID }}
|
||||
<a class="hidechildren" onclick="hideAllChildComments(event)" href="">hide all child comments</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="expando {{ if eq .Rank 0 }}open{{ end}}">
|
||||
{{ if (and .Post.Body.IsValid (ne .Post.Body.String "")) }}
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
{{ printer .Site.SiteView.Counts.Users }} readers <br>
|
||||
<span class="green" title="Users active in the last day"></span>
|
||||
{{ printer .Site.SiteView.Counts.UsersActiveDay }} users here now
|
||||
<p>{{ markdown .Host .Site.SiteView.Site.Sidebar.String }}</p>
|
||||
{{ markdown .Host .Site.SiteView.Site.Sidebar.String }}
|
||||
<div class="age" title="{{ .Site.SiteView.Site.Published.Time}}">founded {{ humanize .Site.SiteView.Site.Published.Time }}</div>
|
||||
{{ if .Site.Admins }}
|
||||
ADMINS
|
||||
|
|
Loading…
Reference in a new issue