viewfeed: switch to hash-based arguments
viewfeed: remove (obsolete) method parameter add shortcut to debug viewfeed() query
This commit is contained in:
parent
839d150a60
commit
6b0a17ad8b
|
@ -92,6 +92,7 @@
|
|||
"feed_catchup" => __("Mark as read"),
|
||||
"feed_reverse" => __("Reverse headlines"),
|
||||
"feed_debug_update" => __("Debug feed update"),
|
||||
"feed_debug_viewfeed" => __("Debug viewfeed()"),
|
||||
"catchup_all" => __("Mark all feeds as read"),
|
||||
"cat_toggle_collapse" => __("Un/collapse current category"),
|
||||
"toggle_combined_mode" => __("Toggle combined mode"),
|
||||
|
@ -162,6 +163,7 @@
|
|||
"f q" => "feed_catchup",
|
||||
"f x" => "feed_reverse",
|
||||
"f *d" => "feed_debug_update",
|
||||
"f *g" => "feed_debug_viewfeed",
|
||||
"f *c" => "toggle_combined_mode",
|
||||
"f c" => "toggle_cdm_expanded",
|
||||
"*q" => "catchup_all",
|
||||
|
|
|
@ -8,7 +8,7 @@ var _viewfeed_timeout = false;
|
|||
var counters_last_request = 0;
|
||||
|
||||
function viewCategory(cat) {
|
||||
viewfeed(cat, '', true);
|
||||
viewfeed({feed: cat, is_cat: true});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -43,22 +43,28 @@ function loadMoreHeadlines() {
|
|||
|
||||
console.log("offset: " + offset);
|
||||
|
||||
viewfeed(getActiveFeedId(), '', activeFeedIsCat(), offset, false, true);
|
||||
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat(), offset: offset, infscroll_req: true});
|
||||
|
||||
} catch (e) {
|
||||
exception_error("viewNextFeedPage", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function viewfeed(feed, method, is_cat, offset, background, infscroll_req, can_wait) {
|
||||
function viewfeed(params) {
|
||||
try {
|
||||
var feed = params.feed;
|
||||
var is_cat = params.is_cat;
|
||||
var offset = params.offset;
|
||||
var background = params.background;
|
||||
var infscroll_req = params.infscroll_req;
|
||||
var can_wait = params.can_wait;
|
||||
var viewfeed_debug = params.viewfeed_debug;
|
||||
|
||||
if (is_cat == undefined)
|
||||
is_cat = false;
|
||||
else
|
||||
is_cat = !!is_cat;
|
||||
|
||||
if (method == undefined) method = '';
|
||||
if (offset == undefined) offset = 0;
|
||||
if (background == undefined) background = false;
|
||||
if (infscroll_req == undefined) infscroll_req = false;
|
||||
|
@ -77,7 +83,7 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req, can_w
|
|||
_infscroll_disable = 0;
|
||||
}
|
||||
|
||||
if (infscroll_req && !method) {
|
||||
if (infscroll_req) {
|
||||
var timestamp = get_timestamp();
|
||||
|
||||
if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
|
||||
|
@ -96,10 +102,6 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req, can_w
|
|||
var query = "?op=feeds&method=view&feed=" + param_escape(feed) + "&" +
|
||||
toolbar_query;
|
||||
|
||||
if (method) {
|
||||
query = query + "&m=" + param_escape(method);
|
||||
}
|
||||
|
||||
if (offset > 0) {
|
||||
if (current_first_id) {
|
||||
query = query + "&fid=" + param_escape(current_first_id);
|
||||
|
@ -121,7 +123,7 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req, can_w
|
|||
query = query + "&vgrlf=" + param_escape(vgroup_last_feed);
|
||||
}
|
||||
} else {
|
||||
if (!method && !is_cat && feed == getActiveFeedId()) {
|
||||
if (!is_cat && feed == getActiveFeedId()) {
|
||||
query = query + "&m=ForceUpdate";
|
||||
}
|
||||
}
|
||||
|
@ -144,6 +146,10 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req, can_w
|
|||
|
||||
setActiveFeedId(feed, is_cat);
|
||||
|
||||
if (viewfeed_debug) {
|
||||
window.open("backend.php" + query + "&debug=1&csrf_token=" + getInitParam("csrf_token"));
|
||||
}
|
||||
|
||||
timeout_ms = can_wait ? 250 : 0;
|
||||
_viewfeed_timeout = setTimeout(function() {
|
||||
|
||||
|
@ -171,9 +177,9 @@ function feedlist_init() {
|
|||
setTimeout("hotkey_prefix_timeout()", 5*1000);
|
||||
|
||||
if (!getActiveFeedId()) {
|
||||
viewfeed(-3);
|
||||
viewfeed({feed: -3});
|
||||
} else {
|
||||
viewfeed(getActiveFeedId(), '', activeFeedIsCat());
|
||||
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat()});
|
||||
}
|
||||
|
||||
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
||||
|
@ -467,7 +473,7 @@ function catchupFeed(feed, is_cat, mode) {
|
|||
var nuf = getNextUnreadFeed(feed, is_cat);
|
||||
|
||||
if (nuf) {
|
||||
viewfeed(nuf, '', is_cat);
|
||||
viewfeed({feed: nuf, is_cat: is_cat});
|
||||
}
|
||||
} else {
|
||||
if (feed == getActiveFeedId() && is_cat == activeFeedIsCat()) {
|
||||
|
|
25
js/tt-rss.js
25
js/tt-rss.js
|
@ -79,7 +79,7 @@ function updateFeedList() {
|
|||
var id = String(item.id);
|
||||
var is_cat = id.match("^CAT:");
|
||||
var feed = id.substr(id.indexOf(":")+1);
|
||||
viewfeed(feed, '', is_cat);
|
||||
viewfeed({feed: feed, is_cat: is_cat});
|
||||
return false;
|
||||
},
|
||||
openOnClick: false,
|
||||
|
@ -146,11 +146,11 @@ function catchupAllFeeds() {
|
|||
}
|
||||
}
|
||||
|
||||
function viewCurrentFeed(method) {
|
||||
function viewCurrentFeed() {
|
||||
console.log("viewCurrentFeed");
|
||||
|
||||
if (getActiveFeedId() != undefined) {
|
||||
viewfeed(getActiveFeedId(), method, activeFeedIsCat());
|
||||
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat()});
|
||||
}
|
||||
return false; // block unneeded form submits
|
||||
}
|
||||
|
@ -273,13 +273,13 @@ function init() {
|
|||
var rv = dijit.byId("feedTree").getNextFeed(
|
||||
getActiveFeedId(), activeFeedIsCat());
|
||||
|
||||
if (rv) viewfeed(rv[0], '', rv[1], null, null, null, true);
|
||||
if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
|
||||
};
|
||||
hotkey_actions["prev_feed"] = function() {
|
||||
var rv = dijit.byId("feedTree").getPreviousFeed(
|
||||
getActiveFeedId(), activeFeedIsCat());
|
||||
|
||||
if (rv) viewfeed(rv[0], '', rv[1], null, null, null, true);
|
||||
if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
|
||||
};
|
||||
hotkey_actions["next_article"] = function() {
|
||||
moveToPost('next');
|
||||
|
@ -411,7 +411,7 @@ function init() {
|
|||
};
|
||||
hotkey_actions["feed_refresh"] = function() {
|
||||
if (getActiveFeedId() != undefined) {
|
||||
viewfeed(getActiveFeedId(), '', activeFeedIsCat());
|
||||
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat()});
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -429,6 +429,11 @@ function init() {
|
|||
alert("You can't debug this kind of feed.");
|
||||
}
|
||||
};
|
||||
|
||||
hotkey_actions["feed_debug_viewfeed"] = function() {
|
||||
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat(), viewfeed_debug: true});
|
||||
};
|
||||
|
||||
hotkey_actions["feed_edit"] = function() {
|
||||
if (activeFeedIsCat())
|
||||
alert(__("You can't edit this kind of feed."));
|
||||
|
@ -454,16 +459,16 @@ function init() {
|
|||
}
|
||||
};
|
||||
hotkey_actions["goto_all"] = function() {
|
||||
viewfeed(-4);
|
||||
viewfeed({feed: -4});
|
||||
};
|
||||
hotkey_actions["goto_fresh"] = function() {
|
||||
viewfeed(-3);
|
||||
viewfeed({feed: -3});
|
||||
};
|
||||
hotkey_actions["goto_marked"] = function() {
|
||||
viewfeed(-1);
|
||||
viewfeed({feed: -1});
|
||||
};
|
||||
hotkey_actions["goto_published"] = function() {
|
||||
viewfeed(-2);
|
||||
viewfeed({feed: -2});
|
||||
};
|
||||
hotkey_actions["goto_tagcloud"] = function() {
|
||||
displayDlg(__("Tag cloud"), "printTagCloud");
|
||||
|
|
|
@ -1352,7 +1352,7 @@ function openNextUnreadFeed() {
|
|||
try {
|
||||
var is_cat = activeFeedIsCat();
|
||||
var nuf = getNextUnreadFeed(getActiveFeedId(), is_cat);
|
||||
if (nuf) viewfeed(nuf, '', is_cat);
|
||||
if (nuf) viewfeed({feed: nuf, is_cat: is_cat});
|
||||
} catch (e) {
|
||||
exception_error("openNextUnreadFeed", e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue