Fixed data-retina
This commit is contained in:
parent
36793e9f9c
commit
a4357ddad8
@ -72,7 +72,7 @@ build.album = function(data) {
|
||||
|
||||
}
|
||||
|
||||
var {path: thumbPath, retina: thumbRetina} = lychee.retinize(data.thumbs[0]);
|
||||
var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbs[0]);
|
||||
|
||||
html = `
|
||||
<div class='album' data-id='${ data.id }'>
|
||||
@ -116,7 +116,7 @@ build.photo = function(data) {
|
||||
|
||||
}
|
||||
|
||||
var {path: thumbPath, retina: thumbRetina} = lychee.retinize(data.thumbUrl);
|
||||
var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbUrl);
|
||||
|
||||
html = `
|
||||
<div class='photo' data-album-id='${ data.album }' data-id='${ data.id }'>
|
||||
|
@ -326,24 +326,20 @@ lychee.escapeHTML = function(s) {
|
||||
lychee.retinize = function(path = '') {
|
||||
|
||||
var pixelRatio = window.devicePixelRatio,
|
||||
extention = path.split('.').pop();
|
||||
extention = path.split('.').pop(),
|
||||
hasRetina = extention!=='svg';
|
||||
|
||||
if ((pixelRatio!==undefined&&pixelRatio>1)&&
|
||||
(extention!=='svg')) {
|
||||
(hasRetina===true)) {
|
||||
|
||||
path = path.replace(/\.[^/.]+$/, '');
|
||||
path = path + '@2x' + '.' + extention;
|
||||
|
||||
return {
|
||||
path,
|
||||
retina: true
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
path,
|
||||
retina: false
|
||||
hasRetina
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user