A free, self-hostable news aggregator…
Add locker to mark_favorite action
Marien Fressinaud69ce70be35c5
diff --git a/p/scripts/main.js b/p/scripts/main.jsindex 44517eb6c..39b780bd7 100644--- a/p/scripts/main.js+++ b/p/scripts/main.js@@ -1,7 +1,6 @@"use strict";var $stream = null,- isCollapsed = true,- pending_feed = [];+ isCollapsed = true;function is_normal_mode() {return $stream.hasClass('normal');@@ -107,6 +106,7 @@ function incUnreadsFeed(article, feed_id, nb) {return isCurrentView;}+var pending_feeds = [];function mark_read(active, only_not_read) {if (active.length === 0 ||(only_not_read === true && !active.hasClass("not_read"))) {@@ -120,13 +120,13 @@ function mark_read(active, only_not_read) {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);+ index_pending = pending_feeds.indexOf(feed_id);if (index_pending !== -1) {return false;}- pending_feed.push(feed_id);+ pending_feeds.push(feed_id);$.ajax({type: 'POST',@@ -146,7 +146,7 @@ function mark_read(active, only_not_read) {incUnreadsFeed(active, feed_id, inc);- pending_feed.splice(index_pending, 1);+ pending_feeds.splice(index_pending, 1);});}@@ -160,6 +160,16 @@ function mark_favorite(active) {return false;}+ var feed_url = active.find(".website>a").attr("href"),+ feed_id = feed_url.substr(feed_url.lastIndexOf('f_')),+ index_pending = pending_feeds.indexOf(feed_id);++ if (index_pending !== -1) {+ return false;+ }++ pending_feeds.push(feed_id);+$.ajax({type: 'POST',url: url,@@ -190,6 +200,8 @@ function mark_favorite(active) {elem.setAttribute('data-unread', numberFormat(feed_unreads + inc));}}++ pending_feeds.splice(index_pending, 1);});}