changed read/unread buttons behaviour

This commit is contained in:
Jeena 2013-09-15 14:16:33 +02:00
parent 52b5d27deb
commit 843c746e1a
3 changed files with 26 additions and 19 deletions

View file

@ -63,7 +63,6 @@ header .button, footer .button, .button.small {
.yellow .bar .button { background: #f1c40f; color: #2c3e50; }
.smallogo { text-align: center; margin: 0; padding: 0; }
.smallogo img { width: 50%; }
button:active, a:active, .button:active {
background: black !important;

View file

@ -22,7 +22,7 @@
</article>
<footer class="bar">
<a class="button icon" href="#reload">&#128260;</a>
<a class="button icon" href="#all-read" id="all-read">&#128229;</a>
<a class="button icon" href="#all-read" id="all-read"></a>
<a class="button icon" href="#settings">&#9881;</a>
<canvas width="40" height="40"></canvas>
</footer>
@ -59,7 +59,7 @@
<article>
<form>
<p class="smallogo">
<img src="img/splash.png" alt="Logo, an ape head">
<img src="img/icon-128.png" alt="Logo, an ape head">
</p>
<p>
<label for="url">URL:</label>
@ -83,7 +83,7 @@
<section id="full">
<header class="bar">
<a class="button icon" href="#list">&#57349;</a>
<a id="setunread" class="button icon" href="#unread">&#128229;</a>
<a id="setunread" class="button icon" href="#unread"></a>
<a id="setstarred" class="button icon" href="#starred">&#9734;</a>
<canvas width="40" height="40"></canvas>
</header>

View file

@ -44,7 +44,7 @@ App.prototype.after_login = function() {
var i = parseInt(url.replace("#full-", ""), 10);
_this.showFull(_this.unread_articles[i]);
} else if(url == "#unread") {
_this.setCurrentUnread();
_this.toggleCurrentUnread();
} else if(url == "#starred") {
_this.toggleStarred();
} else if(url == "#logout") {
@ -130,7 +130,7 @@ App.prototype.setColor = function(color) {
App.prototype.reload = function() {
this.unread_articles = [];
$("#all-read").innerHTML = "&#128229;";
$("#all-read").innerHTML = "";
this.ttrss.getUnreadFeeds(this.gotUnreadFeeds.bind(this));
};
@ -202,9 +202,9 @@ App.prototype.updateList = function() {
}, this);
if(unread > 0) {
$("#all-read").innerHTML = "&#128229;";
$("#all-read").innerHTML = "";
} else {
$("#all-read").innerHTML = "&#128228;";
$("#all-read").innerHTML = "";
}
this.updatePieChart();
@ -270,10 +270,10 @@ App.prototype.showFull = function(article, slide_back) {
$(page_id + " .article").innerHTML = article.content;
if(article.set_unread) {
$("#setunread").innerHTML = "&#128228;";
if(article.unread) {
$("#setunread").innerHTML = "";
} else {
$("#setunread").innerHTML = "&#128229;";
$("#setunread").innerHTML = "";
}
if(article.marked) {
@ -317,22 +317,30 @@ App.prototype.setCurrentRead = function() {
article.set_unread = false;
$("#setunread").innerHTML = "✓";
this.updatePieChart();
};
App.prototype.setCurrentUnread = function() {
App.prototype.toggleCurrentUnread = function() {
var article = this.unread_articles[this.currentIndex];
if(article.unread) {
article.unread = false;
article.set_unread = false;
$("#setunread").innerHTML = "✓";
} else {
article.unread = true;
article.set_unread = true;
$("#setunread").innerHTML = "❌";
}
this.updateList();
this.ttrss.setArticleUnread(article.id);
$("#setunread").innerHTML = "&#128228;";
};
App.prototype.toggleAllRead = function() {
if($("#all-read").innerHTML == "📥") { // set all read
if($("#all-read").innerHTML == "") { // set all read
var ids = [];
for (var i = 0; i < this.unread_articles.length; i++) {
@ -341,7 +349,7 @@ App.prototype.toggleAllRead = function() {
article.set_unread = false;
ids.push(article.id);
}
$("#all-read").innerHTML = "&#128228;";
$("#all-read").innerHTML = "&#10003;";
this.updateList();
@ -356,7 +364,7 @@ App.prototype.toggleAllRead = function() {
article.set_unread = false;
ids.push(article.id);
}
$("#all-read").innerHTML = "&#128229;";
$("#all-read").innerHTML = "&#10060;";
this.updateList();
this.ttrss.setArticleUnread(ids.join(","));