aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/main.js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-11-21 20:15:05 +0000
committerMario <mario@mariovavti.com>2020-11-21 20:15:05 +0000
commit7639157a4907e9dbdffe6dd24f4f687f4cce6f01 (patch)
treee4d22a7f385fe1fbe0ca182aa9c116b1d0030343 /view/js/main.js
parentf74cfaec5f48ec37cc1f51e5381a45998ebc70e3 (diff)
downloadvolse-hubzilla-7639157a4907e9dbdffe6dd24f4f687f4cce6f01.tar.gz
volse-hubzilla-7639157a4907e9dbdffe6dd24f4f687f4cce6f01.tar.bz2
volse-hubzilla-7639157a4907e9dbdffe6dd24f4f687f4cce6f01.zip
restrict returned html usage to local_channel() until some issues will be worked out
Diffstat (limited to 'view/js/main.js')
-rw-r--r--view/js/main.js54
1 files changed, 33 insertions, 21 deletions
diff --git a/view/js/main.js b/view/js/main.js
index b7cfb75db..5b6431858 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -1148,24 +1148,30 @@ function justifyPhotosAjax(id) {
function dolike(ident, verb) {
$('#like-rotator-' + ident.toString()).show();
- $.get('like/' + ident.toString() + '?verb=' + verb, function (data) {
- data = JSON.parse(data);
- if(data.success) {
- // this is a bit tricky since the top level thread wrapper wraps the whole thread
- if($('#thread-wrapper-' + data.orig_id).hasClass('toplevel_item')) {
- var wrapper = $('<div></div>').html( data.html ).find('#wall-item-outside-wrapper-' + data.id);
- $('#wall-item-outside-wrapper-' + data.orig_id).html(wrapper[0].innerHTML);
- // those were not replaced - swap the id
- $('#thread-wrapper-' + data.orig_id).attr('id', 'thread-wrapper-' + data.id);
- $('#wall-item-outside-wrapper-' + data.orig_id).attr('id', 'wall-item-outside-wrapper-' + data.id);
- }
- else {
- $('#thread-wrapper-' + data.orig_id).replaceWith(data.html);
+
+ if(! localUser) {
+ $.get('like/' + ident.toString() + '?verb=' + verb, updateInit);
+ }
+ else {
+ $.get('like/' + ident.toString() + '?verb=' + verb, function (data) {
+ data = JSON.parse(data);
+ if(data.success) {
+ // this is a bit tricky since the top level thread wrapper wraps the whole thread
+ if($('#thread-wrapper-' + data.orig_id).hasClass('toplevel_item')) {
+ var wrapper = $('<div></div>').html( data.html ).find('#wall-item-outside-wrapper-' + data.id);
+ $('#wall-item-outside-wrapper-' + data.orig_id).html(wrapper[0].innerHTML);
+ // those were not replaced - swap the id
+ $('#thread-wrapper-' + data.orig_id).attr('id', 'thread-wrapper-' + data.id);
+ $('#wall-item-outside-wrapper-' + data.orig_id).attr('id', 'wall-item-outside-wrapper-' + data.id);
+ }
+ else {
+ $('#thread-wrapper-' + data.orig_id).replaceWith(data.html);
+ }
+ $('#wall-item-ago-' + data.id + ' .autotime').timeago();
+ liking = 0;
}
- $('#wall-item-ago-' + data.id + ' .autotime').timeago();
- liking = 0;
- }
- });
+ });
+ }
liking = 1;
}
@@ -1374,10 +1380,16 @@ function post_comment(id) {
localStorage.removeItem("comment_body-" + id);
$("#comment-edit-preview-" + id).hide();
$("#comment-edit-text-" + id).val('').blur().attr('placeholder', aStr.comment);
- $('#wall-item-comment-wrapper-' + id).before(data.html);
- $('#wall-item-ago-' + data.id + ' .autotime').timeago();
- $('body').css('cursor', 'unset');
- commentBusy = false;
+
+ if(! localUser) {
+ updateInit();
+ }
+ else {
+ $('#wall-item-comment-wrapper-' + id).before(data.html);
+ $('#wall-item-ago-' + data.id + ' .autotime').timeago();
+ $('body').css('cursor', 'unset');
+ commentBusy = false;
+ }
var tarea = document.getElementById("comment-edit-text-" + id);
if(tarea) {