aboutsummaryrefslogtreecommitdiff
path: root/assets/js/config.js
blob: 28b84f5c451c6b9d0a611cdfacab325a4887f081 (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
console.log('loading script...')

var lang = window.navigator.language.split('-')[0]

var adjustLang = function(lang) {
    console.log(navigator.languages)
    if (lang == 'fr') {
	console.log('Ici on parle le français')
    } else {
	// Fallback to English
	console.log('Let us do English.')
    }
}

document.ready = function() {
    console.log('I am already running on document.ready')
}

document.ready = function() {

    // Ensure that we keep existing 'ready' function if any
    var ready_run = null
    console.log(typeof document.ready)
    if (typeof document.ready !== 'undefined') {
	ready_run = document.ready
    }
    // and run it before appending our stuff
    if (typeof ready_run === 'function') {
	console.log('running pre-existing ready()')
	ready_run()
	unset(ready_run)
    }

    console.log('document.ready');
    adjustLang(lang)

}

console.log('script loaded.')