diff --git a/src/js/dashboard.js b/src/js/dashboard.js
index 6604c67..234490f 100644
--- a/src/js/dashboard.js
+++ b/src/js/dashboard.js
@@ -519,7 +519,7 @@ page.getUploads = (params = {}) => {
params.pageNum = 0
}
- const url = params.album !== undefined
+ const url = typeof params.album !== 'undefined'
? `api/album/${params.album}/${params.pageNum}`
: `api/uploads/${params.pageNum}`
@@ -673,9 +673,7 @@ page.getUploads = (params = {}) => {
let unselected = false
const showOriginalNames = page.views[page.currentView].originalNames
- const hasExpiryDateColumn = files.some(file => {
- return file.expirydate !== undefined
- })
+ const hasExpiryDateColumn = files.some(file => typeof file.expirydate !== 'undefined')
for (let i = 0; i < files.length; i++) {
// Build full URLs
@@ -727,7 +725,7 @@ page.getUploads = (params = {}) => {
files[i].appendix = files[i].userid
? users[files[i].userid] || ''
: ''
- } else if (params.album === undefined) {
+ } else if (typeof params.album === 'undefined') {
files[i].appendix = files[i].albumid
? albums[files[i].albumid] || ''
: ''
@@ -754,7 +752,7 @@ page.getUploads = (params = {}) => {
div.className = 'image-container column'
div.dataset.id = upload.id
- if (upload.thumb !== undefined) {
+ if (typeof upload.thumb !== 'undefined') {
div.innerHTML = ``
} else {
div.innerHTML = `${upload.extname || 'N/A'}
`
@@ -812,7 +810,7 @@ page.getUploads = (params = {}) => {
|
File name |
${showOriginalNames ? 'Original name | ' : ''}
- ${params.album === undefined ? `User' : 'albumid">Album'} | ` : ''}
+ ${typeof params.album === 'undefined' ? `User' : 'albumid">Album'} | ` : ''}
${allAlbums ? 'Album | ' : ''}
Size |
${params.all ? 'IP | ' : ''}
@@ -840,7 +838,7 @@ page.getUploads = (params = {}) => {
|
${upload.name} |
${showOriginalNames ? `${upload.original} | ` : ''}
- ${params.album === undefined ? `${upload.appendix} | ` : ''}
+ ${typeof params.album === 'undefined' ? `${upload.appendix} | ` : ''}
${allAlbums ? `${upload.albumid ? (albums[upload.albumid] || '') : ''} | ` : ''}
${upload.prettyBytes} |
${params.all ? `${upload.ip || ''} | ` : ''}
@@ -3021,13 +3019,13 @@ window.addEventListener('DOMContentLoaded', () => {
Object.defineProperty(Object, 'assign', {
value: function assign (target, varArgs) { // .length of function is 2
'use strict'
- if (target === null || target === undefined) {
+ if (target === null || typeof target === 'undefined') {
throw new TypeError('Cannot convert undefined or null to object')
}
const to = Object(target)
for (let i = 1; i < arguments.length; i++) {
const nextSource = arguments[i]
- if (nextSource !== null && nextSource !== undefined) {
+ if (nextSource !== null && typeof nextSource !== 'undefined') {
for (const nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
diff --git a/src/js/home.js b/src/js/home.js
index 5ef0da6..b5a8f7d 100644
--- a/src/js/home.js
+++ b/src/js/home.js
@@ -399,7 +399,7 @@ page.prepareDropzone = () => {
}
// Attach necessary data for initial upload speed calculation
- if (xhr._uplSpeedCalc === undefined) {
+ if (typeof xhr._uplSpeedCalc === 'undefined') {
xhr._uplSpeedCalc = {
lastSent: 0,
data: [{ timestamp: Date.now(), bytes: 0 }]
@@ -947,9 +947,9 @@ page.prepareUploadConfig = () => {
let value
if (!conf.disabled) {
- if (conf.value !== undefined) {
+ if (typeof conf.value !== 'undefined') {
value = conf.value
- } else if (conf.number !== undefined) {
+ } else if (typeof conf.number !== 'undefined') {
const parsed = parseInt(localStorage[lsKeys[key]])
if (!isNaN(parsed) && parsed <= conf.number.max && parsed >= conf.number.min) {
value = parsed
@@ -969,9 +969,9 @@ page.prepareUploadConfig = () => {
// otherwise pass value to global page object
if (typeof conf.valueHandler === 'function') {
conf.valueHandler(value)
- } else if (value !== undefined) {
+ } else if (typeof value !== 'undefined') {
page[key] = value
- } else if (fallback[key] !== undefined) {
+ } else if (typeof fallback[key] !== 'undefined') {
page[key] = fallback[key]
}
}
@@ -985,7 +985,7 @@ page.prepareUploadConfig = () => {
for (let j = 0; j < conf.select.length; j++) {
const opt = conf.select[j]
const selected = (value && (opt.value === String(value))) ||
- (value === undefined && opt.value === 'default')
+ (typeof value === 'undefined' && opt.value === 'default')
opts.push(`