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) {
|
App.prototype.validate = function(articles) {
|
||||||
|
|
||||||
|
if(articles.length == 0) return true;
|
||||||
|
|
||||||
for (var i = 0; i < articles.length; i++) {
|
for (var i = 0; i < articles.length; i++) {
|
||||||
if(typeof articles[i].title != "undefined") return true;
|
if(typeof articles[i].title != "undefined") return true;
|
||||||
}
|
}
|
||||||
|
@ -288,12 +290,10 @@ App.prototype.showPrevious = function() {
|
||||||
App.prototype.setCurrentRead = function() {
|
App.prototype.setCurrentRead = 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
|
||||||
|
|
||||||
if(!article.set_unread) {
|
if(!article.set_unread) {
|
||||||
article.unread = false;
|
article.unread = false;
|
||||||
this.updateList();
|
this.updateList();
|
||||||
var _this = this;
|
this.ttrss.setArticleRead(article.id);
|
||||||
setTimeout(function() { _this.ttrss.setArticleRead(article.id); }, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
article.set_unread = false;
|
article.set_unread = false;
|
||||||
|
@ -307,7 +307,7 @@ App.prototype.setCurrentUnread = function() {
|
||||||
article.set_unread = true;
|
article.set_unread = true;
|
||||||
this.updateList();
|
this.updateList();
|
||||||
var _this = this;
|
var _this = this;
|
||||||
setTimeout(function() { _this.ttrss.setArticleUnread(article.id); }, 100);
|
this.ttrss.setArticleUnread(article.id);
|
||||||
|
|
||||||
$("#setunread").innerHTML = "✔ unread";
|
$("#setunread").innerHTML = "✔ unread";
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,10 +52,8 @@ TinyTinyRSS.prototype.doOperation = function(operation, new_options, callback) {
|
||||||
if(callback)
|
if(callback)
|
||||||
callback(JSON.parse(xhr.responseText).content);
|
callback(JSON.parse(xhr.responseText).content);
|
||||||
} else {
|
} else {
|
||||||
if(xhr.status != 0)
|
if(xhr.status != 0) alert("error: " + xhr.status + " " + xhr.statusText);
|
||||||
alert("error: " + xhr.status + " " + xhr.statusText);
|
if(callback) callback(null);
|
||||||
if(callback)
|
|
||||||
callback(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,8 +80,9 @@ TinyTinyRSS.prototype.setArticleRead = function(article_id) {
|
||||||
field: 2
|
field: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
if (navigator.onLine) this.doOperation("updateArticle", options);
|
if (navigator.onLine) {
|
||||||
else {
|
this.doOperation("updateArticle", options);
|
||||||
|
} else {
|
||||||
var read_articles = localStorage.read_articles;
|
var read_articles = localStorage.read_articles;
|
||||||
if(typeof read_articles !== "undefined") read_articles = JSON.parse(read_articles);
|
if(typeof read_articles !== "undefined") read_articles = JSON.parse(read_articles);
|
||||||
else read_articles = [];
|
else read_articles = [];
|
||||||
|
|
Reference in a new issue