changed read/unread buttons behaviour
This commit is contained in:
parent
52b5d27deb
commit
843c746e1a
3 changed files with 26 additions and 19 deletions
|
@ -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;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</article>
|
||||
<footer class="bar">
|
||||
<a class="button icon" href="#reload">🔄</a>
|
||||
<a class="button icon" href="#all-read" id="all-read">📥</a>
|
||||
<a class="button icon" href="#all-read" id="all-read">❌</a>
|
||||
<a class="button icon" href="#settings">⚙</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"></a>
|
||||
<a id="setunread" class="button icon" href="#unread">📥</a>
|
||||
<a id="setunread" class="button icon" href="#unread">✓</a>
|
||||
<a id="setstarred" class="button icon" href="#starred">☆</a>
|
||||
<canvas width="40" height="40"></canvas>
|
||||
</header>
|
||||
|
|
34
js/App.js
34
js/App.js
|
@ -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 = "📥";
|
||||
$("#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 = "📥";
|
||||
$("#all-read").innerHTML = "❌";
|
||||
} else {
|
||||
$("#all-read").innerHTML = "📤";
|
||||
$("#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 = "📤";
|
||||
if(article.unread) {
|
||||
$("#setunread").innerHTML = "❌";
|
||||
} else {
|
||||
$("#setunread").innerHTML = "📥";
|
||||
$("#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 = "📤";
|
||||
};
|
||||
|
||||
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 = "📤";
|
||||
$("#all-read").innerHTML = "✓";
|
||||
|
||||
this.updateList();
|
||||
|
||||
|
@ -356,7 +364,7 @@ App.prototype.toggleAllRead = function() {
|
|||
article.set_unread = false;
|
||||
ids.push(article.id);
|
||||
}
|
||||
$("#all-read").innerHTML = "📥";
|
||||
$("#all-read").innerHTML = "❌";
|
||||
this.updateList();
|
||||
|
||||
this.ttrss.setArticleUnread(ids.join(","));
|
||||
|
|
Reference in a new issue