Improved JS, updating single items now work
This commit is contained in:
parent
4070ad1815
commit
9cf342f02a
|
@ -760,10 +760,12 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
// Fetch a page full of parent items for this page
|
// Fetch a page full of parent items for this page
|
||||||
if ($update) {
|
if ($update) {
|
||||||
if (!empty($parent)) {
|
if (!empty($parent)) {
|
||||||
logger('Blubb: '.$parent);
|
|
||||||
$sql_extra4 = "`item`.`id` = ".intval($parent);
|
$sql_extra4 = "`item`.`id` = ".intval($parent);
|
||||||
} else {
|
} else {
|
||||||
$sql_extra4 = "`item`.`unseen`";
|
$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`
|
$r = q("SELECT `item`.`parent-uri` AS `uri`, `item`.`parent` AS `item_id`, $sql_order AS `order_date`
|
||||||
|
|
|
@ -9,7 +9,7 @@ function _resizeIframe(obj, desth) {
|
||||||
if (h == (ch + 'px')) {
|
if (h == (ch + 'px')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (desth == ch && ch>0) {
|
if (desth == ch && ch > 0) {
|
||||||
obj.style.height = ch + 'px';
|
obj.style.height = ch + 'px';
|
||||||
}
|
}
|
||||||
setTimeout(_resizeIframe, 100, obj, ch);
|
setTimeout(_resizeIframe, 100, obj, ch);
|
||||||
|
@ -75,9 +75,9 @@ $(function() {
|
||||||
$('body').on('click','[data-role="insert-formatting"]', function(e) {
|
$('body').on('click','[data-role="insert-formatting"]', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var o = $(this);
|
var o = $(this);
|
||||||
var bbcode = o.data('bbcode');
|
var bbcode = o.data('bbcode');
|
||||||
var id = o.data('id');
|
var id = o.data('id');
|
||||||
if (bbcode=="img") {
|
if (bbcode == "img") {
|
||||||
Dialog.doImageBrowser("comment", id);
|
Dialog.doImageBrowser("comment", id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ $(function() {
|
||||||
$(".onoff input").each(function() {
|
$(".onoff input").each(function() {
|
||||||
val = $(this).val();
|
val = $(this).val();
|
||||||
id = $(this).attr("id");
|
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) {
|
$(".onoff > a").click(function(event) {
|
||||||
|
@ -107,8 +107,8 @@ $(function() {
|
||||||
var input = $(this).siblings("input");
|
var input = $(this).siblings("input");
|
||||||
var val = 1-input.val();
|
var val = 1-input.val();
|
||||||
var id = input.attr("id");
|
var id = input.attr("id");
|
||||||
$("#"+id+"_onoff ."+ (val==0?"on":"off")).addClass("hidden");
|
$("#"+id+"_onoff ." + (val == 0 ? "on":"off")).addClass("hidden");
|
||||||
$("#"+id+"_onoff ."+ (val==1?"on":"off")).removeClass("hidden");
|
$("#"+id+"_onoff ." + (val == 1 ? "on":"off")).removeClass("hidden");
|
||||||
input.val(val);
|
input.val(val);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ $(function() {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
menu = $( $(this).attr('rel') );
|
menu = $($(this).attr('rel'));
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (menu.attr('popup') == "false") {
|
if (menu.attr('popup') == "false") {
|
||||||
|
@ -166,8 +166,8 @@ $(function() {
|
||||||
|
|
||||||
/* notifications template */
|
/* notifications template */
|
||||||
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
|
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_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_mark = unescape($('<div>').append($("#nav-notifications-mark-all").clone()).html()); //outerHtml hack
|
||||||
var notifications_empty = unescape($("#nav-notifications-menu").html());
|
var notifications_empty = unescape($("#nav-notifications-menu").html());
|
||||||
|
|
||||||
/* enable perfect-scrollbars for different elements */
|
/* enable perfect-scrollbars for different elements */
|
||||||
|
@ -260,7 +260,7 @@ $(function() {
|
||||||
var notification = new Notification(document.title, {
|
var notification = new Notification(document.title, {
|
||||||
body: decodeHtml(e.message.replace('→ ', '').format(e.name)),
|
body: decodeHtml(e.message.replace('→ ', '').format(e.name)),
|
||||||
icon: e.photo,
|
icon: e.photo,
|
||||||
});
|
});
|
||||||
notification['url'] = e.href;
|
notification['url'] = e.href;
|
||||||
notification.addEventListener("click", function(ev) {
|
notification.addEventListener("click", function(ev) {
|
||||||
window.location = ev.target.url;
|
window.location = ev.target.url;
|
||||||
|
@ -345,7 +345,7 @@ $(function() {
|
||||||
comparison = top < scrollTop - 1;
|
comparison = top < scrollTop - 1;
|
||||||
}
|
}
|
||||||
if (comparison) {
|
if (comparison) {
|
||||||
$('html, body').animate({ scrollTop: top }, 200);
|
$('html, body').animate({scrollTop: top}, 200);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -396,11 +396,11 @@ function NavUpdate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function liveUpdate(src) {
|
function liveUpdate(src) {
|
||||||
if ((src == null) || (stopped) || (! profile_uid)) {
|
if ((src == null) || stopped || !profile_uid) {
|
||||||
$('.like-rotator').hide(); return;
|
$('.like-rotator').hide(); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($('.comment-edit-text-full').length) || (in_progress)) {
|
if (($('.comment-edit-text-full').length) || in_progress) {
|
||||||
if (livetime) {
|
if (livetime) {
|
||||||
clearTimeout(livetime);
|
clearTimeout(livetime);
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ function imgdull(node) {
|
||||||
function dolike(ident,verb) {
|
function dolike(ident,verb) {
|
||||||
unpause();
|
unpause();
|
||||||
$('#like-rotator-' + ident.toString()).show();
|
$('#like-rotator-' + ident.toString()).show();
|
||||||
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
|
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate);
|
||||||
liking = 1;
|
liking = 1;
|
||||||
force_update = true;
|
force_update = true;
|
||||||
update_item = ident.toString();
|
update_item = ident.toString();
|
||||||
|
@ -502,7 +502,7 @@ function dolike(ident,verb) {
|
||||||
function dosubthread(ident) {
|
function dosubthread(ident) {
|
||||||
unpause();
|
unpause();
|
||||||
$('#like-rotator-' + ident.toString()).show();
|
$('#like-rotator-' + ident.toString()).show();
|
||||||
$.get('subthread/' + ident.toString(), NavUpdate );
|
$.get('subthread/' + ident.toString(), NavUpdate);
|
||||||
liking = 1;
|
liking = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ function lockview(event,id) {
|
||||||
lockvisible = true;
|
lockvisible = true;
|
||||||
$.get('lockview/' + id, function(data) {
|
$.get('lockview/' + id, function(data) {
|
||||||
$('#panel').html(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();
|
$('#panel').show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -625,7 +625,7 @@ function preview_comment(id) {
|
||||||
function(data) {
|
function(data) {
|
||||||
if (data.preview) {
|
if (data.preview) {
|
||||||
$("#comment-edit-preview-" + id).html(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"
|
"json"
|
||||||
|
@ -652,7 +652,7 @@ function preview_post() {
|
||||||
function(data) {
|
function(data) {
|
||||||
if (data.preview) {
|
if (data.preview) {
|
||||||
$("#jot-preview-content").html(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"
|
"json"
|
||||||
|
@ -723,26 +723,26 @@ function loadScrollContent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function bin2hex(s) {
|
function bin2hex(s) {
|
||||||
// Converts the binary representation of data to hex
|
// Converts the binary representation of data to hex
|
||||||
//
|
//
|
||||||
// version: 812.316
|
// version: 812.316
|
||||||
// discuss at: http://phpjs.org/functions/bin2hex
|
// discuss at: http://phpjs.org/functions/bin2hex
|
||||||
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
||||||
// + bugfixed by: Onno Marsman
|
// + bugfixed by: Onno Marsman
|
||||||
// + bugfixed by: Linuxworld
|
// + bugfixed by: Linuxworld
|
||||||
// * example 1: bin2hex('Kev');
|
// * example 1: bin2hex('Kev');
|
||||||
// * returns 1: '4b6576'
|
// * returns 1: '4b6576'
|
||||||
// * example 2: bin2hex(String.fromCharCode(0x00));
|
// * example 2: bin2hex(String.fromCharCode(0x00));
|
||||||
// * returns 2: '00'
|
// * returns 2: '00'
|
||||||
var v,i, f = 0, a = [];
|
var v,i, f = 0, a = [];
|
||||||
s += '';
|
s += '';
|
||||||
f = s.length;
|
f = s.length;
|
||||||
|
|
||||||
for (i = 0; i<f; i++) {
|
for (i = 0; i<f; i++) {
|
||||||
a[i] = s.charCodeAt(i).toString(16).replace(/^([\da-f])$/,"0$1");
|
a[i] = s.charCodeAt(i).toString(16).replace(/^([\da-f])$/,"0$1");
|
||||||
}
|
}
|
||||||
|
|
||||||
return a.join('');
|
return a.join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function groupChangeMember(gid, cid, sec_token) {
|
function groupChangeMember(gid, cid, sec_token) {
|
||||||
|
|
|
@ -752,6 +752,7 @@ function doLikeAction(ident, verb) {
|
||||||
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
|
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
|
||||||
liking = 1;
|
liking = 1;
|
||||||
force_update = true;
|
force_update = true;
|
||||||
|
update_item = ident.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decodes a hexadecimally encoded binary string
|
// Decodes a hexadecimally encoded binary string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user