Optimized version of the possibility to reload the content of the network page only at its top.
This commit is contained in:
parent
1a865bf400
commit
4d6f28d224
4 changed files with 12 additions and 18 deletions
11
js/main.js
11
js/main.js
|
@ -21,6 +21,7 @@
|
||||||
var src = null;
|
var src = null;
|
||||||
var prev = null;
|
var prev = null;
|
||||||
var livetime = null;
|
var livetime = null;
|
||||||
|
var force_update = false;
|
||||||
var msie = false;
|
var msie = false;
|
||||||
var stopped = false;
|
var stopped = false;
|
||||||
var totStopped = false;
|
var totStopped = false;
|
||||||
|
@ -301,11 +302,16 @@
|
||||||
prev = 'live-' + src;
|
prev = 'live-' + src;
|
||||||
|
|
||||||
in_progress = true;
|
in_progress = true;
|
||||||
|
|
||||||
|
if ($(document).scrollTop() == 0)
|
||||||
|
force_update = true;
|
||||||
|
|
||||||
var udargs = ((netargs.length) ? '/' + netargs : '');
|
var udargs = ((netargs.length) ? '/' + netargs : '');
|
||||||
var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0) + '&top=' + ($(document).scrollTop() != 0 ? '0' : '1');
|
var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0) + '&force=' + (force_update ? '1' : '0');
|
||||||
|
|
||||||
$.get(update_url,function(data) {
|
$.get(update_url,function(data) {
|
||||||
in_progress = false;
|
in_progress = false;
|
||||||
|
force_update = false;
|
||||||
// $('.collapsed-comments',data).each(function() {
|
// $('.collapsed-comments',data).each(function() {
|
||||||
// var ident = $(this).attr('id');
|
// var ident = $(this).attr('id');
|
||||||
// var is_hidden = $('#' + ident).is(':hidden');
|
// var is_hidden = $('#' + ident).is(':hidden');
|
||||||
|
@ -414,6 +420,7 @@
|
||||||
$('#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;
|
||||||
}
|
}
|
||||||
|
|
||||||
function dosubthread(ident) {
|
function dosubthread(ident) {
|
||||||
|
@ -505,6 +512,7 @@
|
||||||
commentClose(tarea,id);
|
commentClose(tarea,id);
|
||||||
if(timer) clearTimeout(timer);
|
if(timer) clearTimeout(timer);
|
||||||
timer = setTimeout(NavUpdate,10);
|
timer = setTimeout(NavUpdate,10);
|
||||||
|
force_update = true;
|
||||||
}
|
}
|
||||||
if(data.reload) {
|
if(data.reload) {
|
||||||
window.location.href=data.reload;
|
window.location.href=data.reload;
|
||||||
|
@ -637,6 +645,7 @@ function notifyMarkAll() {
|
||||||
$.get('notify/mark/all', function(data) {
|
$.get('notify/mark/all', function(data) {
|
||||||
if(timer) clearTimeout(timer);
|
if(timer) clearTimeout(timer);
|
||||||
timer = setTimeout(NavUpdate,1000);
|
timer = setTimeout(NavUpdate,1000);
|
||||||
|
force_update = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -911,10 +911,6 @@ function item_post(&$a) {
|
||||||
|
|
||||||
call_hooks('post_local_end', $datarray);
|
call_hooks('post_local_end', $datarray);
|
||||||
|
|
||||||
// if no auto update is enabled, then disable it temporarily
|
|
||||||
if (get_pconfig($profile_uid, "system", "no_auto_update") == 1)
|
|
||||||
set_pconfig($profile_uid, "system", "no_auto_update", -1);
|
|
||||||
|
|
||||||
if(strlen($emailcc) && $profile_uid == local_user()) {
|
if(strlen($emailcc) && $profile_uid == local_user()) {
|
||||||
$erecips = explode(',', $emailcc);
|
$erecips = explode(',', $emailcc);
|
||||||
if(count($erecips)) {
|
if(count($erecips)) {
|
||||||
|
|
|
@ -136,10 +136,6 @@ function like_content(&$a) {
|
||||||
// Save the author information for the unlike in case we need to relay to Diaspora
|
// Save the author information for the unlike in case we need to relay to Diaspora
|
||||||
store_diaspora_like_retract_sig($activity, $item, $like_item, $contact);
|
store_diaspora_like_retract_sig($activity, $item, $like_item, $contact);
|
||||||
|
|
||||||
// if no auto update is enabled, then disable it temporarily
|
|
||||||
if (get_pconfig($owner_uid, "system", "no_auto_update") == 1)
|
|
||||||
set_pconfig($owner_uid, "system", "no_auto_update", -1);
|
|
||||||
|
|
||||||
// proc_run('php',"include/notifier.php","like","$post_id"); // $post_id isn't defined here!
|
// proc_run('php',"include/notifier.php","like","$post_id"); // $post_id isn't defined here!
|
||||||
$like_item_id = $like_item['id'];
|
$like_item_id = $like_item['id'];
|
||||||
proc_run('php',"include/notifier.php","like","$like_item_id");
|
proc_run('php',"include/notifier.php","like","$like_item_id");
|
||||||
|
@ -222,10 +218,6 @@ EOT;
|
||||||
// Save the author information for the like in case we need to relay to Diaspora
|
// Save the author information for the like in case we need to relay to Diaspora
|
||||||
store_diaspora_like_sig($activity, $post_type, $contact, $post_id);
|
store_diaspora_like_sig($activity, $post_type, $contact, $post_id);
|
||||||
|
|
||||||
// if no auto update is enabled, then disable it temporarily
|
|
||||||
if (get_pconfig($owner_uid, "system", "no_auto_update") == 1)
|
|
||||||
set_pconfig($owner_uid, "system", "no_auto_update", -1);
|
|
||||||
|
|
||||||
$arr['id'] = $post_id;
|
$arr['id'] = $post_id;
|
||||||
|
|
||||||
call_hooks('post_local_end', $arr);
|
call_hooks('post_local_end', $arr);
|
||||||
|
|
|
@ -13,12 +13,9 @@ function update_network_content(&$a) {
|
||||||
echo "<!DOCTYPE html><html><body>\r\n";
|
echo "<!DOCTYPE html><html><body>\r\n";
|
||||||
echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
|
echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
|
||||||
|
|
||||||
$no_auto_update = get_pconfig($profile_uid, "system", "no_auto_update");
|
if (!get_pconfig($profile_uid, "system", "no_auto_update") OR ($_GET['force'] == 1))
|
||||||
if (($no_auto_update <= 0) OR ($_GET['top'] == 1)) {
|
|
||||||
$text = network_content($a,$profile_uid);
|
$text = network_content($a,$profile_uid);
|
||||||
if ($no_auto_update < 0)
|
else
|
||||||
set_pconfig($profile_uid, "system", "no_auto_update", 1);
|
|
||||||
} else
|
|
||||||
$text = "";
|
$text = "";
|
||||||
|
|
||||||
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
||||||
|
|
Loading…
Reference in a new issue