Merge branch 'master' of github.com:jeena/FeedMonkey
This commit is contained in:
commit
e120f99e4e
5 changed files with 68 additions and 20 deletions
59
js/App.js
59
js/App.js
|
@ -7,6 +7,13 @@ function App() {
|
||||||
if(!color) color = "red";
|
if(!color) color = "red";
|
||||||
this.setColor(color);
|
this.setColor(color);
|
||||||
this.fontChange();
|
this.fontChange();
|
||||||
|
|
||||||
|
var numArticles = localStorage.numArticles;
|
||||||
|
if(!numArticles) numArticles = 50;
|
||||||
|
this.numArticles(numArticles);
|
||||||
|
var maxDownload = localStorage.maxDownload;
|
||||||
|
if(!maxDownload) maxDownload = 500000;
|
||||||
|
this.maxDownload(maxDownload);
|
||||||
};
|
};
|
||||||
|
|
||||||
App.prototype.authenticate = function() {
|
App.prototype.authenticate = function() {
|
||||||
|
@ -101,6 +108,14 @@ App.prototype.after_login = function(backend) {
|
||||||
} else {
|
} else {
|
||||||
this.backend = new TinyTinyRSS(this, localStorage.server_url, localStorage.session_id);
|
this.backend = new TinyTinyRSS(this, localStorage.server_url, localStorage.session_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var numArticles = localStorage.numArticles;
|
||||||
|
if(!numArticles) numArticles = 50;
|
||||||
|
this.numArticles(numArticles);
|
||||||
|
var maxDownload = localStorage.maxDownload;
|
||||||
|
if(!maxDownload) maxDownload = 500000;
|
||||||
|
this.maxDownload(maxDownload);
|
||||||
|
|
||||||
this.reload();
|
this.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -139,7 +154,8 @@ App.prototype.setColor = function(color) {
|
||||||
App.prototype.reload = function() {
|
App.prototype.reload = function() {
|
||||||
this.unread_articles = [];
|
this.unread_articles = [];
|
||||||
$("#all-read").innerHTML = "❌";
|
$("#all-read").innerHTML = "❌";
|
||||||
this.backend.reload(this.gotUnreadFeeds.bind(this));
|
var number=parseInt(localStorage.numArticles);
|
||||||
|
this.backend.reload(this.gotUnreadFeeds.bind(this),number);
|
||||||
};
|
};
|
||||||
|
|
||||||
App.prototype.gotUnreadFeeds = function(new_articles) {
|
App.prototype.gotUnreadFeeds = function(new_articles) {
|
||||||
|
@ -157,11 +173,25 @@ App.prototype.gotUnreadFeeds = function(new_articles) {
|
||||||
this.unread_articles = this.unread_articles.concat(new_articles);
|
this.unread_articles = this.unread_articles.concat(new_articles);
|
||||||
|
|
||||||
if(new_articles.length > 0) {
|
if(new_articles.length > 0) {
|
||||||
this.backend.getUnreadFeeds(this.gotUnreadFeeds.bind(this), this.unread_articles);
|
try {
|
||||||
} else {
|
//To check if when it fails it is the same
|
||||||
localStorage.unread_articles = JSON.stringify(this.unread_articles);
|
localStorage.unread_articles = JSON.stringify(this.unread_articles);
|
||||||
|
//alert("Size probando:"+probando.length)
|
||||||
|
var size = parseInt(localStorage.maxDownload);
|
||||||
|
if(localStorage.unread_articles.length < size) {
|
||||||
|
var num = parseInt(localStorage.numArticles);
|
||||||
|
this.backend.getUnreadFeeds(this.gotUnreadFeeds.bind(this), this.unread_articles,num);
|
||||||
|
} else {
|
||||||
|
alert("Limit size reached: Downloaded: " + this.unread_articles.length + " articles. Reached: " + localStorage.unread_articles.length +" bytes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
alert("Reached maximum memory by app" + e.name + " " +e.message +". We will keep working in anycase with:" + localStorage.unread_articles.length);
|
||||||
|
}
|
||||||
this.populateList();
|
this.populateList();
|
||||||
}
|
} else {
|
||||||
|
alert("Downloaded: " + this.unread_articles.length + " articles. Reached: " + localStorage.unread_articles.length + " bytes");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -447,5 +477,22 @@ App.prototype.fontChange = function(size) {
|
||||||
document.body.addClass("f" + i);
|
document.body.addClass("f" + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
App.prototype.numArticles= function(askfor) {
|
||||||
|
if(askfor < 200 && askfor > 0) {
|
||||||
|
localStorage.numArticles=askfor;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localStorage.numArticles=100;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
App.prototype.maxDownload= function(maxdata) {
|
||||||
|
if(maxdata < 5000000 && maxdata > 100000) {
|
||||||
|
localStorage.maxDownload=maxdata;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localStorage.maxDownload=500000;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,18 +65,18 @@ OwnCloud.prototype.doOperation = function(method, operation, new_options, callba
|
||||||
xhr.send(body);
|
xhr.send(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
OwnCloud.prototype.reload = function(callback) {
|
OwnCloud.prototype.reload = function(callback,limit) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this.getFeeds(function() { _this.getUnreadFeeds(callback); });
|
this.getFeeds(function() { _this.getUnreadFeeds(callback,0,limit); });
|
||||||
};
|
};
|
||||||
|
|
||||||
OwnCloud.prototype.getUnreadFeeds = function(callback, skip) {
|
OwnCloud.prototype.getUnreadFeeds = function(callback, skip, limit) {
|
||||||
if(skip) {
|
if(skip) {
|
||||||
skip = skip[skip.length - 1].id;
|
skip = skip[skip.length - 1].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
batchSize: 700,
|
batchSize: limit || 700,
|
||||||
offset: skip || 0,
|
offset: skip || 0,
|
||||||
type: 3,
|
type: 3,
|
||||||
id: 0,
|
id: 0,
|
||||||
|
|
10
js/Pond.js
10
js/Pond.js
|
@ -69,15 +69,15 @@ Pond.prototype.doOperation = function(method, operation, new_options, callback)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Pond.prototype.reload = function(callback) {
|
Pond.prototype.reload = function(callback,limit) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this.getFeeds(function() { _this.getUnreadFeeds(callback); });
|
this.getFeeds(function() { _this.getUnreadFeeds(callback,0,limit); });
|
||||||
};
|
};
|
||||||
|
|
||||||
Pond.prototype.getUnreadFeeds = function(callback, skip) {
|
Pond.prototype.getUnreadFeeds = function(callback, skip, limit) {
|
||||||
var options = {
|
var options = {
|
||||||
status: "unread",
|
status: "unread",
|
||||||
limit: 100
|
limit: limit || 100
|
||||||
};
|
};
|
||||||
|
|
||||||
if(skip && skip.length > 0) {
|
if(skip && skip.length > 0) {
|
||||||
|
@ -224,4 +224,4 @@ Pond.login = function(server_url, user, password, callback) {
|
||||||
xhr.setRequestHeader("Content-Length", options.length);
|
xhr.setRequestHeader("Content-Length", options.length);
|
||||||
xhr.setRequestHeader("Connection", "close");
|
xhr.setRequestHeader("Connection", "close");
|
||||||
xhr.send(options);
|
xhr.send(options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,17 +54,18 @@ TinyTinyRSS.prototype.doOperation = function(operation, new_options, callback) {
|
||||||
xhr.send(JSON.stringify(options));
|
xhr.send(JSON.stringify(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
TinyTinyRSS.prototype.reload = function(callback) {
|
TinyTinyRSS.prototype.reload = function(callback,limit) {
|
||||||
this.getUnreadFeeds(callback, []);
|
this.getUnreadFeeds(callback, 0, limit);
|
||||||
};
|
};
|
||||||
|
|
||||||
TinyTinyRSS.prototype.getUnreadFeeds = function(callback, skip) {
|
TinyTinyRSS.prototype.getUnreadFeeds = function(callback, skip, limit) {
|
||||||
skip = skip.length;
|
skip = skip.length;
|
||||||
var options = {
|
var options = {
|
||||||
show_excerpt: false,
|
show_excerpt: false,
|
||||||
view_mode: "unread",
|
view_mode: "unread",
|
||||||
show_content: true,
|
show_content: true,
|
||||||
feed_id: -4,
|
feed_id: -4,
|
||||||
|
limit: limit || 0,
|
||||||
skip: skip || 0
|
skip: skip || 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,5 +19,5 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"installs_allowed_from": ["*"],
|
"installs_allowed_from": ["*"],
|
||||||
"version": "0.3.0"
|
"version": "0.3.0_iss30"
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue