16020,6,161,31,56,6,905,23,424,72,424,77,685,55,623,47,713,44,135,75,696,53,643,45,723,40,162,77,531,55,727,55,362,47,604,44,258,71,454,36,449,49,3031,46,1551,48,441,59,70,61,214,57,133,62,70,64,119,60,119,54,441,42,664,21,208,40,680,38,315,32,1735,43,159,42,158,37,140,43,228,26,1303,49,246,40,490,36,448,29,100,32,730,39,867,35,2903,39,571,40,876,59,308,22,248,41,376,46,115,41,205,46,264,35,1681,43,514,47,375,43,333,45,140,56,642,43,369,59,660,37,91,28,1807,26,710,51,1022,73,987,73,112,42,251,52,530,76,810,43,451,49,1068,87,344,66,414,86,548,71,485,88,703,95,175,98,880,95,414,96,127,73,57,80,1242,68,847,86,663,88,271,83,2389,88,599,98,585,101,500,107,945,89,534,110,202,92,295,108,375,90,763,94,425,86,410,90,393,92,294,95,1366,78,949,96,253,109,376,113,498,79,1416,113,420,99,979,90,289,106,167,109,157,121,460,120,509,103,2012,88,371,84,688,73,397,71,551,57,1683,49,552,57,1110,53,400,63,717,63,534,72,331,72,135,72,331,47,122,53,146,45,331,66,703,51,275,62,348,60,225,62,217,44,633,65,771,74,260,74,398,76,291,59,344,65,750,74,247,74,392,76,270,59,365,63,388,57,413,35,448,37,1446,28,399,29,1396,31,577,43,1301,27,528,24,449,22,1100,45,490,36,360,34,2497,34,139,38,402,25,469,34,289,49,306,37,289,42,230,53,750,36,269,46,767,48,331,54,268,38,238,63,548,48,325,39,1031,40,88,38,464,53,334,55,915,56,628,58,268,41,1687,71,369,29,799,58,811,34,349,27,362,43,334,22,857,18,1284,34,436,43,490,34,358,36,852,26,1042,26,768,48,3026,51,340,54,3071,57,164,39,290,31,309,56,407,43,494,34,646,34,323,22,1879,28,1817,28,93,43,408,40,426,29,226,32,93,47,368,44,316,33,311,47,310,30,2128,61,1486,39,739,53,667,54,496,56,540,63,222,53,297,61,996,39,762,53,579,63,410,78,1055,87,352,70,504,54,756,56,561,63,222,53,223,39,800,53,844,63,487,76,326,54,459,56,505,30,142,26,113,56,403,52,437,51,228,63,388,69,346,65,312,92,639,87,395,69,456,65,335,45,924,53,911,61,771,46,654,55,501,36,2001,70,526,89,1335,87,657,87,1501,93,172,78,444,81,813,81,294,41,1032,65,879,53,1119,45,1666,49,854,41,689,48,266,32,125,30,154,26,1131,50,624,46,146,35,176,50,1109,22,1078,28,504,36,804,38,203,30,663,21,730,43,393,43,164,37,631,32,1686,15,916,42,90,38,88,42,685,37,221,49,570,57,113,57,103,33,269,38,188,42,2031,36,474,47,623,37,477,46,136,57,623,39,376,35,877,32,251,25,325,44,120,28,278,31,401,47,133,51,339,46,463,58,1280,66,113,66,113,42,283,32,532,49,293,54,2314,53,2499,61,203,65,507,55,483,64,136,75,611,71,1097,61,862,54,691,58,113,47,390,43,192,44,581,34,359,48,634,45,161,52,601,51,604,50,569,68,113,62,1228,46,314,36,2205,53,1502,65,1212,73,4698,71,420,65,270,63,384,68,513,59,627,65,927,76,6935,75,6935,75,208197,82,124196,81,31578,73,2274,65,1117,66,7106,65,2905,65,3432,65,16423,72,1075,71,3861,63,2001,69,507,59,483,68,136,79,360,64,348,58,1674,62,100,51,388,47,159,48,586,38,514,67,396,52,1313,49,166,56,410,46,237,42,235,46,1625,41,650,59,113,53,1192,35,323,37,162,40,136,46,963,57,865,71,1620,65,348,66,384,75,106,86,611,75,907,70,210,61,150,49,551,57,1358,65,725,61,125,61,188,53,440,49,432,58,720,51,1227,53,326,42,304,38,197,39,596,29,384,48,138,47,726,42,237,38,235,42,709,37,226,49,45,31,340,33,200,36,170,51,1279,45,164,53,1175,61,725,57,125,57,188,49,397,47,725,45,389,68,280,61,758,49,1470,58,687,47,1164,49,328,38,299,35,523,25,297,44,138,43,737,46,90,42,88,46,636,41,221,53,561,61,113,61,113,37,334,46,450,39,751,36,251,29,327,48,138,32,278,39,663,45,795,34,702,41,740,41,736,36,228,48,237,44,235,48,482,43,570,55,45,37,228,39,275,47,431,42,132,48,614,51,1938,55,214,68,541,51,2141,64,256,53,299,44,299,40,184,41,373,31,539,50,120,46,510,45,766,47,587,42,212,54,832,38,241,43,206,41,346,52,1004,52,230,55,449,52,1061,40,692,30,308,49,138,51,526,60,747,49,1676,49,132,55,509,36,559,46,310,45,114,52,735,57,1305,63,719,52,251,48,555,41,447,44,272,55,1532,58,496,55,1247,46,1085,63,153,53,912,73,726,88,733,87,599,102,249,102,270,115,163,118,781,98,268,96,379,96,359,98,974,84,502,70,363,77,540,77,540,63,1157,65,406,70,626,66,130,77,942,67,394,53,184,46,392,43,536,33,487,52,120,36,545,52,1005,40,1042,51,496,51,5529,46,639,60,676,60,756,58,646,68,171,61,725,49,218,61,1235,50,1211,62,360,40,1094,43,276,39,229,43,784,38,323,50,702,50,405,32,104,34,730,24,502,48,1068,47,528,37,774,36,533,26,356,45,138,34,398,33,673,57,644,43,4396,61,715,67,398,83,213,72,777,71,1285,81,219,67,478,71,686,66,626,48,1171,63,206,59,417,59,918,47,418,48,1173,39,2379,45,112,49,561,47,149,44,534,44,464,40,460,44,967,39,284,51,991,71,302,67,288,75,1075,69,70,59,254,61,338,63,367,59,103,35,262,42,271,38,171,47,748,62,375,87,673,73,1062,57,1904,79,602,73,353,91,345,88,246,77,731,64,686,84,106,81,99,66,900,66,270,68,119,67,185,63,375,88,673,74,1009,58,1562,74,353,92,345,89,246,78,731,65,686,85,106,82,99,64,229,89,602,63,372,62,560,67,900,67,270,57,389,51,277,47,259,55,192,40,327,54,270,37,469,27,744,46,138,56,754,44,591,42,583,44,721,43,636,38,898,34,707,44,395,40,512,44,823,39,45,57,245,61,285,69,251,65,321,73,1086,67,76,51,908,47,706,35,266,47,171,38,171,47,913,62,686,90,643,73,936,70,502,57,2026,75,467,93,106,73,606,76,441,66,1101,75,714,57,460,51,279,47,261,55,177,40,787,54,287,37,434,27,705,46,138,44,271,44,90,40,88,44,1746,39,115,51,1419,35,607,25,216,40,206,52,1532,73,1297,69,339,61,939,37,263,52,1426,41,330,45,465,49,367,55,532,58,215,61,163,59,186,43,282,59,386,44,212,49,343,49,397,56,114,57,339,73,106,62,586,85,195,76,245,86,149,101,130,100,301,86,223,99,204,51,740,72,181,47,390,72,333,57,600,73,322,88,550,106,580,104,401,110,163,97,259,87,775,98,379,116,320,127,168,115,225,102,358,104,429,82,197,59,617,64,177,84,193,60,462,71,1122,93,255,98,855,98,430,76,1240,61,500,40,414,37,886,34,251,27,1195,46,138,30,278,46,168,56,168,54,587,74,322,62,173,50,510,58,307,52,248,34,876,33,713,48,556,50,757,40,173,56,120,46,382,48,218,62,253,46,539,41,198,43,153,34,405,43,90,39,88,43,671,38,115,50,1383,34,703,39,206,36,781,64,931,83,300,100,2003,97,1056,88,408,105,575,107,778,90,879,74,2671,86,502,81,1123,87,1115,92,205,70,986,52,339,46,515,36,978,48,787,64,2667,49,252,64,797,69,1277,36,723,33,251,26,657,45,138,29,274,37,547,32,755,49,687,46,996,73,260,74,127,46,1916,55,438,55,892,57,315,59,67,51,58,43,1165,32,465,41,310,40,114,52,845,36,305,53,458,36,363,39,212,50,251,50,313,44,563,58,178,48,866,58,848,65,942,48,184,41,392,38,482,28,503,47,138,31,478,35,979,41,1479,44,218,45,318,35,838,43,237,39,298,43,515,38,45,50,1260,34,293,37,198,48,1392,48,682,37,163,52,178,46,895,65,1151,76,519,79,280,79,302,71,479,63,359,70,690,56,2517,65,457,63,942,48,699,50,233,58,593,46,236,48,139,39,554,36,362,26,274,45,138,29,274,33,448,44,90,40,88,44,696,39,45,51,515,57,81,59,237,51,240,35,430,38,178,47,604,70,280,62,260,87,673,73,993,57,3624,66,374,64,1271,74,717,62,336,40,314,37,925,34,251,27,693,46,138,30,274,44,210,46,1534,51,203,51,447,40,339,45,347,49,387,38,1017,34,403,40,88,44,656,39,82,51,1015,35,319,25,122,40,188,38,326,49,1187,49,260,52,443,49,1055,37,692,27,308,46,120,44,1025,56,713,53,2076,46,577,46,1342,65,418,58,1052,63,627,53,1051,66,261,52,1027,42,115,61,610,44,1623,46,996,58,625,62,421,42,154,44,1202,64,397,50,291,50,430,56,473,63,462,42,743,49,278,52,1197,46,619,50,186,48,353,52,1100,33,688,52,434,38,88,42,661,37,174,55,291,49,634,59,376,55,442,59,160,59,319,48,164,33,381,38,223,39,566,42,163,40,286,39,370,51,649,50,343,50,407,45,696,54,215,55,733,60,508,76,161,69,258,57,786,69,429,54,905,52,457,45,248,38,558,47,115,35,882,25,590,44,120,39,550,28,662,51,204,33,149,32,404,45,405,31,279,44,315,32,662,46,151,66,273,83,131,65,151,62,276,51,506,42,378,48,278,38,88,42,1159,37,45,49,1171,33,226,38,206,36,274,47,1096,50,449,47,1021,45,884,38,533,35,692,25,504,44,138,28,345,32,736,31,621,38,314,46,78,42,76,46,529,41,403,61,609,53,1578,61,340,67,283,61,456,63,341,37,191,27,330,40,182,51,453,62,471,49,982,58,510,57,563,45,820,64,560,58,184,49,1809,42,304,39,508,34,368,51,234,53,228,49,224,51,229,38,213,55,771,53,924,34,762,36,276,29,699,48,120,32,300,40,368,36,926,47,804,40,107,57,434,43,88,47,506,42,122,54,721,68,466,62,861,64,379,68,561,71,1071,65,797,67,348,38,105,28,175,56,746,44,551,65,345,60,157,50,3035,52,829,63,190,64,515,65,264,65,242,63,188,43,1233,40,525,39,213,58,106,56,287,59,243,56,249,57,167,54,331,58,464,74,536,86,127,55,192,30,506,49,138,33,333,49,818,48,994,50,78,46,76,50,1116,45,231,57,1212,73,113,39,335,41,105,43,697,42,247,59,745,57,1026,66,139,40,239,33,536,52,138,36,262,56,180,59,57,62,134,61,250,65,77,69,445,68,205,56,3772,59,57,57,1889,48,460,40,977,47,844,51,1136,54,138,39,88,43,506,38,45,50,1059,58,208,58,248,60,269,34,215,24,175,46,583,53,817,64,190,65,515,66,264,66,242,64,188,48,2583,39,248,36,493,35,213,52,648,50,859,26,494,45,138,47,1897,29,477,64,298,44,663,37,168,48,652,43,705,44,322,40,318,44,916,39,45,51,565,59,486,59,103,35,358,25,115,50,1207,56,364,44,1231,49,258,45,242,61,959,38,965,48,82,49,2081,66,581,43,142,49,694,39,383,32,1702,49,553,37,372,37,780,27,305,46,138,41,351,46,537,42,531,46,864,41,45,59,677,53,506,37,229,42,188,63,463,46,2677,65,428,66,768,72,310,88,229,76,538,71,281,57,1467,70,376,65,344,66,712,72,814,88,229,76,947,71,647,57,1790,40,1363,51,627,41,236,39,780,36,251,29,325,48,120,32,274,35,369,43,237,39,235,43,855,38,754,50,1070,58,200,58,278,32,431,34,105,24,267,37,176,46,242,50,422,46,408,48,1264,39,340,45,102,36,592,26,445,45,138,44,845,47,144,45,90,41,128,41,145,40,45,47,262,52,1243,54,206,36,134,45,320,46,166,42,158,56,772,42,245,38,294,42,186,44,183,44,439,45,307,37,944,40,4199,47,511,38,692,28,451,47,138,33,622,37,875,37,512,43,769,39,125,49,115,48,45,55,262,60,978,62,206,44,134,53,347,60,772,46,294,46,692,51,1542,36,504,55,138,41,517,69,1523,60,4393,45,1763,56,1108,45,512,51,676,47,125,38,90,34,88,38,671,33,248,45,358,29,633,34,218,38,247,51,640,38,810,45,1115,31,1077,38,455,21,831,40,120,34,246,36,175,28,354,38,472,64,936,28,957,43,521,39,505,43,1047,38,285,50,1053,32,1062,34,240,43,209,56,515,43,762,50,1050,60,362,39,507,59,423,63,135,57,408,68,294,82,623,68,939,74,528,68,294,58,1230,49,185,49,731,67,1209,74,129,61,146,53,274,50,349,52,187,49,441,36,954,33,239,26,669,45,120,29,262,51,825,56,397,77,1028,44,1163,52,521,48,505,52,1117,47,213,59,1053,41,885,43,271,33,734,69,347,65,432,69,135,61,301,76,282,74,189,55,951,73,702,84,296,72,642,82,253,96,189,86,968,111,450,103,524,114,393,86,577,100,431,97,207,96,403,111,322,105,450,97,353,110,463,108,545,80,522,94,496,96,174,108,219,94,303,109,1081,113,551,104,425,114,390,90,325,107,655,84,568,92,230,95,473,59,218,48,385,58,404,45,855,35,498,51,555,54,120,67,559,53,450,60,434,65,234,53,621,42,90,38,88,42,730,37,395,49,565,57,113,57,113,33,170,42,1610,36,610,47,565,37,266,46,136,57,623,30,1642,37,286,33,272,35,195,35,829,25,197,44,138,47,322,43,318,47,783,42,45,54,565,62,486,62,103,38,229,43,206,55,410,47,2566,52,258,48,259,41,897,51,82,52,675,42,205,40,780,37,251,30,325,49,138,33,274,36,431,43,90,39,88,43,772,38,45,50,561,58,113,58,113,34,226,39,188,58,402,76,411,43,1220,37,666,52,175,36,1010,33,251,26,325,45,120,29,274,32,637,50,90,46,88,50,937,45,139,57,561,65,113,65,113,41,293,45,573,59,174,43,781,40,251,33,375,52,138,64,394,55,211,49,1381,38,499,52,644,56,1144,36,274,51,1319,50,406,40,213,44,166,51,90,47,88,51,1014,46,139,58,123,42,294,60,174,44,833,41,251,34,375,53,138,50,409,39,212,53,650,57,1151,37,274,52,1318,66,394,57,210,51,1380,41,501,45,166,39,718,34,479,46,45,30,291,39,676,32,494,22,261,41,138,39,381,30,2054,27,835,44,493,39,320,51,939,59,113,59,113,35,489,51,604,44,311,52,3156,45,407,37,493,27,537,46,120,32,133,51,355,45,2743,46,391,40,210,34,236,38,149,36,958,38,104,52,377,48,367,52,515,47,940,59,1181,67,254,76,615,67,245,50,267,46,282,43,250,44,869,69,526,84,810,84,265,61,1908,73,766,67,260,69,637,69,545,67,359,54,470,58,659,64,504,62,442,51,402,45,508,35,591,54,138,55,539,54,618,52,719,53,858,38,97,43,493,38,320,50,943,58,140,58,143,34,186,24,304,50,239,43,348,51,3144,44,407,36,372,26,449,45,138,31,151,50,355,44,1882,39,204,33,256,37,149,35,840,37,122,40,1309,31,257,34,76,38,839,33,45,51,375,45,865,29,166,38,209,52,418,46,337,41,817,59,1117,43,200,34,243,31,614,21,400,40,120,24,508,40,304,39,808,49,665,44,45,56,1174,40,148,45,236,43,289,55,333,54,355,57,1139,53,472,40,2310,37,1138,42,692,32,524,51,138,39,468,38,220,45,790,43,338,48,319,45,984,46,90,42,88,46,637,41,45,59,289,53,653,63,267,37,1361,27,1779,40,189,50,251,39,768,36,251,29,954,48,138,32,274,58,574,51,1308,43,156,42,558,60,387,68,116,54,704,42,756,34,333,45,820,45,282,42,580,36,561,43,302,57,653,55,459,65,832,53,456,71,918,53,535,42,189,64,2045,67,1052,50,90,46,88,50,637,45,45,63,284,57,632,67,374,67,309,85,291,60,357,72,2489,86,261,74,838,64,1318,41,268,31,2654,54,619,47,349,45,455,43,709,40,269,33,728,52,138,36,253,40,271,54,310,63,546,93,254,91,270,73,631,56,222,67,241,101,379,98,459,98,185,111,184,137,289,123,592,99,629,81,480,74,459,77,189,66,686,66,351,70,519,62,268,63,229,66,384,63,127,64,966,66,274,75,955,77,639,113,223,102,469,99,478,96,554,108,497,111,312,107,141,130,231,117,735,112,217,92,419,104,456,107,259,77,265,83,443,87,387,83,495,66,386,74,175,58,521,48,1165,72,233,46,342,43,78,39,76,38,45,56,728,50,1499,60,246,34,471,24,2003,40,403,40,345,49,1789,40,239,43,158,45,566,60,203,45,3436,58,449,65,302,63,254,53,222,51,220,54,431,56,244,53,324,43,552,33,566,45,288,50,306,38,672,36,397,33,239,26,1027,45,138,29,262,33,876,41,301,51,619,39,546,58,374,45,604,73,340,48,434,45,764,42,445,45,1590,35,1765,60,606,41,237,37,235,41,871,36,688,54,859,48,880,32,98,38,142,53,463,35,706,56,395,46,2390,69,162,67,92,73,237,62,652,57,310,73,229,61,588,56,400,59,376,54,335,44,2589,67,143,71,225,60,978,55,822,71,229,59,1025,54,774,31,2432,41,780,34,791,33,244,50,734,51,114,48,393,58,549,49,482,24,369,43,138,35,605,49,90,45,88,49,765,44,45,56,1126,40,226,45,192,44,234,43,1316,42,692,39,259,32,372,51,138,35,282,47,329,41,213,38,441,43,158,53,237,49,235,53,1549,48,226,60,1799,42,351,44,105,47,174,53,464,73,274,64,2039,76,350,72,593,77,934,56,543,64,1431,72,726,68,125,68,188,60,432,56,451,65,721,58,1472,60,304,49,329,46,509,36,379,55,138,54,955,48,665,43,183,55,875,63,113,63,113,39,301,44,206,42,346,53,963,53,230,56,449,53,827,41,692,31,308,50,138,48,2396,50,2211,56,512,37,541,41,138,46,608,41,108,53,978,37,265,40,346,51,996,51,230,54,449,51,845,49,673,39,748,29,324,48,138,61,1209,68,494,74,246,70,367,70,628,65,1027,66,79,68,979,77,530,76,241,73,1683,71,468,73,287,72,118,74,252,68,156,77,160,66,668,72,402,70,411,76,654,81,995,76,826,62,339,54,402,48,522,44,299,59,189,64,993,66,545,50,443,35,490,41,608,36,210,48,1101,32,265,35,346,46,996,46,230,49,449,46,905,44,617,34,815,24,324,43,138,56,1203,63,440,69,246,65,367,65,650,60,1027,61,79,76,820,63,152,95,389,88,964,96,246,97,387,78,349,72,530,71,241,68,1683,66,468,68,287,67,118,69,252,63,156,72,160,61,646,67,394,65,411,71,630,83,97,101,99,83,1072,101,391,85,1295,89,209,107,226,101,108,99,148,95,221,85,95,93,219,115,141,95,228,97,108,105,506,97,392,99,226,121,284,71,428,57,339,49,306,43,435,39,299,30,484,47,90,43,88,47,592,42,130,63,1096,54,524,38,266,43,206,41,679,52,2790,52,759,42,205,39,604,40,780,37,251,30,325,49,138,33,274,36,431,47,665,42,91,54,865,38,279,43,206,41,346,52,984,52,230,55,449,52,827,40,692,43,403,30,443,49,138,47,2559,49,2561,60,155,65,949,67,428,51,441,62,591,60,1153,55,843,47,126,36,541,47,665,42,45,54,716,62,113,62,113,38,241,41,274,52,703,52,230,55,449,40,692,43,306,30,308,49,138,47,2327,49,1962,55,2115,36,479,46,90,42,88,46,880,41,256,53,561,61,197,61,103,37,296,27,163,39,830,36,251,29,338,48,138,32,274,48,777,50,315,49,310,63,431,61,82,55,1922,68,246,65,249,57,1096,51,315,34,839,40,321,36,317,40,855,35,45,53,362,47,865,31,219,40,209,43,380,61,1014,57,354,45,163,36,435,33,642,40,431,23,389,42,120,52,841,61,273,42,1333,30,1356,46,90,42,88,46,665,41,248,53,358,37,516,46,749,42,218,43,274,39,828,46,455,29,757,48,120,44,104,36,302,52,218,60,1724,54,619,40,276,47,136,45,609,36,528,40,106,44,90,40,88,44,664,39,45,51,561,59,113,59,113,35,226,40,206,44,1519,38,1102,39,319,56,330,52,839,52,337,46,215,49,1408,46,289,37,826,34,251,27,522,46,138,30,274,47,197,36,270,33,563,34,208,64,239,47,1614,43,337
_info
{"project":"app01-trainers","branch":"master","version":266,"versionDate":"2024-05-29T11:00:13.000Z","fromVersion":0,"reset":true,"checksumDocs":"2252-1756816"}
_levelPlayerVersion/version.ls
(function(){
return function(){
return "v3.4";
};
})();
_t.ls
(function(){
return {
continueButton: {
de: "Weiter",
en: "Continue",
fr: "Continuer",
es: "Continuar",
pt: "Continuar"
},
closeButton: {
de: "Schließen",
en: "Close",
fr: "Fermer",
es: "Cerrar",
pt: "Fechar"
},
cancelButton: {
de: "Abbrechen",
en: "Cancel",
fr: "Annuler",
es: "Cancelar",
pt: "Cancelar"
},
backButton: {
de: "Zurück",
en: "Back",
fr: "Retour",
es: "Anterior",
pt: "Voltar"
},
yes: {
de: "Ja",
en: "Yes",
fr: "Oui",
es: "Sí",
pt: "Sim"
},
no: {
de: "Nein",
en: "No",
fr: "Non",
es: "No",
pt: "Não"
},
ok: {
de: "Ok",
en: "Ok",
fr: "OK",
es: "Ok",
pt: "Ok"
},
tryAgain: {
de: "Nochmal probieren",
en: "Try again",
fr: "Réessayer",
es: "Volver a intentar",
pt: "Tentar novamente"
},
solveButton: {
de: "Lösen",
en: "Solve",
fr: "Voir la solution",
es: "Ver solución",
pt: "Ver solução"
},
checkButton: {
de: "Prüfen",
en: "Check",
fr: "Vérifier",
es: "Comprobar",
pt: "Conferir"
}
};
})();
shared/askSound/ask.ls
(function(){
return function(sounds){
var text, play, div, speaker;
play = function(newText, onDone){
if (text !== newText) {
text = newText;
speaker.setSound(sounds[text]);
}
return speaker.play(onDone);
};
div = Div({
display: "block",
margin: "-0.75em auto"
}).html(speaker = inc("/../app01/lib/gui/speakerIconPlayer/speakerIconPlayer")({
size: "3.5em"
}));
div.play = play;
div.stop = speaker.stop;
return div;
};
})();
shared/calcAdditionalMedia/_shared/calcTrainerSpecificFeedbacks/calc.ls
(function(){
return function(slide, atom){
var trainer, p, feedbacks, o;
trainer = slide.trainerParams.trainer;
p = slide.getParam;
return feedbacks = trainer === "findAll" && atom.objects != null
? (function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = _.filter(atom.objects, "feedback")).length; i$ < len$; ++i$) {
o = ref$[i$];
results$.push(p("feedback", o));
}
return results$;
}())
: [];
};
})();
shared/calcAdditionalMedia/images/feedback/addTrainerSpecificFeedback/add.ls
(function(){
return function(slide, images, atom){
var feedbacks, i$, len$, feedback, lresult$, j$, v, lresult1$, elements, k$, len1$, el, image, results$ = [];
feedbacks = inc("../../../_shared/calcTrainerSpecificFeedbacks/calc")(slide, atom);
for (i$ = 0, len$ = feedbacks.length; i$ < len$; ++i$) {
feedback = feedbacks[i$];
lresult$ = [];
for (j$ in feedback) {
v = feedback[j$];
lresult1$ = [];
elements = _.ensureArray(v.text);
for (k$ = 0, len1$ = elements.length; k$ < len1$; ++k$) {
el = elements[k$];
if (el.image) {
image = slide.getParam("image", el);
lresult1$.push(images.push(image));
}
}
lresult$.push(lresult1$);
}
results$.push(lresult$);
}
return results$;
};
})();
shared/calcAdditionalMedia/images/feedback/feedback.ls
(function(){
return function(slide, images){
var atoms, i$, len$, atom, feedback, j$, o, elements, k$, len1$, el, image, results$ = [];
atoms = slide.atoms || [slide.atom];
for (i$ = 0, len$ = atoms.length; i$ < len$; ++i$) {
atom = atoms[i$];
feedback = slide.getParam("feedback", atom);
for (j$ in feedback) {
o = feedback[j$];
elements = _.ensureArray(o.text);
for (k$ = 0, len1$ = elements.length; k$ < len1$; ++k$) {
el = elements[k$];
if (el.image) {
image = slide.getParam("image", el);
images.push(image);
}
}
}
results$.push(inc("addTrainerSpecificFeedback/add")(slide, images, atom));
}
return results$;
};
})();
shared/calcAdditionalMedia/images/hint/hint.ls
(function(){
return function(slide, images){
var calcHintParams, i$, ref$, len$, atom, results$ = [];
calcHintParams = function(a){
var hint, texts, i$, len$, t, image, results$ = [];
hint = slide.getParam("hint", a);
texts = _.ensureArray(hint != null ? hint.text : void 8);
for (i$ = 0, len$ = texts.length; i$ < len$; ++i$) {
t = texts[i$];
if (t != null && t.image) {
image = slide.getParam("image", t);
if (image) {
results$.push(images.push(image));
}
}
}
return results$;
};
if (slide.atoms) {
for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) {
atom = ref$[i$];
results$.push(calcHintParams(atom));
}
return results$;
} else if (slide.atom) {
return calcHintParams(slide.atom);
}
};
})();
shared/calcAdditionalMedia/images/images.ls
(function(){
return function(slide, images){
inc("hint/hint")(slide, images);
return inc("feedback/feedback")(slide, images);
};
})();
shared/calcAdditionalMedia/lsgs/feedback/addTrainerSpecificFeedback/add.ls
(function(){
return function(slide, lsgDescriptions, atom){
var feedbacks, i$, len$, feedback, lresult$, j$, v, lresult1$, elements, k$, len1$, el, lsgD, results$ = [];
feedbacks = inc("../../../_shared/calcTrainerSpecificFeedbacks/calc")(slide, atom);
for (i$ = 0, len$ = feedbacks.length; i$ < len$; ++i$) {
feedback = feedbacks[i$];
lresult$ = [];
for (j$ in feedback) {
v = feedback[j$];
lresult1$ = [];
elements = _.ensureArray(v.text);
for (k$ = 0, len1$ = elements.length; k$ < len1$; ++k$) {
el = elements[k$];
if (el.lsg) {
lsgD = slide.getParam("lsg", el);
lresult1$.push(lsgDescriptions.push(lsgD));
}
}
lresult$.push(lresult1$);
}
results$.push(lresult$);
}
return results$;
};
})();
shared/calcAdditionalMedia/lsgs/feedback/feedback.ls
(function(){
return function(slide, lsgDescriptions){
var atoms, i$, len$, atom, feedback, j$, o, elements, k$, len1$, el, lsgD, results$ = [];
atoms = slide.atoms || [slide.atom];
for (i$ = 0, len$ = atoms.length; i$ < len$; ++i$) {
atom = atoms[i$];
feedback = slide.getParam("feedback", atom);
for (j$ in feedback) {
o = feedback[j$];
elements = _.ensureArray(o.text);
for (k$ = 0, len1$ = elements.length; k$ < len1$; ++k$) {
el = elements[k$];
if (el.lsg) {
lsgD = slide.getParam("lsg", el);
lsgDescriptions.push(lsgD);
}
}
}
results$.push(inc("addTrainerSpecificFeedback/add")(slide, lsgDescriptions, atom));
}
return results$;
};
})();
shared/calcAdditionalMedia/lsgs/hint/hint.ls
(function(){
return function(slide, lsgDescriptions){
var calcHintParams, i$, ref$, len$, atom, results$ = [];
calcHintParams = function(a){
var hint, texts, i$, len$, t, lsgD, results$ = [];
hint = slide.getParam("hint", a);
texts = _.ensureArray(hint != null ? hint.text : void 8);
for (i$ = 0, len$ = texts.length; i$ < len$; ++i$) {
t = texts[i$];
if (t != null && t.lsg) {
lsgD = slide.getParam("lsg", t);
if (lsgD) {
results$.push(lsgDescriptions.push(lsgD));
}
}
}
return results$;
};
if (slide.atoms) {
for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) {
atom = ref$[i$];
results$.push(calcHintParams(atom));
}
return results$;
} else if (slide.atom) {
return calcHintParams(slide.atom);
}
};
})();
shared/calcAdditionalMedia/lsgs/lsgs.ls
(function(){
return function(slide, lsgDescriptions){
inc("hint/hint")(slide, lsgDescriptions);
return inc("feedback/feedback")(slide, lsgDescriptions);
};
})();
shared/calcAdditionalMedia/sounds/feedback/addTrainerSpecificFeedback/add.ls
(function(){
return function(slide, soundParams, atom){
var feedbacks, i$, len$, feedback, lresult$, j$, v, results$ = [];
feedbacks = inc("../../../_shared/calcTrainerSpecificFeedbacks/calc")(slide, atom);
for (i$ = 0, len$ = feedbacks.length; i$ < len$; ++i$) {
feedback = feedbacks[i$];
lresult$ = [];
for (j$ in feedback) {
v = feedback[j$];
if (v.sound) {
lresult$.push(soundParams.push({
text: v.sound,
voice: v.voice || "default",
voiceLang: v.voiceLang || "de"
}));
}
}
results$.push(lresult$);
}
return results$;
};
})();
shared/calcAdditionalMedia/sounds/feedback/feedback.ls
(function(){
return function(slide, soundParams){
var that, i$, o, atoms, len$, atom, feedback, j$, results$ = [];
if (that = slide.getParam("feedback")) {
for (i$ in that) {
o = that[i$];
if (o.sound) {
soundParams.push({
text: o.sound,
voice: o.voice || "default",
voiceLang: o.voiceLang || "de"
});
}
}
}
atoms = slide.atoms || [slide.atom];
for (i$ = 0, len$ = atoms.length; i$ < len$; ++i$) {
atom = atoms[i$];
feedback = slide.getParam("feedback", atom);
for (j$ in feedback) {
o = feedback[j$];
if (o.sound) {
soundParams.push({
text: o.sound,
voice: o.voice || "default",
voiceLang: o.voiceLang || "de"
});
}
}
results$.push(inc("addTrainerSpecificFeedback/add")(slide, soundParams, atom));
}
return results$;
};
})();
shared/calcAdditionalMedia/sounds/finishSound/sound.ls
(function(){
return function(slide, soundParams){
var atom, ref$, sound;
atom = (ref$ = slide.atom) != null && ref$.finishSound ? slide.atom : void 8;
sound = slide.getParam("finishSound", atom);
if (sound != null) {
return soundParams.push({
text: sound,
voice: slide.getParam("voice", atom),
voiceLang: slide.getParam("voiceLang", atom) || "de"
});
}
};
})();
shared/calcAdditionalMedia/sounds/hint/hint.ls
(function(){
return function(slide, soundParams){
var calcHintParams, i$, ref$, len$, atom, results$ = [];
calcHintParams = function(a, soundParams){
var hint;
hint = slide.getParam("hint", a);
if (hint != null && hint.sound) {
return soundParams.push({
text: hint.sound,
voice: hint.voice || "default",
voiceLang: hint.voiceLang || "de"
});
}
};
if (slide.atoms) {
for (i$ = 0, len$ = (ref$ = slide.atoms).length; i$ < len$; ++i$) {
atom = ref$[i$];
results$.push(calcHintParams(atom, soundParams));
}
return results$;
} else if (slide.atom) {
return calcHintParams(slide.atom, soundParams);
}
};
})();
shared/calcAdditionalMedia/sounds/sounds.ls
(function(){
return function(slide, soundParams){
inc("speakInstruction/speakInstruction")(slide, soundParams);
inc("feedback/feedback")(slide, soundParams);
inc("hint/hint")(slide, soundParams);
return inc("finishSound/sound")(slide, soundParams);
};
})();
shared/calcAdditionalMedia/sounds/speakInstruction/speakInstruction.ls
(function(){
return function(slide, soundParams){
var instruction, text, voiceLang, voice;
instruction = slide.getParam("instruction", slide.atom);
text = instruction != null ? instruction.sound : void 8;
if (text) {
voiceLang = (instruction != null ? instruction.voiceLang : void 8) || "de";
voice = (instruction != null ? instruction.voice : void 8) || "default";
return soundParams.push({
text: text,
voice: voice,
voiceLang: voiceLang
});
}
};
})();
shared/calcStringComparison/calc.ls
(function(){
return function(p){
p.highlightColor == null && (p.highlightColor = Color.red[500]);
if (p.input.length === 0) {
p.parts = [{
type: "insertion",
textCorrect: p.solution
}];
} else {
p.distance = inc("calcDistance/calc")(p.input, p.solution);
p.parts = inc("calcParts/calc")(p);
}
p.htmlInput = function(){
return inc("html/input/input")(p);
};
p.htmlSolution = function(){
return inc("html/solution/solution")(p);
};
return p;
};
})();
shared/calcStringComparison/calcDistance/calc.ls
(function(){
return function(input, solution){
var editCheckOrder, arrZ, n, m, createArray, ep, getEntry, checkEdit, getOptimalPathRecursive, getOptimalPath, i$, i, j, j$, path;
editCheckOrder = ["substitution", "insertion", "erasure"];
arrZ = null;
n = input.length;
m = solution.length;
createArray = function(n, m){
var arr, i$, i;
arr = new Array(n);
for (i$ = 0; i$ < n; ++i$) {
i = i$;
arr[i] = new Array(m);
}
arr[0][0] = 0;
return arrZ = arr;
};
ep = function(type, a, b){
if (a != null && a === b) {
return 0;
} else if (type === "substitution") {
return 1;
} else if (type === "erasure") {
return 0.5;
} else if (type === "insertion") {
return 0.5;
}
};
getEntry = function(x, y){
if (x >= 0 && x >= 0) {
return arrZ[x][y];
} else {
return Infinity;
}
};
checkEdit = function(i, j, type, strings){
switch (type) {
case "insertion":
if (arrZ[i][j] === getEntry(i, j - 1) + ep("insertion")) {
return [
i, j - 1, {
type: "insertion",
i: i,
j: j
}
];
}
break;
case "substitution":
if (arrZ[i][j] === getEntry(i - 1, j - 1) + ep("substitution", strings[0][i - 1], strings[1][j - 1])) {
return [
i - 1, j - 1, {
type: arrZ[i][j] === arrZ[i - 1][j - 1] ? "correct" : "substitution",
i: i,
j: j
}
];
}
break;
case "erasure":
if (arrZ[i][j] === getEntry(i - 1, j) + ep("erasure")) {
return [
i - 1, j, {
type: "erasure",
i: i,
j: j
}
];
}
}
};
getOptimalPathRecursive = function(i, j, path, strings, lastEdit){
var i$, ref$, len$, editCheck, that;
if (i === 0 && j === 0) {
return path;
}
if (lastEdit) {
_.pull(editCheckOrder, lastEdit);
editCheckOrder.unshift(lastEdit);
}
for (i$ = 0, len$ = (ref$ = editCheckOrder).length; i$ < len$; ++i$) {
editCheck = ref$[i$];
if (that = checkEdit(i, j, editCheck, strings)) {
path.push(that[2]);
return getOptimalPathRecursive(that[0], that[1], path, strings, editCheck);
}
}
};
getOptimalPath = function(input, solution){
var strings, i, j, path;
strings = [input, solution];
i = input.length;
j = solution.length;
path = getOptimalPathRecursive(i, j, [], strings);
return path.reverse();
};
createArray(n + 1, m + 1);
for (i$ = 0; i$ < n; ++i$) {
i = i$;
arrZ[i + 1][0] = arrZ[i][0] + ep("erasure", input[i]);
}
for (i$ = 0; i$ < m; ++i$) {
j = i$;
arrZ[0][j + 1] = arrZ[0][j] + ep("insertion", solution[j]);
}
for (i$ = 0; i$ < n; ++i$) {
i = i$;
arrZ[i + 1][1] = Math.min(arrZ[i][1] + ep("erasure", input[i]), arrZ[i + 1][0] + ep("insertion", solution[0]), arrZ[i][0] + ep("substitution", input[i], solution[0]));
}
for (i$ = 1; i$ < m; ++i$) {
j = i$;
arrZ[1][j + 1] = Math.min(arrZ[1][j] + ep("insertion", solution[j]), arrZ[0][j + 1] + ep("erasure", input[0]), arrZ[0][j] + ep("substitution", input[0], solution[j]));
}
for (i$ = 1; i$ < n; ++i$) {
i = i$;
for (j$ = 1; j$ < m; ++j$) {
j = j$;
arrZ[i + 1][j + 1] = Math.min(arrZ[i][j + 1] + ep("erasure", input[i]), arrZ[i + 1][j] + ep("insertion", solution[j]), arrZ[i][j] + ep("substitution", input[i], solution[j]));
}
}
path = getOptimalPath(input, solution);
return {
distance: arrZ[n][m],
array: arrZ,
path: path
};
};
})();
shared/calcStringComparison/calcParts/calc.ls
(function(){
return function(p){
var input, solution, parts, currentPart, i$, ref$, len$, i, step, type, a, res$, j$, len1$, s, ref1$;
input = p.input;
solution = p.solution;
parts = [];
currentPart = {};
for (i$ = 0, len$ = (ref$ = p.distance.path).length; i$ < len$; ++i$) {
i = i$;
step = ref$[i$];
type = step.type === "correct"
? "correct"
: step.type === "insertion" ? "insertion" : "wrong";
if (type === currentPart.type) {
currentPart.steps.push(step);
} else {
if (currentPart.type) {
parts.push(currentPart);
}
currentPart = {
index: parts.length,
type: type,
steps: [step]
};
}
}
parts.push(currentPart);
for (i$ = 0, len$ = parts.length; i$ < len$; ++i$) {
i = i$;
p = parts[i$];
if (p.type === "wrong") {
res$ = [];
for (j$ = 0, len1$ = (ref$ = p.steps).length; j$ < len1$; ++j$) {
s = ref$[j$];
res$.push(input[s.i - 1]);
}
a = res$;
p.textWrong = a.join("");
res$ = [];
for (j$ = 0, len1$ = (ref$ = p.steps).length; j$ < len1$; ++j$) {
s = ref$[j$];
if ((ref1$ = s.type) === "substitution" || ref1$ === "transposition") {
res$.push(solution[s.j - 1]);
} else {
res$.push("");
}
}
a = res$;
p.textCorrect = a.join("");
} else if (p.type === "correct") {
res$ = [];
for (j$ = 0, len1$ = (ref$ = p.steps).length; j$ < len1$; ++j$) {
s = ref$[j$];
res$.push(input[s.i - 1]);
}
a = res$;
p.textCorrect = a.join("");
} else if (p.type === "insertion") {
res$ = [];
for (j$ = 0, len1$ = (ref$ = p.steps).length; j$ < len1$; ++j$) {
s = ref$[j$];
res$.push(solution[s.j - 1]);
}
a = res$;
p.textCorrect = a.join("");
}
}
return parts;
};
})();
shared/calcStringComparison/html/input/input.ls
(function(){
return function(p){
var f, part;
f = {
correct: inc("partCorrect/part"),
wrong: inc("partWrong/part"),
insertion: inc("partInsertion/part")
};
return Span({
userSelect: "text",
webkitUserSelect: "text",
cursor: "text"
}).html((function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = p.parts).length; i$ < len$; ++i$) {
part = ref$[i$];
results$.push(f[part.type](part, p));
}
return results$;
}()));
};
})();
shared/calcStringComparison/html/input/partCorrect/part.ls
(function(){
return function(part){
return part.textCorrect;
};
})();
shared/calcStringComparison/html/input/partInsertion/part.ls
(function(){
return function(part, p){
return Span({
borderBottom: "2px solid " + p.highlightColor,
marginLeft: "-0.15em",
marginRight: "-0.15em"
}).html(Div({
display: "inline-block",
width: "0.3em"
}));
};
})();
shared/calcStringComparison/html/input/partWrong/part.ls
(function(){
return function(part, p){
return Span({
borderBottom: "2px solid " + p.highlightColor
}).html(part.textWrong);
};
})();
shared/calcStringComparison/html/solution/partCorrect/part.ls
(function(){
return function(part){
return part.textCorrect;
};
})();
shared/calcStringComparison/html/solution/partInsertion/part.ls
(function(){
return function(part, p){
return Span({
color: p.highlightColor
}).secureHtml(part.textCorrect);
};
})();
shared/calcStringComparison/html/solution/partWrong/part.ls
(function(){
return function(part, p){
return Span({
color: p.highlightColor
}).secureHtml(part.textCorrect);
};
})();
shared/calcStringComparison/html/solution/solution.ls
(function(){
return function(p){
var f, part;
f = {
correct: inc("partCorrect/part"),
wrong: inc("partWrong/part"),
insertion: inc("partInsertion/part")
};
return Span({
userSelect: "text",
webkitUserSelect: "text",
cursor: "text"
}).html((function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = p.parts).length; i$ < len$; ++i$) {
part = ref$[i$];
results$.push(f[part.type](part, p));
}
return results$;
}()));
};
})();
shared/calcSvgsFromLsgDescription/calc.ls
(function(){
return function(slide, lsgDescriptions){
var svgs, i$, ref$, len$, lsgDescription, lsg, ref1$, required, j$, ref2$, len1$, path;
svgs = [];
for (i$ = 0, len$ = (ref$ = _.ensureArray(lsgDescriptions)).length; i$ < len$; ++i$) {
lsgDescription = ref$[i$];
lsg = ((ref1$ = slide.levelParams.lsgs) != null ? ref1$[lsgDescription.lsg] : void 8) || inc(lsgDescription.lsg);
if (!lsg) {
continue;
}
if (_.isFunction(lsg)) {
lsg = lsg(lsgDescription);
}
required = LSG2.util.getRequiredSync(lsg);
for (j$ = 0, len1$ = (ref2$ = required.svgs).length; j$ < len1$; ++j$) {
path = ref2$[j$];
svgs.push({
path: path
});
}
}
return _.uniqBy(svgs, "path");
};
})();
shared/choices/_t.ls
(function(){
return {
check: {
de: "Prüfen",
en: "Check",
fr: "Vérifier",
es: "Comprobar",
pt: "Conferir"
},
solution: {
de: "Lösung",
en: "Solution",
fr: "Solution",
es: "Solución",
pt: "Solução"
}
};
})();
shared/choices/buttonContinue/button.ls
(function(){
return function(click){
return Button({
label: T("continueButton"),
icon: path("/../app01/lib/svg/icon/arrow-right-small.svg"),
iconPosition: "right"
}).addClass("choicesContinueButton").css({
padding: "0.7em",
minWidth: "5em",
marginTop: "1em",
backgroundClip: "border-box"
}).addClass("keyManager-enter").bind("keyManager", click).tap(click).onDomAppendAndVisible(function(){
return this.keyframeAnimate({
keyframes: {
"30%": {
transform: "rotate(0deg)"
},
"32%": {
transform: "rotate(-5deg)"
},
"37%": {
transform: "rotate(5deg)"
},
"39%": {
transform: "rotate(0deg)"
}
},
delay: 6000,
duration: 6000,
iterationCount: "infinite",
timing: "linear"
});
});
};
})();
shared/choices/buttonSubmit/button.ls
(function(){
return function(click){
return Button({
label: T("checkButton"),
icon: path("/../app01/lib/svg/icon/arrow-right-small.svg"),
iconPosition: "right"
}).addClass("choicesSubmitButton").css({
padding: "0.7em",
marginTop: "1em"
}).addClass("keyManager-enter").bind("keyManager", click).tap(click);
};
})();
shared/choices/choice/choice.ls
(function(){
return function(choice, o, i){
var selected, click, solve, showSolution, div, solution, iconCheckOn, iconCheckOff;
selected = false;
click = function(){
selected = !selected;
if (selected) {
iconCheckOn.show();
return iconCheckOff.hide();
} else {
iconCheckOn.hide();
return iconCheckOff.show();
}
};
solve = function(){
var m;
m = false;
div.css({
pointerEvents: "none"
});
if (choice.correct) {
if (!selected) {
iconCheckOff.setColor(Color.red[500]);
m = true;
} else {
iconCheckOn.setColor(Color.green[500]);
}
} else {
if (selected) {
iconCheckOn.setColor(Color.red[500]);
m = true;
}
}
if (m) {
o.onActionMistake({
text: choice.text,
selected: selected,
correct: false
});
return o.allCorrect = false;
} else if (selected) {
return o.onActionCorrect({
text: choice.text,
selected: selected,
correct: true
});
}
};
showSolution = function(type){
var w;
w = solution.show().width({
withMargins: true
});
if (type !== "review") {
solution.css({
width: 0,
margin: 0
});
return solution.css({
width: w + "px",
transition: "width 500ms"
});
}
};
div = Div({
display: "flex",
justifyContent: "flex-start",
minWidth: "14em",
padding: "0.6em 0",
whiteSpace: "nowrap",
wordWrap: "break-word",
textAlign: "left",
margin: "0 auto",
borderBottom: "1px solid " + Color.grey[300],
borderTop: i === 0 ? "1px solid " + Color.grey[300] : void 8
}).append(solution = inc("solution/solution")(choice).hide(), iconCheckOn = inc("iconCheckOn/icon")().hide(), iconCheckOff = inc("iconCheckOff/icon")(), inc("label/label")(o, choice.text)).tap(click);
div.solve = solve;
div.isSelected = selected;
div.label = choice.text;
div.showSolution = showSolution;
div.iconCheckOn = iconCheckOn;
div.iconCheckOff = iconCheckOff;
return div;
};
})();
shared/choices/choice/iconCheckOff/icon.ls
(function(){
return function(){
return SvgIcon({
svg: path("/../app01/lib/svg/icon/check-off.svg")
}).css({
flex: "0 0 auto",
marginLeft: "0.5em"
});
};
})();
shared/choices/choice/iconCheckOn/icon.ls
(function(){
return function(){
return SvgIcon({
svg: path("/../app01/lib/svg/icon/check-on.svg")
}).css({
flex: "0 0 auto",
marginLeft: "0.5em"
});
};
})();
shared/choices/choice/label/label.ls
(function(){
return function(o, label){
return Div({
flex: "1 1 auto",
paddingLeft: "0.7em",
pointerEvents: "none"
}).html(label);
};
})();
shared/choices/choice/solution/solution.ls
(function(){
return function(choice){
return SvgIcon({
svg: choice.correct
? path("/../app01/lib/svg/icon/check-on.svg")
: path("/../app01/lib/svg/icon/check-off.svg")
}).css({
flex: "0 0 auto",
marginLeft: "0.5em"
});
};
})();
shared/choices/choices.ls
(function(){
return function(o){
var choiceDivs, clickSubmit, clickContinue, div, i$, ref$, len$, i, choice, d, submitButton, continueButton;
o.allCorrect = true;
choiceDivs = [];
clickSubmit = function(){
var i$, ref$, len$, d;
for (i$ = 0, len$ = (ref$ = choiceDivs).length; i$ < len$; ++i$) {
d = ref$[i$];
d.solve();
}
if (!o.allCorrect) {
inc("showSolution/show")(div, choiceDivs);
}
if (typeof o.onSubmit == 'function') {
o.onSubmit(o.allCorrect);
}
submitButton.css({
pointerEvents: "none",
backgroundColor: o.allCorrect
? Color.green[500]
: Color.red[500]
});
return setTimeout(function(){
submitButton.hide();
return continueButton.fadeIn();
}, 1000);
};
clickContinue = function(){
continueButton.remove();
return o.onFinish();
};
div = Div({
display: "inline-block",
maxWidth: "100%",
padding: "0 0.8em",
margin: "2em 0 1em",
backgroundColor: 'white'
});
for (i$ = 0, len$ = (ref$ = o.choices).length; i$ < len$; ++i$) {
i = i$;
choice = ref$[i$];
choiceDivs.push(d = inc("choice/choice")(choice, o, i).appendTo(div));
}
requestAnimationFrame(function(){
return inc("optimizeSize/optimize")(choiceDivs);
});
div.append(submitButton = inc("buttonSubmit/button")(clickSubmit), continueButton = inc("buttonContinue/button")(clickContinue).hide());
div.choices = choiceDivs;
return div;
};
})();
shared/choices/optimizeSize/calcMaxWidth/calc.ls
(function(){
return function(divs){
var maxWidth, i$, len$, div, width;
maxWidth = 0;
for (i$ = 0, len$ = divs.length; i$ < len$; ++i$) {
div = divs[i$];
width = div.width() + 10;
maxWidth = Math.max(width, maxWidth);
}
return maxWidth;
};
})();
shared/choices/optimizeSize/optimize.ls
(function(){
return function(divs){
var wrapper, maxWidth, i$, len$, div, results$ = [];
wrapper = divs[0].closest(".choicesWrapper");
if (wrapper && !wrapper.isVisible()) {
wrapper.show();
maxWidth = inc("calcMaxWidth/calc")(divs);
wrapper.hide();
} else {
maxWidth = inc("calcMaxWidth/calc")(divs);
}
for (i$ = 0, len$ = divs.length; i$ < len$; ++i$) {
div = divs[i$];
results$.push(div.css({
width: maxWidth + "px",
maxWidth: "90%",
whiteSpace: "normal"
}));
}
return results$;
};
})();
shared/choices/showSolution/show.ls
(function(){
return function(div, choiceDivs){
var i$, len$, d;
for (i$ = 0, len$ = choiceDivs.length; i$ < len$; ++i$) {
d = choiceDivs[i$];
d.css({
maxWidth: "95%"
});
d.showSolution();
}
return choiceDivs[0].prepend(Div({
position: "absolute",
top: "-2em",
left: "-1.2em",
opacity: 0,
color: Color.grey[550],
fontSize: "0.9em"
}).animation({
css: {
left: "-0.7em",
opacity: 1
},
easing: "linear",
duration: 300
}).html(T("solution")));
};
})();
shared/colorBracket/color.ls
(function(){
return function(s){
return s.replace(/(\([^)]+?\))/g, "$1");
};
})();
shared/continueButton/button.ls
(function(){
return function(callback){
var children, bottom, onContinue, showButton, div;
children = null;
bottom = app.currentPage.bottom;
onContinue = function(){
bottom.append(children);
return callback();
};
showButton = function(){
var h;
if (app.currentPage.levelPlayer == null) {
return;
}
children = bottom.childrenAll();
bottom.html(div).show();
h = div.height();
return div.keyframeAnimate({
keyframes: {
"0%": {
height: "0px"
},
"100%": {
height: h + "px"
}
},
duration: 500,
onCompleted: function(){
return div.css({
height: ""
});
}
});
};
div = Div();
div.css({
textAlign: "center"
}).addClass("continueButton").html(inc("button/button")(onContinue, div, bottom));
div.showButton = showButton;
return div;
};
})();
shared/continueButton/button/button.ls
(function(){
return function(callback, div, bottom){
var click, button;
click = function(){
button.css({
pointerEvents: "none"
});
return bottom.keyframeAnimate({
keyframes: {
"0%": {
transform: "translateY(0%)"
},
"100%": {
transform: "translateY(100%)"
}
},
duration: 400,
delay: 100,
onCompleted: function(){
div.remove();
bottom.css({
transform: ""
});
return callback();
}
});
};
return button = Button({
key: "enter",
action: click,
label: T("continueButton"),
icon: path("/../app01/lib/svg/icon/arrow-right-small.svg"),
iconPosition: "right"
}).css({
margin: "0.8em",
backgroundClip: "border-box"
}).keyframeAnimate({
keyframes: {
"30%": {
transform: "rotate(0deg)"
},
"32%": {
transform: "rotate(-5deg)"
},
"37%": {
transform: "rotate(5deg)"
},
"39%": {
transform: "rotate(0deg)"
}
},
duration: 6000,
iterationCount: "infinite",
timing: "linear"
});
};
})();
shared/convertGapString/convert.ls
(function(){
var colorTags;
colorTags = inc("/../app01/lib/util/cssColorTags/cssColorTags");
return function(s){
var r, parts, parts2, bold, italic, underline, superscript, subscript, textColor, markColor, gapIndex, i$, len$, p, isGap, j$, ref$, len1$, c, i;
r = _.replaceAll;
s = String(s);
s = r(s, "|", "|");
s = s.replace(/([^(])\(([^(])/g, "$1BRACKETOPEN$2");
s = s.replace(/(\({2})\(/g, "$1BRACKETOPEN");
s = s.replace(/([^)])\)([^)])/g, "$1BRACKETCLOSE$2");
s = s.replace(/\)(\){2})/g, "BRACKETCLOSE$1");
s = r(s, "((", "||GAP");
s = r(s, "))", "||");
parts = s.split("||");
parts = _.filter(parts, function(s){
return s !== "";
});
parts2 = [];
bold = false;
italic = false;
underline = false;
superscript = false;
subscript = false;
textColor = "";
markColor = "";
gapIndex = 0;
for (i$ = 0, len$ = parts.length; i$ < len$; ++i$) {
p = parts[i$];
isGap = p.substring(0, 3) === "GAP";
p = r(p, "GAP", "");
p = r(p, "BRACKETOPEN", "(");
p = r(p, "BRACKETCLOSE", ")");
if (isGap) {
parts2.push({
gap: p,
bold: bold,
italic: italic,
underline: underline,
gapIndex: gapIndex
});
gapIndex++;
} else {
p = r(p, "
", "||BREAK||");
p = r(p, "
", "||BREAK||");
p = r(p, "
", "||BREAK||");
p = r(p, "
", "||BREAK||");
p = r(p, "", "||BOLD||");
p = r(p, "", "||BOLD||");
p = r(p, "", "||ITALIC||");
p = r(p, "", "||ITALIC||");
p = r(p, "", "||UNDERLINE||");
p = r(p, "", "||UNDERLINE||");
p = r(p, "", "||SUPERSCRIPT||");
p = r(p, "", "||SUPERSCRIPT||");
p = r(p, "", "||SUBSCRIPT||");
p = r(p, "", "||SUBSCRIPT||");
p = r(p, " ", "||SPACE||");
for (j$ = 0, len1$ = (ref$ = _.keys(colorTags.textColors)).length; j$ < len1$; ++j$) {
c = ref$[j$];
p = r(p, "", "||MARK-" + c + "||");
p = r(p, "", "||MARK-" + c + "||");
p = r(p, "", "||TEXT-" + c + "||");
p = r(p, "", "||TEXT-" + c + "||");
}
for (j$ = 0, len1$ = (ref$ = p.split("||")).length; j$ < len1$; ++j$) {
i = j$;
p = ref$[j$];
if (p === "BREAK") {
parts2.push({
'break': true
});
} else if (p === "BOLD") {
bold = !bold;
} else if (p === "ITALIC") {
italic = !italic;
} else if (p === "UNDERLINE") {
underline = !underline;
} else if (p === "SUPERSCRIPT") {
superscript = !superscript;
} else if (p === "SUBSCRIPT") {
subscript = !subscript;
} else if (p === "SPACE") {
parts2.push({
space: true,
underline: underline,
markColor: colorTags.markColors[markColor]
});
} else if (_.startsWith(p, "MARK-")) {
markColor = markColor
? undefined
: p.split("MARK-")[1];
} else if (_.startsWith(p, "TEXT-")) {
textColor = textColor
? undefined
: p.split("TEXT-")[1];
} else if (p.length > 0) {
parts2.push({
word: p,
bold: bold,
italic: italic,
underline: underline,
superscript: superscript,
subscript: subscript,
markColor: colorTags.markColors[markColor],
textColor: colorTags.textColors[textColor]
});
}
}
}
}
return parts2;
};
})();
shared/convertPlusPlusArray/convert.ls
(function(){
return function(a){
var defaultCorrect, choices, p, s;
defaultCorrect = !_.includes(a.join(","), "++");
return choices = (function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = a).length; i$ < len$; ++i$) {
p = ref$[i$];
s = _.replace(p, "++ ", "++");
if (s.substring(0, 2) === "++") {
results$.push({
text: s.substring(2),
correct: true
});
} else if (s.substring(0, 2) === "--") {
results$.push({
text: s.substring(2),
correct: false
});
} else {
results$.push({
text: s,
correct: defaultCorrect
});
}
}
return results$;
}());
};
})();
shared/convertPlusPlusString/convert.ls
(function(){
return function(s){
var parts, res$, i$, ref$, len$, p, defaultCorrect, choices;
s = s.trim();
s = _.replaceAll(s, "<", "<");
s = _.replaceAll(s, ">", ">");
res$ = [];
for (i$ = 0, len$ = (ref$ = s.split(" ")).length; i$ < len$; ++i$) {
p = ref$[i$];
if (_.includes(p, ")/;
newPart = "";
for (i$ = 0, len$ = (ref$ = p.split(re)).length; i$ < len$; ++i$) {
t = ref$[i$];
if (_.startsWith(t, " 20) {
debug("Error, you're trying to prepare " + gapSolutions.length + " sounds at once! uniqueSolutions + soundMode b is limited to 20 sounds. Please disable sound / use custom sound / decrease the number of uniqueSolutions", o.text);
gapSolutions = gapSolutions.slice(0, 20);
}
solutions2 = [];
for (j$ = 0, len1$ = gapSolutions.length; j$ < len1$; ++j$) {
sol = gapSolutions[j$];
for (k$ = 0, len2$ = solutions.length; k$ < len2$; ++k$) {
s = solutions[k$];
solutions2.push(s + sol);
}
}
solutions = solutions2;
}
return solutions;
};
})();
shared/gapComponent/calcGapStringSolutions/gapTextSolutions/solutions.ls
(function(){
return function(o, part){
var parts, solutions, i$, len$, p, j$, len1$, i, solutions2, choices, ref$, c, k$, len2$, s;
parts = inc("/shared/convertGapString/convert")(part.text);
solutions = [""];
for (i$ = 0, len$ = parts.length; i$ < len$; ++i$) {
p = parts[i$];
if (p.space) {
for (j$ = 0, len1$ = solutions.length; j$ < len1$; ++j$) {
i = j$;
solutions[i] += " ";
}
} else if (p.word) {
for (j$ = 0, len1$ = solutions.length; j$ < len1$; ++j$) {
i = j$;
solutions[i] += p.word;
}
} else if (p['break']) {
for (j$ = 0, len1$ = solutions.length; j$ < len1$; ++j$) {
i = j$;
solutions[i] += " ";
}
} else if (p.gap) {
solutions2 = [];
choices = inc("/shared/convertPlusPlusString/convert")(p.gap);
for (j$ = 0, len1$ = (ref$ = _.filter(choices, {
correct: true
})).length; j$ < len1$; ++j$) {
c = ref$[j$];
for (k$ = 0, len2$ = solutions.length; k$ < len2$; ++k$) {
s = solutions[k$];
solutions2.push(s + c.text);
}
}
solutions = solutions2;
}
}
return solutions;
};
})();
shared/gapComponent/calcGapStringSolutions/mathDivSolutions/solutions.ls
(function(){
return function(o, part){
return MathDiv2({
value: part.text
}).calcGapStringSolutions();
};
})();
shared/gapComponent/calcTotalGaps/calc.ls
(function(){
return function(b){
var totalMath, totalText, total;
totalMath = (b != null ? b.split(//).length : void 8) - 1 || 0;
totalText = (b != null ? b.split("((").length : void 8) - 1 || 0;
return total = totalMath + totalText;
};
})();
shared/gapComponent/component/calcTextParts/calc.ls
(function(){
return function(text){
var re, parts, i$, ref$, len$, t;
re = /()/;
parts = [];
for (i$ = 0, len$ = (ref$ = text.split(re)).length; i$ < len$; ++i$) {
t = ref$[i$];
if (t.trim() === "") {
continue;
}
if (t.indexOf("", ""]).length; j$ < len$; ++j$) {
s = ref$[j$];
if (_.includes(t2, s)) {
t2 = t2.split(s)[0];
}
}
p1.text = t1.split("")[0] + ("`" + t2 + "`") + "";
p2.text = p2.text.slice(t2.length);
hasChanged = true;
}
}
if (hasChanged) {
parts = _.filter(parts, function(part){
return part.text !== "";
});
}
return parts;
};
})();
shared/gapComponent/component/component.ls
(function(){
return function(o){
var gapComponent;
if (!o.mode) {
debug("Error: You must specify a gapMode to use this trainer");
}
o.textParts = inc("calcTextParts/calc")(o.text);
gapComponent = o.textParts.length > 1 && _.find(o.textParts, {
type: "mathDiv"
})
? inc("mixed/mixed")(o)
: o.text.trim().indexOf("?@\[\]^_`{|}~]/g;
return s.replace(punctRegex, "");
};
})();
shared/gapComponent/component/gapText/gapText/createParts/_shared/getMatchingCorrectChoice/get.ls
(function(){
return function(o, value){
var clean, gaps, that, usedUniqueSolutions, g, correctChoices, correctChoice;
clean = inc("../_cleanString/clean")(o);
gaps = (that = o.gap.closest(".mixed"))
? that.gaps()
: o.gaps;
usedUniqueSolutions = o.uniqueSolutions && _.filter(o.choices, {
correct: true
}).length > 1
? (function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = gaps).length; i$ < len$; ++i$) {
g = ref$[i$];
if (g.gapIsCompleted === true && _.filter(g.choices, {
correct: true
}).length > 1) {
results$.push(clean(g.correctValue || g.getValue()));
} else {
continue;
}
}
return results$;
}())
: [];
correctChoices = _.filter(o.choices, function(c){
return c.correct && !_.includes(usedUniqueSolutions, clean(c.text));
});
return correctChoice = _.find(correctChoices, function(c){
return clean(c.text) === value;
}) || correctChoices[0];
};
})();
shared/gapComponent/component/gapText/gapText/createParts/appendAndCombine/appendAndCombine.ls
(function(){
return function(div, element, lastElement, lastP, p){
var combiner;
if ((p.gap && (lastP != null && lastP.word)) || (p.word && (lastP != null && lastP.gap)) || (p.word && (lastP != null && lastP.word)) || (p.space && (lastP != null && lastP.word))) {
combiner = inc("combiner/combiner")();
lastElement.wrap(combiner);
return lastElement.after(element);
} else {
return div.append(element);
}
};
})();
shared/gapComponent/component/gapText/gapText/createParts/appendAndCombine/combiner/combiner.ls
(function(){
return function(){
return Div({
display: "inline-block",
whiteSpace: "nowrap",
lineHeight: "inherit"
});
};
})();
shared/gapComponent/component/gapText/gapText/createParts/break/break.ls
(function(){
return function(s){
return "
";
};
})();
shared/gapComponent/component/gapText/gapText/createParts/calcGapParams/calc.ls
(function(){
return function(o, p){
var gapLength, params;
gapLength = _.isArray(o.gapLength)
? o.gapLength[p.gapIndex]
: o.gapLength;
params = {
slide: o.slide,
text: p.gap,
mode: o.mode,
onGapResult: o.onGapResult,
onStart: o.onStart,
gaps: o.gaps,
gapAlign: o.gapAlign,
gapLength: gapLength,
gapIndex: p.gapIndex,
onSubmitCustom: o.onSubmitCustom,
onActionCorrect: o.onActionCorrect,
onActionMistake: o.onActionMistake,
onActionResolved: o.onActionResolved,
onActionTrainMistake: o.onActionTrainMistake,
trainAttempts: o.trainAttempts,
inputEditable: o.inputEditable,
tagIndex: o.tagIndex,
totalGaps: o.totalGaps,
uniqueSolutions: o.uniqueSolutions,
learnListMode: o.learnListMode
};
if (o.mode === "write") {
params.ignoreCase = o.ignoreCase;
params.ignoreAccents = o.ignoreAccents;
params.keyboardLayout = o.keyboardLayout;
params.keyboardSpecialKeys = o.keyboardSpecialKeys;
} else if (o.mode === "buttons") {
params.buttonsDiv = o.buttonsDiv;
params.combineButtons = o.combineButtons;
params.removeCorrectButton = o.removeCorrectButton;
params.shuffleButtons = o.shuffleButtons;
params.trueFalseMode = o.trueFalseMode;
params.trueButtonLabel = o.trueButtonLabel;
params.falseButtonLabel = o.falseButtonLabel;
}
return params;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/create.ls
(function(){
return function(div, o){
var i$, ref$, len$, part, element, params, gap, lastPart, lastElement, results$ = [];
for (i$ = 0, len$ = (ref$ = o.parts).length; i$ < len$; ++i$) {
part = ref$[i$];
element = part.gap
? (params = inc("calcGapParams/calc")(o, part), gap = o.mode === "write"
? inc("gapWrite/gapWrite")(params)
: o.mode === "buttons" ? inc("gapButtons/gapButtons")(params) : void 8, o.gaps.push(gap), gap)
: part.space
? inc("space/space")(part)
: part['break']
? inc("break/break")()
: inc("word/word")(part, o);
inc("appendAndCombine/appendAndCombine")(div, element, lastElement, lastPart, part);
if (typeof element.css == 'function') {
element.css({
fontWeight: part.bold ? "bold" : void 8,
fontStyle: part.italic ? "italic" : void 8
});
}
lastPart = part;
results$.push(lastElement = element);
}
return results$;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/cursor/cursor.ls
(function(){
return function(){
var interval, onInterval, start, stop, div;
onInterval = function(){
if (!div.isVisible()) {
clearInterval(interval);
interval = null;
}
return div.css({
visibility: div.css("visibility") === "hidden" ? "visible" : "hidden"
});
};
start = function(){
clearInterval(interval);
interval = setInterval(onInterval, 500);
return div.show();
};
stop = function(){
clearInterval(interval);
interval = null;
return div.hide();
};
div = Div({
position: "absolute",
height: "2px",
width: "100%",
bottom: "-1px",
left: 0,
backgroundColor: Color.grey[500]
}).addClass("cursor").hide();
div.start = start;
div.stop = stop;
return div;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/fixedLength/div.ls
(function(){
return function(o){
var lengthDiv, i;
return lengthDiv = Div({
height: 0,
overflow: "hidden"
}).append((function(){
var i$, to$, results$ = [];
for (i$ = 1, to$ = o.gapLength; i$ <= to$; ++i$) {
i = i$;
results$.push("0");
}
return results$;
}()));
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/gapButtons.ls
(function(){
return function(o){
var startGap, submitGap, stopGap, getValue, click, gap;
o.choices = inc("../../calcChoices/calc")(o);
if (_.filter(o.choices, {
correct: true
}).length === 0) {
debug("Warning: please specify at least one correct choice in " + o.text + "!");
}
o.result = {
isDone: false
};
o.cursor = inc("cursor/cursor")(o);
startGap = function(){
var ref$, i$, ref1$, len$, b;
o.slide.gapClickStartDisabled = false;
if ((ref$ = o.buttonsDiv) != null) {
ref$.show();
}
o.slide.levelPlayer.currentGap = gap;
o.buttonsDiv.css({
pointerEvents: ""
});
for (i$ = 0, len$ = (ref1$ = o.buttonsDiv.childrenAll()).length; i$ < len$; ++i$) {
b = ref1$[i$];
if (b.isVisible()) {
b.css({
pointerEvents: ""
});
}
}
inc("showButtons/show")(gap, o);
if (typeof o.onStart == 'function') {
o.onStart();
}
return o.cursor.start();
};
submitGap = function(button){
o.slide.gapClickStartDisabled = true;
return inc("submit/submit")(o, button, function(){
return o.onGapResult(o.gap);
});
};
stopGap = function(){
var ref$;
if ((ref$ = o.buttonsDiv) != null) {
ref$.hide();
}
o.cursor.stop();
return o.slide.levelPlayer.currentGap = undefined;
};
getValue = function(){
return gap.correctValue;
};
click = function(){
var currentGap;
if (gap.css("pointerEvents") === "none") {
return;
}
currentGap = o.slide.levelPlayer.currentGap;
if (currentGap === gap || o.result.isDone) {
return;
}
if (o.slide.gapClickStartDisabled) {
return;
}
if (currentGap != null) {
currentGap.stopGap();
}
return startGap();
};
gap = Div({
display: "inline-block",
backgroundColor: Color.grey[100],
lineHeight: "inherit",
whiteSpace: "pre",
padding: "0.1em 0.2em 0.1em 0.1em",
margin: "0.14em 0",
borderBottom: "2px solid transparent",
cursor: "pointer",
textAlign: o.gapAlign || "center"
}).addClass("gapButton").addClass("gap gap" + o.gapIndex).tap({
up: click,
animation: "none"
});
inc("setMinWidth/set")(o, gap);
gap.append(inc("fixedLength/div")(o), gap.contentSpan = Span().html(" "), gap.tagIndex = inc("tagIndex/tagIndex")(o), o.cursor);
if (o.gapLength) {
gap.css({
minWidth: "",
width: "",
paddingLeft: 0,
paddingRight: 0
});
}
o.gap = gap;
gap.click = click;
gap.gaps = o.gaps;
gap.choices = o.choices;
gap.gapIsCompleted = false;
gap.submitGap = submitGap;
gap.startGap = startGap;
gap.stopGap = stopGap;
gap.getValue = getValue;
gap.result = function(){
return o.result;
};
return gap;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/setMinWidth/set.ls
(function(){
return function(o, gap){
var dummy, choices, res$, i$, ref$, len$, c, mean, min, minWidth;
dummy = Div({
position: "fixed",
top: 0,
bottom: 0,
left: "-1000px",
right: 0,
visibility: "hidden"
}).appendTo(body);
res$ = [];
for (i$ = 0, len$ = (ref$ = o.choices).length; i$ < len$; ++i$) {
c = ref$[i$];
res$.push(Span().html(c.text).appendTo(dummy));
}
choices = res$;
mean = _.mean(_.map(choices, function(c){
return c.width();
}));
min = inc("/../app01/lib/util/emToPx/emToPx")(2);
minWidth = Math.max(min, mean);
dummy.remove();
return gap.css({
minWidth: minWidth + "px"
});
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/showButtons/button/button.ls
(function(){
return function(o, choice, i){
var click, div;
click = function(){
var ref$;
o.buttonsDiv.css({
pointerEvents: "none"
});
return (ref$ = o.slide.levelPlayer.currentGap) != null ? ref$.submitGap(div) : void 8;
};
div = Button({
label: choice.text,
labelAllowWrap: true,
action: click,
icon: (choice != null ? choice.icon : void 8) === "correct"
? path("/../app01/lib/svg/icon/checkmark.svg")
: (choice != null ? choice.icon : void 8) === "wrong" ? path("/../app01/lib/svg/icon/close.svg") : void 8
}).css({
margin: "0.5em"
});
div.value = choice.text;
return div;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/showButtons/calcChoices/calc.ls
(function(){
return function(o, choices){
var choices2, i$, len$, choice;
choices2 = [];
for (i$ = 0, len$ = choices.length; i$ < len$; ++i$) {
choice = choices[i$];
if (choice.text === "" && !choice.icon) {
choice.text = " ";
}
choices2.push(choice);
}
if (!o.removeCorrectButton) {
choices2 = _.uniqBy(_.map(choices2, function(c){
return _.omit(c, "correct");
}), "text");
}
if (o.shuffleButtons && !o.trueFalseMode) {
choices2 = _.shuffleWithSeed(choices2);
}
return choices2;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/showButtons/combineChoices/combine.ls
(function(){
return function(o){
var choices, uniqueChoices, i$, ref$, len$, gapButton, j$, ref1$, len1$, choice, otherChoices;
choices = [];
uniqueChoices = [];
for (i$ = 0, len$ = (ref$ = o.slide.div.findAll(".gapButton")).length; i$ < len$; ++i$) {
gapButton = ref$[i$];
for (j$ = 0, len1$ = (ref1$ = gapButton.choices).length; j$ < len1$; ++j$) {
choice = ref1$[j$];
if (!o.uniqueSolutions || _.filter(gapButton.choices, fn$).length < 2) {
choices.push(choice);
continue;
}
otherChoices = _.flatMap(_.filter(gapButton.gaps, fn1$), fn2$);
if (otherChoices.some(fn3$) && uniqueChoices.some(fn4$)) {
uniqueChoices.push(choice);
} else {
uniqueChoices.push(choice);
choices.push(choice);
}
}
}
return choices;
function fn$(c){
return c.correct === true;
}
function fn1$(g){
return g !== gapButton;
}
function fn2$(g){
return g.choices;
}
function fn3$(c){
return _.isEqual(c, choice);
}
function fn4$(c){
return _.isEqual(c, choice);
}
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/showButtons/show.ls
(function(){
return function(gap, o){
var div, choices, i, choice;
div = o.buttonsDiv;
if (o.combineButtons && div.childrenAll().length > 0) {
return;
}
choices = o.combineButtons
? inc("combineChoices/combine")(o)
: gap.choices;
choices = inc("calcChoices/calc")(o, choices);
return div.html((function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = choices).length; i$ < len$; ++i$) {
i = i$;
choice = ref$[i$];
results$.push(inc("button/button")(o, choice, i));
}
return results$;
}())).hide().fadeIn();
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/submit/onCorrect/colorizeGap/colorize.ls
(function(){
return function(gap){
var ref$;
gap.css({
color: Color.green[500],
cursor: "default"
});
return (ref$ = gap.findFirst(".icon")) != null ? ref$.setColor(Color.green[500]) : void 8;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/submit/onCorrect/on.ls
(function(){
return function(o, button, callback){
var gap;
gap = o.gap;
gap.gapIsCompleted = true;
o.result.isDone = true;
button.setState("correct");
inc("colorizeGap/colorize")(gap);
o.slide.levelPlayer.progressBar.showGreen();
return inc("onActionCorrect/on")(o, button, callback);
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/submit/onCorrect/onActionCorrect/on.ls
(function(){
return function(o, button, callback){
var action;
action = {
gap: o.gapIndex,
button: button.value
};
return o.onActionCorrect(action, function(){
return setTimeout(function(){
if (o.removeCorrectButton) {
button.css({
visibility: "hidden"
});
} else {
button.setState("normal");
button.css({
pointerEvents: "none"
});
}
return callback();
}, 500);
});
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/submit/onWrong/on.ls
(function(){
return function(o, button){
var gap, ref$;
gap = o.gap;
button.setState("wrong");
gap.css({
color: Color.red[500]
});
if ((ref$ = gap.findFirst(".icon")) != null) {
ref$.setColor(Color.red[500]);
}
o.slide.levelPlayer.progressBar.addElement().showRed();
if (typeof o.onActionMistake == 'function') {
o.onActionMistake({
gap: o.gapIndex,
button: button.value,
text: gap.getValue(),
solution: gap.correctValue
});
}
return setTimeout(function(){
o.slide.gapClickStartDisabled = false;
button.setState("normal");
o.buttonsDiv.css({
pointerEvents: ""
});
gap.css({
color: "black",
minWidth: gap.defaultMinWidth,
padding: gap.defaultPadding,
textAlign: o.gapAlign || "center"
});
gap.contentSpan.html(" ");
return o.cursor.start();
}, 500);
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/submit/showValue/show.ls
(function(){
return function(o, button){
var gap, value, that;
gap = o.gap;
value = button.value;
gap.contentSpan.html((that = button.icon) ? Svg({
svg: that.outerHtml()
}).css({
verticalAlign: "-0.1em",
marginRight: "0.2em"
}).addClass("icon") : void 8, value);
gap.defaultPadding = gap.css("padding");
gap.defaultMinWidth = gap.css("minWidth");
return gap.css({
paddingLeft: "",
paddingRight: "",
minWidth: ""
});
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/submit/submit.ls
(function(){
return function(o, button, callback){
var value, correctChoice;
value = button.value;
correctChoice = inc("../../_shared/getMatchingCorrectChoice/get")(o, value);
o.gap.correctValue = correctChoice.text;
o.cursor.stop();
inc("showValue/show")(o, button);
if (correctChoice.text === value) {
return inc("onCorrect/on")(o, button, callback);
} else {
return inc("onWrong/on")(o, button);
}
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapButtons/tagIndex/tagIndex.ls
(function(){
return function(o){
if (o.tagIndex == null) {
return;
}
return Div({
position: "absolute",
top: "-12px",
left: "-8px",
fontSize: "0.7em",
backgroundColor: Color.yellow[200],
padding: "0.2em",
pointerEvents: "none",
boxShadow: '0px 0px 2px #bbb'
}).html(o.tagIndex === -1
? o.gapIndex + 1
: o.totalGaps === 1
? o.tagIndex + 1
: (o.tagIndex + 1) + "." + (o.gapIndex + 1));
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/gap/calcMaxChars/calc.ls
(function(){
return function(o){
var that, max, i$, ref$, len$, c, maxChars;
if (that = o.maxChars) {
return that;
}
max = 0;
for (i$ = 0, len$ = (ref$ = o.choices).length; i$ < len$; ++i$) {
c = ref$[i$];
max = Math.max(c.text.length + 5, max);
}
return maxChars = Math.max(35, max);
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/gap/calcSpecialKeys/calc.ls
(function(){
return function(o){
var layout, template, keyboardKeys, keyboardKeysFlat, hasShiftKey, i$, len$, key, specialKeys, ref$, choice, j$, ref1$, len1$, char, c;
layout = o.keyboardLayout === "standardGuiLanguage"
? twitch({
de: "standardSlimDE",
en: "standardSlimEN",
fr: "standardSlimFR",
es: "standardSlimES",
pt: "standardSlimPT"
})
: o.keyboardLayout;
template = inc("/../app01/lib/gui/screenKeyboard/_templates/templates")[layout];
keyboardKeys = template != null ? template.main.join("|").split("|") : void 8;
if (!keyboardKeys) {
return;
}
keyboardKeysFlat = [];
hasShiftKey = false;
for (i$ = 0, len$ = keyboardKeys.length; i$ < len$; ++i$) {
key = keyboardKeys[i$];
if (_.startsWith(key, "shift")) {
hasShiftKey = true;
}
if (!key.match(/^.+?\[.+?\]$/)) {
keyboardKeysFlat.push(key[0]);
}
}
keyboardKeysFlat.push(" ");
specialKeys = [];
for (i$ = 0, len$ = (ref$ = o.choices).length; i$ < len$; ++i$) {
choice = ref$[i$];
for (j$ = 0, len1$ = (ref1$ = Array.from(choice.text)).length; j$ < len1$; ++j$) {
char = ref1$[j$];
c = hasShiftKey ? char.toLowerCase() : char;
if (!in$(c, keyboardKeysFlat)) {
specialKeys.push(char);
}
}
}
if (specialKeys.length > 0) {
return o.keyboardSpecialKeys = specialKeys.sort().join(" ");
}
};
})();
function in$(x, xs){
var i = -1, l = xs.length >>> 0;
while (++i < l) if (x === xs[i]) return true;
return false;
}
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/gap/gap.ls
(function(){
return function(o, click, submitGap){
var maxChars, f, div;
maxChars = inc("calcMaxChars/calc")(o);
inc("calcSpecialKeys/calc")(o);
f = o.inputEditable
? inc("/../app01/lib/gui/inputEditable/input")
: inc("/../app01/lib/gui/input2/input");
div = f({
keyboardHeader: o.keyboardSpecialKeys ? inc("keyboardHeader/header")(o) : void 8,
keyboardLayout: o.keyboardLayout,
maxLength: maxChars,
onSubmit: submitGap,
textAlign: o.gapAlign || "center",
fixedLength: o.gapLength,
enabled: false,
lineHeight: "1.4em",
linePadding: "0.2em 0.7em 0.2em 0.2em",
lineWrapping: true
}).addClass("gap gap" + o.gapIndex).append(inc("../../gapButtons/tagIndex/tagIndex")(o)).tap({
up: click,
animation: "none"
}).css({
minWidth: "1.5em",
margin: "0.14em 0",
cursor: "pointer",
padding: !o.inputEditable ? "0.2em 0.7em 0.2em 0.2em" : void 8
});
if (o.gapLength) {
div.css({
minWidth: "",
width: "",
paddingLeft: 0,
paddingRight: 0
});
}
return div;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/gap/keyboardHeader/header.ls
(function(){
return function(o){
return function(screenKeyboard){
return Div({
display: "flex",
minHeight: "2.5em",
alignItems: "stretch",
padding: "4px"
}).addClass("keyboardHeader").html(inc("specialKeys/specialKeys")(o, screenKeyboard));
};
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/gap/keyboardHeader/specialKeys/key/key.ls
(function(){
return function(screenKeyboard, key){
return Div({
display: "flex",
padding: "0.3em 0.4em",
flex: "0 0 auto",
minWidth: "2.5em"
}).html(Div({
flex: "1 1 auto",
whiteSpace: "nowrap",
textAlign: "center",
overflow: "hidden",
textOverflow: "ellipsis",
display: "flex",
paddingTop: "0.1em"
}).html(key)).tap(function(){
return screenKeyboard.onKey(key);
});
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/gap/keyboardHeader/specialKeys/specialKeys.ls
(function(){
return function(o, screenKeyboard){
var keys, div, key;
keys = o.keyboardSpecialKeys.trim();
keys = keys.replace(/\s{2,}/g, " ");
keys = _.uniq(keys.split(" "));
return div = Div({
display: "flex",
justifyContent: "flex-start",
flex: "1 1 auto",
flexWrap: "wrap"
}).append((function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = keys).length; i$ < len$; ++i$) {
key = ref$[i$];
results$.push(inc("key/key")(screenKeyboard, key));
}
return results$;
}()));
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/gapWrite.ls
(function(){
return function(o){
var startGap, submitGap, stopGap, click, gap;
o.choices = inc("../../calcChoices/calc")(o);
if (_.filter(o.choices, {
correct: true
}).length === 0) {
debug("Warning: Please specify at least one correct choice in " + o.text + "!");
}
o.result = {
isDone: false
};
startGap = function(){
o.slide.gapClickStartDisabled = false;
gap.enable();
gap.start();
gap.css({
cursor: "text"
});
if (typeof o.onStart == 'function') {
o.onStart();
}
return o.slide.levelPlayer.currentGap = gap;
};
submitGap = function(){
if (o.gap.getValue() === "" && !o.learnListMode) {
return;
}
o.slide.gapClickStartDisabled = true;
gap.disable();
return inc("submit/submit")(o, function(){
return o.onGapResult(gap);
});
};
stopGap = function(){
gap.stop();
gap.disable();
o.slide.levelPlayer.currentGap = undefined;
if (!o.result.isDone) {
return gap.css({
cursor: "pointer"
});
}
};
click = function(){
var currentGap;
currentGap = o.slide.levelPlayer.currentGap;
if (currentGap === gap || o.result.isDone) {
return;
}
if (o.slide.gapClickStartDisabled) {
return;
}
if (currentGap != null) {
currentGap.stopGap();
}
return startGap();
};
gap = inc("gap/gap")(o, click, submitGap);
o.gap = gap;
gap.click = click;
gap.startGap = startGap;
gap.stopGap = stopGap;
gap.submitGap = submitGap;
gap.result = function(){
return o.result;
};
gap.choices = o.choices;
gap.gapIsCompleted = false;
return gap;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/compareValues/calcCombinations/calc.ls
(function(){
return function(array){
var calc;
calc = function(active, rest, a){
var a1, a2;
if (!(active != null && active.length) && !(rest != null && rest.length)) {
return;
}
if (!(rest != null && rest.length)) {
a.push(active);
} else {
a1 = active.slice();
a2 = active.slice();
a1.push(rest[0]);
calc(a1, rest.slice(1), a);
calc(a2, rest.slice(1), a);
}
return a;
};
return _.sortBy(calc([], array, []));
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/compareValues/compare.ls
(function(){
return function(o, value, valueSol){
var removePunctuation, isCorrect, checks, checkCombos, i$, len$, combo, cs1, cs2, j$, len1$, c;
removePunctuation = inc("../../../_shared/_removePunctuation/remove");
isCorrect = value === valueSol;
if (isCorrect) {
return {
isCorrect: isCorrect
};
}
if (!o.learnListMode) {
return {
isCorrect: false
};
}
checks = [
{
type: "ascii",
fn: function(s){
return _.deburr(s);
}
}, {
type: "lower",
fn: function(s){
return s.toLowerCase();
}
}, {
type: "punct",
fn: function(s){
return removePunctuation(s);
}
}
];
checkCombos = inc("calcCombinations/calc")(checks);
for (i$ = 0, len$ = checkCombos.length; i$ < len$; ++i$) {
combo = checkCombos[i$];
cs1 = value.slice();
cs2 = valueSol.slice();
for (j$ = 0, len1$ = combo.length; j$ < len1$; ++j$) {
c = combo[j$];
cs1 = c.fn(cs1);
cs2 = c.fn(cs2);
}
if (cs1 === cs2) {
return {
isHalfCorrect: true,
reason: _.map(combo, "type").join("-")
};
}
}
return {
isCorrect: false
};
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/onCorrect/on.ls
(function(){
return function(o, callback){
var gap;
gap = o.gap;
inc("styleCorrectGap/style")(gap);
o.slide.levelPlayer.progressBar.showGreen();
gap.setValue(gap.correctValue);
o.result.isDone = true;
gap.gapIsCompleted = true;
return inc("onActionCorrect/on")(o, gap, callback);
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/onCorrect/onActionCorrect/on.ls
(function(){
return function(o, gap, callback){
var action;
action = {
gap: o.gapIndex,
text: gap.correctValue
};
return o.onActionCorrect(action, callback);
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/onCorrect/styleCorrectGap/style.ls
(function(){
return function(gap){
return gap.css({
paddingLeft: "",
paddingRight: "",
minWidth: "",
color: Color.green[500],
cursor: "default"
});
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/onWrong/_hintMistake/feedbackTextAbove/text.ls
(function(){
return function(o){
var wrongText, correctText;
o.gap.css({
fontSize: "0.9em",
lineHeight: "1em",
verticalAlign: "middle"
});
wrongText = Span().css({
textDecoration: "line-through",
color: Color.red[500]
}).secureHtml(o.gap.getValue() || " ");
correctText = Span().css({
color: Color.grey[550]
}).secureHtml(o.gap.correctValue || " ");
return Div({
display: "inline-block",
lineHeight: "1em"
}).append(correctText, "
", wrongText);
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/onWrong/_hintMistake/feedbackTextSide/text.ls
(function(){
return function(o){
var value, wrongText, solution, correctText;
value = o.gap.getValue();
if (value.trim() === "") {
wrongText = Span().css({
borderBottom: "2px solid " + Color.red[500]
}).html(" ");
} else {
wrongText = Span().css({
textDecoration: "line-through",
color: Color.red[500]
}).secureHtml(value || " ");
}
solution = o.gap.correctValue;
correctText = Span().css({
color: Color.grey[550]
}).secureHtml(solution || " ");
return Span().append(wrongText, " ", correctText);
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/onWrong/_hintMistake/hint.ls
(function(){
return function(o, cb){
var callback, isDone, retry, solve, onSolveDone, html, div;
callback = function(){
o.slide.div.css({
pointerEvents: ""
});
return cb();
};
isDone = false;
retry = function(){
isDone = true;
o.slide.gapClickStartDisabled = false;
o.gap.enable();
o.gap.css({
color: "black"
});
o.gap.start();
o.gap.selectAll();
return o.slide.levelPlayer.currentGap = o.gap;
};
solve = function(){
var feedbackText;
o.slide.levelPlayer.progressBar.showGrey();
if (typeof o.onActionResolved == 'function') {
o.onActionResolved({
gap: o.gapIndex,
solution: o.gap.correctValue
});
}
isDone = true;
feedbackText = _.some(["lsg", "table"], function(t){
return _.startsWith(o.slide.trainerParams.trainer, t);
})
? inc("feedbackTextAbove/text")(o)
: inc("feedbackTextSide/text")(o);
o.gap.html(feedbackText).css({
paddingRight: "0em",
paddingLeft: "0em",
minWidth: "",
width: ""
});
o.result.isDone = true;
o.gap.gapIsCompleted = true;
o.slide.div.css({
pointerEvents: "none"
});
return setTimeout(onSolveDone, 500);
};
onSolveDone = function(){
var gaps, nextGap;
gaps = o.slide.div.findAll(".gap");
nextGap = _.find(gaps, {
gapIsCompleted: false
});
if (!nextGap && !o.slide.finishButton) {
o.slide.finishButton = true;
}
return callback();
};
html = Div({
padding: "0.3em",
textAlign: "center"
}).html(Div().html(T("solutionWrong")), Div({
margin: "0.7em 0 0.4em"
}).html(Button({
label: T("tryAgain"),
icon: path("/../app01/lib/svg/icon/refresh.svg")
}).tap(function(){
return div.close("retry");
}).css({
marginRight: "0.8em"
}), Button({
label: T("solveButton"),
icon: path("/../app01/lib/svg/icon/lock-open.svg")
}).tap(function(){
return div.close("solve");
})));
div = inc("/shared/topMessage/topMessage")({
html: html,
onClose: function(type){
if (type === "solve") {
return solve();
} else {
return retry();
}
}
}).addClass("hint").addClass("gapWriteMistakeHint");
div.isDone = function(){
return isDone;
};
div.solveAndContinue = solve;
div.retryAndContinue = retry;
return div;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/onWrong/on.ls
(function(){
return function(o, callback){
var gap;
gap = o.gap;
gap.css({
color: Color.red[500],
cursor: "default"
});
o.slide.levelPlayer.progressBar.addElement().showRed();
inc("_hintMistake/hint")(o, callback);
return typeof o.onActionMistake == 'function' ? o.onActionMistake({
gap: o.gapIndex,
text: gap.getValue(),
solution: gap.correctValue
}) : void 8;
};
})();
shared/gapComponent/component/gapText/gapText/createParts/gapWrite/submit/submit.ls
(function(){
return function(o, callback){
var clean, valueClean, correctChoice, correctChoiceClean, compareResult, that;
clean = inc("../../_shared/_cleanString/clean")(o);
valueClean = clean(o.gap.getValue());
correctChoice = inc("../../_shared/getMatchingCorrectChoice/get")(o, valueClean);
correctChoiceClean = clean(correctChoice.text);
o.gap.stop();
o.gap.correctValue = correctChoice.text;
compareResult = inc("compareValues/compare")(o, valueClean, correctChoiceClean);
if (that = o.onSubmitCustom) {
return that(o, compareResult, callback);
} else if (compareResult.isCorrect) {
return inc("onCorrect/on")(o, callback);
} else {
return inc("onWrong/on")(o, callback);
}
};
})();
shared/gapComponent/component/gapText/gapText/createParts/space/space.ls
(function(){
return function(part, o){
return Div({
display: "inline-block",
lineHeight: "inherit",
borderBottom: "2px solid transparent",
padding: "0.2em 0 0.1em",
margin: "0.14em 0",
pointerEvents: "none"
}).append(Div({
height: "0"
}), Div({
display: "inline-block",
textDecoration: part.underline ? "underline" : void 8,
backgroundColor: part.markColor,
zIndex: 0
}).html(" "));
};
})();
shared/gapComponent/component/gapText/gapText/createParts/word/word.ls
(function(){
return function(part, o){
var s;
s = part.word;
return Div({
display: "inline-block",
lineHeight: "inherit",
borderBottom: "2px solid transparent",
padding: "0.2em 0 0.1em",
margin: "0.14em 0",
pointerEvents: "none"
}).append(Div({
height: "0"
}), Div({
display: "inline-block",
textDecoration: part.underline ? "underline" : void 8,
backgroundColor: part.markColor,
color: part.textColor,
zIndex: 1
}).secureHtml(part.superscript
? "" + part.word + ""
: part.subscript
? "" + part.word + ""
: part.word));
};
})();
shared/gapComponent/component/gapText/gapText/gapText.ls
(function(){
return function(o){
var isDone, start, stop, finish, div;
o.mode == null && (o.mode = "write");
o.gaps = [];
o.parts = inc("/shared/convertGapString/convert")(o.text);
o.totalGaps = _.filter(o.parts, function(p){
return p.gap;
}).length;
isDone = o.totalGaps === 0;
start = function(){
var i$, ref$, len$, g, results$ = [];
if (app.currentPage.levelPlayer == null) {
return;
}
if (o.totalGaps === 0) {
o.onFinish();
return;
}
for (i$ = 0, len$ = (ref$ = o.gaps).length; i$ < len$; ++i$) {
g = ref$[i$];
if (!g.result().isDone) {
g.startGap();
break;
}
}
return results$;
};
stop = function(){
var i$, ref$, len$, g, results$ = [];
for (i$ = 0, len$ = (ref$ = o.gaps).length; i$ < len$; ++i$) {
g = ref$[i$];
results$.push(g.stopGap());
}
return results$;
};
finish = function(){
var result;
result = {
correctValue: o.correctValue
};
return o.onFinish(result);
};
o.onGapResult = function(gap){
var i$, ref$, len$, g, nextGap;
for (i$ = 0, len$ = (ref$ = o.gaps).length; i$ < len$; ++i$) {
g = ref$[i$];
if (!g.result().isDone) {
nextGap = g;
break;
}
}
if (nextGap) {
app.currentPage.scrollElementIntoView(nextGap, {
padding: 50
});
return nextGap.startGap();
} else {
isDone = true;
o.correctValue = inc("calcCorrectValue/calc")(o);
if ((ref$ = o.buttonsDiv) != null) {
ref$.hide();
}
o.slide.levelPlayer.currentGap = undefined;
return finish();
}
};
div = Span().addClass("gapText").css({
lineHeight: "1.4em"
});
inc("createParts/create")(div, o);
div.start = start;
div.stop = stop;
div.gaps = function(){
return o.gaps;
};
div.isDone = function(){
return isDone;
};
div.calcCorrectValue = function(){
return inc("calcCorrectValue/calc")(o);
};
return div;
};
})();
shared/gapComponent/component/mathDiv/mathDiv.ls
(function(){
return function(o){
var p, atom, ref$;
p = o.slide.getParam;
atom = o.atom;
o.gapValidateMode = p("gapValidateMode", atom) || "literal";
o.matLayout = p("matLayout", atom);
o.shuffleButtons = (ref$ = p("shuffleButtons", atom)) != null ? ref$ : true;
o.combineButtons = (ref$ = p("combineButtons", atom)) != null ? ref$ : false;
o.removeCorrectButton = (ref$ = p("removeCorrectButton", atom)) != null ? ref$ : false;
o.uniqueSolutions = (ref$ = p("uniqueSolutions", atom)) != null ? ref$ : false;
return inc("mathDiv/mathDiv")(o);
};
})();
shared/gapComponent/component/mathDiv/mathDiv/mathDiv.ls
(function(){
return function(o){
var ref$, ref1$, ref2$, ref3$, ref4$;
return MathDiv2({
mode: o.mode === "buttons"
? "gapButtons"
: o.mode === "write" ? "gapWrite" : void 8,
buttonsDiv: o.buttonsDiv,
gapValidateMode: o.gapValidateMode,
shuffleButtons: o.shuffleButtons,
combineButtons: o.combineButtons,
removeCorrectButton: o.removeCorrectButton,
uniqueSolutions: o.uniqueSolutions,
enableHorizontalScroll: true,
keyboardLayout: (ref$ = o.matLayout) != null ? ref$.keyboardLayout : void 8,
keyboardShowHeader: (ref1$ = o.matLayout) != null ? ref1$.showKeyboardHeader : void 8,
keyboardHideUndo: (ref2$ = o.matLayout) != null ? ref2$.hideUndo : void 8,
keyboardHideArrows: (ref3$ = o.matLayout) != null ? ref3$.hideArrows : void 8,
keyboardSpecialKeys: (ref4$ = o.matLayout) != null ? ref4$.specialKeys : void 8,
slide: o.slide,
enabled: true,
value: o.text,
onStart: o.onStart,
onFinish: o.onFinish,
onActionCorrect: o.onActionCorrect,
onActionMistake: o.onActionMistake,
onActionResolved: o.onActionResolved
}).css({
maxWidth: "100%",
justifyContent: o.textAlign !== "left" ? "center" : void 8
});
};
})();
shared/gapComponent/component/mixed/calcGaps/calc.ls
(function(){
return function(o){
var allGaps, index, i$, ref$, len$, c, gaps, j$, len1$, g;
allGaps = [];
index = 0;
for (i$ = 0, len$ = (ref$ = o.components).length; i$ < len$; ++i$) {
c = ref$[i$];
if (c.gaps != null) {
gaps = c.gaps();
for (j$ = 0, len1$ = gaps.length; j$ < len1$; ++j$) {
g = gaps[j$];
g.mixedGapIndex = index++;
}
allGaps = _.concat(allGaps, gaps);
}
}
return allGaps;
};
})();
shared/gapComponent/component/mixed/createComponents/_o2/o2.ls
(function(){
return function(part, i, o){
var onAction, o2;
onAction = function(action){
action.mixedGapIndex = o.components[i].gaps()[action.gap].mixedGapIndex;
return action.gap = i + "_" + action.gap;
};
o2 = {
text: part.text,
slide: o.slide,
atom: o.atom,
buttonsDiv: o.buttonsDiv,
mode: o.mode,
type: part.type,
onActionCorrect: function(action, callback){
onAction(action);
return o.onActionCorrect(action, callback);
},
onActionMistake: function(action){
onAction(action);
return o.onActionMistake(action);
},
onActionResolved: function(action){
onAction(action);
return o.onActionResolved(action);
},
onStart: o.onStart
};
o2.onFinish = inc("../../onComponentFinish/onFinish")(o, o2, i);
return o2;
};
})();
shared/gapComponent/component/mixed/createComponents/create.ls
(function(){
return function(o){
var i, part;
return o.components = (function(){
var i$, ref$, len$, ref1$, results$ = [];
for (i$ = 0, len$ = (ref$ = o.textParts).length; i$ < len$; ++i$) {
i = i$;
part = ref$[i$];
if (part.type === "linebreak") {
results$.push(inc("linebreak/break")());
} else if ((ref1$ = part.type) === "gapText" || ref1$ === "text") {
results$.push(inc("gapText/gapText")(part, i, o));
} else if (part.type === "mathDiv") {
results$.push(inc("mathDiv/mathDiv")(part, i, o));
}
}
return results$;
}());
};
})();
shared/gapComponent/component/mixed/createComponents/gapText/gapText.ls
(function(){
return function(part, i, o){
var o2, gapText, i$, ref$, len$, j, gap;
o2 = inc("../_o2/o2")(part, i, o);
gapText = inc("../../../gapText/gapText")(o2);
for (i$ = 0, len$ = (ref$ = gapText.findAll(".gap")).length; i$ < len$; ++i$) {
j = i$;
gap = ref$[i$];
gap.addClass("gap" + i + "_" + j);
}
return gapText;
};
})();
shared/gapComponent/component/mixed/createComponents/linebreak/break.ls
(function(){
return function(){
var div;
div = Div({
height: "0.3em"
});
div.isDone = function(){
return true;
};
return div;
};
})();
shared/gapComponent/component/mixed/createComponents/mathDiv/mathDiv.ls
(function(){
return function(part, i, o){
var o2, mathDiv, i$, ref$, len$, j, gap;
o2 = inc("../_o2/o2")(part, i, o);
mathDiv = inc("../../../mathDiv/mathDiv")(o2);
for (i$ = 0, len$ = (ref$ = mathDiv.findAll(".gap")).length; i$ < len$; ++i$) {
j = i$;
gap = ref$[i$];
gap.addClass("gap" + i + "_" + j);
}
return mathDiv;
};
})();
shared/gapComponent/component/mixed/div/div.ls
(function(){
return function(o){
return Div({
display: "inline-block"
}).addClass("mixed").append(o.components);
};
})();
shared/gapComponent/component/mixed/isDone/isDone.ls
(function(){
return function(o){
var isDone;
return isDone = !_.includes(_.map(o.components, function(c){
return c.isDone();
}), false);
};
})();
shared/gapComponent/component/mixed/mixed.ls
(function(){
return function(o){
o.components = inc("createComponents/create")(o);
o.gaps = inc("calcGaps/calc")(o);
o.div = inc("div/div")(o);
o.div.gaps = function(){
return o.gaps;
};
o.div.start = function(){
return inc("start/start")(o);
};
o.div.isDone = function(){
return inc("isDone/isDone")(o);
};
return o.div;
};
})();
shared/gapComponent/component/mixed/onComponentFinish/onFinish.ls
(function(){
return function(o, o2, i){
return function(result){
var found, i$, ref$, len$, g, nextGap, j, c;
o.correctValues == null && (o.correctValues = []);
o.correctValues[i] = result != null ? result.correctValue : void 8;
found = false;
for (i$ = 0, len$ = (ref$ = o.gaps).length; i$ < len$; ++i$) {
g = ref$[i$];
if (!g.gapIsCompleted) {
found = true;
nextGap = g;
nextGap.startGap();
break;
}
}
if (!found) {
for (i$ = 0, len$ = (ref$ = o.components).length; i$ < len$; ++i$) {
j = i$;
c = ref$[i$];
if ((typeof c.gaps == 'function' ? c.gaps().length : void 8) === 0) {
o.correctValues[j] = c.calcCorrectValue();
}
}
return o.onFinish({
correctValue: o.correctValues.join("")
});
}
};
};
})();
shared/gapComponent/component/mixed/start/start.ls
(function(){
return function(o){
var i$, ref$, len$, g, results$ = [];
if (o.gaps.length === 0) {
o.onFinish();
return;
}
for (i$ = 0, len$ = (ref$ = o.gaps).length; i$ < len$; ++i$) {
g = ref$[i$];
if (!g.gapIsCompleted) {
g.startGap();
break;
}
}
return results$;
};
})();
shared/gapComponent/scoreActions/_shared/actionLabel/label.ls
(function(){
return function(type){
return Div({
display: "inline-block",
minWidth: "0.8em",
backgroundColor: "rgba(0, 0, 0, 0.05)",
padding: "0 0.2em",
color: type === "correct"
? Color.green[500]
: type === "resolved"
? Color.grey[550]
: Color.red[500]
}).onDomAppend(function(){
if (!this.innerHTML) {
return this.html(" ");
}
});
};
})();
shared/gapComponent/scoreActions/_shared/calcTagDiv/calc.ls
(function(){
return function(gapIndex){
return Div({
fontSize: "12px",
backgroundColor: Color.yellow[200],
padding: "0.2em",
boxShadow: '0px 0px 2px #bbb',
color: "black",
marginRight: "0.7em"
}).html(gapIndex + 1);
};
})();
shared/gapComponent/scoreActions/_shared/calcTagIndex/calc.ls
(function(){
return function(slide, action){
var tagIndex;
return tagIndex = slide.yellowTagsCountPerSlide
? (slide.yellowTagIndex == null && (slide.yellowTagIndex = 0), slide.yellowTagIndex++)
: action.gap;
};
})();
shared/gapComponent/scoreActions/actions.ls
(function(){
return function(o){
var showYellowTag, slide, gapComponent, actions;
showYellowTag = o.showYellowTag;
slide = o.slide;
gapComponent = o.gapComponent;
actions = o.actions;
slide.yellowTagsCountPerSlide = o.yellowTagsCountPerSlide;
if (gapComponent.hasClass("gapText")) {
return inc("gapTextActions/actions")(slide, gapComponent, actions, showYellowTag);
} else if (gapComponent.hasClass("mathDiv")) {
return inc("mathDivActions/actions")(slide, gapComponent, actions, showYellowTag);
} else if (gapComponent.hasClass("mixed")) {
return inc("mixedActions/actions")(slide, gapComponent, actions, showYellowTag);
}
};
})();
shared/gapComponent/scoreActions/gapTextActions/action/action.ls
(function(){
return function(slide, gapText, action, showYellowTag){
var gap, row, calcTagDiv;
gap = gapText.findFirst(".gap" + action.gap);
if (!gap) {
return;
}
row = inc("/shared/scoreActionRowFlex/row")(action, action.correct
? inc("correct/correct")(slide, action)
: action.resolved
? inc("resolved/resolved")(slide, action)
: inc("mistake/mistake")(slide, action));
calcTagDiv = inc("../../_shared/calcTagDiv/calc");
if (showYellowTag) {
if (gap.yellowTagIndex == null) {
gap.yellowTagIndex = inc("../../_shared/calcTagIndex/calc")(slide, action);
gap.append(calcTagDiv(gap.yellowTagIndex).css({
position: "absolute",
left: 0,
top: 0
}));
}
row.append(calcTagDiv(gap.yellowTagIndex).css({
position: "absolute",
left: "-6px",
top: "-6px"
}));
}
return row;
};
})();
shared/gapComponent/scoreActions/gapTextActions/action/correct/correct.ls
(function(){
return function(slide, action){
var text;
text = action.button || action.text;
return Div({
flex: "1 1 auto",
display: "flex",
justifyContent: "flex-start"
}).append(inc("../../../_shared/actionLabel/label")("correct").secureHtml(text));
};
})();
shared/gapComponent/scoreActions/gapTextActions/action/mistake/mistake.ls
(function(){
return function(slide, action){
var text, solution;
text = action.button || action.text;
solution = action.solution;
return Div({
flex: "1 1 auto",
display: "flex",
justifyContent: "flex-start"
}).append(inc("../../../_shared/actionLabel/label")("wrong").secureHtml(text), Div().html(T("instead")), inc("../../../_shared/actionLabel/label")("resolved").secureHtml(solution));
};
})();
shared/gapComponent/scoreActions/gapTextActions/action/resolved/resolved.ls
(function(){
return function(slide, action){
var solution;
solution = action.solution;
return Div({
flex: "1 1 auto",
display: "flex",
justifyContent: "flex-start"
}).append(Div().html(T("showSolution")), inc("../../../_shared/actionLabel/label")("resolved").secureHtml(solution));
};
})();
shared/gapComponent/scoreActions/gapTextActions/actions.ls
(function(){
return function(slide, gapText, actions, showYellowTag){
var action;
return Div().append((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, gapText, action, showYellowTag));
}
return results$;
}()));
};
})();
shared/gapComponent/scoreActions/mathDivActions/action/action.ls
(function(){
return function(slide, mathDiv, action, showYellowTag){
var gap, row, calcTagDiv;
gap = mathDiv.findFirst(".gap" + action.gap);
if (!gap) {
return;
}
row = inc("/shared/scoreActionRowFlex/row")(action, action.correct
? inc("correct/correct")(action)
: action.resolved
? inc("resolved/resolved")(action)
: inc("mistake/mistake")(action));
calcTagDiv = inc("../../_shared/calcTagDiv/calc");
if (showYellowTag) {
if (gap.yellowTagIndex == null) {
gap.yellowTagIndex = inc("../../_shared/calcTagIndex/calc")(slide, action);
gap.append(calcTagDiv(gap.yellowTagIndex).css({
position: "absolute",
left: 0,
top: 0
}));
}
row.append(calcTagDiv(gap.yellowTagIndex).css({
position: "absolute",
left: "-6px",
top: "-6px"
}));
}
return row;
};
})();
shared/gapComponent/scoreActions/mathDivActions/action/correct/correct.ls
(function(){
return function(action){
return Div({
flex: "1 1 auto",
display: "flex",
justifyContent: "flex-start"
}).append(inc("../../../_shared/actionLabel/label")("correct").append(MathDiv2({
value: action.value,
enabled: false
})));
};
})();
shared/gapComponent/scoreActions/mathDivActions/action/mistake/mistake.ls
(function(){
return function(action){
return Div({
flex: "1 1 auto",
display: "flex",
justifyContent: "flex-start"
}).html(inc("../../../_shared/actionLabel/label")("wrong").html(MathDiv2({
value: action.value,
enabled: false
})), T("instead"), inc("../../../_shared/actionLabel/label")("resolved").html(MathDiv2({
value: action.solution,
enabled: false,
color: "currentColor"
})));
};
})();
shared/gapComponent/scoreActions/mathDivActions/action/resolved/resolved.ls
(function(){
return function(action){
return Div({
flex: "1 1 auto",
display: "flex",
justifyContent: "flex-start"
}).append(T("showSolution"), inc("../../../_shared/actionLabel/label")("resolved").append(MathDiv2({
value: action.solution,
enabled: false
})));
};
})();
shared/gapComponent/scoreActions/mathDivActions/actions.ls
(function(){
return function(slide, mathDiv, actions, showYellowTag){
var action;
return Div({
textAlign: "left"
}).append((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, mathDiv, action, showYellowTag));
}
return results$;
}()));
};
})();
shared/gapComponent/scoreActions/mixedActions/action/action.ls
(function(){
return function(slide, gapComponent, action, showYellowTag){
var gap;
gap = gapComponent.findFirst(".gap" + action.gap);
if (!gap) {} else if (gap.hasClass("mgap")) {
return inc("../../mathDivActions/action/action")(slide, gapComponent, action, showYellowTag);
} else {
return inc("../../gapTextActions/action/action")(slide, gapComponent, action, showYellowTag);
}
};
})();
shared/gapComponent/scoreActions/mixedActions/actions.ls
(function(){
return function(slide, gapComponent, actions, showYellowTag){
var action;
slide.yellowTagsCountPerSlide = true;
return Div({
textAlign: "left"
}).append((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, gapComponent, action, showYellowTag));
}
return results$;
}()));
};
})();
shared/getParam/default/default.ls
(function(){
return function(slide, name, atom){
var param;
param = (atom != null ? atom[name] : void 8) != null
? atom[name]
: slide.trainerParams[name] != null
? slide.trainerParams[name]
: slide.levelParams[name] != null ? slide.levelParams[name] : null;
if (name === "fontFamily") {
switch (param) {
case "monospace":
return "Source Code Pro";
case "school":
return "Solocode School";
default:
return param;
}
} else {
return param;
}
};
})();
shared/getParam/feedback/feedback.ls
(function(){
return function(slide, name, atom){
var name, a, t, l, feedback, specialNames, value, i$, len$, n, ref$, ref1$, ref2$, sounds, text;
a = _.cloneDeep(atom);
t = _.cloneDeep(slide.trainerParams);
l = _.cloneDeep(slide.levelParams);
feedback = (a != null ? a.feedback : void 8) || (t != null ? t.feedback : void 8);
if (!feedback) {
return;
}
specialNames = ["voice", "voiceLang", "style", "speaker", "autoplay"];
for (name in feedback) {
value = feedback[name];
if (_.includes(specialNames, name)) {
continue;
}
if (_.isString(value)) {
value = {
text: value
};
}
for (i$ = 0, len$ = specialNames.length; i$ < len$; ++i$) {
n = specialNames[i$];
value[n] = (ref$ = value[n]) != null
? ref$
: (ref$ = feedback[n]) != null
? ref$
: (ref$ = (ref1$ = t.feedback) != null ? ref1$[n] : void 8) != null
? ref$
: (ref$ = l.feedback) != null ? ref$[n] : void 8;
if (n === "voice" || n === "voiceLang") {
value[n] == null && (value[n] = (ref2$ = t != null ? t[n] : void 8) != null
? ref2$
: l != null ? l[n] : void 8);
}
}
value.sound == null && (value.sound = value.speaker ? (sounds = (fn$()), sounds.join(" ")) : void 8);
feedback[name] = value;
}
return feedback;
function fn$(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = _.ensureArray(value.text)).length; i$ < len$; ++i$) {
text = ref$[i$];
if (_.isString(text)) {
results$.push(text);
} else if (text.text) {
results$.push(text.text);
}
}
return results$;
}
};
})();
shared/getParam/getParam.ls
(function(){
return function(slide){
var functions, getParam;
functions = {
lsg: inc("lsg/lsg"),
image: inc("image/image"),
feedback: inc("feedback/feedback"),
hint: inc("hint/hint"),
instruction: inc("instruction/instruction"),
'default': inc("default/default")
};
return getParam = function(name, atom){
var f;
f = functions[name] || functions["default"];
return f(slide, name, atom);
};
};
})();
shared/getParam/hint/hint.ls
(function(){
return function(slide, name, atom){
var a, t, l, hint, specialNames, i$, len$, n, ref$, ref1$, ref2$, ref3$, sounds, text;
a = _.cloneDeep(atom);
t = _.cloneDeep(slide.trainerParams);
l = _.cloneDeep(slide.levelParams);
hint = (a != null ? a.hint : void 8) || (t != null ? t.hint : void 8) || (l != null ? l.hint : void 8);
if (!hint) {
return;
}
if (_.isString(hint)) {
hint = {
text: hint
};
}
specialNames = ["voice", "voiceLang", "style", "speaker", "autoplay", "label"];
for (i$ = 0, len$ = specialNames.length; i$ < len$; ++i$) {
n = specialNames[i$];
hint[n] = (ref$ = a != null ? (ref1$ = a.hint) != null ? ref1$[n] : void 8 : void 8) != null
? ref$
: (ref$ = t != null ? (ref2$ = t.hint) != null ? ref2$[n] : void 8 : void 8) != null
? ref$
: l != null ? (ref$ = l.hint) != null ? ref$[n] : void 8 : void 8;
if (n === "voice" || n === "voiceLang") {
hint[n] == null && (hint[n] = (ref3$ = t != null ? t[n] : void 8) != null
? ref3$
: l != null ? l[n] : void 8);
}
}
hint.sound == null && (hint.sound = hint.speaker ? (sounds = (function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = _.ensureArray(hint.text)).length; i$ < len$; ++i$) {
text = ref$[i$];
if (_.isString(text)) {
results$.push(text);
} else if (text.text) {
results$.push(text.text);
}
}
return results$;
}()), sounds.join(" ")) : void 8);
if (!hint.text) {
return;
}
return hint;
};
})();
shared/getParam/image/image.ls
(function(){
return function(slide, name, atom){
var a, t, ref$, l, ref1$, param;
a = _.cloneDeep(atom != null ? atom.image : void 8);
t = _.cloneDeep((ref$ = slide.trainerParams) != null ? ref$.image : void 8);
l = _.cloneDeep((ref1$ = slide.levelParams) != null ? ref1$.image : void 8);
if (_.isString(a)) {
a = {
image: a
};
}
if (_.isString(t)) {
t = {
image: t
};
}
if (_.isString(l)) {
l = {
image: l
};
}
if (_.isObject(a) || _.isObject(t) || _.isObject(l)) {
param = _.defaults(a, t, l);
if (param.image) {
param.image = _.trim(param.image);
return param;
}
}
};
})();
shared/getParam/instruction/instruction.ls
(function(){
return function(slide, name){
var a, t, l, instruction, specialNames, i$, len$, n, ref$, ref1$, ref2$, ref3$;
a = _.cloneDeep(slide.atom);
t = _.cloneDeep(slide.trainerParams);
l = _.cloneDeep(slide.levelParams);
instruction = (a != null ? a.instruction : void 8) || (t != null ? t.instruction : void 8) || (l != null ? l.instruction : void 8);
if (!instruction) {
return;
}
if (_.isString(instruction)) {
instruction = {
text: instruction
};
}
specialNames = ["voice", "voiceLang", "sound", "text", "style", "speaker", "autoplay"];
for (i$ = 0, len$ = specialNames.length; i$ < len$; ++i$) {
n = specialNames[i$];
instruction[n] == null && (instruction[n] = (ref$ = a != null ? (ref1$ = a.instruction) != null ? ref1$[n] : void 8 : void 8) != null
? ref$
: (ref$ = t != null ? (ref2$ = t.instruction) != null ? ref2$[n] : void 8 : void 8) != null
? ref$
: l != null ? (ref$ = l.instruction) != null ? ref$[n] : void 8 : void 8);
if (n === "voice" || n === "voiceLang") {
instruction[n] == null && (instruction[n] = (ref3$ = t != null ? t[n] : void 8) != null
? ref3$
: l != null ? l[n] : void 8);
}
}
instruction.sound == null && (instruction.sound = instruction.speaker ? instruction.text : void 8);
if (!instruction.text && !instruction.sound) {
return;
}
return instruction;
};
})();
shared/getParam/lsg/lsg.ls
(function(){
return function(slide, name, atom){
var a, t, ref$, l, ref1$, param;
a = _.cloneDeep(atom != null ? atom.lsg : void 8);
t = _.cloneDeep((ref$ = slide.trainerParams) != null ? ref$.lsg : void 8);
l = _.cloneDeep((ref1$ = slide.levelParams) != null ? ref1$.lsg : void 8);
if (_.isString(a)) {
a = {
lsg: a
};
}
if (_.isString(t)) {
t = {
lsg: t
};
}
if (_.isString(l)) {
l = {
lsg: l
};
}
if (_.isObject(a) || _.isObject(t) || _.isObject(l)) {
param = _.defaults(a, t, l);
if (param.lsg) {
return param;
}
}
};
})();
shared/image/div/div.ls
(function(){
return function(width, height, imageData, wrapWithDiv){
var div, wrapper;
div = inc("/../app01/lib/gui/image/image")({
base64: imageData != null ? imageData.base64 : void 8,
url: imageData != null ? imageData.url : void 8
}).css({
width: width + "px",
height: height + "px"
});
if (wrapWithDiv) {
wrapper = Div({
margin: "1em auto",
textAlign: "center"
}).html(div);
wrapper.image = div;
return wrapper;
} else {
return div;
}
};
})();
shared/image/image.ls
(function(){
return function(o){
var imageParams, slide, parent, wrapWithDiv, ref$, defaultSize, fontScale, image, width, height, imageData, div;
imageParams = o.image;
slide = o.slide;
parent = o.parent;
wrapWithDiv = (ref$ = o.wrapWithDiv) != null ? ref$ : false;
if (!imageParams) {
return;
}
if (_.isString(imageParams)) {
imageParams = {
image: imageParams
};
}
defaultSize = 150;
fontScale = inc("/../app01/lib/util/fontSize/calcFontScale/calc")();
image = imageParams.image;
if (_.startsWith(image, "pixabay")) {
debug("image warning for image " + image + ": pixabay images shouldn't be used anymore.");
}
width = fontScale * ((imageParams != null ? imageParams.width : void 8) || defaultSize);
height = fontScale * ((imageParams != null ? imageParams.height : void 8) || (imageParams != null ? imageParams.width : void 8) || defaultSize);
imageData = _.find(slide.mediaParams.images, {
id: image
});
div = inc("div/div")(width, height, imageData, wrapWithDiv);
div.scaleToParent = inc("scaleToParent/scale")(div, width, height, parent, wrapWithDiv);
div.scaleToParent();
return div;
};
})();
shared/image/scaleToParent/calcScale/calc.ls
(function(){
return function(width, parent){
var wrapper, that, scaleFactor, parentWidth, scale;
wrapper = (that = app.currentPopup) != null ? that.findFirst(".popupContent") : body;
scaleFactor = parent == null || parent.width() === wrapper.width() ? 0.95 : 1;
if (parent == null) {
parent = wrapper;
}
parentWidth = parent.width() - +parent.css("paddingLeft").replace("px", "") - +parent.css("paddingRight").replace("px", "");
return scale = (parentWidth * scaleFactor) / width;
};
})();
shared/image/scaleToParent/scale.ls
(function(){
return function(div, width, height, parent, wrapWithDiv){
return function(){
var scaleDiv, scale;
scaleDiv = wrapWithDiv ? div.image : div;
scale = inc("calcScale/calc")(width, parent);
if (0 < scale && scale < 1) {
width = width * scale;
height = height * scale;
}
return scaleDiv.css({
width: width + "px",
height: height + "px"
});
};
};
})();
shared/instruction/instruction.ls
(function(){
return function(slide){
var instruction, text, sound, voice, autoplay, hasPlayed, waitFirstPlayCompletedHandlers, play, stop, finish, waitFirstPlayCompleted, div, speaker, label;
instruction = slide.getParam("instruction", slide.atom);
text = instruction != null ? instruction.text : void 8;
sound = instruction != null ? instruction.sound : void 8;
voice = instruction != null ? instruction.voice : void 8;
autoplay = instruction != null ? instruction.autoplay : void 8;
hasPlayed = sound ? false : true;
waitFirstPlayCompletedHandlers = {};
play = function(onFinish){
if (autoplay === false) {
slide.levelPlayer.lastInstructionSound = null;
return finish(onFinish);
} else if (!sound) {
slide.levelPlayer.lastInstructionSound = null;
return finish(onFinish);
} else if (slide.levelPlayer.lastInstructionSound === sound && autoplay !== true) {
return finish(onFinish);
} else {
slide.levelPlayer.lastInstructionSound = sound;
return setTimeout(function(){
var ref$;
if (((ref$ = slide.div) != null && ref$.isVisible()) && app.currentPage.levelPlayer != null) {
return speaker.play(function(){
return finish(onFinish);
});
}
}, 500);
}
};
stop = function(){
return typeof speaker != 'undefined' && speaker !== null ? speaker.stop() : void 8;
};
finish = function(onFinish){
return requestAnimationFrame(function(){
var i$, ref$, v, j$, len$, cb;
hasPlayed = true;
if (typeof onFinish == 'function') {
onFinish();
}
for (i$ in ref$ = waitFirstPlayCompletedHandlers) {
v = ref$[i$];
for (j$ = 0, len$ = v.length; j$ < len$; ++j$) {
cb = v[j$];
cb();
}
}
return waitFirstPlayCompletedHandlers = {};
});
};
waitFirstPlayCompleted = function(o){
var key$;
if (hasPlayed) {
return o.callback();
} else {
waitFirstPlayCompletedHandlers[key$ = o.category] == null && (waitFirstPlayCompletedHandlers[key$] = []);
return waitFirstPlayCompletedHandlers[o.category].push(o.callback);
}
};
div = Div({
width: "35em",
maxWidth: "90%",
margin: "0 auto"
}).addClass("instruction").html(Div({
display: "inline-block",
lineHeight: "1.4em",
padding: "0.5em",
margin: "0.5em",
fontStyle: "italic",
maxWidth: "100%"
}).html(speaker = inc("speaker/speaker")(slide, sound, text, voice), label = inc("label/label")(slide, text)).tap(sound ? {
animation: "none",
up: speaker.toggle
} : void 8));
if (!text && !sound) {
div.hide();
}
div.play = play;
div.stop = stop;
div.sound = sound;
div.hasPlayed = function(){
return hasPlayed;
};
div.waitFirstPlayCompleted = waitFirstPlayCompleted;
return div;
};
})();
shared/instruction/label/label.ls
(function(){
return function(slide, text){
return inc("/../app01/lib/seo/element/h2/h2")().css({
display: "inline"
}).html(text);
};
})();
shared/instruction/speaker/speaker.ls
(function(){
return function(slide, sound, text, voice){
var outline, speaker;
if (!sound) {
return;
}
outline = (text != null ? text.length : void 8) > 0;
sound = slide.sounds[sound + voice];
speaker = inc("/../app01/lib/gui/speakerIconPlayer/speakerIconPlayer")({
outline: outline,
size: outline ? "1.4em" : "3.5em"
}).css({
marginRight: "0.1em"
});
speaker.setSound(sound);
return speaker;
};
})();
shared/levelPlayer/_t.ls
(function(){
return {
offlineError: {
de: "Du musst online sein, um hier weiter lernen zu können.",
en: "To continue learning, please connect to the internet.",
fr: "Tu dois être en ligne pour continuer à apprendre.",
es: "Por favor, conéctate a la red para seguir aprendiendo.",
pt: "Você precisa estar online para continuar aprendendo."
},
reloadButton: {
de: "Nochmal laden",
en: "Reload",
fr: "Réessayer",
es: "Volver a cargar",
pt: "Carregar novamente"
}
};
})();
shared/levelPlayer/abort/abort.ls
(function(){
return function(p){
var abort;
return abort = function(){
if (p.isFinished) {
return;
}
p.isFinished = true;
inc("../log/abort/abort")(p);
inc("/../app01/lib/init/classKit/levelPlayer/abort/abort")(p);
return typeof p.onAbort == 'function' ? p.onAbort() : void 8;
};
};
})();
shared/levelPlayer/calcCurrentSlideIndex/calc.ls
(function(){
return function(p){
var slideIndex;
if (p.context !== "idePreview") {
return -1;
}
if (p.previewTrainerIndex != null) {
slideIndex = _.findIndex(p.slides, function(s){
return _.isEqual(s.trainerParams, p.level.trainers[p.previewTrainerIndex]);
});
return slideIndex - 1;
}
return -1;
};
})();
shared/levelPlayer/calcRound/calc.ls
(function(){
return function(){
var lastRound, round, e;
lastRound = Store("sourceLevelRound") || 0;
round = lastRound + 1;
try {
Store("sourceLevelRound", round);
} catch (e$) {
e = e$;
log.log({
event: "debugFirefoxNSError",
error: e
});
}
_.setRandomSeed(round);
return round;
};
})();
shared/levelPlayer/calcTotalAtoms/calc.ls
(function(){
return function(p){
var t, i$, ref$, len$, s;
t = 0;
for (i$ = 0, len$ = (ref$ = p.slides).length; i$ < len$; ++i$) {
s = ref$[i$];
if (s.atom) {
t++;
} else if (s.atoms) {
t += s.atoms.length;
}
}
return t;
};
})();
shared/levelPlayer/calcTotalProgressElements/calc.ls
(function(){
return function(p, onDone){
var totalDone, errors, calcSlides, onSlideCompleted, finish, onError;
totalDone = 0;
errors = [];
calcSlides = function(){
var i$, ref$, len$, slide, results$ = [];
for (i$ = 0, len$ = (ref$ = p.slides).length; i$ < len$; ++i$) {
slide = ref$[i$];
results$.push(slide.calcTotalProgressElements(onSlideCompleted));
}
return results$;
};
onSlideCompleted = function(errors2){
var errors;
totalDone++;
errors = _.concat(errors, errors2);
if (totalDone === p.slides.length) {
return finish();
}
};
finish = function(){
if (errors.length > 0) {
return onError();
} else {
return onDone();
}
};
onError = function(){
debug("calcTotalProgressElements errors");
return debug(errors);
};
return calcSlides();
};
})();
shared/levelPlayer/finish/finish.ls
(function(){
return function(p){
var finish;
return finish = function(){
if (p.isFinished) {
return;
}
p.isFinished = true;
inc("../log/finish/finish")(p);
inc("/../app01/lib/init/classKit/levelPlayer/finish/finish")(p);
return setTimeout(p.onFinish, 400);
};
};
})();
shared/levelPlayer/generateSlides/generate.ls
(function(){
return function(player){
var trainers, slides, i$, len$, trainer, t, path, trainerParams, levelParams, slide;
trainers = _.ensureArray(player.level.trainers);
slides = [];
for (i$ = 0, len$ = trainers.length; i$ < len$; ++i$) {
trainer = trainers[i$];
t = trainer.trainer;
path = "/../" + (_.startsWith(t, "kid")
? "app01-kid-trainers/trainers/" + t
: _.startsWith(t, "playground")
? "app01-playground-trainers/trainers/" + t.replace("playground/", "")
: "app01-trainers/trainers/" + t) + "/generateSlides";
trainerParams = trainer;
levelParams = player.level;
slides = slides.concat(inc(path)(trainerParams, levelParams));
}
for (i$ = 0, len$ = slides.length; i$ < len$; ++i$) {
slide = slides[i$];
slide.levelPlayer = player;
}
return slides;
};
})();
shared/levelPlayer/loadSlidesMediaFiles/load.ls
(function(){
return function(p){
var index, loadNextSlide, onSlideLoaded;
index = -1;
loadNextSlide = function(){
var slide;
index++;
slide = p.slides[index];
return slide != null ? slide.loadMediaFiles({
onDone: onSlideLoaded
}) : void 8;
};
onSlideLoaded = function(){
return loadNextSlide();
};
return loadNextSlide();
};
})();
shared/levelPlayer/log/_addLearnListProperties/add.ls
(function(){
return function(p, e){
var params;
params = p.page.params;
if (params.context !== "learnList") {
return;
}
delete e.level;
e.listCode = p.level.puid.split("/")[2];
return e.startConfig = _.pick(params, ["shuffleAtoms", "switchAB", "soundMode"]);
};
})();
shared/levelPlayer/log/abort/abort.ls
(function(){
return function(p){
var slide, e;
slide = p.slides[p.currentSlideIndex];
if (slide != null) {
slide.score.logUnloggedAtoms("levelAbort");
}
e = inc("../finish/event")(p);
e.event = "abortLevel";
return p.log.log(e);
};
})();
shared/levelPlayer/log/finish/calcProgressColorsString/calc.ls
(function(){
return function(stats){
var letter, s, s2, lastColor, i$, ref$, len$, c, part;
letter = {
green: "g",
red: "r",
grey: "b"
};
s = "";
s2 = "";
lastColor = undefined;
for (i$ = 0, len$ = (ref$ = stats.progressColors || []).length; i$ < len$; ++i$) {
c = ref$[i$];
if (c !== lastColor) {
s += "|";
}
s += letter[c];
lastColor = c;
}
for (i$ = 0, len$ = (ref$ = s.split("|")).length; i$ < len$; ++i$) {
part = ref$[i$];
if (part) {
s2 += part.length === 1
? part
: part.length > 1 ? part.length + part[0] : void 8;
}
}
return s2;
};
})();
shared/levelPlayer/log/finish/calcScore/calc.ls
(function(){
return function(p){
var s, score;
if (p.level.type === "bulb") {
return 1;
}
s = p.progressBar.getStats();
score = (s.totalGreen * 3) / (s.totalGreen + s.totalRed + s.totalGrey);
score = _.round(score, 1);
if (p.skipFakeResult != null) {
score = p.skipFakeResult;
}
return score = Math.max(0.3, score);
};
})();
shared/levelPlayer/log/finish/event.ls
(function(){
return function(p){
var score, stats, progressColors, duration, project, e, ref$, ref1$;
score = inc("calcScore/calc")(p);
stats = p.progressBar.getStats();
progressColors = stats ? inc("calcProgressColorsString/calc")(stats) : void 8;
duration = (new Date() - p.startedAt) / 1000;
project = p.level.path.split("/")[2];
e = {
event: "finishLevel",
puid: p.level.puid,
level: inc("/../app01/lib/util/projectPath/path")(p.level.path),
levelTitle: p.level.title,
blockPuid: (ref$ = p.level.parentBlock) != null ? ref$.puid : void 8,
blockTitle: (ref1$ = p.level.parentBlock) != null ? ref1$.title : void 8,
corrects: stats.totalGreen,
mistakes: stats.totalRed,
resolved: stats.totalGrey,
total: stats.totalProgressElements,
progressColors: progressColors,
duration: _.round(duration, 1),
atoms: p.totalAtoms,
score: score,
round: p.round,
type: p.level.type
};
inc("../_addLearnListProperties/add")(p, e);
if (p.skipFakeResult != null) {
e.isSkipped = true;
}
if (engine.isDebug) {
e.isDebug = true;
}
return e;
};
})();
shared/levelPlayer/log/finish/finish.ls
(function(){
return function(p){
var e;
return p.log.log(e = inc("event")(p));
};
})();
shared/levelPlayer/log/start/start.ls
(function(){
return function(p){
var e, ref$, ref1$;
e = {
event: "startLevel",
puid: p.level.puid,
level: inc("/../app01/lib/util/projectPath/path")(p.level.path),
blockPuid: (ref$ = p.level.parentBlock) != null ? ref$.puid : void 8,
blockTitle: (ref1$ = p.level.parentBlock) != null ? ref1$.title : void 8,
round: p.round,
type: p.level.type
};
if (engine.isDebug) {
e.isDebug = true;
}
inc("../_addLearnListProperties/add")(p, e);
return p.log.log(e);
};
})();
shared/levelPlayer/playNextSlide/errorPopup/popup.ls
(function(){
return function(){
var clickAbort, popup;
clickAbort = function(){
popup.close();
app.currentPage.levelPlayer.abort();
return startPage({
history: function(path){
return !_.includes(path, "/level");
},
animation: "fadeIn"
});
};
return popup = inc("/../app01/lib/gui/errorPopup/popup")({
onClose: clickAbort
});
};
})();
shared/levelPlayer/playNextSlide/offlinePopup/popup.ls
(function(){
return function(player, reload){
var clickAbort, clickReload, div, css, popup;
clickAbort = function(){
popup.close();
log.log({
event: "debugLevelOfflineAbort",
level: player.level.path,
slide: player.currentSlideIndex + 1
});
player.abort();
return startPage({
history: function(path){
return !_.includes(path, "/level");
},
animation: "fadeIn"
});
};
clickReload = function(){
popup.close();
return reload();
};
div = Div().css({
margin: "1em 0"
}).append(Div().css({
padding: "0 0.5em 0.5em"
}).html(T("offlineError")), Div().css({
display: "inline-block"
}).append(Button({
label: T("cancelButton"),
action: clickAbort
}).css(css = {
margin: "0.5em"
}), Button({
label: T("reloadButton"),
action: clickReload
}).css(css)));
return popup = inc("/../app01/lib/gui/popup/popup")({
html: div,
onClose: function(type){
if (type === "outside" || type === "icon") {
return clickAbort();
}
}
});
};
})();
shared/levelPlayer/playNextSlide/onSamePageInit/init.ls
(function(){
return function(player, slide){
var ref$, ref1$, lastChild;
if ((ref$ = slide.div) != null) {
ref$.css({
paddingBottom: "1.5em"
});
}
if ((ref1$ = body.findFirst(".spinner")) != null) {
ref1$.remove();
}
lastChild = _.last(player.page.childrenAll());
if (lastChild != null) {
lastChild.css({
minHeight: "",
paddingBottom: "1em",
marginBottom: "1em",
borderBottom: !((typeof deviceLog != 'undefined' && deviceLog !== null) && deviceLog['var']("hideOnSamePageBorder")) ? "1px solid lightGrey" : void 8
});
}
if (slide.trainerParams.deleteLastPage) {
return lastChild != null ? lastChild.remove() : void 8;
}
};
})();
shared/levelPlayer/playNextSlide/onSamePageStart/start.ls
(function(){
return function(player, slide){
if (slide.trainerParams.deleteLastPage) {
player.page.scrollElementIntoView(slide.div, {
instant: true
});
} else {
player.page.scrollElementIntoView(slide.div);
}
return slide.trainerParams.deleteLastPage = true;
};
})();
shared/levelPlayer/playNextSlide/play.ls
(function(){
return function(player){
return function(){
var page, slide, loadSlideMedia, onLoadSlideMediaError, initSlide, startSlide;
page = player.page;
player.currentSlideIndex++;
slide = player.slides[player.currentSlideIndex];
if (!slide) {
player.finish();
return;
}
slide.slideStartedAt = new Date();
player.currentSlide = slide;
loadSlideMedia = function(){
inc("prepareMediaLoadingSpinner/spinner")(slide, player);
return slide.loadMediaFiles({
onError: onLoadSlideMediaError,
onDone: initSlide
});
};
onLoadSlideMediaError = function(errors){
if (app.currentPage.levelPlayer !== player) {} else if (_.every(errors, {
error: "offline"
})) {
return inc("offlinePopup/popup")(player, loadSlideMedia);
} else {
return inc("errorPopup/popup")();
}
};
initSlide = function(){
if (app.currentPage.levelPlayer !== player) {
return;
}
_.setRandomSeed(player.round * 100 + player.currentSlideIndex);
slide.div = Div().addClass("slide");
if (slide.trainerParams.onSamePage && player.currentSlideIndex !== 0) {
inc("onSamePageInit/init")(player, slide);
} else {
page.empty();
}
page.append(slide.div);
slide.init();
return startSlide();
};
startSlide = function(){
var ref$;
if ((ref$ = app.lastSound) != null) {
if (typeof ref$.stop == 'function') {
ref$.stop();
}
}
page.bottom.empty().hide();
page.setBottomFreeze(0);
page.disableFreezeMinHeight();
page.centerDuration = 0;
if (slide.trainerParams.onSamePage && player.currentSlideIndex !== 0) {
slide.start();
return inc("onSamePageStart/start")(player, slide);
} else {
page.pageScrollWrapper.scrollTop = 0;
page.css({
transition: "",
height: ""
});
page.fadeIn(200);
return slide.start();
}
};
return loadSlideMedia();
};
};
})();
shared/levelPlayer/playNextSlide/prepareMediaLoadingSpinner/spinner.ls
(function(){
return function(slide, player){
if (engine.isMobileApp) {
return setTimeout(function(){
if (slide.div == null) {
if (slide.trainerParams.onSamePage && player.currentSlideIndex !== 0) {
inc("../onSamePageInit/init")(player, slide);
} else {
player.page.empty();
}
return player.page.append(inc("/../app01/lib/gui/spinner/spinner")());
}
}, 200);
}
};
})();
shared/levelPlayer/player.ls
(function(){
return function(o){
var p;
p = {};
p.log = o.log || log;
p.level = _.cloneDeep(o.level);
p.progressBar = o.progressBar;
p.page = o.page;
p.context = o.context;
p.previewTrainerIndex = o.previewTrainerIndex;
p.round = inc("calcRound/calc")();
p.slides = inc("generateSlides/generate")(p);
p.totalAtoms = inc("calcTotalAtoms/calc")(p);
p.currentSlideIndex = inc("calcCurrentSlideIndex/calc")(p);
p.startedAt = new Date();
p.scoreEvents = [];
p.onFinish = o.onFinish;
p.onAbort = o.onAbort;
p.playNextSlide = inc("playNextSlide/play")(p);
p.start = inc("start/start")(p);
p.finish = inc("finish/finish")(p);
p.abort = inc("abort/abort")(p);
p.page.levelPlayer = p;
inc("calcTotalProgressElements/calc")(p, function(){
p.progressBar.init(p.slides);
return p.start();
});
return p;
};
})();
shared/levelPlayer/start/debugUnsentEventsMobile/debug.ls
(function(){
return function(){
var i$, ref$, len$, l, results$ = [];
if (!engine.isMobileApp) {
return;
}
if (!inc("/../app01/lib/util/isOnline/isOnline")()) {
return;
}
for (i$ = 0, len$ = (ref$ = [log, deviceLog]).length; i$ < len$; ++i$) {
l = ref$[i$];
try {
results$.push(l.getDetails(fn$));
} catch (e$) {}
}
return results$;
function fn$(d){
var total, unsentEvents;
total = d.totalUnsentEvents;
if (total <= 10) {
return;
}
unsentEvents = _.filter(l.list(), function(e){
return !e.inserted;
});
unsentEvents = _.map(unsentEvents, function(e){
return {
event: e.event,
created: e.created
};
});
return helpers.postEvent(l.id(), {
event: "debugMobileUnsentEvents",
total: d.totalUnsentEvents,
details: d,
version: 2,
eventsOldest: _.first(unsentEvents),
eventsNewest: _.last(unsentEvents)
});
}
};
})();
shared/levelPlayer/start/start.ls
(function(){
return function(p){
return function(){
if (engine.isMobileApp) {
inc("/../app01/lib/util/audioContext/refresh/refresh")();
}
inc("debugUnsentEventsMobile/debug")();
inc("../log/start/start")(p);
inc("/../app01/lib/init/classKit/levelPlayer/start/start")(p);
inc("../loadSlidesMediaFiles/load")(p);
return p.playNextSlide();
};
};
})();
shared/lsg/calcLsg/calc.ls
(function(){
return function(lsgParams, mediaParams){
var lsg, ref$;
return lsg = _.endsWith(lsgParams.lsg, ".lsg")
? (mediaParams != null ? (ref$ = mediaParams.lsgs) != null ? ref$[lsgParams.lsg] : void 8 : void 8) || inc(lsgParams.lsg)
: _.endsWith(lsgParams.lsg, ".lsr")
? inc(lsgParams.lsg)(lsgParams)
: (debug("invalid lsg", lsgParams.lsg), null);
};
})();
shared/lsg/checkRequiredArguments/check.ls
(function(){
return function(lsgParams, lsg){
var i$, ref$, len$, a;
for (i$ = 0, len$ = (ref$ = _.ensureArray(lsg.requiredArguments)).length; i$ < len$; ++i$) {
a = ref$[i$];
if (lsgParams[a] == null) {
console.log("missing required renderer argument \"" + a + "\". Not displaying renderer");
return false;
}
}
return true;
};
})();
shared/lsg/div/div.ls
(function(){
return function(lsg, mediaParams, width, height, wrapWithDiv){
var div, ref$, wrapper;
div = (ref$ = deviceLog['var']("useLsg3Div")) === "yes" || ref$ === "both"
? inc("/../lsg2/lsg3Div/div")({
lsg: _.cloneDeep(lsg),
mediaParams: mediaParams
})
: Svg({
svg: LSG2.toSVG(lsg, mediaParams.svgs, mediaParams.lsgs, mediaParams.images)
});
div.css({
width: width + "px",
height: height + "px",
verticalAlign: "top"
});
if (wrapWithDiv) {
wrapper = Div({
margin: "1em auto",
textAlign: "center"
}).html(div, deviceLog['var']("useLsg3Div") === "both" ? Svg({
svg: LSG2.toSVG(lsg, mediaParams.svgs, mediaParams.lsgs, mediaParams.images)
}).css({
width: width + "px",
height: height + "px",
verticalAlign: "top",
marginLeft: "10px"
}) : void 8);
wrapper.lsg = div;
wrapper.updateLayout = div.updateLayout;
return wrapper;
} else {
return div;
}
};
})();
shared/lsg/lsg.ls
(function(){
return function(o){
var lsgParams, slide, parent, wrapWithDiv, ref$, mediaParams, lsg, that, defaultWidth, fontScale, width, height, div;
lsgParams = o.lsg;
slide = o.slide;
parent = o.parent;
wrapWithDiv = (ref$ = o.wrapWithDiv) != null ? ref$ : false;
if (_.isString(lsgParams)) {
lsgParams = {
lsg: lsgParams
};
}
mediaParams = slide.mediaParams;
lsgParams.renderLanguage = slide.levelParams.contentLanguagePrimary;
lsg = inc("calcLsg/calc")(lsgParams, mediaParams);
if (!lsg) {
return;
}
if (!inc("checkRequiredArguments/check")(lsgParams, lsg)) {
return;
}
if (that = _.find(mediaParams.images, function(image){
return _.startsWith(image.id, "pixabay");
})) {
debug("image warning for image " + that.id + " embedded in lsg " + lsgParams.lsg + ": pixabay images shouldn't be used anymore.");
}
lsg = inc("mergeSettings/merge")(lsgParams, lsg);
defaultWidth = wrapWithDiv ? 250 : 150;
fontScale = inc("/../app01/lib/util/fontSize/calcFontScale/calc")();
width = fontScale * (lsgParams.width || defaultWidth);
height = lsg.height * width / lsg.width;
div = inc("div/div")(lsg, mediaParams, width, height, wrapWithDiv);
div.scaleToParent = inc("scaleToParent/scale")(div, width, height, parent, wrapWithDiv);
div.scaleToParent();
div.lsgData = lsg;
return div;
};
})();
shared/lsg/mergeSettings/merge.ls
(function(){
return function(lsgParams, lsg){
var that;
if (that = lsgParams.color) {
lsg.color = _.merge(lsg.color, that);
}
if (that = lsgParams.lineColor) {
lsg.lineColor = _.merge(lsg.lineColor, that);
}
if (that = lsgParams.lineSize) {
lsg.lineSize = _.merge(lsg.lineSize, that);
}
if (that = lsgParams.background) {
lsg.background = that;
}
if (that = lsgParams.renderLanguage) {
lsg.renderLanguage = that;
}
return lsg;
};
})();
shared/lsg/scaleToParent/calcScale/calc.ls
(function(){
return function(width, parent){
var wrapper, that, scaleFactor, parentWidth, scale;
wrapper = (that = app.currentPopup) != null ? that.findFirst(".popupContent") : body;
scaleFactor = parent == null || parent.width() === wrapper.width() ? 0.95 : 1;
if (parent == null) {
parent = wrapper;
}
parentWidth = parent.width() - +parent.css("paddingLeft").replace("px", "") - +parent.css("paddingRight").replace("px", "");
return scale = (parentWidth * scaleFactor) / width;
};
})();
shared/lsg/scaleToParent/scale.ls
(function(){
return function(div, width, height, parent, wrapWithDiv){
return function(){
var scaleDiv, scale;
scaleDiv = wrapWithDiv ? div.lsg : div;
scale = inc("calcScale/calc")(width, parent);
if (0 < scale && scale < 1) {
width = width * scale;
height = height * scale;
}
return scaleDiv.css({
width: width + "px",
height: height + "px"
});
};
};
})();
shared/playAskSoundOrSoundA/play.ls
(function(){
return function(slide, onDone){
var ref$, p, soundMode, voice, ref1$, text, sound;
if (!((ref$ = slide.div) != null && ref$.isVisible())) {
return;
}
p = slide.getParam;
soundMode = p("soundMode", slide.atom);
voice = (ref1$ = p("voiceA", slide.atom)) != null
? ref1$
: p("voice", slide.atom);
text = slide.atom.soundA || slide.atom.sound || slide.atom.a;
sound = slide.sounds[text + voice];
if (sound) {
slide.currentSound = sound;
}
if (soundMode === "a" || soundMode === "ab") {
return sound.play(function(){
return typeof onDone == 'function' ? onDone() : void 8;
});
} else if (soundMode === "askSound") {
return setTimeout(function(){
return slide.askSound.play(text + voice, function(){
return typeof onDone == 'function' ? onDone() : void 8;
});
}, 500);
} else {
return typeof onDone == 'function' ? onDone() : void 8;
}
};
})();
shared/playSoundA/play.ls
(function(){
return function(atom, slide, onDone, onProgressUpdate){
var p, soundMode, voice, ref$, text, sound, waitInstruction;
p = slide.getParam;
soundMode = p("soundMode", atom);
voice = (ref$ = p("voiceA", atom)) != null
? ref$
: p("voice", atom);
text = atom.soundA || atom.sound || atom.a;
sound = slide.sounds[text + voice];
waitInstruction = function(cb, delay){
return slide.instruction.waitFirstPlayCompleted({
category: "sound",
callback: function(){
return setTimeout(cb, delay);
}
});
};
if (sound && (soundMode === "a" || soundMode === "ab")) {
waitInstruction(function(){
var ref$;
if ((ref$ = slide.currentSoundA) != null) {
ref$.stop();
}
slide.currentSoundA = sound;
return sound.play(onDone, onProgressUpdate);
}, 300);
} else if (sound && soundMode === "askSound") {
waitInstruction(function(){
var ref$;
if ((ref$ = slide.currentSoundA) != null) {
ref$.stop();
}
slide.currentSoundA = slide.askSound;
return slide.askSound.play(text + voice, onDone);
}, 500);
} else {
setTimeout(onDone, 300);
}
return sound;
};
})();
shared/playSoundB/play.ls
(function(){
return function(atom, slide, correctValue, onDone, onProgressUpdate){
var p, soundMode, text, voice, ref$, voiceLang, sound;
p = slide.getParam;
soundMode = p("soundMode", atom);
text = atom.soundB || atom.sound || correctValue || atom.b.replace(/<[^>]+>/g, '');
voice = (ref$ = p("voiceB", atom)) != null
? ref$
: p("voice", atom);
voiceLang = (ref$ = p("voiceLangB", atom)) != null
? ref$
: p("voiceLang", atom);
sound = slide.sounds[text + voice + voiceLang];
if ((soundMode === "b" || soundMode === "ab") && sound) {
slide.instruction.waitFirstPlayCompleted({
category: "sound",
callback: function(){
return setTimeout(function(){
return sound.play(onDone, onProgressUpdate);
}, 300);
}
});
} else {
setTimeout(onDone, 1000);
}
return sound;
};
})();
shared/randomizePositions/layoutForce/layout.ls
(function(){
return function(o){
var origin, margin, numSteps, width, height, rects, i$, ref$, len$, e, maxdist, pullToCenter, distance, calculateForce, setApart, move, updateLayout, performStep, i, results$ = [];
origin = {
x: o.parentOffset.left,
y: o.parentOffset.top
};
margin = o.margin || 0;
numSteps = 200;
width = o.parentOffset.width - 2 * margin;
height = o.parentOffset.height - 2 * margin;
rects = [];
for (i$ = 0, len$ = (ref$ = o.elements).length; i$ < len$; ++i$) {
e = ref$[i$];
rects.push(inc("rect/rect")(e, origin));
}
maxdist = Math.max(width, height);
pullToCenter = function(rect){
var dx, dy, dist, d;
dx = rect.centerX - (margin + width / 2);
dy = rect.centerY - (margin + height / 2);
dist = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
dx /= dist;
dy /= dist;
d = dist * 0.08;
rect.dx -= dx * d;
return rect.dy -= dy * d;
};
distance = function(r1, r2){
var dx, dy;
dx = Math.max(0, Math.abs(r1.centerX - r2.centerX) - (r1.width + r2.width) / 2);
dy = Math.max(0, Math.abs(r1.centerY - r2.centerY) - (r1.height + r2.height) / 2);
return Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
};
calculateForce = function(rect){
var i$, ref$, len$, r, dx, dy, l, dist, d, results$ = [];
rect.dx = 0;
rect.dy = 0;
pullToCenter(rect);
for (i$ = 0, len$ = (ref$ = rects).length; i$ < len$; ++i$) {
r = ref$[i$];
if (r !== rect) {
dx = rect.centerX - r.centerX;
dy = rect.centerY - r.centerY;
l = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
dx /= l;
dy /= l;
dist = distance(rect, r);
d = maxdist / (dist + 50);
rect.dx += dx * d;
results$.push(rect.dy += dy * d);
}
}
return results$;
};
setApart = function(rect1){
var i$, ref$, len$, rect2, results$ = [];
for (i$ = 0, len$ = (ref$ = rects).length; i$ < len$; ++i$) {
rect2 = ref$[i$];
if (rect2 !== rect1) {
if (rect1.x === rect2.x && rect1.y === rect2.y && rect1.width === rect2.width && rect1.height === rect2.height) {
rect1.x = margin + Math.random() * (width - rect1.width);
results$.push(rect1.y = margin + Math.random() * (height - rect1.height));
}
}
}
return results$;
};
move = function(r){
r.x += r.dx;
r.y += r.dy;
if (r.x < margin) {
r.x = margin;
}
if (r.y < margin) {
r.y = margin;
}
if (r.x + r.width > margin + width) {
r.x = margin + width - r.width;
}
if (r.y + r.height > margin + height) {
r.y = margin + height - r.height;
}
setApart(r);
r.centerX = r.x + r.width / 2;
return r.centerY = r.y + r.height / 2;
};
updateLayout = function(rect){
return rect.element.css({
left: rect.x + "px",
top: rect.y + "px"
});
};
performStep = function(){
var i$, ref$, len$, r, results$ = [];
for (i$ = 0, len$ = (ref$ = rects).length; i$ < len$; ++i$) {
r = ref$[i$];
calculateForce(r);
}
for (i$ = 0, len$ = (ref$ = rects).length; i$ < len$; ++i$) {
r = ref$[i$];
move(r);
results$.push(updateLayout(r));
}
return results$;
};
if (o.animated) {
for (i$ = 0; i$ < numSteps; ++i$) {
i = i$;
results$.push(setTimeout(fn$, 10 * i));
}
return results$;
} else {
return _.times(numSteps, performStep);
}
function fn$(){
return performStep();
}
};
})();
shared/randomizePositions/layoutForce/rect/rect.ls
(function(){
return function(o, origin){
var offset, rect;
offset = o.offset();
rect = {
x: offset.left - origin.x,
y: offset.top - origin.y,
width: offset.width,
height: offset.height,
element: o,
dx: 0,
dy: 0,
centerX: offset.left - origin.x + offset.width / 2,
centerY: offset.top - origin.y + offset.height / 2
};
return rect;
};
})();
shared/randomizePositions/layoutSpaceDivide/layout.ls
(function(){
return function(o){
var margin, mainRect, spaces, validateSplit, splitRect, placeElement, elements, i$, len$, e;
margin = o.margin || 0;
mainRect = inc("rect/rect")({
x: margin,
y: margin,
width: o.width - 2 * margin,
height: o.height - 2 * margin
});
spaces = [mainRect];
validateSplit = function(rect, split){
if (split.x < rect.x) {
split.x = rect.x;
}
if (split.y < rect.y) {
split.y = rect.y;
}
if (split.x + split.width > rect.x + rect.width) {
split.width = rect.x + rect.width - split.x;
}
if (split.y + split.height > rect.y + rect.height) {
return split.height = rect.y + rect.height - split.y;
}
};
splitRect = function(rect, innerRect){
var splits1, top, bottom, left, right, i$, len$, s, splits2, splits, split;
splits1 = [
top = inc("rect/rect")({
x: rect.x,
y: rect.y,
width: rect.width,
height: innerRect.y - rect.y
}), bottom = inc("rect/rect")({
x: rect.x,
y: innerRect.y + innerRect.height,
width: rect.width,
height: rect.y + rect.height - (innerRect.y + innerRect.height)
}), left = inc("rect/rect")({
x: rect.x,
y: innerRect.y,
width: innerRect.x - rect.x,
height: innerRect.height
}), right = inc("rect/rect")({
x: innerRect.x + innerRect.width,
y: innerRect.y,
width: rect.x + rect.width - innerRect.x - innerRect.width,
height: innerRect.height
})
];
for (i$ = 0, len$ = splits1.length; i$ < len$; ++i$) {
s = splits1[i$];
validateSplit(rect, s);
}
splits2 = [
top = inc("rect/rect")({
x: innerRect.x,
y: rect.y,
width: innerRect.width,
height: innerRect.y - rect.y
}), bottom = inc("rect/rect")({
x: innerRect.x,
y: innerRect.y + innerRect.height,
width: innerRect.width,
height: rect.y + rect.height - (innerRect.y + innerRect.height)
}), left = inc("rect/rect")({
x: rect.x,
y: rect.y,
width: innerRect.x - rect.x,
height: rect.height
}), right = inc("rect/rect")({
x: innerRect.x + innerRect.width,
y: rect.y,
width: rect.x + rect.width - innerRect.x - innerRect.width,
height: rect.height
})
];
for (i$ = 0, len$ = splits2.length; i$ < len$; ++i$) {
s = splits2[i$];
validateSplit(rect, s);
}
splits = _.maxBy(splits1, "area") > _.maxBy(splits2, "area") ? splits1 : splits2;
for (i$ = 0, len$ = splits.length; i$ < len$; ++i$) {
split = splits[i$];
if (split.width > 0 && split.height > 0) {
spaces.push(split);
}
}
return spaces = _.sortBy(spaces, ["area"]);
};
placeElement = function(rect, element){
var offset, x, y, innerRect;
rect == null && (rect = mainRect);
offset = element.offset();
x = rect.x + Math.random() * (rect.width - offset.width);
y = rect.y + Math.random() * (rect.height - offset.height);
innerRect = inc("rect/rect")({
x: x,
y: y,
width: offset.width,
height: offset.height
});
splitRect(rect, innerRect);
return element.css({
left: x + "px",
top: y + "px",
opacity: 1
});
};
elements = _.sortBy(o.elements, [function(e){
return e.offset().width;
}]);
for (i$ = 0, len$ = elements.length; i$ < len$; ++i$) {
e = elements[i$];
e.css({
opacity: 0
});
}
return _.forEach(elements, function(element){
var e, offset;
e = elements.pop();
offset = e.offset();
return placeElement(spaces.pop(), e);
});
};
})();
shared/randomizePositions/layoutSpaceDivide/rect/rect.ls
(function(){
return function(o){
var rect;
rect = {
x: o.x,
y: o.y,
width: o.width,
height: o.height
};
rect.area = rect.width * rect.height;
return rect;
};
})();
shared/randomizePositions/randomize.ls
(function(){
return function(elements, parent){
inc("layoutSpaceDivide/layout")({
elements: elements,
width: parent.width(),
height: parent.height(),
margin: 5
});
return inc("layoutForce/layout")({
elements: elements,
parentOffset: parent.offset(),
margin: 5,
animated: false
});
};
})();
shared/removeBracket/remove.ls
(function(){
return function(s){
var a, s2, i$, len$, p;
s = s.split("(").join("|||(");
s = s.split(")").join(")|||");
a = s.split("|||");
s2 = "";
for (i$ = 0, len$ = a.length; i$ < len$; ++i$) {
p = a[i$];
if (p[0] !== "(") {
s2 += p;
}
}
s2 = s2.trim();
s2 = s2.replace(/\s\s+/g, " ");
return s2;
};
})();
shared/score/feedback/addTrainerSpecificFeedback/add.ls
(function(){
return function(feedbackAll, slide, atom, action){
var trainer, o, ref$;
trainer = slide.trainerParams.trainer;
if (trainer === "findAll" && atom.objects != null) {
o = _.find(atom.objects, function(obj){
return obj['class'] === (action != null ? action['class'] : void 8);
});
return (ref$ = slide.getParam("feedback", o)) != null ? ref$ : feedbackAll;
} else {
return feedbackAll;
}
};
})();
shared/score/feedback/calcFeedback/calc.ls
(function(){
return function(action, feedback, feedbackType){
var index, ref$;
index = ((ref$ = action != null ? action.mixedGapIndex : void 8) != null
? ref$
: (ref$ = action != null ? action.gap : void 8) != null
? ref$
: action != null ? action.index : void 8) + 1;
return feedback = index
? (ref$ = feedback != null ? feedback[feedbackType + index] : void 8) != null
? ref$
: feedback != null ? feedback[feedbackType] : void 8
: feedback != null ? feedback[feedbackType] : void 8;
};
})();
shared/score/feedback/feedback.ls
(function(){
return function(slide, atom, action, feedbackType, callback){
var feedbackAll, feedback;
feedbackAll = slide.getParam("feedback", atom);
if (feedbackAll != null && feedbackAll.text) {
debug("warning: feedback malformed. the feedback text must be defined underneath a correct/wrong/end/finish property", feedbackAll);
}
feedbackAll = inc("addTrainerSpecificFeedback/add")(feedbackAll, slide, atom, action);
feedback = inc("calcFeedback/calc")(action, feedbackAll, feedbackType);
if (!feedback) {
if (typeof callback == 'function') {
callback();
}
return;
}
return inc("/shared/feedback/feedback")(feedback, slide, callback);
};
})();
shared/score/getScoreEvent/get.ls
(function(){
return function(slide, atom){
var scoreEvent;
if (atom) {
return scoreEvent = _.find(slide.levelParams.scoreEvents, function(e){
return e.matchingAtom === atom;
});
} else {
return scoreEvent = _.find(slide.levelParams.scoreEvents, function(e){
return e.matchingTrainer === slide.trainerParams;
});
}
};
})();
shared/score/score.ls
(function(){
return function(slide){
var scores, getScore, feedback, addActionRetry, addActionResolved, addActionCorrect, addActionMistake, log, logUnloggedAtoms, getScoreEvent;
scores = [];
getScore = function(atom){
var score;
score = _.find(scores, function(s){
return s.atom === atom;
});
if (!score) {
scores.push(score = {
atom: atom,
score: inc("score/score")(slide, atom)
});
}
return score.score;
};
feedback = inc("feedback/feedback");
addActionRetry = function(atom, action, callback){
var s;
s = getScore(atom);
s.addActionRetry(action);
return feedback(slide, atom, action, "retry", callback);
};
addActionResolved = function(atom, action, callback){
var s;
s = getScore(atom);
s.addActionResolved(action);
return feedback(slide, atom, action, "solution", callback);
};
addActionCorrect = function(atom, action, callback){
var s;
s = getScore(atom);
s.addActionCorrect(action);
return feedback(slide, atom, action, "correct", callback);
};
addActionMistake = function(atom, action, callback){
var s;
s = getScore(atom);
s.addActionMistake(action);
return feedback(slide, atom, action, "wrong", callback);
};
log = function(atom, callback){
var s;
s = getScore(atom);
s.log();
return feedback(slide, atom, null, "end", callback);
};
logUnloggedAtoms = function(type){
var i$, ref$, len$, s, results$ = [];
for (i$ = 0, len$ = (ref$ = scores).length; i$ < len$; ++i$) {
s = ref$[i$];
s = s.score;
if (!s.isLogged()) {
results$.push(s.log({
type: type
}));
}
}
return results$;
};
getScoreEvent = function(atom){
return inc("getScoreEvent/get")(slide, atom);
};
return slide.score = {
addActionCorrect: addActionCorrect,
addActionMistake: addActionMistake,
addActionResolved: addActionResolved,
addActionRetry: addActionRetry,
getScoreEvent: getScoreEvent,
log: log,
logUnloggedAtoms: logUnloggedAtoms,
totalScoredAtoms: function(){
return scores.length;
}
};
};
})();
shared/score/score/score.ls
(function(){
return function(slide, atom){
var isLogged, score, ref$, addAction, addActionRetry, addActionResolved, addActionCorrect, addActionMistake, logScore;
isLogged = false;
if (!slide.lastScoreActionAt) {
slide.lastScoreActionAt = slide.slideStartedAt;
}
score = {
mistakes: 0,
actions: [],
levelPuid: slide.levelParams.puid,
round: (ref$ = slide.levelPlayer) != null ? ref$.round : void 8,
trainer: slide.trainerParams.trainer,
level: inc("/../app01/lib/util/projectPath/path")(slide.levelParams.path)
};
if (_.isArray(atom)) {
score.atoms = atom;
} else {
score.atom = atom;
}
addAction = function(action){
var now;
now = new Date();
action.position = _.round((new Date() - slide.levelPlayer.startedAt) / 100, 0);
action.duration = _.round((now - slide.lastScoreActionAt) / 100, 0);
slide.lastScoreActionAt = now;
return score.actions.push(action);
};
addActionRetry = function(a){
var a2;
a2 = _.cloneDeep(a || {});
a2.retry = true;
return addAction(a2);
};
addActionResolved = function(a){
var a2;
a2 = _.cloneDeep(a || {});
a2.resolved = true;
return addAction(a2);
};
addActionCorrect = function(a){
var a2;
a2 = _.cloneDeep(a || {});
a2.correct = true;
return addAction(a2);
};
addActionMistake = function(a){
var a2;
a2 = _.cloneDeep(a || {});
a2.correct = false;
score.mistakes++;
return addAction(a2);
};
logScore = function(o){
var e, p, ref$, v;
isLogged = true;
e = {
event: "score"
};
if ((o != null ? o.unfinished : void 8) === true) {
e.unfinished = true;
}
for (p in ref$ = score) {
v = ref$[p];
if (!_.isFunction(v)) {
e[p] = v;
}
}
return slide.levelPlayer.log.log(e);
};
return {
addActionCorrect: addActionCorrect,
addActionMistake: addActionMistake,
addActionResolved: addActionResolved,
addActionRetry: addActionRetry,
log: logScore,
isLogged: function(){
return isLogged;
}
};
};
})();
shared/scoreActionRow/_t.ls
(function(){
return {
secAbbrev: {
de: "s",
en: "s",
fr: " sec",
es: "s",
pt: "s"
}
};
})();
shared/scoreActionRow/duration/duration.ls
(function(){
return function(action){
var d, ref$;
if (!action.duration) {
return;
}
d = _.round(action.duration / 10, 1);
d = d.toFixed(1);
if ((ref$ = engine.guiLanguage) === "de" || ref$ === "fr") {
d = d.replace(".", ",");
}
return Div({
position: "absolute",
right: 0,
top: 0,
color: Color.grey[500],
padding: "0.4em 0.6em"
}).append(Div({
display: "inline-block"
}).html(d + T("secAbbrev")));
};
})();
shared/scoreActionRow/iconScore/icon.ls
(function(){
return function(action){
return SvgIcon({
svg: action.correct
? path("/../app01/lib/svg/illustration/feedback-correct.svg")
: action.resolved
? path("/../app01/lib/svg/illustration/feedback-resolved.svg")
: action.retry
? path("/../app01/lib/svg/illustration/feedback-retry.svg")
: path("/../app01/lib/svg/illustration/feedback-wrong.svg")
}).css({
position: "absolute",
left: "0.4em",
top: "0.57em"
});
};
})();
shared/scoreActionRow/row.ls
(function(){
return function(action){
return Div({
padding: "0.4em 3em 0.5em 1.8em",
marginBottom: "0.4em",
backgroundColor: Color.grey[150]
}).append(inc("iconScore/icon")(action), inc("duration/duration")(action));
};
})();
shared/scoreActionRowFlex/_t.ls
(function(){
return {
secAbbrev: {
de: "s",
en: "s",
fr: " sec",
es: "s",
pt: "s"
}
};
})();
shared/scoreActionRowFlex/duration/duration.ls
(function(){
return function(action){
var d, ref$;
if (!action.duration) {
return;
}
d = _.round(action.duration / 10, 1);
d = d.toFixed(1);
if ((ref$ = engine.guiLanguage) === "de" || ref$ === "fr") {
d = d.replace(".", ",");
}
return Div({
color: Color.grey[500],
padding: "0.4em 0.6em"
}).append(Div({
display: "inline-block"
}).html(d + T("secAbbrev")));
};
})();
shared/scoreActionRowFlex/iconScore/icon.ls
(function(){
return function(action){
return SvgIcon({
svg: action.correct
? path("/../app01/lib/svg/illustration/feedback-correct.svg")
: action.resolved
? path("/../app01/lib/svg/illustration/feedback-resolved.svg")
: path("/../app01/lib/svg/illustration/feedback-wrong.svg")
}).css({
margin: "0.3em"
});
};
})();
shared/scoreActionRowFlex/row.ls
(function(){
return function(action, centerHtml){
var div;
div = Div();
return div.css({
display: "flex",
padding: "0.2em",
marginBottom: "0.4em",
backgroundColor: Color.grey[150]
}).append(inc("iconScore/icon")(action), Div({
flex: "1 1 auto"
}).append(centerHtml), inc("duration/duration")(action));
};
})();
shared/slide/calcTotalProgressElements/calc.ls
(function(){
return function(slide){
return function(onDone){
var path, calcFunction;
path = slide.trainerFolder + "/_calcTotalProgressElements/calc";
calcFunction = inc(path, {
silentError: true
});
if (_.isFunction(calcFunction)) {
return calcFunction(slide, onDone);
} else {
return onDone();
}
};
};
})();
shared/slide/finish/finish.ls
(function(){
return function(slide){
var enableFinishSoundNext;
enableFinishSoundNext = typeof deviceLog != 'undefined' && deviceLog !== null ? deviceLog['var']("finishSoundNext") : void 8;
if (enableFinishSoundNext === "v1" || enableFinishSoundNext === "v2" || enableFinishSoundNext === "v3") {
if (enableFinishSoundNext === "v1") {
return inc("finishV1/finish")(slide);
}
if (enableFinishSoundNext === "v2") {
return inc("finishV2/finish")(slide);
}
if (enableFinishSoundNext === "v3") {
return inc("finishV3/finish")(slide);
}
}
return function(onFinish){
var ref$, button, callback, playFinishSound, showFinishFeedback, showFinishButton;
if ((ref$ = body.findFirst(".feedbackContainer")) != null && ref$.isVisible()) {
slide.finishAfterFeedback = true;
return;
}
button = null;
callback = function(){
return (typeof onFinish == 'function' ? onFinish() : void 8) || slide.onFinishedSlide();
};
playFinishSound = function(){
var atom, ref$, finishSound, ref1$, voice;
atom = (ref$ = slide.atom) != null && ref$.finishSound ? slide.atom : void 8;
finishSound = slide.getParam("finishSound", atom);
if (finishSound) {
if ((ref1$ = slide.instruction) != null) {
ref1$.stop();
}
if (slide.finishButton === true) {
setTimeout(showFinishButton, 3000);
}
voice = slide.getParam("voice", atom);
return slide.sounds[finishSound + voice].play(showFinishFeedback);
} else {
return showFinishFeedback();
}
};
showFinishFeedback = function(){
var atom, ref$, ref1$, feedback, ref2$;
atom = (ref$ = slide.atom) != null && ((ref1$ = ref$.feedback) != null && ref1$.finish) ? slide.atom : void 8;
feedback = (ref2$ = slide.getParam("feedback", atom)) != null ? ref2$.finish : void 8;
if (feedback) {
return inc("/shared/feedback/feedback")(feedback, slide, showFinishButton);
} else {
return showFinishButton();
}
};
showFinishButton = function(){
if (!slide.finishButton) {
slide.levelPlayer.page.bottom.empty().hide();
return callback();
} else if (button == null) {
button = inc("/shared/continueButton/button")(callback);
button.prepend(slide.divBeforeFinishButton);
return button.showButton();
}
};
return playFinishSound();
};
};
})();
shared/slide/finish/finishV1/continueSpeakerButton/button.ls
(function(){
return function(sound, callback, label){
var children, bottom, tap, showButton, div, speaker;
children = null;
bottom = app.currentPage.bottom;
tap = function(){
div.css({
pointerEvents: "none"
});
return bottom.keyframeAnimate({
keyframes: {
"0%": {
transform: "translateY(0%)"
},
"100%": {
transform: "translateY(100%)"
}
},
duration: 400,
delay: 100,
onCompleted: function(){
sound.stop();
div.remove();
bottom.css({
transform: ""
}).append(children);
return callback();
}
});
};
showButton = function(){
var h;
if (app.currentPage.levelPlayer == null) {
return;
}
children = bottom.childrenAll();
bottom.html(div).show();
h = div.height();
return div.keyframeAnimate({
keyframes: {
"0%": {
height: "0px"
},
"100%": {
height: h + "px"
}
},
duration: 500,
onCompleted: function(){
return div.css({
height: ""
});
}
});
};
div = Div();
div.css({
textAlign: "center"
}).addClass("continueSpeakerButton").html(Button(label).css({
margin: "0.8em",
textAlign: "center",
color: Color.grey[800]
}).prepend(speaker = inc("/../app01/lib/gui/speakerAnimate/speakerAnimate")({
progressbarType: "below",
progressBarFillDirection: "left",
speakerType: "123",
size: "1.8em"
}).css({
marginRight: "0.5em"
})).tap(tap).addClass("keyManager-enter").bind("keyManager", tap));
speaker.findFirst(".progressBarVolume").css({
backgroundColor: Color.grey[600]
});
speaker.findFirst(".speaker").setColor(Color.grey[600]);
div.showButton = showButton;
div.speaker = speaker;
return div;
};
})();
shared/slide/finish/finishV1/finish.ls
(function(){
return function(slide){
return function(onFinish){
var ref$, callback, playFinishSound, showFinishFeedback, showFinishButton;
if ((ref$ = body.findFirst(".feedbackContainer")) != null && ref$.isVisible()) {
slide.finishAfterFeedback = true;
return;
}
callback = function(){
return (typeof onFinish == 'function' ? onFinish() : void 8) || slide.onFinishedSlide();
};
playFinishSound = function(){
return inc("playFinishSound/play")(slide, callback, showFinishFeedback, showFinishButton);
};
showFinishFeedback = function(){
return inc("showFinishFeedback/show")(slide, callback, showFinishButton);
};
showFinishButton = function(){
return inc("showFinishButton/show")(slide, callback);
};
return playFinishSound();
};
};
})();
shared/slide/finish/finishV1/playFinishSound/play.ls
(function(){
return function(slide, callback, showFinishFeedback, showFinishButton){
var atom, ref$, finishSound, ref1$, voice, sound;
atom = (ref$ = slide.atom) != null && ref$.finishSound ? slide.atom : void 8;
finishSound = slide.getParam("finishSound", atom);
if (slide.getParam("feedback", atom)) {
callback = showFinishFeedback;
}
if (finishSound) {
if ((ref1$ = slide.instruction) != null) {
ref1$.stop();
}
voice = slide.getParam("voice", atom);
sound = slide.sounds[finishSound + voice];
inc("../showFinishSound/show")(slide, sound, callback);
return sound.play(callback, slide.speakerButton.speaker.update);
} else {
return showFinishFeedback();
}
};
})();
shared/slide/finish/finishV1/showFinishButton/show.ls
(function(){
return function(slide, callback){
var disableAnimation, ref$;
if (!slide.finishButton) {
slide.levelPlayer.page.bottom.empty().hide();
return callback();
} else if (slide.continuebutton == null) {
disableAnimation = (ref$ = slide.speakerButton) != null ? ref$.isVisible() : void 8;
slide.continuebutton = inc("/shared/continueButton/button")(callback, disableAnimation);
slide.continuebutton.prepend(slide.divBeforeFinishButton);
return slide.continuebutton.showButton();
}
};
})();
shared/slide/finish/finishV1/showFinishFeedback/show.ls
(function(){
return function(slide, callback, showFinishButton){
var atom, ref$, ref1$, feedback, ref2$;
atom = (ref$ = slide.atom) != null && ((ref1$ = ref$.feedback) != null && ref1$.finish) ? slide.atom : void 8;
feedback = (ref2$ = slide.getParam("feedback", atom)) != null ? ref2$.finish : void 8;
if (feedback) {
return inc("/shared/feedback/feedback")(feedback, slide, showFinishButton);
} else if (slide.finishButton) {
return showFinishButton();
} else {
slide.levelPlayer.page.bottom.empty().hide();
return callback();
}
};
})();
shared/slide/finish/finishV1/showFinishSound/calcLabel/calc.ls
(function(){
return function(slide){
var atom, ref$;
atom = (ref$ = slide.atom) != null && ref$.finishSound ? slide.atom : void 8;
if (!slide.getParam("feedback", atom)) {
return "Weiter";
} else {
return null;
}
};
})();
shared/slide/finish/finishV1/showFinishSound/show.ls
(function(){
return function(slide, sound, callback){
var label;
label = inc("calcLabel/calc")(slide);
slide.speakerButton = inc("../continueSpeakerButton/button")(sound, callback, label);
slide.speakerButton.prepend(slide.divBeforeFinishButton);
return slide.speakerButton.showButton();
};
})();
shared/slide/finish/finishV2/continueSpeakerButton/button.ls
(function(){
return function(sound){
var children, bottom, showIcon, div, speaker;
children = null;
bottom = app.currentPage.bottom;
showIcon = function(){
var h;
if (app.currentPage.levelPlayer == null) {
return;
}
children = bottom.childrenAll();
bottom.html(div).show();
h = div.height();
return div.keyframeAnimate({
keyframes: {
"0%": {
height: "0px"
},
"100%": {
height: h + "px"
}
},
duration: 500,
onCompleted: function(){
return div.css({
height: ""
});
}
});
};
div = Div();
div.css({
margin: "0.8em",
textAlign: "center",
display: "flex"
}).addClass("continueSpeakerButton").html(speaker = inc("/../app01/lib/gui/speakerAnimate/speakerAnimate")({
progressbarType: "below",
progressBarFillDirection: "left",
speakerType: "123",
size: "1.8em"
}).css({
marginRight: "0.5em"
}));
speaker.findFirst(".progressBarVolume").css({
backgroundColor: Color.grey[600]
});
speaker.findFirst(".speaker").setColor(Color.grey[600]);
div.showIcon = showIcon;
div.speaker = speaker;
return div;
};
})();
shared/slide/finish/finishV2/finish.ls
(function(){
return function(slide, enableFinishSoundNext){
return function(onFinish){
var ref$, callback, playFinishSound, showFinishFeedback, showFinishButton;
if ((ref$ = body.findFirst(".feedbackContainer")) != null && ref$.isVisible()) {
slide.finishAfterFeedback = true;
return;
}
callback = function(){
return (typeof onFinish == 'function' ? onFinish() : void 8) || slide.onFinishedSlide();
};
playFinishSound = function(){
return inc("playFinishSound/play")(slide, callback, showFinishFeedback, showFinishButton);
};
showFinishFeedback = function(){
return inc("showFinishFeedback/show")(slide, callback, showFinishButton);
};
showFinishButton = function(){
return inc("showFinishButton/show")(slide, callback);
};
return playFinishSound();
};
};
})();
shared/slide/finish/finishV2/playFinishSound/play.ls
(function(){
return function(slide, callback, showFinishFeedback, showFinishButton){
var atom, ref$, finishSound, that, ref1$;
atom = (ref$ = slide.atom) != null && ref$.finishSound ? slide.atom : void 8;
finishSound = slide.getParam("finishSound", atom);
if (slide.getParam("feedback", atom)) {
callback = showFinishFeedback;
}
if (that = finishSound) {
if ((ref1$ = slide.instruction) != null) {
ref1$.stop();
}
inc("showFinishButton/show")(slide, callback);
return inc("playSound/play")(slide, showFinishFeedback, atom, that);
} else {
return showFinishFeedback();
}
};
})();
shared/slide/finish/finishV2/playFinishSound/playSound/play.ls
(function(){
return function(slide, showFinishFeedback, atom, finishSound){
var voice, sound, playSoundCb;
voice = slide.getParam("voice", atom);
sound = slide.sounds[finishSound + voice];
playSoundCb = function(){
inc("../../showFinishSound/show")(slide);
return sound.play(showFinishFeedback, slide.speakerIcon.speaker.update);
};
return inc("playIfNotMuted/play")(playSoundCb, showFinishFeedback);
};
})();
shared/slide/finish/finishV2/playFinishSound/playSound/playIfNotMuted/play.ls
(function(){
return function(playSoundCb, showFinishFeedback){
var antonVolumeMuted, deviceVolumeMuted, muteSwitchEnabled, calcIsMuted, calcDeviceVolume, calcMuteSwitchEnabled;
calcIsMuted = function(){
if (antonVolumeMuted) {
showFinishFeedback();
}
if (window.SolocodePlugin) {
return calcDeviceVolume();
}
};
calcDeviceVolume = function(){
if (engine.isiOsApp) {
return cordova.exec(function(volume){
deviceVolumeMuted = volume === 0;
return calcMuteSwitchEnabled();
}, function(volume){
deviceVolumeMuted = volume === 0;
return calcMuteSwitchEnabled();
}, "SolocodePlugin", "getVolume", []);
} else {
return SolocodePlugin.getVolume(function(volume, error){
deviceVolumeMuted = volume === 0;
if (deviceVolumeMuted) {
showFinishFeedback();
} else {
return playSoundCb();
}
});
}
};
calcMuteSwitchEnabled = function(){
return SolocodePlugin.getMuteSwitchEnabled(function(isEnabled){
muteSwitchEnabled = isEnabled;
if (muteSwitchEnabled && deviceVolumeMuted) {
showFinishFeedback();
} else {
return playSoundCb();
}
});
};
return calcIsMuted();
};
})();
shared/slide/finish/finishV2/playFinishSound/showFinishButton/continueButton/button.ls
(function(){
return function(callback){
var click, button;
click = function(){
return callback();
};
return button = Button({
key: "enter",
action: click,
label: T("continueButton"),
icon: path("/../app01/lib/svg/icon/arrow-right-small.svg"),
iconPosition: "right",
state: "disabled"
}).css({
margin: "0.8em",
backgroundClip: "border-box"
});
};
})();
shared/slide/finish/finishV2/playFinishSound/showFinishButton/show.ls
(function(){
return function(slide, callback){
var atom, ref$, ref1$, ref2$;
atom = (ref$ = slide.atom) != null && ((ref1$ = ref$.feedback) != null && ref1$.finish) ? slide.atom : void 8;
if (slide.continueButton == null && !((ref2$ = slide.getParam("feedback", atom)) != null && ref2$.finish)) {
slide.continueButton = inc("/shared/continueButton/button/button")(callback);
slide.continueButton = inc("continueButton/button")(callback);
return slide.speakerIcon.append(slide.continueButton);
}
};
})();
shared/slide/finish/finishV2/showFinishButton/show.ls
(function(){
return function(slide, callback){
var atom, ref$, ref1$, ref2$, disableAnimation, ref3$;
atom = (ref$ = slide.atom) != null && ((ref1$ = ref$.feedback) != null && ref1$.finish) ? slide.atom : void 8;
if (!((ref2$ = slide.getParam("feedback", atom)) != null && ref2$.finish)) {
slide.continueButton.setState("normal");
}
if (!slide.finishButton) {
slide.levelPlayer.page.bottom.empty().hide();
return callback();
} else if (slide.continuebutton == null) {
disableAnimation = (ref3$ = slide.speakerButton) != null ? ref3$.isVisible() : void 8;
slide.continuebutton = inc("/shared/continueButton/button")(callback, disableAnimation);
slide.continuebutton.prepend(slide.divBeforeFinishButton);
return slide.continuebutton.showButton();
}
};
})();
shared/slide/finish/finishV2/showFinishFeedback/show.ls
(function(){
return function(slide, callback, showFinishButton){
var atom, ref$, ref1$, feedback, ref2$;
atom = (ref$ = slide.atom) != null && ((ref1$ = ref$.feedback) != null && ref1$.finish) ? slide.atom : void 8;
feedback = (ref2$ = slide.getParam("feedback", atom)) != null ? ref2$.finish : void 8;
if (feedback) {
return inc("/shared/feedback/feedback")(feedback, slide, showFinishButton);
} else if (slide.finishButton) {
return slide.continueButton.setState("normal");
} else {
slide.levelPlayer.page.bottom.empty().hide();
return callback();
}
};
})();
shared/slide/finish/finishV2/showFinishSound/calcLabel/calc.ls
(function(){
return function(slide){
var atom, ref$;
atom = (ref$ = slide.atom) != null && ref$.finishSound ? slide.atom : void 8;
if (!slide.getParam("feedback", atom)) {
return "Weiter";
} else {
return null;
}
};
})();
shared/slide/finish/finishV2/showFinishSound/show.ls
(function(){
return function(slide, sound, callback){
slide.speakerIcon = inc("../continueSpeakerButton/button")(sound);
slide.speakerIcon.prepend(slide.divBeforeFinishButton);
return slide.speakerIcon.showIcon();
};
})();
shared/slide/finish/finishV3/finish.ls
(function(){
return function(slide){
return function(onFinish){
var ref$, finishSlide, playFinishSound, showFinishFeedback, showFinishButton;
if ((ref$ = body.findFirst(".feedbackContainer")) != null && ref$.isVisible()) {
slide.finishAfterFeedback = true;
return;
}
finishSlide = function(){
slide.levelPlayer.page.bottom.empty().hide();
return (typeof onFinish == 'function' ? onFinish() : void 8) || slide.onFinishedSlide();
};
playFinishSound = function(){
return inc("playFinishSound/play")(slide, finishSlide, showFinishFeedback, showFinishButton);
};
showFinishFeedback = function(){
return inc("showFinishFeedback/show")(slide, finishSlide, showFinishButton);
};
showFinishButton = function(){
return inc("showFinishButton/show")(slide, finishSlide);
};
return playFinishSound();
};
};
})();
shared/slide/finish/finishV3/playFinishSound/play.ls
(function(){
return function(slide, finishSlide, showFinishFeedback, showFinishButton){
var atom, ref$, finishSound, onDone, ref1$, voice, sound, speakerDiv, that;
atom = (ref$ = slide.atom) != null && ref$.finishSound ? slide.atom : void 8;
finishSound = slide.getParam("finishSound", atom);
onDone = slide.getParam("feedback", atom)
? showFinishFeedback
: slide.finishButton ? showFinishButton : finishSlide;
if (finishSound) {
if ((ref1$ = slide.instruction) != null) {
ref1$.stop();
}
voice = slide.getParam("voice", atom);
sound = slide.sounds[finishSound + voice];
speakerDiv = inc("speakerDiv/div")(sound);
if (that = slide.divBeforeFinishButton) {
speakerDiv.prepend(that);
}
if (finishSound.split(" ").length > 1) {
speakerDiv.showSpeaker();
}
return sound.play(onDone, speakerDiv.speaker.update);
} else {
return onDone();
}
};
})();
shared/slide/finish/finishV3/playFinishSound/speakerDiv/div.ls
(function(){
return function(sound){
var div, speaker;
div = Div({
textAlign: "center"
}).html(speaker = inc("/../app01/lib/gui/speakerAnimate/speakerAnimate")({
progressbarType: "below",
progressBarFillDirection: "left",
speakerType: "123",
size: "1.8em"
}).css({
marginRight: "0.5em",
margin: "0.8em",
textAlign: "center",
color: Color.grey[800]
}).addClass("speaker"));
div.speaker = speaker;
div.showSpeaker = function(){
return inc("showSpeaker/show")(div);
};
return div;
};
})();
shared/slide/finish/finishV3/playFinishSound/speakerDiv/showSpeaker/show.ls
(function(){
return function(div){
if (app.currentPage.levelPlayer == null) {
return;
}
app.currentPage.bottom.html(div).show();
return div.keyframeAnimate({
keyframes: {
"0%": {
height: "0px"
},
"100%": {
height: div.height() + "px"
}
},
duration: 500,
onCompleted: function(){
return div.css({
height: ""
});
}
});
};
})();
shared/slide/finish/finishV3/showFinishButton/show.ls
(function(){
return function(slide, finishSlide){
var disableAnimation, ref$;
if (!slide.finishButton) {
return finishSlide();
} else if (slide.continuebutton == null) {
disableAnimation = (ref$ = slide.speakerButton) != null ? ref$.isVisible() : void 8;
slide.continuebutton = inc("/shared/continueButton/button")(finishSlide, disableAnimation);
slide.continuebutton.prepend(slide.divBeforeFinishButton);
return slide.continuebutton.showButton();
}
};
})();
shared/slide/finish/finishV3/showFinishFeedback/show.ls
(function(){
return function(slide, finishSlide, showFinishButton){
var atom, ref$, ref1$, feedback, ref2$, onDone;
atom = (ref$ = slide.atom) != null && ((ref1$ = ref$.feedback) != null && ref1$.finish) ? slide.atom : void 8;
feedback = (ref2$ = slide.getParam("feedback", atom)) != null ? ref2$.finish : void 8;
onDone = slide.finishButton ? showFinishButton : finishSlide;
if (feedback) {
return inc("/shared/feedback/feedback")(feedback, slide, showFinishButton);
} else {
return onDone();
}
};
})();
shared/slide/heapInfo/info.ls
(function(){
return function(slide){
return inc("/../app01/lib/util/heapInfo/info")("trainer_slide_" + slide.trainerParams.trainer);
};
})();
shared/slide/init/init.ls
(function(){
return function(slide, folder){
return function(){
return inc(folder + "/init")(slide);
};
};
})();
shared/slide/loadMediaFiles/_calcFileMasterEtag/calc.ls
(function(){
return function(slide, fileId){
var fileType, levelMediaFiles, ref$, masterEtag, ref1$;
fileType = fileId.split("/")[0];
levelMediaFiles = (ref$ = slide.levelParams.mediaFiles) != null ? ref$[fileType + "s"] : void 8;
masterEtag = (ref1$ = _.find(levelMediaFiles, {
fileId: fileId
})) != null ? ref1$.etag : void 8;
if (masterEtag) {
return masterEtag;
} else {
return "latest";
}
};
})();
shared/slide/loadMediaFiles/_calcMediaArray/calc.ls
(function(){
return function(slide, type){
var path, a, project, file, items;
path = slide.trainerFolder + ("/_media2/" + type + "/" + type);
a = path.split("/");
project = a[2];
file = a.slice(3).join("/") + ".ls";
items = projects.documentCache[project][file]
? inc(path)(slide)
: [];
items = _.ensureArray(items);
items = _.filter(items, function(i){
return i != null;
});
items = _.uniqWith(items, _.isEqual);
return items;
};
})();
shared/slide/loadMediaFiles/_calcSubfolder/calc.ls
(function(){
return function(slide){
var project, subfolder;
project = slide.levelParams.path.split("/")[2];
return subfolder = _.startsWith(project, "LL-")
? "learnLists/" + project + "/"
: "content/" + project + "/";
};
})();
shared/slide/loadMediaFiles/convertToOldMediaParams/convert.ls
(function(){
return function(slide){
var mediaFiles, mediaParams;
mediaFiles = slide.mediaFiles;
mediaParams = {
sounds: [],
images: [],
svgs: [],
lsgs: {}
};
inc("sounds/sounds")(mediaFiles, mediaParams);
inc("images/images")(mediaFiles, mediaParams);
inc("svgs/svgs")(mediaFiles, mediaParams);
inc("lsgs/lsgs")(mediaFiles, mediaParams);
return slide.mediaParams = mediaParams;
};
})();
shared/slide/loadMediaFiles/convertToOldMediaParams/images/images.ls
(function(){
return function(mediaFiles, mediaParams){
var i$, ref$, len$, image, a, results$ = [];
for (i$ = 0, len$ = (ref$ = mediaFiles.images).length; i$ < len$; ++i$) {
image = ref$[i$];
a = image.fileId.split("/");
results$.push(mediaParams.images.push({
id: a[1],
base64: image.fileContent,
url: image.url
}));
}
return results$;
};
})();
shared/slide/loadMediaFiles/convertToOldMediaParams/lsgs/lsgs.ls
(function(){
return function(mediaFiles, mediaParams){
var i$, ref$, len$, lsg, path, results$ = [];
for (i$ = 0, len$ = (ref$ = mediaFiles.lsgs).length; i$ < len$; ++i$) {
lsg = ref$[i$];
path = "/../" + lsg.fileId.substr(4);
results$.push(mediaParams.lsgs[path] = lsg.fileContent);
}
return results$;
};
})();
shared/slide/loadMediaFiles/convertToOldMediaParams/sounds/calcMediaParamMultiSound/calc.ls
(function(){
return function(sound, mediaFiles){
var mediaParamSound, childrenSounds, i$, len$, s, fileId, fileContent, e;
mediaParamSound = inc("../calcMediaParamSound/calc")(sound);
childrenSounds = inc("/../app01/lib/util/convertSoundString/convert")(mediaParamSound);
for (i$ = 0, len$ = childrenSounds.length; i$ < len$; ++i$) {
s = childrenSounds[i$];
fileId = "sound/" + s.voiceLang + "/" + s.voice + "/" + s.text;
try {
fileContent = _.find(mediaFiles.sounds, {
fileId: fileId
}).fileContent;
} catch (e$) {
e = e$;
debug(fileId);
}
s.base64 = fileContent;
}
mediaParamSound.data = childrenSounds;
return mediaParamSound;
};
})();
shared/slide/loadMediaFiles/convertToOldMediaParams/sounds/calcMediaParamSound/calc.ls
(function(){
return function(sound){
var fileId, a, voiceLang, voice, text, mediaParamSound;
fileId = sound.fileId;
a = fileId.split("/");
voiceLang = a[1];
voice = a[2];
text = fileId.substr(("sound/" + voice + "/" + voiceLang + "/").length);
if (voice === "null") {
voice = null;
}
return mediaParamSound = {
text: text,
voice: voice,
voiceLang: voiceLang,
data: sound.fileContent
};
};
})();
shared/slide/loadMediaFiles/convertToOldMediaParams/sounds/sounds.ls
(function(){
return function(mediaFiles, mediaParams){
var i$, ref$, len$, sound, results$ = [];
for (i$ = 0, len$ = (ref$ = mediaFiles.sounds).length; i$ < len$; ++i$) {
sound = ref$[i$];
if (!sound.isMultiSound) {
results$.push(mediaParams.sounds.push(inc("calcMediaParamSound/calc")(sound)));
} else if (sound.isMultiSound) {
results$.push(mediaParams.sounds.push(inc("calcMediaParamMultiSound/calc")(sound, mediaFiles)));
}
}
return results$;
};
})();
shared/slide/loadMediaFiles/convertToOldMediaParams/svgs/svgs.ls
(function(){
return function(mediaFiles, mediaParams){
var i$, ref$, len$, svg, path, results$ = [];
for (i$ = 0, len$ = (ref$ = mediaFiles.svgs).length; i$ < len$; ++i$) {
svg = ref$[i$];
path = "/../" + svg.fileId.substr(4);
results$.push(mediaParams.svgs.push({
path: path,
svgText: svg.fileContent
}));
}
return results$;
};
})();
shared/slide/loadMediaFiles/images/images.ls
(function(){
return function(slide, onDone){
var mediaFiles, images, subfolder, totalDone, calcAdditionalImages, loadImages, onImageLoaded, finish;
mediaFiles = slide.mediaFiles;
images = inc("../_calcMediaArray/calc")(slide, "images");
subfolder = inc("../_calcSubfolder/calc")(slide);
totalDone = 0;
calcAdditionalImages = function(){
inc("/shared/calcAdditionalMedia/images/images")(slide, images);
if (images.length === 0) {
return onDone("images");
} else {
return loadImages();
}
};
loadImages = function(){
var i$, ref$, len$, image, results$ = [];
for (i$ = 0, len$ = (ref$ = images).length; i$ < len$; ++i$) {
image = ref$[i$];
results$.push(inc("loadImage/load")(image, slide, subfolder, onImageLoaded));
}
return results$;
};
onImageLoaded = function(){
totalDone++;
if (totalDone === images.length) {
return finish();
}
};
finish = function(){
return onDone("images");
};
return calcAdditionalImages();
};
})();
shared/slide/loadMediaFiles/images/loadImage/load.ls
(function(){
return function(image, slide, subfolder, onLoaded){
var mediaFiles, imageId, fileId, fileFolder, fileApi, etag, load, onImageLoaded, onImageError;
mediaFiles = slide.mediaFiles;
imageId = image.image || image;
fileId = "image/" + imageId;
fileFolder = subfolder + "_images";
fileApi = slide.fileApi;
etag = inc("../../_calcFileMasterEtag/calc")(slide, fileId);
load = function(){
return inc("/../app01/lib/util/downloadContentFile/download")({
fileId: fileId,
fileFolder: fileFolder,
fileApi: fileApi,
etag: etag,
returnFileContent: true,
onLoaded: onImageLoaded,
onError: onImageError
});
};
onImageLoaded = function(image, details){
mediaFiles.images.push({
fileId: details.fileId,
etag: details.responseEtag,
url: details.url,
fileContent: details.fileContent
});
return onLoaded();
};
onImageError = function(error){
mediaFiles.errors.push(error);
return onLoaded();
};
return load();
};
})();
shared/slide/loadMediaFiles/initFonts/getUsedLsgFonts/get.ls
(function(){
return function(slide){
var fonts, id, ref$, lsg, i$, ref1$, len$, o, parts, ref2$, s;
fonts = {};
for (id in ref$ = slide.mediaParams.lsgs) {
lsg = ref$[id];
if (_.endsWith(id, ".lsr")) {
continue;
}
for (i$ = 0, len$ = (ref1$ = _.filter(lsg.objects, {
type: "text"
})).length; i$ < len$; ++i$) {
o = ref1$[i$];
o = _.pick(o, "font", "bold", "italic");
parts = [];
if (o.bold) {
parts.push("bold");
}
if (o.italic) {
parts.push("italic");
}
parts.push("12px");
if ((ref2$ = o.font) !== "Source Sans Pro Solocode" && ref2$ !== "Solocode School") {
if (o.font && o.font !== "Source Sans Pro") {
debug("invalid font in lsg: " + o.font);
}
o.font = "Source Sans Pro Solocode";
}
parts.push(o.font);
s = parts.join(" ");
fonts[s] = o;
}
}
return fonts;
};
})();
shared/slide/loadMediaFiles/initFonts/init.ls
(function(){
return function(slide, onDone){
var fonts, totalFonts, totalDone, loadFonts, onLoaded, ref$;
fonts = inc("getUsedLsgFonts/get")(slide);
totalFonts = _.keys(fonts).length;
totalDone = 0;
loadFonts = function(){
var s, ref$, o, results$ = [];
for (s in ref$ = fonts) {
o = ref$[s];
results$.push(inc("loadFont/load")(s, o, onLoaded));
}
return results$;
};
onLoaded = function(){
totalDone++;
if (totalDone === totalFonts) {
return onDone();
}
};
if (((ref$ = document.fonts) != null ? ref$.check : void 8) == null || engine.isBotMode) {
return onDone();
} else if (totalFonts === 0) {
return onDone();
} else {
return loadFonts();
}
};
})();
shared/slide/loadMediaFiles/initFonts/loadFont/load.ls
(function(){
return function(s, o, onLoaded){
var startedAt, maxDuration, div, f;
if (document.fonts.check(s)) {
onLoaded();
return;
}
startedAt = new Date();
maxDuration = 2000;
div = Div({
position: "absolute",
top: "-1000px",
font: s
}).html("abc").appendTo(body);
f = function(){
var age;
age = new Date() - startedAt;
if (document.fonts.check(s)) {
div.remove();
return onLoaded();
} else if (age > maxDuration) {
return div.remove();
} else {
return setTimeout(f, 30);
}
};
return f();
};
})();
shared/slide/loadMediaFiles/load.ls
(function(){
return function(slide){
slide.loadMediaFilesCallbacks == null && (slide.loadMediaFilesCallbacks = []);
return function(p){
var totalDone, load, onLoaded, checkErrors, convertToOldMediaParams, initFonts, initSounds, finish, onError;
totalDone = 0;
load = function(){
slide.fileApi = p.fileApi;
slide.mediaFiles = {
images: [],
sounds: [],
lsgs: [],
svgs: [],
errors: []
};
inc("images/images")(slide, onLoaded);
inc("lsgs/lsgs")(slide, onLoaded);
inc("sounds/sounds")(slide, p.skipSounds, onLoaded);
return inc("svgs/svgs")(slide, onLoaded);
};
onLoaded = function(type){
totalDone++;
if (totalDone === 4) {
return checkErrors();
}
};
checkErrors = function(){
if (slide.mediaFiles.errors.length > 0) {
return onError();
} else {
return convertToOldMediaParams();
}
};
convertToOldMediaParams = function(){
inc("convertToOldMediaParams/convert")(slide);
return initFonts();
};
initFonts = function(){
return inc("initFonts/init")(slide, initSounds);
};
initSounds = function(){
slide.sounds = !p.skipSounds
? inc("/shared/soundsPre/soundsPre")(slide.mediaParams)
: {};
return finish();
};
finish = function(){
var i$, ref$, len$, p2;
slide.loadMediaFilesCompleted = true;
for (i$ = 0, len$ = (ref$ = slide.loadMediaFilesCallbacks).length; i$ < len$; ++i$) {
p2 = ref$[i$];
if (typeof p2.onDone == 'function') {
p2.onDone();
}
}
return slide.loadMediaFilesCallbacks = [];
};
onError = function(){
var i$, ref$, len$, p2;
slide.loadMediaFilesCompleted = true;
for (i$ = 0, len$ = (ref$ = slide.loadMediaFilesCallbacks).length; i$ < len$; ++i$) {
p2 = ref$[i$];
if (typeof p2.onError == 'function') {
p2.onError(slide.mediaFiles.errors);
}
}
return slide.loadMediaFilesCallbacks = [];
};
if (slide.loadMediaFilesCompleted && !slide.mediaFiles.errors.length > 0) {
return typeof p.onDone == 'function' ? p.onDone() : void 8;
} else {
slide.loadMediaFilesCompleted = false;
slide.loadMediaFilesCallbacks.push(p);
if (slide.loadMediaFilesCallbacks.length === 1) {
return load();
}
}
};
};
})();
shared/slide/loadMediaFiles/lsgs/loadLsgDescriptionMediaFiles/load.ls
(function(){
return function(p){
var loadLsg, loadChildrenSvgs, loadChildrenImages, loadChildrenLsgs, finish;
loadLsg = function(){
return inc("loadLsg/load")(p, loadChildrenSvgs);
};
loadChildrenSvgs = function(){
return inc("loadChildrenSvgs/load")(p, loadChildrenImages);
};
loadChildrenImages = function(){
return inc("loadChildrenImages/load")(p, loadChildrenLsgs);
};
loadChildrenLsgs = function(){
return inc("loadChildrenLsgs/load")(p, finish);
};
finish = function(){
return p.onDone();
};
return loadLsg();
};
})();
shared/slide/loadMediaFiles/lsgs/loadLsgDescriptionMediaFiles/loadChildrenImages/load.ls
(function(){
return function(p, onDone){
var imageObjects, ref$, totalDone, loadImages, onImageLoaded, onImageError;
imageObjects = _.filter((ref$ = p.lsg) != null ? ref$.objects : void 8, {
type: "image"
});
imageObjects = _.uniqBy(imageObjects, "image");
totalDone = 0;
loadImages = function(){
var i$, ref$, len$, o, fileId, fileFolder, fileApi, etag, results$ = [];
for (i$ = 0, len$ = (ref$ = imageObjects).length; i$ < len$; ++i$) {
o = ref$[i$];
fileId = "image/" + o.image;
fileFolder = p.subfolder + "_images";
fileApi = p.slide.fileApi;
etag = inc("../../../_calcFileMasterEtag/calc")(p.slide, fileId);
results$.push(inc("/../app01/lib/util/downloadContentFile/download")({
fileId: fileId,
fileFolder: fileFolder,
fileApi: fileApi,
etag: etag,
returnFileContent: true,
onLoaded: onImageLoaded,
onError: onImageError
}));
}
return results$;
};
onImageLoaded = function(image, details){
p.slide.mediaFiles.images.push({
fileId: details.fileId,
etag: details.responseEtag,
url: details.url,
fileContent: image
});
totalDone++;
if (totalDone === imageObjects.length) {
return onDone();
}
};
onImageError = function(error){
p.slide.mediaFiles.errors.push(error);
totalDone++;
if (totalDone === imageObjects.length) {
return onDone();
}
};
if (imageObjects.length === 0) {
return onDone();
} else {
return loadImages();
}
};
})();
shared/slide/loadMediaFiles/lsgs/loadLsgDescriptionMediaFiles/loadChildrenLsgs/load.ls
(function(){
return function(p, onDone){
var lsgObjects, ref$, totalDone, loadLsgs, onLoaded;
lsgObjects = _.filter((ref$ = p.lsg) != null ? ref$.objects : void 8, {
type: "lsg"
});
totalDone = 0;
loadLsgs = function(){
var i$, ref$, len$, o, results$ = [];
for (i$ = 0, len$ = (ref$ = lsgObjects).length; i$ < len$; ++i$) {
o = ref$[i$];
results$.push(inc("../load")({
lsgDescription: o,
slide: p.slide,
subfolder: p.subfolder,
onDone: onLoaded
}));
}
return results$;
};
onLoaded = function(){
totalDone++;
if (totalDone === lsgObjects.length) {
return onDone();
}
};
if (lsgObjects.length === 0) {
return onDone();
} else {
return loadLsgs();
}
};
})();
shared/slide/loadMediaFiles/lsgs/loadLsgDescriptionMediaFiles/loadChildrenSvgs/load.ls
(function(){
return function(p, onDone){
var svgObjects, ref$, totalDone, loadSvgs, onSvgLoaded, onSvgError;
svgObjects = _.filter((ref$ = p.lsg) != null ? ref$.objects : void 8, function(o){
var ref$;
return o.type === "svg" && ((ref$ = o.svg) != null ? ref$.indexOf("