jclic 2.1.21 → 2.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/jclic-node.js +9 -8
  3. package/dist/jclic-node.js.map +1 -1
  4. package/dist/jclic.min.js +2 -2
  5. package/dist/jclic.min.js.map +1 -1
  6. package/package.json +4 -4
  7. package/src/GlobalData.js +1 -1
  8. package/src/JClicPlayer.js +2 -2
  9. package/src/bags/MediaBag.js +6 -5
  10. package/dist/1078.jclic-node.js +0 -282
  11. package/dist/1078.jclic-node.js.map +0 -1
  12. package/dist/1196.jclic-node.js +0 -808
  13. package/dist/1196.jclic-node.js.map +0 -1
  14. package/dist/1253.jclic-node.js +0 -1432
  15. package/dist/1253.jclic-node.js.map +0 -1
  16. package/dist/13.jclic-node.js +0 -103
  17. package/dist/13.jclic-node.js.map +0 -1
  18. package/dist/1567.jclic-node.js +0 -2313
  19. package/dist/1567.jclic-node.js.map +0 -1
  20. package/dist/1588.jclic-node.js +0 -602
  21. package/dist/1588.jclic-node.js.map +0 -1
  22. package/dist/1725.jclic-node.js +0 -836
  23. package/dist/1725.jclic-node.js.map +0 -1
  24. package/dist/1731.jclic-node.js +0 -438
  25. package/dist/1731.jclic-node.js.map +0 -1
  26. package/dist/1842.jclic-node.js +0 -651
  27. package/dist/1842.jclic-node.js.map +0 -1
  28. package/dist/2160.jclic-node.js +0 -1016
  29. package/dist/2160.jclic-node.js.map +0 -1
  30. package/dist/222.jclic-node.js +0 -129
  31. package/dist/222.jclic-node.js.map +0 -1
  32. package/dist/2316.jclic-node.js +0 -949
  33. package/dist/2316.jclic-node.js.map +0 -1
  34. package/dist/2355.jclic-node.js +0 -371
  35. package/dist/2355.jclic-node.js.map +0 -1
  36. package/dist/2366.jclic-node.js +0 -431
  37. package/dist/2366.jclic-node.js.map +0 -1
  38. package/dist/2379.jclic-node.js +0 -202
  39. package/dist/2379.jclic-node.js.map +0 -1
  40. package/dist/2437.jclic-node.js +0 -450
  41. package/dist/2437.jclic-node.js.map +0 -1
  42. package/dist/2531.jclic-node.js +0 -869
  43. package/dist/2531.jclic-node.js.map +0 -1
  44. package/dist/2608.jclic-node.js +0 -160
  45. package/dist/2608.jclic-node.js.map +0 -1
  46. package/dist/2715.jclic-node.js +0 -554
  47. package/dist/2715.jclic-node.js.map +0 -1
  48. package/dist/277.jclic-node.js +0 -22
  49. package/dist/277.jclic-node.js.map +0 -1
  50. package/dist/2921.jclic-node.js +0 -660
  51. package/dist/2921.jclic-node.js.map +0 -1
  52. package/dist/2952.jclic-node.js +0 -101
  53. package/dist/2952.jclic-node.js.map +0 -1
  54. package/dist/3018.jclic-node.js +0 -421
  55. package/dist/3018.jclic-node.js.map +0 -1
  56. package/dist/3019.jclic-node.js +0 -682
  57. package/dist/3019.jclic-node.js.map +0 -1
  58. package/dist/3231.jclic-node.js +0 -274
  59. package/dist/3231.jclic-node.js.map +0 -1
  60. package/dist/331.jclic-node.js +0 -115
  61. package/dist/331.jclic-node.js.map +0 -1
  62. package/dist/3391.jclic-node.js +0 -276
  63. package/dist/3391.jclic-node.js.map +0 -1
  64. package/dist/3502.jclic-node.js +0 -671
  65. package/dist/3502.jclic-node.js.map +0 -1
  66. package/dist/3653.jclic-node.js +0 -982
  67. package/dist/3653.jclic-node.js.map +0 -1
  68. package/dist/371.jclic.min.js +0 -2
  69. package/dist/371.jclic.min.js.map +0 -1
  70. package/dist/3856.jclic-node.js +0 -575
  71. package/dist/3856.jclic-node.js.map +0 -1
  72. package/dist/4112.jclic-node.js +0 -659
  73. package/dist/4112.jclic-node.js.map +0 -1
  74. package/dist/4123.jclic-node.js +0 -910
  75. package/dist/4123.jclic-node.js.map +0 -1
  76. package/dist/427.jclic-node.js +0 -894
  77. package/dist/427.jclic-node.js.map +0 -1
  78. package/dist/4483.jclic-node.js +0 -327
  79. package/dist/4483.jclic-node.js.map +0 -1
  80. package/dist/4548.jclic-node.js +0 -1078
  81. package/dist/4548.jclic-node.js.map +0 -1
  82. package/dist/466.jclic-node.js +0 -99
  83. package/dist/466.jclic-node.js.map +0 -1
  84. package/dist/485.jclic-node.js +0 -783
  85. package/dist/485.jclic-node.js.map +0 -1
  86. package/dist/4921.jclic-node.js +0 -500
  87. package/dist/4921.jclic-node.js.map +0 -1
  88. package/dist/5091.jclic-node.js +0 -239
  89. package/dist/5091.jclic-node.js.map +0 -1
  90. package/dist/520.jclic-node.js +0 -550
  91. package/dist/520.jclic-node.js.map +0 -1
  92. package/dist/5312.jclic-node.js +0 -1126
  93. package/dist/5312.jclic-node.js.map +0 -1
  94. package/dist/5338.jclic-node.js +0 -212
  95. package/dist/5338.jclic-node.js.map +0 -1
  96. package/dist/5344.jclic-node.js +0 -229
  97. package/dist/5344.jclic-node.js.map +0 -1
  98. package/dist/5550.jclic-node.js +0 -238
  99. package/dist/5550.jclic-node.js.map +0 -1
  100. package/dist/5626.jclic-node.js +0 -614
  101. package/dist/5626.jclic-node.js.map +0 -1
  102. package/dist/5977.jclic-node.js +0 -1081
  103. package/dist/5977.jclic-node.js.map +0 -1
  104. package/dist/6148.jclic-node.js +0 -345
  105. package/dist/6148.jclic-node.js.map +0 -1
  106. package/dist/6176.jclic-node.js +0 -481
  107. package/dist/6176.jclic-node.js.map +0 -1
  108. package/dist/6221.jclic-node.js +0 -1072
  109. package/dist/6221.jclic-node.js.map +0 -1
  110. package/dist/6238.jclic-node.js +0 -718
  111. package/dist/6238.jclic-node.js.map +0 -1
  112. package/dist/6454.jclic-node.js +0 -1413
  113. package/dist/6454.jclic-node.js.map +0 -1
  114. package/dist/6565.jclic-node.js +0 -294
  115. package/dist/6565.jclic-node.js.map +0 -1
  116. package/dist/6579.jclic-node.js +0 -719
  117. package/dist/6579.jclic-node.js.map +0 -1
  118. package/dist/6715.jclic-node.js +0 -148
  119. package/dist/6715.jclic-node.js.map +0 -1
  120. package/dist/6777.jclic-node.js +0 -171
  121. package/dist/6777.jclic-node.js.map +0 -1
  122. package/dist/6782.jclic-node.js +0 -1611
  123. package/dist/6782.jclic-node.js.map +0 -1
  124. package/dist/6847.jclic-node.js +0 -601
  125. package/dist/6847.jclic-node.js.map +0 -1
  126. package/dist/6856.jclic-node.js +0 -252
  127. package/dist/6856.jclic-node.js.map +0 -1
  128. package/dist/696.jclic-node.js +0 -1821
  129. package/dist/696.jclic-node.js.map +0 -1
  130. package/dist/698.jclic-node.js +0 -583
  131. package/dist/698.jclic-node.js.map +0 -1
  132. package/dist/704.jclic-node.js +0 -80
  133. package/dist/704.jclic-node.js.map +0 -1
  134. package/dist/7046.jclic-node.js +0 -735
  135. package/dist/7046.jclic-node.js.map +0 -1
  136. package/dist/7220.jclic-node.js +0 -156
  137. package/dist/7220.jclic-node.js.map +0 -1
  138. package/dist/7257.jclic-node.js +0 -931
  139. package/dist/7257.jclic-node.js.map +0 -1
  140. package/dist/743.jclic-node.js +0 -583
  141. package/dist/743.jclic-node.js.map +0 -1
  142. package/dist/757.jclic-node.js +0 -1072
  143. package/dist/757.jclic-node.js.map +0 -1
  144. package/dist/7781.jclic-node.js +0 -202
  145. package/dist/7781.jclic-node.js.map +0 -1
  146. package/dist/7912.jclic-node.js +0 -2103
  147. package/dist/7912.jclic-node.js.map +0 -1
  148. package/dist/827.jclic-node.js +0 -708
  149. package/dist/827.jclic-node.js.map +0 -1
  150. package/dist/8276.jclic-node.js +0 -409
  151. package/dist/8276.jclic-node.js.map +0 -1
  152. package/dist/8322.jclic-node.js +0 -498
  153. package/dist/8322.jclic-node.js.map +0 -1
  154. package/dist/8641.jclic-node.js +0 -360
  155. package/dist/8641.jclic-node.js.map +0 -1
  156. package/dist/8837.jclic-node.js +0 -651
  157. package/dist/8837.jclic-node.js.map +0 -1
  158. package/dist/8895.jclic-node.js +0 -151
  159. package/dist/8895.jclic-node.js.map +0 -1
  160. package/dist/9072.jclic-node.js +0 -1285
  161. package/dist/9072.jclic-node.js.map +0 -1
  162. package/dist/9078.jclic-node.js +0 -935
  163. package/dist/9078.jclic-node.js.map +0 -1
  164. package/dist/9103.jclic-node.js +0 -718
  165. package/dist/9103.jclic-node.js.map +0 -1
  166. package/dist/9359.jclic-node.js +0 -145
  167. package/dist/9359.jclic-node.js.map +0 -1
  168. package/dist/9409.jclic-node.js +0 -921
  169. package/dist/9409.jclic-node.js.map +0 -1
  170. package/dist/9513.jclic-node.js +0 -720
  171. package/dist/9513.jclic-node.js.map +0 -1
  172. package/dist/9704.jclic-node.js +0 -81
  173. package/dist/9704.jclic-node.js.map +0 -1
  174. package/dist/9950.jclic-node.js +0 -827
  175. package/dist/9950.jclic-node.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"7257.jclic-node.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEuB;AACqC;AACH;AACd;AACY;AACP;;AAEhD;AACA,kBAAkB,yCAAyC,oCAAoC,kDAAkD;AACjJ;AACA;AACA;AACA;AACO,6BAA6B,2DAAQ;AAC5C;AACA;AACA,aAAa,0CAA0C,eAAe,6DAA6D;AACnI;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,mDAAmD,0BAA0B,8EAA8E;AACnK;AACA;AACA,kCAAkC,gEAAa;AAC/C;AACA;AACA,aAAa,0BAA0B,WAAW,yCAAyC;AAC3F,aAAa,gCAAgC;AAC7C;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gBAAgB,+DAAa;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,mCAAmC;AACzE;AACA,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,wDAAS;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC,eAAe;AACf;AACA;AACA;AACA;AACA,MAAM,wDAAM;AACZ;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,6CAAC,mBAAmB,eAAe,YAAY,gBAAgB;AACpF;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA,oBAAoB,8DAAY;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,gBAAgB;AAC7B,eAAe,SAAS;AACxB,6CAA6C;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,oDAAK;AAC7D;AACA;AACA;AACA;AACA;AACA,gBAAgB,oDAAK;AACrB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,sBAAsB,GAAG,YAAY;AAC9D,2BAA2B,UAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,2DAA2D;AACrE;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA,CAAC;;AAED;AACA,qDAAqD;AACrD,UAAU,OAAO;AACjB;;AAEA;AACA,iEAAe,2DAAQ,yDAAyD,EAAC;;;;;;;;;;;;;;;;ACrXjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE6C;AACN;AACiB;AACR;;AAEhD;AACA,uBAAuB,2DAA2D;AAClF,IAAI,2CAA2C,uBAAuB,iDAAiD;AACvH;AACA;AACA;AACA;AACO,4BAA4B,wDAAY;AAC/C;AACA;AACA,aAAa,sCAAsC;AACnD,aAAa,sBAAsB;AACnC,aAAa,sBAAsB;AACnC,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,8BAA8B;AAC3C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,wDAAS;AAC3B,UAAU,oDAAK;AACf,UAAU,wDAAS;AACnB;AACA;;AAEA;AACA;AACA,oBAAoB,eAAe;AACnC;AACA;AACA,iBAAiB,qDAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,qDAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,uEAAuE;AAC7E,aAAa,sCAAsC;AACnD,aAAa,sBAAsB;AACnC,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,gDAAgD;AAC7D,aAAa,8BAA8B;AAC3C,aAAa,8BAA8B;AAC3C;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA,eAAe,wDAAS;AACxB,MAAM,yDAAQ;AACd,MAAM,yDAAQ;AACd;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA,eAAe,wDAAS;AACxB,MAAM,4DAAO;AACb,MAAM,4DAAO;AACb;;AAEA;AACA,sDAAsD,iDAAiD;AACvG;AACA;AACA,aAAa,kCAAkC;AAC/C,eAAe;AACf;AACA;AACA,eAAe,oDAAK;AACpB;;AAEA;AACA,kDAAkD,kDAAkD;AACpG;AACA;AACA,aAAa,kCAAkC;AAC/C,aAAa,kCAAkC;AAC/C,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,eAAe,oDAAK;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED,iEAAe,aAAa,EAAC;;;;;;;;;;;;;AClL7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEwD;;AAExD;;AAEA;AACA,sDAAsD,kDAAkD;AACxG,IAAI,kDAAkD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,aAAa,sBAAsB;AACnC,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA,kDAAkD,0BAA0B;AAC5E,mBAAmB,wDAAS;AAC5B,sBAAsB,oDAAK;AAC3B,oBAAoB,oDAAK;AACzB,2BAA2B,oDAAK;AAChC;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA,gBAAgB,wDAAK;AACrB;;AAEA;AACA;AACA,aAAa,kBAAkB;AAC/B,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;;AAEA;AACA;AACA,oBAAoB,oDAAK;AACzB,sBAAsB,wDAAS,kCAAkC,wDAAS;AAC1E;AACA,oBAAoB,oDAAK;AACzB,wBAAwB,wDAAS,kCAAkC,wDAAS;AAC5E;AACA;;AAEA;AACA;AACA,yBAAyB,oDAAK;AAC9B;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,kBAAkB;AAC/B,aAAa,kCAAkC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,oDAAK;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA,uBAAuB,mDAAmD;AAC1E;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,YAAY,QAAQ;AACpB;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA,YAAY,kCAAkC;AAC9C;AACA;AACA;AACA;AACA,YAAY,mCAAmC;AAC/C;AACA;AACA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED,iEAAe,YAAY,EAAC","sources":["webpack://jclic/./src/activities/puzzles/ExchangePuzzle.js","webpack://jclic/./src/boxes/ActiveBoxGrid.js","webpack://jclic/./src/boxes/BoxConnector.js"],"sourcesContent":["/**\n * File : activities/puzzles/ExchangePuzzle.js\n * Created : 30/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport $ from 'jquery';\nimport { Activity, ActivityPanel } from '../../Activity.js';\nimport ActiveBoxGrid from '../../boxes/ActiveBoxGrid.js';\nimport BoxBag from '../../boxes/BoxBag.js';\nimport BoxConnector from '../../boxes/BoxConnector.js';\nimport { Rectangle, Point } from '../../AWT.js';\n\n/**\n * This class of {@link module:Activity.Activity Activity} shows only one panel with shuffled {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects.\n * To solve the activity, each cell must exchange its location with another one. When all cells are\n * on place, the activity is done.\n * @extends module:Activity.Activity\n */\nexport class ExchangePuzzle extends Activity {\n /**\n * ExchangePuzzle constructor\n * @param {module:project/JClicProject.JClicProject} project - The {@link module:project/JClicProject.JClicProject JClicProject} to which this activity belongs\n */\n constructor(project) {\n super(project);\n }\n\n /**\n * Retrieves the minimum number of actions needed to solve this activity.\n * @override\n * @returns {number}\n */\n getMinNumActions() {\n return this.abc.primary.getNumCells();\n }\n\n /**\n * Whether or not the activity uses random to shuffle internal components\n * @override\n * @returns {boolean}\n */\n hasRandom() {\n return true;\n }\n\n /**\n * When `true`, the activity must always be shuffled\n * @override\n * @returns {boolean}\n */\n shuffleAlways() {\n return true;\n }\n\n /**\n * Whether the activity allows the user to request help.\n * @override\n * @returns {boolean}\n */\n helpSolutionAllowed() {\n return true;\n }\n}\n\n/**\n * The {@link module:Activity.ActivityPanel ActivityPanel} where activities of type {@link module:activities/puzzles/ExchangePuzzle.ExchangePuzzle ExchangePuzzle} are played.\n * @extends module:Activity.ActivityPanel\n */\nclass ExchangePuzzlePanel extends ActivityPanel {\n /**\n * ExchangePuzzlePanel constructor\n * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs\n * @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the\n * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) Java interface.\n * @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy\n */\n constructor(act, ps, $div) {\n super(act, ps, $div);\n }\n\n /**\n * Miscellaneous cleaning operations\n * @override\n */\n clear() {\n if (this.bg) {\n this.bg.end();\n this.bg = null;\n }\n }\n\n /**\n * Prepares the visual components of the activity\n * @override\n */\n buildVisualComponents() {\n if (this.firstRun)\n super.buildVisualComponents();\n this.clear();\n\n const abc = this.act.abc['primary'];\n if (abc) {\n if (abc.image)\n abc.setImgContent(this.act.project.mediaBag, null, false);\n\n if (this.act.acp !== null)\n this.act.acp.generateContent(abc.nch, abc.ncw, [abc], false);\n\n this.bg = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);\n this.bg.setContent(abc);\n this.bg.setVisible(true);\n }\n }\n\n /**\n * Basic initialization procedure\n * @override\n */\n initActivity() {\n super.initActivity();\n if (!this.firstRun)\n this.buildVisualComponents();\n else\n this.firstRun = false;\n\n if (this.bg) {\n this.shuffle([this.bg], true, true);\n if (this.useOrder)\n this.currentItem = this.bg.getNextItem(-1);\n this.setAndPlayMsg('initial', 'start');\n this.invalidate().update();\n this.playing = true;\n }\n }\n\n /**\n * Updates the graphic content of this panel.\n * This method will be called from {@link module:AWT.Container#update} when needed.\n * @override\n * @param {module:AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,\n * it's the whole panel.\n */\n updateContent(dirtyRegion) {\n super.updateContent(dirtyRegion);\n if (this.bg && this.$canvas) {\n const\n canvas = this.$canvas.get(-1),\n ctx = canvas.getContext('2d');\n if (!dirtyRegion)\n dirtyRegion = new Rectangle(0, 0, canvas.width, canvas.height);\n ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);\n this.bg.update(ctx, dirtyRegion);\n }\n return this;\n }\n\n /**\n * Sets the real dimension of this panel.\n * @override\n * @param {module:AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel\n * @returns {module:AWT.Dimension}\n */\n setDimension(preferredMaxSize) {\n return !this.bg || this.getBounds().equals(preferredMaxSize) ?\n preferredMaxSize :\n BoxBag.layoutSingle(preferredMaxSize, this.bg, this.act.margin);\n }\n\n /**\n * Sets the size and position of this activity panel\n * @override\n * @param {module:AWT.Rectangle} rect\n */\n setBounds(rect) {\n if (this.$canvas)\n this.$canvas.remove();\n\n super.setBounds(rect);\n if (this.bg) {\n // Create the main canvas\n this.$canvas = $(`<canvas width=\"${rect.dim.width}\" height=\"${rect.dim.height}\"/>`).css({\n position: 'absolute',\n top: 0,\n left: 0\n });\n this.$div.append(this.$canvas);\n\n // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context\n this.bc = new BoxConnector(this, this.$canvas);\n\n // Repaint all\n this.invalidate().update();\n }\n }\n\n /**\n * Builds the accessible components needed for this ActivityPanel\n * This method is called when all main elements are placed and visible, when the activity is ready\n * to start or when resized.\n * @override\n */\n buildAccessibleComponents() {\n if (this.$canvas && this.accessibleCanvas && this.bg) {\n super.buildAccessibleComponents();\n this.bg.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');\n }\n }\n\n /**\n * Main handler used to process mouse, touch, keyboard and edit events\n * @override\n * @param {external:Event} event - The HTML event to be processed\n * @returns {boolean} - When this event handler returns `false`, jQuery will stop its\n * propagation through the DOM tree. See: {@link http://api.jquery.com/on}\n */\n processEvent(event) {\n if (this.bc && this.playing) {\n\n //\n // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated\n let p = null;\n //\n // Two [ActiveBox](ActiveBox.html) pointers used for the [BoxConnector](BoxConnector.html)\n // `origin` and `dest` points.\n let bx1, bx2;\n // Array to be filled with actions to be executed at the end of event processing\n const delayedActions = [];\n //\n // _touchend_ event don't provide pageX nor pageY information\n if (event.type === 'touchend')\n p = this.bc.active ? this.bc.dest.clone() : new Point();\n else {\n // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`\n const\n x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,\n y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;\n p = new Point(x - this.$div.offset().left, y - this.$div.offset().top);\n }\n\n // Flag for tracking `mouseup` events\n let up = false;\n\n switch (event.type) {\n case 'touchcancel':\n // Canvel movement\n if (this.bc.active)\n this.bc.end();\n break;\n\n case 'mouseup':\n // Don't consider drag moves below 3 pixels. Can be a \"trembling click\"\n if (this.bc.active && p.distanceTo(this.bc.origin) <= 3)\n break;\n\n up = true;\n /* falls through */\n case 'touchend':\n case 'touchstart':\n case 'mousedown':\n if (!this.bc.active) {\n // New pairing starts\n //\n // Pairings never can start with a `mouseup` event\n if (up)\n break;\n\n this.ps.stopMedia(1);\n // Find the ActiveBox behind the clicked point\n bx1 = this.bg.findActiveBox(p);\n if (bx1) {\n // Start the [BoxConnector](BoxConnector.html)\n if (this.act.dragCells)\n this.bc.begin(p, bx1);\n else\n this.bc.begin(p);\n // Play cell media or event sound\n if (!bx1.playMedia(this.ps, delayedActions))\n this.playEvent('click');\n }\n } else {\n this.ps.stopMedia(1);\n // Pairing completed\n //\n // Find the active boxes behind `bc.origin` and `p`\n if (this.act.dragCells)\n bx1 = this.bc.bx;\n else\n bx1 = this.bg.findActiveBox(this.bc.origin);\n this.bc.end();\n bx2 = this.bg.findActiveBox(p);\n //\n // Check if the pairing was OK\n if (bx1 && bx2) {\n const\n src = `${bx1.getDescription()} (${bx1.idOrder})`,\n dest = `(${bx2.idLoc})`;\n let ok = (bx1.idOrder === bx2.idLoc);\n this.bg.swapCellPositions(bx1, bx2, true);\n // Check results and notify action\n const cellsAtPlace = this.bg.countCellsAtEquivalentPlace(true);\n this.ps.reportNewAction(this.act, 'PLACE', src, dest, ok, cellsAtPlace);\n // End activity or play event sound\n if (ok && cellsAtPlace === this.bg.getNumCells())\n this.finishActivity(true);\n else\n this.playEvent(ok ? 'actionOk' : 'actionError');\n }\n this.update();\n }\n break;\n\n case 'mousemove':\n case 'touchmove':\n this.bc.moveTo(p);\n break;\n }\n delayedActions.forEach(action => action());\n event.preventDefault();\n }\n }\n}\n\nObject.assign(ExchangePuzzlePanel.prototype, {\n /**\n * The {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} object containing the information to be displayed in the panel.\n * @name module:activities/puzzles/ExchangePuzzle.ExchangePuzzlePanel#bg\n * @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */\n bg: null,\n /**\n * The box connector\n * @name module:activities/puzzles/ExchangePuzzle.ExchangePuzzlePanel#bc\n * @type {module:boxes/BoxConnector.BoxConnector} */\n bc: null,\n /**\n * List of mouse, touch and keyboard events intercepted by this panel\n * @override\n * @name module:activities/puzzles/ExchangePuzzle.ExchangePuzzlePanel#events\n * @type {string[]} */\n events: ['mousedown', 'mouseup', 'mousemove', 'touchstart', 'touchend', 'touchmove', 'touchcancel'],\n});\n\n/**\n * Panel class associated to this type of activity: {@link module:activities/puzzles/ExchangePuzzle.ExchangePuzzlePanel ExchangePuzzlePanel}\n * @type {class} */\nExchangePuzzle.Panel = ExchangePuzzlePanel;\n\n// Register activity class\nexport default Activity.registerClass('@puzzles.ExchangePuzzle', ExchangePuzzle);\n","/**\n * File : boxes/ActiveBoxGrid.js\n * Created : 19/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport ActiveBoxBag from './ActiveBoxBag.js';\nimport ActiveBox from './ActiveBox.js';\nimport { Rectangle, Dimension, Point } from '../AWT.js';\nimport { settings, roundTo } from '../Utils.js';\n\n/**\n * This class extends {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} with constructors that take an argument of type\n * {@link module:shapers/Shaper.Shaper Shaper} used to build all its {@link module:boxes/ActiveBox.ActiveBox ActiveBox}components. It also maintains information\n * about the number of \"rows\" and \"columns\", useful to compute valid (integer) values when\n * resizing or moving its components.\n * @extends module:boxes/ActiveBoxBag.ActiveBoxBag\n */\nexport class ActiveBoxGrid extends ActiveBoxBag {\n /**\n * ActiveBxGrid constructor\n * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs\n * @param {module:AWT.Container} container - The container where this box grid is placed.\n * @param {module:boxes/BoxBase} boxBase - The object where colors, fonts, border and other graphic properties\n * @param {number} px - `X` coordinate of the upper left corner of this box grid\n * @param {number} py - `Y` coordinate of the upper left corner of this box grid\n * @param {number} setWidth - Total width of the box grid\n * @param {number} setHeight - Total height of the box grid\n * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects\n */\n constructor(parent, container, boxBase, px, py, setWidth, setHeight, sh) {\n // ActiveBoxGrid derives from ActiveBoxBag\n super(parent, container, boxBase);\n\n this.nCols = sh.nCols;\n this.nRows = sh.nRows;\n\n // This will be the enclosing rectangle of this ActiveBox bag\n const r = new Rectangle(\n new Point(px, py),\n new Dimension(\n Math.round(setWidth / this.nCols) * this.nCols,\n Math.round(setHeight / this.nRows) * this.nRows));\n\n // Create all the [ActiveBox](ActiveBox.html) objects based on the\n // shapes provided by the [Shaper](Shaper.html)\n for (let i = 0; i < sh.nCells; i++) {\n const\n tmpSh = sh.getShape(i, r),\n bx = new ActiveBox(this, container, boxBase, i, tmpSh.getBounds());\n if (!sh.rectangularShapes)\n bx.setShape(tmpSh);\n this.addActiveBox(bx);\n }\n\n // If the Shaper has `remainder` (extra space), set the background box of this\n // [BoxBag](BoxBag.html)\n if (sh.hasRemainder) {\n const\n tmpSh = sh.getRemainderShape(r),\n bx = new ActiveBox(this, container, boxBase, 0, tmpSh.getBounds());\n bx.setShape(tmpSh);\n this.setBackgroundBox(bx);\n }\n }\n\n /**\n * This factory constructor creates a new empty grid with the number of cells indicated by the\n * {@link module:boxes/ActiveBagContent.ActiveBagContent ActiveBagContent} `abc`, not filling the cells with any content.\n * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs\n * @param {module:AWT.Container} container - The container where this box grid is placed.\n * @param {number} px - `X` coordinate of the upper left corner of this box grid\n * @param {number} py - `Y` coordinate of the upper left corner of this box grid\n * @param {module:boxes/ActiveBagContent.ActiveBagContent} abc - Used only to get the number of cells and the shaper (when `sh` is `null`)\n * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects\n * @param {module:boxes/BoxBase.BoxBase} boxBase - The object where colors, fonts, border and other graphic properties\n * of this box grid are defined.\n * @returns {module:boxes/ActiveBoxGrid.ActiveBoxGrid}\n */\n static createEmptyGrid(parent, container, px, py, abc, sh, boxBase) {\n const result = abc ? new ActiveBoxGrid(parent, container,\n boxBase || abc.style,\n px, py,\n abc.getTotalWidth(), abc.getTotalHeight(),\n sh || abc.getShaper()) : null;\n\n if (result)\n result.setBorder(abc.border);\n\n return result;\n }\n\n /**\n * Gets the minimum size of this grid\n * @returns {module:AWT.Dimension}\n */\n getMinimumSize() {\n return new Dimension(\n settings.MIN_CELL_SIZE * this.nCols,\n settings.MIN_CELL_SIZE * this.nRows);\n }\n\n /**\n * Gets a scaled size of this grid, rounded to the nearest integer values\n * @param {number} scale - The scale factor\n * @returns {module:AWT.Dimension}\n */\n getScaledSize(scale) {\n return new Dimension(\n roundTo(scale * this.preferredBounds.dim.width, this.nCols),\n roundTo(scale * this.preferredBounds.dim.height, this.nRows));\n }\n\n /**\n * Returns the logical coordinates of the provided {@link module:boxes/ActiveBox.ActiveBox ActiveBox}.\n * The units of the result are not pixels, but ordinal numbers (relative positions) of columns\n * and rows in the grid.\n * @param {module:boxes/ActiveBox.ActiveBox} bx - The box to process\n * @returns {module:AWT.Point}\n */\n getCoord(bx) {\n return new Point(bx.idLoc % this.nCols, Math.floor(bx.idLoc / this.nCols));\n }\n\n /**\n * Calculates the logical distance between two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects.\n * Resulting units are not pixels, but ordinal numbers (relative positions) of columns and rows\n * in the grid.\n * @param {module:boxes/ActiveBox.ActiveBox} src - First box\n * @param {module:boxes/ActiveBox.ActiveBox} dest - Second box\n * @returns {module:AWT.Point}\n */\n getCoordDist(src, dest) {\n const\n ptSrc = this.getCoord(src),\n ptDest = this.getCoord(dest);\n return new Point(ptDest.x - ptSrc.x, ptDest.y - ptSrc.y);\n }\n}\n\nObject.assign(ActiveBoxGrid.prototype, {\n /**\n * Number of columns of this box grid\n * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nCols\n * @type {number} */\n nCols: 1,\n /**\n * Number of rows of this box grid\n * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nRows\n * @type {number} */\n nRows: 1,\n});\n\nexport default ActiveBoxGrid;\n","/**\n * File : boxes/BoxConnector.js\n * Created : 26/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport { Point, Dimension, Rectangle } from '../AWT.js';\n\nconst DEFAULT_COMPOSITE_OP = 'source-over';\n\n/**\n * BoxConnector allows users to visually connect two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects of an\n * {@link module:Activity.ActivityPanel ActivityPanel}. There are two modes of operation:\n *\n * - Drawing a line between an origin point (usually the point where the user clicks on) and a\n * destination point.\n * - Dragging the ActiveBox from one location to another.\n *\n * The connecting lines can have arrowheads at its endings.\n */\nexport class BoxConnector {\n /**\n * BoxConnector constructor\n * @param {module:AWT.Container} parent - The Container to which this BoxConnector belongs\n * @param {external:jQuery} $canvas - The HTML `canvas` element where this BoxConnector will draw.\n */\n constructor(parent, $canvas) {\n this.parent = parent;\n this.ctx = $canvas.get(-1).getContext('2d', { willReadFrequently: true });\n this.dim = new Dimension(this.ctx.canvas.width, this.ctx.canvas.height);\n this.origin = new Point();\n this.dest = new Point();\n this.relativePos = new Point();\n }\n\n /**\n * Displaces the ending point of the connector\n * @param {number} dx - Displacement on the X axis\n * @param {number} dy - Displacement on the Y axis\n */\n moveBy(dx, dy) {\n this.moveTo(Point(this.dest.x + dx, this.dest.y + dy));\n }\n\n /**\n * Moves the ending point of the connector to a new position\n * @param {module:AWT.Point} pt - The new position\n * @param {boolean} forcePaint - When `true`, forces the repaint of all the area also if there is\n * no movement at all.\n */\n moveTo(pt, forcePaint) {\n if (!this.active || !forcePaint && this.dest.equals(pt))\n return;\n\n // Restore the background\n if (this.bgRect) {\n if (this.bgImg) {\n this.ctx.putImageData(\n this.bgImg,\n 0, 0,\n this.bgRect.pos.x, this.bgRect.pos.y,\n this.bgRect.dim.width, this.bgRect.dim.height);\n } else if (this.parent)\n this.parent.updateContent();\n }\n\n this.dest.moveTo(pt);\n\n // Calculate the bounds of the invalidated area after the move:\n // Start with the origin point or box area\n const pt1 = new Point(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);\n this.bgRect = new Rectangle(pt1, this.bx ? this.bx.dim : new Dimension());\n // Add the destination point or box area\n const pt2 = new Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y);\n this.bgRect.add(new Rectangle(pt2, this.bx ? this.bx.dim : new Dimension()));\n // Add a generous border around the area\n this.bgRect.grow(10, 10);\n\n if (this.bx !== null) {\n // Move the ActiveBox\n this.bx.moveTo(new Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y));\n this.bx.setTemporaryHidden(false);\n this.bx.update(this.ctx, null);\n this.bx.setTemporaryHidden(true);\n } else {\n // Draw the connecting line\n this.drawLine();\n this.linePainted = true;\n }\n }\n\n /**\n * Starts the box connector operation\n * @param {module:AWT.Point} pt - Starting point\n * @param {module:boxes/ActiveBox.ActiveBox} [box] - Passed only when the BoxConnector runs in drag&drop mode\n */\n begin(pt, box) {\n if (this.active)\n this.end();\n this.origin.moveTo(pt);\n this.dest.moveTo(pt);\n this.linePainted = false;\n this.active = true;\n\n if (box) {\n // Remember what box will be moved, hide it from the panel and repaint all\n this.bx = box;\n this.relativePos.moveTo(pt.x - box.pos.x, pt.y - box.pos.y);\n this.bx.setFocused(true);\n this.bx.setTemporaryHidden(true);\n this.linePainted = false;\n this.parent.invalidate().update();\n }\n\n // Save the full image currently displayed on the panel (with the box hidden)\n try {\n this.bgImg = this.ctx.getImageData(0, 0, this.dim.width, this.dim.height);\n } catch (_ex) {\n // Avoid \"canvas tainted by cross-origin data\" errors\n // Setting bgImg to null is less efficient, but works\n this.bgImg = null;\n }\n this.bgRect = null;\n\n // Make a first movement to make the box appear\n if (box)\n this.moveTo(pt, true);\n }\n\n /**\n * Finalizes the operation of this box connector until a new call to `begin`\n */\n end() {\n if (!this.active)\n return;\n\n this.active = false;\n this.linePainted = false;\n this.bgRect = null;\n this.bgImg = null;\n\n if (this.bx) {\n // Restore the original position and attributes of the box\n this.bx.setFocused(false);\n this.bx.moveTo(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);\n this.bx.setTemporaryHidden(false);\n this.bx = null;\n this.relativePos.moveTo(0, 0);\n }\n\n // Repaint all\n this.ctx.clearRect(0, 0, this.dim.width, this.dim.height);\n this.parent.invalidate().update();\n }\n\n /**\n * Strokes a line between `origin` and `dest`, optionally ended with an arrowhead.\n */\n drawLine() {\n if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {\n this.ctx.strokeStyle = this.xorColor;\n this.ctx.globalCompositeOperation = this.compositeOp;\n } else\n this.ctx.strokeStyle = this.lineColor;\n\n this.ctx.lineWidth = this.lineWidth;\n\n this.ctx.beginPath();\n this.ctx.moveTo(this.origin.x, this.origin.y);\n this.ctx.lineTo(this.dest.x, this.dest.y);\n this.ctx.stroke();\n\n if (this.arrow) {\n // Draws the arrow head\n const\n beta = Math.atan2(this.origin.x - this.dest.x, this.dest.x - this.origin.x),\n arp = new Point(this.dest.x - this.arrowLength * Math.cos(beta + this.arrowAngle),\n this.dest.y + this.arrowLength * Math.sin(beta + this.arrowAngle));\n this.ctx.beginPath();\n this.ctx.moveTo(this.dest.x, this.dest.y);\n this.ctx.lineTo(arp.x, arp.y);\n this.ctx.stroke();\n\n arp.moveTo(this.dest.x - this.arrowLength * Math.cos(beta - this.arrowAngle),\n this.dest.y + this.arrowLength * Math.sin(beta - this.arrowAngle));\n this.ctx.beginPath();\n this.ctx.moveTo(this.dest.x, this.dest.y);\n this.ctx.lineTo(arp.x, arp.y);\n this.ctx.stroke();\n }\n if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {\n // reset default settings\n this.ctx.globalCompositeOperation = DEFAULT_COMPOSITE_OP;\n }\n }\n}\n\nObject.assign(BoxConnector.prototype, {\n /**\n * The background image, saved and redrawn on each movement\n * @name module:boxes/BoxConnector.BoxConnector#bgImg\n * @type {external:HTMLImageElement} */\n bgImg: null,\n /**\n * The rectangle of {@link module:Activity.ActivityPanel ActivityPanel} saved in `bgImg`\n * @name module:boxes/BoxConnector.BoxConnector#bgRect\n * @type {module:AWT.Rectangle} */\n bgRect: null,\n /**\n * Initial position of the connector\n * @name module:boxes/BoxConnector.BoxConnector#origin\n * @type {module:AWT.Point} */\n origin: null,\n /**\n * Current (while moving) and final position of the connector\n * @name module:boxes/BoxConnector.BoxConnector#dest\n * @type {module:AWT.Point} */\n dest: null,\n /**\n * When `true`, the connector must end on arrowhead\n * @name module:boxes/BoxConnector.BoxConnector#arrow\n * @type {boolean} */\n arrow: false,\n /**\n * `true` while the connector is active\n * @name module:boxes/BoxConnector.BoxConnector#active\n * @type {boolean} */\n active: false,\n /**\n * `true` while the line has already been painted (used for XOR expressions)\n * @name module:boxes/BoxConnector.BoxConnector#linePainted\n * @type {boolean} */\n linePainted: false,\n /**\n * The arrowhead length (in pixels)\n * @name module:boxes/BoxConnector.BoxConnector#arrowLength\n * @type {number} */\n arrowLength: 10,\n /**\n * The arrowhead angle\n * @name module:boxes/BoxConnector.BoxConnector#arrowAngle\n * @type {number} */\n arrowAngle: Math.PI / 6,\n /**\n * The main color used in XOR operations\n * @name module:boxes/BoxConnector.BoxConnector#lineColor\n * @type {string} */\n lineColor: 'black',\n /**\n * The complementary color used in XOR operations\n * @name module:boxes/BoxConnector.BoxConnector#xorColor\n * @type {string} */\n xorColor: 'white',\n /**\n * The global composite operator used when drawing in XOR mode. Default is \"difference\".\n * For a list of possible values see:\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation}\n * @name module:boxes/BoxConnector.BoxConnector#compositeOp\n * @type {string} */\n compositeOp: 'difference',\n /**\n * The default {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation composite operator}\n * (\"source-over\").\n * @name module:boxes/BoxConnector.BoxConnector#DEFAULT_COMPOSITE_OP\n * @static\n * @type {string} */\n DEFAULT_COMPOSITE_OP: DEFAULT_COMPOSITE_OP,\n /**\n * Relative position of point B regarding A\n * @name module:boxes/BoxConnector.BoxConnector#relativePos\n * @type {module:AWT.Point} */\n relativePos: null,\n /**\n * The ActiveBox to connect or move\n * @name module:boxes/BoxConnector.BoxConnector#bx\n * @type {module:boxes/ActiveBox.ActiveBox} */\n bx: null,\n /**\n * The Graphics context where the BoxConnector will paint\n * @name module:boxes/BoxConnector.BoxConnector#ctx\n * @type {external:CanvasRenderingContext2D} */\n ctx: null,\n /**\n * The dimension of the HTML canvas where to draw\n * @name module:boxes/BoxConnector.BoxConnector#dim\n * @type {module:AWT.Dimension} */\n dim: null,\n /**\n * The container to which this connector belongs\n * @name module:boxes/BoxConnector.BoxConnector#parent\n * @type {module:AWT.Container} */\n parent: null,\n /**\n * Width of the connector line\n * @name module:boxes/BoxConnector.BoxConnector#lineWidth\n * @type {number} */\n lineWidth: 1.5,\n});\n\nexport default BoxConnector;\n"],"names":[],"sourceRoot":""}
