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; } .yellow .bar .button { background: #f1c40f; color: #2c3e50; }
.smallogo { text-align: center; margin: 0; padding: 0; } .smallogo { text-align: center; margin: 0; padding: 0; }
.smallogo img { width: 50%; }
button:active, a:active, .button:active { button:active, a:active, .button:active {
background: black !important; background: black !important;

View file

@ -22,7 +22,7 @@
</article> </article>
<footer class="bar"> <footer class="bar">
<a class="button icon" href="#reload">&#128260;</a> <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> <a class="button icon" href="#settings">&#9881;</a>
<canvas width="40" height="40"></canvas> <canvas width="40" height="40"></canvas>
</footer> </footer>
@ -59,7 +59,7 @@
<article> <article>
<form> <form>
<p class="smallogo"> <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>
<p> <p>
<label for="url">URL:</label> <label for="url">URL:</label>
@ -83,7 +83,7 @@
<section id="full"> <section id="full">
<header class="bar"> <header class="bar">
<a class="button icon" href="#list">&#57349;</a> <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> <a id="setstarred" class="button icon" href="#starred">&#9734;</a>
<canvas width="40" height="40"></canvas> <canvas width="40" height="40"></canvas>
</header> </header>

View file

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