+ // Comment form submit
+ $body.on('submit', '.comment-edit-form', function(e) {
+ let $form = $(this);
+ let id = $form.data('item-id');
+
+ // Compose page form exception: id is always 0 and form must not be submitted asynchronously
+ if (id === 0) {
+ return;
+ }
+
+ e.preventDefault();
+
+ let $commentSubmit = $form.find('.comment-edit-submit').button('loading');
+
+ unpause();
+ commentBusy = true;
+
+ $.post(
+ 'item',
+ $form.serialize(),
+ 'json'
+ )
+ .then(function(data) {
+ if (data.success) {
+ $('#comment-edit-wrapper-' + id).hide();
+ let $textarea = $('#comment-edit-text-' + id);
+ $textarea.val('');
+ if ($textarea.get(0)) {
+ commentClose($textarea.get(0), id);
+ }
+ if (timer) {
+ clearTimeout(timer);
+ }
+ timer = setTimeout(NavUpdate,10);
+ force_update = true;
+ update_item = id;
+ }
+ if (data.reload) {
+ window.location.href = data.reload;
+ }
+ })
+ .always(function() {
+ $commentSubmit.button('reset');
+ });
+ });
+
+ $body.on('submit', '.modal-body #poke-wrapper', function(e) {
+ e.preventDefault();
+
+ let $form = $(this);
+ let $pokeSubmit = $form.find('button[type=submit]').button('loading');
+
+ $.post(
+ $form.attr('action'),
+ $form.serialize(),
+ 'json'
+ )
+ .then(function(data) {
+ if (data.success) {
+ $('#modal').modal('hide');
+ }
+ })
+ .always(function() {
+ $pokeSubmit.button('reset');
+ });
+ })