Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed comment toggle #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions memodump.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def footer(self, d, **keywords):
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="%(prefix)s/%(theme)s/js/bootstrap.min.js"></script>
<!-- toggle.js by dossist -->
<script src="%(prefix)s/%(theme)s/js/toggle.js"></script>
<!-- script src="%(prefix)s/%(theme)s/js/toggle.js"></script -->
<!-- Custom script -->
%(script)s
<!-- End of JavaScript -->
Expand Down Expand Up @@ -349,6 +349,24 @@ def script(self):
$('#pagebox a[href^="#"]:not([href="#"])').on("click", mdAnchorFix.clickWrapper);
$(window).on("hashchange", mdAnchorFix.jump);
if (location.hash) setTimeout(function () { mdAnchorFix.jump(); }, 100);

$(".global-comment").click(function(){
$this = $(this);
if ($this.hasClass('on')) {
$this.removeClass('on');
$(".current-comment.on").click();
} else {
$this.addClass('on');
$(".current-comment:not(.on)").click();
};
});

$(".comment").before('<a rel="nofollow" class="menu-nav-comment nbcomment current-comment"></a>');
$(".current-comment").click(function(){
$this = $(this);
$this.next().toggle();
$this.hasClass('on') ? $this.removeClass('on') : $this.addClass('on');
});
}(jQuery);
</script>
"""
Expand Down Expand Up @@ -515,7 +533,7 @@ def commentbutton(self):
_ = self.request.getText
html = u'''
<li class="toggleCommentsButton navbar-comment-toggle" style="display:none;">
<a href="#" class="menu-nav-comment nbcomment navbar-comment-toggle" rel="nofollow" onClick="toggleComments();return false;" data-toggle="toggle" data-target=".navbar-comment-toggle">
<a class="menu-nav-comment nbcomment navbar-comment-toggle global-comment" rel="nofollow">
<span class="hidden-sm">%s</span>
</a>
</li>
Expand Down
1 change: 1 addition & 0 deletions memodump/css/moinizer.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ strong.highlight {
.comment { /* .comment must be on top of other color box classes */
color: #999;
background-color: #f0f0ff;
padding: 0;
}
.red { /* Bootstrap .alert-danger */
background-color: #f2dede;
Expand Down
71 changes: 0 additions & 71 deletions memodump/js/toggle.js

This file was deleted.