cdm: don't try to load content which is already there

This commit is contained in:
Andrew Dolgov 2010-11-13 02:17:04 +03:00
parent dd1c068056
commit 20f16e7197
1 changed files with 28 additions and 22 deletions

View File

@ -2001,33 +2001,39 @@ function cdmExpandArticle(id) {
elem = $("CICD-" + id); elem = $("CICD-" + id);
if (!Element.visible(elem)) { if (!Element.visible(elem)) {
$("FUPDPIC-" + id).src = "images/indicator_tiny.gif";
$("CWRAP-" + id).innerHTML = "<div class=\"insensitive\">" +
__("Loading, please wait...") + "</div>";
Element.show(elem); Element.show(elem);
Element.hide("CEXC-" + id); Element.hide("CEXC-" + id);
var query = "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id); if ($("CWRAP-" + id).innerHTML == "") {
//console.log(query); $("FUPDPIC-" + id).src = "images/indicator_tiny.gif";
new Ajax.Request("backend.php", { $("CWRAP-" + id).innerHTML = "<div class=\"insensitive\">" +
parameters: query, __("Loading, please wait...") + "</div>";
onComplete: function(transport) {
$("FUPDPIC-" + id).src = 'images/blank_icon.gif'; var query = "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id);
if (transport.responseXML) { //console.log(query);
var article = transport.responseXML.getElementsByTagName("article")[0];
var recv_id = article.getAttribute("id"); new Ajax.Request("backend.php", {
parameters: query,
if (recv_id == id) onComplete: function(transport) {
$("CWRAP-" + id).innerHTML = article.firstChild.nodeValue; $("FUPDPIC-" + id).src = 'images/blank_icon.gif';
} else { if (transport.responseXML) {
$("CWRAP-" + id).innerHTML = __("Unable to load article."); var article = transport.responseXML.getElementsByTagName("article")[0];
var recv_id = article.getAttribute("id");
}
}}); if (recv_id == id)
$("CWRAP-" + id).innerHTML = article.firstChild.nodeValue;
} else {
$("CWRAP-" + id).innerHTML = __("Unable to load article.");
}
}});
}
} }
var new_offset = $("RROW-" + id).offsetTop; var new_offset = $("RROW-" + id).offsetTop;