diff options
author | Vincent Tam <sere@live.hk> | 2019-05-20 22:05:41 +0300 |
---|---|---|
committer | Vincent Tam <sere@live.hk> | 2019-05-20 22:07:59 +0300 |
commit | 41f7e21524625239067d7ba4c8833c362fb8ee74 (patch) | |
tree | 0eb0ffcbd97720334c251cb3b431dc5c34334e64 /static/js | |
parent | 14771fcb347f4c0101a3606f8a4cf8cd6ca7db9b (diff) |
Tidy up README
Diffstat (limited to 'static/js')
-rw-r--r-- | static/js/staticman.js | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/static/js/staticman.js b/static/js/staticman.js deleted file mode 100644 index 216d848..0000000 --- a/static/js/staticman.js +++ /dev/null @@ -1,62 +0,0 @@ -// Static comments -// from: https://github.com/eduardoboucas/popcorn/blob/gh-pages/js/main.js -$(document).ready(function() { - var $comments = $('.js-comments'); - - $('.js-form').submit(function () { - var form = this; - - $(form).addClass('form--loading'); - - $.ajax({ - type: $(this).attr('method'), - url: $(this).attr('action'), - data: $(this).serialize(), - contentType: 'application/x-www-form-urlencoded', - success: function (data) { - // $('.js-form input[type="submit"]').val('{{ i18n comment_btn_submit }}'); - // showAlert('{{ i18n comment_success_msg }}'); - showAlert('success'); - $(form).removeClass('form--loading'); - clearForm(); - }, - error: function (err) { - console.log(err); - // $('.js-form input[type="submit"]').val('{{ i18n comment_btn_submit }}'); - // showAlert('{{ i18n comment_error_msg }}'); - showAlert('failed'); - $(form).removeClass('form--loading'); - } - }); - - return false; - }); - - function showAlert(msg) { - $('.js-form .js-notice').removeClass('hidden'); - $('.js-form .js-notice-text').text(msg); - } - - function clearForm() { - $('input[name="fields[replyThread]"]').val(''); - $('input[name="fields[replyID]"]').val(''); - $('input[name="fields[replyName]"]').val(''); - $('.reply-notice-text').text(''); - } - - // record reply target when "reply to this comment" is pressed - $('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(cmt.attr("id")); - authorTag = cmt.find('.comment-author'); - replyName = authorTag.text(); - $('input[name="fields[replyName]"]').val(replyName); - $('.reply-notice-text').text('↷\xa0' + replyName); - }); - - // clear form when reset button is clicked - $('.js-form input[type="reset"]').click(function (){ - clearForm(); - }); -}); |