blob: eb6886c21582ea92570d08dbeeac67d2c8c3a9b8 (
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
|
const isiPhone = !!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
const isiPad = !!(navigator.userAgent.match(/iPad/i))
const isAndroid = !!(navigator.userAgent.match(/Android/i))
const isMobile = isiPhone || isiPad || isAndroid
const isDesktop = !isMobile
const htmlClassList = document.body.parentNode.classList
htmlClassList.add(isDesktop ? 'desktop' : 'mobile')
function toArray(a) { return Array.prototype.slice.apply(a) }
function choice(a) { return a[Math.floor(Math.random()*a.length)]}
var site = (function(){
var site = {}
site.init = function(){
site.build()
}
site.build = function(){
const paras = document.querySelectorAll("section p")
if (paras.length) {
paras[0].classList.add('first_paragraph')
}
toArray(document.querySelectorAll('header .links a')).forEach(tag => {
if (window.location.href.match(tag.href)) {
tag.classList.add('active')
}
})
}
site.init()
})()
|