summaryrefslogtreecommitdiff
path: root/js/feedlist.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-03-31 12:37:42 +0400
committerAndrew Dolgov <[email protected]>2013-03-31 12:37:42 +0400
commitc8b693cf7f8616e4dc37ee2f370a01b6642ac7f5 (patch)
tree9520a60643e476a6afaab1ceacb400510595968e /js/feedlist.js
parentbf1fee83471cc9efef9f8d3ade0cd00b84633cf1 (diff)
implement catchup with selectable updated criteria
Diffstat (limited to 'js/feedlist.js')
-rw-r--r--js/feedlist.js50
1 files changed, 36 insertions, 14 deletions
diff --git a/js/feedlist.js b/js/feedlist.js
index 28fadc0b0..9d643142b 100644
--- a/js/feedlist.js
+++ b/js/feedlist.js
@@ -380,8 +380,20 @@ function getNextUnreadFeed(feed, is_cat) {
}
}
-function catchupCurrentFeed() {
- return catchupFeed(getActiveFeedId(), activeFeedIsCat());
+function catchupCurrentFeed(elem) {
+
+ if (elem) {
+ var toolbar = document.forms["main_toolbar_form"];
+ var catchup_feed = dijit.getEnclosingWidget(toolbar.catchup_feed);
+ var mode = catchup_feed.attr('value');
+
+ if (mode != 'default') {
+ catchupFeed(getActiveFeedId(), activeFeedIsCat(), mode);
+ catchup_feed.attr('value', 'default');
+ }
+ } else {
+ catchupFeed(getActiveFeedId(), activeFeedIsCat());
+ }
}
function catchupFeedInGroup(id) {
@@ -400,11 +412,26 @@ function catchupFeedInGroup(id) {
}
}
-function catchupFeed(feed, is_cat) {
+function catchupFeed(feed, is_cat, mode) {
try {
if (is_cat == undefined) is_cat = false;
- var str = __("Mark all articles in %s as read?");
+ var str = false;
+
+ switch (mode) {
+ case "1day":
+ str = __("Mark all articles in %s older than 1 day as read?");
+ break;
+ case "1week":
+ str = __("Mark all articles in %s older than 1 week as read?");
+ break;
+ case "2weeks":
+ str = __("Mark all articles in %s older than 2 weeks as read?");
+ break;
+ default:
+ str = __("Mark all articles in %s as read?");
+ }
+
var fn = getFeedName(feed, is_cat);
str = str.replace("%s", fn);
@@ -414,7 +441,7 @@ function catchupFeed(feed, is_cat) {
}
var catchup_query = "?op=rpc&method=catchupFeed&feed_id=" +
- feed + "&is_cat=" + is_cat;
+ feed + "&is_cat=" + is_cat + "&mode=" + mode;
console.log(catchup_query);
@@ -425,15 +452,6 @@ function catchupFeed(feed, is_cat) {
onComplete: function(transport) {
handle_rpc_json(transport);
- if (feed == getActiveFeedId() && is_cat == activeFeedIsCat()) {
-
- $$("#headlines-frame > div[id*=RROW][class*=Unread]").each(
- function(child) {
- child.removeClassName("Unread");
- }
- );
- }
-
var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
if (show_next_feed) {
@@ -442,6 +460,10 @@ function catchupFeed(feed, is_cat) {
if (nuf) {
viewfeed(nuf, '', is_cat);
}
+ } else {
+ if (feed == getActiveFeedId() && is_cat == activeFeedIsCat()) {
+ viewCurrentFeed();
+ }
}
notify("");