jclic 2.1.21 → 2.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/jclic-node.js +1 -1
- package/dist/jclic-node.js.map +1 -1
- package/dist/jclic.min.js +2 -2
- package/dist/jclic.min.js.map +1 -1
- package/package.json +1 -1
- package/src/GlobalData.js +1 -1
- package/dist/1078.jclic-node.js +0 -282
- package/dist/1078.jclic-node.js.map +0 -1
- package/dist/1196.jclic-node.js +0 -808
- package/dist/1196.jclic-node.js.map +0 -1
- package/dist/1253.jclic-node.js +0 -1432
- package/dist/1253.jclic-node.js.map +0 -1
- package/dist/13.jclic-node.js +0 -103
- package/dist/13.jclic-node.js.map +0 -1
- package/dist/1567.jclic-node.js +0 -2313
- package/dist/1567.jclic-node.js.map +0 -1
- package/dist/1588.jclic-node.js +0 -602
- package/dist/1588.jclic-node.js.map +0 -1
- package/dist/1725.jclic-node.js +0 -836
- package/dist/1725.jclic-node.js.map +0 -1
- package/dist/1731.jclic-node.js +0 -438
- package/dist/1731.jclic-node.js.map +0 -1
- package/dist/1842.jclic-node.js +0 -651
- package/dist/1842.jclic-node.js.map +0 -1
- package/dist/2160.jclic-node.js +0 -1016
- package/dist/2160.jclic-node.js.map +0 -1
- package/dist/222.jclic-node.js +0 -129
- package/dist/222.jclic-node.js.map +0 -1
- package/dist/2316.jclic-node.js +0 -949
- package/dist/2316.jclic-node.js.map +0 -1
- package/dist/2355.jclic-node.js +0 -371
- package/dist/2355.jclic-node.js.map +0 -1
- package/dist/2366.jclic-node.js +0 -431
- package/dist/2366.jclic-node.js.map +0 -1
- package/dist/2379.jclic-node.js +0 -202
- package/dist/2379.jclic-node.js.map +0 -1
- package/dist/2437.jclic-node.js +0 -450
- package/dist/2437.jclic-node.js.map +0 -1
- package/dist/2531.jclic-node.js +0 -869
- package/dist/2531.jclic-node.js.map +0 -1
- package/dist/2608.jclic-node.js +0 -160
- package/dist/2608.jclic-node.js.map +0 -1
- package/dist/2715.jclic-node.js +0 -554
- package/dist/2715.jclic-node.js.map +0 -1
- package/dist/277.jclic-node.js +0 -22
- package/dist/277.jclic-node.js.map +0 -1
- package/dist/2921.jclic-node.js +0 -660
- package/dist/2921.jclic-node.js.map +0 -1
- package/dist/2952.jclic-node.js +0 -101
- package/dist/2952.jclic-node.js.map +0 -1
- package/dist/3018.jclic-node.js +0 -421
- package/dist/3018.jclic-node.js.map +0 -1
- package/dist/3019.jclic-node.js +0 -682
- package/dist/3019.jclic-node.js.map +0 -1
- package/dist/3231.jclic-node.js +0 -274
- package/dist/3231.jclic-node.js.map +0 -1
- package/dist/331.jclic-node.js +0 -115
- package/dist/331.jclic-node.js.map +0 -1
- package/dist/3391.jclic-node.js +0 -276
- package/dist/3391.jclic-node.js.map +0 -1
- package/dist/3502.jclic-node.js +0 -671
- package/dist/3502.jclic-node.js.map +0 -1
- package/dist/3653.jclic-node.js +0 -982
- package/dist/3653.jclic-node.js.map +0 -1
- package/dist/371.jclic.min.js +0 -2
- package/dist/371.jclic.min.js.map +0 -1
- package/dist/3856.jclic-node.js +0 -575
- package/dist/3856.jclic-node.js.map +0 -1
- package/dist/4112.jclic-node.js +0 -659
- package/dist/4112.jclic-node.js.map +0 -1
- package/dist/4123.jclic-node.js +0 -910
- package/dist/4123.jclic-node.js.map +0 -1
- package/dist/427.jclic-node.js +0 -894
- package/dist/427.jclic-node.js.map +0 -1
- package/dist/4483.jclic-node.js +0 -327
- package/dist/4483.jclic-node.js.map +0 -1
- package/dist/4548.jclic-node.js +0 -1078
- package/dist/4548.jclic-node.js.map +0 -1
- package/dist/466.jclic-node.js +0 -99
- package/dist/466.jclic-node.js.map +0 -1
- package/dist/485.jclic-node.js +0 -783
- package/dist/485.jclic-node.js.map +0 -1
- package/dist/4921.jclic-node.js +0 -500
- package/dist/4921.jclic-node.js.map +0 -1
- package/dist/5091.jclic-node.js +0 -239
- package/dist/5091.jclic-node.js.map +0 -1
- package/dist/520.jclic-node.js +0 -550
- package/dist/520.jclic-node.js.map +0 -1
- package/dist/5312.jclic-node.js +0 -1126
- package/dist/5312.jclic-node.js.map +0 -1
- package/dist/5338.jclic-node.js +0 -212
- package/dist/5338.jclic-node.js.map +0 -1
- package/dist/5344.jclic-node.js +0 -229
- package/dist/5344.jclic-node.js.map +0 -1
- package/dist/5550.jclic-node.js +0 -238
- package/dist/5550.jclic-node.js.map +0 -1
- package/dist/5626.jclic-node.js +0 -614
- package/dist/5626.jclic-node.js.map +0 -1
- package/dist/5977.jclic-node.js +0 -1081
- package/dist/5977.jclic-node.js.map +0 -1
- package/dist/6148.jclic-node.js +0 -345
- package/dist/6148.jclic-node.js.map +0 -1
- package/dist/6176.jclic-node.js +0 -481
- package/dist/6176.jclic-node.js.map +0 -1
- package/dist/6221.jclic-node.js +0 -1072
- package/dist/6221.jclic-node.js.map +0 -1
- package/dist/6238.jclic-node.js +0 -718
- package/dist/6238.jclic-node.js.map +0 -1
- package/dist/6454.jclic-node.js +0 -1413
- package/dist/6454.jclic-node.js.map +0 -1
- package/dist/6565.jclic-node.js +0 -294
- package/dist/6565.jclic-node.js.map +0 -1
- package/dist/6579.jclic-node.js +0 -719
- package/dist/6579.jclic-node.js.map +0 -1
- package/dist/6715.jclic-node.js +0 -148
- package/dist/6715.jclic-node.js.map +0 -1
- package/dist/6777.jclic-node.js +0 -171
- package/dist/6777.jclic-node.js.map +0 -1
- package/dist/6782.jclic-node.js +0 -1611
- package/dist/6782.jclic-node.js.map +0 -1
- package/dist/6847.jclic-node.js +0 -601
- package/dist/6847.jclic-node.js.map +0 -1
- package/dist/6856.jclic-node.js +0 -252
- package/dist/6856.jclic-node.js.map +0 -1
- package/dist/696.jclic-node.js +0 -1821
- package/dist/696.jclic-node.js.map +0 -1
- package/dist/698.jclic-node.js +0 -583
- package/dist/698.jclic-node.js.map +0 -1
- package/dist/704.jclic-node.js +0 -80
- package/dist/704.jclic-node.js.map +0 -1
- package/dist/7046.jclic-node.js +0 -735
- package/dist/7046.jclic-node.js.map +0 -1
- package/dist/7220.jclic-node.js +0 -156
- package/dist/7220.jclic-node.js.map +0 -1
- package/dist/7257.jclic-node.js +0 -931
- package/dist/7257.jclic-node.js.map +0 -1
- package/dist/743.jclic-node.js +0 -583
- package/dist/743.jclic-node.js.map +0 -1
- package/dist/757.jclic-node.js +0 -1072
- package/dist/757.jclic-node.js.map +0 -1
- package/dist/7781.jclic-node.js +0 -202
- package/dist/7781.jclic-node.js.map +0 -1
- package/dist/7912.jclic-node.js +0 -2103
- package/dist/7912.jclic-node.js.map +0 -1
- package/dist/827.jclic-node.js +0 -708
- package/dist/827.jclic-node.js.map +0 -1
- package/dist/8276.jclic-node.js +0 -409
- package/dist/8276.jclic-node.js.map +0 -1
- package/dist/8322.jclic-node.js +0 -498
- package/dist/8322.jclic-node.js.map +0 -1
- package/dist/8641.jclic-node.js +0 -360
- package/dist/8641.jclic-node.js.map +0 -1
- package/dist/8837.jclic-node.js +0 -651
- package/dist/8837.jclic-node.js.map +0 -1
- package/dist/8895.jclic-node.js +0 -151
- package/dist/8895.jclic-node.js.map +0 -1
- package/dist/9072.jclic-node.js +0 -1285
- package/dist/9072.jclic-node.js.map +0 -1
- package/dist/9078.jclic-node.js +0 -935
- package/dist/9078.jclic-node.js.map +0 -1
- package/dist/9103.jclic-node.js +0 -718
- package/dist/9103.jclic-node.js.map +0 -1
- package/dist/9359.jclic-node.js +0 -145
- package/dist/9359.jclic-node.js.map +0 -1
- package/dist/9409.jclic-node.js +0 -921
- package/dist/9409.jclic-node.js.map +0 -1
- package/dist/9513.jclic-node.js +0 -720
- package/dist/9513.jclic-node.js.map +0 -1
- package/dist/9704.jclic-node.js +0 -81
- package/dist/9704.jclic-node.js.map +0 -1
- package/dist/9950.jclic-node.js +0 -827
- package/dist/9950.jclic-node.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"9950.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;AAC4B;AACf;AACM;;AAE1C;AACA;AACA,wDAAwD,4DAA4D;AACpH,2CAA2C,mDAAmD;AAC9F;AACO;AACP;AACA;AACA,aAAa,0CAA0C;AACvD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA,sBAAsB,2DAAe;AACrC,wBAAwB,6CAAC;AACzB;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA,sBAAsB,2DAAe;AACrC;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,cAAc,mDAAmD;AACjE,aAAa,QAAQ;AACrB,aAAa,SAAS;AACtB;AACA,eAAe;AACf;AACA;AACA,WAAW,2DAAM;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,mDAAmD;AAChE,aAAa,QAAQ;AACrB,aAAa,SAAS,+BAA+B,mDAAmD;AACxG;AACA,eAAe;AACf;AACA;AACA;AACA;AACA,aAAa,2DAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,2DAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA,IAAI,kDAAM;AACV;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB;AACA,aAAa,UAAU;AACvB,aAAa,gCAAgC,+CAA+C,iDAAiD;AAC7I,eAAe,QAAQ;AACvB;AACA;AACA;AACA,IAAI,kDAAM;AACV;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI,kDAAM;AACV;AACA,QAAQ,wDAAG;AACX;AACA,QAAQ;AACR;AACA,KAAK;AACL;AACA;;AAEA;AACA,cAAc,mCAAmC;AACjD,aAAa,QAAQ;AACrB,aAAa,QAAQ,UAAU,kDAAkD;AACjF,eAAe;AACf;AACA;AACA,WAAW,sDAAI;AACf;AACA;;AAEA;AACA;AACA,wBAAwB,mDAAmD;AAC3E;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,0CAA0C;AACtD;AACA,CAAC;;AAED,iEAAe,QAAQ,EAAC;;;;;;;;;;;;;;;;;;;;ACrNxB;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;AAC4B;AACQ;AAChB;AACL;AAC+B;AACpC;;AAEjC;AACA;AACA;AACA;AACA;AACA,OAAO,qEAAqE;AAC5E;AACA,OAAO,qEAAqE;AAC5E,OAAO,6CAA6C;AACpD;AACO;AACP;AACA;AACA;AACA;AACA,wBAAwB,2DAAe;AACvC,gCAAgC,iEAAgB;AAChD;AACA,wBAAwB,yDAAQ;AAChC;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B,aAAa,QAAQ;AACrB,aAAa,gBAAgB;AAC7B,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gEAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,yDAAQ;AACjB,MAAM,mDAAI;AACV;AACA,mBAAmB,6CAAC;AACpB,uBAAuB,2DAAM;AAC7B;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,oDAAQ;AAChD,KAAK;;AAEL,WAAW,4DAAO;AAClB;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,gBAAgB;AAC7B,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gEAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI,mDAAI;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA,4DAA4D,yCAAyC;AACrG,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA,WAAW,oDAAQ,8BAA8B,2DAAM;AACvD;;AAEA;AACA;AACA,iBAAiB,kCAAkC,GAAG,wDAAwD,KAAK,8CAA8C;AACjK,aAAa,gCAAgC,iCAAiC,iDAAiD;AAC/H;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;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,gDAAgD;AAC5D;AACA;AACA;AACA;AACA,YAAY,+CAA+C;AAC3D;AACA;AACA;AACA,kDAAkD,wEAAwE;AAC1H;AACA;AACA,YAAY,mBAAmB;AAC/B;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,YAAY,+BAA+B;AAC3C;AACA;AACA;AACA;AACA,YAAY,wBAAwB;AACpC;AACA;AACA;AACA,WAAW;AACX;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,gBAAgB;AAC5B;AACA,CAAC;;AAED,iEAAe,YAAY,EAAC;;;;;;;;;;;;;;;;ACzR5B;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;;AAEA;;AAEuB;AAC2B;AACyF;;AAE3I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,aAAa,0CAA0C;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,mEAAc;AAC7C;AACA;AACA,UAAU,6CAAC,iEAAiE,iEAAY;AACxF;AACA;AACA,4BAA4B,yEAAoB,CAAC,iEAAY;AAC7D;AACA;AACA,kCAAkC,yEAAoB,CAAC,iEAAY;AACnE;AACA;AACA,2BAA2B,yEAAoB,CAAC,iEAAY;AAC5D;AACA,4BAA4B,iEAAY;AACxC;AACA;AACA;AACA,8BAA8B,wEAAmB;AACjD;AACA;AACA,iCAAiC,6DAAW;AAC5C,yCAAyC,6CAAC;AAC1C;AACA;AACA,8BAA8B,6CAAC;AAC/B;AACA;AACA,sBAAsB,iEAAY;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,mEAAc;AACvC;AACA;AACA;AACA,sBAAsB,mEAAc;AACpC;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ,YAAY,wDAAG,+BAA+B,KAAK;AACnD;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,WAAW,4DAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA,IAAI,4DAAO;AACX;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,0CAA0C;AACtD;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,MAAM;AACN;AACA,YAAY,UAAU;AACtB;AACA;AACA,mGAAmG;AACnG;AACA,YAAY,QAAQ;AACpB;AACA;AACA,eAAe,wDAAwD;AACvE;AACA,YAAY,sCAAsC;AAClD,mBAAmB,6DAAW;AAC9B,CAAC;;AAED,iEAAe,eAAe,EAAC","sources":["webpack://jclic/./src/bags/MediaBag.js","webpack://jclic/./src/project/JClicProject.js","webpack://jclic/./src/project/ProjectSettings.js"],"sourcesContent":["/**\n * File : bags/MediaBag.js\n * Created : 07/04/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 MediaBagElement from './MediaBagElement.js';\nimport Skin from '../skins/Skin.js';\nimport { log, nSlash } from '../Utils.js';\n\n/**\n * This class stores and manages all the media components (images, sounds, animations, video,\n * MIDI files, etc.) needed to run the activities of a {@link module:project/JClicProject.JClicProject JClicProject}. The main member of\n * the class is `elements`. This is where {@link module:bads/MediaBagElement.MediaBagElement} objects are stored.\n */\nexport class MediaBag {\n /**\n * MediaBag constructor\n * @param {module:project/JClicProject.JClicProject} project - The JClic project to which this media bag belongs\n */\n constructor(project) {\n this.project = project;\n this.elements = {};\n }\n\n /**\n * Loads this object settings from a specific JQuery XML element\n * @param {external:jQuery} $xml - The XML element to parse\n */\n setProperties($xml) {\n $xml.children('media').each((_n, child) => {\n const mbe = new MediaBagElement(this.project.basePath, null, this.project.zip);\n mbe.setProperties($(child));\n this.elements[mbe.name] = mbe;\n });\n return this;\n }\n\n /**\n * Gets a object with the basic attributes needed to rebuild this instance excluding functions,\n * parent references, constants and also attributes retaining the default value.\n * The resulting object is commonly usued to serialize elements in JSON format.\n * @returns {object} - The resulting object, with minimal attrributes\n */\n getAttributes() {\n return Object.keys(this.elements).map(k => this.elements[k].getAttributes());\n }\n\n /**\n * Loads the MediaBag content from a data object\n * @param {object} data - The data object to parse\n */\n setAttributes(data) {\n data.forEach(el => {\n const mbe = new MediaBagElement(this.project.basePath, null, this.project.zip);\n mbe.setAttributes(el);\n this.elements[mbe.name] = mbe;\n });\n return this;\n }\n\n /**\n * Finds a {@link module:bads/MediaBagElement.MediaBagElement} by its name, creating a new one if not found and requested.\n * @param {string} name - The name of the element\n * @param {boolean} [create] - When `true`, a new MediaBagElement will be created if not found,\n * using 'name' as its file name.\n * @returns {module:bags/MediaBagElement.MediaBagElement}\n */\n getElement(name, create) {\n name = nSlash(name);\n let result = this.elements[name];\n if (create && !result)\n result = this.getElementByFileName(name, create);\n return result;\n }\n\n /**\n * Gets a {@link module:bads/MediaBagElement.MediaBagElement} by its file name.\n * @param {string} file - The requested file name\n * @param {boolean} [create] - When `true`, a new {@link module:bads/MediaBagElement.MediaBagElement} will be created if not\n * found.\n * @returns {module:bags/MediaBagElement.MediaBagElement}\n */\n getElementByFileName(file, create) {\n let result = null;\n if (file) {\n file = nSlash(file);\n for (let name in this.elements) {\n if (this.elements[name].file === file) {\n result = this.elements[name];\n break;\n }\n }\n if (!result && create) {\n result = new MediaBagElement(this.project.basePath, null, this.project.zip);\n result.name = file;\n result.file = file;\n result.ext = file.toLowerCase().split('#')[0].split('.').pop();\n result.type = result.getFileType(result.ext);\n this.elements[result.name] = result;\n }\n }\n return result;\n }\n\n /**\n * Get the names of the media elements that are of the given type.\n * When the search type is `font`, the `fontName` property is used instead of `name`\n * @param {string} type - The type of elements to search\n * @returns {string[]}\n */\n getElementsOfType(type) {\n const result = [];\n $.each(this.elements, (name, element) => {\n if (element.type === type)\n result.push(type === 'font' ? element.fontName : name);\n });\n return result;\n }\n\n /**\n * Preloads all resources.\n *\n * __Use with care!__ Calling this method will start loading all the resources defined in the\n * MediaBag, whether used or not in the current activity.\n * @param {string} type - The type of media to be build. When `null` or `undefined`, all\n * resources will be build.\n * @param {function} [callback] - Function to be called when each element is ready.\n * @param {module:JClicPlayer.JClicPlayer} [ps] - An optional `PlayStation` (currently a {@link module:JClicPlayer.JClicPlayer JClicPlayer}) used to dynamically load fonts\n * @returns {number} - The total number of elements that will be built\n */\n buildAll(type, callback, ps) {\n let count = 0;\n $.each(this.elements, (name, element) => {\n if (!type || element.type === type) {\n element.build(callback, ps, false);\n count++;\n }\n });\n return count;\n }\n\n /**\n * Checks if there are media waiting to be loaded\n * @returns {number} - The amount of media elements already loaded, or -1 if all elements are ready\n */\n countWaitingElements() {\n let\n ready = 0,\n allReady = true;\n\n // Only for debug purposes: return always 'false'\n // TODO: Check loading process!\n $.each(this.elements, (name, element) => {\n if (element.data && !element.ready && !element.checkReady() && !element.checkTimeout()) {\n log('debug', '... waiting for: %s', name);\n allReady = false;\n } else\n ready++;\n });\n return allReady ? -1 : ready;\n }\n\n /**\n * Loads a {@link module:skins/Skin.Skin Skin} object\n * @param {string} name - The skin name to be loaded\n * @param {string} ps - The {@link module:JClicPlayer.JClicPlayer JClicPlayer} linked to the skin\n * @returns {module:skins/Skin.Skin}\n */\n getSkinElement(name, ps) {\n return Skin.getSkin(name, ps);\n }\n}\n\nObject.assign(MediaBag.prototype, {\n /**\n * The collection of {@link module:bads/MediaBagElement.MediaBagElement} objects\n * @name module:bags/MediaBag.MediaBag#elements\n * @type {object} */\n elements: null,\n /**\n * The JClic project to which this MediaBag belongs\n * @name module:bags/MediaBag.MediaBag#project\n * @type {module:project/JClicProject.JClicProject} */\n project: null,\n});\n\nexport default MediaBag;\n","/**\n * File : project/JClicProject.js\n * Created : 01/04/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 ProjectSettings from './ProjectSettings.js';\nimport ActivitySequence from '../bags/ActivitySequence.js';\nimport MediaBag from '../bags/MediaBag.js';\nimport Activity from '../Activity.js';\nimport { getBasePath, nSlash, getAttr, settings } from '../Utils.js';\nimport { Font } from '../AWT.js';\n\n/**\n * JClicProject contains all the components of a JClic project: activities, sequences, media\n * files, descriptors and metadata.\n *\n * This encapsulation is achieved by three auxiliary objects:\n * - {@link module:project/ProjectSettings.ProjectSettings ProjectSettings}: stores metadata like full title, description, authors, languages,\n * educational topics...\n * - {@link module:bags/ActivitySequence.ActivitySequence ActivitySequence}: defines the order in which the activities must be shown.\n * - {@link module:bags/MediaBag.MediaBag MediaBag}: contains the list of all media files used by the activities\n */\nexport class JClicProject {\n /**\n * JClicProject constructor\n */\n constructor() {\n this.settings = new ProjectSettings(this);\n this.activitySequence = new ActivitySequence(this);\n this._activities = {};\n this.mediaBag = new MediaBag(this);\n }\n\n /**\n * Loads the project settings from a main jQuery XML element\n * @param {external:jQuery} $xml - The XML element\n * @param {string} path - The full path of this project\n * @param {external:JSZip} [zip] - An optional JSZip object where this project is encapsulated\n * @param {object} [options] - An object with miscellaneous options\n * @returns {module:project/JClicProject.JClicProject}\n */\n setProperties($xml, path, zip, options) {\n if (path) {\n this.path = path;\n if (path.file)\n this.basePath = path;\n else\n this.basePath = getBasePath(path);\n }\n this.zip = zip;\n this.name = $xml.attr('name');\n this.version = $xml.attr('version');\n if ($xml.attr('type') !== undefined && $xml.attr('type') !== '')\n this.type = $xml.attr('type');\n if ($xml.attr('code') !== undefined && $xml.attr('code') !== '')\n this.code = $xml.attr('code');\n this.settings.setProperties($xml.children('settings'));\n this.activitySequence.setProperties($xml.children('sequence'));\n this.mediaBag.setProperties($xml.children('mediaBag'));\n this.reportableActs = 0;\n this._activities = {};\n const $node = $xml.children('activities');\n const $acts = $node.children('activity');\n const ownFonts = this.mediaBag.getElementsOfType('font');\n if (ownFonts.length > 0)\n options.ownFonts = (options.ownFonts || []).concat(ownFonts);\n // Skip checkTree when in NodeJS, due to a JSDOM error with jQuery in XML mode\n if (!settings.NODEJS)\n Font.checkTree($acts, options);\n $acts.each((_n, act) => {\n const $act = $(act);\n this._activities[nSlash($act.attr('name'))] = $act;\n if ($act.children('settings').attr('report') === 'true')\n this.reportableActs++;\n });\n return this;\n }\n\n /**\n * Gets a object with the basic attributes needed to rebuild this instance excluding functions,\n * parent references, constants and also attributes retaining the default value.\n * The resulting object is commonly usued to serialize elements in JSON format.\n * @returns {object} - The resulting object, with minimal attrributes\n */\n getAttributes() {\n const keys = Object.keys(this._activities);\n this.activities = {};\n keys.forEach(k => {\n const act = this._activities[k];\n this.activities[k] = act.jquery ? Activity.getActivity(act, this) : act;\n });\n\n return getAttr(this, ['name', 'version', 'type', 'code', 'settings', 'activitySequence', 'activities', 'mediaBag']);\n }\n\n /**\n * Gets a JSON string representing the content of this project. This string can be transformed later into a data\n * object suitable for `setAttributes`.\n * @param {number} [space] - The number of white spaces to place between items. Defaults to zero (meaning all the JSON rendered in one single line)\n * @returns {string} - The JSON text\n */\n getJSON(space = 0) {\n return JSON.stringify(\n this.getAttributes(),\n (_key, val) => val.toFixed ? Number(val.toFixed(4)) : val,\n space\n );\n }\n\n /**\n * Loads the project settings from a data object\n * @param {object} data - The data object\n * @param {string} path - The full path of this project\n * @param {external:JSZip} [zip] - An optional JSZip object where this project is encapsulated\n * @param {object} [options] - An object with miscellaneous options\n * @returns {module:project/JClicProject.JClicProject}\n */\n setAttributes(data, path, zip, options) {\n if (path) {\n this.path = path;\n if (path.file)\n this.basePath = path;\n else\n this.basePath = getBasePath(path);\n }\n this.zip = zip;\n this.name = data.name;\n this.version = data.version;\n if (data.type)\n this.type = data.type;\n if (data.code)\n this.code = data.code;\n this.settings.setAttributes(data.settings);\n this.activitySequence.setAttributes(data.activitySequence);\n this.mediaBag.setAttributes(data.mediaBag);\n this.reportableActs = 0;\n this._activities = data.activities;\n\n const ownFonts = this.mediaBag.getElementsOfType('font');\n if (ownFonts.length > 0)\n options.ownFonts = (options.ownFonts || []).concat(ownFonts);\n // TODO: Check fonts\n Font.checkTree(this._activities, options);\n this.reportableActs = Object.keys(this._activities)\n .filter(k => this._activities[k].includeInReports)\n .length;\n return this;\n }\n\n /**\n * Finds activities by name and builds the corresponding {@link module:Activity.Activity Activity} object.\n * @param {string} name - The name of the requested activity\n * @returns {module:Activity.Activity}\n */\n getActivity(name) {\n return Activity.getActivity(this._activities[nSlash(name)], this);\n }\n\n /**\n *\n * Builds the {@link module:skins/Skin.Skin Skin}, {@link module:media/EventSounds.EventSounds EventSounds} and {@link module:bags/MediaBag.MediaBag MediaBag} fonts associated to this project.\n * @param {module:JClicPlayer.JClicPlayer} ps - The PlayStation (usually a {@link module:JClicPlayer.JClicPlayer JClicPlayer}) linked to this project.\n */\n realize(ps) {\n // Build skin\n if (this.skin === null && this.settings.skinFileName !== null && this.settings.skinFileName.length > 0)\n this.skin = this.mediaBag.getSkinElement(this.settings.skinFileName, ps);\n\n this.settings.eventSounds.realize(ps, this.mediaBag);\n\n // Build all elements of type `font`\n this.mediaBag.buildAll('font', null, ps);\n }\n\n /**\n * Run finalizers on realized objects\n */\n end() {\n // TODO: Implement JClicProject.end()\n }\n}\n\nObject.assign(JClicProject.prototype, {\n /**\n * The project's name\n * @name module:project/JClicProject.JClicProject#name\n * @type {string} */\n name: 'unknown',\n /**\n * The version of the XML file format used to save the project (currently 0.1.3)\n * @name module:project/JClicProject.JClicProject#version\n * @type {string} */\n version: '0.1.3',\n /**\n * Optional property that can be used by reporting systems\n * @name module:project/JClicProject.JClicProject#type\n * @type {string} */\n type: null,\n /**\n * Optional property that can be used by reporting systems\n * @name module:project/JClicProject.JClicProject#code\n * @type {string} */\n code: null,\n /**\n * Object containing the project settings\n * @name module:project/JClicProject.JClicProject#settings\n * @type {module:project/ProjectSettings.ProjectSettings} */\n settings: null,\n /**\n * Object containing the order in which the activities should be played\n * @name module:project/JClicProject.JClicProject#activitySequence\n * @type {module:bags/ActivitySequence.ActivitySequence} */\n activitySequence: null,\n /**\n * Array of jQuery xml elements containing the data of each activity. Don't rely on this object\n * to retrieve real activities. Use the method {@link module:project/JClicProject.JClicProject#getActivity getActivity} instead.\n * @name module:project/JClicProject.JClicProject#_activities\n * @private\n * @type {external:jQuery[]} */\n _activities: null,\n /**\n * Number of activities suitable to be included reports\n * @name module:project/JClicProject.JClicProject#reportableActs\n * @type {number}\n */\n reportableActs: 0,\n /**\n * The collection of all media elements used in this project\n * @name module:project/JClicProject.JClicProject#mediaBag\n * @type {module:bags/MediaBag.MediaBag} */\n mediaBag: null,\n /**\n * The object that builds and manages the visual interface presented to users\n * @name module:project/JClicProject.JClicProject#skin\n * @type {module:skins/Skin.Skin} */\n skin: null,\n /**\n * Relative path or absolute URL to be used as a base to access files, usually in conjunction\n * with {@link module:JClicPlayer.JClicPlayer#basePath}\n * @name module:project/JClicProject.JClicProject#basePath\n * @type {string} */\n basePath: '',\n /**\n * Full path of this project\n * @name module:project/JClicProject.JClicProject#path\n * @type {string} */\n path: null,\n /**\n * The JSZip object where this project is stored (can be `null`)\n * @name module:project/JClicProject.JClicProject#zip\n * @type {external:JSZip} */\n zip: null,\n});\n\nexport default JClicProject;\n","/**\n * File : project/ProjectSettings.js\n * Created : 01/04/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\n/* global window */\n\nimport $ from 'jquery';\nimport EventSounds from '../media/EventSounds.js';\nimport { log, getXmlNodeText, parseXmlNode, reduceTextsToStrings, parseOldDate, cleanOldLanguageTag, getAttr, setAttr } from '../Utils.js';\n\n/**\n * This class contains miscellaneous settings of JClic projects.\n *\n * In addition to the members of this class, there can be other properties in JClic project files\n * that are not currently loaded:\n * - iconFileName\n * - descriptors\n * - area\n * - level\n * - locale\n * - authors\n * - organizations\n * - revisions\n */\nexport class ProjectSettings {\n /**\n * ProjectSettings constructor\n * @param {module:project/JClicProject.JClicProject} project - The project to which this settings belongs\n */\n constructor(project) {\n this.project = project;\n this.authors = [];\n this.organizations = [];\n this.revisions = [];\n this.languages = [];\n this.locales = [];\n this.description = {};\n this.tags = {};\n }\n\n /**\n * Reads the ProjectSettings values from a JQuery XML element\n * @param {external:jQuery} $xml - The XML element to parse\n */\n setProperties($xml) {\n let single_description = null;\n const multiple_descriptions = [];\n\n $xml.children().each((_n, child) => {\n switch (child.nodeName) {\n case 'title':\n this.title = child.textContent;\n break;\n case 'description':\n single_description = getXmlNodeText(child);\n break;\n case 'descriptions':\n $(child).children().each((_n, desc) => multiple_descriptions.push(parseXmlNode(desc)));\n break;\n case 'author':\n this.authors.push(reduceTextsToStrings(parseXmlNode(child)));\n break;\n case 'organization':\n this.organizations.push(reduceTextsToStrings(parseXmlNode(child)));\n break;\n case 'revision':\n const revision = reduceTextsToStrings(parseXmlNode(child));\n if (revision.date)\n revision.date = parseOldDate(revision.date);\n this.revisions.push(revision);\n break;\n case 'language':\n this.languages.push(cleanOldLanguageTag(child.textContent));\n break;\n case 'eventSounds':\n this.eventSounds = new EventSounds();\n this.eventSounds.setProperties($(child));\n break;\n case 'skin':\n this.skinFileName = $(child).attr('file');\n break;\n case 'descriptors':\n this.tags = parseXmlNode(child, true);\n if (this.tags['#text']) {\n this.tags.other = this.tags['#text'].textContent;\n delete this.tags['#text'];\n }\n break;\n case 'license':\n this.license = getXmlNodeText(child);\n break;\n case 'cover':\n case 'thumb':\n const img = getXmlNodeText(child);\n if (img.file)\n this[child.nodeName] = img.file;\n break;\n }\n });\n\n this.buildLocales();\n\n multiple_descriptions.forEach(d => {\n if (d.language && d.text)\n this.description[d.language] = d.text;\n });\n\n if (single_description && this.languages.length > 0 && !this.description[this.languages[0]])\n this.description[this.languages[0]] = single_description;\n\n return this;\n }\n\n buildLocales() {\n // Try to find an array of valid locales\n // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl\n if (this.languages.length > 0 && window.Intl && window.Intl.getCanonicalLocales) {\n this.locales = [];\n this.languages.forEach(lang => {\n // Languages usually are stored in the form: \"English (en)\"\n const matches = /\\(([a-z,A-Z,-]+)\\)/.exec(lang);\n if (matches && matches.length > 1) {\n try {\n const canonicals = window.Intl.getCanonicalLocales(matches[1]);\n if (canonicals)\n this.locales = this.locales.concat(canonicals);\n } catch (_err) {\n log('error', `Invalid language: ${lang}`);\n }\n }\n });\n }\n return this;\n }\n\n /**\n * Gets a object with the basic attributes needed to rebuild this instance excluding functions,\n * parent references, constants and also attributes retaining the default value.\n * The resulting object is commonly usued to serialize elements in JSON format.\n * @returns {object} - The resulting object, with minimal attrributes\n */\n getAttributes() {\n return getAttr(this, [\n 'title', 'description',\n 'tags', 'languages', 'license',\n 'authors', 'organizations',\n 'revisions',\n 'cover', 'thumb',\n 'skinFileName', 'eventSounds'\n ]);\n }\n\n /**\n * Reads the properties of this ProjectSettings from a data object\n * @param {object} data - The data object to be parsed, or just the text content\n * @returns {module:project/ProjectSettings.ProjectSettings}\n */\n setAttributes(data) {\n setAttr(this, data, [\n 'title', 'description',\n 'tags', 'languages', 'license',\n 'authors', 'organizations',\n 'revisions',\n 'cover', 'thumb',\n 'skinFileName', 'eventSounds'\n ]);\n\n // Build Date objects in revisions\n if (this.revisions)\n this.revisions.forEach(rv => {\n if (rv.date)\n rv.date = new Date(rv.date);\n });\n\n return this.buildLocales();\n }\n}\n\nObject.assign(ProjectSettings.prototype, {\n /**\n * The JClicProject to which this ProjectSettings belongs\n * @name module:project/ProjectSettings.ProjectSettings#project\n * @type {module:project/JClicProject.JClicProject} */\n project: null,\n /**\n * The project title\n * @name module:project/ProjectSettings.ProjectSettings#title\n * @type {string} */\n title: 'Untitled',\n /**\n * The authors of this project.\n * Each author is represented by an object with the following attributes:\n * `name` (mandatory), `mail`, `rol`, `organization` and `url`\n * @name module:project/ProjectSettings.ProjectSettings#authors\n * @type {object[]} */\n authors: null,\n /**\n * Schools, companies and other institutions involved on this project.\n * Each organization is represented by an object with the following attributes:\n * `name` (mandatory), `mail`, `url`, `address`, `pc`, `city`, `state`, `country`, `comments`\n * @name module:project/ProjectSettings.ProjectSettings#organizations\n * @type {object[]} */\n organizations: null,\n /**\n * The history of revisions made to this project.\n * Revisions are represented by objects with the following attributes:\n * `date` (mandatory), `description`, `comments` and `author`\n * @name module:project/ProjectSettings.ProjectSettings#revisions\n * @type {object[]} */\n revisions: null,\n /**\n * Project's description, maybe in multiple languages.\n * @name module:project/ProjectSettings.ProjectSettings#description\n * @type {object} */\n description: null,\n /**\n * JClic projects can use more than one language, so use a string array\n * @name module:project/ProjectSettings.ProjectSettings#languages\n * @type {string[]} */\n languages: null,\n tags: null,\n cover: null,\n thumb: null,\n license: {\n type: 'by-nc-sa',\n url: 'https://creativecommons.org/licenses/by-nc-sa/4.0',\n },\n /**\n * Array of canonical locales, as defined in\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation|Intl}\n * @name module:project/ProjectSettings.ProjectSettings#locales\n * @type {string[]} */\n locales: null,\n /**\n * The name of an optional 'skin' (visual aspect) can be set for the whole project, or for each {@link module:Activity.Activity Activity}\n * @name module:project/ProjectSettings.ProjectSettings#skinFileName\n * @type {string} */\n skinFileName: null,\n /**\n * The main {@link module:media/EventSounds.EventSounds EventSounds} object of the project\n * @name module:project/ProjectSettings.ProjectSettings#eventSounds\n * @type {module:media/EventSounds.EventSounds} */\n eventSounds: new EventSounds(),\n});\n\nexport default ProjectSettings;\n"],"names":[],"sourceRoot":""}
|