tie the main slider to ajax updates and buildCmd

This commit is contained in:
friendica 2012-07-25 19:45:45 -07:00
parent fc53a7a09e
commit 21b3dc9c27
6 changed files with 35 additions and 25 deletions

View File

@ -327,13 +327,19 @@ function updateConvItems(mode,data) {
in_progress = true;
var udargs = ((page_load) ? '/load' : '');
page_load = false;
var update_url;
var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0);
if(typeof buildCmd == 'function') {
update_url = buildCmd();
}
else {
var udargs = ((page_load) ? '/load' : '');
update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0);
}
$.get(update_url,function(data) {
var update_mode = ((page_load) ? 'replace' : 'update');
var update_mode = ((page_load) ? 'replace' : 'update');
page_load = false;
in_progress = false;
updateConvItems(update_mode,data);
});

View File

@ -488,7 +488,7 @@ function network_content(&$a, $update = 0, $load = false) {
$a->page['htmlhead'] .= "<script>\r\n"
. "var network_cmd = " . '"' . $a->get_baseurl() . '/network/' . '"' . ";\r\n"
. "var network_cmd = " . '"' . $a->get_baseurl() . '/update_network' . '"' . ";\r\n"
. "var network_uid = " . ((local_user()) ? local_user() : 0) . ";\r\n"
. "var network_gid = " . (($gid) ? $gid : 0) . ";\r\n"
. "var network_cid = " . (($_GET['cid']) ? $_GET['cid'] : 0) . ";\r\n"
@ -508,21 +508,23 @@ function network_content(&$a, $update = 0, $load = false) {
. 'var network_dend = "' . $datequery . '"' . ";\r\n"
. 'var network_dbegin = "' . $datequery2 . '"' . ";\r\n"
. 'function buildCmd() { var bCmd = network_cmd + "?f=" ;
. 'function buildCmd() {
var udargs = ((page_load) ? "/load" : "");
var bCmd = network_cmd + udargs + "?f=" ;
if(network_uid) bCmd = bCmd + "&p=" + network_uid;
if(network_cmin) bCmd = bCmd + "&cmin=" + network_cmin;
if(network_cmax) bCmd = bCmd + "&cmax=" + network_cmax;
if(network_gid) { bCmd = bCmd + "&gid=" + network_gid; } else
if(network_cid) { bCmd = bCmd + "&cid=" + network_cid; }
if(network_star) bCmd = bCmd + "&star=" + network_star;
if(network_liked) bCmd = bCmd + "&liked=" + network_liked;
if(network_conv) bCmd = bCmd + "&conv=" + network_conv;
if(network_spam) bCmd = bCmd + "&spam=" + network_spam;
if(network_new) bCmd = bCmd + "&new=" + network_new;
if(network_search) bCmd = bCmd + "&search=" + network_search;
if(network_file) bCmd = bCmd + "&file=" + network_file;
if(network_dend) bCmd = bCmd + "&dend=" + network_dend;
if(network_dbegin) bCmd = bCmd + "&dbegin=" + network_dbegin;
if(network_cmin != 0) bCmd = bCmd + "&cmin=" + network_cmin;
if(network_cmax != 99) bCmd = bCmd + "&cmax=" + network_cmax;
if(network_gid != 0) { bCmd = bCmd + "&gid=" + network_gid; } else
if(network_cid != 0) { bCmd = bCmd + "&cid=" + network_cid; }
if(network_star != 0) bCmd = bCmd + "&star=" + network_star;
if(network_liked != 0) bCmd = bCmd + "&liked=" + network_liked;
if(network_conv!= 0) bCmd = bCmd + "&conv=" + network_conv;
if(network_spam != 0) bCmd = bCmd + "&spam=" + network_spam;
if(network_new != 0) bCmd = bCmd + "&new=" + network_new;
if(network_search != "") bCmd = bCmd + "&search=" + network_search;
if(network_file != "") bCmd = bCmd + "&file=" + network_file;
if(network_dend != "") bCmd = bCmd + "&dend=" + network_dend;
if(network_dbegin != "") bCmd = bCmd + "&dbegin=" + network_dbegin;
if(network_page != 1) bCmd = bCmd + "&page=" + network_page;
return(bCmd);

View File

@ -11,10 +11,12 @@
function networkRefresh() {
if((document.readyState !== "complete") || (slideTimer !== null))
return;
slideTimer = setTimeout(networkTimerRefresh,5000);
slideTimer = setTimeout(networkTimerRefresh,2000);
}
function networkTimerRefresh() {
window.location.href = buildCmd();
slideTimer = null;
page_load = true;
liveUpdate();
}
</script>

View File

@ -42,7 +42,7 @@
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
{{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }}
</div>
{{ if $item.drop.dropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
{{ if $item.drop.pagedropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
<div class="wall-item-delete-end"></div>
</div>
</div>

View File

@ -62,9 +62,9 @@
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer"></a>
{{ endif }}
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
{{ if $item.drop.pagedropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }}
{{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }}
</div>
{{ if $item.drop.dropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
{{ if $item.drop.pagedropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
<div class="wall-item-delete-end"></div>
</div>
</div>

View File

@ -69,7 +69,7 @@
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
{{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }}
</div>
{{ if $item.drop.dropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
{{ if $item.drop.pagedropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
<div class="wall-item-delete-end"></div>
</div>
</div>