update für Laptop
This commit is contained in:
parent
2ff0655407
commit
8a8aab01bf
1
.idea/wordRotator.iml
generated
1
.idea/wordRotator.iml
generated
@ -3,7 +3,6 @@
|
|||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<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/src" isTestSource="false" packagePrefix="Application\" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/module/Application/pwa/public" isTestSource="false" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/public/js" />
|
<excludeFolder url="file://$MODULE_DIR$/public/js" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/publicTest" />
|
<excludeFolder url="file://$MODULE_DIR$/publicTest" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/event-manager" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/event-manager" />
|
||||||
|
|||||||
47
bin/build.js
47
bin/build.js
@ -1,6 +1,11 @@
|
|||||||
const shouldMangleAndTranspile = (process.argv.length >= 3 && process.argv[2] === "1");
|
const shouldIncludeSourcemap = (process.argv.length >= 3 && process.argv[2] === "2");
|
||||||
|
|
||||||
|
const shouldMangleAndTranspile = shouldIncludeSourcemap || (process.argv.length >= 3 && process.argv[2] === "1");
|
||||||
// const shouldMangleAndTranspile = (process.argv.wordLength >= 3 && process.argv[2] === "1"); || true;
|
// const shouldMangleAndTranspile = (process.argv.wordLength >= 3 && process.argv[2] === "1"); || true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const rollup = require('rollup');
|
const rollup = require('rollup');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
@ -13,7 +18,7 @@ if (shouldMangleAndTranspile) {
|
|||||||
babel = require('babel-core');
|
babel = require('babel-core');
|
||||||
regenerator = require('regenerator');
|
regenerator = require('regenerator');
|
||||||
}
|
}
|
||||||
const uglifyOptions = {
|
let uglifyOptions = {
|
||||||
ecma: "es6",
|
ecma: "es6",
|
||||||
mangle: {
|
mangle: {
|
||||||
// ecma:"es6",
|
// ecma:"es6",
|
||||||
@ -40,7 +45,18 @@ const uglifyOptions = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const babelOptions = {
|
let uglifyOptions2 = {
|
||||||
|
mangle: {toplevel: true}, compress: {
|
||||||
|
keep_fargs: false,
|
||||||
|
toplevel: true,
|
||||||
|
dead_code: true,
|
||||||
|
unused: true,
|
||||||
|
passes: 1,
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let babelOptions = {
|
||||||
compact: true,
|
compact: true,
|
||||||
minified: true,
|
minified: true,
|
||||||
presets: ['env'],
|
presets: ['env'],
|
||||||
@ -48,11 +64,18 @@ const babelOptions = {
|
|||||||
// plugins: ["regenerator-runtime"]
|
// plugins: ["regenerator-runtime"]
|
||||||
};
|
};
|
||||||
|
|
||||||
const regeneratorOptions = {
|
let regeneratorOptions = {
|
||||||
includeRuntime: true,
|
includeRuntime: true,
|
||||||
// sourceMaps:"inline",
|
// sourceMaps:"inline",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (shouldIncludeSourcemap){
|
||||||
|
// uglifyOptions["sourceMap"] = {url: "inline"};
|
||||||
|
uglifyOptions2["sourceMap"] = {url: "inline"};
|
||||||
|
// babelOptions["sourceMaps"] = "inline";
|
||||||
|
// regeneratorOptions["sourceMaps"] = "inline";
|
||||||
|
}
|
||||||
|
|
||||||
const options = require('../rollup.config');
|
const options = require('../rollup.config');
|
||||||
const outputOptions = options.output;
|
const outputOptions = options.output;
|
||||||
options.output = null;
|
options.output = null;
|
||||||
@ -64,8 +87,7 @@ async function build() {
|
|||||||
let {code, map} = await bundle.generate(outputOptions[i]);
|
let {code, map} = await bundle.generate(outputOptions[i]);
|
||||||
if (shouldMangleAndTranspile) {
|
if (shouldMangleAndTranspile) {
|
||||||
|
|
||||||
let names = {};
|
const uglifyRes = uglifyJs.minify(code, uglifyOptions);
|
||||||
const uglifyRes = uglifyJs.minify(code, {...uglifyOptions, ...{nameCache:names}});
|
|
||||||
code = uglifyRes.code;
|
code = uglifyRes.code;
|
||||||
// fs.writeFileSync('transpiled.js', code);
|
// fs.writeFileSync('transpiled.js', code);
|
||||||
const babelRes = babel.transform(code, babelOptions);
|
const babelRes = babel.transform(code, babelOptions);
|
||||||
@ -73,19 +95,8 @@ async function build() {
|
|||||||
code = regenerator.compile(code, regeneratorOptions).code;
|
code = regenerator.compile(code, regeneratorOptions).code;
|
||||||
|
|
||||||
|
|
||||||
const uglifyRes2 = uglifyJs.minify(code, {
|
const uglifyRes2 = uglifyJs.minify(code, uglifyOptions2);
|
||||||
mangle: {toplevel: true}, compress: {
|
|
||||||
keep_fargs: false,
|
|
||||||
toplevel: true,
|
|
||||||
dead_code: true,
|
|
||||||
unused: true,
|
|
||||||
passes: 1,
|
|
||||||
|
|
||||||
},
|
|
||||||
nameCache: names,
|
|
||||||
});
|
|
||||||
code = uglifyRes2.code;
|
code = uglifyRes2.code;
|
||||||
fs.writeFileSync(outputOptions[i].nameFile, JSON.stringify(names));
|
|
||||||
}
|
}
|
||||||
fs.writeFileSync(outputOptions[i].file, code);
|
fs.writeFileSync(outputOptions[i].file, code);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
npm run build
|
npm run build 2
|
||||||
@ -44,8 +44,8 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script>
|
<script>
|
||||||
let defaultThemeClass = 'black';
|
var defaultThemeClass = 'black';
|
||||||
let currentThemeClass = localStorage.getItem("currentTheme");
|
var currentThemeClass = localStorage.getItem("currentTheme");
|
||||||
if (!currentThemeClass) {
|
if (!currentThemeClass) {
|
||||||
currentThemeClass = defaultThemeClass;
|
currentThemeClass = defaultThemeClass;
|
||||||
}
|
}
|
||||||
@ -123,7 +123,8 @@
|
|||||||
console.log("init started");
|
console.log("init started");
|
||||||
initPromise = new Promise(function (resolve) {
|
initPromise = new Promise(function (resolve) {
|
||||||
if (typeof Map === "undefined") {
|
if (typeof Map === "undefined") {
|
||||||
window.Map = function () {
|
console.log("defining maps");
|
||||||
|
window["Map"] = function () {
|
||||||
this.get = function (key) {
|
this.get = function (key) {
|
||||||
var hash = this.__createHash(key);
|
var hash = this.__createHash(key);
|
||||||
return this.__map[hash];
|
return this.__map[hash];
|
||||||
@ -240,6 +241,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof Promise === 'undefined') {
|
if (typeof Promise === 'undefined') {
|
||||||
|
console.log("defining promises");
|
||||||
// alert("Your Browser is maybe too old to run this site. Please update your browser!");
|
// alert("Your Browser is maybe too old to run this site. Please update your browser!");
|
||||||
var promiseScript = document.createElement("script");
|
var promiseScript = document.createElement("script");
|
||||||
promiseScript.src = "//cdn.jsdelivr.net/bluebird/3.5.0/bluebird.min.js";
|
promiseScript.src = "//cdn.jsdelivr.net/bluebird/3.5.0/bluebird.min.js";
|
||||||
|
|||||||
7333
public/js/app.js
7333
public/js/app.js
File diff suppressed because one or more lines are too long
@ -29,11 +29,11 @@ import {CreditsSite} from "../module/Application/pwa/js/site/CreditsSite";
|
|||||||
import {SelectWordsSite} from "../module/Application/pwa/js/site/SelectWordsSite";
|
import {SelectWordsSite} from "../module/Application/pwa/js/site/SelectWordsSite";
|
||||||
import {DeleteWordsSite} from "../module/Application/pwa/js/site/DeleteWordsSite";
|
import {DeleteWordsSite} from "../module/Application/pwa/js/site/DeleteWordsSite";
|
||||||
|
|
||||||
|
import './settings'
|
||||||
|
|
||||||
applyPolyfills();
|
applyPolyfills();
|
||||||
|
|
||||||
|
|
||||||
import './settings'
|
|
||||||
|
|
||||||
ThemeManager.addTheme(new Theme('red', 'red'));
|
ThemeManager.addTheme(new Theme('red', 'red'));
|
||||||
ThemeManager.addTheme(new Theme("blue", "blue"));
|
ThemeManager.addTheme(new Theme("blue", "blue"));
|
||||||
ThemeManager.addTheme(new Theme("black", "black"));
|
ThemeManager.addTheme(new Theme("black", "black"));
|
||||||
@ -55,10 +55,6 @@ AndroidBridge.addDefinition(() => {
|
|||||||
// window["app"]["refreshCurrentSite"] = app.refreshCurrentSite;
|
// window["app"]["refreshCurrentSite"] = app.refreshCurrentSite;
|
||||||
});
|
});
|
||||||
|
|
||||||
// bridge für Android
|
|
||||||
// window["Translator"] = Translator;
|
|
||||||
// window["Translator"]["setLanguage"] = Translator.setLanguage;
|
|
||||||
|
|
||||||
|
|
||||||
SettingsSite.setTemplate("html/application/setting-template.html");
|
SettingsSite.setTemplate("html/application/setting-template.html");
|
||||||
// SettingsSite.shouldAddSettingsAction = false;
|
// SettingsSite.shouldAddSettingsAction = false;
|
||||||
@ -78,7 +74,6 @@ InitPromise.resolve(app).then(async function(){
|
|||||||
Translator.setLanguage("de");
|
Translator.setLanguage("de");
|
||||||
|
|
||||||
InstallManager.setCanInstallListener(e => {
|
InstallManager.setCanInstallListener(e => {
|
||||||
console.log("can install!", e);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
window["applyAndroidBridge"] = AndroidBridge.applyDefinitions;
|
window["applyAndroidBridge"] = AndroidBridge.applyDefinitions;
|
||||||
|
|||||||
@ -38,11 +38,11 @@ class AndroidBridge {
|
|||||||
object = newObject;
|
object = newObject;
|
||||||
}
|
}
|
||||||
definition = parts[0];
|
definition = parts[0];
|
||||||
console.log("parts for", definition, parts, object);
|
// console.log("parts for", definition, parts, object);
|
||||||
}
|
}
|
||||||
let textDefinition = definition;
|
let textDefinition = definition;
|
||||||
definition = () => {
|
definition = () => {
|
||||||
console.log("defining", textDefinition, object);
|
// console.log("defining", textDefinition, object);
|
||||||
window[textDefinition] = object;
|
window[textDefinition] = object;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -3500,6 +3500,7 @@ class MyDb {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
self.openStore(objectStore, function (store) {
|
self.openStore(objectStore, function (store) {
|
||||||
|
console.log("loadMany 1");
|
||||||
let indexRequest = store.index(index);
|
let indexRequest = store.index(index);
|
||||||
indexRequest.onerror = function (e) {
|
indexRequest.onerror = function (e) {
|
||||||
throw {
|
throw {
|
||||||
@ -3507,16 +3508,14 @@ class MyDb {
|
|||||||
"event": e
|
"event": e
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let request = indexRequest.openCursor(value, direction);
|
|
||||||
request.onerror = function (e) {
|
|
||||||
throw {
|
|
||||||
"type": "indexed-db-index-error",
|
|
||||||
"event": e
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let objects = [];
|
let objects = [];
|
||||||
let numberResults = 0;
|
let numberResults = 0;
|
||||||
request.onsuccess = function (e) {
|
console.log("indexrequest", indexRequest.openCursor());
|
||||||
|
let request = indexRequest.openCursor(value, direction);
|
||||||
|
console.log("request", request);
|
||||||
|
request["onsuccess"]= function (e) {
|
||||||
|
console.log("loadMany 2");
|
||||||
let cursor = e.target.result;
|
let cursor = e.target.result;
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
objects.push(cursor.value);
|
objects.push(cursor.value);
|
||||||
@ -3526,8 +3525,16 @@ class MyDb {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log("loadMany 3");
|
||||||
resolve(objects);
|
resolve(objects);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
request["onerror"] = function (e) {
|
||||||
|
throw {
|
||||||
|
"type": "indexed-db-index-error",
|
||||||
|
"event": e
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
import {SystemSettings, Translator} from "./lib/pwa-lib";
|
import {SystemSettings, Translator} from "./lib/pwa-lib";
|
||||||
import {Matomo} from "./lib/pwa-assets";
|
import {Matomo} from "./lib/pwa-assets";
|
||||||
|
|
||||||
|
|
||||||
let basePath = "/pwa/wordRotator/public/";
|
let basePath = "/pwa/wordRotator/public/";
|
||||||
if (window.location.pathname.includes("publicTest/"))
|
if (window.location.pathname.indexOf("publicTest/") >= 0)
|
||||||
{
|
{
|
||||||
basePath = "/pwa/wordRotator/publicTest/";
|
basePath = "/pwa/wordRotator/publicTest/";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,10 @@ export class WordRotatorDb extends MyDb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loadNextLevel(rendererTypes) {
|
async loadNextLevel(rendererTypes) {
|
||||||
|
console.log("loadNextLevel 1", IDBKeyRange.lowerBound(0));
|
||||||
const levels = await this.loadMany("difficulty", IDBKeyRange.lowerBound(0), WordRotatorDb.OBJECT_STORE.LEVEL);
|
const levels = await this.loadMany("difficulty", IDBKeyRange.lowerBound(0), WordRotatorDb.OBJECT_STORE.LEVEL);
|
||||||
|
// const levels = await this.loadMany("difficulty", null, WordRotatorDb.OBJECT_STORE.LEVEL);
|
||||||
|
console.log("loadNextLevel 2");
|
||||||
|
|
||||||
let wrongLevels = [];
|
let wrongLevels = [];
|
||||||
let newLevels = [];
|
let newLevels = [];
|
||||||
|
|||||||
@ -96,14 +96,13 @@ export class LevelSite extends WordRotatorBaseSite {
|
|||||||
this.findBy("#help-button").addEventListener("click", () => {
|
this.findBy("#help-button").addEventListener("click", () => {
|
||||||
this.help();
|
this.help();
|
||||||
});
|
});
|
||||||
|
await this.loadLastLevel();
|
||||||
this.loadLastLevel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadLastLevel() {
|
async loadLastLevel() {
|
||||||
try {
|
try {
|
||||||
let currentLevelInfo = localStorage.getItem("currentLevel");
|
let currentLevelInfo = localStorage.getItem("currentLevel");
|
||||||
if (currentLevelInfo !== null) {
|
if (Helper.isNotNull(currentLevelInfo)) {
|
||||||
currentLevelInfo = JSON.parse(currentLevelInfo);
|
currentLevelInfo = JSON.parse(currentLevelInfo);
|
||||||
|
|
||||||
const db = WordRotatorDb.getInstance();
|
const db = WordRotatorDb.getInstance();
|
||||||
@ -151,7 +150,9 @@ export class LevelSite extends WordRotatorBaseSite {
|
|||||||
this.wonText.style.fontSize = "0";
|
this.wonText.style.fontSize = "0";
|
||||||
|
|
||||||
const db = WordRotatorDb.getInstance();
|
const db = WordRotatorDb.getInstance();
|
||||||
|
console.log("nextLevel 2");
|
||||||
const nextLevelJson = await db.loadNextLevel(LevelSite.RENDERER_TYPES);
|
const nextLevelJson = await db.loadNextLevel(LevelSite.RENDERER_TYPES);
|
||||||
|
console.log("nextLevel 3");
|
||||||
|
|
||||||
if (nextLevelJson === null) {
|
if (nextLevelJson === null) {
|
||||||
this.startSite(EndSite);
|
this.startSite(EndSite);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user