Sha256: dd176d434b36ae49e2b1e458e706242a1013a6ed94262dd3518110a1e17411fd
Contents?: true
Size: 917 Bytes
Versions: 52
Compression:
Stored size: 917 Bytes
Contents
/** * comment_ajax.js: * * Copyright (C) 2013 by MATSUOKA Kohei <kohei@machu.jp> * You can distribute it under GPL2 or any later version. */ $(function() { $(document).on('submit', 'form.comment', function(e) { e.preventDefault(); var form = $(this); $('<input type="hidden">').attr('name', 'comment').appendTo(form); $(':submit', form).attr('disabled', 'disabled'); $('div.button input', form).hide(); $('div.button', form).append('<div id="loading-button"><img src="' + $tDiary.plugin.comment_ajax.theme + '/loading.gif">') $.post(form.attr('action'), form.serialize(), function(data) { $('#loading-button').remove(); $('div.button input', form).show(); form[0].reset(); $(':submit', form).removeAttr('disabled'); // $(data) is a diary HTML of the day $('div.comment:first', form.parents('div.day')) .after($('div.comment', $(data))) .remove(); }, 'html'); }); });
Version data entries
52 entries across 33 versions & 1 rubygems