Installierbar und Settings bearbeitet
This commit is contained in:
parent
cd917c0f2d
commit
396b651fc5
@ -1 +1 @@
|
||||
<div></div>
|
||||
<div><p></div>
|
||||
@ -30,7 +30,7 @@
|
||||
<link href="css/foundation.css" media="screen,print" rel="stylesheet" type="text/css">
|
||||
<link href="css/wordRotator.css" media="screen,print" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body class='blue'>
|
||||
<body class='black'>
|
||||
|
||||
<div id='print-content'>
|
||||
</div>
|
||||
|
||||
@ -4603,30 +4603,28 @@ InitPromise.addPromise(function(app){
|
||||
app.addDeepLink("newPassword", SetNewPasswordSite);
|
||||
});
|
||||
|
||||
class InstallManager{
|
||||
static init(){
|
||||
console.log("init");
|
||||
class InstallManager {
|
||||
static init() {
|
||||
window.addEventListener('beforeinstallprompt', e => {
|
||||
console.log("beforeinstallprompt", e);
|
||||
this.deferredPromt = e;
|
||||
if (this.canInstallListener){
|
||||
e.preventDefault();
|
||||
if (this.canInstallListener) {
|
||||
this.canInstallListener(this.deferredPromt);
|
||||
}
|
||||
});
|
||||
}
|
||||
static setCanInstallListener(listener, callIfCanInstall){
|
||||
|
||||
static setCanInstallListener(listener, callIfCanInstall) {
|
||||
this.canInstallListener = listener;
|
||||
callIfCanInstall = Helper.nonNull(callIfCanInstall, true);
|
||||
|
||||
if (callIfCanInstall && Helper.nonNull(this.deferredPromt)){
|
||||
if (callIfCanInstall && Helper.nonNull(this.deferredPromt)) {
|
||||
this.canInstallListener(this.deferredPromt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InstallManager.init();
|
||||
window.addEventListener("load", () => {
|
||||
console.log("loaded");
|
||||
});
|
||||
|
||||
class Matomo {
|
||||
|
||||
@ -6799,9 +6797,14 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
});
|
||||
|
||||
InstallManager.setCanInstallListener((e) => {
|
||||
let installButton =this.findBy("#install-button");
|
||||
let installButton = this.findBy("#install-button");
|
||||
installButton.addEventListener("click", () => {
|
||||
e.prompt();
|
||||
e["userChoice"].then(res => {
|
||||
if (res["outcome"] === 'accepted') {
|
||||
installButton.classList.add("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
installButton.classList.remove("hidden");
|
||||
});
|
||||
|
||||
@ -8,30 +8,28 @@ class DelayPromise extends Promise {
|
||||
}
|
||||
}
|
||||
|
||||
class InstallManager{
|
||||
static init(){
|
||||
console.log("init");
|
||||
class InstallManager {
|
||||
static init() {
|
||||
window.addEventListener('beforeinstallprompt', e => {
|
||||
console.log("beforeinstallprompt", e);
|
||||
this.deferredPromt = e;
|
||||
if (this.canInstallListener){
|
||||
e.preventDefault();
|
||||
if (this.canInstallListener) {
|
||||
this.canInstallListener(this.deferredPromt);
|
||||
}
|
||||
});
|
||||
}
|
||||
static setCanInstallListener(listener, callIfCanInstall){
|
||||
|
||||
static setCanInstallListener(listener, callIfCanInstall) {
|
||||
this.canInstallListener = listener;
|
||||
callIfCanInstall = Helper.nonNull(callIfCanInstall, true);
|
||||
|
||||
if (callIfCanInstall && Helper.nonNull(this.deferredPromt)){
|
||||
if (callIfCanInstall && Helper.nonNull(this.deferredPromt)) {
|
||||
this.canInstallListener(this.deferredPromt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InstallManager.init();
|
||||
window.addEventListener("load", () => {
|
||||
console.log("loaded");
|
||||
});
|
||||
|
||||
class Matomo {
|
||||
|
||||
|
||||
@ -1 +1,3 @@
|
||||
<div></div>
|
||||
<div>
|
||||
<p></p>
|
||||
</div>
|
||||
@ -62,9 +62,14 @@ export class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
});
|
||||
|
||||
InstallManager.setCanInstallListener((e) => {
|
||||
let installButton =this.findBy("#install-button");
|
||||
let installButton = this.findBy("#install-button");
|
||||
installButton.addEventListener("click", () => {
|
||||
e.prompt();
|
||||
e["userChoice"].then(res => {
|
||||
if (res["outcome"] === 'accepted') {
|
||||
installButton.classList.add("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
installButton.classList.remove("hidden");
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user