move counters processing to different xmlhttp object

This commit is contained in:
Andrew Dolgov 2006-09-29 04:44:58 +01:00
parent 7bc4f2517f
commit abbe0154f7
4 changed files with 119 additions and 15 deletions

View File

@ -112,6 +112,7 @@ div.postReply {
background-repeat : repeat-x; background-repeat : repeat-x;
height : 100%; height : 100%;
padding : 10px; padding : 10px;
margin-left : 1px;
} }
div.postReply a { div.postReply a {
@ -907,3 +908,100 @@ div.cdmContent a:hover {
color : black; color : black;
} }
/* layout */
#header {
position : absolute;
white-space: nowrap;
top : 10px;
left : 15px;
right : 5px;
height : 40px;
color : gray;
font-size : x-small;
}
#feeds-holder {
border-width : 1px 1px 1px 0px;
border-style : solid;
border-color : #c0c0c0;
top : 70px;
left : 0px;
position : absolute;
width : 260px;
overflow : auto;
bottom : 50px;
}
#toolbar {
position : absolute;
left : 261px;
padding : 5px 10px 5px 10px;
top : 70px;
right : 0px;
white-space: nowrap;
height : 30px;
background-image : url("images/vgrad_light.png");
background-position : bottom left;
background-repeat : repeat-x;
font-size : small;
}
div.headlines_normal {
position : absolute;
border-width : 1px 0px 0px 0px;
border-style : solid;
border-color : #c0c0c0;
left : 260px;
height : 280px;
top : 105px;
right : 0px;
overflow : auto;
font-size : small;
}
div.headlines_cdm {
position : absolute;
border-width : 1px 0px 1px 0px;
border-style : solid;
border-color : #c0c0c0;
left : 260px;
bottom : 50px;
top : 105px;
right : 0px;
overflow : auto;
font-size : small;
}
#content-frame {
position : absolute;
border-width : 1px 0px 1px 0px;
border-style : solid;
border-color : #c0c0c0;
overflow : auto;
top : 390px;
left : 260px;
bottom : 50px;
right : 0px;
}
#footer {
position : absolute;
bottom : 0px;
height : 30px;
text-align : center;
color : gray;
font-size : x-small;
background-image : url("images/vgrad_light_rev2.png");
background-position : top left;
background-repeat : repeat-x;
background-color : white;
right : 0px;
left : 0px;
padding : 10px;
}
#headlinesContainer {
margin-left : 1px;
background-color : white;
}

View File

@ -1234,6 +1234,7 @@ div.loadingPrompt {
div.whiteBox { div.whiteBox {
background-color : white; background-color : white;
margin-left : 1px; margin-left : 1px;
text-align : center;
} }
/* layout */ /* layout */

View File

@ -16,6 +16,7 @@ var active_feed_is_cat = false;
var number_of_feeds = 0; var number_of_feeds = 0;
var xmlhttp = Ajax.getTransport(); var xmlhttp = Ajax.getTransport();
var xmlhttp_ctr = Ajax.getTransport();
var init_params = new Object(); var init_params = new Object();
@ -36,25 +37,33 @@ function toggleTags() {
function dlg_frefresh_callback() { function dlg_frefresh_callback() {
if (xmlhttp.readyState == 4) { if (xmlhttp.readyState == 4) {
notify(xmlhttp.responseText); notify(xmlhttp.responseText);
if (getActiveFeedId() == _qfd_deleted_feed) {
var h = document.getElementById("headlines-frame");
if (h) {
h.innerHTML = "<div class='whiteBox'>No feed selected.</div>";
}
}
setTimeout('updateFeedList(false, false)', 50); setTimeout('updateFeedList(false, false)', 50);
closeInfoBox(); closeInfoBox();
} }
} }
function refetch_callback() { function refetch_callback() {
if (xmlhttp.readyState == 4) { if (xmlhttp_ctr.readyState == 4) {
try { try {
var date = new Date(); var date = new Date();
last_refetch = date.getTime() / 1000; last_refetch = date.getTime() / 1000;
if (!xmlhttp.responseXML) { if (!xmlhttp_ctr.responseXML) {
notify("refetch_callback: backend did not return valid XML", true, true); notify("refetch_callback: backend did not return valid XML", true, true);
return; return;
} }
var reply = xmlhttp.responseXML.firstChild; var reply = xmlhttp_ctr.responseXML.firstChild;
if (!reply) { if (!reply) {
notify("refetch_callback: backend did not return expected XML object", true, true); notify("refetch_callback: backend did not return expected XML object", true, true);
@ -175,19 +184,19 @@ function scheduleFeedUpdate(force) {
var date = new Date(); var date = new Date();
if (!xmlhttp_ready(xmlhttp) && last_refetch < date.getTime() / 1000 - 60) { if (!xmlhttp_ready(xmlhttp_ctr) && last_refetch < date.getTime() / 1000 - 60) {
debug("<b>xmlhttp seems to be stuck, aborting</b>"); debug("<b>xmlhttp seems to be stuck, aborting</b>");
xmlhttp.abort(); xmlhttp_ctr.abort();
} }
debug("REFETCH query: " + query_str); debug("REFETCH query: " + query_str);
if (xmlhttp_ready(xmlhttp)) { if (xmlhttp_ready(xmlhttp_ctr)) {
xmlhttp.open("GET", query_str, true); xmlhttp_ctr.open("GET", query_str, true);
xmlhttp.onreadystatechange=refetch_callback; xmlhttp_ctr.onreadystatechange=refetch_callback;
xmlhttp.send(null); xmlhttp_ctr.send(null);
} else { } else {
debug("xmlhttp busy"); debug("xmlhttp_ctr busy");
//printLockingError(); //printLockingError();
} }
} }

View File

@ -1,7 +1,5 @@
var active_post_id = false; var active_post_id = false;
//var xmlhttp_rpc = Ajax.getTransport();
function headlines_callback() { function headlines_callback() {
if (xmlhttp.readyState == 4) { if (xmlhttp.readyState == 4) {
debug("headlines_callback"); debug("headlines_callback");
@ -54,8 +52,6 @@ function view(id, feed_id) {
var query = "backend.php?op=view&id=" + param_escape(id) + var query = "backend.php?op=view&id=" + param_escape(id) +
"&feed=" + param_escape(feed_id); "&feed=" + param_escape(feed_id);
xmlhttp.abort();
if (xmlhttp_ready(xmlhttp)) { if (xmlhttp_ready(xmlhttp)) {
xmlhttp.open("GET", query, true); xmlhttp.open("GET", query, true);
xmlhttp.onreadystatechange=article_callback; xmlhttp.onreadystatechange=article_callback;