Icon hinzugefügt
This commit is contained in:
105
public/js/app.js
105
public/js/app.js
@@ -4603,6 +4603,31 @@ InitPromise.addPromise(function(app){
|
||||
app.addDeepLink("newPassword", SetNewPasswordSite);
|
||||
});
|
||||
|
||||
class InstallManager{
|
||||
static init(){
|
||||
console.log("init");
|
||||
window.addEventListener('beforeinstallprompt', e => {
|
||||
console.log("beforeinstallprompt", e);
|
||||
this.deferredPromt = e;
|
||||
if (this.canInstallListener){
|
||||
this.canInstallListener(this.deferredPromt);
|
||||
}
|
||||
});
|
||||
}
|
||||
static setCanInstallListener(listener, callIfCanInstall){
|
||||
this.canInstallListener = listener;
|
||||
callIfCanInstall = Helper.nonNull(callIfCanInstall, true);
|
||||
|
||||
if (callIfCanInstall && Helper.nonNull(this.deferredPromt)){
|
||||
this.canInstallListener(this.deferredPromt);
|
||||
}
|
||||
}
|
||||
}
|
||||
InstallManager.init();
|
||||
window.addEventListener("load", () => {
|
||||
console.log("loaded");
|
||||
});
|
||||
|
||||
class Matomo {
|
||||
|
||||
static init() {
|
||||
@@ -4825,6 +4850,8 @@ class AudioChain {
|
||||
this.startTime = null;
|
||||
this.pauseTime = null;
|
||||
this.source = null;
|
||||
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
setBuffer(buffer) {
|
||||
@@ -4842,8 +4869,7 @@ class AudioChain {
|
||||
}
|
||||
}
|
||||
|
||||
async start(delay, offset, duration)
|
||||
{
|
||||
async start(delay, offset, duration) {
|
||||
let source = this.context.createBufferSource();
|
||||
|
||||
source.loop = this.shouldLoop;
|
||||
@@ -4859,48 +4885,24 @@ class AudioChain {
|
||||
source.start(delay, offset, duration);
|
||||
this.startTime = (new Date()).getTime();
|
||||
this.source = source;
|
||||
this.running = true;
|
||||
}
|
||||
|
||||
async stop(delay){
|
||||
if (Helper.isNotNull(this.source)){
|
||||
this.pauseTime = ((new Date()).getTime())-this.startTime;
|
||||
async stop(delay) {
|
||||
if (Helper.isNotNull(this.source)) {
|
||||
this.pauseTime = ((new Date()).getTime()) - this.startTime;
|
||||
return this.source.stop(delay);
|
||||
}
|
||||
this.running = false;
|
||||
return null;
|
||||
}
|
||||
|
||||
async resume(){
|
||||
console.log("resume-Time:", Helper.nonNull(this.pauseTime, 0)/1000.0);
|
||||
return this.start(null, Helper.nonNull(this.pauseTime, 0)/1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
class InitPromise$1
|
||||
{
|
||||
static addPromise(promise)
|
||||
{
|
||||
if (typeof promise === 'function')
|
||||
{
|
||||
let func = promise;
|
||||
promise = InitPromise$1.mainPromise.then(function(app){
|
||||
return (func(app));
|
||||
});
|
||||
async resume() {
|
||||
if (!this.running) {
|
||||
return this.start(null, Helper.nonNull(this.pauseTime, 0) / 1000.0);
|
||||
}
|
||||
InitPromise$1.promises.push(promise);
|
||||
}
|
||||
|
||||
static resolve(app)
|
||||
{
|
||||
InitPromise$1.mainResolver(app);
|
||||
return InitPromise$1.mainPromise.then(function(){
|
||||
return Promise.all(InitPromise$1.promises);
|
||||
});
|
||||
}
|
||||
}
|
||||
InitPromise$1.promises = [];
|
||||
InitPromise$1.mainPromise = new Promise(function(resolver){
|
||||
InitPromise$1.mainResolver = resolver;
|
||||
});
|
||||
|
||||
class SoundManager {
|
||||
static getInstance() {
|
||||
@@ -4938,7 +4940,7 @@ class SoundManager {
|
||||
audioObject.timeOffset = Helper.nonNull(options.timeOffset, audioObject.timeOffset, 0);
|
||||
this.channels[channel] = audioObject;
|
||||
|
||||
if (audioObject.muted){
|
||||
if (audioObject.muted) {
|
||||
this.stop(channel);
|
||||
}
|
||||
|
||||
@@ -4972,7 +4974,7 @@ class SoundManager {
|
||||
source.setBuffer(buffer);
|
||||
|
||||
//to prevent gap in mp3-files
|
||||
source.setLooping(this.channels[channel].loop, 0.3, buffer.duration-0.3);
|
||||
source.setLooping(this.channels[channel].loop, 0.3, buffer.duration - 0.3);
|
||||
|
||||
source.start();
|
||||
|
||||
@@ -4989,21 +4991,31 @@ class SoundManager {
|
||||
oldAudio.source.stop();
|
||||
}
|
||||
}
|
||||
|
||||
get(channel) {
|
||||
channel = Helper.nonNull(channel, SoundManager.CHANNELS.DEFAULT);
|
||||
return this.channels[channel];
|
||||
}
|
||||
|
||||
async resume(channel){
|
||||
channel = Helper.nonNull(channel, SoundManager.CHANNELS.DEFAULT);
|
||||
if (!this.channels[channel].muted && Helper.isNotNull(this.channels[channel].source)) {
|
||||
return this.channels[channel].source.resume();
|
||||
}
|
||||
}
|
||||
|
||||
handleVisibilityChange() {
|
||||
if (document.hidden){
|
||||
for (let k in this.channels){
|
||||
this.channels[k].source.stop();
|
||||
if (document.hidden) {
|
||||
for (let k in this.channels) {
|
||||
if (Helper.isNotNull(this.channels[k].source)) {
|
||||
this.channels[k].source.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
for (let k in this.channels){
|
||||
if (!this.channels[k].muted){
|
||||
this.channels[k].source.resume();
|
||||
else {
|
||||
for (let k in this.channels) {
|
||||
if (!this.channels[k].muted && Helper.isNotNull(this.channels[k].source)) {
|
||||
this.channels[k].source.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6053,6 +6065,8 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
volume: 0.7
|
||||
}, SoundManager.CHANNELS.SOUND);
|
||||
|
||||
soundManager.resume(SoundManager.CHANNELS.MUSIC);
|
||||
|
||||
return super.onConstruct(args);
|
||||
}
|
||||
|
||||
@@ -6851,6 +6865,7 @@ InitPromise.resolve(app).then(async function(){
|
||||
app.start(MenuSite);
|
||||
Translator.setLanguage("de");
|
||||
|
||||
// let matomo = new Matomo();
|
||||
// console.log(await matomo._askIsTracking());
|
||||
InstallManager.setCanInstallListener(e => {
|
||||
console.log("can install!", e);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,17 +3,18 @@
|
||||
"short_name":"WordRotator",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/img/android-chrome-192x192.png",
|
||||
"src": "../img/icons/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/img/android-chrome-512x512.png",
|
||||
"src": "../img/icons/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"background_color": "#ff0000",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone",
|
||||
"start_url":"/"
|
||||
}
|
||||
Reference in New Issue
Block a user