blob: a811dcf6a1664bd4ef2c4702d0250ced903efece (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import * as sort from './sort'
import * as format from './format'
import * as maths from './math'
export {
sort,
...maths,
...format,
}
export const is_iphone = !!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
export const is_ipad = !!(navigator.userAgent.match(/iPad/i))
export const is_android = !!(navigator.userAgent.match(/Android/i))
export const is_mobile = is_iphone || is_ipad || is_android
export const is_desktop = ! is_mobile;
const htmlClassList = document.body.parentNode.classList
htmlClassList.add(is_desktop ? 'desktop' : 'mobile')
htmlClassList.remove('loading')
// window.debug = false
document.body.style.backgroundImage = 'linear-gradient(' + (randint(40)+40) + 'deg, #fde, #ffe)'
export const allProgress = (promises, progress_cb) => {
let d = 0
progress_cb(0, 0, promises.length)
promises.forEach((p) => {
p.then((s) => {
d += 1
progress_cb(Math.floor((d * 100) / promises.length), d, promises.length)
return s
})
})
return Promise.all(promises)
}
|