Settings angepasst

This commit is contained in:
silas 2018-10-01 13:55:14 +02:00
parent 8dbc0dc3f2
commit 9310230a0d
12 changed files with 74 additions and 23 deletions

View File

@ -45,7 +45,7 @@
<option name="arguments" value="--html5 --collapse-whitespace --remove-attribute-quotes --remove-empty-attributes --remove-comments --remove-optional-tags --remove-redundant-attributes $FilePath$ -o $ContentRoot$/public/html/$FileDirRelativeToSourcepath$/$FileName$" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="NEVER" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="html" />
<option name="immediateSync" value="true" />
<option name="name" value="htmlminify" />

View File

@ -8,7 +8,7 @@ return [
'user' => 'root',
'password' => '123456',
'host' => '127.0.0.1',
'dbname' => 'silas_wordRotatorTest',
'dbname' => 'silas_beta_wordRotator',
'driverOptions' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
),

View File

@ -1,4 +1,4 @@
USE silas_wordRotatorTest;
USE silas_beta_wordRotator;
DROP TABLE IF EXISTS Cronjob;
DROP TABLE IF EXISTS ChangeEmailCode;

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<div class="max-height fill-me"><div class="row max-width grow flex-center"><div class="columns small-centered small-12 smedium-11 medium-9 large-7"><div class="row clickable" id=theme-chooser><span class="columns small-6" data-translation=theme></span> <span class="columns small-6 text-right"><div id=theme-name></div></span></div><label class="switch row max-width"><span class="columns small-6" data-translation=sound></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=play-sound name=play-sound value=1 data-default=1> <span class=slider></span></span></label> <label class="switch row max-width"><span class="columns small-6" data-translation=music></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=play-music name=play-music value=1 data-default=1> <span class=slider></span></span></label><div class="row clickable" id=credits-button><span class="columns small-6" data-translation=credits></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row clickable" id=privacy-policy-button><span class="columns small-6" data-translation=privacy-policy></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row clickable" id=impressum-button><span class="columns small-6" data-translation=impressum></span> <span class="columns small-6 text-right" data-translation=">"></span></div><label class="switch row max-width"><span class="columns small-6" data-translation=track></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=track-switch name=matomoShouldTrack value=1 data-default=1 data-raw=1> <span class=slider></span></span></label> <button id=reset-levels class=button data-translation=reset-levels></button></div></div></div>
<div class="max-height fill-me"><div class="row max-width grow flex-center"><div class="columns small-centered small-12 smedium-11 medium-9 large-7"><div class="row setting-row" id=theme-chooser><span class="columns small-6" data-translation=theme></span> <span class="columns small-6 text-right"><div id=theme-name></div></span></div><label class="switch row setting-row"><span class="columns small-6" data-translation=sound></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=play-sound name=play-sound value=1 data-default=1> <span class=slider></span></span></label> <label class="switch row setting-row"><span class="columns small-6" data-translation=music></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=play-music name=play-music value=1 data-default=1> <span class=slider></span></span></label><div class="row setting-row" id=credits-button><span class="columns small-6" data-translation=credits></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=privacy-policy-button><span class="columns small-6" data-translation=privacy-policy></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=impressum-button><span class="columns small-6" data-translation=impressum></span> <span class="columns small-6 text-right" data-translation=">"></span></div><label class="switch row setting-row"><span class="columns small-6" data-translation=track></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=track-switch name=matomoShouldTrack value=1 data-default=1 data-raw=1> <span class=slider></span></span></label> <button id=reset-levels class="button hidden" data-translation=reset-levels></button></div></div></div>

View File

@ -1 +1 @@
<div class="max-height fill-me overflow-y-scroll"><ul class="menu vertical plain dropdown hidden" id=settings-fragment-list></ul><h2 data-translation=settings></h2><div id=settings-fragments></div></div>
<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>

View File

