137
137
>
138
138
<i class =" material-icons" >chevron_right</i >
139
139
</button >
140
+ <link rel =" prefetch" :href =" previousRaw" >
141
+ <link rel =" prefetch" :href =" nextRaw" >
140
142
</div >
141
143
</template >
142
144
@@ -146,7 +148,6 @@ import { files as api } from "@/api";
146
148
import { baseURL , resizePreview } from " @/utils/constants" ;
147
149
import url from " @/utils/url" ;
148
150
import throttle from " lodash.throttle" ;
149
-
150
151
import HeaderBar from " @/components/header/HeaderBar" ;
151
152
import Action from " @/components/header/Action" ;
152
153
import ExtendedImage from " @/components/files/ExtendedImage" ;
@@ -172,6 +173,8 @@ export default {
172
173
navTimeout: null ,
173
174
hoverNav: false ,
174
175
autoPlay: false ,
176
+ previousRaw: " " ,
177
+ nextRaw: " " ,
175
178
};
176
179
},
177
180
computed: {
@@ -302,20 +305,31 @@ export default {
302
305
for (let j = i - 1 ; j >= 0 ; j-- ) {
303
306
if (mediaTypes .includes (this .listing [j].type )) {
304
307
this .previousLink = this .listing [j].url ;
308
+ this .previousRaw = this .prefetchUrl (this .listing [j]);
305
309
break ;
306
310
}
307
311
}
308
-
309
312
for (let j = i + 1 ; j < this .listing .length ; j++ ) {
310
313
if (mediaTypes .includes (this .listing [j].type )) {
311
314
this .nextLink = this .listing [j].url ;
315
+ this .nextRaw = this .prefetchUrl (this .listing [j]);
312
316
break ;
313
317
}
314
318
}
315
319
316
320
return ;
317
321
}
318
322
},
323
+ prefetchUrl : function (item ) {
324
+ const key = Date .parse (item .modified );
325
+ if (item .type === " image" && ! this .fullSize ) {
326
+ return ` ${ baseURL} /api/preview/big${ item .path } ?k=${ key} &inline=true` ;
327
+ } else if (item .type === " image" ){
328
+ return ` ${ baseURL} /api/raw${ item .path } ?k=${ key} &inline=true` ;
329
+ } else {
330
+ return " " ;
331
+ }
332
+ },
319
333
openMore () {
320
334
this .$store .commit (" showHover" , " more" );
321
335
},
0 commit comments