remove ACTFEEDID container, keep information in a cookie instead (getActiveFeedId/setActiveFeedId API)

This commit is contained in:
Andrew Dolgov 2005-09-08 06:29:45 +01:00
parent 25cb57366a
commit 867413478a
5 changed files with 32 additions and 38 deletions

View File

@ -117,7 +117,7 @@
print "</table>"; print "</table>";
print "<div class=\"invisible\" id=\"FEEDTU\">$total_unread</div>"; print "<div class=\"invisible\" id=\"FEEDTU\">$total_unread</div>";
print "<div class=\"invisible\" id=\"ACTFEEDID\">$actid</div>"; // print "<div class=\"invisible\" id=\"ACTFEEDID\">$actid</div>";
} }

View File

@ -1,5 +1,3 @@
var active_feed_id = 666;
var active_offset;
function viewfeed(feed, skip, subop, doc) { function viewfeed(feed, skip, subop, doc) {
@ -40,12 +38,9 @@ function viewfeed(feed, skip, subop, doc) {
limit = "All"; limit = "All";
} }
active_feed_id = feed; // document.getElementById("ACTFEEDID").innerHTML = feed;
active_offset = skip;
document.getElementById("ACTFEEDID").innerHTML = feed; setActiveFeedId(feed);
setCookie("ttrss_vf_actfeed", feed);
if (subop == "MarkAllRead") { if (subop == "MarkAllRead") {

View File

@ -270,3 +270,11 @@ function gotoMain() {
function gotoExportOpml() { function gotoExportOpml() {
document.location.href = "opml.php?op=Export"; document.location.href = "opml.php?op=Export";
} }
function getActiveFeedId() {
return getCookie("ttrss_vf_actfeed");
}
function setActiveFeedId(id) {
return setCookie("ttrss_vf_actfeed", id);
}

View File

@ -8,8 +8,6 @@ var xmlhttp = false;
var total_unread = 0; var total_unread = 0;
var first_run = true; var first_run = true;
var active_feed_id = false;
var search_query = ""; var search_query = "";
/*@cc_on @*/ /*@cc_on @*/
@ -50,15 +48,6 @@ function feedlist_callback() {
} }
*/ */
function checkActiveFeedId() {
var actfeedid = frames["feeds-frame"].document.getElementById("ACTFEEDID");
if (actfeedid) {
active_feed_id = actfeedid.innerHTML;
}
}
function refetch_callback() { function refetch_callback() {
if (xmlhttp.readyState == 4) { if (xmlhttp.readyState == 4) {
@ -117,8 +106,8 @@ function updateFeedList(silent, fetch) {
var query_str = "backend.php?op=feeds"; var query_str = "backend.php?op=feeds";
if (active_feed_id) { if (getActiveFeedId()) {
query_str = query_str + "&actid=" + active_feed_id; query_str = query_str + "&actid=" + getActiveFeedId();
} }
if (fetch) query_str = query_str + "&fetch=yes"; if (fetch) query_str = query_str + "&fetch=yes";
@ -142,10 +131,8 @@ function catchupAllFeeds() {
function viewCurrentFeed(skip, subop) { function viewCurrentFeed(skip, subop) {
active_feed_id = frames["feeds-frame"].document.getElementById("ACTFEEDID").innerHTML; if (getActiveFeedId()) {
viewfeed(getActiveFeedId(), skip, subop);
if (active_feed_id) {
viewfeed(active_feed_id, skip, subop);
} }
} }
@ -186,13 +173,11 @@ function viewfeed(feed, skip, subop) {
limit = "All"; limit = "All";
} }
active_feed_id = feed; setActiveFeedId(feed);
var f_doc = frames["feeds-frame"].document; var f_doc = frames["feeds-frame"].document;
f_doc.getElementById("ACTFEEDID").innerHTML = feed; // f_doc.getElementById("ACTFEEDID").innerHTML = feed;
setCookie("ttrss_vf_actfeed", feed);
if (subop == "MarkAllRead") { if (subop == "MarkAllRead") {
@ -239,16 +224,16 @@ function timeout() {
function resetSearch() { function resetSearch() {
var searchbox = document.getElementById("searchbox") var searchbox = document.getElementById("searchbox")
if (searchbox.value != "" && active_feed_id) { if (searchbox.value != "" && getActiveFeedId()) {
searchbox.value = ""; searchbox.value = "";
viewfeed(active_feed_id, 0, ""); viewfeed(getActiveFeedId(), 0, "");
} }
} }
function search() { function search() {
checkActiveFeedId(); checkActiveFeedId();
if (active_feed_id) { if (getActiveFeedId()) {
viewfeed(active_feed_id, 0, ""); viewfeed(getActiveFeedId(), 0, "");
} else { } else {
notify("Please select some feed first."); notify("Please select some feed first.");
} }
@ -282,7 +267,7 @@ function localHotkeyHandler(keycode) {
} }
if (keycode == 85) { if (keycode == 85) {
return viewfeed(active_feed_id, active_offset, "ForceUpdate"); return viewfeed(getActiveFeedId(), 0, "ForceUpdate");
} }
// notify("KC: " + keycode); // notify("KC: " + keycode);
@ -317,6 +302,13 @@ function init() {
var limitbox = document.getElementById("limitbox"); var limitbox = document.getElementById("limitbox");
limitbox.value = getCookie("ttrss_vf_limit"); limitbox.value = getCookie("ttrss_vf_limit");
} }
// if (getCookie("ttrss_vf_actfeed")) {
// viewfeed(getCookie("ttrss_vf_actfeed"), 0, '');
// }
setCookie("ttrss_vf_actfeed", "");
} }

View File

@ -1,4 +1,3 @@
var active_feed_id = false;
var active_post_id = false; var active_post_id = false;
var total_unread = 0; var total_unread = 0;
@ -73,7 +72,7 @@ function view(id, feed_id) {
} }
active_post_id = id; active_post_id = id;
active_feed_id = feed_id; setActiveFeedId(feed_id);
var content = parent.document.getElementById("content-frame"); var content = parent.document.getElementById("content-frame");
@ -134,13 +133,13 @@ function moveToPost(mode) {
if (mode == "next") { if (mode == "next") {
if (next_id != undefined) { if (next_id != undefined) {
view(next_id, active_feed_id); view(next_id, getActiveFeedId());
} }
} }
if (mode == "prev") { if (mode == "prev") {
if ( prev_id != undefined) { if ( prev_id != undefined) {
view(prev_id, active_feed_id); view(prev_id, getActiveFeedId());
} }
} }
} }