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