backend/view: use JSON instead of XML; backend: output session invalid error using JSON
This commit is contained in:
parent
014d3ad823
commit
009646d23a
51
backend.php
51
backend.php
|
@ -49,7 +49,6 @@
|
|||
$print_exec_time = false;
|
||||
|
||||
if ((!$op || $op == "rpc" || $op == "rss" ||
|
||||
($op == "view" && $mode != "zoom") ||
|
||||
$op == "digestSend" || $op == "dlg" ||
|
||||
$op == "viewfeed" || $op == "publish" ||
|
||||
$op == "globalUpdateFeeds") && !$_REQUEST["noxml"]) {
|
||||
|
@ -67,25 +66,28 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (!$op) {
|
||||
header("Content-Type: application/xml");
|
||||
print_error_xml(7); exit;
|
||||
}
|
||||
|
||||
if (SINGLE_USER_MODE) {
|
||||
authenticate_user($link, "admin", null);
|
||||
}
|
||||
|
||||
if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds"
|
||||
/* if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds"
|
||||
&& $op != "rss" && $op != "getUnread" && $op != "publish" && $op != "getProfiles") {
|
||||
|
||||
if ($op == "rpc" || $op == "viewfeed" || $op == "view") {
|
||||
print_error_xml(6); die;
|
||||
print_error_xml(6); exit;
|
||||
} else {
|
||||
header("Location: tt-rss.php?return=" .
|
||||
urlencode($_SERVER['REQUEST_URI']));
|
||||
}
|
||||
exit;
|
||||
} */
|
||||
|
||||
if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" &&
|
||||
$op != "rss" && $op != "getUnread" && $op != "getProfiles") {
|
||||
|
||||
header("Content-Type: text/plain");
|
||||
print json_encode(array("error" => array("code" => 6)));
|
||||
return;
|
||||
}
|
||||
|
||||
$purge_intervals = array(
|
||||
|
@ -217,15 +219,15 @@
|
|||
$mode = db_escape_string($_REQUEST["mode"]);
|
||||
$omode = db_escape_string($_REQUEST["omode"]);
|
||||
|
||||
if ($mode != "zoom") print "<reply>";
|
||||
|
||||
// in prefetch mode we only output requested cids, main article
|
||||
// just gets marked as read (it already exists in client cache)
|
||||
|
||||
$articles = array();
|
||||
|
||||
if ($mode == "") {
|
||||
outputArticleXML($link, $id, false);
|
||||
array_push($articles, format_article($link, $id, false));
|
||||
} else if ($mode == "zoom") {
|
||||
outputArticleXML($link, $id, false, true, true);
|
||||
array_push($articles, format_article($link, $id, false, true, true));
|
||||
} else {
|
||||
catchupArticleById($link, $id, 0);
|
||||
}
|
||||
|
@ -233,18 +235,13 @@
|
|||
if (!$_SESSION["bw_limit"]) {
|
||||
foreach ($cids as $cid) {
|
||||
if ($cid) {
|
||||
outputArticleXML($link, $cid, false, false);
|
||||
array_push($articles, format_article($link, $cid, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if ($mode == "prefetch") {
|
||||
print "<counters><![CDATA[";
|
||||
print json_encode(getAllCounters($link, $omode));
|
||||
print "]]></counters>";
|
||||
} */
|
||||
print json_encode($articles);
|
||||
|
||||
if ($mode != "zoom") print "</reply>";
|
||||
break; // view
|
||||
|
||||
case "viewfeed":
|
||||
|
@ -376,13 +373,18 @@
|
|||
|
||||
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("10", $timing_info);
|
||||
|
||||
if (is_array($topmost_article_ids) && !get_pref($link, 'COMBINED_DISPLAY_MODE') && !$_SESSION["bw_limit"]) {
|
||||
print "<articles>";
|
||||
/* if (is_array($topmost_article_ids) && !get_pref($link, 'COMBINED_DISPLAY_MODE') && !$_SESSION["bw_limit"]) {
|
||||
|
||||
$articles = array();
|
||||
|
||||
foreach ($topmost_article_ids as $id) {
|
||||
outputArticleXML($link, $id, $feed, false);
|
||||
array_push($articles, format_article($link, $id, $feed, false));
|
||||
}
|
||||
print "</articles>";
|
||||
}
|
||||
|
||||
print "<articles><![CDATA[";
|
||||
print json_encode($articles);
|
||||
print "]]></articles>";
|
||||
} */
|
||||
|
||||
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("20", $timing_info);
|
||||
|
||||
|
@ -481,7 +483,6 @@
|
|||
$search, $search_mode, $match_on, $view_mode);
|
||||
} else {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
print_error_xml(6); die;
|
||||
}
|
||||
break; // rss
|
||||
|
||||
|
|
121
functions.php
121
functions.php
|
@ -4487,9 +4487,13 @@
|
|||
return $entry;
|
||||
}
|
||||
|
||||
function outputArticleXML($link, $id, $feed_id, $mark_as_read = true,
|
||||
function format_article($link, $id, $feed_id, $mark_as_read = true,
|
||||
$zoom_mode = false) {
|
||||
|
||||
$rv = array();
|
||||
|
||||
$rv['id'] = $id;
|
||||
|
||||
/* we can figure out feed_id from article id anyway, why do we
|
||||
* pass feed_id here? let's ignore the argument :( */
|
||||
|
||||
|
@ -4498,7 +4502,9 @@
|
|||
|
||||
$feed_id = (int) db_fetch_result($result, 0, "feed_id");
|
||||
|
||||
if (!$zoom_mode) { print "<article id='$id'><![CDATA["; };
|
||||
$rv['feed_id'] = $feed_id;
|
||||
|
||||
//if (!$zoom_mode) { print "<article id='$id'><![CDATA["; };
|
||||
|
||||
$result = db_query($link, "SELECT rtl_content, always_display_enclosures FROM ttrss_feeds
|
||||
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
@ -4568,28 +4574,19 @@
|
|||
|
||||
if ($zoom_mode) {
|
||||
header("Content-Type: text/html");
|
||||
print "<html><head>
|
||||
$rv['content'] .= "<html><head>
|
||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
|
||||
<title>Tiny Tiny RSS - ".$line["title"]."</title>
|
||||
<link rel=\"stylesheet\" type=\"text/css\" href=\"tt-rss.css\">
|
||||
</head><body>";
|
||||
}
|
||||
|
||||
print "<div id=\"PTITLE-$id\" style=\"display : none\">" .
|
||||
$rv['content'] .= "<div id=\"PTITLE-$id\" style=\"display : none\">" .
|
||||
truncate_string(strip_tags($line['title']), 15) . "</div>";
|
||||
|
||||
print "<div class=\"postReply\" id=\"POST-$id\">";
|
||||
$rv['content'] .= "<div class=\"postReply\" id=\"POST-$id\">";
|
||||
|
||||
/* print "<div dojoType=\"dijit.Menu\" style=\"display: none;\"
|
||||
targetNodeIds=\"POSTHDR-$id\">";
|
||||
print "<div onclick=\"postOpenInNewTab(event, $id)\"
|
||||
dojoType=\"dijit.MenuItem\">".__('View in a new tab')."</div>";
|
||||
print "<div dojoType=\"dijit.MenuSeparator\"></div>";
|
||||
print "<div onclick=\"openArticleInNewWindow($id)\"
|
||||
dojoType=\"dijit.MenuItem\">".__('Open original article')."</div>";
|
||||
print "</div>"; */
|
||||
|
||||
print "<div onclick=\"return postClicked(event, $id)\"
|
||||
$rv['content'] .= "<div onclick=\"return postClicked(event, $id)\"
|
||||
class=\"postHeader\" id=\"POSTHDR-$id\">";
|
||||
|
||||
$entry_author = $line["author"];
|
||||
|
@ -4601,69 +4598,69 @@
|
|||
$parsed_updated = make_local_datetime($link, $line["updated"], true,
|
||||
false, true);
|
||||
|
||||
print "<div class=\"postDate$rtl_class\">$parsed_updated</div>";
|
||||
$rv['content'] .= "<div class=\"postDate$rtl_class\">$parsed_updated</div>";
|
||||
|
||||
if ($line["link"]) {
|
||||
print "<div clear='both'><a target='_blank'
|
||||
$rv['content'] .= "<div clear='both'><a target='_blank'
|
||||
title=\"".htmlspecialchars($line['title'])."\"
|
||||
href=\"" .
|
||||
$line["link"] . "\">" .
|
||||
truncate_string($line["title"], 100) .
|
||||
"<span class='author'>$entry_author</span></a></div>";
|
||||
} else {
|
||||
print "<div clear='both'>" . $line["title"] . "$entry_author</div>";
|
||||
$rv['content'] .= "<div clear='both'>" . $line["title"] . "$entry_author</div>";
|
||||
}
|
||||
|
||||
$tags_str = format_tags_string(get_article_tags($link, $id), $id);
|
||||
|
||||
if (!$entry_comments) $entry_comments = " "; # placeholder
|
||||
|
||||
print "<div style='float : right'>
|
||||
$rv['content'] .= "<div style='float : right'>
|
||||
<img src='".theme_image($link, 'images/tag.png')."'
|
||||
class='tagsPic' alt='Tags' title='Tags'> ";
|
||||
|
||||
if (!$zoom_mode) {
|
||||
print "<span id=\"ATSTR-$id\">$tags_str</span>
|
||||
$rv['content'] .= "<span id=\"ATSTR-$id\">$tags_str</span>
|
||||
<a title=\"".__('Edit tags for this article')."\"
|
||||
href=\"#\" onclick=\"editArticleTags($id, $feed_id)\">(+)</a>";
|
||||
|
||||
print "<img src=\"".theme_image($link, 'images/art-zoom.png')."\"
|
||||
$rv['content'] .= "<img src=\"".theme_image($link, 'images/art-zoom.png')."\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
||||
onclick=\"postOpenInNewTab(event, $id)\"
|
||||
alt='Zoom' title='".__('Open article in new tab')."'>";
|
||||
|
||||
//$note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
|
||||
|
||||
print "<img src=\"".theme_image($link, 'images/art-pub-note.png')."\"
|
||||
$rv['content'] .= "<img src=\"".theme_image($link, 'images/art-pub-note.png')."\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
||||
onclick=\"editArticleNote($id)\"
|
||||
alt='PubNote' title='".__('Edit article note')."'>";
|
||||
|
||||
if (DIGEST_ENABLE) {
|
||||
print "<img src=\"".theme_image($link, 'images/art-email.png')."\"
|
||||
$rv['content'] .= "<img src=\"".theme_image($link, 'images/art-email.png')."\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
||||
onclick=\"emailArticle($id)\"
|
||||
alt='Zoom' title='".__('Forward by email')."'>";
|
||||
}
|
||||
|
||||
if (ENABLE_TWEET_BUTTON) {
|
||||
print "<img src=\"".theme_image($link, 'images/art-tweet.png')."\"
|
||||
$rv['content'] .= "<img src=\"".theme_image($link, 'images/art-tweet.png')."\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
||||
onclick=\"tweetArticle($id)\"
|
||||
alt='Zoom' title='".__('Share on Twitter')."'>";
|
||||
}
|
||||
|
||||
print "<img src=\"".theme_image($link, 'images/digest_checkbox.png')."\"
|
||||
$rv['content'] .= "<img src=\"".theme_image($link, 'images/digest_checkbox.png')."\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
||||
onclick=\"closeArticlePanel($id)\"
|
||||
alt='Zoom' title='".__('Close this panel')."'>";
|
||||
|
||||
} else {
|
||||
$tags_str = strip_tags($tags_str);
|
||||
print "<span id=\"ATSTR-$id\">$tags_str</span>";
|
||||
$rv['content'] .= "<span id=\"ATSTR-$id\">$tags_str</span>";
|
||||
}
|
||||
print "</div>";
|
||||
print "<div clear='both'>$entry_comments</div>";
|
||||
$rv['content'] .= "</div>";
|
||||
$rv['content'] .= "<div clear='both'>$entry_comments</div>";
|
||||
|
||||
if ($line["orig_feed_id"]) {
|
||||
|
||||
|
@ -4672,66 +4669,65 @@
|
|||
|
||||
if (db_num_rows($tmp_result) != 0) {
|
||||
|
||||
print "<div clear='both'>";
|
||||
print __("Originally from:");
|
||||
$rv['content'] .= "<div clear='both'>";
|
||||
$rv['content'] .= __("Originally from:");
|
||||
|
||||
print " ";
|
||||
$rv['content'] .= " ";
|
||||
|
||||
$tmp_line = db_fetch_assoc($tmp_result);
|
||||
|
||||
print "<a target='_blank'
|
||||
$rv['content'] .= "<a target='_blank'
|
||||
href=' " . htmlspecialchars($tmp_line['site_url']) . "'>" .
|
||||
$tmp_line['title'] . "</a>";
|
||||
|
||||
print " ";
|
||||
$rv['content'] .= " ";
|
||||
|
||||
print "<a target='_blank' href='" . htmlspecialchars($tmp_line['feed_url']) . "'>";
|
||||
print "<img title='".__('Feed URL')."'class='tinyFeedIcon' src='images/pub_set.gif'></a>";
|
||||
$rv['content'] .= "<a target='_blank' href='" . htmlspecialchars($tmp_line['feed_url']) . "'>";
|
||||
$rv['content'] .= "<img title='".__('Feed URL')."'class='tinyFeedIcon' src='images/pub_set.gif'></a>";
|
||||
|
||||
print "</div>";
|
||||
$rv['content'] .= "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
$rv['content'] .= "</div>";
|
||||
|
||||
print "<div class=\"postIcon\">" .
|
||||
$rv['content'] .= "<div class=\"postIcon\">" .
|
||||
"<a target=\"_blank\" title=\"".__("Visit the website")."\"$
|
||||
href=\"".htmlspecialchars($feed_site_url)."\">".
|
||||
$feed_icon . "</a></div>";
|
||||
|
||||
print "<div id=\"POSTNOTE-$id\">";
|
||||
$rv['content'] .= "<div id=\"POSTNOTE-$id\">";
|
||||
if ($line['note']) {
|
||||
print format_article_note($id, $line['note']);
|
||||
$rv['content'] .= format_article_note($id, $line['note']);
|
||||
}
|
||||
print "</div>";
|
||||
$rv['content'] .= "</div>";
|
||||
|
||||
print "<div class=\"postContent\">";
|
||||
$rv['content'] .= "<div class=\"postContent\">";
|
||||
|
||||
$article_content = sanitize_rss($link, $line["content"], false, false,
|
||||
$feed_site_url);
|
||||
|
||||
print $article_content;
|
||||
$rv['content'] .= $article_content;
|
||||
|
||||
print_article_enclosures($link, $id, $always_display_enclosures,
|
||||
$article_content);
|
||||
$rv['content'] .= format_article_enclosures($link, $id,
|
||||
$always_display_enclosures, $article_content);
|
||||
|
||||
print "</div>";
|
||||
$rv['content'] .= "</div>";
|
||||
|
||||
print "</div>";
|
||||
$rv['content'] .= "</div>";
|
||||
|
||||
}
|
||||
|
||||
if (!$zoom_mode) {
|
||||
print "]]></article>";
|
||||
} else {
|
||||
print "
|
||||
if ($zoom_mode) {
|
||||
$rv['content'] .= "
|
||||
<div style=\"text-align : center\">
|
||||
<button onclick=\"return window.close()\">".
|
||||
__("Close this window")."</button></div>";
|
||||
print "</body></html>";
|
||||
|
||||
$rv['content'] .= "</body></html>";
|
||||
}
|
||||
|
||||
return $rv;
|
||||
|
||||
}
|
||||
|
||||
function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view,
|
||||
|
@ -5230,7 +5226,7 @@
|
|||
$always_display_enclosures = sql_bool_to_bool(db_fetch_result($tmp_result,
|
||||
0, "always_display_enclosures"));
|
||||
|
||||
print_article_enclosures($link, $id, $always_display_enclosures,
|
||||
print format_article_enclosures($link, $id, $always_display_enclosures,
|
||||
$article_content);
|
||||
|
||||
print "</div>";
|
||||
|
@ -6795,10 +6791,11 @@
|
|||
|
||||
}
|
||||
|
||||
function print_article_enclosures($link, $id, $always_display_enclosures,
|
||||
function format_article_enclosures($link, $id, $always_display_enclosures,
|
||||
$article_content) {
|
||||
|
||||
$result = get_article_enclosures($link, $id);
|
||||
$rv = '';
|
||||
|
||||
if (count($result) > 0) {
|
||||
|
||||
|
@ -6830,7 +6827,7 @@
|
|||
array_push($entries, $entry);
|
||||
}
|
||||
|
||||
print "<div class=\"postEnclosures\">";
|
||||
$rv .= "<div class=\"postEnclosures\">";
|
||||
|
||||
if (!get_pref($link, "STRIP_IMAGES")) {
|
||||
if ($always_display_enclosures ||
|
||||
|
@ -6841,7 +6838,7 @@
|
|||
if (preg_match("/image/", $entry["type"]) ||
|
||||
preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) {
|
||||
|
||||
print "<p><img
|
||||
$rv .= "<p><img
|
||||
alt=\"".htmlspecialchars($entry["filename"])."\"
|
||||
src=\"" .htmlspecialchars($entry["url"]) . "\"/></p>";
|
||||
}
|
||||
|
@ -6850,15 +6847,17 @@
|
|||
}
|
||||
|
||||
if (count($entries) == 1) {
|
||||
print __("Attachment:") . " ";
|
||||
$rv .= __("Attachment:") . " ";
|
||||
} else {
|
||||
print __("Attachments:") . " ";
|
||||
$rv .= __("Attachments:") . " ";
|
||||
}
|
||||
|
||||
print join(", ", $entries_html);
|
||||
$rv .= join(", ", $entries_html);
|
||||
|
||||
print "</div>";
|
||||
$rv .= "</div>";
|
||||
}
|
||||
|
||||
return $rv;
|
||||
}
|
||||
|
||||
function getLastArticleId($link) {
|
||||
|
|
|
@ -473,19 +473,19 @@
|
|||
|
||||
} */
|
||||
|
||||
// XML method
|
||||
if ($subop == "getArticles") {
|
||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
print "<rpc-reply>";
|
||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
||||
$articles = array();
|
||||
|
||||
foreach ($ids as $id) {
|
||||
if ($id) {
|
||||
outputArticleXML($link, $id, 0, false);
|
||||
array_push($articles, format_article($link, $id, 0, false));
|
||||
}
|
||||
}
|
||||
print "</rpc-reply>";
|
||||
|
||||
print json_encode($articles);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1145,6 +1145,9 @@ function handle_rpc_json(transport, scheduled_call) {
|
|||
if (error) {
|
||||
var code = error['code'];
|
||||
var msg = error['msg'];
|
||||
|
||||
console.warn("[handle_rpc_json] received fatal error " + code + "/" + msg);
|
||||
|
||||
if (code != 0) {
|
||||
fatalError(code, msg);
|
||||
return false;
|
||||
|
|
86
viewfeed.js
86
viewfeed.js
|
@ -16,15 +16,12 @@ var cache_added = [];
|
|||
|
||||
function headlines_callback2(transport, feed_cur_page) {
|
||||
try {
|
||||
|
||||
if (!handle_rpc_reply(transport)) return;
|
||||
handle_rpc_json(transport);
|
||||
|
||||
loading_set_progress(25);
|
||||
|
||||
console.log("headlines_callback2 [page=" + feed_cur_page + "]");
|
||||
|
||||
if (!transport_error_check(transport)) return;
|
||||
|
||||
var is_cat = false;
|
||||
var feed_id = false;
|
||||
|
||||
|
@ -276,51 +273,32 @@ function article_callback2(transport, id) {
|
|||
try {
|
||||
console.log("article_callback2 " + id);
|
||||
|
||||
if (!handle_rpc_reply(transport)) return;
|
||||
handle_rpc_json(transport);
|
||||
|
||||
if (transport.responseXML) {
|
||||
|
||||
if (!transport_error_check(transport)) return;
|
||||
var reply = JSON.parse(transport.responseText);
|
||||
|
||||
if (reply) {
|
||||
var upic = $('FUPDPIC-' + id);
|
||||
|
||||
if (upic) {
|
||||
upic.src = 'images/blank_icon.gif';
|
||||
}
|
||||
if (upic) upic.src = 'images/blank_icon.gif';
|
||||
|
||||
if (id != last_requested_article) {
|
||||
console.log("requested article id is out of sequence, aborting");
|
||||
return;
|
||||
}
|
||||
|
||||
// active_post_id = id;
|
||||
|
||||
//console.log("looking for articles to cache...");
|
||||
|
||||
var articles = transport.responseXML.getElementsByTagName("article");
|
||||
|
||||
for (var i = 0; i < articles.length; i++) {
|
||||
var a_id = articles[i].getAttribute("id");
|
||||
|
||||
//console.log("found id: " + a_id);
|
||||
|
||||
if (a_id == active_post_id) {
|
||||
//console.log("active article, rendering...");
|
||||
render_article(articles[i].firstChild.nodeValue);
|
||||
reply.each(function(article) {
|
||||
if (active_post_id == article['id']) {
|
||||
render_article(article['content']);
|
||||
}
|
||||
|
||||
cache_inject(a_id, articles[i].firstChild.nodeValue);
|
||||
}
|
||||
|
||||
|
||||
// showArticleInHeadlines(id);
|
||||
|
||||
var reply = transport.responseXML.firstChild.firstChild;
|
||||
cache_inject(article['id'], article['content']);
|
||||
});
|
||||
|
||||
} else {
|
||||
console.warn("article_callback: returned no XML object");
|
||||
//var f = $("content-frame");
|
||||
//f.innerHTML = "<div class='whiteBox'>" + __('Could not display article (missing XML object)') + "</div>";
|
||||
console.warn("article_callback: returned invalid data");
|
||||
|
||||
render_article("<div class='whiteBox'>" +
|
||||
__('Could not display article (invalid data received)') + "</div>");
|
||||
}
|
||||
|
||||
var date = new Date();
|
||||
|
@ -480,36 +458,6 @@ function togglePub(id, client_only, no_effects, note) {
|
|||
} });
|
||||
}
|
||||
|
||||
/* if (!client_only) {
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: query,
|
||||
onComplete: function(transport) {
|
||||
handle_rpc_reply(transport);
|
||||
|
||||
var note = transport.responseXML.getElementsByTagName("note")[0];
|
||||
|
||||
if (note) {
|
||||
var note_id = note.getAttribute("id");
|
||||
var note_size = note.getAttribute("size");
|
||||
var note_content = note.firstChild.nodeValue;
|
||||
|
||||
var container = $('POSTNOTE-' + note_id);
|
||||
|
||||
cache_invalidate(note_id);
|
||||
|
||||
if (container) {
|
||||
if (note_size == "0") {
|
||||
Element.hide(container);
|
||||
} else {
|
||||
container.innerHTML = note_content;
|
||||
Element.show(container);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} });
|
||||
} */
|
||||
|
||||
} catch (e) {
|
||||
exception_error("togglePub", e);
|
||||
}
|
||||
|
@ -1329,12 +1277,12 @@ function preloadBatchedArticles() {
|
|||
|
||||
preload_id_batch = [];
|
||||
|
||||
var articles = transport.responseXML.getElementsByTagName("article");
|
||||
var articles = JSON.parse(transport.responseText);
|
||||
|
||||
for (var i = 0; i < articles.length; i++) {
|
||||
var id = articles[i].getAttribute("id");
|
||||
var id = articles[i]['id'];
|
||||
if (!cache_check(id)) {
|
||||
cache_inject(id, articles[i].firstChild.nodeValue);
|
||||
cache_inject(id, articles[i]['content']);
|
||||
console.log("preloaded article: " + id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue