var total_feed_entries = false;
-var _viewfeed_autoselect_first = false;
-var _viewfeed_autoselect_last = false;
-
-var _update_ids;
-var _update_num_ids;
-
var search_query = "";
/*@cc_on @*/
}
}
-function feed_update_callback() {
- if (xmlhttp_rpc.readyState == 4) {
- var result = xmlhttp_rpc.responseText;
- notify(_update_ids);
- updateFeed(_update_ids.shift());
- }
-}
-
-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 view_callback() {
- var container = document.getElementById('content');
- if (xmlhttp_view.readyState == 4) {
- container.innerHTML=xmlhttp_view.responseText;
- markHeadline(active_post_id);
- }
-}
-
function refetch_callback() {
if (xmlhttp_rpc.readyState == 4) {
}
-function scheduleSepFeedUpdate(force) {
- notify("Updating feeds in background (M2)...");
-
- _update_ids = getFeedIds();
- _update_num_ids = _update_ids.length;
-
- updateFeed(_update_ids.pop());
-
-}
-
function scheduleFeedUpdate(force) {
notify("Updating feeds in background...");
}
}
+/*
function catchupPage(feed) {
if (!xmlhttp_ready(xmlhttp)) {
notify("No unread items on this page.");
}
-}
+} */
function catchupAllFeeds() {
}
+function viewCurrentFeed(skip, subop) {
+ if (active_feed_id ) {
+ viewfeed(active_feed_id, skip, subop);
+ }
+}
+
function viewfeed(feed, skip, subop) {
+// notify("Loading headlines...");
+
enableHotkeys();
var searchbox = document.getElementById("searchbox");
search_query = "";
}
-/* if (active_feed_id == feed && subop != "ForceUpdate") {
- notify("This feed is currently selected.");
- return;
- } */
+ var viewbox = document.getElementById("viewbox");
+
+ var view_mode;
+
+ if (viewbox) {
+ view_mode = viewbox.value;
+ } else {
+ view_mode = "All Posts";
+ }
+
+ setCookie("ttrss_vf_vmode", view_mode);
+
+ var limitbox = document.getElementById("limitbox");
+
+ var limit;
+
+ if (limitbox) {
+ limit = limitbox.value;
+ setCookie("ttrss_vf_limit", limit);
+ } else {
+ limit = "All";
+ }
if (skip < 0 || skip > total_feed_entries) {
return;
active_feed_id = feed;
active_offset = skip;
- var query = "backend.php?op=viewfeed&feed=" + param_escape(feed) +
- "&skip=" + param_escape(skip) + "&subop=" + param_escape(subop);
-
- if (search_query != "") {
- query = query + "&search=" + param_escape(search_query);
- }
-
- xmlhttp.open("GET", query, true);
- xmlhttp.onreadystatechange=viewfeed_callback;
- xmlhttp.send(null);
-
- notify("Loading headlines...");
+ setCookie("ttrss_vf_actfeed", feed);
-}
-
-function markHeadline(id) {
- var row = document.getElementById("RROW-" + id);
- if (row) {
- row.className = row.className + "Selected";
- }
-}
-
-function getFeedIds() {
- var content = document.getElementById("feedsList");
-
- var rows = new Array();
-
- for (i = 0; i < content.rows.length; i++) {
- var id = content.rows[i].id.replace("FEEDR-", "");
- if (id.length > 0) {
- rows.push(id);
- }
- }
-
- return rows;
-}
-
-function cleanSelected(element) {
- var content = document.getElementById(element);
-
- var rows = new Array();
+ if (subop == "MarkAllRead") {
- for (i = 0; i < content.rows.length; i++) {
- content.rows[i].className = content.rows[i].className.replace("Selected", "");
- }
-
-}
-
-function view(id,feed_id) {
-
- enableHotkeys();
-
- if (!xmlhttp_ready(xmlhttp_view)) {
- printLockingError();
- return
- }
-
- var crow = document.getElementById("RROW-" + id);
+ var feedr = document.getElementById("FEEDR-" + feed);
+ var feedt = document.getElementById("FEEDT-" + feed);
+ var feedu = document.getElementById("FEEDU-" + feed);
- if (crow.className.match("Unread")) {
- var umark = document.getElementById("FEEDU-" + feed_id);
- umark.innerHTML = umark.innerHTML - 1;
- crow.className = crow.className.replace("Unread", "");
+ feedu.innerHTML = "0";
- if (umark.innerHTML == "0") {
- var feedr = document.getElementById("FEEDR-" + feed_id);
+ if (feedr.className.match("Unread")) {
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();
+ var query = "backend.php?op=viewfeed&feed=" + param_escape(feed) +
+ "&skip=" + param_escape(skip) + "&subop=" + param_escape(subop) +
+ "&view=" + param_escape(view_mode) + "&limit=" + limit;
- if (unread_rows.length == 0) {
- var button = document.getElementById("btnCatchupPage");
- if (button) {
- button.className = "disabledButton";
- button.href = "";
- }
+ if (search_query != "") {
+ query = query + "&search=" + param_escape(search_query);
}
+
+ var headlines_frame = document.getElementById("headlines-frame");
+
+ headlines_frame.src = query + "&addheader=true";
- active_post_id = id;
+ var feedr = document.getElementById("FEEDR-" + feed);
- xmlhttp_view.open("GET", "backend.php?op=view&id=" + param_escape(id), true);
- xmlhttp_view.onreadystatechange=view_callback;
- xmlhttp_view.send(null);
+ cleanSelected("feedsList");
+ feedr.className = feedr.className + "Selected";
+
+ disableContainerChildren("headlinesToolbar", false);
+// notify("");
}
function resetSearch() {
document.getElementById("searchbox").value = "";
- viewfeed(active_feed_id, 0, "");
+ if (active_feed_id) {
+ viewfeed(active_feed_id, 0, "");
+ }
}
-function search(feed) {
- viewfeed(feed, 0, "");
+function search() {
+ if (active_feed_id) {
+ viewfeed(active_feed_id, 0, "");
+ } else {
+ notify("Please select some feed first.");
+ }
}
function localPiggieFunction(enable) {
}
}
-function relativeid_callback() {
-
- if (xmlhttp_rpc.readyState == 4) {
- notify(xmlhttp_rpc.responseText);
- }
-
-}
-
-function getVisibleUnreadHeadlines() {
- var content = document.getElementById("headlinesList");
-
- var rows = new Array();
-
- for (i = 0; i < content.rows.length; i++) {
- var row_id = content.rows[i].id.replace("RROW-", "");
- if (row_id.length > 0 && content.rows[i].className.match("Unread")) {
- rows.push(row_id);
- }
- }
- return rows;
-}
-
-function getVisibleHeadlineIds() {
-
- var content = document.getElementById("headlinesList");
-
- var rows = new Array();
-
- for (i = 0; i < content.rows.length; i++) {
- var row_id = content.rows[i].id.replace("RROW-", "");
- if (row_id.length > 0) {
- rows.push(row_id);
- }
- }
- return rows;
-}
-
-function getFirstVisibleHeadlineId() {
- var rows = getVisibleHeadlineIds();
- return rows[0];
-}
-
-function getLastVisibleHeadlineId() {
- var rows = getVisibleHeadlineIds();
- return rows[rows.length-1];
-}
-
+/*
function moveToPost(mode) {
var rows = getVisibleHeadlineIds();
}
}
+*/
function localHotkeyHandler(keycode) {
- if (keycode == 78) {
+/* if (keycode == 78) {
return moveToPost('next');
}
if (keycode == 80) {
return moveToPost('prev');
- }
+ } */
if (keycode == 82) {
return scheduleFeedUpdate(true);
}
-
function init() {
+ disableContainerChildren("headlinesToolbar", true);
+
// IE kludge
if (xmlhttp && !xmlhttp_rpc) {
updateFeedList(false, false);
document.onkeydown = hotkey_handler;
setTimeout("timeout()", 1800*1000);
+
+ var content = document.getElementById("content");
+
+// active_feed_id = getCookie("ttrss_vf_actfeed");
+
+ var limitbox = document.getElementById("limitbox");
+
+ if (getCookie("ttrss_vf_vmode")) {
+ var viewbox = document.getElementById("viewbox");
+ viewbox.value = getCookie("ttrss_vf_vmode");
+ }
+
}
+
+