@ -6586,6 +6586,10 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
WordRotatorDb.getInstance().removeAll(WordRotatorDb.OBJECT_STORE.LEVEL);
});
if (location.hostname.includes("beta") || location.hostname.includes("127.0.0.1")){
this.findBy("#reset-levels").classList.remove("hidden");
}
let playMusicButton = this.findBy("#play-music");
playMusicButton.addEventListener("change", () => {
let soundManager = SoundManager.getInstance();

View File

@ -1,13 +1,13 @@
<div class='max-height fill-me'>
<div class='row max-width grow flex-center'>
<div class='columns small-centered small-12 smedium-11 medium-9 large-7'>
<div class='row clickable' id="theme-chooser">
<div class='row setting-row' id="theme-chooser">
<span class='columns small-6' data-translation="theme"></span>
<span class='columns small-6 text-right'>
<div id='theme-name'></div>
</span>
</div>
<label class="switch row max-width">
<label class="switch row setting-row">
<span class='columns small-6' data-translation="sound"></span>
<span class='columns small-6 text-right'>
<input type="checkbox" class="setting" id="play-sound" name='play-sound' value="1"
@ -15,7 +15,7 @@
<span class="slider"></span>
</span>
</label>
<label class="switch row max-width">
<label class="switch row setting-row">
<span class='columns small-6' data-translation="music"></span>
<span class='columns small-6 text-right'>
<input type="checkbox" class="setting" id="play-music" name='play-music' value="1"
@ -23,19 +23,19 @@
<span class="slider"></span>
</span>
</label>
<div class='row clickable' id='credits-button'>
<div class='row setting-row' id='credits-button'>
<span class='columns small-6' data-translation="credits"></span>
<span class='columns small-6 text-right' data-translation=">"></span>
</div>
<div class='row clickable' id='privacy-policy-button'>
<div class='row setting-row' id='privacy-policy-button'>
<span class='columns small-6' data-translation="privacy-policy"></span>
<span class='columns small-6 text-right' data-translation=">"></span>
</div>
<div class='row clickable' id='impressum-button'>
<div class='row setting-row' id='impressum-button'>
<span class='columns small-6' data-translation="impressum"></span>
<span class='columns small-6 text-right' data-translation=">"></span>
</div>
<label class="switch row max-width">
<label class="switch row setting-row">
<span class='columns small-6' data-translation="track"></span>
<span class='columns small-6 text-right'>
<input type="checkbox" class="setting" id="track-switch" name='matomoShouldTrack' value="1"
@ -50,7 +50,7 @@
<!--&gt;</iframe>-->
<button id='reset-levels' class="button" data-translation="reset-levels"></button>
<button id='reset-levels' class="button hidden" data-translation="reset-levels"></button>
<!--<label class='row'>-->

View File

@ -1,5 +1,9 @@
<div class="max-height fill-me overflow-y-scroll">
<ul class="menu vertical plain dropdown hidden" id="settings-fragment-list"></ul>
<h2 data-translation="settings"></h2>
<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>

View File

@ -56,6 +56,10 @@ export class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
WordRotatorDb.getInstance().removeAll(WordRotatorDb.OBJECT_STORE.LEVEL);
});
if (location.hostname.includes("beta") || location.hostname.includes("127.0.0.1")){
this.findBy("#reset-levels").classList.remove("hidden");
}
let playMusicButton = this.findBy("#play-music");
playMusicButton.addEventListener("change", () => {
let soundManager = SoundManager.getInstance();

View File

@ -89,4 +89,15 @@ body {
}
}
}
label{
font-size: 1em;
}
.setting-row{
line-height: 1;
padding-top: 0.5em;
padding-bottom: 0.5em;
width: 100%;
cursor: pointer;
}
}

View File

@ -242,8 +242,8 @@ test('Play', async t => {
levelNumber++;
//5. Level
await t.expect(Selector('#level-number').textContent).eql(""+levelNumber)
//5. Level
await t.expect(Selector('#level-number').textContent).eql("" + levelNumber)
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("BEANTOBEALBALEUM")
.expect(Selector('.segment-parent').nth(SEGMENT.SIX).textContent).eql("NUTUNGNGRGHAIEUS")
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
@ -277,8 +277,8 @@ test('Play', async t => {
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel * levelNumber + extraCoins - helpCost));
levelNumber++;
//Level 6
await t.expect(Selector('#level-number').textContent).eql(""+levelNumber)
//Level 6
await t.expect(Selector('#level-number').textContent).eql("" + levelNumber)
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("FEGEHLISARBEBERE")
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
.expect(Selector('.segment-parent').nth(SEGMENT.TEN).getStyleProperty('transform')).eql("matrix(-1, 0, 0, -1, 0, 0)")
@ -329,8 +329,8 @@ test('Play', async t => {
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel * levelNumber + extraCoins - helpCost));
levelNumber++;
//Level 7
await t.expect(Selector('.segment-parent').nth(SEGMENT.SIX).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
//Level 7
await t.expect(Selector('.segment-parent').nth(SEGMENT.SIX).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
.expect(Selector('.segment-row > .child-container').childElementCount).eql(3)
.drag(Selector('.segment-parent').nth(SEGMENT.ONE), 4, dragDimen, {
@ -377,8 +377,7 @@ test('LoadLastLevel', async t => {
}).before(async t => {
await testLocalStorageSet("currentLevel", "{\"id\":15,\"rotations\":[0,0,270],\"locks\":[false,true,true]}");
});
test.only('LevelRotation', async t => {
test('LevelRotation', async t => {
await t
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
@ -411,4 +410,33 @@ test.only('LevelRotation', async t => {
}).before(async t => {
await replaceRandom([0.9, 0.5]);
});
test.only('SendUserstats', async t => {
let matomoCheck = ClientFunction(() => {
return fetch("//matomo.silas.link/index.php?module=API&method=AjaxOptOut.isTracked", {
"mode": "cors",
"credentials": "include",
}).then(res => res.text()).then(text => (new window.DOMParser()).parseFromString(text, "text/xml")).then((xml => {
let textContent = xml.firstChild.textContent;
console.log(textContent);
return (textContent === "1")
}));
});
await t
.click(Selector(".action [data-translation-title='settings']"))
.expect(Selector("#play-sound").checked).ok()
.expect(Selector("#play-music").checked).ok()
.expect(Selector("#track-switch").checked).ok()
.expect(await matomoCheck()).ok()
.click(Selector(".switch [data-translation='track']"))
.expect(Selector("#track-switch").checked).eql(false);
let res = await matomoCheck();
await t.expect(res).eql(false)
.click(Selector(".switch [data-translation='track']"))
.expect(Selector("#track-switch").checked).ok();
res = await matomoCheck();
await t.expect(res).ok()
}).before(async t => {
await testLocalStorageSet("matomoShouldTrack", "1");
});