diff options
author | Mario Vavti <mario@mariovavti.com> | 2024-11-08 11:19:42 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2024-11-08 11:19:42 +0100 |
commit | 4b4cac63fd4597b5c3090377196c8ad970900b21 (patch) | |
tree | a13eb1e5b569e6ac023000a8acb78d9f016f5209 /view/js/main.js | |
parent | 21b60bf119a3d070e385c1011f4c3ccb9951f23c (diff) | |
parent | 17183cc5dcbc5eb825d353d9f24fa74b2e4c6cdd (diff) | |
download | volse-hubzilla-4b4cac63fd4597b5c3090377196c8ad970900b21.tar.gz volse-hubzilla-4b4cac63fd4597b5c3090377196c8ad970900b21.tar.bz2 volse-hubzilla-4b4cac63fd4597b5c3090377196c8ad970900b21.zip |
Merge branch 'dev' into containers
Diffstat (limited to 'view/js/main.js')
-rw-r--r-- | view/js/main.js | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/view/js/main.js b/view/js/main.js index 87025a1c8..c1b0d410c 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1178,20 +1178,27 @@ function justifyPhotosAjax(id) { } function dolike(ident, verb) { - $('#like-rotator-' + ident.toString()).show(); + $('#like-rotator-' + ident).show(); - if(typeof conv_mode == typeof undefined) + if (typeof conv_mode == typeof undefined) { conv_mode = ''; + } - if(typeof page_mode == typeof undefined) + if (typeof page_mode == typeof undefined) { page_mode = ''; + } + + let reload = 0; - var reload = ''; - if(module == 'photos') + if (module == 'photos') { reload = 1; + } + - $.get('like/' + ident.toString() + '?verb=' + verb + '&conv_mode=' + conv_mode + '&page_mode=' + page_mode + '&reload=' + reload, function (data) { - if(data.success) { + $.get('like/' + ident + '?verb=' + verb + '&conv_mode=' + conv_mode + '&page_mode=' + page_mode + '&reload=' + reload, function (data) { + if (data.success) { + + close_modal(); // mod photos if (data.reload) { @@ -1213,10 +1220,9 @@ function dolike(ident, verb) { $('#wall-item-ago-' + data.id + ' .autotime').timeago(); collapseHeight(); liking = 0; - // remove modal backdrop in case the update was triggered from a modal - $('.modal-backdrop').remove(); } }); + liking = 1; } @@ -1332,26 +1338,28 @@ function dropItem(url, object, b64mid) { } function dosubthread(ident) { - $('#like-rotator-' + ident.toString()).show(); - $.get('subthread/sub/' + ident.toString(), updateInit ); + $('#like-rotator-' + ident).show(); + $.get('subthread/sub/' + ident, updateInit ); liking = 1; } function dounsubthread(ident) { - $('#like-rotator-' + ident.toString()).show(); - $.get('subthread/unsub/' + ident.toString(), updateInit ); + $('#like-rotator-' + ident).show(); + $.get('subthread/unsub/' + ident, updateInit ); liking = 1; } -function moderate_approve(ident) { - $('#like-rotator-' + ident.toString()).show(); - $.get('moderate/' + ident.toString() + '/approve', updateInit ); +function moderate_approve(ident, verb) { + $('#like-rotator-' + ident).show(); + close_modal(); + $.get('moderate/' + ident + '/approve', updateInit ); liking = 1; } function moderate_drop(ident) { - $('#like-rotator-' + ident.toString()).show(); - $.get('moderate/' + ident.toString() + '/drop', $('#thread-wrapper-' + ident.toString()).fadeOut(function() { this.remove(); })); + $('#like-rotator-' + ident).show(); + close_modal(); + $.get('moderate/' + ident + '/drop', $('#thread-wrapper-' + ident).fadeOut(function() { this.remove(); })); liking = 1; } @@ -1723,3 +1731,11 @@ function toast(string, severity) { toastInstance.show(); } + +function close_modal() { + let modal = bootstrap.Modal.getInstance(document.querySelector('.modal.show')); + + if (modal) { + modal.hide(); + } +} |