Installierbar und Settings bearbeitet

This commit is contained in:
silas
2018-10-06 18:14:39 +02:00
parent 07ec39b1a1
commit cd917c0f2d
12 changed files with 48 additions and 26 deletions

View File

@@ -6756,7 +6756,7 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
themeNameElem.removeAllChildren().appendChild(Translator.makePersistentTranslation(currentThemeName));
this.findBy("#theme-chooser").addEventListener("click", async () => {
let newTheme = await (new ChooseThemeDialog()).show();
if (Helper.isNotNull(newTheme)){
if (Helper.isNotNull(newTheme)) {
SettingsManager.getInstance().setSetting("theme", newTheme);
ThemeManager.changeCurrentTheme(newTheme);
themeNameElem.removeAllChildren().appendChild(Translator.makePersistentTranslation(newTheme));
@@ -6772,7 +6772,7 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
WordRotatorDb.getInstance().removeAll(WordRotatorDb.OBJECT_STORE.LEVEL);
});
if (location.hostname.includes("beta") || location.hostname.includes("127.0.0.1")){
if (location.hostname.includes("beta") || location.hostname.includes("127.0.0.1")) {
this.findBy("#reset-levels").classList.remove("hidden");
}
@@ -6780,12 +6780,12 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
playMusicButton.addEventListener("change", () => {
let soundManager = SoundManager.getInstance();
soundManager.set({muted: !playMusicButton.checked}, SoundManager.CHANNELS.MUSIC);
if (playMusicButton.checked){
if (playMusicButton.checked) {
soundManager.play(SoundManager.CHANNELS.MUSIC);
}
});
this.findBy("#track-switch").addEventListener("change", function(e) {
this.findBy("#track-switch").addEventListener("change", function (e) {
Matomo.setTrack(this.checked === true);
e.stopPropagation();
e.preventDefault();
@@ -6798,6 +6798,14 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
this.getSite().startSite(PrivacyPolicySite);
});
InstallManager.setCanInstallListener((e) => {
let installButton =this.findBy("#install-button");
installButton.addEventListener("click", () => {
e.prompt();
});
installButton.classList.remove("hidden");
});
return super.onFirstStart();
}

File diff suppressed because one or more lines are too long