summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <github@ainw.org> 2014-12-03 18:13:59 -0500
committerGravatar Alexis Degrugillier <github@ainw.org> 2014-12-03 18:16:50 -0500
commit93af0cf61e6e9368888eedb2d2e36397da3f87bd (patch)
tree5af162f0992092c0a4ebe212fdc81f6b52edef84
parentd88335072d7e6c31f74f03a6ef7513073a1eb1a8 (diff)
Fix behavior when marking an article as unread
-rw-r--r--p/scripts/main.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 19eba206d..32cf55a3c 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -144,6 +144,7 @@ function mark_read(active, only_not_read) {
inc = 0;
if (active.hasClass("not_read")) {
active.removeClass("not_read");
+ hide_article(active);
inc--;
} else if (only_not_read !== true || active.hasClass("not_read")) {
active.addClass("not_read");
@@ -231,14 +232,7 @@ function toggleContent(new_active, old_active) {
}
old_active.removeClass("active current");
new_active.addClass("current");
- if (context['auto_remove_article'] && !old_active.hasClass('not_read')) {
- var p = old_active.prev();
- var n = old_active.next();
- if (p.hasClass('day') && n.hasClass('day')) {
- p.remove();
- }
- old_active.remove();
- }
+ hide_article(old_active);
} else {
new_active.toggleClass('active');
}
@@ -283,6 +277,17 @@ function toggleContent(new_active, old_active) {
}
}
+function hide_article(article) {
+ if (context['auto_remove_article'] && !article.hasClass('not_read')) {
+ var p = article.prev();
+ var n = article.next();
+ if (p.hasClass('day') && n.hasClass('day')) {
+ p.remove();
+ }
+ article.remove();
+ }
+}
+
function prev_entry() {
var old_active = $(".flux.current"),
new_active = old_active.length === 0 ? $(".flux:last") : old_active.prevAll(".flux:first");
@@ -690,9 +695,6 @@ function init_stream(divStream) {
divStream.on('click', '.flux a.read', function () {
var active = $(this).parents(".flux");
mark_read(active, false);
- if (context['auto_remove_article']) {
- active.remove();
- }
return false;
});