2318,6,162,40,95,43,212,32,215,41,505,48,370,56,273,39,365,53,567,51,251,44,549,36,518,37,133,33,528,54,348,37,269,22,444,29,178,47,322,36,400,39,272,43,510,38,424,67,211,66,265,56,185,50,877,63,297,70,127,70,356,63,290,55,371,32,496,50,443,34,195,46,354,36,229,52,237,50,131,61,172,40,334,43,173,73,266,52,469,50,190,43,559,34,523,36,629,26,468,42,236,42,361,41,607,42,95,46,128,41,550,59,185,51,231,53,759,64,124,72,459,68,810,86,499,71,388,74,271,87,199,81,524,88,128,65,369,35,298,37,307,50,292,49,528,44,380,55,345,65,211,48,417,48,584,39,585,29,728,43,242,32,251,50,339,40,744,50,561,48,237,45,397,44,332,48,583,39,278,58,557,55,303,62,365,43,631,38,461,50,480,62,457,76,188,77,266,71,378,78,232,63,212,74,501,63,290,32,237,34,76,39,309,52,203,36,521,26,349,48,427,36,475,42,383,41,459,51,380,35,466,58,534,51,782,63,295,60,311,115,914,104,142,102,412,114,494,92,843,105,178,119,526,134,325,137,379,157,708,168,149,120,774,139,323,105,233,73,470,86,340,71,214,64,235,43,691,66,492,47,448,50,538,42,805,60,684,54,200,92,191,96,427,87,300,78,344,83,285,66,283,87,601,100,508,88,323,74,335,67,355,64,213,66,189,36,251,38,179,43,412,50,676,47,370,49,300,56,356,63,459,57,350,45,831,76,300,85,373,63,600,77,274,78,134,67,605,90,297,104,616,120,249,113,156,102,263,77,736,75,292,81,491,99,309,108,363,112,228,91,200,68,230,79,972,65,559,61,173,43,146,40,691,44,584,52,460,54,241,60,504,81,337,87,212,68,516,58,255,39,326,47,442,56,596,62,683,30,752,44,925,46,450,45,253,39,367,52,303,52,303,43,701,38,137,68,130,71,190,68,130,67,281,66,238,56,163,50,382,65,520,47,91,44,173,37,190,34,438,52,224,36,654,26,329,42,299,60,324,49,116,64,126,45,459,54,555,63,348,52,198,58,534,76,309,85,363,89,228,68,182,47,167,49,313,39,867,32,439,41,462,48,299,48,337,36,432,47,126,73,301,75,255,51,521,64,186,62,226,46,746,57,187,75,315,79,180,87,198,82,417,91,123,66,702,58,858,78,414,63,194,74,297,71,355,74,537,55,310,40,577,42,357,54,999,75,683,52,453,65,190,48,319,59,399,60,422,44,844,34,839,52,236,53,138,47,437,54,219,56,128,48,749,53,350,62,764,58,538,45,829,78,111,78,109,61,838,88,135,72,199,50,500,59,363,59,276,72,278,107,632,104,191,86,1024,113,760,98,548,88,565,117,310,112,104,116,167,98,598,128,265,155,194,120,222,115,176,96,393,112,390,130,309,139,363,143,228,122,230,89,252,76,182,53,457,60,279,64,182,65,280,49,446 _info {"project":"app01-kid-trainers","branch":"master","version":77,"versionDate":"2024-06-04T13:04:52.000Z","fromVersion":0,"reset":true,"checksumDocs":"325-144362"} shared/_preview/calcInstruction/calc.ls (function(){ return function(atom){ return atom.instruction.text || atom.instruction; }; })(); shared/_preview/instruction/instruction.ls (function(){ return function(label){ return Div({ display: "inline-block", lineHeight: "1.4em", padding: "0.5em", margin: "0.5em", fontStyle: "italic" }).html(label + "").addClass("previewInstruction"); }; })(); shared/_review/yellowTag/tag.ls (function(){ return function(i){ return Div({ padding: "0.2em", fontSize: "0.75em", backgroundColor: Color.yellow[200], boxShadow: '0px 0px 2px #bbb', color: "black", minWidth: "1em" }).html((i + 1) + ""); }; })(); shared/calcAtomInstructionSounds/calc.ls (function(){ return function(slide){ var sounds, i$, ref$, len$, atom, i, text, ref1$, that; sounds = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; slide.atom = atom; i = slide.getParam("instruction", slide.atom); if (!i) { continue; } text = i.speaker ? (ref1$ = i.sound) != null ? ref1$ : i.text : (that = i.sound) ? that : void 8; if (text) { sounds.push({ text: text, voice: i.voice, voiceLang: i.voiceLang }); } } delete slide.atom; return sounds; }; })(); shared/introSequence/calcIntroStepSound/calc.ls (function(){ return function(slide, step){ var s, get, voice, voiceLang, sound; s = step.sound; if (!s) { return; } get = inc("getParam/get")(slide); voice = get("voice"); voiceLang = get("voiceLang"); sound = _.isString(s) ? { text: s } : s; sound.voice == null && (sound.voice = voice); sound.voiceLang == null && (sound.voiceLang = voiceLang); return sound; }; })(); shared/introSequence/calcIntroStepSound/getParam/get.ls (function(){ return function(slide){ return function(n){ var t, l, ref$, ref1$; t = slide.trainerParams; l = slide.levelParams; return ((ref$ = t.instruction) != null ? ref$[n] : void 8) || ((ref1$ = l.instruction) != null ? ref1$[n] : void 8) || t[n] || l[n]; }; }; })(); shared/introSequence/playIntro/play.ls (function(){ return function(slide, onDone){ var sequence, nextStep; sequence = _.ensureArray(slide.getParam("introSequence")); nextStep = function(){ var step; slide.currentIntroSequenceIndex++; step = sequence[slide.currentIntroSequenceIndex]; if (step) { return inc("step/step")(slide, step, nextStep); } else { return onDone(); } }; return nextStep(); }; })(); shared/introSequence/playIntro/step/action/action.ls (function(){ return function(slide, step, onDone){ var action, i$, ref$, len$, cl, j$, ref1$, len1$, el; action = step.action; if (!action) { onDone(); return; } for (i$ = 0, len$ = (ref$ = _.ensureArray(step['class'])).length; i$ < len$; ++i$) { cl = ref$[i$]; for (j$ = 0, len1$ = (ref1$ = slide.div.findAll("." + cl)).length; j$ < len1$; ++j$) { el = ref1$[j$]; el.css({ pointerEvents: "none" }); if (action === "hide") { el.css({ opacity: 0 }); } else if (action === "fadeIn") { el.fadeIn(); } } } return setTimeout(onDone, action === "hide" ? 0 : 300); }; })(); shared/introSequence/playIntro/step/sound/sound.ls (function(){ return function(slide, step, onDone){ var s, sound; if (!step.sound) { onDone(); return; } s = inc("/shared/introSequence/calcIntroStepSound/calc")(slide, step); sound = slide.sounds[s.text + s.voice]; return sound.play(onDone); }; })(); shared/introSequence/playIntro/step/step.ls (function(){ return function(slide, step, playNext){ var delay, playActionAndSound, finish; delay = function(){ var d, ref$; d = (ref$ = step.delay) != null ? ref$ : 0; return setTimeout(playActionAndSound, d); }; playActionAndSound = function(){ var counter, onDone; counter = 0; onDone = function(){ counter++; if (counter === 2) { return finish(); } }; inc("action/action")(slide, step, onDone); return inc("sound/sound")(slide, step, onDone); }; finish = function(){ return playNext(); }; if (slide.div.isVisible()) { return delay(); } }; })(); shared/lsgSlim/adjustSize/adjust.ls (function(){ return function(l){ var w, h, w2, that, scale, fontScale; w = l.lsgData.width; h = l.lsgData.heigt; if (engine.isDebug) { h = l.lsgData.height; } w2 = (that = l.lsgParams.width) ? that : _.isNumber(l.defaultWidth) ? l.defaultWidth : l.defaultWidth === "original" ? l.lsgData.width : 150; scale = w2 / w; if (l.adjustFontScale) { fontScale = inc("/../app01/lib/util/fontSize/calcFontScale/calc")(); scale *= fontScale; } return l.lsgDiv.css({ width: w * scale + "px", height: h * scale + "px" }); }; })(); shared/lsgSlim/calcLsgParams/calc.ls (function(){ return function(p){ if (_.isString(p.lsgParams)) { return { lsg: p.lsgParams }; } else { return p.lsgParams; } }; })(); shared/lsgSlim/getLsgData/get.ls (function(){ return function(l){ var lsgPath, lsgData, renderParams; lsgPath = l.lsgParams.lsg; if (_.endsWith(lsgPath, ".lsg")) { return lsgData = l.slide.mediaParams.lsgs[lsgPath]; } else if (_.endsWith(lsgPath, ".lsr")) { renderParams = _.cloneDeep(l.lsgParams); renderParams.renderLanguage = l.slide.getParam("contentLanguagePrimary"); lsgData = inc(lsgPath)(renderParams); if (inc("hasRequiredArguments/has")(lsgData, renderParams)) { return lsgData; } } else { debug("invalid lsg", lsgParams.lsg); return null; } }; })(); shared/lsgSlim/getLsgData/hasRequiredArguments/has.ls (function(){ return function(lsgData, renderParams){ var i$, ref$, len$, a; for (i$ = 0, len$ = (ref$ = _.ensureArray(lsgData.requiredArguments)).length; i$ < len$; ++i$) { a = ref$[i$]; if (renderParams[a] == null) { console.log("missing required renderer argument \"" + a + "\". Not displaying renderer"); return false; } } return true; }; })(); shared/lsgSlim/hideDebugTags/hide.ls (function(){ return function(l){ var debugTags, i$, len$, debugTag, results$ = []; debugTags = l.lsgDiv.findAll(".debugTag"); for (i$ = 0, len$ = debugTags.length; i$ < len$; ++i$) { debugTag = debugTags[i$]; results$.push(debugTag.hide()); } return results$; }; })(); shared/lsgSlim/lsg.ls (function(){ return function(p){ var l, ref$; l = {}; l.slide = p.slide; l.defaultWidth = p.defaultWidth; l.adjustFontScale = (ref$ = p.adjustFontScale) != null ? ref$ : true; l.lsgParams = inc("calcLsgParams/calc")(p); l.lsgData = inc("getLsgData/get")(l); if (!l.lsgData) { return; } inc("mergeParamsIntoLsgData/merge")(l); l.lsgDiv = inc("lsgDiv/div")(l); inc("adjustSize/adjust")(l); inc("hideDebugTags/hide")(l); return l.lsgDiv; }; })(); shared/lsgSlim/lsgDiv/div.ls (function(){ return function(l){ var lsg, mp; lsg = _.cloneDeep(l.lsgData); mp = l.slide.mediaParams; return inc("/../lsg2/lsg3Div/div")({ lsg: lsg, mediaParams: mp }); }; })(); shared/lsgSlim/mergeParamsIntoLsgData/merge.ls (function(){ return function(l){ var p, d, i$, ref$, len$, s, that; p = l.lsgParams; d = l.lsgData; for (i$ = 0, len$ = (ref$ = ["color", "lineColor", "lineSize"]).length; i$ < len$; ++i$) { s = ref$[i$]; if (that = p[s]) { d[s] = _.merge(d[s], that); } } if (that = p.background) { return d.background = that; } }; })(); shared/resetTotalDoneTasks/reset.ls (function(){ return function(slide){ var i$, ref$, len$, atom, lresult$, j$, ref1$, len1$, task, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atomsNormalized).length; i$ < len$; ++i$) { atom = ref$[i$]; lresult$ = []; for (j$ = 0, len1$ = (ref1$ = atom.tasks).length; j$ < len1$; ++j$) { task = ref1$[j$]; lresult$.push(task.totalDone = 0); } results$.push(lresult$); } return results$; }; })(); trainers/kidCards/_media2/lsgs/lsgs.ls (function(){ return function(slide){ var lsgs, cards, i$, len$, card, that; lsgs = []; cards = _.ensureArray(slide.getParam("cards")); for (i$ = 0, len$ = cards.length; i$ < len$; ++i$) { card = cards[i$]; if (that = card.lsg) { lsgs.push(that); } } return lsgs; }; })(); trainers/kidCards/_media2/sounds/sounds.ls (function(){ return function(slide){ var sounds, introSequence, i$, len$, step, s, instructionSounds; sounds = []; introSequence = slide.getParam("introSequence"); if (introSequence) { for (i$ = 0, len$ = introSequence.length; i$ < len$; ++i$) { step = introSequence[i$]; s = inc("/shared/introSequence/calcIntroStepSound/calc")(slide, step); if (s) { sounds.push(s); } } } instructionSounds = inc("/shared/calcAtomInstructionSounds/calc")(slide); return sounds = _.concat(sounds, instructionSounds); }; })(); trainers/kidCards/_preview/preview.ls (function(){ return function(slide){ var i$, ref$, len$, atom, instructionText; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; slide.atom = atom; instructionText = slide.getParam("instruction").text; Div().html(inc("/shared/_preview/instruction/instruction")(instructionText), slide.cardsDiv.clone()).addClass("previewDiv").appendTo(slide.div); } return slide.cardsDiv.hide(); }; })(); trainers/kidCards/_review/scoreActions/actionRow/result/lsg/lsg.ls (function(){ return function(slide, lsg){ return Div().html(inc("/../app01-trainers/shared/lsg/lsg")({ lsg: lsg, slide: slide }).css({ height: "2em", width: "2em", backgroundColor: Color.grey[300] })); }; })(); trainers/kidCards/_review/scoreActions/actionRow/result/result.ls (function(){ return function(slide, action, cardIndex){ return Div({ flex: "1 1 auto", display: "flex", justifyContent: "flex-start" }).html(inc("/shared/_review/yellowTag/tag")(cardIndex).css({ marginRight: "0.5em" }), inc("lsg/lsg")(slide, action.lsg)); }; })(); trainers/kidCards/_review/scoreActions/actionRow/row.ls (function(){ return function(slide, action, cardIndex){ return inc("/../app01-trainers/shared/scoreActionRowFlex/row")(action, inc("result/result")(slide, action, cardIndex)); }; })(); trainers/kidCards/_review/scoreActions/actions.ls (function(){ return function(slide){ var cardIndices, i$, ref$, len$, atom, lresult$, scoreEvent, actions, j$, len1$, action, cardIndex, results$ = []; slide.cardsDiv.show(); inc("hidePreviewDivs/hide")(slide); cardIndices = inc("calcCardIndices/calc")(slide); inc("drawYellowTagToPreview/draw")(slide, cardIndices); for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; lresult$ = []; slide.atom = atom; scoreEvent = slide.score.getScoreEvent(atom); if (!scoreEvent) { continue; } actions = scoreEvent.actions; slide.div.append(inc("/../app01-trainers/shared/instruction/instruction")(slide)); for (j$ = 0, len1$ = actions.length; j$ < len1$; ++j$) { action = actions[j$]; cardIndex = cardIndices[action.id]; lresult$.push(slide.div.append(inc("actionRow/row")(slide, action, cardIndex))); } results$.push(lresult$); } return results$; }; })(); trainers/kidCards/_review/scoreActions/calcCardIndices/calc.ls (function(){ return function(slide){ var cardIndices, i$, ref$, len$, i, card, id; cardIndices = {}; for (i$ = 0, len$ = (ref$ = slide.cardsDiv.findAll(".card")).length; i$ < len$; ++i$) { i = i$; card = ref$[i$]; id = inc("calcId/calc")(card); cardIndices[id] = i; } return cardIndices; }; })(); trainers/kidCards/_review/scoreActions/calcCardIndices/calcId/calc.ls (function(){ return function(card){ var className; className = card.classes()[1]; return className.split("card_")[1]; }; })(); trainers/kidCards/_review/scoreActions/drawYellowTagToPreview/draw.ls (function(){ return function(slide, cardIndices){ var cards, i$, len$, i, card, results$ = []; cards = slide.cardsDiv.childrenAll(); for (i$ = 0, len$ = cards.length; i$ < len$; ++i$) { i = i$; card = cards[i$]; results$.push(card.append(inc("/shared/_review/yellowTag/tag")(i).css({ position: "absolute", top: 0, left: 0 }))); } return results$; }; })(); trainers/kidCards/_review/scoreActions/hidePreviewDivs/hide.ls (function(){ return function(slide){ var previewDivs, i$, len$, previewDiv, results$ = []; previewDivs = slide.div.findAll(".previewDiv"); for (i$ = 0, len$ = previewDivs.length; i$ < len$; ++i$) { previewDiv = previewDivs[i$]; results$.push(previewDiv.hide()); } return results$; }; })(); trainers/kidCards/_skip/calcRemainingSolutions/calc.ls (function(){ return function(slide){ var atomNormalized, totalSolutions, totalDone, remainingSolutions; atomNormalized = slide.atomsNormalized[slide.currentAtomIndex]; totalSolutions = atomNormalized.solution.length; totalDone = atomNormalized.totalDone; if (totalDone) { return remainingSolutions = totalSolutions - totalDone; } else { return totalSolutions; } }; })(); trainers/kidCards/_skip/skip.ls (function(){ return function(slide){ var remainingSolutions, i$, i; if (slide.currentAtomIndex > slide.atomsNormalized.length - 1) { slide.onFinishedSlide(); return; } if (slide.currentAtomIndex < 0 && slide.getParam("introSequence")) { return inc("skipIntroSequence/skip")(slide); } else { remainingSolutions = inc("calcRemainingSolutions/calc")(slide); for (i$ = 1; i$ <= remainingSolutions; ++i$) { i = i$; slide.levelPlayer.progressBar.showGreen(); } return slide.startNextAtom(); } }; })(); trainers/kidCards/_skip/skipIntroSequence/skip.ls (function(){ return function(slide){ var sequence, i$, len$, item, j$, ref$, len1$, el; sequence = _.ensureArray(slide.getParam("introSequence")); slide.currentIntroSequenceIndex = sequence.length; for (i$ = 0, len$ = sequence.length; i$ < len$; ++i$) { item = sequence[i$]; for (j$ = 0, len1$ = (ref$ = slide.div.findAll("." + item['class'])).length; j$ < len1$; ++j$) { el = ref$[j$]; el.fadeIn(); } } return slide.startNextAtom(); }; })(); trainers/kidCards/_start/start.ls (function(){ return function(slide){ if (slide.getParam("introSequence")) { return slide.playIntro(function(){ return slide.startNextAtom(); }); } else { return slide.startNextAtom(); } }; })(); trainers/kidCards/calcAtomsNormalized/calc.ls (function(){ return function(atoms){ var atomsNormalized, atom, atom2; return atomsNormalized = (function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; atom2 = _.cloneDeep(atom); atom2.solution = _.ensureArray(atom2.solution); results$.push(atom2); } return results$; }()); }; })(); trainers/kidCards/calcCards/calc.ls (function(){ return function(slide){ var cards; cards = _.ensureArray(slide.getParam("cards")); if (!slide.getParam("introSequence") && slide.getParam("shuffleCards")) { cards = _.shuffleWithSeed(cards); } return cards; }; })(); trainers/kidCards/calcTotalProgressElements/calc.ls (function(){ return function(slide){ var total, i$, ref$, len$, atom; total = 0; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; total += _.ensureArray(atom.solution).length; } return total; }; })(); trainers/kidCards/cardsDiv/calcCardsWidth/calc.ls (function(){ return function(cards){ var sizes; sizes = inc("cardSizes/array")(); return (sizes[cards.length] - 2) + "%"; }; })(); trainers/kidCards/cardsDiv/calcCardsWidth/cardSizes/array.ls (function(){ return function(){ return { 1: 100, 2: 50, 3: 30, 4: 50, 5: 30, 6: 30, 7: 24, 8: 24, 9: 30, 10: 19, 11: 19, 12: 24, 13: 24, 14: 24, 15: 19, 16: 24 }; }; })(); trainers/kidCards/cardsDiv/card/card.ls (function(){ return function(card, width, space, index, slide){ var div; return div = Div({ display: "flex", width: width, margin: "0 " + space + " " + space + " 0", background: Color.grey[100] }).addClass("card card_" + card.id).html(inc("lsg/lsg")(card, slide)).tap(function(){ return inc("tap/tap")(div, card, slide); }); }; })(); trainers/kidCards/cardsDiv/card/lsg/lsg.ls (function(){ return function(card, slide){ return inc("/../app01-trainers/shared/lsg/lsg")({ lsg: card.lsg, slide: slide }).css({ width: "100%", height: "100%" }); }; })(); trainers/kidCards/cardsDiv/card/tap/onCorrect/disableAllCards/disable.ls (function(){ return function(slide){ var cards, i$, len$, card, results$ = []; cards = slide.div.findAll(".card"); for (i$ = 0, len$ = cards.length; i$ < len$; ++i$) { card = cards[i$]; results$.push(card.css({ pointerEvents: "none" })); } return results$; }; })(); trainers/kidCards/cardsDiv/card/tap/onCorrect/on.ls (function(){ return function(atomNormalized, div, cardData, slide){ div.css({ pointerEvents: "none", outline: "0.2em solid " + Color.green[600] }); atomNormalized.totalDone++; slide.levelPlayer.progressBar.showGreen(); slide.score.addActionCorrect(slide.atom, cardData); if (atomNormalized.totalDone === atomNormalized.solution.length) { inc("disableAllCards/disable")(slide); return slide.score.log(slide.atom, function(){ return slide.startNextAtom(); }); } }; })(); trainers/kidCards/cardsDiv/card/tap/onWrong/on.ls (function(){ return function(atomNormalized, div, cardData, slide){ slide.levelPlayer.progressBar.addElement().showRed(); return slide.score.addActionMistake(slide.atom, cardData); }; })(); trainers/kidCards/cardsDiv/card/tap/tap.ls (function(){ return function(div, cardData, slide){ var atomNormalized; atomNormalized = slide.atomsNormalized[slide.currentAtomIndex]; if (!(atomNormalized != null && atomNormalized.solution) || !(cardData != null && cardData.id)) { return; } if (in$(cardData.id, atomNormalized.solution)) { return inc("onCorrect/on")(atomNormalized, div, cardData, slide); } else { return inc("onWrong/on")(atomNormalized, div, cardData, slide); } }; })(); function in$(x, xs){ var i = -1, l = xs.length >>> 0; while (++i < l) if (x === xs[i]) return true; return false; } trainers/kidCards/cardsDiv/div.ls (function(){ return function(slide){ var cards, width, space, i, card; cards = slide.cards; width = inc("calcCardsWidth/calc")(cards); space = "2%"; return Div({ display: "flex", padding: "0em 1.5em 0 1.5em", flexWrap: "wrap", maxWidth: "30em", margin: "0 auto" }).appendTo(slide.div).html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = cards).length; i$ < len$; ++i$) { i = i$; card = ref$[i$]; results$.push(inc("card/card")(card, width, space, i, slide)); } return results$; }())); }; })(); trainers/kidCards/generateSlides.ls (function(){ return function(trainerParams, levelParams){ var atoms, slide, ref$; atoms = _.ensureArray(trainerParams.atoms); if (trainerParams.shuffleAtoms || levelParams.shuffleAtoms) { atoms = _.shuffleWithSeed(atoms); } slide = inc("/../app01-trainers/shared/slide/slide")(trainerParams, levelParams, THISFILE); slide.atoms = atoms; slide.cards = inc("calcCards/calc")(slide); slide.atomsNormalized = inc("calcAtomsNormalized/calc")(atoms); slide.totalProgressElements = inc("calcTotalProgressElements/calc")(slide); slide.finishButton = (ref$ = slide.getParam("finishButton")) != null ? ref$ : false; return slide; }; })(); trainers/kidCards/init.ls (function(){ return function(slide){ inc("resetTotalDone/reset")(slide); slide.currentAtomIndex = -1; slide.currentIntroSequenceIndex = -1; slide.showInstruction = function(){ return inc("showInstruction/show")(slide); }; slide.playIntro = function(onDone){ return inc("/shared/introSequence/playIntro/play")(slide, onDone); }; slide.cardsDiv = inc("cardsDiv/div")(slide); return slide.startNextAtom = function(){ return inc("startNextAtom/start")(slide); }; }; })(); trainers/kidCards/resetTotalDone/reset.ls (function(){ return function(slide){ var i$, ref$, len$, atom, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atomsNormalized).length; i$ < len$; ++i$) { atom = ref$[i$]; results$.push(atom.totalDone = 0); } return results$; }; })(); trainers/kidCards/showInstruction/show.ls (function(){ return function(slide){ var ref$, instruction; if ((ref$ = slide.instruction) != null) { ref$.remove(); } instruction = inc("/../app01-trainers/shared/instruction/instruction")(slide); slide.div.prepend(instruction); instruction.play(); if (slide.currentAtomIndex > 0) { instruction.fadeIn(1300); } return slide.instruction = instruction; }; })(); trainers/kidCards/startNextAtom/start.ls (function(){ return function(slide){ var startNext, showAndEnable; startNext = function(){ slide.currentAtomIndex++; slide.atom = slide.atoms[slide.currentAtomIndex]; if (slide.atom) { if (slide.currentAtomIndex === 0) { return showAndEnable(); } else { return setTimeout(showAndEnable, 500); } } else { return setTimeout(slide.finish, 500); } }; showAndEnable = function(){ var i$, ref$, len$, el; for (i$ = 0, len$ = (ref$ = slide.div.findAll(".card")).length; i$ < len$; ++i$) { el = ref$[i$]; el.css({ pointerEvents: "", outline: "" }); } return slide.showInstruction(); }; return startNext(); }; })(); trainers/kidColorize/_media2/lsgs/lsgs.ls (function(){ return function(slide){ var lsgs; return lsgs = [slide.getParam("lsg")]; }; })(); trainers/kidColorize/_media2/sounds/sounds.ls (function(){ return function(slide){ var sounds; return sounds = inc("/shared/calcAtomInstructionSounds/calc")(slide); }; })(); trainers/kidColorize/_preview/preview.ls (function(){ return function(slide){ var i$, ref$, len$, atomIndex, atom, instructionText, results$ = []; slide.lsg.remove(); for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atomIndex = i$; atom = ref$[i$]; slide.atom = atom; instructionText = slide.getParam("instruction").text; results$.push(Div().html(inc("/shared/_preview/instruction/instruction")(instructionText), inc("previewLsgDiv/div")(slide), inc("previewColorPickerDiv/div")(slide)).addClass("previewDiv" + atomIndex).appendTo(slide.div)); } return results$; }; })(); trainers/kidColorize/_preview/previewColorPickerDiv/div.ls (function(){ return function(slide){ return Div({ width: "100%", background: Color.grey[250] }).html(inc("../../colorPicker/colorPicker")(slide)).addClass("previewBottomDiv"); }; })(); trainers/kidColorize/_preview/previewLsgDiv/div.ls (function(){ return function(slide){ var lsgParams; lsgParams = slide.getParam("lsg"); return inc("/shared/lsgSlim/lsg")({ lsgParams: lsgParams, slide: slide, defaultWidth: 250 }).css({ maxWidth: "95%" }).addClass("lsg"); }; })(); trainers/kidColorize/_review/scoreActions/actions.ls (function(){ return function(slide){ var i$, ref$, len$, atomIndex, atom, currentPreviewDiv, yellowTagData, scoreEvent, actions, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atomIndex = i$; atom = ref$[i$]; currentPreviewDiv = slide.div.findFirst(".previewDiv" + atomIndex); yellowTagData = inc("calcYellowTagData/calc")(slide, currentPreviewDiv); inc("addYellowTagsToPreview/add")(slide, yellowTagData, currentPreviewDiv); scoreEvent = slide.score.getScoreEvent(atom); if (!scoreEvent) { continue; } actions = scoreEvent.actions; inc("colorizeElements/colorize")(slide, actions, currentPreviewDiv); results$.push(inc("drawActionRows/draw")(slide, actions, currentPreviewDiv, yellowTagData)); } return results$; }; })(); trainers/kidColorize/_review/scoreActions/addInstruction/add.ls (function(){ return function(slide, atom){ return slide.lsg.prepend(Div({ display: "flex" }).html("instruction")); }; })(); trainers/kidColorize/_review/scoreActions/addYellowTagsToPreview/add.ls (function(){ return function(slide, yellowTagData, currentPreviewDiv){ var currentLsg, i$, len$, i, data, results$ = []; currentLsg = currentPreviewDiv.findFirst(".lsg"); for (i$ = 0, len$ = yellowTagData.length; i$ < len$; ++i$) { i = i$; data = yellowTagData[i$]; results$.push(currentLsg.prepend(inc("/shared/_review/yellowTag/tag")(i).css({ position: "absolute", top: data.top + "%", left: data.left + "%", zIndex: "100" }))); } return results$; }; })(); trainers/kidColorize/_review/scoreActions/calcYellowTagData/calc.ls (function(){ return function(slide, currentPreviewDiv){ var currentLsg, shapeElements, offsets, res$, i$, len$, i, shapeElement, o1, o2, offsetLeft, offsetTop; currentLsg = currentPreviewDiv.findFirst(".lsg"); if (typeof currentLsg.updateLayout == 'function') { currentLsg.updateLayout(); } shapeElements = inc("calcShapeElements/calc")(slide, currentLsg); res$ = []; for (i$ = 0, len$ = shapeElements.length; i$ < len$; ++i$) { i = i$; shapeElement = shapeElements[i$]; o1 = shapeElement.offset(); o2 = currentLsg.offset(); offsetLeft = o1.left - o2.left; offsetTop = o1.top - o2.top; res$.push({ left: offsetLeft / o2.width * 100, top: offsetTop / o2.height * 100, tapClassId: shapeElement.tapClassId, tapClass: shapeElement.tapClass }); } offsets = res$; return _.sortBy(offsets, ["left", "top"]); }; })(); trainers/kidColorize/_review/scoreActions/calcYellowTagData/calcShapeElements/calc.ls (function(){ return function(slide, currentLsg){ var shapeElements, i$, ref$, len$, className, elements, j$, len1$; shapeElements = []; for (i$ = 0, len$ = (ref$ = slide.classNames).length; i$ < len$; ++i$) { className = ref$[i$]; elements = currentLsg.findAll("." + className); for (j$ = 0, len1$ = elements.length; j$ < len1$; ++j$) { (fn$.call(this, j$, elements[j$])); } } return shapeElements; function fn$(i, el){ el.tapClass = className; el.tapClassId = i; shapeElements.push(el); } }; })(); trainers/kidColorize/_review/scoreActions/colorizeElements/colorize.ls (function(){ return function(slide, actions, currentPreviewDiv){ var i$, len$, i, a, colorValue, results$ = []; for (i$ = 0, len$ = actions.length; i$ < len$; ++i$) { i = i$; a = actions[i$]; colorValue = slide.getParam("colors")[a.color]; if (a.correct) { results$.push(currentPreviewDiv.findAll("." + a.tapClass)[a.tapClassId].attr({ fill: colorValue })); } } return results$; }; })(); trainers/kidColorize/_review/scoreActions/drawActionRows/action/action.ls (function(){ return function(slide, action, yellowTagData){ var index, row; index = inc("findTapClassId/find")(action, yellowTagData); row = inc("/../app01-trainers/shared/scoreActionRowFlex/row")(action, inc("result/result")(slide, action, index)); return row; }; })(); trainers/kidColorize/_review/scoreActions/drawActionRows/action/findTapClassId/find.ls (function(){ return function(action, yellowTagData){ return _.findIndex(yellowTagData, function(data){ return data.tapClassId === action.tapClassId && data.tapClass === action.tapClass; }); }; })(); trainers/kidColorize/_review/scoreActions/drawActionRows/action/result/result.ls (function(){ return function(slide, action, index){ var colors; colors = slide.getParam("colors"); return Div({ flex: "1 1 auto", display: "flex", justifyContent: "flex-start" }).append(Div({ backgroundColor: colors[action.color], width: "1.5em", height: "1.5em", borderRadius: "50%", marginRight: "0.3em", marginLeft: "0.2em" }), Svg({ svg: path("/../app01/lib/svg/shape/arrow-top.svg"), color: Color.grey[400] }).css({ transform: "rotate(90deg)", marginRight: "0.25em" }), inc("../yellowTagWrapper/div")(index)); }; })(); trainers/kidColorize/_review/scoreActions/drawActionRows/action/yellowTagWrapper/div.ls (function(){ return function(index){ return inc("/shared/_review/yellowTag/tag")(index).css({ margin: "0em 0.25em" }); }; })(); trainers/kidColorize/_review/scoreActions/drawActionRows/draw.ls (function(){ return function(slide, actions, currentPreviewDiv, yellowTagData){ var action; return currentPreviewDiv.append(Div().html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = actions).length; i$ < len$; ++i$) { action = ref$[i$]; results$.push(inc("action/action")(slide, action, yellowTagData)); } return results$; }()))); }; })(); trainers/kidColorize/_skip/skip.ls (function(){ return function(slide){ var t, i$, i; t = slide.calcAtomPendingTotal(); for (i$ = 1; i$ <= t; ++i$) { i = i$; slide.levelPlayer.progressBar.showGreen(); } if (!slide.atoms[slide.currentAtomIndex + 1]) { return slide.onFinishedSlide(); } else { return slide.startNextAtom(); } }; })(); trainers/kidColorize/_start/start.ls (function(){ return function(slide){ var i$, ref$, len$, el; slide.levelPlayer.page.bottom.html(slide.colorPicker).show(); for (i$ = 0, len$ = (ref$ = slide.tapElements).length; i$ < len$; ++i$) { el = ref$[i$]; el.css({ pointerEvents: "auto", cursor: "default" }); } return slide.startNextAtom(); }; })(); trainers/kidColorize/calcAtomPendingTotal/calc.ls (function(){ return function(slide){ var total, totalDone, i$, ref$, len$, t; total = 0; totalDone = 0; for (i$ = 0, len$ = (ref$ = slide.atomNormalized.tasks).length; i$ < len$; ++i$) { t = ref$[i$]; total += t.total || 0; totalDone += t.totalDone || 0; } return total - totalDone; }; })(); trainers/kidColorize/calcAtomsNormalized/calc.ls (function(){ return function(atoms){ var atomsNormalized, atom, atom2; return atomsNormalized = (function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; if (atom != null && atom.tasks) { atom2 = _.cloneDeep(atom); atom2.tasks = _.ensureArray(atom2.tasks); } else { atom2 = _.omit(atom, ["class", "color", "total"]); atom2.tasks == null && (atom2.tasks = [_.pick(atom, ["class", "color", "total"])]); } results$.push(atom2); } return results$; }()); }; })(); trainers/kidColorize/calcClassNames/calc.ls (function(){ return function(slide){ var classNames, i$, ref$, len$, a, j$, ref1$, len1$, t, that; classNames = []; for (i$ = 0, len$ = (ref$ = slide.atomsNormalized).length; i$ < len$; ++i$) { a = ref$[i$]; for (j$ = 0, len1$ = (ref1$ = a.tasks).length; j$ < len1$; ++j$) { t = ref1$[j$]; if (that = t['class']) { classNames.push(that); } } } return _.uniq(classNames); }; })(); trainers/kidColorize/calcTotalProgressElements/calc.ls (function(){ return function(slide){ var total, i$, ref$, len$, a, j$, ref1$, len1$, t, that; total = 0; for (i$ = 0, len$ = (ref$ = slide.atomsNormalized).length; i$ < len$; ++i$) { a = ref$[i$]; for (j$ = 0, len1$ = (ref1$ = a.tasks).length; j$ < len1$; ++j$) { t = ref1$[j$]; if (that = t.total) { total += that; } } } return total; }; })(); trainers/kidColorize/colorPicker/attentionAnimation/animation.ls (function(){ return function(div){ return div.keyframeAnimate({ keyframes: { "0%": { transform: "scale(1)" }, "50%": { transform: "scale(1.3)" }, "100%": { transform: "scale(1)" } }, duration: 1000 }); }; })(); trainers/kidColorize/colorPicker/color/color.ls (function(){ return function(color, colorValue, slide){ var tap; tap = function(){ slide.selectedColor = color; return slide.colorPicker.update(); }; return Div({ padding: "1em" }).html(Div({ width: "2em", height: "2em", borderRadius: "50%", background: colorValue, border: slide.selectedColor === color ? "10px solid " + Color.grey[300] : "10px solid " + colorValue })).tap({ up: tap, animation: "none" }); }; })(); trainers/kidColorize/colorPicker/colorPicker.ls (function(){ return function(slide){ var colors, div, color, colorValue; colors = slide.getParam("colors"); div = Div({ display: "flex", flexWrap: "wrap", padding: "0.3em", margin: "0 auto" }).html((function(){ var ref$, results$ = []; for (color in ref$ = colors) { colorValue = ref$[color]; results$.push(inc("color/color")(color, colorValue, slide)); } return results$; }())); div.update = function(){ return div.replaceWith(slide.colorPicker = inc(THISFILE)(slide)); }; div.attentionAnimation = function(){ return inc("attentionAnimation/animation")(div); }; return div; }; })(); trainers/kidColorize/generateSlides.ls (function(){ return function(trainerParams, levelParams){ var atoms, slide, ref$; atoms = _.ensureArray(trainerParams.atoms); if (trainerParams.shuffleAtoms || levelParams.shuffleAtoms) { atoms = _.shuffleWithSeed(atoms); } slide = inc("/../app01-trainers/shared/slide/slide")(trainerParams, levelParams, THISFILE); slide.atoms = atoms; slide.atomsNormalized = inc("calcAtomsNormalized/calc")(atoms); slide.totalProgressElements = inc("calcTotalProgressElements/calc")(slide); slide.finishButton = (ref$ = slide.getParam("finishButton")) != null ? ref$ : false; return slide; }; })(); trainers/kidColorize/init.ls (function(){ return function(slide){ inc("/shared/resetTotalDoneTasks/reset")(slide); slide.currentAtomIndex = -1; slide.instructionDiv = inc("instructionDiv/div")(slide); slide.lsg = inc("lsg/lsg")(slide); slide.classNames = inc("calcClassNames/calc")(slide); slide.tapElements = inc("tapElements/tapElements")(slide); slide.colorPicker = inc("colorPicker/colorPicker")(slide); slide.startNextAtom = function(){ return inc("startNextAtom/start")(slide); }; slide.showInstruction = function(){ return inc("showInstruction/show")(slide); }; slide.calcAtomPendingTotal = function(){ return inc("calcAtomPendingTotal/calc")(slide); }; return slide.onTapElement = function(el){ return inc("onTapElement/on")(slide, el); }; }; })(); trainers/kidColorize/instructionDiv/div.ls (function(){ return function(slide){ var instruction; slide.atom = slide.atoms[0]; instruction = inc("/../app01-trainers/shared/instruction/instruction")(slide); slide.atom = null; return Div().html(instruction).appendTo(slide.div); }; })(); trainers/kidColorize/lsg/lsg.ls (function(){ return function(slide){ var lsgParams, div; lsgParams = slide.getParam("lsg"); div = inc("/shared/lsgSlim/lsg")({ lsgParams: lsgParams, slide: slide, defaultWidth: 250 }).css({ maxWidth: "95%" }).appendTo(slide.div); return div; }; })(); trainers/kidColorize/onTapElement/isCorrect/is.ls (function(){ return function(element, slide, atom, color, tapClass){ var i$, ref$, len$, t; for (i$ = 0, len$ = (ref$ = slide.atomNormalized.tasks).length; i$ < len$; ++i$) { t = ref$[i$]; if ((t.color === color || t.color === "any") && t['class'] === tapClass) { if (t.totalDone < t.total) { t.totalDone += 1; return true; } } } }; })(); trainers/kidColorize/onTapElement/on.ls (function(){ return function(slide, element){ var atom, color, tapClass, action, originalAtom, isCorrect; if (slide.tapsDisabled) { return; } atom = slide.atom; color = slide.selectedColor; tapClass = element.tapClass; action = { color: color, tapClass: tapClass, tapClassId: element.tapClassId }; originalAtom = slide.atoms[slide.currentAtomIndex]; if (!color) { inc("/../app01/lib/util/soundEffectPlay/soundEffectPlay")("wrongPreschool"); slide.colorPicker.attentionAnimation(); return; } isCorrect = inc("isCorrect/is")(element, slide, atom, color, tapClass); if (isCorrect) { return inc("onCorrect/on")(element, slide, color, originalAtom, action); } else { return inc("onWrong/on")(element, slide, color, originalAtom, action); } }; })(); trainers/kidColorize/onTapElement/onCorrect/on.ls (function(){ return function(element, slide, color, originalAtom, action){ var colorValue; colorValue = slide.getParam("colors")[slide.selectedColor]; element.attr({ fill: colorValue }).css({ pointerEvents: "none", color: colorValue }); element.fillColor = color; slide.levelPlayer.progressBar.showGreen(); slide.score.addActionCorrect(originalAtom, action); if (slide.calcAtomPendingTotal() === 0) { slide.tapsDisabled = true; return slide.score.log(originalAtom, function(){ return setTimeout(function(){ return slide.startNextAtom(); }, 500); }); } }; })(); trainers/kidColorize/onTapElement/onWrong/on.ls (function(){ return function(element, slide, color, originalAtom, action){ slide.colorPicker.attentionAnimation(); slide.levelPlayer.progressBar.addElement().showRed(); return slide.score.addActionMistake(originalAtom, action); }; })(); trainers/kidColorize/showInstruction/show.ls (function(){ return function(slide){ var ref$, instruction; if ((ref$ = slide.instructionDiv.instruction) != null) { ref$.stop(); } instruction = inc("/../app01-trainers/shared/instruction/instruction")(slide); slide.instructionDiv.html(instruction); if (slide.currentAtomIndex > 0) { instruction.fadeIn(1300); } instruction.play(); return slide.instructionDiv.instruction = instruction; }; })(); trainers/kidColorize/startNextAtom/start.ls (function(){ return function(slide){ slide.currentAtomIndex++; slide.atom = slide.atoms[slide.currentAtomIndex]; slide.atomNormalized = slide.atomsNormalized[slide.currentAtomIndex]; if (slide.atom) { slide.tapsDisabled = false; return slide.showInstruction(); } else { slide.colorPicker.remove(); return slide.finish(); } }; })(); trainers/kidColorize/tapElements/tapElements.ls (function(){ return function(slide){ var tapElements, i$, ref$, len$, c, elements, j$, len1$; tapElements = []; for (i$ = 0, len$ = (ref$ = slide.classNames).length; i$ < len$; ++i$) { c = ref$[i$]; elements = slide.lsg.findAll("." + c); for (j$ = 0, len1$ = elements.length; j$ < len1$; ++j$) { (fn$.call(this, j$, elements[j$])); } tapElements = _.concat(tapElements, elements); } return tapElements; function fn$(i, el){ el.tapClass = c; el.tapClassId = i; el.tap({ up: function(){ return slide.onTapElement(el); }, animation: "none" }).css({ pointerEvents: "none" }); } }; })(); trainers/kidCount/_media2/lsgs/lsgs.ls (function(){ return function(slide){ var lsgs, i$, ref$, len$, atom; lsgs = []; lsgs = _.concat(lsgs, slide.getParam("backgroundLsg")); for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; lsgs = _.concat(lsgs, atom.lsg); } return lsgs; }; })(); trainers/kidCount/_media2/sounds/calcCorrectSound/calc.ls (function(){ return function(slide, atom){ var s, correctSounds, soundArray, i$, len$, correctSound, sound, ref$; s = atom.sound; correctSounds = []; if (!(s != null && s.correct)) { return; } soundArray = _.ensureArray(s.correct); for (i$ = 0, len$ = soundArray.length; i$ < len$; ++i$) { correctSound = soundArray[i$]; sound = { text: correctSound, voice: (ref$ = s.voice) != null ? ref$ : slide.getParam("voice"), voiceLang: (ref$ = s.voiceLang) != null ? ref$ : slide.getParam("voiceLang") }; correctSounds.push(sound); } return correctSounds; }; })(); trainers/kidCount/_media2/sounds/calcEndSounds/calc.ls (function(){ return function(slide){ var s, sound, ref$; s = slide.atom.sound; if (!(s != null && s.end)) { return; } return sound = { text: s.end, voice: (ref$ = s.voice) != null ? ref$ : slide.getParam("voice"), voiceLang: (ref$ = s.voiceLang) != null ? ref$ : slide.getParam("voiceLang") }; }; })(); trainers/kidCount/_media2/sounds/calcInstructionSound/calc.ls (function(){ return function(slide, atom){ var i, sound, ref$; slide.atom = atom; i = slide.getParam("instruction"); if (!i.speaker) { return; } return sound = { text: (ref$ = i.sound) != null ? ref$ : i.text, voice: (ref$ = i.voice) != null ? ref$ : slide.getParam("voice"), voiceLang: (ref$ = i.voiceLang) != null ? ref$ : slide.getParam("voiceLang") }; }; })(); trainers/kidCount/_media2/sounds/sounds.ls (function(){ return function(slide){ var sounds, i$, ref$, len$, atom, correctSounds, that, endSounds, instructionSounds; sounds = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; slide.atom = atom; correctSounds = inc("calcCorrectSound/calc")(slide, atom); if (that = correctSounds) { sounds = sounds.concat(that); } endSounds = inc("calcEndSounds/calc")(slide, atom); if (that = endSounds) { sounds = sounds.concat(that); } } delete slide.atom; instructionSounds = inc("/shared/calcAtomInstructionSounds/calc")(slide); sounds = _.concat(sounds, instructionSounds); return sounds; }; })(); trainers/kidCount/_preview/preview.ls (function(){ return function(slide){ var i$, ref$, len$, atomIndex, atom, instructionText; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atomIndex = i$; atom = ref$[i$]; slide.atom = atom; instructionText = slide.getParam("instruction").text; Div().html(inc("/shared/_preview/instruction/instruction")(instructionText), slide.backgroundLsg.clone()).addClass("previewDiv").appendTo(slide.div); } return slide.backgroundLsg.hide(); }; })(); trainers/kidCount/_review/scoreActions/actions.ls (function(){ return function(slide){ var i$, ref$, len$, atomIndex, atom, results$ = []; inc("hidePreviewDivs/hide")(slide); slide.backgroundLsg.show(); inc("drawYellowTagsToPreviewDiv/draw")(slide); for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atomIndex = i$; atom = ref$[i$]; slide.atom = atom; slide.isMultiLsg = _.isArray(slide.atom.lsg); inc("drawInstruction/draw")(slide); results$.push(inc("drawActionRows/draw")(slide)); } return results$; }; })(); trainers/kidCount/_review/scoreActions/drawActionRows/draw.ls (function(){ return function(slide){ var scoreEvent, actions, i$, len$, action, row, results$ = []; scoreEvent = slide.score.getScoreEvent(slide.atom); if (!scoreEvent) { return; } actions = scoreEvent.actions; for (i$ = 0, len$ = actions.length; i$ < len$; ++i$) { action = actions[i$]; results$.push(slide.div.append(row = inc("/../app01-trainers/shared/scoreActionRowFlex/row")(action, inc("result/result")(slide, action)))); } return results$; }; })(); trainers/kidCount/_review/scoreActions/drawActionRows/result/arrow/arrow.ls (function(){ return function(){ return Svg({ svg: path("/../app01/lib/svg/shape/arrow-top.svg"), color: Color.grey[400] }).css({ transform: "rotate(90deg)", margin: "0 0.5em" }); }; })(); trainers/kidCount/_review/scoreActions/drawActionRows/result/calcLsg/calc.ls (function(){ return function(slide, action){ var lsg; if (slide.isMultiLsg) { if (action.totalDone === 0) { return lsg = slide.atom.lsg[action.totalDone]; } else { return lsg = slide.atom.lsg[action.totalDone - 1]; } } else { return lsg = slide.atom.lsg; } }; })(); trainers/kidCount/_review/scoreActions/drawActionRows/result/result.ls (function(){ return function(slide, action){ var lsg, lsgDiv; lsg = inc("calcLsg/calc")(slide, action); lsgDiv = inc("/shared/lsgSlim/lsg")({ lsgParams: lsg, slide: slide }).css({ margin: "0 0.5em", width: "2em" }); return Div({ display: "flex", flex: "1 1 auto", justifyContent: "flex-start" }).html(lsgDiv, inc("arrow/arrow")(), inc("yellowTag/div")(slide, action)); }; })(); trainers/kidCount/_review/scoreActions/drawActionRows/result/yellowTag/div.ls (function(){ return function(slide, action){ var yellowTag; yellowTag = slide.backgroundLsg.overlayDiv.findFirst(".yellowTag." + action.className); return yellowTag.clone().css({ margin: "0 0.5em", position: "relative" }); }; })(); trainers/kidCount/_review/scoreActions/drawInstruction/draw.ls (function(){ return function(slide){ var instruction; instruction = slide.getParam("instruction", slide.atom); return slide.div.append(inc("/shared/_preview/instruction/instruction")(instruction.text)); }; })(); trainers/kidCount/_review/scoreActions/drawYellowTagsToPreviewDiv/draw.ls (function(){ return function(slide){ var i$, ref$, len$, atomIndex, atom, targetDiv, className, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atomIndex = i$; atom = ref$[i$]; targetDiv = slide.backgroundLsg.overlayDiv.findFirst(".targetDiv." + atom['class']); className = targetDiv.className.replace("targetDiv ", ""); results$.push(targetDiv.append(inc("/shared/_review/yellowTag/tag")(atomIndex).addClass("yellowTag " + className))); } return results$; }; })(); trainers/kidCount/_review/scoreActions/hidePreviewDivs/hide.ls (function(){ return function(slide){ var previewDivs, i$, len$, previewDiv, results$ = []; previewDivs = slide.div.findAll(".previewDiv"); for (i$ = 0, len$ = previewDivs.length; i$ < len$; ++i$) { previewDiv = previewDivs[i$]; results$.push(previewDiv.hide()); } return results$; }; })(); trainers/kidCount/_skip/skip.ls (function(){ return function(slide){ var remaining, i$, i; remaining = slide.atom.total - slide.totalDone; for (i$ = 1; i$ <= remaining; ++i$) { i = i$; slide.levelPlayer.progressBar.showGreen(); } return slide.startNextAtom(); }; })(); trainers/kidCount/_start/start.ls (function(){ return function(slide){ return slide.startNextAtom(); }; })(); trainers/kidCount/backgroundLsg/lsg.ls (function(){ return function(slide){ var lsgParams, div; lsgParams = slide.getParam("backgroundLsg"); div = inc("/shared/lsgSlim/lsg")({ lsgParams: lsgParams, slide: slide }).css({ maxWidth: "95%" }).appendTo(slide.div); if (typeof div.updateLayout == 'function') { div.updateLayout(); } return div; }; })(); trainers/kidCount/calcTotalProgressElements/calc.ls (function(){ return function(slide){ var total, i$, ref$, len$, a; total = 0; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { a = ref$[i$]; total += a.total; } return total; }; })(); trainers/kidCount/generateSlides.ls (function(){ return function(trainerParams, levelParams){ var atoms, slide, ref$; atoms = _.ensureArray(trainerParams.atoms); if (trainerParams.shuffleAtoms || levelParams.shuffleAtoms) { atoms = _.shuffleWithSeed(atoms); } slide = inc("/../app01-trainers/shared/slide/slide")(trainerParams, levelParams, THISFILE); slide.atoms = atoms; slide.totalProgressElements = inc("calcTotalProgressElements/calc")(slide); slide.finishButton = (ref$ = slide.getParam("finishButton")) != null ? ref$ : false; return slide; }; })(); trainers/kidCount/init.ls (function(){ return function(slide){ slide.currentAtomIndex = -1; slide.backgroundLsg = inc("backgroundLsg/lsg")(slide); slide.targetDiv = inc("targetDiv/div")(slide); slide.startNextAtom = inc("startNextAtom/start")(slide); slide.showInstruction = inc("showInstruction/show")(slide); return slide.playSound = inc("playSound/play")(slide); }; })(); trainers/kidCount/playSound/calcSoundId/calc.ls (function(){ return function(slide, type){ var sounds, sound, soundId; if (type === "correct") { sounds = inc("../../_media2/sounds/calcCorrectSound/calc")(slide, slide.atom); sound = sounds != null ? sounds[slide.totalDone - 1] : void 8; } else if (type === "end") { sound = inc("../../_media2/sounds/calcEndSounds/calc")(slide); } if (!sound) { return; } return soundId = sound.text + sound.voice + sound.voiceLang; }; })(); trainers/kidCount/playSound/play.ls (function(){ return function(slide){ return function(type, onFinish){ var soundId, ref$; soundId = inc("calcSoundId/calc")(slide, type); if (!soundId) { return typeof onFinish == 'function' ? onFinish() : void 8; } else { if ((ref$ = slide.atomSound) != null) { ref$.stop(); } slide.atomSound = slide.sounds[soundId]; return slide.atomSound.play(function(){ return setTimeout(function(){ return typeof onFinish == 'function' ? onFinish() : void 8; }, 500); }); } }; }; })(); trainers/kidCount/showInstruction/show.ls (function(){ return function(slide){ return function(){ var ref$, instruction; if ((ref$ = slide.instruction) != null) { ref$.remove(); } instruction = inc("/../app01-trainers/shared/instruction/instruction")(slide); slide.div.prepend(instruction); instruction.play(); if (slide.currentAtomIndex > 0) { instruction.fadeIn(1300); } return slide.instruction = instruction; }; }; })(); trainers/kidCount/startNextAtom/start.ls (function(){ return function(slide){ return function(){ var ref$; slide.currentAtomIndex++; slide.atom = slide.atoms[slide.currentAtomIndex]; slide.totalDone = 0; slide.multiLsg = _.isArray((ref$ = slide.atom) != null ? ref$.lsg : void 8); if (slide.atom) { slide.backgroundLsg.overlayDiv.css({ pointerEvents: "" }); return slide.showInstruction(); } else { slide.targetDiv.css({ pointerEvents: "none" }); return setTimeout(slide.finish, 1000); } }; }; })(); trainers/kidCount/targetDiv/calcClassnames/calc.ls (function(){ return function(slide){ var lsgClassnames, atomClasses, i$, len$, atomClass, zone; lsgClassnames = []; atomClasses = _.map(slide.atoms, "class"); for (i$ = 0, len$ = atomClasses.length; i$ < len$; ++i$) { atomClass = atomClasses[i$]; zone = slide.backgroundLsg.findFirst("." + atomClass); if (zone) { lsgClassnames.push(atomClass); } } return lsgClassnames; }; })(); trainers/kidCount/targetDiv/div.ls (function(){ return function(slide){ var classNames, className; classNames = inc("calcClassnames/calc")(slide); return Div({ position: "absolute", top: 0, left: 0, right: 0, bottom: 0 }).html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = classNames).length; i$ < len$; ++i$) { className = ref$[i$]; results$.push(inc("lsgZonesArray/array")(slide, className)); } return results$; }())).appendTo(slide.backgroundLsg.overlayDiv); }; })(); trainers/kidCount/targetDiv/lsgZonesArray/_zoneDiv/div.ls (function(){ return function(slide, lsgEl, className){ var lsg, scale, offset, offset2, top, left, width, height; lsg = slide.backgroundLsg; scale = lsg.getCurrentScale(); offset = lsgEl.offset(); offset2 = lsg.offset(); top = (offset.top - offset2.top) / scale; left = (offset.left - offset2.left) / scale; width = offset.width / scale; height = offset.height / scale; return Div({ display: "flex", position: "absolute", top: top + "px", left: left + "px", width: width + "px", height: height + "px" }).addClass(className); }; })(); trainers/kidCount/targetDiv/lsgZonesArray/array.ls (function(){ return function(slide, className){ var tapElements, ignoredElements, array, tapElement, ignoredElement; tapElements = slide.backgroundLsg.findAll("." + className); ignoredElements = slide.backgroundLsg.findAll(".ignore"); inc("hideLsgZones/hide")(slide, tapElements); return array = [ (function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = tapElements).length; i$ < len$; ++i$) { tapElement = ref$[i$]; results$.push(inc("tapZoneDiv/div")(slide, className, tapElement)); } return results$; }()), (function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = ignoredElements).length; i$ < len$; ++i$) { ignoredElement = ref$[i$]; results$.push(inc("_zoneDiv/div")(slide, ignoredElement, "ignore")); } return results$; }()) ]; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/hideLsgZones/hide.ls (function(){ return function(slide, tapElements){ var i$, len$, tapElement, results$ = []; for (i$ = 0, len$ = tapElements.length; i$ < len$; ++i$) { tapElement = tapElements[i$]; if (slide.getParam("hideLsgZones")) { results$.push(tapElement.css({ opacity: 0 })); } } return results$; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/div.ls (function(){ return function(slide, className, lsgElement){ var tap, div; tap = function(e){ return inc("tap/tap")(slide, div, className, e); }; div = inc("../_zoneDiv/div")(slide, lsgElement, className); return div.tap({ up: tap, animation: "none" }).css({ cursor: "default" }).addClass("targetDiv"); }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/_calcPositionInDivBounds/calc.ls (function(){ return function(lsgDiv, targetDiv, translation){ var relativePosition, translatedPosition, divHeight, divWidth, targetHeight, targetWidth, divMaxPosition, positionInDivBounds; relativePosition = { top: lsgDiv.offset().top - targetDiv.offset().top, left: lsgDiv.offset().left - targetDiv.offset().left }; translatedPosition = { top: relativePosition.top + translation.top, left: relativePosition.left + translation.left }; divHeight = lsgDiv.height(); divWidth = lsgDiv.width(); targetHeight = targetDiv.height(); targetWidth = targetDiv.width(); divMaxPosition = { top: Math.min(translatedPosition.top, targetHeight - divHeight), left: Math.min(translatedPosition.left, targetWidth - divWidth) }; positionInDivBounds = { top: Math.max(divMaxPosition.top, 0), left: Math.max(divMaxPosition.left, 0) }; if (divHeight > targetHeight) { positionInDivBounds.top = 0; } return positionInDivBounds; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/calcLsgParams/calc.ls (function(){ return function(slide){ if (slide.multiLsg) { return slide.atom.lsg[slide.totalDone]; } else { return slide.atom.lsg; } }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/centerLsg/center.ls (function(){ return function(lsgDiv, targetDiv, scale){ var translation, positionInDivBounds; lsgDiv.updateLayout(); translation = { top: -(lsgDiv.height() / 2), left: -(lsgDiv.width() / 2) }; positionInDivBounds = inc("../_calcPositionInDivBounds/calc")(lsgDiv, targetDiv, translation); return lsgDiv.css({ top: positionInDivBounds.top / scale + "px", left: positionInDivBounds.left / scale + "px" }); }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/disablePointerEvents/disable.ls (function(){ return function(lsgDiv){ var totalSvgs, i$, len$, svg, lresult$, svgElements, j$, len1$, svgElement, results$ = []; totalSvgs = lsgDiv.findAll("svg"); for (i$ = 0, len$ = totalSvgs.length; i$ < len$; ++i$) { svg = totalSvgs[i$]; lresult$ = []; svgElements = svg.childrenAll(); for (j$ = 0, len1$ = svgElements.length; j$ < len1$; ++j$) { svgElement = svgElements[j$]; lresult$.push(svgElement.css({ pointerEvents: "none" })); } results$.push(lresult$); } return results$; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/insert.ls (function(){ return function(slide, positionedDiv, e){ var scale, left, top, lsgParams, lsgWidth, isOverlappingDiv, lsgDiv; scale = slide.backgroundLsg.getCurrentScale(); left = e.clientX - positionedDiv.offset().left; top = e.clientY - positionedDiv.offset().top; lsgParams = inc("calcLsgParams/calc")(slide, scale); lsgWidth = lsgParams.width * scale; isOverlappingDiv = inc("isOverlappingDiv/is")(e); lsgDiv = inc("/shared/lsgSlim/lsg")({ lsgParams: lsgParams, slide: slide }).css({ position: "absolute", left: left / scale + "px", top: top / scale + "px", width: lsgWidth / scale + "px" }).addClass("kidCountLsg").appendTo(positionedDiv); inc("disablePointerEvents/disable")(lsgDiv); inc("centerLsg/center")(lsgDiv, positionedDiv, scale); if (isOverlappingDiv) { return inc("moveCurrentDiv/move")(positionedDiv, lsgDiv, scale); } }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/isOverlappingDiv/is.ls (function(){ return function(e){ var el, isOverlapping; el = document.elementFromPoint(e.clientX, e.clientY); return isOverlapping = el.closest(".kidCountLsg") != null; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/moveCurrentDiv/animateDiv/animate.ls (function(){ return function(targetDiv, lsgDiv, nearestDiv, scale){ var translation, positionInBounds; translation = { top: lsgDiv.height() * nearestDiv.direction.top, left: lsgDiv.width() * nearestDiv.direction.left }; positionInBounds = inc("../../_calcPositionInDivBounds/calc")(lsgDiv, targetDiv, translation); return setTimeout(function(){ return lsgDiv.keyframeAnimate({ keyframes: { "100%": { top: positionInBounds.top / scale + "px", left: positionInBounds.left / scale + "px" } }, duration: 500 }); }, 100); }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/moveCurrentDiv/findNearestDiv/calcDirection/calc.ls (function(){ return function(distanceData){ var topLeftDistance, totalDistance, direction; topLeftDistance = distanceData.topLeftDistance; totalDistance = distanceData.totalDistance; return direction = { top: _.round(topLeftDistance.top / totalDistance, 2), left: _.round(topLeftDistance.left / totalDistance, 2) }; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/moveCurrentDiv/findNearestDiv/calcDistanceData/calc.ls (function(){ return function(overlapDiv, lsgDiv){ var topLeftDistance, totalDistance, distanceData; topLeftDistance = inc("calcTopLeftDistance/calc")(overlapDiv, lsgDiv); totalDistance = _.round(Math.sqrt(Math.pow(topLeftDistance.top, 2) + Math.pow(topLeftDistance.left, 2)), 2); return distanceData = { topLeftDistance: topLeftDistance, totalDistance: totalDistance }; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/moveCurrentDiv/findNearestDiv/calcDistanceData/calcTopLeftDistance/calc.ls (function(){ return function(overlapDiv, lsgDiv){ var overlapDivOffset, lsgDivOffset, overlapDivLeft, overlapDivTop, lsgDivLeft, lsgDivTop, deltaTop, deltaLeft, distance; overlapDivOffset = overlapDiv.offset(); lsgDivOffset = lsgDiv.offset(); overlapDivLeft = overlapDivOffset.left + overlapDiv.width() / 2; overlapDivTop = overlapDivOffset.top + overlapDiv.height() / 2; lsgDivLeft = lsgDivOffset.left + lsgDiv.width() / 2; lsgDivTop = lsgDivOffset.top + lsgDiv.height() / 2; deltaTop = lsgDivTop - overlapDivTop; deltaLeft = lsgDivLeft - overlapDivLeft; return distance = { top: deltaTop === 0 ? inc("calcRandom/calc")() : deltaTop, left: deltaLeft === 0 ? inc("calcRandom/calc")() : deltaLeft }; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/moveCurrentDiv/findNearestDiv/calcDistanceData/calcTopLeftDistance/calcRandom/calc.ls (function(){ return function(){ var number; number = _.random(0, 10); if (_.random(0, 1) === 1) { return number; } else { return -number; } }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/moveCurrentDiv/findNearestDiv/find.ls (function(){ return function(targetDiv, lsgDiv){ var lsgDivs, overlapDivs, divDistances, nearestDiv; lsgDivs = targetDiv.childrenAll(); overlapDivs = _.filter(lsgDivs, function(div){ var divOffset, lsgDivOffset; if (div === lsgDiv) { return false; } divOffset = div.offset(); lsgDivOffset = lsgDiv.offset(); return inc("willOverlapWithDiv/will")(divOffset, lsgDivOffset); }); divDistances = _.map(overlapDivs, function(overlapDiv){ var distanceData, direction, divDistance; distanceData = inc("calcDistanceData/calc")(overlapDiv, lsgDiv); direction = inc("calcDirection/calc")(distanceData); return divDistance = { div: overlapDiv, direction: direction, distance: distanceData.totalDistance }; }); nearestDiv = _.minBy(divDistances, "distance"); return nearestDiv; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/moveCurrentDiv/findNearestDiv/willOverlapWithDiv/will.ls (function(){ return function(divOffset, possibleOffset){ if (divOffset.right < possibleOffset.left) { return false; } if (divOffset.left > possibleOffset.right) { return false; } if (divOffset.top > possibleOffset.bottom) { return false; } if (divOffset.bottom < possibleOffset.top) { return false; } return true; }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/insertLsgToDiv/moveCurrentDiv/move.ls (function(){ return function(targetDiv, lsgDiv, scale){ var nearestDiv; nearestDiv = inc("findNearestDiv/find")(targetDiv, lsgDiv); if (nearestDiv) { return inc("animateDiv/animate")(targetDiv, lsgDiv, nearestDiv, scale); } }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/on.ls (function(){ return function(slide, positionedDiv, className, e){ inc("insertLsgToDiv/insert")(slide, positionedDiv, e); slide.levelPlayer.progressBar.showGreen(); slide.totalDone++; slide.score.addActionCorrect(slide.atom, { totalDone: slide.totalDone, className: className }); if (slide.totalDone === slide.atom.total) { return inc("onFinishAtom/on")(slide, positionedDiv); } else { return setTimeout(function(){ return slide.playSound("correct"); }, 200); } }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onCorrect/onFinishAtom/on.ls (function(){ return function(slide, positionedDiv){ slide.backgroundLsg.overlayDiv.css({ pointerEvents: "none" }); return slide.score.log(slide.atom, function(){ return setTimeout(function(){ return slide.playSound("correct", function(){ return slide.playSound("end", function(){ return slide.startNextAtom(); }); }); }, 200); }); }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/onWrong/on.ls (function(){ return function(slide, className){ slide.levelPlayer.progressBar.addElement().showRed(); return slide.score.addActionMistake(slide.atom, { totalDone: slide.totalDone, className: className }); }; })(); trainers/kidCount/targetDiv/lsgZonesArray/tapZoneDiv/tap/tap.ls (function(){ return function(slide, positionedDiv, className, e){ if (className === slide.atom['class']) { return inc("onCorrect/on")(slide, positionedDiv, className, e); } else { return inc("onWrong/on")(slide, className); } }; })(); trainers/kidDragGroup/_media2/lsgs/lsgs.ls (function(){ return function(slide){ var lsgs, that, i$, ref$, len$, dragEl, group, j$, ref1$, len1$, prefill; lsgs = []; if (that = slide.getParam("backgroundLsg")) { lsgs.push(that); } for (i$ = 0, len$ = (ref$ = _.ensureArray(slide.getParam("dragElements"))).length; i$ < len$; ++i$) { dragEl = ref$[i$]; if (that = dragEl.lsg) { lsgs.push(that); } } for (i$ = 0, len$ = (ref$ = _.ensureArray(slide.getParam("groups"))).length; i$ < len$; ++i$) { group = ref$[i$]; if (that = group.lsg) { lsgs.push(that); } for (j$ = 0, len1$ = (ref1$ = _.ensureArray(group.prefill)).length; j$ < len1$; ++j$) { prefill = ref1$[j$]; if (that = prefill.lsg) { lsgs.push(that); } } } return lsgs; }; })(); trainers/kidDragGroup/_media2/sounds/calcDragElementSound/calc.ls (function(){ return function(slide, soundPart){ var soundElements, soundType, sound, dragSoundElement; soundElements = []; for (soundType in soundPart) { if (soundType !== "start" && soundType !== "end") { continue; } sound = soundPart[soundType]; dragSoundElement = { text: sound.text || sound, voice: sound.voice || slide.getParam("voice"), voiceLang: sound.voiceLang || slide.getParam("voiceLang"), type: soundType }; soundElements.push(dragSoundElement); } return soundElements; }; })(); trainers/kidDragGroup/_media2/sounds/sounds.ls (function(){ return function(slide){ var sounds, instructionSounds, i$, ref$, len$, el, that; sounds = []; instructionSounds = inc("/shared/calcAtomInstructionSounds/calc")(slide); sounds = sounds.concat(instructionSounds); for (i$ = 0, len$ = (ref$ = slide.getParam("dragElements")).length; i$ < len$; ++i$) { el = ref$[i$]; if (that = el.sound) { sounds = sounds.concat(inc("calcDragElementSound/calc")(slide, that)); } } return sounds; }; })(); trainers/kidDragGroup/_preview/hideGroups/hide.ls (function(){ return function(slide, lsg){ var groups, i$, len$, group, solvedZone, dragZone, results$ = []; if (!slide.getParam("hideLsgZones")) { return; } groups = _.ensureArray(slide.getParam("groups")); for (i$ = 0, len$ = groups.length; i$ < len$; ++i$) { group = groups[i$]; solvedZone = lsg.findFirst("." + group.solvedZone); dragZone = lsg.findFirst("." + group.zone); if (solvedZone != null) { solvedZone.css({ opacity: 0 }); } results$.push(dragZone != null ? dragZone.css({ opacity: 0 }) : void 8); } return results$; }; })(); trainers/kidDragGroup/_preview/preview.ls (function(){ return function(slide){ var i$, ref$, len$, atomIndex, atom, instructionText, lsg, ref1$; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atomIndex = i$; atom = ref$[i$]; slide.atom = atom; instructionText = slide.getParam("instruction").text; Div().html(inc("/shared/_preview/instruction/instruction")(instructionText), lsg = inc("../backgroundLsg/lsg")(slide), inc("../groups/groups")(slide), inc("../dragElementsDiv/div")(slide)).addClass("previewDiv" + atomIndex).appendTo(slide.div); inc("hideGroups/hide")(slide, lsg); if (!slide.enableAtomInstruction) { break; } } inc("resizeDragElements/resize")(slide); if ((ref$ = slide.groups) != null) { ref$.hide(); } if ((ref1$ = slide.backgroundLsg) != null) { ref1$.hide(); } return slide.dragElementsDiv.hide(); }; })(); trainers/kidDragGroup/_preview/resizeDragElements/resize.ls (function(){ return function(slide){ var dragElementDivs, i$, len$, dragElementDiv, lresult$, j$, ref$, len1$, dragElement, lsg, results$ = []; if (slide.dragElements.length > 5) { dragElementDivs = slide.div.findAll(".dragElements"); for (i$ = 0, len$ = dragElementDivs.length; i$ < len$; ++i$) { dragElementDiv = dragElementDivs[i$]; lresult$ = []; for (j$ = 0, len1$ = (ref$ = dragElementDiv.childrenAll()).length; j$ < len1$; ++j$) { dragElement = ref$[j$]; lsg = dragElement.findFirst(".lsg3"); dragElement.css({ margin: "1%", width: "auto", height: "auto" }); lresult$.push(lsg.css({ width: "1.5em", height: "1.5em" })); } results$.push(lresult$); } return results$; } }; })(); trainers/kidDragGroup/_review/scoreActions/actions.ls (function(){ return function(slide){ inc("hidePreviewDivs/hide")(slide); inc("showSlideDiv/show")(slide); inc("drawYellowTagsToTarget/draw")(slide); return inc("drawActionRows/draw")(slide); }; })(); trainers/kidDragGroup/_review/scoreActions/drawActionRows/actionsRows/result/arrow/arrow.ls (function(){ return function(){ return Svg({ svg: path("/../app01/lib/svg/shape/arrow-top.svg"), color: Color.grey[400] }).css({ transform: "rotate(90deg)", marginRight: "0.5em" }); }; })(); trainers/kidDragGroup/_review/scoreActions/drawActionRows/actionsRows/result/element/element.ls (function(){ return function(slide, elementCategory, dragElements){ var dragElement, lsg, lsgDiv; dragElements = _.ensureArray(dragElements); dragElement = _.find(dragElements, function(element){ return element.elementCategory === elementCategory; }); lsg = dragElement.lsg; lsgDiv = inc("/../app01-trainers/shared/lsg/lsg")({ lsg: lsg, slide: slide }).css({ height: "2em", width: "2em" }); return Div().html(lsgDiv); }; })(); trainers/kidDragGroup/_review/scoreActions/drawActionRows/actionsRows/result/result.ls (function(){ return function(slide, action, dragElements){ return Div({ flex: "1 1 auto", display: "flex", justifyContent: "flex-start" }).append(inc("element/element")(slide, action.elementCategory, dragElements), inc("arrow/arrow")(), inc("../../../yellowTag/yellowTag")(action.groupId)); }; })(); trainers/kidDragGroup/_review/scoreActions/drawActionRows/actionsRows/rows.ls (function(){ return function(slide, actions, dragElements){ var i$, len$, action, row, results$ = []; for (i$ = 0, len$ = actions.length; i$ < len$; ++i$) { action = actions[i$]; results$.push(row = inc("/../app01-trainers/shared/scoreActionRowFlex/row")(action, inc("result/result")(slide, action, dragElements))); } return results$; }; })(); trainers/kidDragGroup/_review/scoreActions/drawActionRows/calcDragElements/calc.ls (function(){ return function(slide){ var elements, dragElement; return elements = (function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = dragElements).length; i$ < len$; ++i$) { dragElement = ref$[i$]; results$.push(dragElement); } return results$; }()); }; })(); trainers/kidDragGroup/_review/scoreActions/drawActionRows/draw.ls (function(){ return function(slide){ var dragElements; dragElements = slide.getParam("dragElements"); if (slide.enableAtomInstructions) { return inc("drawWithInstructions/draw")(slide, dragElements); } else { return inc("drawWithSortedActions/draw")(slide, dragElements); } }; })(); trainers/kidDragGroup/_review/scoreActions/drawActionRows/drawWithInstructions/draw.ls (function(){ return function(slide, dragElements){ var i$, ref$, len$, a, scoreEvent, actions, instruction, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { a = ref$[i$]; scoreEvent = slide.score.getScoreEvent(a); if (!scoreEvent) { continue; } actions = scoreEvent != null ? scoreEvent.actions : void 8; instruction = inc("/shared/_preview/calcInstruction/calc")(a); slide.div.append(inc("/shared/_preview/instruction/instruction")(instruction)); results$.push(slide.div.append(inc("../actionsRows/rows")(slide, actions, dragElements))); } return results$; }; })(); trainers/kidDragGroup/_review/scoreActions/drawActionRows/drawWithSortedActions/calcActions/calc.ls (function(){ return function(slide){ var scoreEvents, i$, ref$, len$, a, e, actions, j$, len1$; scoreEvents = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { a = ref$[i$]; e = slide.score.getScoreEvent(a); if (e) { scoreEvents.push(e); } } actions = []; for (i$ = 0, len$ = scoreEvents.length; i$ < len$; ++i$) { e = scoreEvents[i$]; for (j$ = 0, len1$ = (ref$ = e.actions).length; j$ < len1$; ++j$) { a = ref$[j$]; actions.push(a); } } return _.sortBy(actions, "position"); }; })(); trainers/kidDragGroup/_review/scoreActions/drawActionRows/drawWithSortedActions/draw.ls (function(){ return function(slide, dragElements){ var actions, instruction; actions = inc("calcActions/calc")(slide); instruction = slide.getParam("instruction").text; return slide.div.append(inc("/shared/_preview/instruction/instruction")(instruction), inc("../actionsRows/rows")(slide, actions, dragElements)); }; })(); trainers/kidDragGroup/_review/scoreActions/drawYellowTagsToTarget/draw.ls (function(){ return function(slide){ var targets, i$, len$, target, id, results$ = []; targets = slide.groups.findAll(".dragTarget"); for (i$ = 0, len$ = targets.length; i$ < len$; ++i$) { target = targets[i$]; id = target.groupData.groupId; results$.push(target.append(inc("../yellowTag/yellowTag")(id))); } return results$; }; })(); trainers/kidDragGroup/_review/scoreActions/hidePreviewDivs/hide.ls (function(){ return function(slide){ var i$, ref$, len$, atomIndex, atom, previewDiv, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atomIndex = i$; atom = ref$[i$]; previewDiv = slide.div.findFirst(".previewDiv" + atomIndex); previewDiv.hide(); if (!slide.enableAtomInstruction) { break; } } return results$; }; })(); trainers/kidDragGroup/_review/scoreActions/showSlideDiv/show.ls (function(){ return function(slide){ var ref$, ref1$; if ((ref$ = slide.groups) != null) { ref$.show(); } if ((ref1$ = slide.backgroundLsg) != null) { ref1$.show(); } return slide.dragElementsDiv.show(); }; })(); trainers/kidDragGroup/_review/scoreActions/yellowTag/yellowTag.ls (function(){ return function(id){ return Div({ padding: "0.2em", fontSize: "0.75em", background: Color.yellow[200], boxShadow: '0px 0px 2px #bbb', color: "black" }).html(id + ""); }; })(); trainers/kidDragGroup/_skip/skip.ls (function(){ return function(slide){ var remainingTasks, i$, i; remainingTasks = slide.calcRemainingTasks(slide); for (i$ = 1; i$ <= remainingTasks; ++i$) { i = i$; slide.levelPlayer.progressBar.showGreen(); } return slide.onFinishedSlide(); }; })(); trainers/kidDragGroup/_start/start.ls (function(){ return function(slide){ if (slide.enableAtomInstructions) { slide.startNextAtom(); } else { slide.showInstruction(); } return slide.dragElementsDiv.start(); }; })(); trainers/kidDragGroup/backgroundLsg/lsg.ls (function(){ return function(slide){ var lsgParams, div; lsgParams = slide.getParam("backgroundLsg"); if (!lsgParams) { return; } if (!lsgParams.width) { debug("backgroundLsg width is missing"); return; } div = inc("/shared/lsgSlim/lsg")({ slide: slide, lsgParams: lsgParams }).css({ maxWidth: "90%" }).appendTo(slide.div); if (typeof div.updateLayout == 'function') { div.updateLayout(); } return div; }; })(); trainers/kidDragGroup/calcAtomsNormalized/calc.ls (function(){ return function(atoms){ var atomsNormalized, atom, atom2, t; return atomsNormalized = (function(){ var i$, ref$, len$, j$, ref1$, len1$, results$ = []; for (i$ = 0, len$ = (ref$ = atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; if (atom != null && atom.tasks) { atom2 = _.cloneDeep(atom); atom2.tasks = _.ensureArray(atom2.tasks); } else { atom2 = _.omit(atom, ["groupId", "elementCategory", "total"]); atom2.tasks == null && (atom2.tasks = [_.pick(atom, ["groupId", "elementCategory", "total"])]); } for (j$ = 0, len1$ = (ref1$ = atom2.tasks).length; j$ < len1$; ++j$) { t = ref1$[j$]; t.atom = atom; } results$.push(atom2); } return results$; }()); }; })(); trainers/kidDragGroup/calcCurrentTasks/calc.ls (function(){ return function(slide){ var tasks, atom; return tasks = !slide.enableAtomInstructions ? _.flatten((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atomsNormalized).length; i$ < len$; ++i$) { atom = ref$[i$]; results$.push(atom.tasks); } return results$; }())) : slide.atomsNormalized[slide.currentAtomIndex].tasks; }; })(); trainers/kidDragGroup/calcRemainingTasks/calc.ls (function(){ return function(slide){ var tasks, totalDone, total, i$, len$, task; tasks = slide.calcCurrentTasks(); totalDone = 0; total = 0; for (i$ = 0, len$ = tasks.length; i$ < len$; ++i$) { task = tasks[i$]; totalDone += task.totalDone; total += task.total; } return total - totalDone; }; })(); trainers/kidDragGroup/calcTotalProgressElements/calc.ls (function(){ return function(slide){ var total, i$, ref$, len$, atom, j$, ref1$, len1$, task; total = 0; for (i$ = 0, len$ = (ref$ = slide.atomsNormalized).length; i$ < len$; ++i$) { atom = ref$[i$]; for (j$ = 0, len1$ = (ref1$ = atom.tasks).length; j$ < len1$; ++j$) { task = ref1$[j$]; if (task.total) { total += task.total; } } } return total; }; })(); trainers/kidDragGroup/dragElementsDiv/calcDragElements/calc.ls (function(){ return function(slide){ var dragElements, i$, ref$, len$, el, total, j$, i; dragElements = []; for (i$ = 0, len$ = (ref$ = _.ensureArray(slide.getParam("dragElements"))).length; i$ < len$; ++i$) { el = ref$[i$]; total = el.total || 1; for (j$ = 1; j$ <= total; ++j$) { i = j$; dragElements.push(_.omit(el, "total")); } } if (slide.getParam("shuffleDragElements")) { dragElements = _.shuffleWithSeed(dragElements); } return dragElements; }; })(); trainers/kidDragGroup/dragElementsDiv/calcScroll/calc.ls (function(){ return function(slide){ return inc("/../app01/lib/util/waitFrames/wait")(4, function(){ var psw, ref$; psw = slide.levelPlayer.page.pageScrollWrapper; if (psw.isScrollableY) { slide.pageIsScrollable = true; } return (ref$ = slide.maxScrollTop) != null ? ref$ : slide.maxScrollTop = psw.scrollHeight - psw.clientHeight - 30; }); }; })(); trainers/kidDragGroup/dragElementsDiv/div.ls (function(){ return function(slide){ var dragElements, start, div, d; dragElements = inc("calcDragElements/calc")(slide); start = function(){ var i$, ref$, len$, dragElement; slide.totalDraggedElements = 0; slide.dragScrollFix = 0; for (i$ = 0, len$ = (ref$ = slide.dragElements).length; i$ < len$; ++i$) { dragElement = ref$[i$]; dragElement.start(); } return inc("calcScroll/calc")(slide); }; div = Div({ display: "flex", margin: "2em auto 0", flexWrap: "wrap", maxWidth: "25em" }).html(slide.dragElements = (function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = dragElements).length; i$ < len$; ++i$) { d = ref$[i$]; results$.push(inc("dragElement/dragElement")(slide, d)); } return results$; }())).addClass("dragElements safeAreaPaddingBottom").appendTo(slide.div); div.start = start; return div; }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/calcWidthHeightEm/calc.ls (function(){ return function(lsgData, customWidth){ var s, that, r; lsgData = lsgData; s = 4; if (that = customWidth) { s = that / inc("/../app01/lib/util/emToPx/emToPx")(1); } r = lsgData.width / lsgData.height; if (r > 1) { return { w: s, h: s / r }; } else { return { w: s * r, h: s }; } }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/_highlightTarget/highlight.ls (function(){ return function(slide){ var i$, ref$, len$, el, results$ = []; if (slide.getParam("groupLayout") === "backgroundLsg") { return; } for (i$ = 0, len$ = (ref$ = slide.div.findAll(".dragTarget")).length; i$ < len$; ++i$) { el = ref$[i$]; results$.push(el.css({ background: el === slide.dragTarget ? Color.blue[50] : Color.grey[75] })); } return results$; }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/drag.ls (function(){ return function(slide, div){ return div.drag({ boundingDiv: slide.div, updateBoundsOnDrag: true, shouldStart: function(){ return div.disableDrag !== true && slide.totalDraggedElements === 0; }, onStart: function(e){ slide.playDragSound(div.dragElementData, "start"); return slide.totalDraggedElements++; }, onMove: function(e){ return inc("onMove/on")(e, slide, div); }, onEnd: function(e){ inc("onEnd/on")(e, slide, div); slide.dragTarget = null; slide.totalDraggedElements--; return slide.dragScrollFix = 0; } }).bind("touchstart", function(e){ return e.preventDefault(); }); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/_reset/reset.ls (function(){ return function(slide, div, e){ div.disableDrag = true; e.updateTranslation({ y: -slide.dragScrollFix, x: 0 }); e.animateToStart(function(){ return div.disableDrag = false; }); return slide.levelPlayer.page.scrollElementIntoView(div, { padding: 20 }); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/calcTask/calc.ls (function(){ return function(slide, target){ return _.find(slide.calcCurrentTasks(), { groupId: target.groupData.groupId }); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/on.ls (function(){ return function(e, slide, div){ var target, d, task, action; inc("../_highlightTarget/highlight")(slide); target = slide.dragTarget; if (!target) { inc("_reset/reset")(slide, div, e); return; } d = div.dragElementData; task = inc("calcTask/calc")(slide, target); action = { elementCategory: d.elementCategory, groupId: target.groupData.groupId }; if (task != null && task.totalDone < task.total && task.elementCategory === d.elementCategory) { return inc("onCorrect/on")(e, slide, div, task, action, target); } else { return inc("onWrong/on")(e, slide, div, task, action, target); } }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/onCorrect/animate/animate.ls (function(){ return function(slide, div, target){ div.css({ pointerEvents: "none", cursor: "default", background: "rgba(248, 248, 248, 0.5)" }); div.offsetSave(); inc("replaceWithPlaceholder/replace")(div); inc("appendToTarget/append")(slide, div, target); return div.offsetAnimate(300); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/onCorrect/animate/appendToTarget/append.ls (function(){ return function(slide, div, target){ var solvedZone, target2, wh, wrapperDiv, o1, o2, s; solvedZone = target.groupData.solvedZone; target2 = solvedZone ? slide.div.findFirst(".solvedTarget_" + solvedZone) : target; wh = inc("calcWidthHeightEm/calc")(div.lsg.lsgData, div.dragElementData.lsg.solvedWidth); target2.append(wrapperDiv = Div({ display: "flex", width: wh.w + "em", height: wh.h + "em" }).html(div.css({ background: "", transform: "", pointerEvents: "none" }))); o1 = wrapperDiv.offset(); o2 = div.offset(); s = o1.width / o2.width; return div.css({ transform: "scale(" + s + ")" }); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/onCorrect/animate/appendToTarget/calcWidthHeightEm/calc.ls (function(){ return function(lsgData, customWidth){ var s, that, r; lsgData = lsgData; s = 4; if (that = customWidth) { s = that / inc("/../app01/lib/util/emToPx/emToPx")(1); } r = lsgData.width / lsgData.height; return { w: s, h: s / r }; }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/onCorrect/animate/replaceWithPlaceholder/replace.ls (function(){ return function(div){ return div.replaceWith(Div({ width: div.css("width"), height: div.css("height"), margin: div.css("margin") })); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/onCorrect/disableDragElements/disable.ls (function(){ return function(slide){ var i$, ref$, len$, el, results$ = []; for (i$ = 0, len$ = (ref$ = slide.dragElements).length; i$ < len$; ++i$) { el = ref$[i$]; results$.push(el.css({ pointerEvents: "none", cursor: "default" })); } return results$; }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/onCorrect/on.ls (function(){ return function(e, slide, div, task, action, target){ var finishAtom, d; inc("animate/animate")(slide, div, target); finishAtom = function(){ return setTimeout(function(){ return slide.finishAtom(); }, 500); }; task.totalDone++; slide.levelPlayer.progressBar.showGreen(); slide.score.addActionCorrect(task.atom, action); d = div.dragElementData; if (task.totalDone !== task.total) { slide.playDragSound(d, "end"); return; } return slide.score.log(task.atom, function(){ var r; r = slide.calcRemainingTasks(slide); if (r === 0) { if (!slide.enableAtomInstructions) { inc("disableDragElements/disable")(slide); } return slide.playDragSound(d, "end", finishAtom); } else { return slide.playDragSound(d, "end"); } }); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onEnd/onWrong/on.ls (function(){ return function(e, slide, div, task, action, target){ var atom; inc("../_reset/reset")(slide, div, e); atom = slide.enableAtomInstructions ? slide.atom : task.atom; slide.levelPlayer.progressBar.addElement().showRed(); return slide.score.addActionMistake(atom, action); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onMove/calcTarget/calc.ls (function(){ return function(slide, div){ var collidingDivs, divOffset, i$, ref$, len$, el; collidingDivs = []; divOffset = div.offset(); for (i$ = 0, len$ = (ref$ = slide.div.findAll(".dragTarget")).length; i$ < len$; ++i$) { el = ref$[i$]; if (inc("isColliding/is")(el, divOffset)) { collidingDivs.push(el); } } if (collidingDivs.length === 0) { return; } else if (collidingDivs.length === 1) { return collidingDivs[0]; } return inc("calcNearestTarget/calc")(collidingDivs, div); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onMove/calcTarget/calcNearestTarget/calc.ls (function(){ return function(collidingDivs, div){ var a, res$, i$, len$, el; res$ = []; for (i$ = 0, len$ = collidingDivs.length; i$ < len$; ++i$) { el = collidingDivs[i$]; res$.push({ element: el, distance: inc("calcDist/calc")(div, el) }); } a = res$; a = _.minBy(a, "distance"); return a.element; }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onMove/calcTarget/calcNearestTarget/calcDist/calc.ls (function(){ return function(div1, div2){ var o1, o2, div1X, div1Y, div2X, div2Y, dist; o1 = div1.offset(); o2 = div2.offset(); div1X = o1.left + div1.width() / 2; div1Y = o1.top + div1.height() / 2; div2X = o2.left + div2.width() / 2; div2Y = o2.top + div2.height() / 2; return dist = Math.sqrt(Math.pow(div2X - div1X, 2) + Math.pow(div2Y - div1Y, 2)); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onMove/calcTarget/isColliding/calcOffsetsOverlap/calc.ls (function(){ return function(o1, o2){ if (o1.right < o2.left) { return false; } if (o1.left > o2.right) { return false; } if (o1.top > o2.bottom) { return false; } if (o1.bottom < o2.top) { return false; } return true; }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onMove/calcTarget/isColliding/is.ls (function(){ return function(dragTargetDiv, pairBOffset){ var o2, isColliding; o2 = dragTargetDiv.offset(); isColliding = inc("calcOffsetsOverlap/calc")(pairBOffset, o2); return isColliding; }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onMove/on.ls (function(){ return function(e, slide, div){ if (slide.pageIsScrollable) { inc("scroll/scroll")(e, slide, div); } slide.dragTarget = inc("calcTarget/calc")(slide, div); return inc("../_highlightTarget/highlight")(slide); }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/drag/onMove/scroll/scroll.ls (function(){ return function(e, slide, div){ var y, psw, pageTop, pageBottom, scroll; y = e.clientPosition.y; psw = slide.levelPlayer.page.pageScrollWrapper; pageTop = slide.levelPlayer.page.top.height() + 50; pageBottom = window.innerHeight - slide.levelPlayer.page.bottom.height() - 50; scroll = function(){ if (slide.totalDraggedElements === 0) { return; } if (div.scrollDirection === "up" && psw.scrollTop > 0) { psw.scrollTop -= 5; slide.dragScrollFix -= 5; e.updateTranslation({ y: -5, x: 0 }); return setTimeout(scroll, 50); } else if (div.scrollDirection === "down") { if (slide.maxScrollTop <= psw.scrollTop) { div.scrollDirection = null; return; } psw.scrollTop += 5; slide.dragScrollFix += 5; e.updateTranslation({ y: 5, x: 0 }); return setTimeout(scroll, 50); } }; if (y > pageBottom) { div.scrollDirection = "down"; return scroll(); } else if (y < pageTop) { div.scrollDirection = "up"; return scroll(); } else { return div.scrollDirection = null; } }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/dragElement.ls (function(){ return function(slide, dragElementData){ var lsg, wh, start, div; lsg = inc("lsg/lsg")(slide, dragElementData.lsg); wh = inc("calcWidthHeightEm/calc")(lsg.lsgData, dragElementData.lsg.width); start = function(){ return inc("drag/drag")(slide, div); }; div = Div({ display: "flex", width: wh.w + "em", height: wh.h + "em", margin: "0.4em", borderRadius: "999px", background: Color.grey[75] }).html(lsg.css({ width: wh.w + "em", height: wh.h + "em" })); div.dragElementData = dragElementData; div.lsg = lsg; div.start = start; return div; }; })(); trainers/kidDragGroup/dragElementsDiv/dragElement/lsg/lsg.ls (function(){ return function(slide, lsgParams){ var lsg; return lsg = inc("/shared/lsgSlim/lsg")({ lsgParams: lsgParams, slide: slide, defaultWidth: "original" }); }; })(); trainers/kidDragGroup/finishAtom/finish.ls (function(){ return function(slide){ if (slide.enableAtomInstructions) { return slide.startNextAtom(); } else { return slide.finish(); } }; })(); trainers/kidDragGroup/generateSlides.ls (function(){ return function(trainerParams, levelParams){ var atoms, slide, ref$; atoms = _.ensureArray(trainerParams.atoms); if (trainerParams.shuffleAtoms || levelParams.shuffleAtoms) { atoms = _.shuffleWithSeed(atoms); } slide = inc("/../app01-trainers/shared/slide/slide")(trainerParams, levelParams, THISFILE); slide.atoms = atoms; slide.atomsNormalized = inc("calcAtomsNormalized/calc")(atoms); slide.totalProgressElements = inc("calcTotalProgressElements/calc")(slide); slide.enableAtomInstructions = _.find(slide.atoms, function(a){ return a.instruction != null; }) != null; slide.finishButton = (ref$ = slide.getParam("finishButton")) != null ? ref$ : false; return slide; }; })(); trainers/kidDragGroup/groups/flexDiv/div.ls (function(){ return function(slide, layout, groups){ var totalGroups, isHorizontal, group; totalGroups = groups.length; isHorizontal = layout === "horizontal"; return Div({ display: "flex", margin: "0 auto", width: "90%", flexDirection: isHorizontal ? "row" : "column", alignItems: isHorizontal ? "flex-start" : "center" }).html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = groups).length; i$ < len$; ++i$) { group = ref$[i$]; results$.push(inc("group/group")(slide, group, groups, isHorizontal)); } return results$; }())).appendTo(slide.div); }; })(); trainers/kidDragGroup/groups/flexDiv/group/group.ls (function(){ return function(slide, group, groups, isHorizontal){ var div; return div = Div({ display: "flex", justifyContent: "center", margin: "0.5em", width: isHorizontal ? (100 / groups.length - 5) + "%" : "100%", maxWidth: isHorizontal ? "5em" : "20em", flexDirection: isHorizontal ? "column" : "row" }).html(inc("title/title")(slide, group, isHorizontal), inc("lsg/lsg")(slide, group), inc("targetDiv/div")(slide, group, groups, isHorizontal)); }; })(); trainers/kidDragGroup/groups/flexDiv/group/lsg/lsg.ls (function(){ return function(slide, group){ if (!group.lsg) { return; } return inc("/../app01-trainers/shared/lsg/lsg")({ lsg: group.lsg, slide: slide }).css({ width: "3em", height: "3em", pointerEvents: "none", margin: "0.2em" }); }; })(); trainers/kidDragGroup/groups/flexDiv/group/targetDiv/div.ls (function(){ return function(slide, group, groups, isHorizontal){ var div, that; div = Div({ display: "flex", justifyContent: "flex-start", width: "100%", background: Color.grey[75], border: (that = group.borderColor) ? "2px solid " + that : "2px solid " + Color.grey[250], minHeight: isHorizontal ? "10em" : "5em", flexDirection: isHorizontal ? "column" : "row", flexWrap: "wrap" }).addClass("dragTarget").html(inc("prefillElements/elements")(slide, group)); div.groupData = group; return div; }; })(); trainers/kidDragGroup/groups/flexDiv/group/targetDiv/prefillElements/elements.ls (function(){ return function(slide, group){ var prefillElements, i$, len$, d, results$ = []; if (!group.prefill) { return; } prefillElements = _.ensureArray(group.prefill); for (i$ = 0, len$ = prefillElements.length; i$ < len$; ++i$) { d = prefillElements[i$]; results$.push(inc("prefillLsg/lsg")(slide, d)); } return results$; }; })(); trainers/kidDragGroup/groups/flexDiv/group/targetDiv/prefillElements/prefillLsg/lsg.ls (function(){ return function(slide, d){ if (!d.lsg) { return; } return inc("/../app01-trainers/shared/lsg/lsg")({ lsg: d.lsg, slide: slide }).css({ width: "2em", height: "2em", pointerEvents: "none" }); }; })(); trainers/kidDragGroup/groups/flexDiv/group/title/fixMinWidth/fix.ls (function(){ return function(slide, isHorizontal){ var elements, maxWidth, i$, len$, el, results$ = []; if (isHorizontal) { return; } elements = slide.div.findAll(".groupTitle"); maxWidth = 0; for (i$ = 0, len$ = elements.length; i$ < len$; ++i$) { el = elements[i$]; if (el.style.minWidth !== "") { return; } maxWidth = Math.max(maxWidth, el.offsetWidth); } for (i$ = 0, len$ = elements.length; i$ < len$; ++i$) { el = elements[i$]; results$.push(el.css({ minWidth: maxWidth + "px" })); } return results$; }; })(); trainers/kidDragGroup/groups/flexDiv/group/title/title.ls (function(){ return function(slide, group, isHorizontal){ var t; t = group.title; if (!t) { return; } return Div({ padding: "0.3em" }).addClass("groupTitle").html(t).onDomAppend(function(){ return inc("fixMinWidth/fix")(slide, isHorizontal); }); }; })(); trainers/kidDragGroup/groups/groups.ls (function(){ return function(slide){ var groups, layout; groups = _.ensureArray(slide.getParam("groups")); layout = slide.getParam("groupLayout"); if (layout === "vertical" || layout === "horizontal") { return inc("flexDiv/div")(slide, layout, groups); } else { return inc("overlayDiv/div")(slide, layout, groups); } }; })(); trainers/kidDragGroup/groups/overlayDiv/div.ls (function(){ return function(slide, layout, groups){ var group; return Div({ position: "absolute", top: 0, left: 0, right: 0, bottom: 0 }).html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = groups).length; i$ < len$; ++i$) { group = ref$[i$]; results$.push([inc("groupDiv/div")(slide, group), inc("groupSolvedDiv/div")(slide, group)]); } return results$; }())).appendTo(slide.backgroundLsg.overlayDiv); }; })(); trainers/kidDragGroup/groups/overlayDiv/groupDiv/div.ls (function(){ return function(slide, group){ var lsg, lsgEl, s, o, o2, div; lsg = slide.backgroundLsg; lsgEl = lsg.findFirst("." + group.zone); if (!lsgEl) { debug("class not found in lsg: " + group.zone); return; } if (slide.getParam("hideLsgZones")) { lsgEl.css({ opacity: 0 }); } s = lsg.getCurrentScale(); o = lsgEl.offset(); o2 = lsg.offset(); div = Div({ display: "flex", position: "absolute", top: (o.top - o2.top) / s + "px", left: (o.left - o2.left) / s + "px", width: o.width / s + "px", height: o.height / s + "px" }).addClass("dragTarget"); div.groupData = group; return div; }; })(); trainers/kidDragGroup/groups/overlayDiv/groupSolvedDiv/div.ls (function(){ return function(slide, group){ var lsg, lsgEl, s, o, o2, div; if (!group.solvedZone) { return; } lsg = slide.backgroundLsg; lsgEl = lsg.findFirst("." + group.solvedZone); if (!lsgEl) { debug("class not found in lsg: " + group.solvedZone); return; } if (slide.getParam("hideLsgZones")) { lsgEl.css({ opacity: 0 }); } s = lsg.getCurrentScale(); o = lsgEl.offset(); o2 = lsg.offset(); div = Div({ display: "flex", position: "absolute", top: (o.top - o2.top) / s + "px", left: (o.left - o2.left) / s + "px", width: o.width / s + "px", height: o.height / s + "px", flexWrap: "wrap" }).addClass("solvedTarget_" + group.solvedZone); div.groupData = group; return div; }; })(); trainers/kidDragGroup/init.ls (function(){ return function(slide){ inc("/shared/resetTotalDoneTasks/reset")(slide); slide.backgroundLsg = inc("backgroundLsg/lsg")(slide); slide.groups = inc("groups/groups")(slide); slide.dragElementsDiv = inc("dragElementsDiv/div")(slide); slide.currentAtomIndex = -1; slide.showInstruction = function(){ return inc("showInstruction/show")(slide); }; slide.calcCurrentTasks = function(){ return inc("calcCurrentTasks/calc")(slide); }; slide.calcRemainingTasks = function(){ return inc("calcRemainingTasks/calc")(slide); }; slide.startNextAtom = function(){ return inc("startNextAtom/start")(slide); }; slide.finishAtom = function(){ return inc("finishAtom/finish")(slide); }; return slide.playDragSound = inc("playDragSound/play")(slide); }; })(); trainers/kidDragGroup/playDragSound/play.ls (function(){ return function(slide){ return function(dragElement, type, onAtomFinished){ var sounds, sound, ref$, soundId; sounds = inc("../_media2/sounds/calcDragElementSound/calc")(slide, dragElement.sound); sound = _.find(sounds, { type: type }); if (type === "end") { slide.instruction.stop(); } if (sound) { slide.instruction.stop(); if ((ref$ = slide.currentDragSound) != null && ref$.isPlaying) { slide.currentDragSound.stop(); if (typeof slide.currentDragCallback == 'function') { slide.currentDragCallback(); } } soundId = sound.text + sound.voice + sound.voiceLang; slide.currentDragSound = slide.sounds[soundId]; slide.currentDragCallback = onAtomFinished; return slide.currentDragSound.play(function(){ return setTimeout(function(){ return typeof onAtomFinished == 'function' ? onAtomFinished() : void 8; }, 500); }); } else { return typeof onAtomFinished == 'function' ? onAtomFinished() : void 8; } }; }; })(); trainers/kidDragGroup/showInstruction/show.ls (function(){ return function(slide){ var ref$, instruction; if ((ref$ = slide.instruction) != null) { ref$.remove(); } instruction = inc("/../app01-trainers/shared/instruction/instruction")(slide); slide.div.prepend(instruction); instruction.play(function(){ return slide.levelPlayer.page.scrollElementIntoView(slide.dragElementsDiv); }); if (slide.currentAtomIndex > 0) { instruction.fadeIn(1300); } return slide.instruction = instruction; }; })(); trainers/kidDragGroup/startNextAtom/start.ls (function(){ return function(slide){ if (!slide.enableAtomInstructions) { return; } slide.currentAtomIndex++; slide.atom = slide.atoms[slide.currentAtomIndex]; if (slide.atom) { return slide.showInstruction(); } else { return slide.finish(); } }; })(); trainers/kidPairs/_media2/lsgs/lsgs.ls (function(){ return function(slide){ var lsgs, i$, ref$, len$, atom, that, ref1$, ref2$; lsgs = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; if (that = (ref1$ = atom.a) != null ? ref1$.lsg : void 8) { lsgs.push(that); } if (that = (ref2$ = atom.b) != null ? ref2$.lsg : void 8) { lsgs.push(that); } } return lsgs; }; })(); trainers/kidPairs/_media2/sounds/calcSoundA/calc.ls (function(){ return function(slide, atom, s){ var p, ref$, sound; p = slide.getParam; s = (ref$ = atom.a) != null ? ref$.sound : void 8; if (!s) { return; } return sound = { text: _.isString(s) ? s : s.text, voice: s.voice || p("voice", atom), voiceLang: s.voiceLang || p("voiceLang", atom) }; }; })(); trainers/kidPairs/_media2/sounds/calcSoundB/calc.ls (function(){ return function(slide, atom){ var p, s, ref$, sound; p = slide.getParam; s = (ref$ = atom.b) != null ? ref$.sound : void 8; if (!s) { return; } return sound = { text: _.isString(s) ? s : s.text, voice: s.voice || p("voice", atom), voiceLang: s.voiceLang || p("voiceLang", atom) }; }; })(); trainers/kidPairs/_media2/sounds/sounds.ls (function(){ return function(slide){ var sounds, introSequence, i$, len$, step, s, ref$, atom; sounds = []; introSequence = slide.getParam("introSequence"); if (introSequence) { for (i$ = 0, len$ = introSequence.length; i$ < len$; ++i$) { step = introSequence[i$]; s = inc("/shared/introSequence/calcIntroStepSound/calc")(slide, step); if (s) { sounds.push(s); } } } for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; s = inc("calcSoundA/calc")(slide, atom); if (s) { sounds.push(s); } } for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; s = inc("calcSoundB/calc")(slide, atom); if (s) { sounds.push(s); } } return sounds; }; })(); trainers/kidPairs/_preview/preview.ls (function(){ return function(slide){ return slide.div.prepend(inc("/../app01-trainers/shared/instruction/instruction")(slide)); }; })(); trainers/kidPairs/_review/scoreActions/actionRow/result/aDiv/div.ls (function(){ return function(slide, lsg){ return inc("../lsg/lsg")(slide, lsg).css({ borderRadius: "15% 15% 0px 0px" }); }; })(); trainers/kidPairs/_review/scoreActions/actionRow/result/arrow/arrow.ls (function(){ return function(){ return Svg({ svg: path("/../app01/lib/svg/shape/arrow-top.svg"), color: Color.grey[400] }).css({ transform: "rotate(90deg)", marginLeft: "0.5em" }); }; })(); trainers/kidPairs/_review/scoreActions/actionRow/result/bDiv/div.ls (function(){ return function(slide, lsg){ return inc("../lsg/lsg")(slide, lsg).css({ borderRadius: "0px 0px 15% 15%" }); }; })(); trainers/kidPairs/_review/scoreActions/actionRow/result/lsg/lsg.ls (function(){ return function(slide, lsg){ var lsgDiv; return lsgDiv = inc("/../app01-trainers/shared/lsg/lsg")({ lsg: lsg, slide: slide }).css({ height: "2em", width: "2em", marginLeft: "0.5em", border: "2px solid " + Color.grey[300], backgroundColor: Color.grey[300] }); }; })(); trainers/kidPairs/_review/scoreActions/actionRow/result/result.ls (function(){ return function(slide, action){ return Div({ flex: "1 1 auto", display: "flex", justifyContent: "flex-start" }).html(inc("bDiv/div")(slide, action.b.lsg), inc("arrow/arrow")(), inc("aDiv/div")(slide, action.a.lsg)); }; })(); trainers/kidPairs/_review/scoreActions/actionRow/row.ls (function(){ return function(slide, action){ return inc("/../app01-trainers/shared/scoreActionRowFlex/row")(action, inc("result/result")(slide, action)); }; })(); trainers/kidPairs/_review/scoreActions/actions.ls (function(){ return function(slide){ var actions, action; actions = inc("calcSortedActions/calc")(slide); return Div({ marginTop: "2em" }).html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = actions).length; i$ < len$; ++i$) { action = ref$[i$]; results$.push(inc("actionRow/row")(slide, action)); } return results$; }())).appendTo(slide.div); }; })(); trainers/kidPairs/_review/scoreActions/calcSortedActions/calc.ls (function(){ return function(slide){ var totalActions, i$, ref$, len$, atom, scoreEvent, actions, j$, len1$, action; totalActions = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; scoreEvent = slide.score.getScoreEvent(atom); if (!scoreEvent) { continue; } actions = scoreEvent != null ? scoreEvent.actions : void 8; for (j$ = 0, len1$ = actions.length; j$ < len1$; ++j$) { action = actions[j$]; totalActions.push(action); } } return _.sortBy(totalActions, "position"); }; })(); trainers/kidPairs/_shared/calcMaxWidth/calc.ls (function(){ return function(slide){ return (100 / slide.atoms.length - 5) + "%"; }; })(); trainers/kidPairs/_shared/calcWidth/calc.ls (function(){ return function(slide, atom){ var lsg, that; lsg = slide.getParam("lsg", atom.b); if (that = lsg.width) { return that + "px"; } else { return "4em"; } }; })(); trainers/kidPairs/_shared/lsg/lsg.ls (function(){ return function(slide, lsg){ return inc("/../app01-trainers/shared/lsg/lsg")({ lsg: lsg, slide: slide }).css({ width: "100%", height: "100%", pointerEvents: "none" }); }; })(); trainers/kidPairs/_start/start.ls (function(){ return function(slide){ var playIntro, start; playIntro = function(){ if (slide.getParam("introSequence")) { return slide.playIntro(start); } else { return start(); } }; start = function(){ var i$, ref$, len$, el; for (i$ = 0, len$ = (ref$ = slide.div.findAll(".pairB")).length; i$ < len$; ++i$) { el = ref$[i$]; el.css({ opacity: 0 }); } slide.zoneB.fadeIn(); return slide.showInstruction(); }; return playIntro(); }; })(); trainers/kidPairs/calcTotalProgressElements/calc.ls (function(){ return function(slide){ var total, i$, ref$, len$, atom; total = 0; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; if (atom.a != null) { total++; } } return total; }; })(); trainers/kidPairs/generateSlides.ls (function(){ return function(trainerParams, levelParams){ var atoms, slide, ref$; atoms = _.ensureArray(trainerParams.atoms); if (trainerParams.shuffleAtoms || levelParams.shuffleAtoms) { atoms = _.shuffleWithSeed(atoms); } slide = inc("/../app01-trainers/shared/slide/slide")(trainerParams, levelParams, THISFILE); slide.atoms = atoms; slide.atomsShuffled = _.shuffleWithSeed(_.clone(slide.atoms)); slide.totalProgressElements = inc("calcTotalProgressElements/calc")(slide); slide.finishButton = (ref$ = slide.getParam("finishButton")) != null ? ref$ : false; slide.totalDraggedElements = 0; slide.currentIntroSequenceIndex = -1; return slide; }; })(); trainers/kidPairs/init.ls (function(){ return function(slide){ slide.showInstruction = function(){ return inc("showInstruction/show")(slide); }; slide.playIntro = function(onDone){ return inc("/shared/introSequence/playIntro/play")(slide, onDone); }; slide.zonePairs = inc("zonePairs/zone")(slide); return slide.zoneB = inc("zoneB/zone")(slide); }; })(); trainers/kidPairs/showInstruction/show.ls (function(){ return function(slide){ var ref$, instruction; if ((ref$ = slide.instruction) != null) { ref$.remove(); } instruction = inc("/../app01-trainers/shared/instruction/instruction")(slide); slide.div.prepend(instruction); instruction.play(); return slide.instruction = instruction; }; })(); trainers/kidPairs/zoneB/pairB/_highlightTarget/highlight.ls (function(){ return function(slide){ var i$, ref$, len$, el, results$ = []; for (i$ = 0, len$ = (ref$ = slide.div.findAll(".dragTarget")).length; i$ < len$; ++i$) { el = ref$[i$]; results$.push(el.childrenAll()[0].css({ outline: el === slide.dragTarget ? "4px solid " + Color.blue[100] : "" })); } return results$; }; })(); trainers/kidPairs/zoneB/pairB/calcRotate/calc.ls (function(){ return function(i){ var r; r = _.randomWithSeed(2, 6); if (i % 2 === 1) { r = -r; } return r; }; })(); trainers/kidPairs/zoneB/pairB/dragEnd/animateToStart/animate.ls (function(){ return function(e, slide){ return e.animateToStart(function(){ return slide.totalDraggedElements--; }); }; })(); trainers/kidPairs/zoneB/pairB/dragEnd/end.ls (function(){ return function(e, slide, atom, div){ var target; target = slide.dragTarget; slide.dragTarget = null; inc("../_highlightTarget/highlight")(slide); if (!target) { return inc("animateToStart/animate")(e, slide); } else if ((target != null ? target.atom : void 8) === atom) { return inc("onCorrect/on")(e, slide, atom, div, target); } else { inc("onWrong/on")(e, slide, atom, div, target); return inc("animateToStart/animate")(e, slide); } }; })(); trainers/kidPairs/zoneB/pairB/dragEnd/onCorrect/on.ls (function(){ return function(e, slide, atom, div, target){ target.findFirst(".pairB").css({ opacity: 1 }); slide.totalDraggedElements--; div.css({ transform: "", visibility: "hidden", pointerEvents: "none" }); slide.levelPlayer.progressBar.showGreen(); slide.score.addActionCorrect(atom, { a: target.atom.a, b: atom.b }); return inc("soundA/play")(slide, atom, function(){ return slide.score.log(atom, function(){ target.removeClass("dragTarget"); if (slide.div.findFirst(".dragTarget") == null) { return setTimeout(slide.finish, 500); } }); }); }; })(); trainers/kidPairs/zoneB/pairB/dragEnd/onCorrect/soundA/play.ls (function(){ return function(slide, atom, onDone){ var s; s = inc("../../../../../_media2/sounds/calcSoundA/calc")(slide, atom); if (!s) { onDone(); return; } return setTimeout(function(){ var ref$, sound; if ((ref$ = slide.instruction) != null) { ref$.stop(); } sound = slide.sounds[s.text + s.voice]; return sound.play(onDone); }, 300); }; })(); trainers/kidPairs/zoneB/pairB/dragEnd/onWrong/on.ls (function(){ return function(e, slide, atom, div, target){ slide.levelPlayer.progressBar.addElement().showRed(); return slide.score.addActionMistake(atom, { a: target.atom.a, b: atom.b }); }; })(); trainers/kidPairs/zoneB/pairB/dragMove/calcTarget/calc.ls (function(){ return function(slide, div){ var collidingDivs, divOffset, i$, ref$, len$, el; collidingDivs = []; divOffset = div.offset(); for (i$ = 0, len$ = (ref$ = slide.div.findAll(".dragTarget")).length; i$ < len$; ++i$) { el = ref$[i$]; if (inc("isColliding/is")(el, divOffset)) { collidingDivs.push(el); if (collidingDivs.length === 2) { break; } } } if (collidingDivs.length === 0) { return; } else if (collidingDivs.length === 1) { return collidingDivs[0]; } return inc("calcNearestTarget/calc")(collidingDivs, div); }; })(); trainers/kidPairs/zoneB/pairB/dragMove/calcTarget/calcNearestTarget/calc.ls (function(){ return function(collidingDivs, div){ var a, res$, i$, len$, el; res$ = []; for (i$ = 0, len$ = collidingDivs.length; i$ < len$; ++i$) { el = collidingDivs[i$]; res$.push({ element: el, distance: inc("calcDist/calc")(div, el) }); } a = res$; a = _.minBy(a, "distance"); return a.element; }; })(); trainers/kidPairs/zoneB/pairB/dragMove/calcTarget/calcNearestTarget/calcDist/calc.ls (function(){ return function(div1, div2){ var o1, o2, div1X, div1Y, div2X, div2Y, dist; o1 = div1.offset(); o2 = div2.offset(); div1X = o1.left + div1.width() / 2; div1Y = o1.top + div1.height() / 2; div2X = o2.left + div2.width() / 2; div2Y = o2.top + div2.height() / 2; return dist = Math.sqrt(Math.pow(div2X - div1X, 2) + Math.pow(div2Y - div1Y, 2)); }; })(); trainers/kidPairs/zoneB/pairB/dragMove/calcTarget/isColliding/calcOffsetsOverlap/calc.ls (function(){ return function(o1, o2){ if (o1.right < o2.left) { return false; } if (o1.left > o2.right) { return false; } if (o1.top > o2.bottom) { return false; } if (o1.bottom < o2.top) { return false; } return true; }; })(); trainers/kidPairs/zoneB/pairB/dragMove/calcTarget/isColliding/is.ls (function(){ return function(dragTargetDiv, o1){ var o2, isColliding; o2 = dragTargetDiv.offset(); isColliding = inc("calcOffsetsOverlap/calc")(o1, o2); return isColliding; }; })(); trainers/kidPairs/zoneB/pairB/dragMove/move.ls (function(){ return function(e, slide, atom, div){ slide.dragTarget = inc("calcTarget/calc")(slide, div); return inc("../_highlightTarget/highlight")(slide); }; })(); trainers/kidPairs/zoneB/pairB/dragStart/start.ls (function(){ return function(e, slide, atom, div){ var s, ref$, sound; s = inc("../../../_media2/sounds/calcSoundB/calc")(slide, atom); slide.totalDraggedElements++; if (!s) { return; } if ((ref$ = slide.instruction) != null) { ref$.stop(); } sound = slide.sounds[s.text + s.voice]; return sound.play(); }; })(); trainers/kidPairs/zoneB/pairB/pairB.ls (function(){ return function(atom, i, slide){ var lsg, rotate, width, maxWidth, div; lsg = atom.b.lsg; rotate = inc("calcRotate/calc")(i); width = inc("../../_shared/calcWidth/calc")(slide, atom); maxWidth = inc("../../_shared/calcMaxWidth/calc")(slide); div = Div({ display: "flex", background: Color.grey[150], borderRadius: "0px 0px 15% 15%", border: "2px solid " + Color.grey[150], overflow: "hidden", margin: "1.5%", width: width, maxWidth: maxWidth, transform: "rotate(" + rotate + "deg)" }).html(inc("../../_shared/lsg/lsg")(slide, lsg)).drag({ onStart: function(e){ return inc("dragStart/start")(e, slide, atom, div); }, onMove: function(e){ return inc("dragMove/move")(e, slide, atom, div); }, onEnd: function(e){ return inc("dragEnd/end")(e, slide, atom, div); }, shouldStart: function(){ return slide.totalDraggedElements === 0; } }); return div; }; })(); trainers/kidPairs/zoneB/zone.ls (function(){ return function(slide){ var i, atom; return Div({ display: "flex", justifyContent: "center", alignItems: "flex-start", maxWidth: "30em", margin: "1em auto" }).appendTo(slide.div).html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atomsShuffled).length; i$ < len$; ++i$) { i = i$; atom = ref$[i$]; results$.push(inc("pairB/pairB")(atom, i, slide)); } return results$; }())).hide(); }; })(); trainers/kidPairs/zonePairs/pair/pair.ls (function(){ return function(atom, i, slide){ var width, maxWidth, div; width = inc("../../_shared/calcWidth/calc")(slide, atom); maxWidth = inc("../../_shared/calcMaxWidth/calc")(slide); div = Div({ display: "flex", flexDirection: "column", width: width, maxWidth: maxWidth, margin: "0 1.5% 0 1.5%" }).addClass("pair pair_" + (i + 1) + " dragTarget").html(inc("pairA/pairA")(atom, slide), inc("pairB/pairB")(atom, slide)); div.atom = atom; return div; }; })(); trainers/kidPairs/zonePairs/pair/pairA/pairA.ls (function(){ return function(atom, slide){ var lsg; lsg = atom.a.lsg; return Div({ display: "flex", background: Color.grey[150], borderRadius: "15% 15% 0px 0px", border: "2px solid " + Color.grey[150], overflow: "hidden", width: "100%" }).html(inc("../../../_shared/lsg/lsg")(slide, lsg)); }; })(); trainers/kidPairs/zonePairs/pair/pairB/pairB.ls (function(){ return function(atom, slide){ var lsg; lsg = atom.b.lsg; return Div({ display: "flex", background: Color.grey[150], borderRadius: "0px 0px 15% 15%", border: "2px solid " + Color.grey[150], overflow: "hidden", width: "100%", margin: "6% 0 0 0" }).addClass("pairB").html(inc("../../../_shared/lsg/lsg")(slide, lsg)); }; })(); trainers/kidPairs/zonePairs/zone.ls (function(){ return function(slide){ var div, i, atom; return div = Div({ display: "flex", justifyContent: "center", maxWidth: "30em", margin: "0 auto" }).appendTo(slide.div).html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { i = i$; atom = ref$[i$]; if (!atom.a) { continue; } results$.push(inc("pair/pair")(atom, i, slide)); } return results$; }())); }; })(); trainers/kidSoundSequence/_media2/lsgs/lsgs.ls (function(){ return function(slide){ var lsgs; lsgs = _.map(slide.soundElements, "lsg"); return lsgs = _.uniq(lsgs); }; })(); trainers/kidSoundSequence/_media2/sounds/calcSequenceSolvedSound/calc.ls (function(){ return function(slide, sequenceSolvedSound){ var s, sound; s = sequenceSolvedSound; sound = _.isString(s) ? { text: s } : s; sound.voice == null && (sound.voice = slide.getParam("voice")); sound.voiceLang == null && (sound.voiceLang = slide.getParam("voiceLang")); return sound; }; })(); trainers/kidSoundSequence/_media2/sounds/calcSoundFromSoundElement/calc.ls (function(){ return function(soundElement, slide){ var s, sound; s = soundElement.sound; sound = _.isString(s) ? { text: s } : s; sound.voice == null && (sound.voice = "custom"); sound.voiceLang == null && (sound.voiceLang = "de"); return sound; }; })(); trainers/kidSoundSequence/_media2/sounds/sounds.ls (function(){ return function(slide){ var sounds, instructionSounds, i$, ref$, len$, el, that; sounds = []; instructionSounds = inc("/shared/calcAtomInstructionSounds/calc")(slide); sounds = sounds.concat(instructionSounds); for (i$ = 0, len$ = (ref$ = slide.soundElements).length; i$ < len$; ++i$) { el = ref$[i$]; sounds.push(inc("calcSoundFromSoundElement/calc")(el, slide)); } if (that = slide.getParam("sequenceSolvedSound")) { sounds.push(inc("calcSequenceSolvedSound/calc")(slide, that)); } return sounds; }; })(); trainers/kidSoundSequence/_preview/findFirstInstruction/find.ls (function(){ return function(atoms){ var i$, len$, i, atom; for (i$ = 0, len$ = atoms.length; i$ < len$; ++i$) { i = i$; atom = atoms[i$]; if (atom.instruction) { return i; } } }; })(); trainers/kidSoundSequence/_preview/instruction/instruction.ls (function(){ return function(slide){ var instructionText; instructionText = slide.getParam("instruction").text; return Div({ marginTop: "1em" }).html(inc("/shared/_preview/instruction/instruction")(instructionText)); }; })(); trainers/kidSoundSequence/_preview/preview.ls (function(){ return function(slide){ var ref$, i$, ref1$, len$, atomIndex, atom, instructionText, ref2$, results$ = []; slide.sequenceDiv.hide(); slide.playButton.remove(); if ((ref$ = slide.instruction) != null) { ref$.remove(); } for (i$ = 0, len$ = (ref1$ = slide.atoms).length; i$ < len$; ++i$) { atomIndex = i$; atom = ref1$[i$]; slide.atom = atom; instructionText = (ref2$ = slide.getParam("instruction")) != null ? ref2$.text : void 8; if (atom.prefill) { continue; } results$.push(Div().html(instructionText ? inc("/shared/_preview/instruction/instruction")(instructionText) : void 8, inc("../sequenceDiv/div")(slide), inc("soundPickerDiv/div")(slide)).appendTo(slide.div).addClass("previewDiv" + atomIndex)); } return results$; }; })(); trainers/kidSoundSequence/_preview/soundPickerDiv/div.ls (function(){ return function(slide){ var soundPicker; return Div({ width: "100%", background: Color.grey[250] }).html(soundPicker = inc("../../soundPicker/soundPicker")(slide)); }; })(); trainers/kidSoundSequence/_review/scoreActions/actionRows/action/action.ls (function(){ return function(slide, sortedAction){ var index; sortedAction.taskIndex; index = slide.atomsNormalized[sortedAction.atomIndex].indexWithoutPrefill; return inc("/../app01-trainers/shared/scoreActionRowFlex/row")(sortedAction, inc("result/result")(slide, sortedAction, sortedAction.taskIndex)); }; })(); trainers/kidSoundSequence/_review/scoreActions/actionRows/action/lsgDiv/div.ls (function(){ return function(selectedSound, slide){ return Div({ display: "flex", width: "2em", height: "2em" }).html(inc("../../../drawLsg/draw")(selectedSound, slide)); }; })(); trainers/kidSoundSequence/_review/scoreActions/actionRows/action/result/arrow/arrow.ls (function(){ return function(){ return Svg({ svg: path("/../app01/lib/svg/shape/arrow-top.svg"), color: Color.grey[400] }).css({ transform: "rotate(90deg)", margin: "0em 0.5em 0em 0em" }); }; })(); trainers/kidSoundSequence/_review/scoreActions/actionRows/action/result/result.ls (function(){ return function(slide, sortedAction, taskIndex){ var selectedSound, that; selectedSound = slide.soundElements[sortedAction.soundIndex]; if (that = sortedAction.elementIndex) { taskIndex = that; } return Div({ flex: "1 1 auto", display: "flex", justifyContent: "flex-start" }).append(inc("../lsgDiv/div")(selectedSound, slide), inc("arrow/arrow")(), inc("../yellowTagActionRow/div")(taskIndex)); }; })(); trainers/kidSoundSequence/_review/scoreActions/actionRows/action/yellowTagActionRow/div.ls (function(){ return function(index){ return inc("/shared/_review/yellowTag/tag")(index).css({ display: "flex" }); }; })(); trainers/kidSoundSequence/_review/scoreActions/actionRows/rows.ls (function(){ return function(slide, actions, atomIndex){ var totalActions, i$, len$, action, actionWithIndex, sortedActions, sortedAction; totalActions = []; for (i$ = 0, len$ = actions.length; i$ < len$; ++i$) { action = actions[i$]; actionWithIndex = _.merge(action, { atomIndex: atomIndex }); totalActions.push(actionWithIndex); } sortedActions = _.sortBy(totalActions, "position"); return slide.div.append(Div({ margin: "0.5em 1em", textAlign: "left" }).append((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = sortedActions).length; i$ < len$; ++i$) { sortedAction = ref$[i$]; results$.push(inc("action/action")(slide, sortedAction)); } return results$; }()))); }; })(); trainers/kidSoundSequence/_review/scoreActions/actions.ls (function(){ return function(slide){ var sequenceDiv, i$, ref$, len$, i, atom, scoreEvent, actions, instruction; sequenceDiv = slide.sequenceDiv; inc("hidePreviewDivs/hide")(slide); sequenceDiv.show(); inc("drawPrefillOverlay/draw")(slide, sequenceDiv); for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { i = i$; atom = ref$[i$]; scoreEvent = slide.score.getScoreEvent(atom); if (atom.prefill || !scoreEvent) { continue; } actions = scoreEvent.actions; inc("restoreSolution/restore")(slide, actions, sequenceDiv); if (slide.enableAtomInstructions) { instruction = inc("/shared/_preview/calcInstruction/calc")(atom); slide.div.append(inc("/shared/_preview/instruction/instruction")(instruction).css({ marginTop: "1em" })); } inc("actionRows/rows")(slide, actions, i); } return inc("addYellowTagsToSequence/add")(slide, sequenceDiv); }; })(); trainers/kidSoundSequence/_review/scoreActions/addYellowTagsToSequence/add.ls (function(){ return function(slide, sequenceDiv){ var i$, ref$, len$, i, child, results$ = []; for (i$ = 0, len$ = (ref$ = sequenceDiv.childrenAll()).length; i$ < len$; ++i$) { i = i$; child = ref$[i$]; results$.push(child.append(inc("/shared/_review/yellowTag/tag")(i).css({ position: "absolute", bottom: "-2em", left: "50%", marginLeft: "-0.5em", fontSize: "var(--tagFontSize)" }))); } return results$; }; })(); trainers/kidSoundSequence/_review/scoreActions/drawLsg/draw.ls (function(){ return function(selectedSound, slide){ var lsg; lsg = selectedSound.lsg; return inc("/../app01-trainers/shared/lsg/lsg")({ lsg: lsg, slide: slide }).css({ width: "60%" }); }; })(); trainers/kidSoundSequence/_review/scoreActions/drawPrefillOverlay/draw.ls (function(){ return function(slide, sequenceDiv){ var prefillDivs, i$, len$, div, results$ = []; prefillDivs = sequenceDiv.findAll(".prefill"); for (i$ = 0, len$ = prefillDivs.length; i$ < len$; ++i$) { div = prefillDivs[i$]; results$.push(div.css({ opacity: 0.35 })); } return results$; }; })(); trainers/kidSoundSequence/_review/scoreActions/hidePreviewDivs/hide.ls (function(){ return function(slide){ var i$, ref$, len$, atomIndex, atom, previewDiv, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atomIndex = i$; atom = ref$[i$]; previewDiv = slide.div.findFirst(".previewDiv" + atomIndex); results$.push(previewDiv != null ? previewDiv.hide() : void 8); } return results$; }; })(); trainers/kidSoundSequence/_review/scoreActions/restoreSolution/restore.ls (function(){ return function(slide, actions, sequenceDiv){ var i$, len$, action, selectedSound, sequenceElementIndex, ref$, results$ = []; for (i$ = 0, len$ = actions.length; i$ < len$; ++i$) { action = actions[i$]; selectedSound = slide.soundElements[action.soundIndex]; sequenceElementIndex = (ref$ = action.elementIndex) != null ? ref$ : action.taskIndex; if (!action.correct) { continue; } results$.push(sequenceDiv.childrenAll()[sequenceElementIndex].html(inc("../drawLsg/draw")(selectedSound, slide))); } return results$; }; })(); trainers/kidSoundSequence/_shared/updateSize/update.ls (function(){ return function(slide, div){ var total, size; total = slide.totalProgressElements + slide.totalPrefillElements; size = body.offsetWidth * 0.8 / total; size = Math.min(size, 100); return div.css({ fontSize: size / 80 + "em" }).cssVar({ tagFontSize: _.round(80 / size * 0.75, 2) + "em" }); }; })(); trainers/kidSoundSequence/_skip/skip.ls (function(){ return function(slide){ var totalTasks, atom, remainingTasks, i$, i; totalTasks = slide.totalPrefillElements + slide.totalProgressElements; atom = slide.atomsNormalized[slide.currentAtomIndex]; if (!atom) { slide.onFinishedSlide(); return; } remainingTasks = atom.tasks.length - atom.totalDone; for (i$ = 1; i$ <= remainingTasks; ++i$) { i = i$; slide.levelPlayer.progressBar.showGreen(); } slide.currentTaskIndex += remainingTasks; if (totalTasks - slide.currentTaskIndex === 0) { return slide.onFinishedSlide(); } else { return slide.startNextAtom(); } }; })(); trainers/kidSoundSequence/_start/start.ls (function(){ return function(slide){ slide.levelPlayer.page.bottom.html(slide.soundPicker).show(); slide.soundPicker.update(); if (slide.enableAtomInstructions) { return slide.startNextAtom(); } else { slide.currentAtomIndex++; slide.totalDraggedElements = 0; slide.dragTargets = slide.div.findAll(".dragTarget"); return slide.showInstruction(); } }; })(); trainers/kidSoundSequence/calcAtomsNormalized/calc.ls (function(){ return function(slide){ var soundElements, atomsNormalized, i$, ref$, len$, atom, atom2, tasks, totalPrefill, j$, len1$, task, soundElement; soundElements = slide.soundElements; atomsNormalized = []; for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) { atom = ref$[i$]; if (atom != null && atom.tasks) { atom2 = _.cloneDeep(atom); tasks = _.ensureArray(atom2.tasks); } else { atom2 = _.omit(atom, ["borderColor", "elementCategory", "prefill"]); tasks = _.ensureArray(_.pick(atom, ["borderColor", "elementCategory", "prefill"])); } totalPrefill = _.filter(tasks, { prefill: true }).length; for (j$ = 0, len1$ = tasks.length; j$ < len1$; ++j$) { task = tasks[j$]; soundElement = inc("../calcTaskSound/calc")(slide, task); task.sound = soundElement != null ? soundElement.sound : void 8; task.soundDuration = soundElement != null ? soundElement.soundDuration : void 8; } atomsNormalized.push({ tasks: tasks, totalPrefill: totalPrefill }); } return atomsNormalized; }; })(); trainers/kidSoundSequence/calcAtomsNormalized/calcSoundForElements/calc.ls (function(){ return function(slide, atoms2){ var indexWithoutPrefill, i$, len$, i, atom, matchingSoundEl, results$ = []; indexWithoutPrefill = 0; for (i$ = 0, len$ = atoms2.length; i$ < len$; ++i$) { i = i$; atom = atoms2[i$]; matchingSoundEl = _.find(slide.soundElements, { elementCategory: atom.elementCategory }); if (atom.prefill) { matchingSoundEl.isAny = false; indexWithoutPrefill = indexWithoutPrefill - 1; } atom.indexWithoutPrefill = indexWithoutPrefill; indexWithoutPrefill++; if (matchingSoundEl) { atom.sound = matchingSoundEl.sound; if (matchingSoundEl.soundDuration) { results$.push(atom.soundDuration = matchingSoundEl.soundDuration); } } } return results$; }; })(); trainers/kidSoundSequence/calcSoundElements/calc.ls (function(){ return function(slide){ var soundElements, i$, len$, i, el; soundElements = slide.getParam("soundElements"); soundElements = _.cloneDeep(soundElements); soundElements = _.ensureArray(soundElements); for (i$ = 0, len$ = soundElements.length; i$ < len$; ++i$) { i = i$; el = soundElements[i$]; el.soundIndex = i; el.anyCategory = null; el.isAny = true; el.sound.soundId = inc("calceSoundId/calc")(el, slide); } return soundElements; }; })(); trainers/kidSoundSequence/calcSoundElements/calceSoundId/calc.ls (function(){ return function(soundElement, slide){ var s, sound, soundId; s = soundElement.sound; sound = _.isString(s) ? { text: s } : s; return soundId = sound.text + "customde"; }; })(); trainers/kidSoundSequence/calcTaskSound/calc.ls (function(){ return function(slide, task){ var soundElement, element; if (_.includes(task.elementCategory, "any")) { return null; } soundElement = _.find(slide.soundElements, { elementCategory: task.elementCategory }); return element = { sound: soundElement.sound, soundDuration: soundElement.soundDuration }; }; })(); trainers/kidSoundSequence/calcTotalPrefillElements/calc.ls (function(){ return function(atoms){ var totalPrefill, i$, len$, atom, j$, ref$, len1$, task; totalPrefill = 0; for (i$ = 0, len$ = atoms.length; i$ < len$; ++i$) { atom = atoms[i$]; if (atom.prefill) { totalPrefill++; } if (atom.tasks) { for (j$ = 0, len1$ = (ref$ = atom.tasks).length; j$ < len1$; ++j$) { task = ref$[j$]; if (task.prefill) { totalPrefill++; } } } } return totalPrefill; }; })(); trainers/kidSoundSequence/calcTotalProgressElements/calc.ls (function(){ return function(slide, atoms){ var total, totalPrefilled, i$, len$, atom, j$, ref$, len1$, task; total = 0; totalPrefilled = slide.totalPrefillElements; for (i$ = 0, len$ = atoms.length; i$ < len$; ++i$) { atom = atoms[i$]; if (atom.tasks != null) { for (j$ = 0, len1$ = (ref$ = atom.tasks).length; j$ < len1$; ++j$) { task = ref$[j$]; total++; } } else { total++; } } return total - totalPrefilled; }; })(); trainers/kidSoundSequence/generateSlides.ls (function(){ return function(trainerParams, levelParams){ var atoms, slide, ref$; atoms = _.ensureArray(trainerParams.atoms); if (trainerParams.shuffleAtoms || levelParams.shuffleAtoms) { atoms = _.shuffleWithSeed(atoms); } slide = inc("/../app01-trainers/shared/slide/slide")(trainerParams, levelParams, THISFILE); slide.atoms = atoms; slide.soundElements = inc("calcSoundElements/calc")(slide); slide.atomsNormalized = inc("calcAtomsNormalized/calc")(slide); slide.totalPrefillElements = inc("calcTotalPrefillElements/calc")(atoms); slide.totalProgressElements = inc("calcTotalProgressElements/calc")(slide, atoms); slide.enableAtomInstructions = _.find(slide.atoms, function(a){ return a.instruction != null; }) != null; slide.finishButton = (ref$ = slide.getParam("finishButton", slide.atom)) != null ? ref$ : false; return slide; }; })(); trainers/kidSoundSequence/init.ls (function(){ return function(slide){ inc("initAtomTotalDone/init")(slide); slide.selectedSound = null; slide.selectedSoundIndex = null; slide.anyCategories = []; slide.currentAtomIndex = -1; slide.currentTaskIndex = 0; slide.instruction = inc("instruction/instruction")(slide); slide.sequenceDiv = inc("sequenceDiv/div")(slide); slide.playButton = inc("playButton/button")(slide); slide.soundPicker = inc("soundPicker/soundPicker")(slide); slide.startNextAtom = function(){ return inc("startNextAtom/start")(slide); }; slide.showInstruction = function(){ return inc("showInstruction/show")(slide); }; slide.playSequenceSolvedSound = function(onFinish){ return inc("playSequenceSolvedSound/play")(slide, onFinish); }; return slide.playFinishSequence = function(onFinish){ return inc("playFinishSequence/play")(slide, onFinish); }; }; })(); trainers/kidSoundSequence/initAtomTotalDone/init.ls (function(){ return function(slide){ var i$, ref$, len$, atom, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atomsNormalized).length; i$ < len$; ++i$) { atom = ref$[i$]; results$.push(atom.totalDone = 0); } return results$; }; })(); trainers/kidSoundSequence/instruction/instruction.ls (function(){ return function(slide){ return inc("/../app01-trainers/shared/instruction/instruction")(slide).appendTo(slide.div); }; })(); trainers/kidSoundSequence/playButton/button.ls (function(){ return function(slide){ var tap, div; tap = function(e){ return inc("tap/tap")(slide, div); }; div = Div({ display: "inline-flex", padding: "1em 1em 1em 1em", borderRadius: "50%", background: Color.grey[200], pointerEvents: "none", opacity: 0 }).html(inc("playIcon/icon")()).addClass("playButton").tap(tap).appendTo(slide.div); div.showButton = function(){ return inc("showButton/show")(slide, div); }; return div; }; })(); trainers/kidSoundSequence/playButton/playIcon/icon.ls (function(){ return function(){ return Div({ width: "2.3em", height: "2.3em", padding: "0em 0em 0em 0.4em" }).html(Svg({ svg: path("/../app01/lib/svg/shape/play.svg"), color: Color.grey[500], size: "100%" })); }; })(); trainers/kidSoundSequence/playButton/showButton/show.ls (function(){ return function(slide, div){ div.css({ pointerEvents: "" }).fadeIn(700); return slide.soundPicker.hide(); }; })(); trainers/kidSoundSequence/playButton/tap/tap.ls (function(){ return function(slide, div){ var sequenceElements, i$, len$, sequenceElement; sequenceElements = slide.div.findFirst(".sequenceDiv").childrenAll(); div.css({ pointerEvents: "none" }); for (i$ = 0, len$ = sequenceElements.length; i$ < len$; ++i$) { sequenceElement = sequenceElements[i$]; sequenceElement.css({ pointerEvents: "none" }); } return slide.playFinishSequence(function(){ var i$, ref$, len$, sequenceElement, results$ = []; if (!slide.trainerFinished) { slide.finish(); slide.trainerFinished = true; } div.css({ pointerEvents: "" }); for (i$ = 0, len$ = (ref$ = sequenceElements).length; i$ < len$; ++i$) { sequenceElement = ref$[i$]; results$.push(sequenceElement.css({ pointerEvents: "" })); } return results$; }); }; })(); trainers/kidSoundSequence/playFinishSequence/play.ls (function(){ return function(slide, onFinish){ var index, seqDivs, playNextSound; index = -1; seqDivs = slide.sequenceDiv.childrenAll(); playNextSound = function(){ var seqDiv; index++; seqDiv = seqDivs[index]; if (seqDiv) { return inc("playNext/play")(seqDiv, slide, playNextSound); } else { return onFinish(); } }; return playNextSound(); }; })(); trainers/kidSoundSequence/playFinishSequence/playNext/play.ls (function(){ return function(seqDiv, slide, onDone){ var seqEl, soundId, sound, soundDuration, animationDuration, fadeIn, playSound, finish; seqEl = seqDiv.task; soundId = seqEl.sound.soundId; sound = slide.sounds[soundId]; soundDuration = seqEl.soundDuration; animationDuration = soundDuration <= 100 ? soundDuration - 20 : 100; fadeIn = function(){ seqDiv.keyframeAnimate({ keyframes: { "0%": { background: "white" }, "100%": { background: Color.grey[200] } }, duration: animationDuration }); return playSound(); }; playSound = function(){ if (soundDuration) { sound.play(); return setTimeout(finish, soundDuration); } else { return sound.play(finish); } }; finish = function(){ seqDiv.css({ background: "white" }); return onDone(); }; return fadeIn(); }; })(); trainers/kidSoundSequence/playSequenceSolvedSound/play.ls (function(){ return function(slide, onFinish){ var that, text, voice, voiceLang, soundId, sequenceSolvedSound; slide.instruction.stop(); if (that = slide.getParam("sequenceSolvedSound")) { text = that.text || that; voice = that.voice || slide.getParam("voice"); voiceLang = that.voiceLang || slide.getParam("voiceLang"); soundId = text + voice + voiceLang; sequenceSolvedSound = slide.sounds[soundId]; return setTimeout(function(){ return sequenceSolvedSound.play(onFinish); }, 500); } else { return setTimeout(onFinish, 500); } }; })(); trainers/kidSoundSequence/sequenceDiv/div.ls (function(){ return function(slide){ var elementIndex, updateSize, div, i, atom, j, task; elementIndex = -1; updateSize = function(){ return inc("../_shared/updateSize/update")(slide, div); }; div = Div({ display: "flex", flexDirection: "row", margin: "1em 0 2em 0", fontSize: "1em" }).html((function(){ var i$, ref$, len$, lresult$, j$, ref1$, len1$, results$ = []; for (i$ = 0, len$ = (ref$ = slide.atomsNormalized).length; i$ < len$; ++i$) { i = i$; atom = ref$[i$]; lresult$ = []; for (j$ = 0, len1$ = (ref1$ = atom.tasks).length; j$ < len1$; ++j$) { j = j$; task = ref1$[j$]; elementIndex++; lresult$.push(inc("sequenceElement/div")(slide, task, i, elementIndex)); } results$.push(lresult$); } return results$; }())).appendTo(slide.div).addClass("sequenceDiv").onWindowResize(updateSize); updateSize(); return div; }; })(); trainers/kidSoundSequence/sequenceDiv/sequenceElement/animateFocus/animate.ls (function(){ return function(div){ return function(){ return div.css({ transform: "scale(1.2)" }); }; }; })(); trainers/kidSoundSequence/sequenceDiv/sequenceElement/animateReset/animate.ls (function(){ return function(div){ return function(){ return div.css({ transform: "scale(1)" }); }; }; })(); trainers/kidSoundSequence/sequenceDiv/sequenceElement/div.ls (function(){ return function(slide, task, atomIndex, elementIndex){ var tap, div; tap = function(){ return slide.sounds[task.sound.soundId].play(); }; div = Div({ display: "flex", width: "4em", height: "4em", border: "0.16em solid " + task.borderColor, borderRadius: "50%", margin: "0.3em", pointerEvents: "none", transition: "transform 200ms" }); if (task.prefill) { div.html(inc("prefillLsg/lsg")(slide, task)).addClass("prefill").css({ pointerEvents: "" }); } else { div.html(Div({ display: "flex", width: "100%", height: "100%" })).addClass("dragTarget"); } div.tap({ down: tap, animation: "hover" }).addClass(elementIndex + ""); div.task = task; div.atomIndex = atomIndex; div.elementIndex = elementIndex; div.animateFocus = inc("animateFocus/animate")(div); div.animateReset = inc("animateReset/animate")(div); return div; }; })(); trainers/kidSoundSequence/sequenceDiv/sequenceElement/prefillLsg/findPrefillLsg/find.ls (function(){ return function(slide, atom){ return _.find(slide.soundElements, { elementCategory: atom.elementCategory }).lsg; }; })(); trainers/kidSoundSequence/sequenceDiv/sequenceElement/prefillLsg/lsg.ls (function(){ return function(slide, atom){ var lsg; lsg = inc("findPrefillLsg/find")(slide, atom); return inc("/shared/lsgSlim/lsg")({ lsgParams: lsg, slide: slide }).css({ width: "90%" }); }; })(); trainers/kidSoundSequence/showInstruction/show.ls (function(){ return function(slide){ var minHeight, ref$, that, instruction; minHeight = ((ref$ = slide.instruction) != null ? ref$.offset().height : void 8) + "px"; if (that = slide.instruction) { that.stop(); that.remove(); } instruction = inc("/../app01-trainers/shared/instruction/instruction")(slide); slide.div.prepend(instruction); instruction.play(); if (slide.currentAtomIndex > 0) { instruction.css({ minHeight: minHeight }).fadeIn(1300); } return slide.instruction = instruction; }; })(); trainers/kidSoundSequence/soundPicker/backgroundDiv/div.ls (function(){ return function(slide){ var soundEl; return Div({ position: "absolute" }).html(Div({ display: "flex" }).html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = slide.soundElements).length; i$ < len$; ++i$) { soundEl = ref$[i$]; results$.push(inc("../soundPickerDiv/div")(slide, soundEl)); } return results$; }()))); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/div.ls (function(){ return function(slide){ var i$, ref$, len$, soundElement, results$ = []; for (i$ = 0, len$ = (ref$ = slide.soundElements).length; i$ < len$; ++i$) { soundElement = ref$[i$]; results$.push(inc("soundElement/div")(slide, soundElement)); } return results$; }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/div.ls (function(){ return function(slide, soundElement){ var start, div; start = function(){ return inc("enableDrag/enable")(slide, div, soundElement); }; div = inc("../../soundPickerDiv/div")(slide, soundElement); div.addClass("dragElement"); div.start = start; return div; }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/_animateSequenceDiv/animate.ls (function(){ return function(slide){ var currentTargetDiv, maximizedTargetDiv, that; currentTargetDiv = slide.currentTargetDiv; maximizedTargetDiv = slide.maximizedTargetDiv; if (currentTargetDiv) { if (_.isEqual(currentTargetDiv != null ? currentTargetDiv.classes() : void 8, maximizedTargetDiv != null ? maximizedTargetDiv.classes() : void 8)) { return; } if (that = maximizedTargetDiv) { that.animateReset(); } currentTargetDiv.animateFocus(); return slide.maximizedTargetDiv = currentTargetDiv; } else { slide.maximizedTargetDiv = null; return maximizedTargetDiv != null ? maximizedTargetDiv.animateReset() : void 8; } }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/calcOpenDragTargets/calc.ls (function(){ return function(slide){ var openTargetDivs; return openTargetDivs = _.filter(slide.dragTargets, function(target){ return _.includes(target.classes(), "dragTarget"); }); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/enable.ls (function(){ return function(slide, soundDiv, soundElement){ var moveFunction, move, resetTotalDraggedElements, dragStartAt, dragEnded, validDragTargets; moveFunction = function(){ return inc("onMove/on")(slide, validDragTargets, soundDiv, dragEnded); }; move = _.throttle(moveFunction, 200); resetTotalDraggedElements = function(){ return slide.totalDraggedElements = 0; }; dragStartAt = null; dragEnded = true; validDragTargets = null; return soundDiv.drag({ shouldStart: function(){ return slide.totalDraggedElements === 0; }, onStart: function(e){ slide.totalDraggedElements = 1; validDragTargets = inc("calcOpenDragTargets/calc")(slide); dragStartAt = new Date(); return dragEnded = false; }, onMove: function(e){ return move(); }, onEnd: function(e){ dragEnded = true; if (new Date - dragStartAt < 200) { slide.sounds[soundElement.sound.soundId].play(); } return inc("onEnd/on")(slide, soundDiv, soundElement, e, resetTotalDraggedElements); } }).bind("touchstart", function(e){ return e.preventDefault(); }); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/isCorrect/addSoundToAny/add.ls (function(){ return function(slide, task, soundElement){ var i$, ref$, len$, atomNormalized, foundTasks, j$, len1$, foundTask; if (soundElement.anyCategory || _.includes(slide.anyCategories, task.elementCategory) || !_.includes(task.elementCategory, "any")) { return; } for (i$ = 0, len$ = (ref$ = slide.atomsNormalized).length; i$ < len$; ++i$) { atomNormalized = ref$[i$]; foundTasks = _.filter(atomNormalized.tasks, { elementCategory: task.elementCategory }); for (j$ = 0, len1$ = foundTasks.length; j$ < len1$; ++j$) { foundTask = foundTasks[j$]; foundTask.sound = soundElement.sound; foundTask.soundDuration = soundElement.soundDuration; } } soundElement.anyCategory = task.elementCategory; return slide.anyCategories.push(task.elementCategory); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/isCorrect/is.ls (function(){ return function(slide, soundElement){ var currentTarget, task, i, totalTasks; currentTarget = slide.currentTargetDiv; task = currentTarget.task; i = currentTarget.atomIndex; totalTasks = slide.atomsNormalized[i].tasks.length; if ((slide.enableAtomInstructions || totalTasks < 2) && slide.currentAtomIndex !== i) { return false; } if (soundElement.isAny) { inc("addSoundToAny/add")(slide, task, soundElement); } return task.elementCategory === soundElement.elementCategory || task.elementCategory === soundElement.anyCategory; }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/on.ls (function(){ return function(slide, soundDiv, soundElement, e, onFinish){ var originalAtom; if (!slide.currentTargetDiv) { e.animateToStart(function(){ return onFinish(); }); return; } originalAtom = slide.atoms[slide.currentAtomIndex]; if (inc("isCorrect/is")(slide, soundElement)) { inc("onCorrect/on")(slide, soundDiv, originalAtom, soundElement, onFinish); } else { inc("onWrong/on")(slide, originalAtom, soundElement, e, onFinish); } slide.currentTargetDiv = null; inc("../_animateSequenceDiv/animate")(slide); return slide.maximizedTargetDiv = null; }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/onCorrect/calcPendingTasks/calc.ls (function(){ return function(slide){ var index, normalizedAtom, totalTasks; index = slide.currentAtomIndex; normalizedAtom = slide.atomsNormalized[index]; totalTasks = normalizedAtom.tasks.length - normalizedAtom.totalPrefill; normalizedAtom.totalDone++; return totalTasks - normalizedAtom.totalDone; }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/onCorrect/enableTap/enable.ls (function(){ return function(slide){ return slide.currentTargetDiv.css({ pointerEvents: "" }); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/onCorrect/isTrainerFinished/is.ls (function(){ return function(slide){ return slide.currentAtomIndex === slide.totalProgressElements || slide.currentTaskIndex === slide.totalProgressElements; }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/onCorrect/on.ls (function(){ return function(slide, soundDiv, originalAtom, soundElement, onFinish){ return slide.score.addActionCorrect(originalAtom, { soundIndex: soundElement.soundIndex, taskIndex: slide.currentTaskIndex, elementIndex: slide.currentTargetDiv.elementIndex }, function(){ onFinish(); slide.currentTaskIndex++; inc("showCorrectFeedback/show")(slide, soundDiv); inc("enableTap/enable")(slide); if (inc("calcPendingTasks/calc")(slide) === 0) { slide.startNextAtom(); slide.score.log(originalAtom); } if (inc("isTrainerFinished/is")(slide)) { return inc("showPlayButton/show")(slide); } }); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/onCorrect/showCorrectFeedback/drawLsg/draw.ls (function(){ return function(slide, soundDiv){ var lsg; lsg = soundDiv.firstChild; lsg.offsetSave(); lsg.appendTo(slide.currentTargetDiv.firstChild); inc("reverseTargetDivScaling/reverse")(slide.currentTargetDiv.firstChild); return lsg.offsetAnimate(300); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/onCorrect/showCorrectFeedback/drawLsg/reverseTargetDivScaling/reverse.ls (function(){ return function(lsgDiv){ return lsgDiv.keyframeAnimate({ keyframes: { "0%": { transform: "scale(" + 1 / 1.2 + ")" }, "100%": { transform: "scale(1)" } }, duration: 300 }); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/onCorrect/showCorrectFeedback/show.ls (function(){ return function(slide, soundDiv){ slide.currentTargetDiv.removeClass("dragTarget"); slide.levelPlayer.progressBar.showGreen(); inc("drawLsg/draw")(slide, soundDiv); return slide.soundPicker.update(); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/onCorrect/showPlayButton/show.ls (function(){ return function(slide){ return slide.playSequenceSolvedSound(function(){ return setTimeout(function(){ return slide.playButton.showButton(); }, 500); }); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onEnd/onWrong/on.ls (function(){ return function(slide, originalAtom, soundElement, e, onFinish){ return slide.score.addActionMistake(originalAtom, { soundIndex: soundElement.soundIndex, taskIndex: slide.currentTaskIndex, elementIndex: slide.currentTargetDiv.elementIndex }, function(){ e.animateToStart(function(){ return onFinish(); }); return slide.levelPlayer.progressBar.addElement().showRed(); }); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onMove/calcCurrentTargetDiv/calc.ls (function(){ return function(validDragTargets, soundDiv){ var collidingTargets; collidingTargets = _.filter(validDragTargets, function(target){ return inc("isColliding/is")(target, soundDiv); }); if (collidingTargets.length === 0) {} else if (collidingTargets.length === 1) { return collidingTargets[0]; } else { return inc("calcNearestTarget/calc")(collidingTargets, soundDiv); } }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onMove/calcCurrentTargetDiv/calcNearestTarget/calc.ls (function(){ return function(collidingDivs, div){ var a, res$, i$, len$, el; res$ = []; for (i$ = 0, len$ = collidingDivs.length; i$ < len$; ++i$) { el = collidingDivs[i$]; res$.push({ element: el, distance: inc("calcDist/calc")(div, el) }); } a = res$; a = _.minBy(a, "distance"); return a.element; }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onMove/calcCurrentTargetDiv/calcNearestTarget/calcDist/calc.ls (function(){ return function(div1, div2){ var o1, o2, div1X, div1Y, div2X, div2Y, dist; o1 = div1.offset(); o2 = div2.offset(); div1X = o1.left + div1.width() / 2; div1Y = o1.top + div1.height() / 2; div2X = o2.left + div2.width() / 2; div2Y = o2.top + div2.height() / 2; return dist = Math.sqrt(Math.pow(div2X - div1X, 2) + Math.pow(div2Y - div1Y, 2)); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onMove/calcCurrentTargetDiv/isColliding/calcOffsetsOverlap/calc.ls (function(){ return function(o1, o2){ if (o1.right < o2.left) { return false; } if (o1.left > o2.right) { return false; } if (o1.top > o2.bottom) { return false; } if (o1.bottom < o2.top) { return false; } return true; }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onMove/calcCurrentTargetDiv/isColliding/is.ls (function(){ return function(dragTargetDiv, soundElementDiv){ var o1, o2, isColliding; o1 = soundElementDiv.offset(); o2 = dragTargetDiv.offset(); isColliding = inc("calcOffsetsOverlap/calc")(o1, o2); return isColliding; }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/enableDrag/onMove/on.ls (function(){ return function(slide, validDragTargets, soundDiv, dragEnded){ if (dragEnded) { return; } slide.currentTargetDiv = inc("calcCurrentTargetDiv/calc")(validDragTargets, soundDiv); return inc("../_animateSequenceDiv/animate")(slide); }; })(); trainers/kidSoundSequence/soundPicker/soundElements/soundElement/lsg/lsg.ls (function(){ return function(slide, soundElement){ return inc("/shared/lsgSlim/lsg")({ lsgParams: soundElement.lsg, slide: slide }).css({ width: "3.2em", height: "auto" }); }; })(); trainers/kidSoundSequence/soundPicker/soundPicker.ls (function(){ return function(slide){ var updateSize, div; updateSize = function(){ return inc("../_shared/updateSize/update")(slide, div); }; div = Div({ display: "flex", fontSize: "1em" }).html(inc("backgroundDiv/div")(slide), inc("soundElements/div")(slide)).onWindowResize(updateSize); div.update = function(){ div.replaceWith(slide.soundPicker = inc(THISFILE)(slide)); return inc("startDragElements/start")(slide); }; updateSize(); return div; }; })(); trainers/kidSoundSequence/soundPicker/soundPickerDiv/div.ls (function(){ return function(slide, soundEl){ return Div({ display: "flex", width: "4em", height: "4em", margin: "0.6em 0.3em", borderRadius: "50%", background: "white", overflow: "hidden", border: "1px solid " + Color.grey[200] }).html(inc("lsg/lsg")(slide, soundEl)); }; })(); trainers/kidSoundSequence/soundPicker/soundPickerDiv/lsg/lsg.ls (function(){ return function(slide, soundElement){ return inc("/shared/lsgSlim/lsg")({ lsgParams: soundElement.lsg, slide: slide }).css({ width: "3.2em", height: "auto" }); }; })(); trainers/kidSoundSequence/soundPicker/startDragElements/start.ls (function(){ return function(slide){ var dragElements, i$, len$, el, results$ = []; dragElements = slide.soundPicker.findAll(".dragElement"); for (i$ = 0, len$ = dragElements.length; i$ < len$; ++i$) { el = dragElements[i$]; results$.push(el.start()); } return results$; }; })(); trainers/kidSoundSequence/startNextAtom/start.ls (function(){ return function(slide){ var ref$; slide.totalDraggedElements = 0; if (!slide.enableAtomInstructions) { return; } slide.dragTargets = slide.div.findAll(".dragTarget"); slide.currentAtomIndex++; slide.atom = slide.atoms[slide.currentAtomIndex]; if ((ref$ = slide.atom) != null && ref$.prefill) { slide.currentAtomIndex++; slide.atom = slide.atoms[slide.currentAtomIndex]; } if (slide.atom) { return slide.showInstruction(); } }; })();