diff options
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 8cda62d26..e94df2a39 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1,6 +1,7 @@ "use strict"; var $stream = null, - isCollapsed = true; + isCollapsed = true, + pending_feed = []; function is_normal_mode() { return $stream.hasClass('normal'); @@ -107,7 +108,8 @@ function incUnreadsFeed(article, feed_id, nb) { } function mark_read(active, only_not_read) { - if (active.length === 0 || (only_not_read === true && !active.hasClass("not_read"))) { + if (active.length === 0 || + (only_not_read === true && !active.hasClass("not_read"))) { return false; } @@ -116,6 +118,16 @@ function mark_read(active, only_not_read) { return false; } + var feed_url = active.find(".website>a").attr("href"), + feed_id = feed_url.substr(feed_url.lastIndexOf('f_')), + index_pending = pending_feed.indexOf(feed_id); + + if (index_pending !== -1) { + return false; + } + + pending_feed.push(feed_id); + $.ajax({ type: 'POST', url: url, @@ -132,9 +144,9 @@ function mark_read(active, only_not_read) { } $r.find('.icon').replaceWith(data.icon); - var feed_url = active.find(".website>a").attr("href"), - feed_id = feed_url.substr(feed_url.lastIndexOf('f_')); incUnreadsFeed(active, feed_id, inc); + + pending_feed.splice(index_pending, 1); }); } |
