use new theme
This commit is contained in:
parent
05bc58562c
commit
ec1341fcd1
261 changed files with 23060 additions and 17 deletions
40
themes/beautifulhugo/static/js/staticman.js
Normal file
40
themes/beautifulhugo/static/js/staticman.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Static comments
|
||||
// from: https://github.com/eduardoboucas/popcorn/blob/gh-pages/js/main.js
|
||||
(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) {
|
||||
showModal('Perfect !', 'Thanks for your comment! It will show on the site once it has been approved. .');
|
||||
$(form).removeClass('form--loading');
|
||||
},
|
||||
error: function (err) {
|
||||
console.log(err);
|
||||
showModal('Error', 'Sorry, there was an error with the submission!');
|
||||
$(form).removeClass('form--loading');
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.js-close-modal').click(function () {
|
||||
$('body').removeClass('show-modal');
|
||||
});
|
||||
|
||||
function showModal(title, message) {
|
||||
$('.js-modal-title').text(title);
|
||||
$('.js-modal-text').html(message);
|
||||
|
||||
$('body').addClass('show-modal');
|
||||
}
|
||||
})(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue