Improved JS, updating single items now work

This commit is contained in:
Michael 2018-02-27 22:37:11 +00:00
parent 4070ad1815
commit 9cf342f02a
3 changed files with 40 additions and 37 deletions

View file

@ -760,10 +760,12 @@ function networkThreadedView(App $a, $update, $parent)
// Fetch a page full of parent items for this page
if ($update) {
if (!empty($parent)) {
logger('Blubb: '.$parent);
$sql_extra4 = "`item`.`id` = ".intval($parent);
} else {
$sql_extra4 = "`item`.`unseen`";
if (Config::get("system", "like_no_comment")) {
$sql_extra4 .= " AND `item`.`verb` = '".ACTIVITY_POST."'";
}
}
$r = q("SELECT `item`.`parent-uri` AS `uri`, `item`.`parent` AS `item_id`, $sql_order AS `order_date`

View file

@ -9,7 +9,7 @@ function _resizeIframe(obj, desth) {
if (h == (ch + 'px')) {
return;
}
if (desth == ch && ch>0) {
if (desth == ch && ch > 0) {
obj.style.height = ch + 'px';
}
setTimeout(_resizeIframe, 100, obj, ch);
@ -77,7 +77,7 @@ $(function() {
var o = $(this);
var bbcode = o.data('bbcode');
var id = o.data('id');
if (bbcode=="img") {
if (bbcode == "img") {
Dialog.doImageBrowser("comment", id);
return;
}
@ -99,7 +99,7 @@ $(function() {
$(".onoff input").each(function() {
val = $(this).val();
id = $(this).attr("id");
$("#"+id+"_onoff ."+ (val==0?"on":"off")).addClass("hidden");
$("#"+id+"_onoff ." + (val == 0 ? "on":"off")).addClass("hidden");
});
$(".onoff > a").click(function(event) {
@ -107,8 +107,8 @@ $(function() {
var input = $(this).siblings("input");
var val = 1-input.val();
var id = input.attr("id");
$("#"+id+"_onoff ."+ (val==0?"on":"off")).addClass("hidden");
$("#"+id+"_onoff ."+ (val==1?"on":"off")).removeClass("hidden");
$("#"+id+"_onoff ." + (val == 0 ? "on":"off")).addClass("hidden");
$("#"+id+"_onoff ." + (val == 1 ? "on":"off")).removeClass("hidden");
input.val(val);
});
@ -130,7 +130,7 @@ $(function() {
if (isSelected) {
return false;
}
menu = $( $(this).attr('rel') );
menu = $($(this).attr('rel'));
e.preventDefault();
e.stopPropagation();
if (menu.attr('popup') == "false") {
@ -166,8 +166,8 @@ $(function() {
/* notifications template */
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
var notifications_all = unescape($('<div>').append( $("#nav-notifications-see-all").clone() ).html()); //outerHtml hack
var notifications_mark = unescape($('<div>').append( $("#nav-notifications-mark-all").clone() ).html()); //outerHtml hack
var notifications_all = unescape($('<div>').append($("#nav-notifications-see-all").clone()).html()); //outerHtml hack
var notifications_mark = unescape($('<div>').append($("#nav-notifications-mark-all").clone()).html()); //outerHtml hack
var notifications_empty = unescape($("#nav-notifications-menu").html());
/* enable perfect-scrollbars for different elements */
@ -345,7 +345,7 @@ $(function() {
comparison = top < scrollTop - 1;
}
if (comparison) {
$('html, body').animate({ scrollTop: top }, 200);
$('html, body').animate({scrollTop: top}, 200);
return false;
}
});
@ -396,11 +396,11 @@ function NavUpdate() {
}
function liveUpdate(src) {
if ((src == null) || (stopped) || (! profile_uid)) {
if ((src == null) || stopped || !profile_uid) {
$('.like-rotator').hide(); return;
}
if (($('.comment-edit-text-full').length) || (in_progress)) {
if (($('.comment-edit-text-full').length) || in_progress) {
if (livetime) {
clearTimeout(livetime);
}
@ -493,7 +493,7 @@ function imgdull(node) {
function dolike(ident,verb) {
unpause();
$('#like-rotator-' + ident.toString()).show();
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate);
liking = 1;
force_update = true;
update_item = ident.toString();
@ -502,7 +502,7 @@ function dolike(ident,verb) {
function dosubthread(ident) {
unpause();
$('#like-rotator-' + ident.toString()).show();
$.get('subthread/' + ident.toString(), NavUpdate );
$.get('subthread/' + ident.toString(), NavUpdate);
liking = 1;
}
@ -573,7 +573,7 @@ function lockview(event,id) {
lockvisible = true;
$.get('lockview/' + id, function(data) {
$('#panel').html(data);
$('#panel').css({ 'left': cursor.x + 5 , 'top': cursor.y + 5});
$('#panel').css({'left': cursor.x + 5 , 'top': cursor.y + 5});
$('#panel').show();
});
}
@ -625,7 +625,7 @@ function preview_comment(id) {
function(data) {
if (data.preview) {
$("#comment-edit-preview-" + id).html(data.preview);
$("#comment-edit-preview-" + id + " a").click(function() { return false; });
$("#comment-edit-preview-" + id + " a").click(function() {return false;});
}
},
"json"
@ -652,7 +652,7 @@ function preview_post() {
function(data) {
if (data.preview) {
$("#jot-preview-content").html(data.preview);
$("#jot-preview-content" + " a").click(function() { return false; });
$("#jot-preview-content" + " a").click(function() {return false;});
}
},
"json"

View file

@ -752,6 +752,7 @@ function doLikeAction(ident, verb) {
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
liking = 1;
force_update = true;
update_item = ident.toString();
}
// Decodes a hexadecimally encoded binary string