reddit-wallpapers
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -11,3 +11,3 @@ // Core functions | ||
const CheckImg = (url) => { | ||
const CheckImg = (url, checkDim=false) => { | ||
// Promise function to check if image is valid and loadable | ||
@@ -24,3 +24,4 @@ return new Promise((resolve, reject) => { | ||
img.onload = (e) => { | ||
resolve(e) | ||
if (checkDim === 'true' && screen.height > img.height || screen.width > img.width) reject(e) | ||
else resolve(e) | ||
} | ||
@@ -27,0 +28,0 @@ img.onerror = (e) => { |
@@ -33,3 +33,4 @@ import { | ||
isAnimated: options.isAnimated || 'true', // to use jQuery animation | ||
defaultImg: options.defaultImg || '' // default image to use if failed | ||
defaultImg: options.defaultImg || '', // default image to use if failed | ||
checkDim: options.checkDim || 'true', // make sure img dimensions larger than screen dimensions | ||
} | ||
@@ -65,3 +66,3 @@ | ||
let image = defaultImage ? self.options.defaultImg : self.data[self.index].data.url | ||
CheckImg(image).then(() => { | ||
CheckImg(image, self.options.checkDim).then(() => { | ||
let sstyle = { | ||
@@ -68,0 +69,0 @@ 'background-size': 'cover', |
{ | ||
"name": "reddit-wallpapers", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "to help fetching wallpapers with reddit api and loop setting them", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
325209
198