fixed some callback problems
This commit is contained in:
parent
b7a9bf3b7e
commit
bd95d09798
2 changed files with 9 additions and 10 deletions
|
@ -154,6 +154,8 @@ App.prototype.gotUnreadFeeds = function(new_articles) {
|
|||
|
||||
App.prototype.validate = function(articles) {
|
||||
|
||||
if(articles.length == 0) return true;
|
||||
|
||||
for (var i = 0; i < articles.length; i++) {
|
||||
if(typeof articles[i].title != "undefined") return true;
|
||||
}
|
||||
|
@ -288,12 +290,10 @@ App.prototype.showPrevious = function() {
|
|||
App.prototype.setCurrentRead = function() {
|
||||
var article = this.unread_articles[this.currentIndex];
|
||||
if(!article) return; // happens if we're not on a full article site
|
||||
|
||||
if(!article.set_unread) {
|
||||
article.unread = false;
|
||||
this.updateList();
|
||||
var _this = this;
|
||||
setTimeout(function() { _this.ttrss.setArticleRead(article.id); }, 100);
|
||||
this.ttrss.setArticleRead(article.id);
|
||||
}
|
||||
|
||||
article.set_unread = false;
|
||||
|
@ -307,7 +307,7 @@ App.prototype.setCurrentUnread = function() {
|
|||
article.set_unread = true;
|
||||
this.updateList();
|
||||
var _this = this;
|
||||
setTimeout(function() { _this.ttrss.setArticleUnread(article.id); }, 100);
|
||||
this.ttrss.setArticleUnread(article.id);
|
||||
|
||||
$("#setunread").innerHTML = "✔ unread";
|
||||
};
|
||||
|
|
|
@ -52,10 +52,8 @@ TinyTinyRSS.prototype.doOperation = function(operation, new_options, callback) {
|
|||
if(callback)
|
||||
callback(JSON.parse(xhr.responseText).content);
|
||||
} else {
|
||||
if(xhr.status != 0)
|
||||
alert("error: " + xhr.status + " " + xhr.statusText);
|
||||
if(callback)
|
||||
callback(null);
|
||||
if(xhr.status != 0) alert("error: " + xhr.status + " " + xhr.statusText);
|
||||
if(callback) callback(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,8 +80,9 @@ TinyTinyRSS.prototype.setArticleRead = function(article_id) {
|
|||
field: 2
|
||||
};
|
||||
|
||||
if (navigator.onLine) this.doOperation("updateArticle", options);
|
||||
else {
|
||||
if (navigator.onLine) {
|
||||
this.doOperation("updateArticle", options);
|
||||
} else {
|
||||
var read_articles = localStorage.read_articles;
|
||||
if(typeof read_articles !== "undefined") read_articles = JSON.parse(read_articles);
|
||||
else read_articles = [];
|
||||
|
|
Reference in a new issue