diff --git a/.gitignore b/.gitignore index d564d61..65fc558 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .cache .DS_Store node_modules +.idea diff --git a/src/base.js b/src/base.js index e37b908..10d5574 100644 --- a/src/base.js +++ b/src/base.js @@ -1,10 +1,7 @@ const VueImg = Object.create(null) // Check webP support -VueImg.canWebp = false -const img = new Image() -img.onload = () => { VueImg.canWebp = true } -img.src = 'data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAsAAAABBxAREYiI/gcAAABWUDggGAAAADABAJ0BKgEAAQABABwlpAADcAD+/gbQAA==' +VueImg.canWebp = !![].map && document.createElement('canvas').toDataURL('image/webp').indexOf('data:image/webp') === 0; // Default cdn prefix const protocol = location.protocol === 'https:' ? 'https://' : 'http://'