no more js to load js

This commit is contained in:
Jeremy Kauffman 2019-11-12 17:18:50 -05:00 committed by Sean Yesmunt
parent 751b86d05d
commit 7e2fb22836
4 changed files with 4 additions and 40 deletions

View file

@ -2,11 +2,11 @@
<html>
<head>
<meta charset="utf-8" />
<script src="ui.js" async></script>
<title>LBRY</title>
</head>
<body>
<div id="app"></div>
<script src="ui.js"></script>
</body>
</html>

View file

@ -2,6 +2,7 @@
<html>
<head>
<meta charset="utf-8" />
<script src="/ui.js" async></script>
<!-- VARIABLE_HEAD_BEGIN -->
<title>lbry.tv</title>
<meta property="og:url" content="https://beta.lbry.tv" />
@ -15,42 +16,5 @@
<body>
<div id="app"></div>
<script>
window.i18n_messages = {};
function loadUi () {
const script = document.createElement('script');
script.setAttribute('src', '/ui.js');
document.body.appendChild(script);
}
let lang;
try {
const browserLocale = window.navigator.language.slice(0,2);
lang = window.localStorage.getItem('language') || browserLocale || 'en';
} catch {
lang = 'en';
}
/*this should match doSetLanguage in action/settings.js*/
if (lang && lang != 'en') {
fetch('https://lbry.com/i18n/get/lbry-desktop/app-strings/' + lang + '.json')
.then(r => r.json())
.then(j => { window.i18n_messages[lang] = j; loadUi(); })
.catch(() => {
window.localStorage.removeItem('language');
loadUi();
});
} else {
loadUi();
}
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-7620985872686147",
enable_page_level_ads: true
});
</script>
</body>
</html>

View file

@ -14,7 +14,7 @@ const defaultState = {
[SETTINGS.ENABLE_SYNC]: true,
// UI
[SETTINGS.LANGUAGE]: window.localStorage.getItem(SETTINGS.LANGUAGE) || 'en',
[SETTINGS.LANGUAGE]: window.localStorage.getItem(SETTINGS.LANGUAGE) || window.navigator.language.slice(0, 2) || 'en',
[SETTINGS.THEME]: __('light'),
[SETTINGS.THEMES]: [__('light'), __('dark')],
[SETTINGS.SUPPORT_OPTION]: false,

View file

@ -56,7 +56,7 @@ const searchFilter = createFilter('search', ['options']);
const tagsFilter = createFilter('tags', ['followedTags']);
const subscriptionsFilter = createFilter('subscriptions', ['subscriptions']);
const blockedFilter = createFilter('blocked', ['blockedChannels']);
const settingsFilter = createBlacklistFilter('settings', ['loadedLanguages']);
const settingsFilter = createBlacklistFilter('settings', ['loadedLanguages', 'language']);
const whiteListedReducers = [
'fileInfo',
'publish',