Merge remote-tracking branch 'origin/master'

# Conflicts:
#	public/js/app.js
This commit is contained in:
silas 2018-11-05 22:52:27 +01:00
commit 5b537790cc
3 changed files with 15 additions and 7907 deletions

View File

@ -11,8 +11,6 @@ rm -rf src/scss/lib
mkdir -p src/js/lib/
mkdir -p src/scss/lib/
for d in "vendor/ainias/pwa"*/; do
find $d$jsSourceDir -name '*.js' -exec cp -r '{}' src/js/lib/ \;

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ export class WordRotatorDb extends MyDb {
}
constructor() {
super("wordRotator", 4);
super("wordRotator", 6);
}
upgrade(db, oldVersion, newVersion, e) {
@ -24,13 +24,16 @@ export class WordRotatorDb extends MyDb {
let levelObjectStore = e.target.transaction.objectStore(WordRotatorDb.OBJECT_STORE.LEVEL);
levelObjectStore.createIndex("played", ["deleted", "played", "difficulty", "id"], {"unique": false});
}
// xhklsfdbnk = 42;
if (Helper.isNull(oldVersion) || oldVersion < 3 && newVersion >= 3) {
let levelObjectStore = e.target.transaction.objectStore(WordRotatorDb.OBJECT_STORE.LEVEL);
levelObjectStore.createIndex("difficulty", "difficulty", {"unique": false});
}
if (Helper.isNull(oldVersion) || oldVersion < 3 && newVersion >= 4) {
console.log("update", oldVersion, newVersion);
if (Helper.isNull(oldVersion) || oldVersion < 6 && newVersion >= 6) {
try {
db.deleteObjectStore(WordRotatorDb.OBJECT_STORE.SYSTEM_VARS);
} catch (e) {}
let levelObjectStore = db.createObjectStore(WordRotatorDb.OBJECT_STORE.SYSTEM_VARS, {"keyPath": "name"});
}
};
@ -48,8 +51,8 @@ export class WordRotatorDb extends MyDb {
async loadNextLevel(rendererTypes) {
let levels = await this.loadAll(WordRotatorDb.OBJECT_STORE.LEVEL);
levels = levels.sort((a,b) => {
return (a["difficulty"] - b["difficulty"]);
levels = levels.sort((a, b) => {
return (a["difficulty"] - b["difficulty"]);
});
let wrongLevels = [];
@ -60,7 +63,7 @@ export class WordRotatorDb extends MyDb {
newLevels.push(levels[i]);
difficulty = levels[i]["difficulty"];
}
else if (levels[i]["difficulty"] !== 0 && !levels[i]["deleted"] && !levels[i]["played"] ) {
else if (levels[i]["difficulty"] !== 0 && !levels[i]["deleted"] && !levels[i]["played"]) {
wrongLevels.push(levels[i]);
}
}
@ -78,21 +81,21 @@ export class WordRotatorDb extends MyDb {
return await this.saveObj(level, WordRotatorDb.OBJECT_STORE.LEVEL);
}
async loadDateLastSync(){
async loadDateLastSync() {
let dateLastSync = await this.load("date-last-sync", WordRotatorDb.OBJECT_STORE.SYSTEM_VARS);
if (dateLastSync){
if (dateLastSync) {
return dateLastSync["value"];
}
return null;
}
async saveDateLastSync(value){
return await this.saveObj({"name": "date-last-sync", "value":value}, WordRotatorDb.OBJECT_STORE.SYSTEM_VARS)
async saveDateLastSync(value) {
return await this.saveObj({"name": "date-last-sync", "value": value}, WordRotatorDb.OBJECT_STORE.SYSTEM_VARS)
}
}
WordRotatorDb.OBJECT_STORE = {
LEVEL: "level",
SYSTEM_VARS:"vars"
SYSTEM_VARS: "vars"
};
WordRotatorDb.instance = null;