mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Refactored "location" -> "window.location"
In client JS files, for readibility and consistency. They'd work the same either way, but I'd think they'd be easier to read and understand this way.
This commit is contained in:
parent
98b2f32ec5
commit
d666e278ec
2
dist/js/dashboard.js
vendored
2
dist/js/dashboard.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/dashboard.js.map
vendored
2
dist/js/dashboard.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/js/home.js
vendored
2
dist/js/home.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/home.js.map
vendored
2
dist/js/home.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/js/misc/utils.js
vendored
2
dist/js/misc/utils.js
vendored
@ -1,2 +1,2 @@
|
|||||||
lsKeys.siBytes="siBytes",page.prepareShareX=function(){var e=page.token?{token:page.token||"",albumid:page.album||""}:{};e.filelength=page.fileLength||"",e.age=page.uploadAge||"",e.striptags=page.stripTags||"";for(var t=[],a=Object.keys(e),r=0;r<a.length;r++)t.push(' "'+a[r]+'": "'+e[a[r]]+'"');var n=(location.hostname+location.pathname).replace(/\/(dashboard)?$/,""),o=n.replace(/\//g,"_"),i=document.querySelector("#ShareX"),s='{\n "Name": "'+o+'",\n "DestinationType": "ImageUploader, FileUploader",\n "RequestMethod": "POST",\n "RequestURL": "'+location.protocol+"//"+n+'/api/upload",\n "Headers": {\n'+t.join(",\n")+'\n },\n "Body": "MultipartFormData",\n "FileFormName": "files[]",\n "URL": "$json:files[0].url$",\n "ThumbnailURL": "$json:files[0].url$"\n}',l=new Blob([s],{type:"application/octet-binary"});i.setAttribute("href",URL.createObjectURL(l)),i.setAttribute("download",o+".sxcu")},page.getPrettyDate=function(e){return e.getFullYear()+"/"+(e.getMonth()<9?"0":"")+(e.getMonth()+1)+"/"+(e.getDate()<10?"0":"")+e.getDate()+" "+(e.getHours()<10?"0":"")+e.getHours()+":"+(e.getMinutes()<10?"0":"")+e.getMinutes()+":"+(e.getSeconds()<10?"0":"")+e.getSeconds()},page.getPrettyBytes=function(e){if("number"!=typeof e&&!isFinite(e))return e;var t="0"!==localStorage[lsKeys.siBytes],a=e<0?"-":"",r=t?1e3:1024;if(a&&(e=-e),e<r)return""+a+e+" B";var n=Math.min(Math.floor(Math.log(e)*Math.LOG10E/3),8);return""+a+Number((e/Math.pow(r,n)).toPrecision(3))+" "+((t?"kMGTPEZY":"KMGTPEZY").charAt(n-1)+(t?"":"i"))+"B"},page.escape=function(e){if(!e)return e;var t,a=String(e),r=/["'&<>]/.exec(a);if(!r)return a;var n="",o=0,i=0;for(o=r.index;o<a.length;o++){switch(a.charCodeAt(o)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}i!==o&&(n+=a.substring(i,o)),i=o+1,n+=t}return i!==o?n+a.substring(i,o):n};
|
lsKeys.siBytes="siBytes",page.prepareShareX=function(){var e=page.token?{token:page.token||"",albumid:page.album||""}:{};e.filelength=page.fileLength||"",e.age=page.uploadAge||"",e.striptags=page.stripTags||"";for(var t=[],a=Object.keys(e),n=0;n<a.length;n++)t.push(' "'+a[n]+'": "'+e[a[n]]+'"');var r=(window.location.hostname+window.location.pathname).replace(/\/(dashboard)?$/,""),o=r.replace(/\//g,"_"),i=document.querySelector("#ShareX"),s='{\n "Name": "'+o+'",\n "DestinationType": "ImageUploader, FileUploader",\n "RequestMethod": "POST",\n "RequestURL": "'+window.location.protocol+"//"+r+'/api/upload",\n "Headers": {\n'+t.join(",\n")+'\n },\n "Body": "MultipartFormData",\n "FileFormName": "files[]",\n "URL": "$json:files[0].url$",\n "ThumbnailURL": "$json:files[0].url$"\n}',l=new Blob([s],{type:"application/octet-binary"});i.setAttribute("href",URL.createObjectURL(l)),i.setAttribute("download",o+".sxcu")},page.getPrettyDate=function(e){return e.getFullYear()+"/"+(e.getMonth()<9?"0":"")+(e.getMonth()+1)+"/"+(e.getDate()<10?"0":"")+e.getDate()+" "+(e.getHours()<10?"0":"")+e.getHours()+":"+(e.getMinutes()<10?"0":"")+e.getMinutes()+":"+(e.getSeconds()<10?"0":"")+e.getSeconds()},page.getPrettyBytes=function(e){if("number"!=typeof e&&!isFinite(e))return e;var t="0"!==localStorage[lsKeys.siBytes],a=e<0?"-":"",n=t?1e3:1024;if(a&&(e=-e),e<n)return""+a+e+" B";var r=Math.min(Math.floor(Math.log(e)*Math.LOG10E/3),8);return""+a+Number((e/Math.pow(n,r)).toPrecision(3))+" "+((t?"kMGTPEZY":"KMGTPEZY").charAt(r-1)+(t?"":"i"))+"B"},page.escape=function(e){if(!e)return e;var t,a=String(e),n=/["'&<>]/.exec(a);if(!n)return a;var r="",o=0,i=0;for(o=n.index;o<a.length;o++){switch(a.charCodeAt(o)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}i!==o&&(r+=a.substring(i,o)),i=o+1,r+=t}return i!==o?r+a.substring(i,o):r};
|
||||||
//# sourceMappingURL=utils.js.map
|
//# sourceMappingURL=utils.js.map
|
||||||
|
2
dist/js/misc/utils.js.map
vendored
2
dist/js/misc/utils.js.map
vendored
File diff suppressed because one or more lines are too long
@ -158,7 +158,7 @@ page.checkClientVersion = apiVersion => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
location.reload()
|
window.location.reload()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ page.onInitError = error => {
|
|||||||
uploadButton.classList.remove('is-hidden')
|
uploadButton.classList.remove('is-hidden')
|
||||||
|
|
||||||
uploadButton.addEventListener('click', () => {
|
uploadButton.addEventListener('click', () => {
|
||||||
location.reload()
|
window.location.reload()
|
||||||
})
|
})
|
||||||
|
|
||||||
if (error.response)
|
if (error.response)
|
||||||
@ -137,7 +137,7 @@ page.checkClientVersion = apiVersion => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
location.reload()
|
window.location.reload()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ page.verifyToken = (token, reloadOnError) => {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (!reloadOnError) return
|
if (!reloadOnError) return
|
||||||
localStorage.removeItem('token')
|
localStorage.removeItem('token')
|
||||||
location.reload()
|
window.location.reload()
|
||||||
})
|
})
|
||||||
|
|
||||||
localStorage[lsKeys.token] = token
|
localStorage[lsKeys.token] = token
|
||||||
@ -1027,7 +1027,7 @@ page.prepareUploadConfig = () => {
|
|||||||
text: 'Configuration saved into this browser.',
|
text: 'Configuration saved into this browser.',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
location.reload()
|
window.location.reload()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ page.prepareShareX = () => {
|
|||||||
// Pad by 4 space
|
// Pad by 4 space
|
||||||
headers.push(` "${keys[i]}": "${values[keys[i]]}"`)
|
headers.push(` "${keys[i]}": "${values[keys[i]]}"`)
|
||||||
|
|
||||||
const origin = (location.hostname + location.pathname).replace(/\/(dashboard)?$/, '')
|
const origin = (window.location.hostname + window.location.pathname).replace(/\/(dashboard)?$/, '')
|
||||||
const originClean = origin.replace(/\//g, '_')
|
const originClean = origin.replace(/\//g, '_')
|
||||||
|
|
||||||
const sharexElement = document.querySelector('#ShareX')
|
const sharexElement = document.querySelector('#ShareX')
|
||||||
@ -26,7 +26,7 @@ page.prepareShareX = () => {
|
|||||||
"Name": "${originClean}",
|
"Name": "${originClean}",
|
||||||
"DestinationType": "ImageUploader, FileUploader",
|
"DestinationType": "ImageUploader, FileUploader",
|
||||||
"RequestMethod": "POST",
|
"RequestMethod": "POST",
|
||||||
"RequestURL": "${location.protocol}//${origin}/api/upload",
|
"RequestURL": "${window.location.protocol}//${origin}/api/upload",
|
||||||
"Headers": {
|
"Headers": {
|
||||||
${headers.join(',\n')}
|
${headers.join(',\n')}
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"1": "1590283732",
|
"1": "1590435470",
|
||||||
"2": "1589010026",
|
"2": "1589010026",
|
||||||
"3": "1581416390",
|
"3": "1581416390",
|
||||||
"4": "1581416390",
|
"4": "1581416390",
|
||||||
|
Loading…
Reference in New Issue
Block a user