From 20f16e7197c355d8446b8f7c581d0db1ebe8f612 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 13 Nov 2010 02:17:04 +0300 Subject: [PATCH] cdm: don't try to load content which is already there --- viewfeed.js | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/viewfeed.js b/viewfeed.js index 99f6f3e4..b710896e 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -2001,33 +2001,39 @@ function cdmExpandArticle(id) { elem = $("CICD-" + id); if (!Element.visible(elem)) { - $("FUPDPIC-" + id).src = "images/indicator_tiny.gif"; - $("CWRAP-" + id).innerHTML = "
" + - __("Loading, please wait...") + "
"; Element.show(elem); Element.hide("CEXC-" + id); - var query = "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id); + if ($("CWRAP-" + id).innerHTML == "") { - //console.log(query); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - $("FUPDPIC-" + id).src = 'images/blank_icon.gif'; - - if (transport.responseXML) { - 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."); + $("FUPDPIC-" + id).src = "images/indicator_tiny.gif"; - } - }}); + $("CWRAP-" + id).innerHTML = "
" + + __("Loading, please wait...") + "
"; + + var query = "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id); + + //console.log(query); + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + $("FUPDPIC-" + id).src = 'images/blank_icon.gif'; + + if (transport.responseXML) { + 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; -- 2.39.5