This commit is contained in:
Jeena 2013-09-15 01:23:23 +02:00
parent 8297a48818
commit 3450feaba0
3 changed files with 54 additions and 10 deletions

View file

@ -219,10 +219,15 @@ canvas {
height: 2.5em; height: 2.5em;
} }
#full .star, #full .unread { .button.icon {
line-height: 0.52; line-height: 0.52;
font-size: 2em; font-size: 2em;
vertical-align: bottom; vertical-align: bottom;
padding-top: 0.35em;
}
.button.icon2 {
line-height: 1.05;
} }
#full h1 { #full h1 {

View file

@ -21,15 +21,16 @@
<ul></ul> <ul></ul>
</article> </article>
<footer class="bar"> <footer class="bar">
<a class="button" href="#reload">Reload</a> <a class="button icon" href="#reload"></a>
<a class="button" href="#settings">Settings</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> <canvas width="40" height="40"></canvas>
</footer> </footer>
</section> </section>
<section id="settings"> <section id="settings">
<header class="bar"> <header class="bar">
<a class="button" href="#list">List</a> <a class="button icon2" href="#list"></a>
</header> </header>
<article> <article>
<ul> <ul>
@ -79,9 +80,9 @@
<section id="full"> <section id="full">
<header class="bar"> <header class="bar">
<a class="button" href="#list">List</a> <a class="button icon2" href="#list"></a>
<a id="setunread" class="button unread" href="#unread"></a> <a id="setunread" class="button icon" href="#unread"></a>
<a id="setstarred" class="button star" href="#starred"></a> <a id="setstarred" class="button icon" href="#starred"></a>
<canvas width="40" height="40"></canvas> <canvas width="40" height="40"></canvas>
</header> </header>
<article> <article>

View file

@ -62,6 +62,8 @@ App.prototype.after_login = function() {
_this.fontChange("smaller"); _this.fontChange("smaller");
} else if(url == "#font-bigger") { } else if(url == "#font-bigger") {
_this.fontChange("bigger"); _this.fontChange("bigger");
} else if(url == "#all-read") {
_this.toggleAllRead();
} }
// this is here so you can tap on a button more then once // this is here so you can tap on a button more then once
@ -128,6 +130,7 @@ App.prototype.setColor = function(color) {
App.prototype.reload = function() { App.prototype.reload = function() {
this.unread_articles = []; this.unread_articles = [];
$("#all-read").innerHTML = "●";
this.ttrss.getUnreadFeeds(this.gotUnreadFeeds.bind(this)); this.ttrss.getUnreadFeeds(this.gotUnreadFeeds.bind(this));
}; };
@ -187,9 +190,11 @@ App.prototype.populateList = function() {
App.prototype.updateList = function() { App.prototype.updateList = function() {
var unread = 0; var unread = 0;
var _this = this;
$$("#list ul li").forEach(function(o, i) { $$("#list ul li").forEach(function(o, i) {
if(!this.unread_articles[i].unread) o.removeClass("unread");
if(!this.unread_articles[i].unread) {
o.removeClass("unread");
}
else { else {
unread++; unread++;
o.addClass("unread"); o.addClass("unread");
@ -314,12 +319,45 @@ App.prototype.setCurrentUnread = function() {
article.unread = true; article.unread = true;
article.set_unread = true; article.set_unread = true;
this.updateList(); this.updateList();
var _this = this;
this.ttrss.setArticleUnread(article.id); this.ttrss.setArticleUnread(article.id);
$("#setunread").innerHTML = "●"; $("#setunread").innerHTML = "●";
}; };
App.prototype.toggleAllRead = function() {
if($("#all-read").innerHTML == "●") { // set all read
var ids = [];
for (var i = 0; i < this.unread_articles.length; i++) {
var article = this.unread_articles[i];
article.unread = false;
article.set_unread = false;
ids.push(article.id);
}
$("#all-read").innerHTML = "○";
this.updateList();
this.ttrss.setArticleRead(ids.join(","));
} else {
var ids = [];
for (var i = 0; i < this.unread_articles.length; i++) {
var article = this.unread_articles[i];
article.unread = true;
article.set_unread = false;
ids.push(article.id);
}
$("#all-read").innerHTML = "●";
this.updateList();
this.ttrss.setArticleUnread(ids.join(","));
}
};
App.prototype.toggleStarred = function() { App.prototype.toggleStarred = function() {
var article = this.unread_articles[this.currentIndex]; var article = this.unread_articles[this.currentIndex];
if(!article) return; // happens if we're not on a full article site if(!article) return; // happens if we're not on a full article site