Dynamic load of entire site

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-09-05 20:35:49 -07:00
parent 22d87f0e1d
commit a6f7c4fbec
2 changed files with 12 additions and 3 deletions

View File

@ -596,6 +596,13 @@
Polymer.dom(thumbnails).appendChild(thumbnail); Polymer.dom(thumbnails).appendChild(thumbnail);
this.thumbnails.push(thumbnail); this.thumbnails.push(thumbnail);
if (this.next) {
this.async(function() {
var cursor = this.photos[this.photos.length - 1];
this._loadPhotos(cursor.taken.toString().replace(/T.*/, "") + "_" + cursor.id, -1, true, this.limit * 2);
}, 250);
}
} }
this.triggerVisibilityChecks(); this.triggerVisibilityChecks();
@ -610,15 +617,17 @@
this._loadPhotos(); this._loadPhotos();
}, },
_loadPhotos: function(start, dir, append) { _loadPhotos: function(start, dir, append, limit) {
if (this.loading == true) { if (this.loading == true) {
return; return;
} }
this.loading = true; this.loading = true;
this.limit = limit || 500;
dir = dir || -1; dir = dir || -1;
var params = { var params = {
limit: Math.ceil(this.clientWidth / 200) * Math.ceil(this.clientHeight / 200), limit: this.limit,
dir: dir dir: dir
}, query = ""; }, query = "";
if (start) { if (start) {

View File

@ -55,7 +55,7 @@ router.get("/*", function(req, res/*, next*/) {
} }
} }
let query = "SELECT * FROM photos WHERE path LIKE :path " + index + " ORDER BY taken " + order + ",id " + order + " LIMIT 1000";// + " LIMIT " + (limit * 2 + 1); let query = "SELECT * FROM photos WHERE path LIKE :path " + index + " ORDER BY taken " + order + ",id " + order + " LIMIT " + (limit * 2 + 1);
return photoDB.sequelize.query(query, { return photoDB.sequelize.query(query, {
replacements: { replacements: {
cursor: cursor, cursor: cursor,