blob: 807a483bf125495f125b57d3dbc1727e23a6a2be (
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
37
38
39
40
41
42
43
44
45
46
|
/**
* Load the site graph
*/
import * as types from 'site/types'
import FontFaceObserver from 'fontfaceobserver'
import actions from 'site/actions'
import { dispatch } from 'site/store'
export const loadMuseum = () => {
processCookie()
Promise.all([
loadFonts,
actions.site.loadGraph('thelastmuseum'),
])
.then(() => dispatch({ type: types.site.load_site }))
}
const loadFonts = () => {
const fonts = [
new FontFaceObserver('Gruk'),
new FontFaceObserver('Gruk Wide', { style: 'italic' }),
new FontFaceObserver('Gruk Medium'),
]
return Promise.all(fonts.map(font => font.load()))
}
const processCookie = () => {
let cookies
try {
cookies = document.cookie.split(";")
.map(s => s.trim().split('='))
.reduce((lookup, pair) => {
lookup[pair[0]] = pair[1]
return lookup
}, {})
} catch (error) {
return
}
if (cookies._icl_visitor_lang_js) {
const language = cookies._icl_visitor_lang_js.split("_")[0]
if (language === 'en' || language === 'de') {
actions.site.changeLanguage(language)
}
}
}
|