use directories for structure

This commit is contained in:
s2
2020-05-26 10:37:57 +02:00
parent 66580d4847
commit ae4aaf2668
1287 changed files with 92093 additions and 13113 deletions

55
app/index.js Normal file
View File

@@ -0,0 +1,55 @@
(function() {
// globals
MyApp.Utils = {};
// utility functions
// app functions
// events
// app startup
// set language
i18next
.use(i18nextBrowserLanguageDetector)
.use(i18nextXHRBackend)
.init({
detection: {
order: ['querystring', 'cookie', 'navigator'],
lookupQuerystring: 'lang',
lookupCookie: 'current-language',
caches: ['cookie'],
cookieMinutes: 5256000
},
whitelist: ['en', 'de', 'it'],
load: 'languageOnly',
fallbackLng: 'it',
backend: {
loadPath: '/i18n/{{lng}}.json'
}
})
.then(function() {
// language initialized
// if there is a lang query string parameter, remove it and reload: we save the language in a cookie so the url stays nice
var urlQueryString = new URLSearchParams(window.location.search);
if (urlQueryString.has('lang')) {
urlQueryString.delete('lang');
var newUrl = [location.protocol, '//', location.host, location.pathname].join('') +
(urlQueryString.toString() !== '' ? '?' + urlQueryString.toString() : '') +
window.location.hash;
window.location = newUrl;
return;
}
// render main shell
MyApp.Shell.renderShell()
.then(function() {
//setup routing
page({
hashbang: true
});
});
});
})();