disable simultaneous xmlhttp calls

This commit is contained in:
Andrew Dolgov 2005-08-22 12:53:39 +01:00
parent 175847dee8
commit 076682aa66
1 changed files with 33 additions and 5 deletions

View File

@ -90,7 +90,7 @@ function view_callback() {
function updateFeedList(called_from_timer, fetch) { function updateFeedList(called_from_timer, fetch) {
if (called_from_timer != true) { if (called_from_timer != true) {
//document.getElementById("feeds").innerHTML = "Loading feeds, please wait..."; //document.getElementById("feeds").innerHTML = "Loading feeds, please wait...";
notify("Updating feeds..."); notify("Updating feeds...");
@ -100,14 +100,22 @@ function updateFeedList(called_from_timer, fetch) {
if (fetch) query_str = query_str + "&fetch=yes"; if (fetch) query_str = query_str + "&fetch=yes";
xmlhttp.open("GET", query_str, true); if (xmlhttp.readyState == 4 || xmlhttp.readyState == 0) {
xmlhttp.onreadystatechange=feedlist_callback; xmlhttp.open("GET", query_str, true);
xmlhttp.send(null); xmlhttp.onreadystatechange=feedlist_callback;
xmlhttp.send(null);
} else {
notify("Please wait until operation finishes.");
}
} }
function catchupPage(feed) { function catchupPage(feed) {
if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
notify("Please wait until operation finishes.");
return
}
var content = document.getElementById("headlinesList"); var content = document.getElementById("headlinesList");
var rows = new Array(); var rows = new Array();
@ -143,6 +151,11 @@ function catchupPage(feed) {
} }
function catchupAllFeeds() { function catchupAllFeeds() {
if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
notify("Please wait until operation finishes.");
return
}
var query_str = "backend.php?op=feeds&subop=catchupAll"; var query_str = "backend.php?op=feeds&subop=catchupAll";
notify("Marking all feeds as read..."); notify("Marking all feeds as read...");
@ -158,6 +171,11 @@ function viewfeed(feed, skip, subop) {
// document.getElementById('headlines').innerHTML='Loading headlines, please wait...'; // document.getElementById('headlines').innerHTML='Loading headlines, please wait...';
// document.getElementById('content').innerHTML=' '; // document.getElementById('content').innerHTML=' ';
if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
notify("Please wait until operation finishes.");
return
}
xmlhttp.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed) + xmlhttp.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed) +
"&skip=" + param_escape(skip) + "&subop=" + param_escape(subop) , true); "&skip=" + param_escape(skip) + "&subop=" + param_escape(subop) , true);
xmlhttp.onreadystatechange=viewfeed_callback; xmlhttp.onreadystatechange=viewfeed_callback;
@ -169,6 +187,11 @@ function viewfeed(feed, skip, subop) {
function view(id,feed_id) { function view(id,feed_id) {
if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
notify("Please wait until operation finishes.");
return
}
var crow = document.getElementById("RROW-" + id); var crow = document.getElementById("RROW-" + id);
if (crow.className.match("Unread")) { if (crow.className.match("Unread")) {
@ -210,6 +233,11 @@ function timeout() {
function search(feed, sender) { function search(feed, sender) {
if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
notify("Please wait until operation finishes.");
return
}
notify("Search: " + feed + ", " + sender.value) notify("Search: " + feed + ", " + sender.value)
document.getElementById('headlines').innerHTML='Loading headlines, please wait...'; document.getElementById('headlines').innerHTML='Loading headlines, please wait...';