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":"6238.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;AAC+B;;AAEtD;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,kEAAkE;AACxE,eAAe;AACf;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,6CAAC;AACZ;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA,IAAI,gEAAW;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+DAAU;AACjC;AACA;AACA,KAAK;AACL;AACA;;AAEA;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,YAAY,SAAS;AACrB;AACA,CAAC;;AAED,iEAAe,SAAS,EAAC;;;;;;;;;;;;;;;;AC1HzB;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;AAC+B;AACf;;AAEvC;AACA,iFAAiF,wCAAwC;AACzH;AACO;AACP;AACA;AACA,aAAa,0BAA0B,WAAW,yCAAyC;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,kEAAkE;AACxE,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,6CAAC;AACrB;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA,IAAI,gEAAW;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+DAAU;AACjC;AACA;AACA,KAAK;AACL;AACA,yBAAyB,qDAAS;AAClC,2BAA2B,6CAAC;AAC5B;AACA,KAAK;AACL;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA,4BAA4B,qDAAS;AACrC;AACA;AACA;;AAEA;AACA,2BAA2B,mDAAmD;AAC9E,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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,YAAY,qCAAqC;AACjD;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA,WAAW,mDAAmD;AAC9D;AACA,YAAY,mCAAmC;AAC/C;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED,iEAAe,WAAW,EAAC;;;;;;;;;;;;;AC9Q3B;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;;AAE2C;;AAE3C;AACA,kEAAkE,0FAA0F;AAC5J,uCAAuC,yDAAyD;AAChG;AACO;AACP;AACA;AACA,aAAa,6DAA6D,WAAW,2FAA2F;AAChL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,0BAA0B,WAAW,yCAAyC;AAC3F;AACA;AACA;AACA,iCAAiC,uDAAW;AAC5C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yCAAyC;AACzC;AACA,YAAY,QAAQ;AACpB;AACA;AACA,wCAAwC;AACxC;AACA,YAAY,QAAQ;AACpB;AACA;AACA,4BAA4B,yDAAyD;AACrF;AACA,YAAY,yCAAyC;AACrD;AACA;AACA,6BAA6B,yCAAyC;AACtE;AACA,YAAY,uCAAuC;AACnD;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,2CAA2C;AACvD;AACA,CAAC;;AAED;AACA,+CAA+C;AAC/C;AACO;AACP;AACA;AACA,aAAa,uCAAuC,aAAa,yDAAyD;AAC1H;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,2CAA2C;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,yDAAyD;AACnE;AACA,YAAY,uCAAuC;AACnD;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,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,CAAC;;AAED;;AAEA,iEAAe,WAAW,EAAC","sources":["webpack://jclic/./src/report/ActionReg.js","webpack://jclic/./src/report/ActivityReg.js","webpack://jclic/./src/report/SequenceReg.js"],"sourcesContent":["/**\n * File : report/ActionReg.js\n * Created : 17/05/2016\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 { attrForEach, getBoolean } from '../Utils.js';\n\n/**\n * This class stores information about one specific action done by the current user while playing\n * an activity.\n *\n */\nexport class ActionReg {\n /**\n * ActionReg constructor\n * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)\n * @param {string}+ source - Description of the object on which the action is done.\n * @param {string}+ dest - Description of the object that acts as a target of the action (used in pairings)\n * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwise\n */\n constructor(type, source, dest, ok) {\n this.type = type;\n this.source = source || null;\n this.dest = dest || null;\n this.ok = ok || false;\n this.time = (new Date()).valueOf();\n }\n\n /**\n * Provides the data associated with this action in XML format suitable for a\n * {@link http://clic.xtec.cat/en/jclic/reports/|JClic Reports Server}.\n * @returns {external:jQuery}\n */\n $getXML() {\n const attr = { ok: this.ok, time: this.time };\n if (this.type)\n attr.type = this.type;\n if (this.source)\n attr.source = this.source;\n if (this.dest)\n attr.dest = this.dest;\n return $('<action/>', attr);\n }\n\n /**\n * Fills this ActionReg with data provided in XML format\n * @param {external:jQuery} $xml - The XML element to be processed, already wrapped as jQuery object\n */\n setProperties($xml) {\n attrForEach($xml.get(0).attributes, (name, value) => {\n switch (name) {\n case 'type':\n case 'source':\n case 'dest':\n this[name] = value;\n break;\n case 'time':\n this[name] = Number(value);\n break;\n case 'ok':\n this[name] = getBoolean(value, false);\n break;\n }\n });\n }\n}\n\nObject.assign(ActionReg.prototype, {\n /**\n * The type of action (`click`, `write`, `move`, `select`...)\n * @name module:report/ActionReg.ActionReg#type\n * @type {string} */\n type: 'unknown',\n /**\n * Description of the object on which the action was done\n * @name module:report/ActionReg.ActionReg#source\n * @type {string} */\n source: null,\n /**\n * Description of the object that has acted as a target of the action (used in pairings)\n * @name module:report/ActionReg.ActionReg#dest\n * @type {string} */\n dest: null,\n /**\n * Time stamp taken when the action was done\n * @name module:report/ActionReg.ActionReg#time\n * @type {number} */\n time: 0,\n /**\n * `true` if the action was OK\n * @name module:report/ActionReg.ActionReg#isOk\n * @type {boolean} */\n isOk: false,\n});\n\nexport default ActionReg;\n","/**\n * File : report/ActivityReg.js\n * Created : 17/05/2016\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 { attrForEach, getBoolean } from '../Utils.js';\nimport ActionReg from './ActionReg.js';\n\n/**\n * This class stores miscellaneous data obtained by the current user playing an {@link module:Activity.Activity Activity}.\n */\nexport class ActivityReg {\n /**\n * ActivityReg constructor\n * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} referenced by this object.\n */\n constructor(act) {\n this.name = act.name;\n this.code = act.code;\n this.actions = [];\n this.startTime = (new Date()).valueOf();\n this.minActions = act.getMinNumActions();\n this.reportActions = act.reportActions;\n }\n\n /**\n * Provides the data associated with the current activity in an XML format suitable for a\n * {@link http://clic.xtec.cat/en/jclic/reports/|JClic Reports Server}.\n * @returns {external:jQuery}\n */\n $getXML() {\n const attr = {\n start: this.startTime,\n time: this.totalTime,\n solved: this.solved,\n score: this.score,\n minActions: this.minActions,\n actions: this.numActions\n };\n if (this.name)\n attr.name = this.name;\n if (this.code)\n attr.code = this.code;\n if (!this.closed)\n attr.closed = false;\n if (this.reportActions)\n attr.reportActions = true;\n\n const $result = $('<activity/>', attr);\n this.actions.forEach(ac => {\n $result.append(ac.$getXML());\n });\n return $result;\n }\n\n /**\n * Builds an object with relevant data about the results obtained by the current student in this activity\n * @returns {object} - The results of this activity\n */\n getData() {\n const result = {\n name: this.name,\n time: Math.round(this.totalTime / 10) / 100,\n solved: this.solved,\n score: this.score,\n minActions: this.minActions,\n actions: this.numActions,\n precision: this.getPrecision(),\n closed: this.closed\n };\n if (this.code)\n result.code = this.code;\n return result;\n }\n\n /**\n * Fills this ActivityReg with data provided in XML format\n * @param {external:jQuery} $xml -The XML element to be processed, already wrapped as jQuery object\n */\n setProperties($xml) {\n attrForEach($xml.get(0).attributes, (name, value) => {\n switch (name) {\n case 'name':\n case 'code':\n this[name] = value;\n break;\n case 'start':\n case 'time':\n case 'score':\n case 'minActions':\n case 'actions':\n this[name] = Number(value);\n break;\n case 'solved':\n case 'closed':\n case 'reportActions':\n this[name] = getBoolean(value, false);\n break;\n }\n });\n $xml.children('action').each((_n, child) => {\n const action = new ActionReg();\n action.setProperties($(child));\n this.actions.push(action);\n });\n }\n\n /**\n * Reports a new action done by the user while playing the current activity\n * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)\n * @param {string}+ source - Description of the object on which the action is done.\n * @param {string}+ dest - Description of the object that acts as a target of the action (used in pairings)\n * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwise\n */\n newAction(type, source, dest, ok) {\n if (!this.closed) {\n this.lastAction = new ActionReg(type, source, dest, ok);\n this.actions.push(this.lastAction);\n }\n }\n\n /**\n * Retrieves a specific {@link module:report/ActionReg.ActionReg ActionReg} element from `actions`\n * @param {number} index - The nth action to be retrieved\n * @returns {module:report/ActionReg.ActionReg}\n */\n getActionReg(index) {\n return index >= this.actions.length ? null : this.actions[index];\n }\n\n /**\n * Closes the current activity, adjusting total time if needed\n */\n closeActivity() {\n if (!this.closed) {\n if (this.lastAction)\n this.totalTime = this.lastAction.time - this.startTime;\n else\n this.totalTime = (new Date()).valueOf() - this.startTime;\n this.closed = true;\n }\n }\n\n /**\n * calculates the final score obtained by the user in this activity.\n * The algorithm used takes in account the minimal number of actions needed, the actions\n * really done by the user, and if the activity was finally solved or not.\n * @returns {number}\n */\n getPrecision() {\n let result = 0;\n if (this.closed && this.minActions > 0 && this.numActions > 0) {\n if (this.solved) {\n if (this.numActions < this.minActions)\n result = 100;\n else\n result = Math.round(this.minActions * 100 / this.numActions);\n } else\n result = Math.round(100 * (this.score * this.score) / (this.minActions * this.numActions));\n }\n return result;\n }\n\n /**\n * This method should be called when the current activity finishes. Data about user's final results\n * on the activity will then be saved.\n * @param {number} score - The final score, usually in a 0-100 scale.\n * @param {number} numActions - The total number of actions done by the user to solve the activity\n * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.\n */\n endActivity(score, numActions, solved) {\n if (!this.closed) {\n this.solved = solved;\n this.numActions = numActions;\n this.score = score;\n this.closeActivity();\n }\n }\n}\n\nObject.assign(ActivityReg.prototype, {\n /**\n * Name of the associated activity\n * @name module:report/ActivityReg.ActivityReg#name\n * @type {string} */\n name: '',\n /**\n * Optional code assigned to this activity, used for later filtering\n * @name module:report/ActivityReg.ActivityReg#code\n * @type {string} */\n code: '',\n /**\n * Timestamp when the user starts playing the activity\n * @name module:report/ActivityReg.ActivityReg#startTime\n * @type {number} */\n startTime: 0,\n /**\n * Total time spent by the user in the activity, measured in milliseconds\n * @name module:report/ActivityReg.ActivityReg#totalTime\n * @type {number} */\n totalTime: 0,\n /**\n * Collection of actions done by the user while playing the activity\n * @name module:report/ActivityReg.ActivityReg#actions\n * @type {module:report/ActionReg.ActionReg[]} */\n actions: [],\n /**\n * `true` only when the user has finished and solved the activity\n * @name module:report/ActivityReg.ActivityReg#solved\n * @type {boolean} */\n solved: false,\n /**\n * Last {@link module:report/ActionReg.ActionReg ActionReg} performed by the user in this activity\n * @name module:report/ActivityReg.ActivityReg#lastAction\n * @type {module:report/ActionReg.ActionReg} */\n lastAction: null,\n /**\n * Final score obtained by the current user in this activity\n * @name module:report/ActivityReg.ActivityReg#score\n * @type {number} */\n score: 0,\n /**\n * Minimum number of actions needed to solve the activity\n * @name module:report/ActivityReg.ActivityReg#minActions\n * @type {number} */\n minActions: 0,\n /**\n * `true` when the activity has finished, `false` for the activity that is currently playing\n * @name module:report/ActivityReg.ActivityReg#closed\n * @type {boolean} */\n closed: false,\n /**\n * `true` when this type of activity should record specific actions done by the users\n * @name module:report/ActivityReg.ActivityReg#reportActions\n * @type {boolean} */\n reportActions: false,\n /**\n * Number of actions done by the user playing this activity\n * @name module:report/ActivityReg.ActivityReg#numActions\n * @type {number} */\n numActions: 0,\n});\n\nexport default ActivityReg;\n","/**\n * File : report/SequenceReg.js\n * Created : 17/05/2016\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 ActivityReg from './ActivityReg.js';\n\n/**\n * This class stores the results of the activities related to an {@link module:bags/ActivitySequenceElement.ActivitySequenceElement ActivitySequenceElement}.\n * It's main component is an array of {@link module:report/ActivityReg.ActivityReg ActivityReg} elements.\n */\nexport class SequenceReg {\n /**\n * SequenceReg constructor\n * @param {module:bags/ActivitySequenceElement.ActivitySequenceElement} ase - The {@link module:bags/ActivitySequenceElement.ActivitySequenceElement ActivitySequenceElement} related to this sequence.\n */\n constructor(ase) {\n this.name = ase.tag;\n this.description = ase.description;\n this.activities = [];\n this.currentActivity = null;\n this.totalTime = 0;\n this.closed = false;\n this.info = new SequenceRegInfo(this);\n }\n\n /**\n * Builds a complex object with data about the results of the activities done in this sequence\n * @returns {object} - The sequence results\n */\n getData() {\n const result = {\n sequence: this.name,\n activities: []\n };\n this.activities.forEach(act => result.activities.push(act.getData()));\n return result;\n }\n\n /**\n * Returns the `info` element associated to this SequenceReg.\n * @returns {module:report/SequenceReg.SequenceRegInfo}\n */\n getInfo() {\n return this.info.recalc();\n }\n\n /**\n * This method should be called when the current working session finishes.\n */\n endSequence() {\n if (this.currentActivity && this.activities.length > 0) {\n if (!this.currentActivity.closed)\n this.currentActivity.closeActivity();\n this.totalTime = this.currentActivity.startTime + this.currentActivity.totalTime - this.activities[0].startTime;\n this.info.valid = false;\n }\n }\n\n /**\n * This method should be invoked when the user starts a new activity\n * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} that has just started\n */\n newActivity(act) {\n if (!this.closed) {\n this.currentActivity = new ActivityReg(act);\n this.activities.push(this.currentActivity);\n this.info.valid = false;\n }\n }\n\n /**\n * This method should be called when the current activity finishes. Data about user's final results\n * on the activity will then be saved.\n * @param {number} score - The final score, usually in a 0-100 scale.\n * @param {number} numActions - The total number of actions done by the user to solve the activity\n * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.\n */\n endActivity(score, numActions, solved) {\n if (this.currentActivity) {\n this.currentActivity.endActivity(score, numActions, solved);\n this.info.valid = false;\n }\n }\n\n /**\n * Reports a new action done by the user while playing the current activity\n * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)\n * @param {string}+ source - Description of the object on which the action is done.\n * @param {string}+ dest - Description of the object that acts as a target of the action (used in pairings)\n * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwise\n */\n newAction(type, source, dest, ok) {\n if (this.currentActivity) {\n this.currentActivity.newAction(type, source, dest, ok);\n this.info.valid = false;\n }\n }\n}\n\nObject.assign(SequenceReg.prototype, {\n /**\n * The `tag` member of the associated {@link module:bags/ActivitySequenceElement.ActivitySequenceElement ActivitySequenceElement}\n * @name module:report/SequenceReg.SequenceReg#name\n * @type {string} */\n name: '',\n /**\n * Optional description given to the {@link module:bags/ActivitySequenceElement.ActivitySequenceElement ActivitySequenceElement}\n * @name module:report/SequenceReg.SequenceReg#description\n * @type {string} */\n description: '',\n /**\n * Collection of all the {@link module:report/ActivityReg.ActivityReg ActivityReg} elements done during this sequence.\n * @name module:report/SequenceReg.SequenceReg#activities\n * @type {module:report/ActivityReg.ActivityReg[]} */\n activities: [],\n /**\n * Registry linked to the {@link module:Activity.Activity Activity} that is currently running\n * @name module:report/SequenceReg.SequenceReg#currentActivity\n * @type {module:report/ActivityReg.ActivityReg} */\n currentActivity: null,\n /**\n * Total time spent on the activities of this sequence\n * @name module:report/SequenceReg.SequenceReg#totalTime\n * @type {number} */\n totalTime: 0,\n /**\n * Flag indicating if the sequence is closed or already available for more activities\n * @name module:report/SequenceReg.SequenceReg#closed\n * @type {boolean} */\n closed: false,\n /**\n * Object with global information associated to this sequence\n * @name module:report/SequenceReg.SequenceReg#info\n * @type {module:report/SequenceReg.SequenceRegInfo} */\n info: null,\n});\n\n/**\n * This object stores the global results of a {@link module:report/SequenceReg.SequenceReg SequenceReg}\n */\nexport class SequenceRegInfo {\n /**\n * SequenceRegInfo constructor\n * @param {module:report/SequenceReg.SequenceReg} sqReg - The {@link module:report/SequenceReg.SequenceReg SequenceReg} associated tho this `Info` object.\n */\n constructor(sqReg) {\n this.sqReg = sqReg;\n }\n\n /**\n * Clears all global data associated with this sequence\n */\n clear() {\n this.nActivities = this.nActClosed = this.nActSolved = this.nActScore = 0;\n this.ratioSolved = this.nActions = this.tScore = this.tTime = 0;\n this.valid = false;\n }\n\n /**\n * Computes the value of all global variables based on the data stored in `activities`\n * @returns {module:report/SequenceReg.SequenceRegInfo} - This \"info\" object\n */\n recalc() {\n if (!this.valid) {\n this.clear();\n this.nActivities = this.sqReg.activities.length;\n if (this.nActivities > 0) {\n this.sqReg.activities.forEach(ar => {\n if (ar.closed) {\n this.nActClosed++;\n this.tTime += ar.totalTime;\n this.nActions += ar.numActions;\n if (ar.solved)\n this.nActSolved++;\n const r = ar.getPrecision();\n if (r >= 0) {\n this.tScore += r;\n this.nActScore++;\n }\n }\n });\n if (this.nActClosed > 0)\n this.ratioSolved = this.nActSolved / this.nActClosed;\n if (this.nActScore > 0)\n this.tScore = Math.round(this.tScore / this.nActScore);\n }\n this.valid = true;\n }\n return this;\n }\n}\n\nObject.assign(SequenceRegInfo.prototype, {\n /**\n * The {@link module:report/SequenceReg.SequenceReg SequenceReg} associated to this \"info\" object\n * @name module:report/SequenceReg.SequenceRegInfo#sqReg\n * @type {module:report/SequenceReg.SequenceReg} */\n sqReg: null,\n /**\n * When `false`, data must be recalculated\n * @name module:report/SequenceReg.SequenceRegInfo#valid\n * @type {boolean} */\n valid: false,\n /**\n * Number of activities played in this sequence\n * @name module:report/SequenceReg.SequenceRegInfo#nActivities\n * @type {number} */\n nActivities: 0,\n /**\n * Number of activities already closed\n * @name module:report/SequenceReg.SequenceRegInfo#nActClosed\n * @type {number} */\n nActClosed: 0,\n /**\n * Number of activities solved\n * @name module:report/SequenceReg.SequenceRegInfo#nActSolved\n * @type {number} */\n nActSolved: 0,\n /**\n * Number of activities with score > 0\n * @name module:report/SequenceReg.SequenceRegInfo#nActScore\n * @type {number} */\n nActScore: 0,\n /**\n * Percentage of solved activities\n * @name module:report/SequenceReg.SequenceRegInfo#ratioSolved\n * @type {number} */\n ratioSolved: 0,\n /**\n * Number of actions done by the user while in this sequence\n * @name module:report/SequenceReg.SequenceRegInfo#nActions\n * @type {number} */\n nActions: 0,\n /**\n * Sum of the scores of all the activities played\n * @name module:report/SequenceReg.SequenceRegInfo#tScore\n * @type {number} */\n tScore: 0,\n /**\n * Sum of the playing time reported by each activity (not always equals to the sequence's total time)\n * @name module:report/SequenceReg.SequenceRegInfo#tTime\n * @type {number} */\n tTime: 0,\n});\n\nSequenceReg.Info = SequenceRegInfo;\n\nexport default SequenceReg;\n"],"names":[],"sourceRoot":""}