'$comment' => DI::l10n()->t('Comment'),
'$submit' => DI::l10n()->t('Submit'),
'$preview' => DI::l10n()->t('Preview'),
+ '$loading' => DI::l10n()->t('Loading...'),
'$sourceapp' => DI::l10n()->t($a->sourcename),
'$ww' => '',
'$rand_num' => Crypto::randomDigits(12)
'$myphoto' => DI::baseUrl()->remove($a->contact['thumb']),
'$comment' => DI::l10n()->t('Comment'),
'$submit' => DI::l10n()->t('Submit'),
+ '$loading' => DI::l10n()->t('Loading...'),
'$edbold' => DI::l10n()->t('Bold'),
'$editalic' => DI::l10n()->t('Italic'),
'$eduline' => DI::l10n()->t('Underline'),
}
}
+ let $body = $('body');
+
// show bulk deletion button at network page if checkbox is checked
$("body").change("input.item-select", function(){
var checked = false;
showHideEventMap(this);
});
+ // Comment form submit
+ $body.on('submit', '.comment-edit-form', function(e) {
+ e.preventDefault();
+
+ let $form = $(this);
+ let id = $form.data('item-id');
+ 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');
+ });
+ })
});
function openClose(theID) {
{{else}}
<div class="comment-wwedit-wrapper" id="comment-edit-wrapper-{{$id}}">
{{/if}}
- <form class="comment-edit-form" data-item-id="{{$id}}" id="comment-edit-form-{{$id}}" action="item" method="post" onsubmit="post_comment({{$id}}); return false;">
+ <form class="comment-edit-form" data-item-id="{{$id}}" id="comment-edit-form-{{$id}}" action="item" method="post">
<input type="hidden" name="type" value="{{$type}}" />
<input type="hidden" name="profile_uid" value="{{$profile_uid}}" />
<input type="hidden" name="parent" value="{{$parent}}" />
<p class="comment-edit-submit-wrapper">
{{if $preview}}
- <button type="button" class="btn btn-defaul btn-sm" onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}"><i class="fa fa-eye"></i> {{$preview}}</button>
+ <button type="button" class="btn btn-defaul btn-sm comment-edit-preview" onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}"><i class="fa fa-eye"></i> {{$preview}}</button>
{{/if}}
- <button type="submit" class="btn btn-primary btn-sm" id="comment-edit-submit-{{$id}}" name="submit"><i class="fa fa-envelope"></i> {{$submit}}</button>
+ <button type="submit" class="btn btn-primary btn-sm comment-edit-submit" id="comment-edit-submit-{{$id}}" name="submit" data-loading-text="{{$loading}}"><i class="fa fa-envelope"></i> {{$submit}}</button>
</p>
<div class="comment-edit-end clear"></div>