aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/stores
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/js/stores')
-rw-r--r--src/web/js/stores/MenuStore.js30
-rw-r--r--src/web/js/stores/MiddlePanelStore.js23
2 files changed, 25 insertions, 28 deletions
diff --git a/src/web/js/stores/MenuStore.js b/src/web/js/stores/MenuStore.js
index ecf32499..d98495f5 100644
--- a/src/web/js/stores/MenuStore.js
+++ b/src/web/js/stores/MenuStore.js
@@ -63,27 +63,23 @@ MenuStore.dispatchToken = JarrDispatcher.register(function(action) {
if(action.attribute != 'read') {
return;
}
- for(var i in MenuStore._datas.categories) {
- if(MenuStore._datas.categories[i].id == action.category_id) {
- for(var j in MenuStore._datas.categories[i].feeds) {
- if(MenuStore._datas.categories[i].feeds[j].id == action.feed_id) {
- if(action.value) {
- MenuStore._datas.categories[i].feeds[j].unread -= 1;
- } else {
- MenuStore._datas.categories[i].feeds[j].unread += 1;
- }
+ var val = action.value_num;
+ action.articles.map(function(article) {
+ for(var i in MenuStore._datas.categories) {
+ if(MenuStore._datas.categories[i].id == article.category_id) {
+ for(var j in MenuStore._datas.categories[i].feeds) {
+ if(MenuStore._datas.categories[i].feeds[j].id == article.feed_id) {
+ MenuStore._datas.categories[i].feeds[j].unread += val;
+ break;
+ }
}
+ MenuStore._datas.categories[i].unread += val;
+ break;
}
- if(action.value) {
- MenuStore._datas.categories[i].unread -= 1;
- } else {
- MenuStore._datas.categories[i].unread += 1;
- }
- MenuStore.emitChange();
- break;
}
- }
+ });
+ MenuStore.emitChange();
break;
default:
// do nothing
diff --git a/src/web/js/stores/MiddlePanelStore.js b/src/web/js/stores/MiddlePanelStore.js
index 12c2d6e8..bc7cee51 100644
--- a/src/web/js/stores/MiddlePanelStore.js
+++ b/src/web/js/stores/MiddlePanelStore.js
@@ -84,21 +84,22 @@ MiddlePanelStore.dispatchToken = JarrDispatcher.register(function(action) {
if(changed) {MiddlePanelStore.emitChange();}
break;
case ActionTypes.CHANGE_ATTR:
- var id = action.article_id;
var attr = action.attribute;
- var val = action.value;
- for (var i in MiddlePanelStore._datas.articles) {
- if(MiddlePanelStore._datas.articles[i].article_id == id) {
- if (MiddlePanelStore._datas.articles[i][attr] != val) {
- MiddlePanelStore._datas.articles[i][attr] = val;
- // avoiding redraw if not filter, display won't change anyway
- if(MiddlePanelStore._datas.filter != 'all') {
- MiddlePanelStore.emitChange();
+ var val = action.value_bool;
+ action.articles.map(function(article) {
+ for (var i in MiddlePanelStore._datas.articles) {
+ if(MiddlePanelStore._datas.articles[i].article_id == article.article_id) {
+ if (MiddlePanelStore._datas.articles[i][attr] != val) {
+ MiddlePanelStore._datas.articles[i][attr] = val;
+ // avoiding redraw if not filter, display won't change anyway
+ if(MiddlePanelStore._datas.filter != 'all') {
+ MiddlePanelStore.emitChange();
+ }
}
+ break;
}
- break;
}
- }
+ });
break;
default:
// pass
bgstack15