Tracking update
This commit is contained in:
parent
d37fc8254e
commit
c0a977afd7
1
.idea/wordRotator.iml
generated
1
.idea/wordRotator.iml
generated
@ -3,7 +3,6 @@
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/module/Application/src" isTestSource="false" packagePrefix="Application\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/module/Application/pwa/html" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/public/js" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/event-manager" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/persistence" />
|
||||
|
||||
@ -1 +1 @@
|
||||
<div class="max-height fill-me overflow-y-scroll"><ul class="menu vertical plain dropdown hidden" id=settings-fragment-list></ul><div class=row><div class="columns small-centered small-12 smedium-11 medium-9 large-7"><h2 data-translation=settings></h2></div></div><div id=settings-fragments></div></div>
|
||||
<div class="max-height fill-me overflow-y-auto"><ul class="menu vertical plain dropdown hidden" id=settings-fragment-list></ul><div class=row><div class="columns small-centered small-12 smedium-11 medium-9 large-7"><h2 data-translation=settings></h2></div></div><div id=settings-fragments></div></div>
|
||||
158
public/js/app.js
158
public/js/app.js
@ -3168,6 +3168,11 @@ function applyPolyfills() {
|
||||
elem.addEventListener("transitionend", transEndLis);
|
||||
elem.addEventListener("transitioncancel", transCancelledLis);
|
||||
});
|
||||
//Fallback
|
||||
setTimeout(() => {
|
||||
resolve(false);
|
||||
}, (time+delay)*1000);
|
||||
|
||||
//Nach Seitenneuzeichnen, damit chrome das immer macht (und FF auch)
|
||||
requestAnimationFrame(function () {
|
||||
requestAnimationFrame(function () {
|
||||
@ -3190,7 +3195,6 @@ function applyPolyfills() {
|
||||
elem.removeEventListener("transitioncancel", transCancelledLis);
|
||||
elem.style.opacity = null;
|
||||
elem.style.transition = null;
|
||||
console.log("transEnd");
|
||||
resolve(true, e);
|
||||
};
|
||||
|
||||
@ -3199,13 +3203,11 @@ function applyPolyfills() {
|
||||
elem.removeEventListener("transitioncancel", transCancelledLis);
|
||||
elem.style.opacity = null;
|
||||
elem.style.transition = null;
|
||||
console.log("transCancelled");
|
||||
resolve(false, e);
|
||||
};
|
||||
elem.addEventListener("transitionend", transEndLis);
|
||||
elem.addEventListener("transitioncancel", transCancelledLis);
|
||||
|
||||
console.log(getComputedStyle(elem).getPropertyValue("opacity"));
|
||||
if (getComputedStyle(elem).getPropertyValue("opacity") === "1"){
|
||||
resolve(false);
|
||||
}
|
||||
@ -4605,7 +4607,7 @@ class Matomo {
|
||||
|
||||
static init() {
|
||||
Matomo.isTrackingPromise = new Promise(async (resolve) => {
|
||||
let shouldTrack = localStorage.getItem(Matomo.LOCAL_STORAGE_KEY);
|
||||
let shouldTrack = Helper.nonNull(localStorage.getItem(Matomo.LOCAL_STORAGE_KEY), "1");
|
||||
if (Helper.isNull(shouldTrack)) {
|
||||
shouldTrack = await Matomo._askIsTracking();
|
||||
localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, shouldTrack);
|
||||
@ -4617,10 +4619,10 @@ class Matomo {
|
||||
resolve(shouldTrack);
|
||||
});
|
||||
Matomo.isTrackingPromise.then(() => {
|
||||
Matomo.push(['trackPageView']);
|
||||
Matomo.push(['enableLinkTracking']);
|
||||
Matomo.push(['setTrackerUrl', Matomo.TRACK_SITE + '/piwik.php']);
|
||||
Matomo.push(['setSiteId', Matomo.SIDE_ID]);
|
||||
Matomo.push(['trackPageView'], true);
|
||||
Matomo.push(['enableLinkTracking'], true);
|
||||
Matomo.push(['setTrackerUrl', Matomo.TRACK_SITE + '/piwik.php'], true);
|
||||
Matomo.push(['setSiteId', Matomo.SIDE_ID + ""], true);
|
||||
|
||||
let d = document, g = d.createElement('script'), s = d.getElementsByTagName('head')[0];
|
||||
g.type = 'text/javascript';
|
||||
@ -4629,19 +4631,52 @@ class Matomo {
|
||||
g.src = Matomo.TRACK_SITE + '/piwik.js';
|
||||
s.appendChild(g);
|
||||
});
|
||||
// window.addEventListener('hashchange', () => {
|
||||
// Matomo.update()
|
||||
// });
|
||||
}
|
||||
|
||||
static update(title) {
|
||||
if (Helper.nonNull(Matomo.currentUrl)){
|
||||
Matomo.push(['setReferrerUrl', Matomo.currentUrl]);
|
||||
}
|
||||
Matomo.currentUrl = window.location.pathname+window.location.search;
|
||||
Matomo.push(['setCustomUrl', Matomo.currentUrl]);
|
||||
Matomo.push(['setDocumentTitle', title]);
|
||||
|
||||
// remove all previously assigned custom variables, requires Matomo (formerly Piwik) 3.0.2
|
||||
Matomo.push(['deleteCustomVariables', 'page']);
|
||||
Matomo.push(['setGenerationTimeMs', 0]);
|
||||
Matomo.push(['trackPageView']);
|
||||
|
||||
// make Matomo aware of newly added content
|
||||
var content = document.getElementById('site-content');
|
||||
Matomo.push(['MediaAnalytics::scanForMedia', content]);
|
||||
Matomo.push(['FormAnalytics::scanForForms', content]);
|
||||
Matomo.push(['trackContentImpressionsWithinNode', content]);
|
||||
Matomo.push(['enableLinkTracking']);
|
||||
}
|
||||
|
||||
static async _askIsTracking() {
|
||||
Matomo.isTrackingPromise = Matomo.query("isTracked")
|
||||
.then(xml => {
|
||||
let textContent = xml.firstChild.textContent;
|
||||
// localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, textContent);
|
||||
return (textContent === "1")
|
||||
});
|
||||
Matomo.isTrackingPromise = new Promise(resolve => {
|
||||
Matomo.push([function () {
|
||||
resolve(!this["isUserOptedOut"]());
|
||||
}]);
|
||||
Matomo.push([function () {
|
||||
resolve(!this["isUserOptedOut"]());
|
||||
}]);
|
||||
});
|
||||
// Matomo.isTrackingPromise = Matomo.query("isTracked")
|
||||
// .then(xml => {
|
||||
// let textContent = xml.firstChild.textContent;
|
||||
// // localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, textContent);
|
||||
// return (textContent === "1")
|
||||
// });
|
||||
return Matomo.isTrackingPromise;
|
||||
}
|
||||
|
||||
static async query(method) {
|
||||
static
|
||||
async query(method) {
|
||||
return fetch(Matomo.TRACK_SITE + Matomo.BASE_PATH + method, {
|
||||
"mode": "cors",
|
||||
"credentials": "include",
|
||||
@ -4652,19 +4687,34 @@ class Matomo {
|
||||
return Matomo.isTrackingPromise;
|
||||
}
|
||||
|
||||
static async setTrack(shouldTrack) {
|
||||
static
|
||||
async setTrack(shouldTrack) {
|
||||
Matomo.isTrackingPromise = Promise.resolve(shouldTrack);
|
||||
localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, (shouldTrack === true) ? "1" : "0");
|
||||
return await Matomo.query((shouldTrack) ? "doTrack" : "doIgnore");
|
||||
}
|
||||
|
||||
static async push(arr) {
|
||||
if (await Matomo.getTrackingPromise()) {
|
||||
window["_paq"].push(arr);
|
||||
// return await Matomo.query((shouldTrack) ? "doTrack" : "doIgnore");
|
||||
if (shouldTrack) {
|
||||
Matomo.push(["forgetUserOptOut"], true);
|
||||
}
|
||||
else {
|
||||
Matomo.push(["optUserOut"], true);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
async push(arr, force) {
|
||||
// force = Helper.nonNull(force, false);
|
||||
|
||||
if (!Array.isArray(arr)) {
|
||||
arr = [arr];
|
||||
}
|
||||
// if (force || await Matomo.getTrackingPromise()) {
|
||||
window["_paq"].push(arr);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Matomo.currentUrl = null;
|
||||
|
||||
Matomo.LOCAL_STORAGE_KEY = "matomoShouldTrack";
|
||||
Matomo.TRACK_SITE = "//matomo.silas.link";
|
||||
Matomo.BASE_PATH = "/index.php?module=API&method=AjaxOptOut.";
|
||||
@ -4672,7 +4722,6 @@ Matomo.SIDE_ID = "1";
|
||||
|
||||
InitPromise.addPromise(() => {
|
||||
window["_paq"] = window["_paq"] || [];
|
||||
|
||||
Matomo.init();
|
||||
});
|
||||
|
||||
@ -5851,6 +5900,11 @@ class EndSite extends WordRotatorBaseSite{
|
||||
constructor(siteManager) {
|
||||
super(siteManager, "html/application/end.html");
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("End Site");
|
||||
return super.onStart(args);
|
||||
}
|
||||
}
|
||||
|
||||
class LevelSite extends WordRotatorBaseSite {
|
||||
@ -5979,7 +6033,9 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.levelScaler = await scaleHelper.scaleToFull(levelSegment, levelSegment.parentElement, false, false, 1, level.words[0].length * 1.5, null, 0);
|
||||
|
||||
this.level = level;
|
||||
return this.tutorial();
|
||||
let res = this.tutorial();
|
||||
Matomo.push(["trackEvent", "LevelSite", "LoadLastLevel"]);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
@ -6027,6 +6083,10 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.wonParams.aborted = true;
|
||||
clearTimeout(this.wonParams.coinCounterTimer);
|
||||
|
||||
//LevelCounter * 2 - 1, damit der durchschnittswert stimmt
|
||||
Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Average", this.levelCounter*2-1]);
|
||||
Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Normal", this.levelCounter]);
|
||||
|
||||
return this.tutorial();
|
||||
}
|
||||
catch (e) {
|
||||
@ -6035,6 +6095,7 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("Level Site");
|
||||
let res = super.onStart(args);
|
||||
|
||||
if (this.levelCounterAction) {
|
||||
@ -6124,6 +6185,8 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.continueButtonScaler();
|
||||
this.levelScaler();
|
||||
|
||||
Matomo.push(["trackEvent", "LevelSite", "LevelWon", "Coins", parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"))]);
|
||||
|
||||
await savePromise;
|
||||
}
|
||||
catch (e) {
|
||||
@ -6154,14 +6217,16 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
}
|
||||
segmentToHelp.setIsRotatable(false);
|
||||
this.level.saveAsCurrentLevel();
|
||||
|
||||
Matomo.push(["trackEvent", "LevelSite", "Help", "Coins", parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"))]);
|
||||
}
|
||||
else {
|
||||
FlashMessenger.addMessage("not-enough-coins");
|
||||
Matomo.push(["trackEvent", "LevelSite", "Help", "Not enough Coins", parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"))]);
|
||||
}
|
||||
}
|
||||
|
||||
async tutorial() {
|
||||
|
||||
if (this.level.id === LevelSite.TUTORIAL.FIRST_LEVEL) {
|
||||
let currentStep = Helper.nonNull(localStorage.getItem("tutorial-step"), "1");
|
||||
|
||||
@ -6303,6 +6368,7 @@ class MenuSite extends WordRotatorBaseSite {
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("Menu Site");
|
||||
let res = super.onStart(args);
|
||||
|
||||
let level = new MainMenuLevel(this.templateContainer);
|
||||
@ -6310,6 +6376,7 @@ class MenuSite extends WordRotatorBaseSite {
|
||||
level.createSegments();
|
||||
|
||||
level.getWonPromise().then(() => {
|
||||
Matomo.push(["trackEvent", "MainMenu", "levelSolved"]);
|
||||
this.startSite(LevelSite);
|
||||
});
|
||||
|
||||
@ -6378,6 +6445,7 @@ class MenuSite extends WordRotatorBaseSite {
|
||||
|
||||
let playButton = this.findBy("#play-button");
|
||||
playButton.addEventListener("click", () => {
|
||||
Matomo.push(["trackEvent", "MainMenu", "startButton"]);
|
||||
this.startSite(LevelSite, this.loadLevelPromise);
|
||||
});
|
||||
|
||||
@ -6417,6 +6485,7 @@ class MenuSite extends WordRotatorBaseSite {
|
||||
if (playMusicButton.checked){
|
||||
soundManager.play(SoundManager.CHANNELS.MUSIC);
|
||||
}
|
||||
Matomo.push(["trackEvent", "MainMenu", "PlayMusic", "Play Music", (playMusicButton.checked)?1:0]);
|
||||
});
|
||||
|
||||
let playSoundButton = this.findBy("#play-sound");
|
||||
@ -6424,6 +6493,7 @@ class MenuSite extends WordRotatorBaseSite {
|
||||
playSoundButton.addEventListener("change", () => {
|
||||
settingsManager.setSetting("play-sound", playSoundButton.checked);
|
||||
soundManager.set({muted: !playSoundButton.checked}, SoundManager.CHANNELS.SOUND);
|
||||
Matomo.push(["trackEvent", "MainMenu", "PlaySound", "Play Sound", (playSoundButton.checked)?1:0]);
|
||||
});
|
||||
}
|
||||
|
||||
@ -6482,6 +6552,11 @@ class PrivacyPolicySite extends WordRotatorBaseSite {
|
||||
constructor(siteManager) {
|
||||
super(siteManager, "html/application/privacyPolicy.html", "privacyPolicy");
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("Privacy Policy Site");
|
||||
return super.onStart(args);
|
||||
}
|
||||
}
|
||||
|
||||
InitPromise.addPromise(app => {
|
||||
@ -6492,6 +6567,11 @@ class CreditsSite extends WordRotatorBaseSite{
|
||||
constructor(siteManager) {
|
||||
super(siteManager, "html/application/credits.html", "credits");
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("Credits Site");
|
||||
return super.onStart(args);
|
||||
}
|
||||
}
|
||||
|
||||
InitPromise.addPromise(app => {
|
||||
@ -6535,27 +6615,6 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
}
|
||||
|
||||
onFirstStart() {
|
||||
// let themeTemplate = this.findBy("#theme-radio-template");
|
||||
// delete themeTemplate["id"];
|
||||
// let themeTemplateContainer = themeTemplate.parentNode;
|
||||
// themeTemplateContainer.removeAllChildren();
|
||||
//
|
||||
// for (let i = 0; i < ThemeManager.themes.length; i++) {
|
||||
// let themeElem = Helper.cloneNode(themeTemplate);
|
||||
// let theme = ThemeManager.themes[i];
|
||||
// themeElem.appendChild(Translator.makePersistentTranslation(theme._name));
|
||||
//
|
||||
// let inputElem = themeElem.querySelector("input");
|
||||
// inputElem.value = theme._className;
|
||||
//
|
||||
// inputElem.addEventListener("change", function() {
|
||||
// if (this.checked){
|
||||
// ThemeManager.changeCurrentTheme(theme)
|
||||
// }
|
||||
// });
|
||||
// themeTemplateContainer.appendChild(themeElem);
|
||||
// }
|
||||
|
||||
let currentThemeName = ThemeManager.currentTheme._name;
|
||||
SettingsManager.getInstance().setSetting("theme", currentThemeName);
|
||||
|
||||
@ -6607,6 +6666,11 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
|
||||
return super.onFirstStart();
|
||||
}
|
||||
|
||||
onStart() {
|
||||
Matomo.update("Settings Site");
|
||||
super.onStart();
|
||||
}
|
||||
}
|
||||
|
||||
InitPromise.addPromise(function () {
|
||||
@ -6623,6 +6687,8 @@ SystemSettings.setBasePath(basePath);
|
||||
Translator.supportedLanguages = ["de"];
|
||||
Translator.markTranslations = false;
|
||||
|
||||
Matomo.SIDE_ID = "2";
|
||||
|
||||
applyPolyfills();
|
||||
|
||||
ThemeManager.addTheme(new Theme('red', ''));
|
||||
|
||||
@ -12,7 +12,7 @@ class Matomo {
|
||||
|
||||
static init() {
|
||||
Matomo.isTrackingPromise = new Promise(async (resolve) => {
|
||||
let shouldTrack = localStorage.getItem(Matomo.LOCAL_STORAGE_KEY);
|
||||
let shouldTrack = Helper.nonNull(localStorage.getItem(Matomo.LOCAL_STORAGE_KEY), "1");
|
||||
if (Helper.isNull(shouldTrack)) {
|
||||
shouldTrack = await Matomo._askIsTracking();
|
||||
localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, shouldTrack);
|
||||
@ -24,10 +24,10 @@ class Matomo {
|
||||
resolve(shouldTrack);
|
||||
});
|
||||
Matomo.isTrackingPromise.then(() => {
|
||||
Matomo.push(['trackPageView']);
|
||||
Matomo.push(['enableLinkTracking']);
|
||||
Matomo.push(['setTrackerUrl', Matomo.TRACK_SITE + '/piwik.php']);
|
||||
Matomo.push(['setSiteId', Matomo.SIDE_ID]);
|
||||
Matomo.push(['trackPageView'], true);
|
||||
Matomo.push(['enableLinkTracking'], true);
|
||||
Matomo.push(['setTrackerUrl', Matomo.TRACK_SITE + '/piwik.php'], true);
|
||||
Matomo.push(['setSiteId', Matomo.SIDE_ID + ""], true);
|
||||
|
||||
let d = document, g = d.createElement('script'), s = d.getElementsByTagName('head')[0];
|
||||
g.type = 'text/javascript';
|
||||
@ -36,19 +36,52 @@ class Matomo {
|
||||
g.src = Matomo.TRACK_SITE + '/piwik.js';
|
||||
s.appendChild(g);
|
||||
});
|
||||
// window.addEventListener('hashchange', () => {
|
||||
// Matomo.update()
|
||||
// });
|
||||
}
|
||||
|
||||
static update(title) {
|
||||
if (Helper.nonNull(Matomo.currentUrl)){
|
||||
Matomo.push(['setReferrerUrl', Matomo.currentUrl]);
|
||||
}
|
||||
Matomo.currentUrl = window.location.pathname+window.location.search;
|
||||
Matomo.push(['setCustomUrl', Matomo.currentUrl]);
|
||||
Matomo.push(['setDocumentTitle', title]);
|
||||
|
||||
// remove all previously assigned custom variables, requires Matomo (formerly Piwik) 3.0.2
|
||||
Matomo.push(['deleteCustomVariables', 'page']);
|
||||
Matomo.push(['setGenerationTimeMs', 0]);
|
||||
Matomo.push(['trackPageView']);
|
||||
|
||||
// make Matomo aware of newly added content
|
||||
var content = document.getElementById('site-content');
|
||||
Matomo.push(['MediaAnalytics::scanForMedia', content]);
|
||||
Matomo.push(['FormAnalytics::scanForForms', content]);
|
||||
Matomo.push(['trackContentImpressionsWithinNode', content]);
|
||||
Matomo.push(['enableLinkTracking']);
|
||||
}
|
||||
|
||||
static async _askIsTracking() {
|
||||
Matomo.isTrackingPromise = Matomo.query("isTracked")
|
||||
.then(xml => {
|
||||
let textContent = xml.firstChild.textContent;
|
||||
// localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, textContent);
|
||||
return (textContent === "1")
|
||||
});
|
||||
Matomo.isTrackingPromise = new Promise(resolve => {
|
||||
Matomo.push([function () {
|
||||
resolve(!this["isUserOptedOut"]());
|
||||
}]);
|
||||
Matomo.push([function () {
|
||||
resolve(!this["isUserOptedOut"]());
|
||||
}]);
|
||||
});
|
||||
// Matomo.isTrackingPromise = Matomo.query("isTracked")
|
||||
// .then(xml => {
|
||||
// let textContent = xml.firstChild.textContent;
|
||||
// // localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, textContent);
|
||||
// return (textContent === "1")
|
||||
// });
|
||||
return Matomo.isTrackingPromise;
|
||||
}
|
||||
|
||||
static async query(method) {
|
||||
static
|
||||
async query(method) {
|
||||
return fetch(Matomo.TRACK_SITE + Matomo.BASE_PATH + method, {
|
||||
"mode": "cors",
|
||||
"credentials": "include",
|
||||
@ -59,19 +92,34 @@ class Matomo {
|
||||
return Matomo.isTrackingPromise;
|
||||
}
|
||||
|
||||
static async setTrack(shouldTrack) {
|
||||
static
|
||||
async setTrack(shouldTrack) {
|
||||
Matomo.isTrackingPromise = Promise.resolve(shouldTrack);
|
||||
localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, (shouldTrack === true) ? "1" : "0");
|
||||
return await Matomo.query((shouldTrack) ? "doTrack" : "doIgnore");
|
||||
}
|
||||
|
||||
static async push(arr) {
|
||||
if (await Matomo.getTrackingPromise()) {
|
||||
window["_paq"].push(arr);
|
||||
// return await Matomo.query((shouldTrack) ? "doTrack" : "doIgnore");
|
||||
if (shouldTrack) {
|
||||
Matomo.push(["forgetUserOptOut"], true);
|
||||
}
|
||||
else {
|
||||
Matomo.push(["optUserOut"], true);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
async push(arr, force) {
|
||||
// force = Helper.nonNull(force, false);
|
||||
|
||||
if (!Array.isArray(arr)) {
|
||||
arr = [arr];
|
||||
}
|
||||
// if (force || await Matomo.getTrackingPromise()) {
|
||||
window["_paq"].push(arr);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Matomo.currentUrl = null;
|
||||
|
||||
Matomo.LOCAL_STORAGE_KEY = "matomoShouldTrack";
|
||||
Matomo.TRACK_SITE = "//matomo.silas.link";
|
||||
Matomo.BASE_PATH = "/index.php?module=API&method=AjaxOptOut.";
|
||||
@ -79,7 +127,6 @@ Matomo.SIDE_ID = "1";
|
||||
|
||||
InitPromise.addPromise(() => {
|
||||
window["_paq"] = window["_paq"] || [];
|
||||
|
||||
Matomo.init();
|
||||
});
|
||||
|
||||
|
||||
@ -4156,6 +4156,11 @@ function applyPolyfills() {
|
||||
elem.addEventListener("transitionend", transEndLis);
|
||||
elem.addEventListener("transitioncancel", transCancelledLis);
|
||||
});
|
||||
//Fallback
|
||||
setTimeout(() => {
|
||||
resolve(false);
|
||||
}, (time+delay)*1000);
|
||||
|
||||
//Nach Seitenneuzeichnen, damit chrome das immer macht (und FF auch)
|
||||
requestAnimationFrame(function () {
|
||||
requestAnimationFrame(function () {
|
||||
@ -4178,7 +4183,6 @@ function applyPolyfills() {
|
||||
elem.removeEventListener("transitioncancel", transCancelledLis);
|
||||
elem.style.opacity = null;
|
||||
elem.style.transition = null;
|
||||
console.log("transEnd");
|
||||
resolve(true, e);
|
||||
};
|
||||
|
||||
@ -4187,13 +4191,11 @@ function applyPolyfills() {
|
||||
elem.removeEventListener("transitioncancel", transCancelledLis);
|
||||
elem.style.opacity = null;
|
||||
elem.style.transition = null;
|
||||
console.log("transCancelled");
|
||||
resolve(false, e);
|
||||
};
|
||||
elem.addEventListener("transitionend", transEndLis);
|
||||
elem.addEventListener("transitioncancel", transCancelledLis);
|
||||
|
||||
console.log(getComputedStyle(elem).getPropertyValue("opacity"));
|
||||
if (getComputedStyle(elem).getPropertyValue("opacity") === "1"){
|
||||
resolve(false);
|
||||
}
|
||||
|
||||
@ -12,4 +12,4 @@ SystemSettings.setBasePath(basePath);
|
||||
Translator.supportedLanguages = ["de"];
|
||||
Translator.markTranslations = false;
|
||||
|
||||
Matomo.SIDE_ID = 2;
|
||||
Matomo.SIDE_ID = "2";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div class="max-height fill-me overflow-y-scroll">
|
||||
<div class="max-height fill-me overflow-y-auto">
|
||||
<ul class="menu vertical plain dropdown hidden" id="settings-fragment-list"></ul>
|
||||
<div class="row">
|
||||
<div class='columns small-centered small-12 smedium-11 medium-9 large-7'>
|
||||
|
||||
@ -12,27 +12,6 @@ export class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
}
|
||||
|
||||
onFirstStart() {
|
||||
// let themeTemplate = this.findBy("#theme-radio-template");
|
||||
// delete themeTemplate["id"];
|
||||
// let themeTemplateContainer = themeTemplate.parentNode;
|
||||
// themeTemplateContainer.removeAllChildren();
|
||||
//
|
||||
// for (let i = 0; i < ThemeManager.themes.length; i++) {
|
||||
// let themeElem = Helper.cloneNode(themeTemplate);
|
||||
// let theme = ThemeManager.themes[i];
|
||||
// themeElem.appendChild(Translator.makePersistentTranslation(theme._name));
|
||||
//
|
||||
// let inputElem = themeElem.querySelector("input");
|
||||
// inputElem.value = theme._className;
|
||||
//
|
||||
// inputElem.addEventListener("change", function() {
|
||||
// if (this.checked){
|
||||
// ThemeManager.changeCurrentTheme(theme)
|
||||
// }
|
||||
// });
|
||||
// themeTemplateContainer.appendChild(themeElem);
|
||||
// }
|
||||
|
||||
let currentThemeName = ThemeManager.currentTheme._name;
|
||||
SettingsManager.getInstance().setSetting("theme", currentThemeName);
|
||||
|
||||
@ -84,6 +63,11 @@ export class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
|
||||
return super.onFirstStart();
|
||||
}
|
||||
|
||||
onStart() {
|
||||
Matomo.update("Settings Site");
|
||||
super.onStart();
|
||||
}
|
||||
}
|
||||
|
||||
InitPromise.addPromise(function () {
|
||||
|
||||
@ -1,11 +1,17 @@
|
||||
import {WordRotatorBaseSite} from "./WordRotatorBaseSite";
|
||||
import {InitPromise} from "../../../../../js/lib/pwa-lib";
|
||||
import {PrivacyPolicySite} from "./PrivacyPolicySite";
|
||||
import {Matomo} from "../../../../../js/lib/pwa-assets";
|
||||
|
||||
export class CreditsSite extends WordRotatorBaseSite{
|
||||
constructor(siteManager) {
|
||||
super(siteManager, "html/application/credits.html", "credits");
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("Credits Site");
|
||||
return super.onStart(args);
|
||||
}
|
||||
}
|
||||
|
||||
InitPromise.addPromise(app => {
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
import {WordRotatorBaseSite} from "./WordRotatorBaseSite";
|
||||
import {Matomo} from "../../../../../js/lib/pwa-assets";
|
||||
|
||||
export class EndSite extends WordRotatorBaseSite{
|
||||
constructor(siteManager) {
|
||||
super(siteManager, "html/application/end.html");
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("End Site");
|
||||
return super.onStart(args);
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@ import {FlashMessenger, Helper, Menu, MenuAction, SystemSettings} from "../../..
|
||||
import {TemplateContainer} from "../wordrotator/Segment/TemplateContainer";
|
||||
import {LevelHelper} from "../wordrotator/Level/LevelHelper";
|
||||
import {WordRotatorDb} from "../WordRotatorDb";
|
||||
import {ScaleHelper, SoundManager} from "../../../../../js/lib/pwa-assets";
|
||||
import {Matomo, ScaleHelper, SoundManager} from "../../../../../js/lib/pwa-assets";
|
||||
import {EndSite} from "./EndSite";
|
||||
import {WordRotatorBaseSite} from "./WordRotatorBaseSite";
|
||||
import {SettingsManager} from "../../../../../js/lib/pwa-core";
|
||||
@ -133,7 +133,9 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
this.levelScaler = await scaleHelper.scaleToFull(levelSegment, levelSegment.parentElement, false, false, 1, level.words[0].length * 1.5, null, 0);
|
||||
|
||||
this.level = level;
|
||||
return this.tutorial();
|
||||
let res = this.tutorial();
|
||||
Matomo.push(["trackEvent", "LevelSite", "LoadLastLevel"]);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
@ -181,6 +183,10 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
this.wonParams.aborted = true;
|
||||
clearTimeout(this.wonParams.coinCounterTimer);
|
||||
|
||||
//LevelCounter * 2 - 1, damit der durchschnittswert stimmt
|
||||
Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Average", this.levelCounter*2-1]);
|
||||
Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Normal", this.levelCounter]);
|
||||
|
||||
return this.tutorial();
|
||||
}
|
||||
catch (e) {
|
||||
@ -189,6 +195,7 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("Level Site");
|
||||
let res = super.onStart(args);
|
||||
|
||||
if (this.levelCounterAction) {
|
||||
@ -278,6 +285,8 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
this.continueButtonScaler();
|
||||
this.levelScaler();
|
||||
|
||||
Matomo.push(["trackEvent", "LevelSite", "LevelWon", "Coins", parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"))]);
|
||||
|
||||
await savePromise;
|
||||
}
|
||||
catch (e) {
|
||||
@ -308,14 +317,16 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
}
|
||||
segmentToHelp.setIsRotatable(false);
|
||||
this.level.saveAsCurrentLevel();
|
||||
|
||||
Matomo.push(["trackEvent", "LevelSite", "Help", "Coins", parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"))]);
|
||||
}
|
||||
else {
|
||||
FlashMessenger.addMessage("not-enough-coins");
|
||||
Matomo.push(["trackEvent", "LevelSite", "Help", "Not enough Coins", parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"))]);
|
||||
}
|
||||
}
|
||||
|
||||
async tutorial() {
|
||||
|
||||
if (this.level.id === LevelSite.TUTORIAL.FIRST_LEVEL) {
|
||||
let currentStep = Helper.nonNull(localStorage.getItem("tutorial-step"), "1");
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import {WordRotatorBaseSite} from "./WordRotatorBaseSite";
|
||||
import {LevelSite} from "./LevelSite";
|
||||
import {ScaleHelper, SoundManager} from "../../../../../js/lib/pwa-assets";
|
||||
import {Matomo, ScaleHelper, SoundManager} from "../../../../../js/lib/pwa-assets";
|
||||
import {TemplateContainer} from "../wordrotator/Segment/TemplateContainer";
|
||||
import {MainMenuLevel} from "../wordrotator/Level/MainMenuLevel";
|
||||
import {FlashMessenger, Helper, InitPromise} from "../../../../../js/lib/pwa-lib";
|
||||
@ -15,6 +15,7 @@ export class MenuSite extends WordRotatorBaseSite {
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("Menu Site");
|
||||
let res = super.onStart(args);
|
||||
|
||||
let level = new MainMenuLevel(this.templateContainer);
|
||||
@ -22,6 +23,7 @@ export class MenuSite extends WordRotatorBaseSite {
|
||||
level.createSegments();
|
||||
|
||||
level.getWonPromise().then(() => {
|
||||
Matomo.push(["trackEvent", "MainMenu", "levelSolved"]);
|
||||
this.startSite(LevelSite);
|
||||
});
|
||||
|
||||
@ -90,6 +92,7 @@ export class MenuSite extends WordRotatorBaseSite {
|
||||
|
||||
let playButton = this.findBy("#play-button");
|
||||
playButton.addEventListener("click", () => {
|
||||
Matomo.push(["trackEvent", "MainMenu", "startButton"]);
|
||||
this.startSite(LevelSite, this.loadLevelPromise);
|
||||
});
|
||||
|
||||
@ -129,6 +132,7 @@ export class MenuSite extends WordRotatorBaseSite {
|
||||
if (playMusicButton.checked){
|
||||
soundManager.play(SoundManager.CHANNELS.MUSIC);
|
||||
}
|
||||
Matomo.push(["trackEvent", "MainMenu", "PlayMusic", "Play Music", (playMusicButton.checked)?1:0]);
|
||||
});
|
||||
|
||||
let playSoundButton = this.findBy("#play-sound");
|
||||
@ -136,6 +140,7 @@ export class MenuSite extends WordRotatorBaseSite {
|
||||
playSoundButton.addEventListener("change", () => {
|
||||
settingsManager.setSetting("play-sound", playSoundButton.checked);
|
||||
soundManager.set({muted: !playSoundButton.checked}, SoundManager.CHANNELS.SOUND);
|
||||
Matomo.push(["trackEvent", "MainMenu", "PlaySound", "Play Sound", (playSoundButton.checked)?1:0]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,16 @@
|
||||
import {WordRotatorBaseSite} from "./WordRotatorBaseSite";
|
||||
import {InitPromise} from "../../../../../js/lib/pwa-lib";
|
||||
import {Matomo} from "../../../../../js/lib/pwa-assets";
|
||||
|
||||
export class PrivacyPolicySite extends WordRotatorBaseSite {
|
||||
constructor(siteManager) {
|
||||
super(siteManager, "html/application/privacyPolicy.html", "privacyPolicy");
|
||||
}
|
||||
|
||||
onStart(args) {
|
||||
Matomo.update("Privacy Policy Site");
|
||||
return super.onStart(args);
|
||||
}
|
||||
}
|
||||
|
||||
InitPromise.addPromise(app => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user