lido-player 0.0.2-alpha-50 → 0.0.2-alpha-43-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-fe562525.js → index-6a69c33a.js} +36 -3
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{lido-avatar_19.cjs.entry.js → lido-avatar_21.cjs.entry.js} +433 -182
- package/dist/cjs/lido-player.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{utils-c3e7cbcc.js → utils-079a5e7d.js} +1033 -169
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/calculator/lido-calculator.css +87 -0
- package/dist/collection/components/calculator/lido-calculator.js +321 -0
- package/dist/collection/components/cell/lido-cell.js +1 -1
- package/dist/collection/components/column/lido-col.js +1 -1
- package/dist/collection/components/container/lido-container.js +20 -2
- package/dist/collection/components/flashCard/lido-flash-card.js +1 -1
- package/dist/collection/components/float/lido-float.js +1 -1
- package/dist/collection/components/home/lido-home.css +0 -4
- package/dist/collection/components/home/lido-home.js +10 -29
- package/dist/collection/components/keyboard/lido-keyboard.js +2 -2
- package/dist/collection/components/mathMatrix/lido-math-matrix.css +10 -2
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +226 -20
- package/dist/collection/components/position/lido-pos.js +1 -1
- package/dist/collection/components/random/lido-random.js +1 -1
- package/dist/collection/components/row/lido-row.js +1 -1
- package/dist/collection/components/scale/lido-balance.css +114 -0
- package/dist/collection/components/scale/lido-balance.js +549 -0
- package/dist/collection/components/shape/lido-shape.js +1 -1
- package/dist/collection/components/slideFill/lido-slide-fill.js +1 -1
- package/dist/collection/components/text/lido-text.js +1 -1
- package/dist/collection/components/trace/lido-trace.js +49 -128
- package/dist/collection/components/wrap/lido-wrap.js +1 -1
- package/dist/collection/css/animation.css +21 -0
- package/dist/collection/css/index.css +45 -0
- package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +24 -25
- package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +0 -3
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +67 -0
- package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +156 -0
- package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +49 -0
- package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +66 -0
- package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +65 -0
- package/dist/collection/stories/Templates/matchBox/matchBox.stories.js +105 -0
- package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +92 -0
- package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +47 -0
- package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +59 -0
- package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +93 -0
- package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +100 -0
- package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +212 -0
- package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +6 -7
- package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +6 -7
- package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +158 -0
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +102 -0
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +94 -0
- package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +184 -0
- package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +213 -0
- package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +109 -0
- package/dist/collection/stories/Templates/total/total.stories.js +59 -0
- package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +96 -0
- package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +55 -0
- package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +5 -6
- package/dist/collection/utils/utils.js +440 -84
- package/dist/collection/utils/utilsHandlers/clickHandler.js +21 -26
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +95 -42
- package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +67 -0
- package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +94 -0
- package/dist/collection/utils/utilsHandlers/matrixHandler.js +298 -0
- package/dist/collection/utils/utilsHandlers/slideHandler.js +4 -2
- package/dist/collection/utils/utilsHandlers/sortHandler.js +21 -12
- package/dist/components/index.js +1 -1
- package/dist/components/lido-avatar.js +1 -1
- package/dist/components/lido-balance.d.ts +11 -0
- package/dist/components/lido-balance.js +6 -0
- package/dist/components/lido-calculator.d.ts +11 -0
- package/dist/components/lido-calculator.js +6 -0
- package/dist/components/lido-cell.js +1 -1
- package/dist/components/lido-col.js +1 -1
- package/dist/components/lido-container.js +1 -1
- package/dist/components/lido-flash-card.js +1 -1
- package/dist/components/lido-float.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-image.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-math-matrix.js +1 -1
- package/dist/components/lido-pos.js +1 -1
- package/dist/components/lido-random.js +1 -1
- package/dist/components/lido-root.js +32 -20
- package/dist/components/lido-row.js +1 -1
- package/dist/components/lido-shape.js +1 -1
- package/dist/components/lido-slide-fill.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/lido-trace.js +1 -1
- package/dist/components/lido-wrap.js +1 -1
- package/dist/components/p-08d0deab.js +254 -0
- package/dist/components/{p-7fc73a13.js → p-15971ede.js} +1 -1
- package/dist/components/{p-1cb590fb.js → p-1fbdb431.js} +2 -2
- package/dist/components/{p-b2d7b151.js → p-29bdd953.js} +2 -2
- package/dist/components/{p-20ffe2e9.js → p-322acda6.js} +42 -49
- package/dist/components/{p-d489f16f.js → p-3f406017.js} +2 -2
- package/dist/components/p-44808985.js +186 -0
- package/dist/components/{p-6917debf.js → p-52844fa4.js} +2 -2
- package/dist/components/{p-ababe351.js → p-73e31a86.js} +2 -2
- package/dist/components/{p-513a03e1.js → p-74849cdd.js} +4 -4
- package/dist/components/{p-6c98fc03.js → p-7f7e5672.js} +2 -2
- package/dist/components/{p-76423463.js → p-835b973d.js} +2 -2
- package/dist/components/{p-3d732e48.js → p-90465904.js} +50 -129
- package/dist/components/{p-6405d878.js → p-904711c8.js} +2 -2
- package/dist/components/{p-926348de.js → p-9be56729.js} +5 -4
- package/dist/components/{p-b83c7a68.js → p-afbc196f.js} +2 -2
- package/dist/components/{p-135e98bf.js → p-bed94c37.js} +1048 -168
- package/dist/components/{p-33588c7a.js → p-cbac3cbc.js} +1 -1
- package/dist/components/{p-a9689087.js → p-d37ab4dc.js} +2 -2
- package/dist/components/p-e36ddcc1.js +166 -0
- package/dist/components/{p-868beaa6.js → p-e4e42677.js} +2 -2
- package/dist/esm/{index-f47852d4.js → index-170e58c7.js} +36 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/{lido-avatar_19.entry.js → lido-avatar_21.entry.js} +432 -183
- package/dist/esm/lido-player.js +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{utils-99110070.js → utils-5df09162.js} +1032 -168
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.css +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-137c99ce.js +2 -0
- package/dist/lido-player/p-7556e652.js +9 -0
- package/dist/lido-player/p-eb956325.entry.js +1 -0
- package/dist/types/components/calculator/lido-calculator.d.ts +40 -0
- package/dist/types/components/container/lido-container.d.ts +4 -0
- package/dist/types/components/home/lido-home.d.ts +0 -1
- package/dist/types/components/mathMatrix/lido-math-matrix.d.ts +24 -4
- package/dist/types/components/scale/lido-balance.d.ts +160 -0
- package/dist/types/components/trace/lido-trace.d.ts +0 -1
- package/dist/types/components.d.ts +342 -14
- package/dist/types/stories/Templates/balancing/balancing.stories.d.ts +4 -0
- package/dist/types/stories/Templates/checker-block/checkerBlock.stories.d.ts +4 -0
- package/dist/types/stories/Templates/checkerBlock/checkerBlock.stories.d.ts +4 -0
- package/dist/types/stories/Templates/fillAnswer/fill-answer.stories.d.ts +4 -0
- package/dist/types/stories/Templates/foodJar/food-jar.stories.d.ts +4 -0
- package/dist/types/stories/Templates/matchBox/matchBox.stories.d.ts +4 -0
- package/dist/types/stories/Templates/matchBox/matchBox2.stories.d.ts +4 -0
- package/dist/types/stories/Templates/matchingCard/matching-card.stories.d.ts +4 -0
- package/dist/types/stories/Templates/multiplyBeeds/multiplyBeeds.stories.d.ts +9 -0
- package/dist/types/stories/Templates/nimbleTable/nimbleTable.stories.d.ts +4 -0
- package/dist/types/stories/Templates/numberBoardTwo/numberBoardTwo.stories.d.ts +4 -0
- package/dist/types/stories/Templates/numberPair/numberPair.stories.d.ts +4 -0
- package/dist/types/stories/Templates/questionBoard/questionBoard.stories.d.ts +15 -0
- package/dist/types/stories/Templates/sequenceBox/sequenceBox1.stories.d.ts +11 -0
- package/dist/types/stories/Templates/sequenceBox/sequenceBox2.stories.d.ts +11 -0
- package/dist/types/stories/Templates/shapePair/shape-pair.stories.d.ts +4 -0
- package/dist/types/stories/Templates/shapeTractor/shape-tractor.stories.d.ts +12 -0
- package/dist/types/stories/Templates/sumTogether/sumTogether.stories.d.ts +11 -0
- package/dist/types/stories/Templates/total/total.stories.d.ts +4 -0
- package/dist/types/stories/Templates/writeNumber/writeNumber.stories.d.ts +13 -0
- package/dist/types/stories/Templates/writeSet/writeSet.stories.d.ts +4 -0
- package/dist/types/utils/utils.d.ts +8 -2
- package/dist/types/utils/utilsHandlers/dragDropHandler.d.ts +4 -0
- package/dist/types/utils/utilsHandlers/lidoBalanceHandler.d.ts +2 -0
- package/dist/types/utils/utilsHandlers/lidoCalculatorHandler.d.ts +1 -0
- package/dist/types/utils/utilsHandlers/matrixHandler.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-58b69b3f.js +0 -160
- package/dist/lido-player/p-b83634bf.entry.js +0 -1
- package/dist/lido-player/p-c8c00dcb.js +0 -9
- package/dist/lido-player/p-ddf627b0.js +0 -2
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index$1 = require('./index-
|
|
3
|
+
const index$1 = require('./index-6a69c33a.js');
|
|
4
4
|
|
|
5
|
-
const DragSelectedMapKey = 'lidoDragSelectedMap';
|
|
6
5
|
const DragMapKey = 'lidoDragMap';
|
|
7
6
|
const SelectedValuesKey = 'lidoSelectedValues';
|
|
8
7
|
const ActivityScoreKey = 'lidoActivityScore';
|
|
@@ -16,7 +15,6 @@ const GameExitKey = 'lidoGameExit';
|
|
|
16
15
|
const ElementDropKey = 'lidoElementDrop';
|
|
17
16
|
const ElementClickKey = 'lidoElementClick';
|
|
18
17
|
const DropLength = 'dropLength';
|
|
19
|
-
const DropHasDrag = 'dropHasDrag';
|
|
20
18
|
const DropToAttr = 'drop-to';
|
|
21
19
|
const DropTimeAttr = 'drop-time';
|
|
22
20
|
const LidoContainer = 'lido-container';
|
|
@@ -161,6 +159,88 @@ function stopHighlightForSpeakingElement(element) {
|
|
|
161
159
|
// element.style.border = '';
|
|
162
160
|
}
|
|
163
161
|
|
|
162
|
+
function updateBalanceOnDrop(dragElement, dropElement) {
|
|
163
|
+
const balanceEl = document.querySelector('lido-balance');
|
|
164
|
+
if (!balanceEl)
|
|
165
|
+
return;
|
|
166
|
+
const leftDrag = Array.from(document.querySelectorAll('[drop-to^="lefthandle"]'));
|
|
167
|
+
const rightDrag = Array.from(document.querySelectorAll('[drop-to^="righthandle"]'));
|
|
168
|
+
balanceEl.leftVal = calculateValue(leftDrag, balanceEl.operation);
|
|
169
|
+
balanceEl.rightVal = calculateValue(rightDrag, balanceEl.operation);
|
|
170
|
+
console.log("leftpan:", balanceEl.leftVal, "rightpan:", balanceEl.rightVal);
|
|
171
|
+
if (balanceEl.updateTilt) {
|
|
172
|
+
balanceEl.updateTilt(balanceEl.leftVal, balanceEl.rightVal);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function calculateValue(elements, operation) {
|
|
176
|
+
if (elements.length === 0)
|
|
177
|
+
return 0;
|
|
178
|
+
if (operation === "count") {
|
|
179
|
+
return elements.length;
|
|
180
|
+
}
|
|
181
|
+
const ADD = ["add", "+"];
|
|
182
|
+
const SUBTRACT = ["subtract", "-"];
|
|
183
|
+
const MULTIPLY = ["multiply", "*"];
|
|
184
|
+
const DIVIDE = ["divide", "/"];
|
|
185
|
+
const expr = elements
|
|
186
|
+
.map(el => el.getAttribute("value") || "0")
|
|
187
|
+
.join(ADD.includes(operation) ? " + " :
|
|
188
|
+
SUBTRACT.includes(operation) ? " - " :
|
|
189
|
+
MULTIPLY.includes(operation) ? " * " :
|
|
190
|
+
DIVIDE.includes(operation) ? " / " : " + ");
|
|
191
|
+
try {
|
|
192
|
+
const res = equationCheck(expr);
|
|
193
|
+
if (typeof res === "number") {
|
|
194
|
+
return res;
|
|
195
|
+
}
|
|
196
|
+
else if (typeof res === "boolean") {
|
|
197
|
+
return res ? 1 : 0;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
return parseFloat(expr) || 0;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (e) {
|
|
204
|
+
console.warn("invalid exp", expr);
|
|
205
|
+
return 0;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function balanceResult(container, objectiveString) {
|
|
209
|
+
var _a, _b, _c, _d, _e, _f;
|
|
210
|
+
const additionalCheck = container.getAttribute('equationCheck');
|
|
211
|
+
if (!additionalCheck)
|
|
212
|
+
return false;
|
|
213
|
+
const balanceEl = document.querySelector('lido-balance');
|
|
214
|
+
if (!balanceEl)
|
|
215
|
+
return false;
|
|
216
|
+
const leftVal = Number((_c = (_a = balanceEl.leftVal) !== null && _a !== void 0 ? _a : (_b = balanceEl.dataset) === null || _b === void 0 ? void 0 : _b.leftVal) !== null && _c !== void 0 ? _c : 0);
|
|
217
|
+
const rightVal = Number((_f = (_d = balanceEl.rightVal) !== null && _d !== void 0 ? _d : (_e = balanceEl.dataset) === null || _e === void 0 ? void 0 : _e.rightVal) !== null && _f !== void 0 ? _f : 0);
|
|
218
|
+
const hasLeft = !isNaN(leftVal) && leftVal !== 0;
|
|
219
|
+
const hasRight = !isNaN(rightVal) && rightVal !== 0;
|
|
220
|
+
if (!hasLeft || !hasRight) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
|
|
224
|
+
const res = objectiveString === symbol;
|
|
225
|
+
console.log("Result:", res);
|
|
226
|
+
return res;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function buildDropHasDragFromDOM() {
|
|
230
|
+
const dropHasDrag = {};
|
|
231
|
+
const dropElements = document.querySelectorAll("[type='drop']");
|
|
232
|
+
dropElements.forEach(drop => {
|
|
233
|
+
const tabIndex = drop.getAttribute("tab-index") || drop.id;
|
|
234
|
+
const assignedDrag = document.querySelector(`[${DropToAttr}="${drop.id}"]`);
|
|
235
|
+
const isFull = !!assignedDrag;
|
|
236
|
+
drop.setAttribute("is-full", String(isFull));
|
|
237
|
+
dropHasDrag[tabIndex] = {
|
|
238
|
+
drop: drop.id,
|
|
239
|
+
isFull
|
|
240
|
+
};
|
|
241
|
+
});
|
|
242
|
+
return dropHasDrag;
|
|
243
|
+
}
|
|
164
244
|
// Function to get the scale of an element
|
|
165
245
|
const getElementScale$1 = (el) => {
|
|
166
246
|
el.style.animation = 'unset';
|
|
@@ -211,7 +291,7 @@ function enableDraggingWithScaling(element) {
|
|
|
211
291
|
isDragging = false;
|
|
212
292
|
return;
|
|
213
293
|
}
|
|
214
|
-
AudioPlayer.getI().stop();
|
|
294
|
+
// AudioPlayer.getI().stop();
|
|
215
295
|
removeHighlight(element);
|
|
216
296
|
isDragging = true;
|
|
217
297
|
isClicked = true;
|
|
@@ -315,7 +395,6 @@ function enableDraggingWithScaling(element) {
|
|
|
315
395
|
// Start observing the element
|
|
316
396
|
observer.observe(container, observerConfig);
|
|
317
397
|
const onMove = (event) => {
|
|
318
|
-
console.log("moved");
|
|
319
398
|
if (!isDragging)
|
|
320
399
|
return;
|
|
321
400
|
if (isDraggingDisabled) {
|
|
@@ -324,7 +403,7 @@ function enableDraggingWithScaling(element) {
|
|
|
324
403
|
}
|
|
325
404
|
isClicked = false;
|
|
326
405
|
element.style.transition = 'none';
|
|
327
|
-
const containerScale =
|
|
406
|
+
const containerScale = getElementScale$1(container);
|
|
328
407
|
let dx = 0;
|
|
329
408
|
let dy = 0;
|
|
330
409
|
if (event instanceof MouseEvent) {
|
|
@@ -346,7 +425,7 @@ function enableDraggingWithScaling(element) {
|
|
|
346
425
|
// Reset styles for all elements
|
|
347
426
|
allElements.forEach(otherElement => {
|
|
348
427
|
var _a;
|
|
349
|
-
const dropObject =
|
|
428
|
+
const dropObject = buildDragSelectedMapFromDOM();
|
|
350
429
|
const storedTabIndexes = Object.keys(dropObject).map(Number);
|
|
351
430
|
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
352
431
|
if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
|
|
@@ -404,7 +483,7 @@ function enableDraggingWithScaling(element) {
|
|
|
404
483
|
allElements.forEach(otherElement => {
|
|
405
484
|
allElements.forEach(otherElement => {
|
|
406
485
|
var _a;
|
|
407
|
-
const dropObject =
|
|
486
|
+
const dropObject = buildDragSelectedMapFromDOM();
|
|
408
487
|
const storedTabIndexes = Object.keys(dropObject).map(Number);
|
|
409
488
|
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
410
489
|
if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
|
|
@@ -568,14 +647,18 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
|
|
|
568
647
|
let prevDropItem = Object.values(dropHasDrag).find(item => document.getElementById(item.drop) === currentDrop);
|
|
569
648
|
if (prevDropItem) {
|
|
570
649
|
prevDropItem.isFull = false;
|
|
571
|
-
|
|
650
|
+
// container.setAttribute(DropHasDrag, JSON.stringify(dropHasDrag));
|
|
651
|
+
const dropEl = document.getElementById(prevDropItem.drop);
|
|
652
|
+
if (dropEl) {
|
|
653
|
+
dropEl.removeAttribute('is-full');
|
|
654
|
+
}
|
|
572
655
|
}
|
|
573
656
|
dragToDropMap.delete(dragElement);
|
|
574
657
|
}
|
|
575
658
|
if (selectedValueData) {
|
|
576
659
|
let selectedValue = JSON.parse(selectedValueData);
|
|
577
660
|
selectedValue = selectedValue.filter(value => value != dragElement['value']);
|
|
578
|
-
|
|
661
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(selectedValue));
|
|
579
662
|
}
|
|
580
663
|
if (dragSelectedData) {
|
|
581
664
|
let dragSelected = JSON.parse(dragSelectedData);
|
|
@@ -583,14 +666,15 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
|
|
|
583
666
|
if (dragPreDropElement) {
|
|
584
667
|
delete dragSelected[dragPreDropElement.getAttribute('tab-index')];
|
|
585
668
|
}
|
|
586
|
-
|
|
669
|
+
// container.setAttribute(DragSelectedMapKey, JSON.stringify(dragSelected));
|
|
587
670
|
dragElement.removeAttribute(DropToAttr);
|
|
588
671
|
updateDropBorder(currentDrop);
|
|
672
|
+
updateBalanceOnDrop();
|
|
589
673
|
}
|
|
590
674
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
591
675
|
allElements.forEach(otherElement => {
|
|
592
676
|
var _a;
|
|
593
|
-
const dropObject =
|
|
677
|
+
const dropObject = buildDragSelectedMapFromDOM();
|
|
594
678
|
const storedTabIndexes = Object.keys(dropObject).map(Number);
|
|
595
679
|
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
596
680
|
if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
|
|
@@ -615,20 +699,22 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
|
|
|
615
699
|
});
|
|
616
700
|
handleShowCheck();
|
|
617
701
|
}
|
|
702
|
+
const tempVanishedValues = [];
|
|
618
703
|
async function onElementDropComplete(dragElement, dropElement) {
|
|
619
|
-
var _a, _b, _c, _d, _e;
|
|
620
|
-
const selectedValueData = localStorage.getItem(SelectedValuesKey) || '';
|
|
621
|
-
const dragSelectedData = localStorage.getItem(DragSelectedMapKey);
|
|
622
|
-
localStorage.getItem(DragMapKey);
|
|
623
|
-
console.log("dragggedddd elem", { value: dragElement.getAttribute("value") });
|
|
624
|
-
let dropHasDrag = JSON.parse(localStorage.getItem(DropHasDrag) || ' {}');
|
|
704
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
625
705
|
const container = document.getElementById(LidoContainer);
|
|
706
|
+
const selectedValueData = (_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : "[]";
|
|
707
|
+
const dragSelectedData = JSON.stringify(buildDragSelectedMapFromDOM());
|
|
708
|
+
const dropSelectedDataobject = buildDragSelectedMapFromDOM();
|
|
709
|
+
JSON.stringify(dropSelectedDataobject);
|
|
710
|
+
console.log("dragggedddd elem", { value: dragElement.getAttribute("value") });
|
|
711
|
+
let dropHasDrag = buildDropHasDragFromDOM();
|
|
626
712
|
if (!dropElement) {
|
|
627
713
|
handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
|
|
628
714
|
return;
|
|
629
715
|
}
|
|
630
716
|
const dropTabIndex = dropElement.getAttribute('tab-index');
|
|
631
|
-
if ((
|
|
717
|
+
if ((_b = dropHasDrag[dropTabIndex]) === null || _b === void 0 ? void 0 : _b.isFull) {
|
|
632
718
|
handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
|
|
633
719
|
return;
|
|
634
720
|
}
|
|
@@ -640,9 +726,10 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
640
726
|
handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
|
|
641
727
|
return;
|
|
642
728
|
}
|
|
729
|
+
// let isCorrect = dropElement.getAttribute('value').toLowerCase().includes(dragElement.getAttribute('value').toLowerCase());
|
|
643
730
|
let isCorrect;
|
|
644
|
-
const dragValue = ((
|
|
645
|
-
const dropValue = ((
|
|
731
|
+
const dragValue = ((_c = dragElement.getAttribute('value')) === null || _c === void 0 ? void 0 : _c.trim()) || "";
|
|
732
|
+
const dropValue = ((_d = dropElement.getAttribute('value')) === null || _d === void 0 ? void 0 : _d.trim()) || "";
|
|
646
733
|
if (Number(dragValue)) {
|
|
647
734
|
const dragNum = Number(dragValue);
|
|
648
735
|
//array of numbers
|
|
@@ -656,8 +743,7 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
656
743
|
}
|
|
657
744
|
}
|
|
658
745
|
else {
|
|
659
|
-
|
|
660
|
-
isCorrect = dropValue.toLowerCase().includes(dragValue.toLowerCase());
|
|
746
|
+
isCorrect = dropElement.getAttribute('value').toLowerCase().includes(dragElement.getAttribute('value').toLowerCase());
|
|
661
747
|
}
|
|
662
748
|
if (!isCorrect) {
|
|
663
749
|
dragElement.style.transition = 'transform 0.5s ease';
|
|
@@ -672,7 +758,7 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
672
758
|
// delete stored[oldDropIndex];
|
|
673
759
|
// localStorage.setItem(localStorageKey, JSON.stringify(stored));
|
|
674
760
|
// }
|
|
675
|
-
|
|
761
|
+
handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
|
|
676
762
|
}, 500);
|
|
677
763
|
if (dragElement['type'] === 'option') {
|
|
678
764
|
const childs = Array.from(container.querySelectorAll(`[value="${dragElement['value']}"]`));
|
|
@@ -691,6 +777,7 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
691
777
|
if (checkdropAttr && checkdropAttr.toLowerCase() === DropMode.EnableAnimation.toLowerCase()) {
|
|
692
778
|
container.style.pointerEvents = "none";
|
|
693
779
|
setTimeout(() => {
|
|
780
|
+
var _a, _b, _c;
|
|
694
781
|
const div = document.createElement('div');
|
|
695
782
|
container.append(div);
|
|
696
783
|
div.classList.add('after-drop-popup-container');
|
|
@@ -699,6 +786,11 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
699
786
|
const allDragElements = container.querySelectorAll('[type="drag"]');
|
|
700
787
|
const dragParents = Array.from(allDragElements).map(el => el.parentElement);
|
|
701
788
|
const allSameParent = dragParents.every(parent => parent === dragElement.parentElement);
|
|
789
|
+
JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
790
|
+
const vanishedValue = (_b = dragElement.getAttribute('value')) !== null && _b !== void 0 ? _b : (_c = dragElement.textContent) === null || _c === void 0 ? void 0 : _c.trim();
|
|
791
|
+
if (vanishedValue) {
|
|
792
|
+
tempVanishedValues.push(vanishedValue);
|
|
793
|
+
}
|
|
702
794
|
// Remove from old parents
|
|
703
795
|
if (allSameParent) {
|
|
704
796
|
dragElement.remove();
|
|
@@ -722,6 +814,16 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
722
814
|
setTimeout(() => {
|
|
723
815
|
div.remove();
|
|
724
816
|
container.style.pointerEvents = 'auto';
|
|
817
|
+
const objective = container.getAttribute('objective');
|
|
818
|
+
if (objective && tempVanishedValues.map(v => v.trim()).sort().join(',') === objective.split(',').map(v => v.trim()).sort().join(',')) {
|
|
819
|
+
(async () => {
|
|
820
|
+
isCorrect = true;
|
|
821
|
+
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
822
|
+
await executeActions(onCorrect, container);
|
|
823
|
+
window.dispatchEvent(new CustomEvent(NextContainerKey));
|
|
824
|
+
tempVanishedValues.length = 0;
|
|
825
|
+
})();
|
|
826
|
+
}
|
|
725
827
|
}, 800); // match animation duration
|
|
726
828
|
}, 2000); // stay for 2 seconds
|
|
727
829
|
}, 250);
|
|
@@ -729,6 +831,12 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
729
831
|
}
|
|
730
832
|
}
|
|
731
833
|
if (dropElement) {
|
|
834
|
+
let selectedValues = JSON.parse((_e = container.getAttribute(SelectedValuesKey)) !== null && _e !== void 0 ? _e : "[]");
|
|
835
|
+
const dragValue = dragElement.getAttribute('value');
|
|
836
|
+
if (dragValue && !selectedValues.includes(dragValue)) {
|
|
837
|
+
selectedValues.push(dragValue);
|
|
838
|
+
}
|
|
839
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(selectedValues));
|
|
732
840
|
if (dropElement.getAttribute('drop-attr') === 'stretch') {
|
|
733
841
|
if (!dropElement.hasAttribute('data-original-width')) {
|
|
734
842
|
const computedStyle = window.getComputedStyle(dropElement);
|
|
@@ -737,15 +845,16 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
737
845
|
const dragWidth = dragElement.offsetWidth;
|
|
738
846
|
dropElement.style.width = `${dragWidth}px`;
|
|
739
847
|
}
|
|
740
|
-
if (!(((
|
|
848
|
+
if (!(((_f = dropElement.getAttribute('dropAttr')) === null || _f === void 0 ? void 0 : _f.toLowerCase()) === DropMode.Diagonal) && (dropElement.getAttribute('minDrops') === '1' || !dropElement.getAttribute('minDrops'))) {
|
|
741
849
|
const isisFull = Object.values(dropHasDrag).find(item => document.getElementById(item.drop) === dropElement);
|
|
742
850
|
if (isisFull) {
|
|
743
851
|
isisFull.isFull = true;
|
|
852
|
+
dropElement.setAttribute('is-full', 'true');
|
|
744
853
|
}
|
|
745
854
|
else {
|
|
746
855
|
console.warn('No matching drop item found for', dropElement);
|
|
747
856
|
}
|
|
748
|
-
|
|
857
|
+
// container.setAttribute(DropHasDrag, JSON.stringify(dropHasDrag));
|
|
749
858
|
if (dragSelectedData) {
|
|
750
859
|
let dragSelected = JSON.parse(dragSelectedData);
|
|
751
860
|
for (const key in dragSelected) {
|
|
@@ -758,7 +867,7 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
758
867
|
}
|
|
759
868
|
}
|
|
760
869
|
}
|
|
761
|
-
|
|
870
|
+
// container.setAttribute(DragSelectedMapKey, JSON.stringify(dragSelected));
|
|
762
871
|
}
|
|
763
872
|
dragElement.classList.add('dropped');
|
|
764
873
|
if (dragElement) {
|
|
@@ -771,7 +880,7 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
771
880
|
dragElement.setAttribute(DropTimeAttr, new Date().getTime().toString());
|
|
772
881
|
}
|
|
773
882
|
// Check for overlaps and highlight only the most overlapping element
|
|
774
|
-
if (dropElement && !((
|
|
883
|
+
if (dropElement && !((_g = dropHasDrag[dropTabIndex]) === null || _g === void 0 ? void 0 : _g.isFull)) {
|
|
775
884
|
let mostOverlappedElement = findMostoverlappedElement$1(dragElement, 'drag');
|
|
776
885
|
const isAllowOnlyOneDrop = dropElement.getAttribute('is-allow-only-one-drop') === 'true' || '';
|
|
777
886
|
if (mostOverlappedElement && isAllowOnlyOneDrop) {
|
|
@@ -780,7 +889,7 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
780
889
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
781
890
|
allElements.forEach(otherElement => {
|
|
782
891
|
var _a;
|
|
783
|
-
const dropObject =
|
|
892
|
+
const dropObject = buildDragSelectedMapFromDOM();
|
|
784
893
|
const storedTabIndexes = Object.keys(dropObject).map(Number);
|
|
785
894
|
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
786
895
|
if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
|
|
@@ -812,13 +921,14 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
812
921
|
handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
|
|
813
922
|
return;
|
|
814
923
|
}
|
|
924
|
+
updateBalanceOnDrop();
|
|
815
925
|
if (dragSelectedData) {
|
|
816
926
|
let currentDrop = dragToDropMap.get(dragElement);
|
|
817
927
|
if (currentDrop) {
|
|
818
928
|
let prevDropItem = Object.values(dropHasDrag).find(item => document.getElementById(item.drop) === currentDrop);
|
|
819
929
|
if (prevDropItem) {
|
|
820
930
|
prevDropItem.isFull = false;
|
|
821
|
-
|
|
931
|
+
// container.setAttribute(DropHasDrag, JSON.stringify(dropHasDrag));
|
|
822
932
|
reduceSizeToOriginal();
|
|
823
933
|
}
|
|
824
934
|
}
|
|
@@ -831,9 +941,9 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
831
941
|
// }
|
|
832
942
|
// localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragSelected));
|
|
833
943
|
}
|
|
834
|
-
let dropLength =
|
|
944
|
+
let dropLength = parseInt((_h = container.getAttribute(DropLength)) !== null && _h !== void 0 ? _h : '0');
|
|
835
945
|
dropLength += 1;
|
|
836
|
-
|
|
946
|
+
container.setAttribute(DropLength, String(dropLength));
|
|
837
947
|
if (dropLength === countPatternWords(dropElement['value'])) {
|
|
838
948
|
const isisFull = Object.values(dropHasDrag).find(item => document.getElementById(item.drop) === dropElement);
|
|
839
949
|
if (isisFull) {
|
|
@@ -842,9 +952,10 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
842
952
|
else {
|
|
843
953
|
console.warn('No matching drop item found for', dropElement);
|
|
844
954
|
}
|
|
845
|
-
|
|
955
|
+
// memoryStorage[DropHasDrag] = dropHasDrag;
|
|
956
|
+
// container.setAttribute(DropHasDrag, JSON.stringify(dropHasDrag));
|
|
846
957
|
dropLength = 0;
|
|
847
|
-
|
|
958
|
+
container.setAttribute(DropLength, String(dropLength));
|
|
848
959
|
}
|
|
849
960
|
dragToDropMap.set(dragElement, dropElement);
|
|
850
961
|
// Add pulse and highlight effect for a successful match
|
|
@@ -852,9 +963,9 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
852
963
|
dispatchElementDropEvent(dragElement, dropElement, isCorrect);
|
|
853
964
|
storingEachActivityScore(isCorrect);
|
|
854
965
|
dragElement.style.opacity = '1';
|
|
966
|
+
await onActivityComplete(dragElement, dropElement);
|
|
855
967
|
const allDropElements = document.querySelectorAll('.drop-element');
|
|
856
968
|
allDropElements.forEach(el => updateDropBorder(el));
|
|
857
|
-
await onActivityComplete(dragElement, dropElement);
|
|
858
969
|
}
|
|
859
970
|
function updateDropBorder(element) {
|
|
860
971
|
if (!element || !element.classList.contains('drop-element'))
|
|
@@ -873,7 +984,9 @@ function updateDropBorder(element) {
|
|
|
873
984
|
element.classList.remove('empty');
|
|
874
985
|
}
|
|
875
986
|
else {
|
|
876
|
-
element.classList.
|
|
987
|
+
if (!element.classList.contains('math-matrix')) {
|
|
988
|
+
element.classList.add('empty');
|
|
989
|
+
}
|
|
877
990
|
element.classList.remove('filled');
|
|
878
991
|
}
|
|
879
992
|
}
|
|
@@ -881,15 +994,12 @@ function handleDropElement(element) {
|
|
|
881
994
|
// let nextIndex = Object.keys(dropHas).length; // Get next index
|
|
882
995
|
// dropHas[nextIndex] = { drop: element, isFull: false };
|
|
883
996
|
element.classList.add('drop-element');
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
if (
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
dropHas[tabIndex] = { drop: element.id, isFull: false };
|
|
891
|
-
localStorage.setItem(DropHasDrag, JSON.stringify(dropHas));
|
|
892
|
-
}
|
|
997
|
+
buildDragSelectedMapFromDOM();
|
|
998
|
+
element.getAttribute('tab-index');
|
|
999
|
+
// if (!dropHas[tabIndex]) {
|
|
1000
|
+
// dropHas[tabIndex] = { drop: element.id, isFull: false };
|
|
1001
|
+
// // localStorage.setItem(DropHasDrag, JSON.stringify(dropHas));
|
|
1002
|
+
// }
|
|
893
1003
|
element.onclick = () => {
|
|
894
1004
|
onClickDropOrDragElement(element, 'drop');
|
|
895
1005
|
};
|
|
@@ -956,7 +1066,7 @@ async function onClickDropOrDragElement(element, type) {
|
|
|
956
1066
|
const dragToDropMap = new Map();
|
|
957
1067
|
async function onClickDragElement(element) {
|
|
958
1068
|
AudioPlayer.getI().stop();
|
|
959
|
-
const dropElements =
|
|
1069
|
+
const dropElements = buildDropHasDragFromDOM();
|
|
960
1070
|
const dragEl = element;
|
|
961
1071
|
if (!dragEl) {
|
|
962
1072
|
console.error('Element not found');
|
|
@@ -1002,9 +1112,12 @@ const appendingDragElementsInDrop = () => {
|
|
|
1002
1112
|
});
|
|
1003
1113
|
});
|
|
1004
1114
|
};
|
|
1115
|
+
const container = document.getElementById(LidoContainer);
|
|
1005
1116
|
const reduceSizeToOriginal = () => {
|
|
1006
1117
|
const dropItems = document.querySelectorAll("[type='drop']");
|
|
1007
|
-
let dropHasDrag =
|
|
1118
|
+
let dropHasDrag = buildDragSelectedMapFromDOM();
|
|
1119
|
+
if (!dropItems || !container)
|
|
1120
|
+
return;
|
|
1008
1121
|
if (!dropHasDrag || !dropItems)
|
|
1009
1122
|
return;
|
|
1010
1123
|
dropItems.forEach(dropElement => {
|
|
@@ -1013,6 +1126,7 @@ const reduceSizeToOriginal = () => {
|
|
|
1013
1126
|
const tabIndex = drop.getAttribute('tab-index');
|
|
1014
1127
|
if (((_a = drop === null || drop === void 0 ? void 0 : drop.getAttribute('drop-attr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Stretch && dropHasDrag[tabIndex].isFull === false) {
|
|
1015
1128
|
const originalWidth = drop.getAttribute('data-original-width');
|
|
1129
|
+
dropElement.removeAttribute('is-full');
|
|
1016
1130
|
if (originalWidth) {
|
|
1017
1131
|
drop.style.width = originalWidth;
|
|
1018
1132
|
drop.removeAttribute('data-original-width');
|
|
@@ -1203,7 +1317,7 @@ function enableReorderDrag(element) {
|
|
|
1203
1317
|
isClicked = false;
|
|
1204
1318
|
event.preventDefault();
|
|
1205
1319
|
const containerRect = container.getBoundingClientRect();
|
|
1206
|
-
const containerScale =
|
|
1320
|
+
const containerScale = getElementScale(container);
|
|
1207
1321
|
const newLeft = (point.clientX - containerRect.left - offsetXInElement) / containerScale;
|
|
1208
1322
|
const newTop = (point.clientY - containerRect.top - offsetYInElement) / containerScale;
|
|
1209
1323
|
element.style.left = `${newLeft}px`;
|
|
@@ -1270,16 +1384,18 @@ function enableReorderDrag(element) {
|
|
|
1270
1384
|
else {
|
|
1271
1385
|
if (element.parentElement['type'] !== 'category') {
|
|
1272
1386
|
executeActions('this.alignMatch=true', divEl, element);
|
|
1273
|
-
|
|
1387
|
+
setTimeout(() => {
|
|
1388
|
+
divEl.replaceWith(element);
|
|
1389
|
+
}, 500);
|
|
1274
1390
|
}
|
|
1275
1391
|
else {
|
|
1276
1392
|
const categoryElement = element.parentElement;
|
|
1277
|
-
const dragValues =
|
|
1393
|
+
const dragValues = buildDragSelectedMapFromDOM();
|
|
1278
1394
|
const tabKey = categoryElement.getAttribute('tab-index');
|
|
1279
1395
|
const targetValue = element['value'];
|
|
1280
1396
|
if (dragValues[tabKey]) {
|
|
1281
1397
|
dragValues[tabKey] = dragValues[tabKey].filter((el) => el !== targetValue);
|
|
1282
|
-
localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragValues));
|
|
1398
|
+
// localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragValues));
|
|
1283
1399
|
}
|
|
1284
1400
|
optionArea.scrollTo({
|
|
1285
1401
|
top: optionArea.scrollHeight,
|
|
@@ -1287,6 +1403,7 @@ function enableReorderDrag(element) {
|
|
|
1287
1403
|
});
|
|
1288
1404
|
optionArea.appendChild(element);
|
|
1289
1405
|
element.classList.remove('dropped');
|
|
1406
|
+
element.removeAttribute('drop-to');
|
|
1290
1407
|
if (dummy) {
|
|
1291
1408
|
dummy.remove();
|
|
1292
1409
|
}
|
|
@@ -1325,12 +1442,12 @@ function enableReorderDrag(element) {
|
|
|
1325
1442
|
category = categoryArr[0];
|
|
1326
1443
|
}
|
|
1327
1444
|
if (element.parentElement.getAttribute('type') === 'category') {
|
|
1328
|
-
const dragValues =
|
|
1445
|
+
const dragValues = buildDragSelectedMapFromDOM();
|
|
1329
1446
|
const tabKey = category.getAttribute('tab-index');
|
|
1330
1447
|
const targetValue = element['value'];
|
|
1331
1448
|
if (dragValues[tabKey]) {
|
|
1332
1449
|
dragValues[tabKey] = dragValues[tabKey].filter((el) => el !== targetValue);
|
|
1333
|
-
localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragValues));
|
|
1450
|
+
// localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragValues));
|
|
1334
1451
|
}
|
|
1335
1452
|
const dummy = createDummyElement(element);
|
|
1336
1453
|
optionArea.appendChild(dummy);
|
|
@@ -1344,6 +1461,7 @@ function enableReorderDrag(element) {
|
|
|
1344
1461
|
resetElementStyles(element);
|
|
1345
1462
|
dummy.replaceWith(element);
|
|
1346
1463
|
element.classList.remove('dropped');
|
|
1464
|
+
element.removeAttribute('drop-to');
|
|
1347
1465
|
}, 100);
|
|
1348
1466
|
return;
|
|
1349
1467
|
}
|
|
@@ -1492,13 +1610,15 @@ function moveWithAnimation(target, overlapped) {
|
|
|
1492
1610
|
}
|
|
1493
1611
|
// Drop Completed
|
|
1494
1612
|
const wordDropComplete = (block, element) => {
|
|
1613
|
+
var _a;
|
|
1614
|
+
console.log("worddrop");
|
|
1495
1615
|
const container = document.getElementById(LidoContainer);
|
|
1496
1616
|
const objective = container.getAttribute('objective');
|
|
1497
1617
|
const objectiveArray = objective.split(',');
|
|
1498
|
-
let wordArray = JSON.parse(
|
|
1618
|
+
let wordArray = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
1499
1619
|
const wordBlock = block.children;
|
|
1500
1620
|
wordArray = Array.from(wordBlock).map(child => child.getAttribute('value'));
|
|
1501
|
-
|
|
1621
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(wordArray));
|
|
1502
1622
|
const elementIndex = wordArray.indexOf(element['value']);
|
|
1503
1623
|
if (elementIndex >= 0) {
|
|
1504
1624
|
const res = matchStringPattern(element['value'], [objectiveArray[elementIndex].trim()]);
|
|
@@ -1513,7 +1633,7 @@ const wordDropComplete = (block, element) => {
|
|
|
1513
1633
|
};
|
|
1514
1634
|
async function onDropToCategory(dragElement, categoryElement) {
|
|
1515
1635
|
dragElement.classList.add('dropped');
|
|
1516
|
-
let dragSelected =
|
|
1636
|
+
let dragSelected = buildDragSelectedMapFromDOM();
|
|
1517
1637
|
let elementArr = dragSelected[categoryElement.getAttribute('tab-index')];
|
|
1518
1638
|
if (Array.isArray(elementArr)) {
|
|
1519
1639
|
if (elementArr.includes(dragElement['value']))
|
|
@@ -1525,7 +1645,10 @@ async function onDropToCategory(dragElement, categoryElement) {
|
|
|
1525
1645
|
dragSelected[key].splice(index, 1);
|
|
1526
1646
|
}
|
|
1527
1647
|
}
|
|
1528
|
-
|
|
1648
|
+
if (categoryElement === null || categoryElement === void 0 ? void 0 : categoryElement.id) {
|
|
1649
|
+
dragElement.setAttribute(DropToAttr, categoryElement.id);
|
|
1650
|
+
}
|
|
1651
|
+
// localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragSelected));
|
|
1529
1652
|
await onActivityComplete(dragElement, categoryElement);
|
|
1530
1653
|
}
|
|
1531
1654
|
|
|
@@ -1744,13 +1867,15 @@ function slidingWithScaling(element) {
|
|
|
1744
1867
|
});
|
|
1745
1868
|
}
|
|
1746
1869
|
const slideCompleted = (slideElement) => {
|
|
1747
|
-
|
|
1870
|
+
var _a;
|
|
1871
|
+
const container = document.getElementById(LidoContainer);
|
|
1872
|
+
const slideArr = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
1748
1873
|
const allSlideElements = document.querySelectorAll("[type='slide']");
|
|
1749
1874
|
let index = 0;
|
|
1750
1875
|
allSlideElements.forEach(item => {
|
|
1751
1876
|
slideArr[index++] = item['value'];
|
|
1752
1877
|
});
|
|
1753
|
-
|
|
1878
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(slideArr));
|
|
1754
1879
|
const objectiveString = document.getElementById(LidoContainer)['objective'];
|
|
1755
1880
|
const objectiveArray = objectiveString.split(',');
|
|
1756
1881
|
const elementIndex = slideArr.indexOf(slideElement['value']);
|
|
@@ -3012,6 +3137,7 @@ function addClickListenerForClickType(element) {
|
|
|
3012
3137
|
return;
|
|
3013
3138
|
}
|
|
3014
3139
|
const onClick = async () => {
|
|
3140
|
+
var _a;
|
|
3015
3141
|
const lido_buttons = element.getAttribute('id');
|
|
3016
3142
|
if (lido_buttons === 'lido-arrow-left' || lido_buttons === 'lido-arrow-right') {
|
|
3017
3143
|
return;
|
|
@@ -3028,25 +3154,15 @@ function addClickListenerForClickType(element) {
|
|
|
3028
3154
|
}
|
|
3029
3155
|
if (container['objective'].length === 0)
|
|
3030
3156
|
return;
|
|
3031
|
-
// element.style.border = '2px solid yellow';
|
|
3032
|
-
// element.style.boxShadow = '0px 0px 10px rgba(255, 255, 0, 0.7)';
|
|
3033
|
-
// element.style.transition = 'transform 0.2s ease, border 0.5s ease';
|
|
3034
|
-
// element.style.transform = 'scale(1.1)';
|
|
3035
|
-
// element.style.transform = 'scale(1)';
|
|
3036
|
-
// element.style.border = '';
|
|
3037
|
-
// element.style.boxShadow = '';
|
|
3038
3157
|
const isActivated = element.classList.contains('lido-element-selected');
|
|
3039
|
-
let selectedValue = JSON.parse(
|
|
3158
|
+
let selectedValue = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
3040
3159
|
if (objective.length === 1) {
|
|
3041
|
-
|
|
3160
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify([element['value']]));
|
|
3042
3161
|
const isCorrect = objective.includes(element['value']);
|
|
3043
3162
|
dispatchClickEvent(element, isCorrect);
|
|
3044
3163
|
if (isCorrect) {
|
|
3045
3164
|
const onCorrect = element.getAttribute('onCorrect');
|
|
3046
|
-
|
|
3047
|
-
element.style.pointerEvents = 'none';
|
|
3048
|
-
}
|
|
3049
|
-
document.body.style.pointerEvents = 'none';
|
|
3165
|
+
// element.style.pointerEvents = 'none';
|
|
3050
3166
|
await executeActions(onCorrect, element);
|
|
3051
3167
|
}
|
|
3052
3168
|
else {
|
|
@@ -3054,7 +3170,11 @@ function addClickListenerForClickType(element) {
|
|
|
3054
3170
|
await executeActions(onInCorrect, element);
|
|
3055
3171
|
// showWrongAnswerAnimation([element]);
|
|
3056
3172
|
}
|
|
3057
|
-
|
|
3173
|
+
// const calciEl=document.querySelector('#lidoCalculator') as any;
|
|
3174
|
+
const isInsideCalculator = element.closest('#lidoCalculator') !== null;
|
|
3175
|
+
if (!isInsideCalculator) {
|
|
3176
|
+
storingEachActivityScore(isCorrect);
|
|
3177
|
+
}
|
|
3058
3178
|
handleShowCheck();
|
|
3059
3179
|
return;
|
|
3060
3180
|
}
|
|
@@ -3065,8 +3185,8 @@ function addClickListenerForClickType(element) {
|
|
|
3065
3185
|
element.classList.remove('lido-element-selected');
|
|
3066
3186
|
executeActions(element.getAttribute('onEntry'), element);
|
|
3067
3187
|
selectedValue = selectedValue.filter(item => item != element['value']);
|
|
3068
|
-
|
|
3069
|
-
let multiOptionScore =
|
|
3188
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify([element['value']]));
|
|
3189
|
+
let multiOptionScore = buildDragSelectedMapFromDOM();
|
|
3070
3190
|
const valueToRemove = element['value'];
|
|
3071
3191
|
const keyToRemove = Object.keys(multiOptionScore).find(key => multiOptionScore[key].includes(valueToRemove));
|
|
3072
3192
|
if (keyToRemove) {
|
|
@@ -3074,10 +3194,9 @@ function addClickListenerForClickType(element) {
|
|
|
3074
3194
|
if (multiOptionScore[keyToRemove].length === 0) {
|
|
3075
3195
|
delete multiOptionScore[keyToRemove];
|
|
3076
3196
|
}
|
|
3077
|
-
localStorage.setItem(DragSelectedMapKey, JSON.stringify(multiOptionScore));
|
|
3078
3197
|
const sortedKeys = Object.keys(multiOptionScore).sort((a, b) => parseInt(a) - parseInt(b));
|
|
3079
3198
|
const sortedValues = sortedKeys.reduce((acc, key) => acc.concat(multiOptionScore[key]), []);
|
|
3080
|
-
|
|
3199
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(sortedValues));
|
|
3081
3200
|
}
|
|
3082
3201
|
if (showCheck && selectedValue.length === 0) {
|
|
3083
3202
|
checkButton.classList.add('lido-disable-check-button');
|
|
@@ -3088,20 +3207,18 @@ function addClickListenerForClickType(element) {
|
|
|
3088
3207
|
element.classList.add('lido-element-selected');
|
|
3089
3208
|
const valueToFind = element['value'];
|
|
3090
3209
|
const key = Object.keys(objective).find(key => objective[key] === valueToFind);
|
|
3091
|
-
let multiOptionScore =
|
|
3210
|
+
let multiOptionScore = buildDragSelectedMapFromDOM();
|
|
3092
3211
|
if (!key) {
|
|
3093
3212
|
multiOptionScore[objective.length + selectedValue.length] = [valueToFind];
|
|
3094
3213
|
}
|
|
3095
3214
|
else {
|
|
3096
3215
|
multiOptionScore[key] = [valueToFind];
|
|
3097
3216
|
}
|
|
3098
|
-
localStorage.setItem(DragSelectedMapKey, JSON.stringify(multiOptionScore));
|
|
3099
3217
|
const sortedKeys = Object.keys(multiOptionScore).sort((a, b) => parseInt(a) - parseInt(b));
|
|
3100
3218
|
const sortedValues = sortedKeys.reduce((acc, key) => acc.concat(multiOptionScore[key]), []);
|
|
3101
|
-
|
|
3219
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(sortedValues));
|
|
3102
3220
|
const isCorrect = objective.includes(element['value']);
|
|
3103
3221
|
dispatchClickEvent(element, isCorrect);
|
|
3104
|
-
AudioPlayer.getI().stop();
|
|
3105
3222
|
if (isCorrect) {
|
|
3106
3223
|
const onCorrect = element.getAttribute('onCorrect');
|
|
3107
3224
|
await executeActions(onCorrect, element);
|
|
@@ -3113,8 +3230,11 @@ function addClickListenerForClickType(element) {
|
|
|
3113
3230
|
}
|
|
3114
3231
|
storingEachActivityScore(isCorrect);
|
|
3115
3232
|
}
|
|
3116
|
-
|
|
3117
|
-
|
|
3233
|
+
const isInsideCalculator = element.closest('#lidoCalculator') !== null;
|
|
3234
|
+
if (!isInsideCalculator) {
|
|
3235
|
+
if (!showCheck && countPatternWords(objective) === countPatternWords(selectedValue)) {
|
|
3236
|
+
validateObjectiveStatus();
|
|
3237
|
+
}
|
|
3118
3238
|
}
|
|
3119
3239
|
};
|
|
3120
3240
|
element.addEventListener('click', onClick);
|
|
@@ -67932,7 +68052,431 @@ function calculateFill(input, currentFill = 0) {
|
|
|
67932
68052
|
return Math.max(0, Math.min(100, value));
|
|
67933
68053
|
}
|
|
67934
68054
|
|
|
68055
|
+
// Helper to animate and remove the active equation cell
|
|
68056
|
+
const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalculateTypes) => {
|
|
68057
|
+
return new Promise((resolve) => {
|
|
68058
|
+
const keyframes = `
|
|
68059
|
+
@keyframes widthDecrease {
|
|
68060
|
+
0% {
|
|
68061
|
+
background-color: ${activeCell.style.backgroundColor};
|
|
68062
|
+
height: ${activeCell.style.height};
|
|
68063
|
+
margin: ${activeCell.style.margin};
|
|
68064
|
+
${activeCell.innerHTML = ""}
|
|
68065
|
+
}
|
|
68066
|
+
100% { background-color: transparent; height: 0px; margin: 0px; }
|
|
68067
|
+
}`;
|
|
68068
|
+
const styleSheet = document.styleSheets[0];
|
|
68069
|
+
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
|
|
68070
|
+
activeCell.style.animation = `widthDecrease 0.1s`;
|
|
68071
|
+
activeCell.addEventListener('animationend', () => {
|
|
68072
|
+
activeCell.style.height = '0px';
|
|
68073
|
+
activeCell.style.margin = '0px';
|
|
68074
|
+
activeCell.style.backgroundColor = 'transparent';
|
|
68075
|
+
activeCell.remove();
|
|
68076
|
+
// Trigger next container if last cell
|
|
68077
|
+
if (allCalculateTypes.length === 1) {
|
|
68078
|
+
setTimeout(() => triggerNextContainer(), 2000);
|
|
68079
|
+
}
|
|
68080
|
+
resolve();
|
|
68081
|
+
});
|
|
68082
|
+
});
|
|
68083
|
+
};
|
|
68084
|
+
// Function: checks and animates equation when correct
|
|
68085
|
+
const checkEquationOfActiveCell = async (container) => {
|
|
68086
|
+
var _a;
|
|
68087
|
+
const calculatorValue = (_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value");
|
|
68088
|
+
const allCalculateTypes = document.querySelectorAll("[type='calculate']");
|
|
68089
|
+
const activeCell = allCalculateTypes[0];
|
|
68090
|
+
const activeCellValue = Number(activeCell["value"]);
|
|
68091
|
+
const calculteValue = Number(calculatorValue);
|
|
68092
|
+
if (!activeCell || calculteValue !== activeCellValue)
|
|
68093
|
+
return;
|
|
68094
|
+
const equation = activeCell["string"];
|
|
68095
|
+
// Replace equation after a short delay
|
|
68096
|
+
//await new Promise(r => setTimeout(r, 200));
|
|
68097
|
+
activeCell.innerHTML = equation.replaceAll("?", calculteValue);
|
|
68098
|
+
const element2 = container.querySelector("#dummy112");
|
|
68099
|
+
element2.innerHTML = activeCell.innerHTML;
|
|
68100
|
+
// Animate and clean up
|
|
68101
|
+
await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
|
|
68102
|
+
};
|
|
68103
|
+
// Function: handles equation check when clicked on OK
|
|
68104
|
+
let score = 0;
|
|
68105
|
+
const handleSolvedEquationSubmissionAndScoreUpdate = async () => {
|
|
68106
|
+
var _a;
|
|
68107
|
+
const container = document.getElementById('lido-container');
|
|
68108
|
+
const calculatorValue = (_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value");
|
|
68109
|
+
const allCalculateTypes = document.querySelectorAll("[type='calculate']");
|
|
68110
|
+
const activeCell = allCalculateTypes[0];
|
|
68111
|
+
const isContinueOnCorrect = container.getAttribute("is-continue-on-correct") === "true";
|
|
68112
|
+
const activeCellValue = Number(activeCell["value"]);
|
|
68113
|
+
const calculteValue = Number(calculatorValue);
|
|
68114
|
+
const element1 = container.querySelector("#dummy111");
|
|
68115
|
+
const element2 = container.querySelector("#dummy112");
|
|
68116
|
+
// PRACTICE MODE (continue only if correct)
|
|
68117
|
+
if (isContinueOnCorrect) {
|
|
68118
|
+
if (element2.innerHTML.length > 0 && activeCellValue === calculteValue) {
|
|
68119
|
+
element1.innerHTML = element2.innerHTML;
|
|
68120
|
+
}
|
|
68121
|
+
await checkEquationOfActiveCell(container);
|
|
68122
|
+
}
|
|
68123
|
+
// TEST MODE (store all, animate regardless of correctness)
|
|
68124
|
+
else {
|
|
68125
|
+
if (calculatorValue.length > 0) {
|
|
68126
|
+
if (calculatorValue === activeCell["value"]) {
|
|
68127
|
+
score++;
|
|
68128
|
+
console.log("SCOREEEE", score);
|
|
68129
|
+
}
|
|
68130
|
+
else {
|
|
68131
|
+
if (score > 0) {
|
|
68132
|
+
score--;
|
|
68133
|
+
}
|
|
68134
|
+
console.log("SCOREEEE", score);
|
|
68135
|
+
}
|
|
68136
|
+
if (element2.innerHTML.length > 0) {
|
|
68137
|
+
element1.innerHTML = element2.innerHTML;
|
|
68138
|
+
}
|
|
68139
|
+
const equation = activeCell["string"];
|
|
68140
|
+
// Replace value visually
|
|
68141
|
+
activeCell.innerHTML = equation.replaceAll("?", calculteValue);
|
|
68142
|
+
element2.innerHTML = activeCell.innerHTML;
|
|
68143
|
+
// Animate
|
|
68144
|
+
await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
|
|
68145
|
+
}
|
|
68146
|
+
}
|
|
68147
|
+
};
|
|
68148
|
+
|
|
68149
|
+
function handlingMatrix(element) {
|
|
68150
|
+
const container = document.querySelector(LidoContainer);
|
|
68151
|
+
if (!container)
|
|
68152
|
+
return;
|
|
68153
|
+
const defualtMatrix = element;
|
|
68154
|
+
adjustSizeForSlots(container, defualtMatrix);
|
|
68155
|
+
splitSlots(container, defualtMatrix);
|
|
68156
|
+
}
|
|
68157
|
+
const splitSlots = (container, defualtMatrix) => {
|
|
68158
|
+
const defualtElements = defualtMatrix.querySelectorAll('.slot');
|
|
68159
|
+
const allDropMatrixes = container.querySelectorAll('lido-math-matrix[type="drop"]');
|
|
68160
|
+
const allDragMatrixes = container.querySelectorAll('lido-math-matrix[type="drag"]');
|
|
68161
|
+
let slot = 1;
|
|
68162
|
+
for (let i = 0; i < allDropMatrixes.length; i++) {
|
|
68163
|
+
const el = allDropMatrixes[i];
|
|
68164
|
+
const rowCount = el.getAttribute('rows') ? parseInt(el.getAttribute('rows')) : 1;
|
|
68165
|
+
const colCount = el.getAttribute('cols') ? parseInt(el.getAttribute('cols')) : 1;
|
|
68166
|
+
if (rowCount === 1 || colCount === 1) {
|
|
68167
|
+
if (rowCount === colCount) {
|
|
68168
|
+
const numbers = Array.from({ length: 100 }, (_, i) => i + 1)
|
|
68169
|
+
.sort(() => Math.random() - 0.5) // Shuffle
|
|
68170
|
+
.slice(0, 10); // Take first 10 unique numbers
|
|
68171
|
+
allDropMatrixes.forEach((item, index) => {
|
|
68172
|
+
const dropElement = item;
|
|
68173
|
+
const dropPosition = defualtElements[numbers[index]];
|
|
68174
|
+
// Safeguard if index > available numbers
|
|
68175
|
+
if (!dropPosition)
|
|
68176
|
+
return;
|
|
68177
|
+
postioningDropElement(dropElement, dropPosition);
|
|
68178
|
+
const dragElement = allDragMatrixes[index];
|
|
68179
|
+
dragElement.setAttribute('text', (numbers[index] + 1).toString());
|
|
68180
|
+
});
|
|
68181
|
+
// return;
|
|
68182
|
+
}
|
|
68183
|
+
if (rowCount === 2 && colCount === 1) {
|
|
68184
|
+
const pairs = generateDoubleSquares(10);
|
|
68185
|
+
console.log('pairs double : ', pairs);
|
|
68186
|
+
allDropMatrixes.forEach((item, index) => {
|
|
68187
|
+
const dropElement = item;
|
|
68188
|
+
const dropPosition = defualtElements[pairs[index][0] - 1];
|
|
68189
|
+
postioningDropElement(dropElement, dropPosition);
|
|
68190
|
+
});
|
|
68191
|
+
allDragMatrixes.forEach((item, index) => {
|
|
68192
|
+
const dragElement = item;
|
|
68193
|
+
dragElement.setAttribute('text', pairs[index].toString());
|
|
68194
|
+
});
|
|
68195
|
+
break;
|
|
68196
|
+
}
|
|
68197
|
+
if (rowCount === 5) {
|
|
68198
|
+
const dropPositionElements = generateHalfHorizontalStripes(i);
|
|
68199
|
+
const dropPosition = defualtElements[dropPositionElements[0] - 1];
|
|
68200
|
+
const dragElement = allDragMatrixes[i];
|
|
68201
|
+
dragElement.setAttribute('text', dropPositionElements.toString());
|
|
68202
|
+
postioningDropElement(el, dropPosition);
|
|
68203
|
+
}
|
|
68204
|
+
if (rowCount === 10) {
|
|
68205
|
+
const dropPosition = defualtElements[slot];
|
|
68206
|
+
const dragElement = allDragMatrixes[i];
|
|
68207
|
+
dragElement.setAttribute('text', Array.from({ length: 10 }, (_, i) => slot + 1 + i * 10).toString());
|
|
68208
|
+
postioningDropElement(el, dropPosition);
|
|
68209
|
+
slot = slot + 2;
|
|
68210
|
+
}
|
|
68211
|
+
else if (colCount === 10) {
|
|
68212
|
+
const dropPosition = defualtElements[10 + (slot - 1)];
|
|
68213
|
+
const dragElement = allDragMatrixes[i];
|
|
68214
|
+
dragElement.setAttribute('text', Array.from({ length: 10 }, (_, i) => i + 10 + slot).toString());
|
|
68215
|
+
postioningDropElement(el, dropPosition);
|
|
68216
|
+
slot = slot + 20;
|
|
68217
|
+
}
|
|
68218
|
+
}
|
|
68219
|
+
else if (rowCount === 3 || colCount === 3) {
|
|
68220
|
+
const slotCell = generateSlotsFromDrops(container);
|
|
68221
|
+
const cellNumbers = Object.keys(slotCell).map(key => slotCell[key].cells);
|
|
68222
|
+
allDragMatrixes.forEach((matrix, index) => {
|
|
68223
|
+
const dragElement = matrix;
|
|
68224
|
+
// let dragTextAttr = dragElement.getAttribute('text');
|
|
68225
|
+
if (dragElement) {
|
|
68226
|
+
dragElement.setAttribute('text', cellNumbers[index].toString());
|
|
68227
|
+
}
|
|
68228
|
+
});
|
|
68229
|
+
allDropMatrixes.forEach((matrix, index) => {
|
|
68230
|
+
const dropElement = matrix;
|
|
68231
|
+
const dropPosition = defualtElements[slotCell[`slot-${index + 1}`].cells[0] - 1];
|
|
68232
|
+
postioningDropElement(dropElement, dropPosition);
|
|
68233
|
+
});
|
|
68234
|
+
break; // stops the loop immediately
|
|
68235
|
+
}
|
|
68236
|
+
else if (rowCount === 2 || colCount === 2) {
|
|
68237
|
+
if (rowCount === colCount) {
|
|
68238
|
+
const pairs = generate2by2Squares(10);
|
|
68239
|
+
allDropMatrixes.forEach((item, index) => {
|
|
68240
|
+
const dropElement = item;
|
|
68241
|
+
const dropPosition = defualtElements[pairs[index][0] - 1];
|
|
68242
|
+
postioningDropElement(dropElement, dropPosition);
|
|
68243
|
+
});
|
|
68244
|
+
allDragMatrixes.forEach((item, index) => {
|
|
68245
|
+
const dragElement = item;
|
|
68246
|
+
dragElement.setAttribute('text', pairs[index].toString());
|
|
68247
|
+
});
|
|
68248
|
+
break;
|
|
68249
|
+
}
|
|
68250
|
+
}
|
|
68251
|
+
}
|
|
68252
|
+
};
|
|
68253
|
+
function generateSlotsFromDrops(container) {
|
|
68254
|
+
const gridSize = 10;
|
|
68255
|
+
let availableCells = Array.from({ length: 100 }, (_, i) => i + 1);
|
|
68256
|
+
const occupied = new Set();
|
|
68257
|
+
const slots = {};
|
|
68258
|
+
let generated = 0;
|
|
68259
|
+
const getCell = (row, col) => row * gridSize + col + 1;
|
|
68260
|
+
// Get all <lido-math-matrix type="drop">
|
|
68261
|
+
const allDropMatrixes = container.querySelectorAll('lido-math-matrix[type="drop"]');
|
|
68262
|
+
for (const matrix of Array.from(allDropMatrixes)) {
|
|
68263
|
+
const width = parseInt(matrix.getAttribute('cols') || '1');
|
|
68264
|
+
const height = parseInt(matrix.getAttribute('rows') || '1');
|
|
68265
|
+
const possiblePositions = [];
|
|
68266
|
+
// generate all possible top-left positions
|
|
68267
|
+
for (let row = 0; row <= gridSize - height; row++) {
|
|
68268
|
+
for (let col = 0; col <= gridSize - width; col++) {
|
|
68269
|
+
const cells = [];
|
|
68270
|
+
let canPlace = true;
|
|
68271
|
+
for (let r = 0; r < height; r++) {
|
|
68272
|
+
for (let c = 0; c < width; c++) {
|
|
68273
|
+
const cell = getCell(row + r, col + c);
|
|
68274
|
+
if (occupied.has(cell)) {
|
|
68275
|
+
canPlace = false;
|
|
68276
|
+
break;
|
|
68277
|
+
}
|
|
68278
|
+
cells.push(cell);
|
|
68279
|
+
}
|
|
68280
|
+
if (!canPlace)
|
|
68281
|
+
break;
|
|
68282
|
+
}
|
|
68283
|
+
if (canPlace)
|
|
68284
|
+
possiblePositions.push(cells);
|
|
68285
|
+
}
|
|
68286
|
+
}
|
|
68287
|
+
if (possiblePositions.length === 0) {
|
|
68288
|
+
console.warn(`No space left for matrix ${generated + 1}`);
|
|
68289
|
+
continue;
|
|
68290
|
+
}
|
|
68291
|
+
// Pick a random valid position
|
|
68292
|
+
const randomCells = possiblePositions[Math.floor(Math.random() * possiblePositions.length)];
|
|
68293
|
+
// Mark as occupied & remove from available
|
|
68294
|
+
randomCells.forEach(c => {
|
|
68295
|
+
occupied.add(c);
|
|
68296
|
+
availableCells = availableCells.filter(x => x !== c);
|
|
68297
|
+
});
|
|
68298
|
+
generated++;
|
|
68299
|
+
slots[`slot-${generated}`] = { cells: randomCells, width, height };
|
|
68300
|
+
}
|
|
68301
|
+
return slots;
|
|
68302
|
+
}
|
|
68303
|
+
const postioningDropElement = (dropElement, dropPosition) => {
|
|
68304
|
+
const container = document.getElementById(LidoContainer);
|
|
68305
|
+
const containerScale = getElementScale$1(container);
|
|
68306
|
+
dropElement.style.transform = 'translate(0,0)';
|
|
68307
|
+
const posRect = dropPosition.getBoundingClientRect();
|
|
68308
|
+
const dropRect = dropElement.getBoundingClientRect();
|
|
68309
|
+
const posCenterX = posRect.left + posRect.width / 2;
|
|
68310
|
+
const posCenterY = posRect.top + posRect.height / 2;
|
|
68311
|
+
const dropCenterX = dropRect.left + dropRect.width / 2;
|
|
68312
|
+
const dropCenterY = dropRect.top + dropRect.height / 2;
|
|
68313
|
+
const scaledLeft = (posCenterX - dropCenterX) / containerScale;
|
|
68314
|
+
const scaledTop = (posCenterY - dropCenterY) / containerScale;
|
|
68315
|
+
const rowCount = dropElement.getAttribute('rows') ? parseInt(dropElement.getAttribute('rows')) : 1;
|
|
68316
|
+
const colCount = dropElement.getAttribute('cols') ? parseInt(dropElement.getAttribute('cols')) : 1;
|
|
68317
|
+
const elementWidth = parseInt(dropPosition.style.width);
|
|
68318
|
+
if (rowCount === 1 || colCount === 1) {
|
|
68319
|
+
if (rowCount === colCount) {
|
|
68320
|
+
dropElement.style.transform = `translate(${scaledLeft}px, ${scaledTop}px)`;
|
|
68321
|
+
return;
|
|
68322
|
+
}
|
|
68323
|
+
else if (rowCount > colCount) {
|
|
68324
|
+
if (rowCount === 10) {
|
|
68325
|
+
dropElement.style.transform = `translate(${scaledLeft + (elementWidth * 4 + elementWidth / 2)}px, ${scaledTop}px)`;
|
|
68326
|
+
}
|
|
68327
|
+
else if (rowCount === 5) {
|
|
68328
|
+
dropElement.style.transform = `translate(${scaledLeft + elementWidth * 2}px, ${scaledTop}px)`;
|
|
68329
|
+
}
|
|
68330
|
+
else if (rowCount === 2) {
|
|
68331
|
+
dropElement.style.transform = `translate(${scaledLeft + elementWidth / 2}px, ${scaledTop}px)`;
|
|
68332
|
+
}
|
|
68333
|
+
}
|
|
68334
|
+
else if (rowCount < colCount) {
|
|
68335
|
+
if (colCount === 10) {
|
|
68336
|
+
dropElement.style.transform = `translate(${scaledLeft}px, ${scaledTop + elementWidth * 4 + elementWidth * 0.2 + elementWidth / 2}px)`;
|
|
68337
|
+
}
|
|
68338
|
+
else if (colCount === 5) {
|
|
68339
|
+
dropElement.style.transform = `translate(${scaledLeft}px, ${scaledTop + elementWidth * 2 + elementWidth * 0.0921}px)`;
|
|
68340
|
+
}
|
|
68341
|
+
}
|
|
68342
|
+
return;
|
|
68343
|
+
}
|
|
68344
|
+
if (rowCount === colCount) {
|
|
68345
|
+
if (rowCount === 2) {
|
|
68346
|
+
dropElement.style.transform = `translate(${scaledLeft + elementWidth / 2}px, ${scaledTop + elementWidth / 2 + 4}px)`;
|
|
68347
|
+
return;
|
|
68348
|
+
}
|
|
68349
|
+
dropElement.style.transform = `translate(${scaledLeft + elementWidth}px, ${scaledTop + elementWidth + 4}px)`;
|
|
68350
|
+
return;
|
|
68351
|
+
}
|
|
68352
|
+
if (rowCount === 3) {
|
|
68353
|
+
if (colCount === 2) {
|
|
68354
|
+
dropElement.style.transform = `translate(${scaledLeft + elementWidth}px, ${scaledTop + elementWidth / 2 + 4}px)`;
|
|
68355
|
+
return;
|
|
68356
|
+
}
|
|
68357
|
+
else if (colCount === 1) {
|
|
68358
|
+
dropElement.style.transform = `translate(${scaledLeft + elementWidth}px, ${scaledTop}px)`;
|
|
68359
|
+
return;
|
|
68360
|
+
}
|
|
68361
|
+
}
|
|
68362
|
+
if (rowCount === 2) {
|
|
68363
|
+
if (colCount === 3) {
|
|
68364
|
+
dropElement.style.transform = `translate(${scaledLeft + elementWidth / 2}px, ${scaledTop + elementWidth + 4}px)`;
|
|
68365
|
+
return;
|
|
68366
|
+
}
|
|
68367
|
+
else if (colCount === 1) {
|
|
68368
|
+
dropElement.style.transform = `translate(${scaledLeft + elementWidth / 2}px, ${scaledTop}px)`;
|
|
68369
|
+
return;
|
|
68370
|
+
}
|
|
68371
|
+
}
|
|
68372
|
+
};
|
|
68373
|
+
const adjustSizeForSlots = (container, defualtMatrix) => {
|
|
68374
|
+
const defualtElement = defualtMatrix.querySelector('.slot');
|
|
68375
|
+
const width = defualtElement.style.width;
|
|
68376
|
+
const allDropMatrixes = container.querySelectorAll('lido-math-matrix[type="drop"]');
|
|
68377
|
+
const allDragMatrixes = container.querySelectorAll('lido-math-matrix[type="drag"]');
|
|
68378
|
+
allDragMatrixes.forEach(item => {
|
|
68379
|
+
const el = item;
|
|
68380
|
+
Array.from(el.querySelectorAll('.slot')).forEach(slot => {
|
|
68381
|
+
const slotEl = slot;
|
|
68382
|
+
slotEl.parentElement.style.width = width;
|
|
68383
|
+
slotEl.style.width = width;
|
|
68384
|
+
slotEl.style.height = width;
|
|
68385
|
+
});
|
|
68386
|
+
});
|
|
68387
|
+
allDropMatrixes.forEach(item => {
|
|
68388
|
+
const el = item;
|
|
68389
|
+
Array.from(el.querySelectorAll('.slot')).forEach(slot => {
|
|
68390
|
+
const slotEl = slot;
|
|
68391
|
+
slotEl.parentElement.style.width = width;
|
|
68392
|
+
slotEl.style.width = width;
|
|
68393
|
+
slotEl.style.height = width;
|
|
68394
|
+
});
|
|
68395
|
+
});
|
|
68396
|
+
};
|
|
68397
|
+
function generateHalfHorizontalStripes(index) {
|
|
68398
|
+
const numbers = Array.from({ length: 10 }, (_, i) => index + 1 + i * 10);
|
|
68399
|
+
const randomPlace = Math.floor(Math.random() * 6);
|
|
68400
|
+
const startSlot = numbers[randomPlace];
|
|
68401
|
+
console.log('kedachuruchu', Array.from({ length: 5 }, (_, i) => startSlot + i * 10));
|
|
68402
|
+
return Array.from({ length: 5 }, (_, i) => startSlot + i * 10);
|
|
68403
|
+
}
|
|
68404
|
+
function generate2by2Squares(count = 16) {
|
|
68405
|
+
const gridSize = 10;
|
|
68406
|
+
const squares = [];
|
|
68407
|
+
const usedCells = new Set();
|
|
68408
|
+
function getCell(row, col) {
|
|
68409
|
+
return (row - 1) * gridSize + col;
|
|
68410
|
+
}
|
|
68411
|
+
while (squares.length < count) {
|
|
68412
|
+
const row = Math.floor(Math.random() * (gridSize - 1)) + 1; // 1–9
|
|
68413
|
+
const col = Math.floor(Math.random() * (gridSize - 1)) + 1; // 1–9
|
|
68414
|
+
const square = [getCell(row, col), getCell(row, col + 1), getCell(row + 1, col), getCell(row + 1, col + 1)];
|
|
68415
|
+
// Skip if overlapping with previous
|
|
68416
|
+
if (square.some(cell => usedCells.has(cell)))
|
|
68417
|
+
continue;
|
|
68418
|
+
// Mark cells as used
|
|
68419
|
+
square.forEach(cell => usedCells.add(cell));
|
|
68420
|
+
squares.push(square);
|
|
68421
|
+
}
|
|
68422
|
+
return squares;
|
|
68423
|
+
}
|
|
68424
|
+
function generateDoubleSquares(count = 16) {
|
|
68425
|
+
const gridSize = 10;
|
|
68426
|
+
const pairs = [];
|
|
68427
|
+
const usedCells = new Set();
|
|
68428
|
+
function getCell(row, col) {
|
|
68429
|
+
return (row - 1) * gridSize + col;
|
|
68430
|
+
}
|
|
68431
|
+
while (pairs.length < count) {
|
|
68432
|
+
const row = Math.floor(Math.random() * (gridSize - 1)) + 1; // 1–9
|
|
68433
|
+
const col = Math.floor(Math.random() * gridSize) + 1; // 1–10
|
|
68434
|
+
const top = getCell(row, col);
|
|
68435
|
+
const bottom = getCell(row + 1, col);
|
|
68436
|
+
// Skip if already used
|
|
68437
|
+
if (usedCells.has(top) || usedCells.has(bottom))
|
|
68438
|
+
continue;
|
|
68439
|
+
pairs.push([top, bottom]);
|
|
68440
|
+
usedCells.add(top);
|
|
68441
|
+
usedCells.add(bottom);
|
|
68442
|
+
}
|
|
68443
|
+
return pairs;
|
|
68444
|
+
}
|
|
68445
|
+
|
|
67935
68446
|
const gameScore = new GameScore();
|
|
68447
|
+
function buildDragSelectedMapFromDOM() {
|
|
68448
|
+
const map = {};
|
|
68449
|
+
const draggedEls = document.querySelectorAll(`[${DropToAttr}]`);
|
|
68450
|
+
draggedEls.forEach(dragEl => {
|
|
68451
|
+
var _a, _b, _c;
|
|
68452
|
+
const to = dragEl.getAttribute(DropToAttr);
|
|
68453
|
+
if (!to)
|
|
68454
|
+
return;
|
|
68455
|
+
const dropEl = document.getElementById(to);
|
|
68456
|
+
if (!dropEl)
|
|
68457
|
+
return;
|
|
68458
|
+
const tabIndex = (_a = dropEl.getAttribute('tab-index')) !== null && _a !== void 0 ? _a : to;
|
|
68459
|
+
if (!map[tabIndex])
|
|
68460
|
+
map[tabIndex] = [];
|
|
68461
|
+
const value = (_c = (_b = dragEl.getAttribute('value')) !== null && _b !== void 0 ? _b : dragEl.value) !== null && _c !== void 0 ? _c : '';
|
|
68462
|
+
map[tabIndex].push(value);
|
|
68463
|
+
});
|
|
68464
|
+
return map;
|
|
68465
|
+
}
|
|
68466
|
+
function getSortedValuesArrayFromMap(map) {
|
|
68467
|
+
const sortedKeys = Object.keys(map).sort((a, b) => parseInt(a) - parseInt(b));
|
|
68468
|
+
const sortedValues = sortedKeys.reduce((acc, key) => {
|
|
68469
|
+
const values = map[key];
|
|
68470
|
+
if (values.length > 1) {
|
|
68471
|
+
acc.push(`(${values.join('|')})`);
|
|
68472
|
+
}
|
|
68473
|
+
else {
|
|
68474
|
+
acc.push(values[0]);
|
|
68475
|
+
}
|
|
68476
|
+
return acc;
|
|
68477
|
+
}, []);
|
|
68478
|
+
return sortedValues;
|
|
68479
|
+
}
|
|
67936
68480
|
function format(first, middle, last) {
|
|
67937
68481
|
return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
|
|
67938
68482
|
}
|
|
@@ -67977,14 +68521,17 @@ const initEventsForElement = async (element, type) => {
|
|
|
67977
68521
|
enableOptionArea(element);
|
|
67978
68522
|
break;
|
|
67979
68523
|
}
|
|
68524
|
+
case 'checkerBlock': {
|
|
68525
|
+
handlingMatrix(element);
|
|
68526
|
+
break;
|
|
68527
|
+
}
|
|
67980
68528
|
}
|
|
67981
68529
|
onTouchListenerForOnTouch(element);
|
|
67982
68530
|
};
|
|
67983
68531
|
// Function to execute actions parsed from the onMatch string
|
|
67984
68532
|
const executeActions = async (actionsString, thisElement, element) => {
|
|
67985
|
-
var _a;
|
|
68533
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
67986
68534
|
const actions = parseActions(actionsString);
|
|
67987
|
-
body.style.pointerEvents = 'none';
|
|
67988
68535
|
for (let i = 0; i < actions.length; i++) {
|
|
67989
68536
|
const action = actions[i];
|
|
67990
68537
|
const queriedElement = document.querySelector(action.actor);
|
|
@@ -67997,13 +68544,25 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
67997
68544
|
targetElement.style.transform = currentTransform !== 'none' ? `${currentTransform} ${action.value}` : action.value;
|
|
67998
68545
|
break;
|
|
67999
68546
|
}
|
|
68547
|
+
case 'revealImageValue': {
|
|
68548
|
+
if (targetElement) {
|
|
68549
|
+
revealImageValue(targetElement); // call your function here
|
|
68550
|
+
}
|
|
68551
|
+
break;
|
|
68552
|
+
}
|
|
68553
|
+
case 'scrollCellAfterEquationSolved': {
|
|
68554
|
+
if (targetElement) {
|
|
68555
|
+
handleSolvedEquationSubmissionAndScoreUpdate();
|
|
68556
|
+
}
|
|
68557
|
+
break;
|
|
68558
|
+
}
|
|
68000
68559
|
case 'alignMatch': {
|
|
68001
68560
|
const dropElement = targetElement;
|
|
68002
68561
|
const dragElement = element;
|
|
68003
68562
|
const container = document.getElementById(LidoContainer);
|
|
68004
68563
|
const containerScale = getElementScale$1(container);
|
|
68005
68564
|
dragElement.style.transform = 'translate(0,0)';
|
|
68006
|
-
console.log(
|
|
68565
|
+
console.log("logg alinmatch");
|
|
68007
68566
|
const dropRect = dropElement.getBoundingClientRect();
|
|
68008
68567
|
const dragRect = dragElement.getBoundingClientRect();
|
|
68009
68568
|
const dropCenterX = dropRect.left + dropRect.width / 2;
|
|
@@ -68049,7 +68608,7 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
68049
68608
|
if (container.getAttribute('is-continue-on-correct') !== 'true') {
|
|
68050
68609
|
targetElement.style.pointerEvents = 'none';
|
|
68051
68610
|
}
|
|
68052
|
-
|
|
68611
|
+
validateObjectiveStatus();
|
|
68053
68612
|
break;
|
|
68054
68613
|
}
|
|
68055
68614
|
case 'prevBtn': {
|
|
@@ -68089,10 +68648,76 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
68089
68648
|
}
|
|
68090
68649
|
break;
|
|
68091
68650
|
}
|
|
68651
|
+
case 'highlightStarsAndDisapper': {
|
|
68652
|
+
const value = action.value;
|
|
68653
|
+
if (value && targetElement) {
|
|
68654
|
+
console.log('highlightStar action triggered');
|
|
68655
|
+
console.log('Target Element:', targetElement);
|
|
68656
|
+
await HighlightStarsOneByOne(targetElement, value);
|
|
68657
|
+
}
|
|
68658
|
+
break;
|
|
68659
|
+
}
|
|
68660
|
+
case 'boxAnimationOneByOne': {
|
|
68661
|
+
const value = action.value;
|
|
68662
|
+
if (value && targetElement) {
|
|
68663
|
+
await animateBoxCells(targetElement, value);
|
|
68664
|
+
}
|
|
68665
|
+
break;
|
|
68666
|
+
}
|
|
68667
|
+
case 'questionBoxAnimate': {
|
|
68668
|
+
const value = action.value;
|
|
68669
|
+
if (value && targetElement) {
|
|
68670
|
+
await questionBoxAnimation(targetElement, value);
|
|
68671
|
+
}
|
|
68672
|
+
break;
|
|
68673
|
+
}
|
|
68092
68674
|
case 'slideAnimation': {
|
|
68093
68675
|
slideAnimation();
|
|
68094
68676
|
break;
|
|
68095
68677
|
}
|
|
68678
|
+
case 'showBalanceSymbol': {
|
|
68679
|
+
const balanceEl = document.querySelector('lido-balance');
|
|
68680
|
+
if (!balanceEl)
|
|
68681
|
+
break;
|
|
68682
|
+
const leftVal = Number((_b = balanceEl.leftVal) !== null && _b !== void 0 ? _b : Number((_d = (_c = balanceEl.dataset) === null || _c === void 0 ? void 0 : _c.leftVal) !== null && _d !== void 0 ? _d : 0));
|
|
68683
|
+
const rightVal = Number((_e = balanceEl.rightVal) !== null && _e !== void 0 ? _e : Number((_g = (_f = balanceEl.dataset) === null || _f === void 0 ? void 0 : _f.rightVal) !== null && _g !== void 0 ? _g : 0));
|
|
68684
|
+
const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
|
|
68685
|
+
balanceEl.balanceSymbol = symbol;
|
|
68686
|
+
balanceEl.dataset.balanceSymbol = symbol;
|
|
68687
|
+
if (balanceEl.revealSymbol) {
|
|
68688
|
+
await balanceEl.revealSymbol();
|
|
68689
|
+
}
|
|
68690
|
+
else {
|
|
68691
|
+
balanceEl.showSymbol = true;
|
|
68692
|
+
}
|
|
68693
|
+
break;
|
|
68694
|
+
}
|
|
68695
|
+
case 'hideBalanceSymbol': {
|
|
68696
|
+
const balanceEl = document.querySelector('lido-balance');
|
|
68697
|
+
if (!balanceEl)
|
|
68698
|
+
break;
|
|
68699
|
+
if (balanceEl.hideSymbol) {
|
|
68700
|
+
await balanceEl.hideSymbol();
|
|
68701
|
+
}
|
|
68702
|
+
else {
|
|
68703
|
+
balanceEl.showSymbol = false;
|
|
68704
|
+
}
|
|
68705
|
+
break;
|
|
68706
|
+
}
|
|
68707
|
+
case 'sumTogetherAnimation': {
|
|
68708
|
+
const value = action.value;
|
|
68709
|
+
if (value) {
|
|
68710
|
+
SumTogetherAnimation(targetElement, value);
|
|
68711
|
+
}
|
|
68712
|
+
break;
|
|
68713
|
+
}
|
|
68714
|
+
case 'addText': {
|
|
68715
|
+
const value = action.value;
|
|
68716
|
+
if (value) {
|
|
68717
|
+
targetElement.textContent += value;
|
|
68718
|
+
}
|
|
68719
|
+
break;
|
|
68720
|
+
}
|
|
68096
68721
|
default: {
|
|
68097
68722
|
targetElement.style[action.action] = action.value;
|
|
68098
68723
|
break;
|
|
@@ -68100,7 +68725,6 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
68100
68725
|
}
|
|
68101
68726
|
}
|
|
68102
68727
|
}
|
|
68103
|
-
body.style.pointerEvents = 'auto';
|
|
68104
68728
|
};
|
|
68105
68729
|
const afterDropDragHandling = (dragElement, dropElement) => {
|
|
68106
68730
|
const container = document.getElementById(LidoContainer);
|
|
@@ -68191,6 +68815,9 @@ const matchStringPattern = (pattern, arr) => {
|
|
|
68191
68815
|
const patternGroups = pattern.split(',').map(group => group.trim());
|
|
68192
68816
|
let arrIndex = 0;
|
|
68193
68817
|
let options = new Set();
|
|
68818
|
+
if (patternGroups.length == 0) { // If pattern is empty
|
|
68819
|
+
return true;
|
|
68820
|
+
}
|
|
68194
68821
|
if (patternGroups.length > 0) {
|
|
68195
68822
|
if (arr.length === 0)
|
|
68196
68823
|
return false; // If pattern is not empty but user provided array is empty, return false
|
|
@@ -68275,38 +68902,36 @@ const calculateScore = () => {
|
|
|
68275
68902
|
gameScore.wrongMoves = 0;
|
|
68276
68903
|
};
|
|
68277
68904
|
async function onActivityComplete(dragElement, dropElement) {
|
|
68278
|
-
var _a
|
|
68905
|
+
var _a;
|
|
68279
68906
|
const container = document.getElementById(LidoContainer);
|
|
68280
68907
|
if (!container)
|
|
68281
68908
|
return;
|
|
68282
68909
|
await executeActions("this.alignMatch='true'", dropElement, dragElement);
|
|
68283
|
-
|
|
68284
|
-
|
|
68285
|
-
|
|
68286
|
-
|
|
68910
|
+
if (dragElement && dropElement) {
|
|
68911
|
+
const isCorrect = dropElement['value'].toLowerCase().includes(dragElement['value'].toLowerCase());
|
|
68912
|
+
if (isCorrect) {
|
|
68913
|
+
const onCorrect = dropElement.getAttribute('onCorrect');
|
|
68914
|
+
if (onCorrect) {
|
|
68915
|
+
await executeActions(onCorrect, dropElement, dragElement);
|
|
68916
|
+
}
|
|
68917
|
+
}
|
|
68918
|
+
else {
|
|
68919
|
+
const onInCorrect = dropElement.getAttribute('onInCorrect');
|
|
68920
|
+
await executeActions(onInCorrect, dropElement, dragElement);
|
|
68921
|
+
}
|
|
68287
68922
|
}
|
|
68288
|
-
dragScore
|
|
68289
|
-
|
|
68923
|
+
let dragScore = buildDragSelectedMapFromDOM();
|
|
68924
|
+
const sortedValues = getSortedValuesArrayFromMap(dragScore);
|
|
68925
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(sortedValues));
|
|
68290
68926
|
//localStorage
|
|
68291
|
-
let drag = JSON.parse((
|
|
68927
|
+
let drag = JSON.parse((_a = localStorage.getItem(DragMapKey)) !== null && _a !== void 0 ? _a : '{}');
|
|
68292
68928
|
const index = dropElement.getAttribute('tab-index');
|
|
68293
68929
|
if (!drag[index]) {
|
|
68294
68930
|
drag[index] = [];
|
|
68295
68931
|
}
|
|
68296
68932
|
drag[index].push(dragElement.id);
|
|
68297
68933
|
// localStorage.setItem(DragMapKey, JSON.stringify(drag));
|
|
68298
|
-
|
|
68299
|
-
const sortedValues = sortedKeys.reduce((acc, key) => {
|
|
68300
|
-
const values = dragScore[key];
|
|
68301
|
-
if (values.length > 1) {
|
|
68302
|
-
acc.push(`(${values.join('|')})`);
|
|
68303
|
-
}
|
|
68304
|
-
else {
|
|
68305
|
-
acc.push(values[0]);
|
|
68306
|
-
}
|
|
68307
|
-
return acc;
|
|
68308
|
-
}, []);
|
|
68309
|
-
localStorage.setItem(SelectedValuesKey, JSON.stringify(sortedValues));
|
|
68934
|
+
Object.keys(dragScore).sort((a, b) => parseInt(a) - parseInt(b));
|
|
68310
68935
|
if (dragElement && dropElement) {
|
|
68311
68936
|
const isCorrect = dropElement['value'].toLowerCase().includes(dragElement['value'].toLowerCase());
|
|
68312
68937
|
if (isCorrect) {
|
|
@@ -68323,8 +68948,7 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
68323
68948
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
68324
68949
|
allElements.forEach(otherElement => {
|
|
68325
68950
|
var _a;
|
|
68326
|
-
const
|
|
68327
|
-
const storedTabIndexes = Object.keys(dropObject).map(Number);
|
|
68951
|
+
const storedTabIndexes = Object.keys(dragScore).map(Number);
|
|
68328
68952
|
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
68329
68953
|
if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
|
|
68330
68954
|
if (otherElement.tagName.toLowerCase() === 'lido-text') {
|
|
@@ -68376,77 +69000,97 @@ const handleShowCheck = () => {
|
|
|
68376
69000
|
var _a, _b;
|
|
68377
69001
|
const container = document.getElementById(LidoContainer);
|
|
68378
69002
|
const objectiveString = container['objective'];
|
|
68379
|
-
const selectValues = (_a =
|
|
69003
|
+
const selectValues = (_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '';
|
|
68380
69004
|
const checkButton = document.querySelector('#lido-checkButton');
|
|
68381
|
-
if (!selectValues || countPatternWords(selectValues)
|
|
69005
|
+
if (!selectValues || countPatternWords(selectValues) < countPatternWords(objectiveString)) {
|
|
68382
69006
|
executeActions("this.addClass='lido-disable-check-button'", checkButton);
|
|
68383
69007
|
return;
|
|
68384
69008
|
}
|
|
68385
69009
|
const showCheck = container.getAttribute('show-check') == 'true';
|
|
68386
69010
|
if (showCheck) {
|
|
68387
69011
|
(_b = checkButton === null || checkButton === void 0 ? void 0 : checkButton.classList) === null || _b === void 0 ? void 0 : _b.remove('lido-disable-check-button');
|
|
69012
|
+
const balanceEl = document.querySelector('lido-balance');
|
|
69013
|
+
if (balanceEl) {
|
|
69014
|
+
if (!checkButton.hasAttribute('data-balance-listener')) {
|
|
69015
|
+
checkButton.addEventListener('click', async function onClick() {
|
|
69016
|
+
if (balanceResult && res) {
|
|
69017
|
+
await executeActions("this.showBalanceSymbol='true'", checkButton);
|
|
69018
|
+
checkButton.removeEventListener('click', onClick);
|
|
69019
|
+
}
|
|
69020
|
+
});
|
|
69021
|
+
checkButton.setAttribute('data-balance-listener', 'true');
|
|
69022
|
+
}
|
|
69023
|
+
}
|
|
68388
69024
|
}
|
|
68389
69025
|
else {
|
|
68390
69026
|
validateObjectiveStatus();
|
|
68391
69027
|
}
|
|
68392
69028
|
};
|
|
68393
|
-
|
|
69029
|
+
let res;
|
|
68394
69030
|
const validateObjectiveStatus = async () => {
|
|
68395
|
-
var _a;
|
|
69031
|
+
var _a, _b;
|
|
68396
69032
|
const container = document.getElementById(LidoContainer);
|
|
68397
69033
|
if (!container)
|
|
68398
69034
|
return;
|
|
68399
69035
|
const objectiveString = container['objective'];
|
|
69036
|
+
const additionalCheck = container.getAttribute('equationCheck');
|
|
69037
|
+
console.log('🚀 ~ validateObjectiveStatus ~ additionalCheck:', additionalCheck);
|
|
69038
|
+
let equationGiven = false;
|
|
68400
69039
|
if (objectiveString == null || objectiveString.length === 0) {
|
|
68401
|
-
|
|
68402
|
-
|
|
68403
|
-
|
|
68404
|
-
|
|
69040
|
+
if (additionalCheck) {
|
|
69041
|
+
equationGiven = true;
|
|
69042
|
+
}
|
|
69043
|
+
if (!equationGiven) {
|
|
69044
|
+
const onCorrect = container.getAttribute('onCorrect');
|
|
69045
|
+
if (onCorrect) {
|
|
69046
|
+
await executeActions(onCorrect, container);
|
|
69047
|
+
}
|
|
69048
|
+
storeActivityScore(100);
|
|
69049
|
+
storingEachActivityScore(true);
|
|
69050
|
+
triggerNextContainer();
|
|
69051
|
+
return;
|
|
68405
69052
|
}
|
|
68406
|
-
storeActivityScore(100);
|
|
68407
|
-
storingEachActivityScore(true);
|
|
68408
|
-
triggerNextContainer();
|
|
68409
|
-
return;
|
|
68410
69053
|
}
|
|
68411
|
-
|
|
68412
|
-
|
|
68413
|
-
|
|
68414
|
-
|
|
68415
|
-
if (!!additionalCheck) {
|
|
69054
|
+
const objectiveArray = (_b = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]')) !== null && _b !== void 0 ? _b : [];
|
|
69055
|
+
if (!!additionalCheck) {
|
|
69056
|
+
const balanceEl = document.querySelector('lido-balance');
|
|
69057
|
+
if (!balanceEl) {
|
|
68416
69058
|
res = equationCheck(additionalCheck);
|
|
68417
|
-
console.log('🚀 ~ handleShowCheck ~ res:', res);
|
|
68418
69059
|
}
|
|
68419
69060
|
else {
|
|
68420
|
-
res =
|
|
69061
|
+
res = balanceResult(container, objectiveString);
|
|
68421
69062
|
}
|
|
68422
|
-
|
|
68423
|
-
|
|
68424
|
-
|
|
68425
|
-
|
|
68426
|
-
|
|
68427
|
-
|
|
68428
|
-
|
|
68429
|
-
|
|
68430
|
-
|
|
68431
|
-
|
|
68432
|
-
|
|
68433
|
-
setTimeout(() => {
|
|
68434
|
-
triggerNextContainer();
|
|
68435
|
-
}, 2000);
|
|
69063
|
+
console.log('🚀 ~ handleShowCheck ~ res:', res);
|
|
69064
|
+
}
|
|
69065
|
+
else {
|
|
69066
|
+
res = matchStringPattern(objectiveString, objectiveArray);
|
|
69067
|
+
}
|
|
69068
|
+
if (res) {
|
|
69069
|
+
const attach = container.getAttribute('appendToDropOnCompletion');
|
|
69070
|
+
const onCorrect = container.getAttribute('onCorrect');
|
|
69071
|
+
if (onCorrect) {
|
|
69072
|
+
if (attach === 'true') {
|
|
69073
|
+
appendingDragElementsInDrop();
|
|
68436
69074
|
}
|
|
68437
|
-
|
|
69075
|
+
await executeActions(onCorrect, container);
|
|
69076
|
+
}
|
|
69077
|
+
if (container.getAttribute('dropAttr') === 'EnableAnimation') {
|
|
69078
|
+
setTimeout(() => {
|
|
68438
69079
|
triggerNextContainer();
|
|
68439
|
-
}
|
|
68440
|
-
await calculateScore();
|
|
69080
|
+
}, 2000);
|
|
68441
69081
|
}
|
|
68442
69082
|
else {
|
|
68443
|
-
|
|
68444
|
-
|
|
68445
|
-
|
|
68446
|
-
|
|
68447
|
-
|
|
68448
|
-
|
|
68449
|
-
|
|
69083
|
+
triggerNextContainer();
|
|
69084
|
+
}
|
|
69085
|
+
await calculateScore();
|
|
69086
|
+
}
|
|
69087
|
+
else {
|
|
69088
|
+
const onInCorrect = container.getAttribute('onInCorrect');
|
|
69089
|
+
await executeActions(onInCorrect, container);
|
|
69090
|
+
const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
|
|
69091
|
+
if (!isContinueOnCorrect) {
|
|
69092
|
+
triggerNextContainer();
|
|
69093
|
+
await calculateScore();
|
|
68450
69094
|
}
|
|
68451
69095
|
}
|
|
68452
69096
|
};
|
|
@@ -68465,16 +69109,16 @@ const triggerPrevcontainer = () => {
|
|
|
68465
69109
|
function convertUrlToRelative(url) {
|
|
68466
69110
|
const container = document.getElementById(LidoContainer);
|
|
68467
69111
|
const baseUrl = container.getAttribute('baseUrl');
|
|
68468
|
-
if ((url === null || url === void 0 ? void 0 : url.startsWith('http')) || (url === null || url === void 0 ? void 0 : url.startsWith('blob'))
|
|
69112
|
+
if ((url === null || url === void 0 ? void 0 : url.startsWith('http')) || (url === null || url === void 0 ? void 0 : url.startsWith('blob'))) {
|
|
68469
69113
|
return url;
|
|
68470
69114
|
}
|
|
68471
|
-
if (baseUrl) {
|
|
68472
|
-
const newUrl = url.startsWith('/') ? url.
|
|
68473
|
-
|
|
68474
|
-
|
|
68475
|
-
|
|
69115
|
+
else if (baseUrl) {
|
|
69116
|
+
const newUrl = !url.startsWith('/') ? url : url.substring(1);
|
|
69117
|
+
return baseUrl + (baseUrl.endsWith('/') ? newUrl : '/' + newUrl);
|
|
69118
|
+
}
|
|
69119
|
+
else {
|
|
69120
|
+
return index$1.getAssetPath(url);
|
|
68476
69121
|
}
|
|
68477
|
-
return index$1.getAssetPath(url);
|
|
68478
69122
|
}
|
|
68479
69123
|
/**
|
|
68480
69124
|
* Asynchronously speaks the given text using the browser's text-to-speech API.
|
|
@@ -68663,7 +69307,10 @@ const equationCheck = (additionalCheck) => {
|
|
|
68663
69307
|
});
|
|
68664
69308
|
// 3. Join the modified parts back into one string
|
|
68665
69309
|
const resultString = modifiedParts.join('');
|
|
69310
|
+
console.log('🚀 ~ equationCheck ~ resultString:', resultString);
|
|
69311
|
+
// 4. Evaluate the final string as a mathematical expression
|
|
68666
69312
|
const finalRes = evaluate(resultString);
|
|
69313
|
+
console.log('🚀 ~ equationCheck ~ finalRes:', finalRes);
|
|
68667
69314
|
return finalRes;
|
|
68668
69315
|
};
|
|
68669
69316
|
const getElementsForQueries = (query) => {
|
|
@@ -68731,13 +69378,6 @@ const attachSpeakIcon = async (element) => {
|
|
|
68731
69378
|
}
|
|
68732
69379
|
element.appendChild(speakIconElement);
|
|
68733
69380
|
};
|
|
68734
|
-
const clearLocalStorage = () => {
|
|
68735
|
-
localStorage.removeItem(DragSelectedMapKey);
|
|
68736
|
-
localStorage.removeItem(DragMapKey);
|
|
68737
|
-
localStorage.removeItem(SelectedValuesKey);
|
|
68738
|
-
localStorage.removeItem(DropHasDrag);
|
|
68739
|
-
localStorage.removeItem(DropLength);
|
|
68740
|
-
};
|
|
68741
69381
|
/**
|
|
68742
69382
|
* Applies a delay to the element's visibility based on `delayVisible`.
|
|
68743
69383
|
*/
|
|
@@ -68823,6 +69463,230 @@ function generateUUIDFallback() {
|
|
|
68823
69463
|
return v.toString(16);
|
|
68824
69464
|
});
|
|
68825
69465
|
}
|
|
69466
|
+
const revealImageValue = (imageEl) => {
|
|
69467
|
+
if (!imageEl)
|
|
69468
|
+
return;
|
|
69469
|
+
const value = imageEl.getAttribute('value');
|
|
69470
|
+
if (!value)
|
|
69471
|
+
return;
|
|
69472
|
+
let valueElement = imageEl.querySelector('.lido-display-hiddenvalue');
|
|
69473
|
+
if (!valueElement) {
|
|
69474
|
+
valueElement = document.createElement('div');
|
|
69475
|
+
valueElement.classList.add('lido-display-hiddenvalue');
|
|
69476
|
+
imageEl.style.position = 'relative';
|
|
69477
|
+
imageEl.appendChild(valueElement);
|
|
69478
|
+
}
|
|
69479
|
+
valueElement.innerText = value;
|
|
69480
|
+
};
|
|
69481
|
+
const setImageBackground = (el, color) => {
|
|
69482
|
+
if (!el)
|
|
69483
|
+
return;
|
|
69484
|
+
el.classList.add('lido-image-colorize');
|
|
69485
|
+
const img = el.querySelector('img');
|
|
69486
|
+
if (img) {
|
|
69487
|
+
// use same image as mask
|
|
69488
|
+
el.style.setProperty('--mask-url', `url(${img.src})`);
|
|
69489
|
+
}
|
|
69490
|
+
if (color === 'red') {
|
|
69491
|
+
el.style.setProperty('--tint-color', '#ff0000');
|
|
69492
|
+
}
|
|
69493
|
+
else if (color === 'green') {
|
|
69494
|
+
el.style.setProperty('--tint-color', '#00c853');
|
|
69495
|
+
}
|
|
69496
|
+
else {
|
|
69497
|
+
el.style.removeProperty('--tint-color');
|
|
69498
|
+
el.style.removeProperty('--mask-url');
|
|
69499
|
+
}
|
|
69500
|
+
};
|
|
69501
|
+
const HighlightStarsOneByOne = async (element, value) => {
|
|
69502
|
+
if (!element)
|
|
69503
|
+
return;
|
|
69504
|
+
if (!value)
|
|
69505
|
+
return;
|
|
69506
|
+
// Dynamically find the parent row of stars
|
|
69507
|
+
const stars = Array.from(element.children);
|
|
69508
|
+
console.log('starRow', stars);
|
|
69509
|
+
for (const star of stars) {
|
|
69510
|
+
// Highlight the star
|
|
69511
|
+
star.classList.add('lido-glow');
|
|
69512
|
+
// Play star sound
|
|
69513
|
+
await AudioPlayer.getI().play(star);
|
|
69514
|
+
// Fade out the star (disappear)
|
|
69515
|
+
star.style.opacity = '0';
|
|
69516
|
+
star.style.visibility = 'hidden';
|
|
69517
|
+
await new Promise(resolve => setTimeout(resolve, 300)); // Wait for fade-out to complete
|
|
69518
|
+
// Remove the highlight
|
|
69519
|
+
star.classList.remove('lido-glow');
|
|
69520
|
+
}
|
|
69521
|
+
};
|
|
69522
|
+
const animateBoxCells = async (element, value) => {
|
|
69523
|
+
if (!element)
|
|
69524
|
+
return;
|
|
69525
|
+
if (!value)
|
|
69526
|
+
return;
|
|
69527
|
+
// Select all cells with the attribute type="box"
|
|
69528
|
+
const boxCells = Array.from(element.children);
|
|
69529
|
+
console.log('boxCells', boxCells);
|
|
69530
|
+
if (!boxCells)
|
|
69531
|
+
return;
|
|
69532
|
+
boxCells.forEach(cell => {
|
|
69533
|
+
// Reset any previous styles
|
|
69534
|
+
cell.style.visibility = 'hidden';
|
|
69535
|
+
});
|
|
69536
|
+
// Animate each cell one by one
|
|
69537
|
+
for (const cell of boxCells) {
|
|
69538
|
+
cell.style.visibility = 'visible';
|
|
69539
|
+
cell.style.opacity = '1';
|
|
69540
|
+
// Apply the "come from top" animation
|
|
69541
|
+
cell.classList.add('lido-box-highlight');
|
|
69542
|
+
// Delay for each cell to come one after another
|
|
69543
|
+
await new Promise(resolve => setTimeout(resolve, 600)); // Adjust delay as needed
|
|
69544
|
+
cell.classList.remove('lido-box-highlight');
|
|
69545
|
+
}
|
|
69546
|
+
// After all cells have come down, apply the bounce animation
|
|
69547
|
+
for (const cell of boxCells) {
|
|
69548
|
+
// play the text child inside cell
|
|
69549
|
+
await AudioPlayer.getI().play(cell);
|
|
69550
|
+
}
|
|
69551
|
+
};
|
|
69552
|
+
const questionBoxAnimation = async (element, value) => {
|
|
69553
|
+
if (!element)
|
|
69554
|
+
return;
|
|
69555
|
+
if (!value)
|
|
69556
|
+
return;
|
|
69557
|
+
// Select all drag elements and drop elements
|
|
69558
|
+
const dragElements = Array.from(element.querySelectorAll("[type='drag']"));
|
|
69559
|
+
// Ensure all drag childrens which is dropped disappear
|
|
69560
|
+
dragElements.forEach(dragElement => {
|
|
69561
|
+
if (dragElement.hasAttribute('drop-to')) {
|
|
69562
|
+
dragElement.style.transition = 'opacity 0.5s ease';
|
|
69563
|
+
dragElement.style.opacity = '0'; // Fade out
|
|
69564
|
+
setTimeout(() => {
|
|
69565
|
+
dragElement.remove(); // Remove from view after fade-out
|
|
69566
|
+
}, 500);
|
|
69567
|
+
}
|
|
69568
|
+
});
|
|
69569
|
+
// Reveal all drop childrens which is hidden
|
|
69570
|
+
const dropElements = Array.from(element.querySelectorAll("[type='drop']"));
|
|
69571
|
+
let check = false;
|
|
69572
|
+
dropElements.forEach(dropEl => {
|
|
69573
|
+
const dropVal = dropEl.getAttribute("value");
|
|
69574
|
+
if (dropVal && dropEl.innerText.trim() === "?") {
|
|
69575
|
+
dropEl.innerText = dropVal;
|
|
69576
|
+
if (dropElements.length > 1 && check == false) {
|
|
69577
|
+
if (window.innerWidth > window.innerHeight) {
|
|
69578
|
+
dropEl.style.marginRight = "-45px";
|
|
69579
|
+
}
|
|
69580
|
+
else {
|
|
69581
|
+
dropEl.style.marginRight = "-65px";
|
|
69582
|
+
}
|
|
69583
|
+
check = true;
|
|
69584
|
+
}
|
|
69585
|
+
}
|
|
69586
|
+
});
|
|
69587
|
+
};
|
|
69588
|
+
const SumTogetherAnimation = async (element, value) => {
|
|
69589
|
+
if (!element)
|
|
69590
|
+
return;
|
|
69591
|
+
if (!value)
|
|
69592
|
+
return;
|
|
69593
|
+
const container = document.getElementById(LidoContainer);
|
|
69594
|
+
if (!container)
|
|
69595
|
+
return;
|
|
69596
|
+
// Expecting structure: [_, TopRow, questionRow, optionRow, ...]
|
|
69597
|
+
const TopRow = Array.from(element.children)[1];
|
|
69598
|
+
const questionRow = Array.from(element.children)[2];
|
|
69599
|
+
const optionRow = Array.from(element.children)[3];
|
|
69600
|
+
if (!TopRow || !questionRow || !optionRow)
|
|
69601
|
+
return;
|
|
69602
|
+
const topRowChildren = Array.from(TopRow.children);
|
|
69603
|
+
const questionRowChildren = Array.from(questionRow.children);
|
|
69604
|
+
const firstNumberEl = questionRowChildren[0];
|
|
69605
|
+
const signElement = questionRowChildren[1];
|
|
69606
|
+
const secondNumberEl = questionRowChildren[2];
|
|
69607
|
+
const equalElement = questionRowChildren[3];
|
|
69608
|
+
const answerElement = questionRowChildren[4];
|
|
69609
|
+
// helper functions
|
|
69610
|
+
const showElement = (el) => {
|
|
69611
|
+
if (!el)
|
|
69612
|
+
return;
|
|
69613
|
+
el.style.visibility = 'visible';
|
|
69614
|
+
el.style.display = '';
|
|
69615
|
+
el.style.opacity = '1';
|
|
69616
|
+
};
|
|
69617
|
+
const readNumber = (el) => {
|
|
69618
|
+
if (!el)
|
|
69619
|
+
return 0;
|
|
69620
|
+
const v = (el.getAttribute && (el.getAttribute('value') || el.getAttribute('string'))) || el.textContent || '';
|
|
69621
|
+
return parseInt(String(v).trim(), 10) || 0;
|
|
69622
|
+
};
|
|
69623
|
+
const elementAppearance = async (flag) => {
|
|
69624
|
+
if (flag) {
|
|
69625
|
+
if (firstNumberEl) {
|
|
69626
|
+
await new Promise(r => setTimeout(r, 200));
|
|
69627
|
+
showElement(firstNumberEl);
|
|
69628
|
+
}
|
|
69629
|
+
if (signElement) {
|
|
69630
|
+
await new Promise(r => setTimeout(r, 200));
|
|
69631
|
+
showElement(signElement);
|
|
69632
|
+
}
|
|
69633
|
+
}
|
|
69634
|
+
else {
|
|
69635
|
+
if (secondNumberEl) {
|
|
69636
|
+
await new Promise(r => setTimeout(r, 200));
|
|
69637
|
+
showElement(secondNumberEl);
|
|
69638
|
+
}
|
|
69639
|
+
if (equalElement) {
|
|
69640
|
+
await new Promise(r => setTimeout(r, 300));
|
|
69641
|
+
showElement(equalElement);
|
|
69642
|
+
}
|
|
69643
|
+
if (optionRow) {
|
|
69644
|
+
await new Promise(r => setTimeout(r, 300));
|
|
69645
|
+
showElement(optionRow);
|
|
69646
|
+
}
|
|
69647
|
+
if (answerElement) {
|
|
69648
|
+
await new Promise(r => setTimeout(r, 200));
|
|
69649
|
+
showElement(answerElement);
|
|
69650
|
+
}
|
|
69651
|
+
}
|
|
69652
|
+
};
|
|
69653
|
+
const number1 = readNumber(firstNumberEl);
|
|
69654
|
+
const number2 = readNumber(secondNumberEl);
|
|
69655
|
+
const sign = ((signElement && ((signElement.getAttribute('string') || signElement.textContent) || '')).toString().trim() === '+') ? '+' : '-';
|
|
69656
|
+
if (sign === '-') {
|
|
69657
|
+
// '-' flow: reveal one by one then change bgColor of last B to red
|
|
69658
|
+
for (let i = 0; i < topRowChildren.length; i++) {
|
|
69659
|
+
await new Promise(resolve => setTimeout(resolve, 75));
|
|
69660
|
+
showElement(topRowChildren[i]);
|
|
69661
|
+
}
|
|
69662
|
+
elementAppearance(true);
|
|
69663
|
+
await new Promise(r => setTimeout(r, 500));
|
|
69664
|
+
for (let k = 0; k < Math.min(number2, topRowChildren.length); k++) {
|
|
69665
|
+
const idx = topRowChildren.length - 1 - k;
|
|
69666
|
+
setImageBackground(topRowChildren[idx], 'red');
|
|
69667
|
+
await new Promise(r => setTimeout(r, 200));
|
|
69668
|
+
}
|
|
69669
|
+
elementAppearance(false);
|
|
69670
|
+
}
|
|
69671
|
+
else {
|
|
69672
|
+
// '+' flow: hide all, then showElement first A, then showElement next B in green
|
|
69673
|
+
for (let i = 0; i < Math.min(number1, topRowChildren.length); i++) {
|
|
69674
|
+
await new Promise(resolve => setTimeout(resolve, 120));
|
|
69675
|
+
showElement(topRowChildren[i]);
|
|
69676
|
+
}
|
|
69677
|
+
elementAppearance(true);
|
|
69678
|
+
await new Promise(r => setTimeout(r, 500));
|
|
69679
|
+
for (let j = 0; j < Math.min(number2, Math.max(0, topRowChildren.length - number1)); j++) {
|
|
69680
|
+
const idx = number1 + j;
|
|
69681
|
+
if (topRowChildren[idx]) {
|
|
69682
|
+
showElement(topRowChildren[idx]);
|
|
69683
|
+
setImageBackground(topRowChildren[idx], 'green');
|
|
69684
|
+
}
|
|
69685
|
+
await new Promise(r => setTimeout(r, 80));
|
|
69686
|
+
}
|
|
69687
|
+
elementAppearance(false);
|
|
69688
|
+
}
|
|
69689
|
+
};
|
|
68826
69690
|
|
|
68827
69691
|
exports.ActivityScoreKey = ActivityScoreKey;
|
|
68828
69692
|
exports.AudioPlayer = AudioPlayer;
|
|
@@ -68833,12 +69697,12 @@ exports.RiveService = RiveService;
|
|
|
68833
69697
|
exports.SelectedValuesKey = SelectedValuesKey;
|
|
68834
69698
|
exports.attachSpeakIcon = attachSpeakIcon;
|
|
68835
69699
|
exports.calculateScale = calculateScale;
|
|
68836
|
-
exports.clearLocalStorage = clearLocalStorage;
|
|
68837
69700
|
exports.commonjsGlobal = commonjsGlobal;
|
|
68838
69701
|
exports.convertUrlToRelative = convertUrlToRelative;
|
|
68839
69702
|
exports.dispatchActivityChangeEvent = dispatchActivityChangeEvent;
|
|
68840
69703
|
exports.dispatchGameCompletedEvent = dispatchGameCompletedEvent;
|
|
68841
69704
|
exports.dispatchGameExitEvent = dispatchGameExitEvent;
|
|
69705
|
+
exports.equationCheck = equationCheck;
|
|
68842
69706
|
exports.executeActions = executeActions;
|
|
68843
69707
|
exports.exitUrl = exitUrl;
|
|
68844
69708
|
exports.fingerUrl = fingerUrl;
|
|
@@ -68851,7 +69715,6 @@ exports.handleElementClick = handleElementClick;
|
|
|
68851
69715
|
exports.handleFloatElementPosition = handleFloatElementPosition;
|
|
68852
69716
|
exports.handlingChildElements = handlingChildElements;
|
|
68853
69717
|
exports.initEventsForElement = initEventsForElement;
|
|
68854
|
-
exports.matchStringPattern = matchStringPattern;
|
|
68855
69718
|
exports.nextUrl = nextUrl;
|
|
68856
69719
|
exports.parseProp = parseProp;
|
|
68857
69720
|
exports.prevUrl = prevUrl;
|
|
@@ -68863,3 +69726,4 @@ exports.storingEachActivityScore = storingEachActivityScore;
|
|
|
68863
69726
|
exports.tinyColor = tinyColor;
|
|
68864
69727
|
exports.triggerNextContainer = triggerNextContainer;
|
|
68865
69728
|
exports.triggerPrevcontainer = triggerPrevcontainer;
|
|
69729
|
+
exports.validateObjectiveStatus = validateObjectiveStatus;
|