This commit is contained in:
Klemek
2023-08-29 16:44:25 +02:00
parent 233f4b1c3a
commit 3239a8293c
2 changed files with 130 additions and 129 deletions
+1
View File
@@ -6,6 +6,7 @@ module.exports = {
},
globals: {
Vue: 'readonly',
LZString: 'readonly',
},
extends: [ 'eslint:recommended' ],
parserOptions: {
+13 -13
View File
@@ -31,14 +31,14 @@ const utils = {
return output;
},
shuffle: function (array) {
const output = [...array];
const output = [ ...array ];
if (output.length < 2) {
return output;
}
for (let i = 0; i < array.length; i++) {
const i1 = this.randindex(array);
const i2 = this.randindex(array, i1);
[output[i1], output[i2]] = [output[i2], output[i1]];
[ output[i1], output[i2] ] = [ output[i2], output[i1] ];
}
return output;
},
@@ -50,14 +50,14 @@ const utils = {
let app = {
data() {
return {
question: "",
answer: "",
question: '',
answer: '',
showAnswer: false,
available: [],
current: [],
failed: [],
done: [],
newRow: ["", ""],
newRow: [ '', '' ],
showConfig: true,
};
},
@@ -71,7 +71,7 @@ let app = {
},
methods: {
showApp() {
document.getElementById("app").setAttribute("style", "");
document.getElementById('app').setAttribute('style', '');
},
show() {
this.showAnswer = true;
@@ -93,7 +93,7 @@ let app = {
addRow() {
if (this.newRow[0] && this.newRow[1]) {
this.available.push(utils.cloneObject(this.newRow));
this.newRow = ["", ""];
this.newRow = [ '', '' ];
}
this.reset();
},
@@ -119,8 +119,8 @@ let app = {
},
beforeMount() {
const url = new URL(window.location);
if (url.searchParams.get("d")) {
this.available = utils.deserialize(url.searchParams.get("d"));
if (url.searchParams.get('d')) {
this.available = utils.deserialize(url.searchParams.get('d'));
this.showConfig = false;
this.reset();
}
@@ -128,9 +128,9 @@ let app = {
updated() {
const data = utils.serialize(this.available);
const url = new URL(window.location);
if (url.searchParams.get("d") !== data) {
url.searchParams.set("d", data);
window.history.pushState({}, "", url);
if (url.searchParams.get('d') !== data) {
url.searchParams.set('d', data);
window.history.pushState({}, '', url);
}
},
mounted: function () {
@@ -140,5 +140,5 @@ let app = {
window.onload = () => {
app = Vue.createApp(app);
app.mount("#app");
app.mount('#app');
};