$last_read_qpart = "";
-// if ("$orig_title" != "$entry_title") {
-// $last_read_qpart = 'last_read = null,';
-// }
-
if ($orig_content_hash != $content_hash) {
if (UPDATE_POST_ON_CHECKSUM_CHANGE) {
$last_read_qpart = 'last_read = null,';
$entry_is_modified = true;
}
-// if (!$no_orig_date && $orig_timestamp < $entry_timestamp) {
-// $last_read_qpart = 'last_read = null,';
-// }
-
if ($entry_is_modified) {
$entry_comments = pg_escape_string($entry_comments);
$entry_title = pg_escape_string($entry_title);
$entry_link = pg_escape_string($entry_link);
-// print "update object $entry_guid<br>";
-
$query = "UPDATE ttrss_entries
SET
$last_read_qpart
}
}
-/*
-function viewfeed_callback() {
- var container = document.getElementById('headlines');
- if (xmlhttp.readyState == 4) {
- container.innerHTML = xmlhttp.responseText;
-
- var factive = document.getElementById("FACTIVE");
- var funread = document.getElementById("FUNREAD");
- var ftotal = document.getElementById("FTOTAL");
-
- if (_viewfeed_autoselect_first == true) {
- _viewfeed_autoselect_first = false;
- view(getFirstVisibleHeadlineId(), active_feed_id);
- }
-
- if (_viewfeed_autoselect_last == true) {
- _viewfeed_autoselect_last = false;
- view(getLastVisibleHeadlineId(), active_feed_id);
- }
-
- if (ftotal && factive && funread) {
- var feed_id = factive.innerHTML;
-
- var feedr = document.getElementById("FEEDR-" + feed_id);
- var feedt = document.getElementById("FEEDT-" + feed_id);
- var feedu = document.getElementById("FEEDU-" + feed_id);
-
- feedt.innerHTML = ftotal.innerHTML;
- feedu.innerHTML = funread.innerHTML;
-
- total_feed_entries = ftotal.innerHTML;
-
- if (feedu.innerHTML > 0 && !feedr.className.match("Unread")) {
- feedr.className = feedr.className + "Unread";
- } else if (feedu.innerHTML <= 0) {
- feedr.className = feedr.className.replace("Unread", "");
- }
-
- cleanSelected("feedsList");
-
- feedr.className = feedr.className + "Selected";
- }
-
- var searchbox = document.getElementById("searchbox");
- searchbox.value = search_query;
-
- markHeadline(active_post_id);
-
- notify("");
-
- }
-} */
-
function refetch_callback() {
if (xmlhttp_rpc.readyState == 4) {
}
-/*
-function view(id,feed_id) {
-
- enableHotkeys();
-
- if (!xmlhttp_ready(xmlhttp_view)) {
- printLockingError();
- return
- }
-
- var crow = document.getElementById("RROW-" + id);
-
- if (crow.className.match("Unread")) {
- var umark = document.getElementById("FEEDU-" + feed_id);
- umark.innerHTML = umark.innerHTML - 1;
- crow.className = crow.className.replace("Unread", "");
-
- if (umark.innerHTML == "0") {
- var feedr = document.getElementById("FEEDR-" + feed_id);
- feedr.className = feedr.className.replace("Unread", "");
- }
-
- total_unread--;
- }
-
- cleanSelected("headlinesList");
-// crow.className = crow.className + "Selected";
-
- var upd_img_pic = document.getElementById("FUPDPIC-" + id);
-
- if (upd_img_pic) {
- upd_img_pic.innerHTML = "";
- }
-
-// document.getElementById('content').innerHTML='Loading, please wait...';
-
- var unread_rows = getVisibleUnreadHeadlines();
-
- if (unread_rows.length == 0) {
- var button = document.getElementById("btnCatchupPage");
- if (button) {
- button.className = "disabledButton";
- button.href = "";
- }
- }
-
- active_post_id = id;
-
- var content = document.getElementById("content-frame");
-
- content.src = "backend.php?op=view&addheader=true&id=" + param_escape(id);
- markHeadline(active_post_id);
-
-}
-*/
-
function timeout() {
scheduleFeedUpdate(true);
setTimeout("timeout()", 1800*1000);
-var active_post_id;
+var active_feed_id = false;
+var active_post_id = false;
var total_unread = 0;
var xmlhttp_rpc = false;
xmlhttp_rpc = new XMLHttpRequest();
}
-function view(id,feed_id) {
+function view(id, feed_id) {
enableHotkeys();
}
active_post_id = id;
+ active_feed_id = feed_id;
var content = parent.document.getElementById("content-frame");
}
+function moveToPost(mode) {
+ var rows = getVisibleHeadlineIds();
+
+ var prev_id;
+ var next_id;
+
+ if (active_post_id == false) {
+ next_id = getFirstVisibleHeadlineId();
+ prev_id = getLastVisibleHeadlineId();
+ } else {
+ for (var i = 0; i < rows.length; i++) {
+ if (rows[i] == active_post_id) {
+ prev_id = rows[i-1];
+ next_id = rows[i+1];
+ }
+ }
+ }
+
+ if (mode == "next") {
+ if (next_id != undefined) {
+ view(next_id, active_feed_id);
+ }
+ }
+
+ if (mode == "prev") {
+ if ( prev_id != undefined) {
+ view(prev_id, active_feed_id);
+ }
+ }
+}
+
+function localHotkeyHandler(keycode) {
+
+ if (keycode == 78) {
+ return moveToPost('next');
+ }
+
+ if (keycode == 80) {
+ return moveToPost('prev');
+ }
+
+// FIXME
+// if (keycode == 85) {
+// return viewfeed(active_feed_id, active_offset, "ForceUpdate");
+// }
+
+// alert("KC: " + keycode);
+
+}