@@ -1,583 +0,0 @@
1
- "use strict";
2
- exports.id = 743;
3
- exports.ids = [743];
4
- exports.modules = {
5
-
6
- /***/ 743:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ c: () => (/* binding */ TextActivityBasePanel),
11
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
12
- /* harmony export */ q: () => (/* binding */ TextActivityBase)
13
- /* harmony export */ });
14
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7750);
15
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
16
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1253);
17
- /* harmony import */ var _Activity_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1567);
18
- /* harmony import */ var _boxes_ActiveBox_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1725);
19
- /* harmony import */ var _boxes_BoxBase_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3018);
20
- /**
21
- * File : activities/text/TextActivityBase.js
22
- * Created : 16/05/2015
23
- * By : Francesc Busquets <francesc@gmail.com>
24
- *
25
- * JClic.js
26
- * An HTML5 player of JClic activities
27
- * https://projectestac.github.io/jclic.js
28
- *
29
- * @source https://github.com/projectestac/jclic.js
30
- *
31
- * @license EUPL-1.2
32
- * @licstart
33
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
34
- *
35
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
36
- * the European Commission- subsequent versions of the EUPL (the "Licence");
37
- * You may not use this work except in compliance with the Licence.
38
- *
39
- * You may obtain a copy of the Licence at:
40
- * https://joinup.ec.europa.eu/software/page/eupl
41
- *
42
- * Unless required by applicable law or agreed to in writing, software
43
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
44
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
45
- * Licence for the specific language governing permissions and limitations
46
- * under the Licence.
47
- * @licend
48
- * @module
49
- */
50
-
51
- /* global window */
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
- /**
60
- * This class and its visual component {@link module:activities/text/TextActivityBase.TextActivityBasePanel TextActivityBasePanel} are the base for text
61
- * activities like {@link module:activities/text/FillInBlanks.FillInBlanks FillInBlanks}, {@link module:activities/text/IdentifyText.IdentifyText IdentifyText}, {@link module:activities/text/OrderText.OrderText OrderText} and {@link module:activities/text/Complete.Complete Complete}.
62
- * @extends module:Activity.Activity
63
- */
64
- class TextActivityBase extends _Activity_js__WEBPACK_IMPORTED_MODULE_2__/* .Activity */ .I {
65
- /**
66
- * TextActivityBase constructor
67
- * @param {module:project/JClicProject.JClicProject} project - The project to which this activity belongs
68
- */
69
- constructor(project) {
70
- super(project);
71
- }
72
-
73
- /**
74
- * Retrieves the minimum number of actions needed to solve this activity
75
- * @override
76
- * @returns {number}
77
- */
78
- getMinNumActions() {
79
- return this.document ? this.document.numTargets : 0;
80
- }
81
- }
82
-
83
- Object.assign(TextActivityBase.prototype, {
84
- /**
85
- * This is the object used to evaluate user's answers in text activities.
86
- * @name module:activities/text/TextActivityBase.TextActivityBase#ev
87
- * @type {module:activities/text/Evaluator.Evaluator} */
88
- ev: null,
89
- /**
90
- * This is the label used by text activities for the `check` button, when present.
91
- * @name module:activities/text/TextActivityBase.TextActivityBase#checkButtonText
92
- * @type {string} */
93
- checkButtonText: null,
94
- /**
95
- * When `true`, a text will be shown before the beginning of the activity.
96
- * @name module:activities/text/TextActivityBase.TextActivityBase#prevScreen
97
- * @type {boolean} */
98
- prevScreen: false,
99
- /**
100
- * Optional text to be shown before the beginning of the activity. When `null`, this text is
101
- * the main document.
102
- * @name module:activities/text/TextActivityBase.TextActivityBase#prevScreenText
103
- * @type {string} */
104
- prevScreenText: null,
105
- /**
106
- * The style of the optional text to be shown before the beginning of the activity.
107
- * @name module:activities/text/TextActivityBase.TextActivityBase#prevScreenStyle
108
- * @type {module:boxes/BoxBase.BoxBase} */
109
- prevScreenStyle: null,
110
- /**
111
- * Maximum amount of time for showing the previous document.
112
- * @name module:activities/text/TextActivityBase.TextActivityBase#prevScreenMaxTime
113
- * @type {number} */
114
- prevScreenMaxTime: -1,
115
- });
116
-
117
- /**
118
- * The {@link module:Activity.ActivityPanel ActivityPanel} where text activities (based on {@link module:activities/text/TextActivityBase.TextActivityBase TextActivityBase}) are played.
119
- * @extends module:Activity.ActivityPanel
120
- */
121
- //export class TextActivityBasePanel extends Activity.Panel {
122
- class TextActivityBasePanel extends _Activity_js__WEBPACK_IMPORTED_MODULE_2__/* .ActivityPanel */ .S {
123
- /**
124
- * TextActivityBasePanel constructor
125
- * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs
126
- * @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the
127
- * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) Java interface.
128
- * @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy
129
- */
130
- constructor(act, ps, $div) {
131
- super(act, ps, $div);
132
- this.targets = [];
133
- }
134
-
135
- /**
136
- * Fills a jQuery DOM element (usually a 'div') with the specified {@link module:activities/text/TextActivityDocument.TextActivityDocument TextActivityDocument}.
137
- * @param {external:jQuery} $div - The jQuery DOM object to be filled with the document.
138
- * @param {module:activities/text/TextActivityDocument.TextActivityDocument} doc - The document
139
- */
140
- setDocContent($div, doc) {
141
-
142
- // Empties the container of any pre-existing content
143
- // and sets the background and other attributes indicated by the main
144
- // style of the document.
145
- // It also sets the 'overflow' CSS attribute to 'auto', which will display a
146
- // vertical scroll bar when needed
147
- $div.empty().css(doc.style['default'].css).css({ display: 'flex', 'flex-direction': 'column' });
148
-
149
- const $scroller = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div/>').css({ 'flex-grow': 1, overflow: 'auto' });
150
- const $doc = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div/>', { class: 'JClicTextDocument' }).css({ 'padding': 4 }).css(doc.style['default'].css);
151
-
152
- let currentPStyle = null;
153
- const popupSpans = [];
154
-
155
- //
156
- // Process paragraphs
157
- doc.p.forEach(p => {
158
- // Creates a new DOM paragraph
159
- const $p = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<p/>').css({ margin: 0 });
160
- let empty = true;
161
-
162
- // Check if the paragraph has its own style
163
- if (p.style) {
164
- currentPStyle = doc.style[p.style].css;
165
- $p.css(currentPStyle);
166
- } else
167
- currentPStyle = null;
168
-
169
- // Check if the paragraph has a special alignment
170
- if (p.Alignment) {
171
- const al = Number(p.Alignment);
172
- $p.css({ 'text-align': al === 1 ? 'center' : al === 2 ? 'right' : 'left' });
173
- }
174
-
175
- // Process the paragraph elements
176
- p.elements.forEach(element => {
177
- // Elements will be inserted as 'span' DOM elements, or as simple text if they don't
178
- // have specific attributes.
179
- let $span;
180
- switch (element.objectType) {
181
- case 'text':
182
- const parsedText = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span/>').html(element.text).text();
183
- const fragments = this.spanText
184
- ? (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .stringToWords */ .Mk)(parsedText)
185
- : [{ text: parsedText, sep: '' }];
186
- fragments.forEach(({ text, sep }) => {
187
- let initialCSS = { ...this.act.document.style['default'].css };
188
- if (element?.attr?.style)
189
- initialCSS = { ...initialCSS, ...doc.style[element.attr.style].css };
190
- if (element?.attr?.css)
191
- initialCSS = { ...initialCSS, ...element.attr.css };
192
- const txtBlocs = this.spanChars ? [...text] : [text];
193
- txtBlocs.forEach((str) => {
194
- if (element.attr) {
195
- // Text uses a specific style and/or individual attributes
196
- $span = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span/>').html(str).css(initialCSS);
197
- // Save initialCSS for later use
198
- $span.initialCSS = initialCSS;
199
- $p.append(this.$createSpanElement($span));
200
- } else {
201
- if (this.spanText) {
202
- $span = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span/>').html(str);
203
- $p.append(this.$createSpanElement($span));
204
- }
205
- else
206
- $p.append(str);
207
- }
208
- });
209
- if (sep !== '')
210
- $p.append(sep);
211
- });
212
- break;
213
-
214
- case 'cell':
215
- // Create a new ActiveBox based on this ActiveBoxContent
216
- $span = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span/>');
217
- const box = _boxes_ActiveBox_js__WEBPACK_IMPORTED_MODULE_3__["default"].createCell($span.css({ position: 'relative' }), element);
218
- $span.css({ 'display': 'inline-block', 'vertical-align': 'middle' });
219
- if (element.mediaContent) {
220
- $span.on('click', event => {
221
- event.preventDefault();
222
- this.ps.stopMedia(1);
223
- box.playMedia(this.ps);
224
- return false;
225
- });
226
- }
227
- $p.append($span);
228
- break;
229
-
230
- case 'target':
231
- $span = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span/>');
232
- if (this.showingPrevScreen) {
233
- $span.text(element.text);
234
- $p.append($span);
235
- break;
236
- }
237
-
238
- const target = element;
239
- let $popup = null;
240
- // Process target popups
241
- if (target.infoMode !== 'no_info' && target.popupContent) {
242
- $popup = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span/>').css({ position: 'absolute', 'padding-top': '2pt', display: 'none' });
243
- // Create a new ActiveBox based on popupContent
244
- const popupBox = _boxes_ActiveBox_js__WEBPACK_IMPORTED_MODULE_3__["default"].createCell($popup, target.popupContent);
245
- if (target.popupContent.mediaContent) {
246
- $popup.on('click', event => {
247
- event.preventDefault();
248
- this.ps.stopMedia(1);
249
- if (popupBox)
250
- popupBox.playMedia(this.ps);
251
- else if (target.popupContent.mediaContent)
252
- this.ps.playMedia(target.popupContent.mediaContent);
253
- return false;
254
- });
255
- }
256
- target.$popup = $popup;
257
- // Save for later setting of top-margin
258
- popupSpans.push({ p: $p, span: $popup, box: popupBox });
259
- }
260
-
261
- $span = this.$createTargetElement(target, $span);
262
- target.num = this.targets.length;
263
- target.pos = target.num;
264
- this.targets.push(target);
265
- if ($span) {
266
- $span.css(doc.style['default'].css);
267
- if (currentPStyle)
268
- $span.css(currentPStyle);
269
- if (this.targetsMarked) {
270
- if (target.attr) {
271
- // Default style name for targets is 'target'
272
- if (!target.attr.style)
273
- target.attr.style = 'target';
274
- $span.css(doc.style[target.attr.style].css);
275
- // Check if target has specific attributes
276
- if (target.attr.css)
277
- $span.css(target.attr.css);
278
- } else if (doc.style['target'])
279
- $span.css(doc.style['target'].css);
280
- } else {
281
- target.targetStatus = 'HIDDEN';
282
- }
283
-
284
- // Catch on-demand popups with `F1`, cancel with `Escape`
285
- if ($popup !== null && target.infoMode === 'onDemand') {
286
- $span.keydown(ev => {
287
- if (ev.key === target.popupKey) {
288
- ev.preventDefault();
289
- this.showPopup($popup, target.popupMaxTime, target.popupDelay);
290
- } else if (ev.key === 'Escape') {
291
- ev.preventDefault();
292
- this.showPopup(null);
293
- }
294
- });
295
- }
296
- }
297
-
298
- if ($popup && $span) {
299
- if (target.isList)
300
- $p.append($span).append($popup);
301
- else
302
- $p.append($popup).append($span);
303
- } else if ($span)
304
- $p.append($span);
305
-
306
- target.$p = $p;
307
- break;
308
- }
309
- empty = false;
310
- });
311
- if (empty)
312
- // Don't leave paragraphs empty
313
- $p.html('&nbsp;');
314
-
315
- // Adds the paragraph to the DOM element
316
- $doc.append($p);
317
- });
318
-
319
- $div.append($scroller.append($doc));
320
-
321
- if (this.act.checkButtonText && !this.showingPrevScreen) {
322
- this.$checkButton = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<button/>', { class: 'StockBtn' })
323
- .html(this.act.checkButtonText)
324
- .css({ width: '100%', 'flex-shrink': 0 })
325
- .on('click', () => this.evaluatePanel());
326
- $div.append(this.$checkButton);
327
- }
328
-
329
- // Place popups below its target baseline
330
- popupSpans.forEach(pspan => pspan.span.css({ 'margin-top': pspan.p.css('font-size') }));
331
-
332
- // Init Evaluator
333
- if (this.act.ev)
334
- this.act.ev.init(this.act.project.settings.locales);
335
-
336
- return $div;
337
- }
338
-
339
- /**
340
- * Creates a target DOM element.
341
- * This method can be overridden in subclasses to create specific types of targets.
342
- * @param {module:activities/text/TextActivityDocument.TextTarget} target - The target related to the DOM object to be created
343
- * @param {external:jQuery} $span - An initial DOM object (usually a `span`) that can be used
344
- * to store the target, or replaced by another type of object.
345
- * @returns {external:jQuery} - The jQuery DOM element loaded with the target data.
346
- */
347
- $createTargetElement(target, $span) {
348
- $span.text(target.text);
349
- target.$span = $span;
350
- return $span;
351
- }
352
-
353
- /**
354
- * Creates a 'span' element, used to isolate elements of text not involved in targets.
355
- * Used only when {@link spanText} is true.
356
- * @param {external:jQuery} $span - An initial DOM object (usually a `span`) that can be used
357
- * to store the target, or replaced by another type of object.
358
- * @returns {external:jQuery} - The jQuery DOM element loaded with the span data.
359
- */
360
- $createSpanElement($span) {
361
- return $span;
362
- }
363
-
364
- /**
365
- * Basic initialization procedure, common to all activities.
366
- * @override
367
- */
368
- initActivity() {
369
- if (this.act.prevScreen)
370
- this.preInitActivity();
371
- else
372
- this.startActivity();
373
- }
374
-
375
- /**
376
- * Called when the activity starts playing
377
- * @override
378
- */
379
- startActivity() {
380
- super.initActivity();
381
- this.setAndPlayMsg('initial', 'start');
382
- this.setDocContent(this.$div, this.act.document);
383
- this.playing = true;
384
- }
385
-
386
- /**
387
- * Called when the text activity has a 'previous screen' information to be shown before the
388
- * activity starts
389
- */
390
- preInitActivity() {
391
- if (!this.act.prevScreen)
392
- return;
393
-
394
- const prevScreenEnd = () => {
395
- this.showingPrevScreen = false;
396
- this.$div.unbind('click');
397
- if (this.prevScreenTimer) {
398
- window.clearTimeout(this.prevScreenTimer);
399
- this.prevScreenTimer = null;
400
- }
401
- this.startActivity();
402
- return true;
403
- };
404
-
405
- this.showingPrevScreen = true;
406
- this.$div.empty();
407
-
408
- if (!this.act.prevScreenText) {
409
- this.setDocContent(this.$div, this.act.document);
410
- } else {
411
- if (!this.act.prevScreenStyle)
412
- this.act.prevScreenStyle = new _boxes_BoxBase_js__WEBPACK_IMPORTED_MODULE_4__["default"]();
413
- this.$div.css(this.act.prevScreenStyle.getCSS()).css('overflow', 'auto');
414
- const $html = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div/>', { class: 'JClicTextDocument' })
415
- .css({ 'padding': 4 })
416
- .css(this.act.prevScreenStyle.getCSS())
417
- .append(this.act.prevScreenText);
418
- this.$div.append($html);
419
- }
420
-
421
- this.enableCounters(true, false, false);
422
- this.ps.setCounterValue('time', 0);
423
-
424
- this.ps.setMsg(this.act.messages['previous']);
425
-
426
- if (this.act.prevScreenMaxTime > 0) {
427
- this.ps.setCountDown('time', this.act.prevScreenMaxTime);
428
- this.prevScreenTimer = window.setTimeout(prevScreenEnd, this.act.prevScreenMaxTime * 1000);
429
- }
430
-
431
- this.$div.on('click', prevScreenEnd);
432
- this.ps.playMsg();
433
- }
434
-
435
- /**
436
- * Called when the user clicks on the check button
437
- * @returns {boolean} - `true` when the panel is OK, `false` otherwise.
438
- */
439
- evaluatePanel() {
440
- this.finishActivity(true);
441
- return true;
442
- }
443
-
444
- /**
445
- * Ordinary ending of the activity, usually called form `processEvent`
446
- * @override
447
- * @param {boolean} result - `true` if the activity was successfully completed, `false` otherwise
448
- */
449
- finishActivity(result) {
450
- if (this.$checkButton)
451
- this.$checkButton.prop('disabled', true);
452
- this.targets.forEach(t => {
453
- if (t.$comboList)
454
- t.$comboList.attr('disabled', true);
455
- });
456
- this.showPopup(null);
457
- super.finishActivity(result);
458
- }
459
-
460
- /**
461
- * Main handler used to process mouse, touch, keyboard and edit events
462
- * @override
463
- * @param {external:Event} _event - The HTML event to be processed
464
- * @returns {boolean} - When this event handler returns `false`, jQuery will stop its
465
- * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
466
- */
467
- processEvent(_event) {
468
- return this.playing;
469
- }
470
-
471
- /**
472
- * @param {external:jQuery} $popup - The popup to display, or _null _ to just hide the current popup
473
- * @param {number} maxTime - The maximum time to mantain the popup on screen, in seconds
474
- * @param {number} waitTime - When set, indicates the number of seconds to wait before show the popup
475
- */
476
- showPopup($popup, maxTime, waitTime) {
477
- // Hide current popup
478
- if (this.$currentPopup) {
479
- this.$currentPopup.css({ display: 'none' });
480
- this.$currentPopup = null;
481
- if (this.currentPopupTimer) {
482
- window.clearTimeout(this.currentPopupTimer);
483
- this.currentPopupTimer = 0;
484
- }
485
- }
486
-
487
- // Clear popupWaitTimer
488
- if (this.popupWaitTimer) {
489
- window.clearTimeout(this.popupWaitTimer);
490
- this.popupWaitTimer = 0;
491
- }
492
-
493
- // Prepare popup timer
494
- if (waitTime) {
495
- this.popupWaitTimer = window.setTimeout(() => {
496
- this.showPopup($popup, maxTime);
497
- }, waitTime * 1000);
498
- return;
499
- }
500
-
501
- if ($popup) {
502
- $popup.css({ display: '' });
503
- $popup.trigger('click');
504
-
505
- this.$currentPopup = $popup;
506
- if (maxTime) {
507
- this.currentPopupTimer = window.setTimeout(() => {
508
- $popup.css({ display: 'none' });
509
- if (this.$currentPopup === $popup) {
510
- this.$currentPopup = null;
511
- this.currentPopupTimer = 0;
512
- }
513
- }, maxTime * 1000);
514
- }
515
- }
516
- }
517
- }
518
-
519
- Object.assign(TextActivityBasePanel.prototype, {
520
- /**
521
- * Array of jQuery DOM elements (usually of type 'span') containing the targets of this activity
522
- * @name module:activities/text/TextActivityBase.TextActivityBasePanel#targets
523
- * @type {external:jQuery[]} */
524
- targets: null,
525
- /**
526
- * Flag indicating if targets must be visually marked at the beginning of the activity.
527
- * Should be `true` except for {@link module:activities/text/IdentifyText.IdentifyText IdentifyText} activities.
528
- * @name module:activities/text/TextActivityBase.TextActivityBasePanel#targetsMarked
529
- * @type {boolean} */
530
- targetsMarked: true,
531
- /**
532
- * The button used to check the activity, only when `Activity.checkButtonText` is not null
533
- * @name module:activities/text/TextActivityBase.TextActivityBasePanel#$checkButton
534
- * @type {external:jQuery}*/
535
- $checkButton: null,
536
- /**
537
- * System timer used to close the previous document when act.maxTime is reached.
538
- * @name module:activities/text/TextActivityBase.TextActivityBasePanel#prevScreenTimer
539
- * @type {number} */
540
- prevScreenTimer: null,
541
- /**
542
- * The popup currently been displayed
543
- * @name module:activities/text/TextActivityBase.TextActivityBasePanel#$currentPopup
544
- * @type {external:jQuery} */
545
- $currentPopup: null,
546
- /**
547
- * A timer controlling the time the current popup will be displayed
548
- * @name module:activities/text/TextActivityBase.TextActivityBasePanel#currentPopupTimer
549
- * @type {number} */
550
- currentPopupTimer: 0,
551
- /**
552
- * A timer prepared to display a popup after a while
553
- * @name module:activities/text/TextActivityBase.TextActivityBasePanel#popupWaitTimer
554
- * @type {number} */
555
- popupWaitTimer: 0,
556
- /**
557
- * When true, all text outside of targets and cells will be inserted as independent words or letters,
558
- * using 'span' elements. {@link module:activities/text/TextActivityBase.TextActivityBasePanel#$createSpanElement} can be used
559
- * to customize these elements.
560
- * @name module:activities/text/TextActivityBase.TextActivityBasePanel#spanText
561
- * @type {boolean} */
562
- spanText: false,
563
- /**
564
- * When true, text spanning will be done at char level: each single letter will be a clickacle span.
565
- * Used only in activities of type "itentify letters"
566
- * @name module:activities/text/TextActivityBase.TextActivityBasePanel#spanChars
567
- * @type {boolean} */
568
- spanChars: false,
569
- });
570
-
571
- /**
572
- * Panel class associated to this type of activity: {@link module:activities/text/TextActivityBase.TextActivityBasePanel TextActivityBasePanel}
573
- * @type {class} */
574
- TextActivityBase.Panel = TextActivityBasePanel;
575
-
576
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextActivityBase);
577
-
578
-
579
- /***/ })
580
-
581
- };
582
- ;
583
- //# sourceMappingURL=743.jclic-node.js.map