diff options
author | Vincent Tam <sere@live.hk> | 2019-05-20 14:46:29 +0300 |
---|---|---|
committer | Vincent Tam <sere@live.hk> | 2019-05-20 14:46:29 +0300 |
commit | c446cb28ae1a40899acfaa92abdca47ec87573a0 (patch) | |
tree | aefce01eee885c64a71e6a7e29312634388d6b96 /static | |
parent | bb5dc77c22d6bfcab5ec98e27a41cc19d3b06263 (diff) |
Template pour Staticman simplifié
Diffstat (limited to 'static')
-rw-r--r-- | static/js/staticman.js | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/static/js/staticman.js b/static/js/staticman.js index 81800ee..40c0c09 100644 --- a/static/js/staticman.js +++ b/static/js/staticman.js @@ -46,10 +46,11 @@ $(document).ready(function() { } // record reply target when "reply to this comment" is pressed - $('.comment-reply-btn a').click(function (){ + $('article.static-comment').on("click", "a.btn", function (evt){ + var cmt = $(evt.delegateTarget); $('input[name="fields[replyThread]"]').val(this.title); - $('input[name="fields[replyID]"]').val(this.id); - authorTag = $(this).parents('.static-comment').children('h4.comment-author'); + $('input[name="fields[replyID]"]').val(cmt.attr("id")); + authorTag = cmt.children('h4.comment-author'); $('input[name="fields[replyName]"]').val(authorTag.text()); $('.js-form fieldset button.button').text('Submit reply'); }); @@ -58,11 +59,4 @@ $(document).ready(function() { $('.js-form fieldset button[type="reset"]').click(function (){ clearForm(); }); - - // smooth scroll to reply target - $('.comment-reply-target a[href^="#"]').click(function (){ - targetPostID = $(this).attr('href'); - targetID = "#" + $(targetPostID).parents('.static-comment').attr('id'); - $('html, body').animate({ scrollTop: $(targetID).offset().top-$('nav').height() }, 500); - }); }); |