mirror of
https://github.com/friendica/friendica
synced 2024-11-19 03:03:41 +00:00
convert update script arg passing to js - remembering the browser prefetch issues
This commit is contained in:
parent
3cc63f2e6f
commit
f7b2f9f5e7
3 changed files with 20 additions and 31 deletions
|
@ -108,7 +108,10 @@
|
||||||
prev = 'live-' + src;
|
prev = 'live-' + src;
|
||||||
|
|
||||||
in_progress = true;
|
in_progress = true;
|
||||||
$.get('update_' + src + '?p=' + profile_uid + '&msie=' + ((msie) ? 1 : 0),function(data) {
|
var udargs = '/' + netargs;
|
||||||
|
var update_url = 'update_' + src + udargs + '?p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0);
|
||||||
|
|
||||||
|
$.get(update_url,function(data) {
|
||||||
in_progress = false;
|
in_progress = false;
|
||||||
$('.wall-item-outside-wrapper',data).each(function() {
|
$('.wall-item-outside-wrapper',data).each(function() {
|
||||||
var ident = $(this).attr('id');
|
var ident = $(this).attr('id');
|
||||||
|
|
|
@ -40,34 +40,21 @@ function network_content(&$a, $update = 0) {
|
||||||
|
|
||||||
$nouveau = false;
|
$nouveau = false;
|
||||||
|
|
||||||
if($update && (x($_SESSION,'netargs'))) {
|
if(($a->argc > 2) && $a->argv[2] === 'new')
|
||||||
$nouveau = $_SESSION['netargs']['nouveau'];
|
$nouveau = true;
|
||||||
$group = $_SESSION['netargs']['group'];
|
|
||||||
if(strlen($group))
|
|
||||||
$group_acl = array('allow_gid' => '<' . $group . '>');
|
|
||||||
$a->pager['page'] = $_SESSION['netargs']['page'];
|
|
||||||
$a->set_pager_itemspage(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if($a->argc > 1) {
|
||||||
|
if($a->argv[1] === 'new')
|
||||||
|
$nouveau = true;
|
||||||
|
else {
|
||||||
|
$group = intval($a->argv[1]);
|
||||||
|
$group_acl = array('allow_gid' => '<' . $group . '>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(! $update) {
|
if(! $update) {
|
||||||
$o .= '<script> $(document).ready(function() { $(\'#nav-network-link\').addClass(\'nav-selected\'); });</script>';
|
$o .= '<script> $(document).ready(function() { $(\'#nav-network-link\').addClass(\'nav-selected\'); });</script>';
|
||||||
|
|
||||||
if(($a->argc > 2) && $a->argv[2] === 'new')
|
|
||||||
$nouveau = true;
|
|
||||||
|
|
||||||
// pull out the group here because the updater might have different args
|
|
||||||
if($a->argc > 1) {
|
|
||||||
if($a->argv[1] === 'new')
|
|
||||||
$nouveau = true;
|
|
||||||
else {
|
|
||||||
$group = intval($a->argv[1]);
|
|
||||||
$group_acl = array('allow_gid' => '<' . $group . '>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$_SESSION['netargs'] = array('nouveau' => $nouveau, 'group' => $group, 'page' => $a->pager['page']);
|
|
||||||
$_SESSION['return_url'] = $a->cmd;
|
$_SESSION['return_url'] = $a->cmd;
|
||||||
|
|
||||||
$geotag = (($a->user['allow_location']) ? load_view_file('view/jot_geotag.tpl') : '');
|
$geotag = (($a->user['allow_location']) ? load_view_file('view/jot_geotag.tpl') : '');
|
||||||
|
@ -118,10 +105,10 @@ function network_content(&$a, $update = 0) {
|
||||||
// filtering by group and also you aren't writing a comment (the last
|
// filtering by group and also you aren't writing a comment (the last
|
||||||
// criteria is discovered in javascript).
|
// criteria is discovered in javascript).
|
||||||
|
|
||||||
// if($a->pager['start'] == 0 && $a->argc == 1) {
|
|
||||||
$o .= '<div id="live-network"></div>' . "\r\n";
|
$o .= '<div id="live-network"></div>' . "\r\n";
|
||||||
$o .= "<script> var profile_uid = " . $_SESSION['uid'] . "; </script>\r\n";
|
$o .= "<script> var profile_uid = " . $_SESSION['uid']
|
||||||
// }
|
. "; var netargs = '" . substr($a->cmd,8)
|
||||||
|
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,6 @@ function profile_content(&$a, $update = 0) {
|
||||||
|
|
||||||
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
|
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
|
||||||
|
|
||||||
|
|
||||||
if(! $update) {
|
if(! $update) {
|
||||||
if(x($_GET,'tab'))
|
if(x($_GET,'tab'))
|
||||||
$tab = notags(trim($_GET['tab']));
|
$tab = notags(trim($_GET['tab']));
|
||||||
|
@ -161,11 +160,11 @@ function profile_content(&$a, $update = 0) {
|
||||||
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
|
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
|
||||||
// because browser prefetching might change it on us. We have to deliver it with the page.
|
// because browser prefetching might change it on us. We have to deliver it with the page.
|
||||||
|
|
||||||
if($tab === 'posts' && (! $a->pager['start'])) {
|
if($tab === 'posts') {
|
||||||
$o .= '<div id="live-profile"></div>' . "\r\n";
|
$o .= '<div id="live-profile"></div>' . "\r\n";
|
||||||
$o .= "<script> var profile_uid = " . $a->profile['profile_uid'] . "; </script>\r\n";
|
$o .= "<script> var profile_uid = " . $a->profile['profile_uid']
|
||||||
|
. "; var netargs = ''; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct permissions
|
// Construct permissions
|
||||||
|
|
Loading…
Reference in a new issue