diff options
Diffstat (limited to 'assets/js/config.js')
-rw-r--r-- | assets/js/config.js | 39 |
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ç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.') |