From 6464d6bcc639c39d968f0c31b96fa5559164a648 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 20 Sep 2015 20:43:01 +0200 Subject: [PATCH] Prefetch next image #185 --- dist/main.js | Bin 189776 -> 189805 bytes src/scripts/photo.js | 17 ++++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/dist/main.js b/dist/main.js index dcd6c068131e04f387bbb8d085e24abbac0ad3e0..e58b91c553fd0e4cf97b4b4c49e6a866667c01aa 100644 GIT binary patch delta 167 zcmca`iu>&;?uHh|EleTdB02>b`6c;!1x2Yj`H3lhsTCy}sndhQnNFvxXeec*CZ;Gv zrzDmn>H-y{rIsXT#42g(6{Y6pm!)cG>OhqMg%S%2Qu9(Y)NOJy^Rg9CbSMCgwpD`Z tS5n9Tnq;e_uAQf?u4JdKxxFTWX`=)q*YpqROj0a)I;oo5eG8eGO8|)5IAj0- delta 118 zcmaERiu=MT?uHh|EleTd(=)@FPMH>DI { 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(``) }