mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-13 16:06:21 +00:00
Merge branch 'safe.fiery.me' into account-manager
This commit is contained in:
commit
f0998a8532
@ -1,7 +1,33 @@
|
||||
/* global LazyLoad */
|
||||
|
||||
const page = {}
|
||||
const page = {
|
||||
lazyLoad: null,
|
||||
|
||||
// byte units for getPrettyBytes()
|
||||
byteUnits: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
}
|
||||
|
||||
page.getPrettyBytes = num => {
|
||||
// MIT License
|
||||
// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
if (!Number.isFinite(num)) { return num }
|
||||
|
||||
const neg = num < 0
|
||||
if (neg) { num = -num }
|
||||
if (num < 1) { return (neg ? '-' : '') + num + ' B' }
|
||||
|
||||
const exponent = Math.min(Math.floor(Math.log10(num) / 3), page.byteUnits.length - 1)
|
||||
const numStr = Number((num / Math.pow(1000, exponent)).toPrecision(3))
|
||||
const unit = page.byteUnits[exponent]
|
||||
|
||||
return (neg ? '-' : '') + numStr + ' ' + unit
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
const elements = document.getElementsByClassName('file-size')
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
elements[i].innerHTML = page.getPrettyBytes(parseInt(elements[i].innerHTML))
|
||||
}
|
||||
|
||||
page.lazyLoad = new LazyLoad()
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ routes.get('/a/:identifier', async (req, res, next) => {
|
||||
|
||||
for (const file of files) {
|
||||
file.file = `${basedomain}/${file.name}`
|
||||
file.size = utils.getPrettyBytes(parseInt(file.size))
|
||||
|
||||
file.extname = path.extname(file.name).toLowerCase()
|
||||
if (utils.mayGenerateThumb(file.extname)) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
v2: Images and config files (manifest.json, browserconfig.xml, etc).
|
||||
v3: CSS and JS files (libs such as bulma, lazyload, etc).
|
||||
#}
|
||||
{% set v1 = "J9TzRpLTDJ" %}
|
||||
{% set v1 = "JxZhgFgBYY" %}
|
||||
{% set v2 = "Ii3JYKIhb0" %}
|
||||
{% set v3 = "HrvcYD3KTh" %}
|
||||
|
||||
|
@ -86,7 +86,7 @@
|
||||
</a>
|
||||
<div class="details">
|
||||
<p><span class="name" title="{{ file.file }}">{{ file.name }}</span></p>
|
||||
<p>{{ file.size }}</p>
|
||||
<p class="file-size">{{ file.size }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user