Browse Source

Merge remote-tracking branch 'origin/develop' into develop

Peter Hoffmann 8 years ago
parent
commit
84f2873bf1
2 changed files with 6 additions and 11 deletions
  1. 0 0
      dist/main.js
  2. 6 11
      src/scripts/photo.js

File diff suppressed because it is too large
+ 0 - 0
dist/main.js


+ 6 - 11
src/scripts/photo.js

@@ -56,7 +56,7 @@ photo.load = function(photoID, albumID) {
 
 		setTimeout(() => {
 			lychee.content.show()
-			//photo.preloadNext(photoID, albumID);
+			photo.preloadNext(photoID);
 		}, 300)
 
 	})
@@ -66,21 +66,16 @@ photo.load = function(photoID, albumID) {
 // Preload the next photo for better response time
 photo.preloadNext = function(photoID) {
 
-	// Never preload on mobile devices with bare RAM and
-	// mostly mobile internet
-	// {{ code }}
-
 	if (album.json &&
-	   album.json.content &&
-	   album.json.content[photoID] &&
-	   album.json.content[photoID].nextPhoto!='') {
+	    album.json.content &&
+	    album.json.content[photoID] &&
+	    album.json.content[photoID].nextPhoto!='') {
 
 		let nextPhoto = album.json.content[photoID].nextPhoto,
 		    url       = album.json.content[nextPhoto].url
 
-		photo.cache        = new Image()
-		photo.cache.src    = url
-		photo.cache.onload = () => photo.cache = null
+		$('head [data-prefetch]').remove()
+		$('head').append(`<link data-prefetch rel="prefetch" href="${ url }">`)
 
 	}
 

Some files were not shown because too many files changed in this diff