aboutsummaryrefslogtreecommitdiff
path: root/assets/js/config.js
diff options
context:
space:
mode:
authorYour Name <you@example.com>2017-12-23 20:10:15 +0100
committerYour Name <you@example.com>2017-12-23 20:10:33 +0100
commit95c3bad65fb93e5de5d36889e186b55e3f7c6446 (patch)
tree9a293fea117b902292989d7a962889274c405e47 /assets/js/config.js
parentd0cf5f9e4a5df1c4fb77425c51160d0f81a1bddc (diff)
downloadlesoiseaux.io-95c3bad65fb93e5de5d36889e186b55e3f7c6446.tar.gz
Add assets (they are mounted at each site as /assets/
Diffstat (limited to 'assets/js/config.js')
-rw-r--r--assets/js/config.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/assets/js/config.js b/assets/js/config.js
new file mode 100644
index 0000000..28b84f5
--- /dev/null
+++ b/assets/js/config.js
@@ -0,0 +1,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&ccedil;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.')