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.
- package/CHANGELOG.md +13 -0
- package/dist/jclic-node.js +9 -8
- 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 +4 -4
- package/src/GlobalData.js +1 -1
- package/src/JClicPlayer.js +2 -2
- package/src/bags/MediaBag.js +6 -5
- 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":"743.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;;AAEA;;AAEuB;AACwB;AACa;AACX;AACJ;;AAE7C;AACA,wCAAwC,2FAA2F;AACnI,oBAAoB,oEAAoE,GAAG,oEAAoE,GAAG,4DAA4D,KAAK,wDAAwD;AAC3R;AACA;AACO,+BAA+B,2DAAQ;AAC9C;AACA;AACA,aAAa,0CAA0C;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,4CAA4C;AACxD;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,8BAA8B;AAC1C;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED;AACA,QAAQ,mDAAmD,iCAAiC,gFAAgF;AAC5K;AACA;AACA;AACO,oCAAoC,gEAAa;AACxD;AACA;AACA,aAAa,0BAA0B,WAAW,yCAAyC;AAC3F,aAAa,gCAAgC;AAC7C;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA,sEAAsE,4FAA4F;AAClK,aAAa,iBAAiB;AAC9B,aAAa,kEAAkE;AAC/E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qDAAqD,6CAA6C;;AAElG,sBAAsB,6CAAC,iBAAiB,kCAAkC;AAC1E,iBAAiB,6CAAC,aAAa,4BAA4B,QAAQ,cAAc;;AAEjF;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,6CAAC,eAAe,WAAW;AAC5C;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;;AAEA;AACA;AACA;AACA,iBAAiB,iEAAiE;AAClF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,6CAAC;AAChC;AACA,gBAAgB,kEAAa;AAC7B,mBAAmB,2BAA2B;AAC9C,iCAAiC,WAAW;AAC5C,iCAAiC;AACjC;AACA,+BAA+B;AAC/B;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA,0BAA0B,6CAAC;AAC3B;AACA;AACA;AACA,kBAAkB;AAClB;AACA,4BAA4B,6CAAC;AAC7B;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA,oBAAoB,6CAAC;AACrB,wBAAwB,2DAAS,wBAAwB,sBAAsB;AAC/E,wBAAwB,uDAAuD;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;;AAEA;AACA,oBAAoB,6CAAC;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,6CAAC,kBAAkB,6DAA6D;AACvG;AACA,+BAA+B,2DAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,gCAAgC,oCAAoC;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA,KAAK;;AAEL;;AAEA;AACA,0BAA0B,6CAAC,gBAAgB,mBAAmB;AAC9D;AACA,eAAe,iCAAiC;AAChD;AACA;AACA;;AAEA;AACA,iDAAiD,wCAAwC;;AAEzF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,wDAAwD;AACrE,aAAa,iBAAiB;AAC9B;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,gBAAgB;AACrC,aAAa,iBAAiB;AAC9B;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA,uCAAuC,yDAAO;AAC9C;AACA,oBAAoB,6CAAC,aAAa,4BAA4B;AAC9D,eAAe,cAAc;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,gBAAgB;AAC7B,eAAe,SAAS;AACxB,6CAA6C;AAC7C;AACA;AACA;AACA;;AAEA;AACA,aAAa,iBAAiB;AAC9B,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,+BAA+B,iBAAiB;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,mBAAmB,aAAa;AAChC;;AAEA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,mBAAmB;AAC/B;AACA;AACA;AACA,kCAAkC,qEAAqE;AACvG;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,gBAAgB;AAC5B;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,iBAAiB;AAC7B;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA,6BAA6B,wFAAwF;AACrH;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA,CAAC;;AAED;AACA,qDAAqD;AACrD,UAAU,OAAO;AACjB;;AAEA,iEAAe,gBAAgB,EAAC","sources":["webpack://jclic/./src/activities/text/TextActivityBase.js"],"sourcesContent":["/**\n * File : activities/text/TextActivityBase.js\n * Created : 16/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\n/* global window */\n\nimport $ from 'jquery';\nimport { stringToWords } from '../../Utils.js';\nimport { Activity, ActivityPanel } from '../../Activity.js';\nimport ActiveBox from '../../boxes/ActiveBox.js';\nimport BoxBase from '../../boxes/BoxBase.js';\n\n/**\n * This class and its visual component {@link module:activities/text/TextActivityBase.TextActivityBasePanel TextActivityBasePanel} are the base for text\n * 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}.\n * @extends module:Activity.Activity\n */\nexport class TextActivityBase extends Activity {\n /**\n * TextActivityBase constructor\n * @param {module:project/JClicProject.JClicProject} project - The project 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.document ? this.document.numTargets : 0;\n }\n}\n\nObject.assign(TextActivityBase.prototype, {\n /**\n * This is the object used to evaluate user's answers in text activities.\n * @name module:activities/text/TextActivityBase.TextActivityBase#ev\n * @type {module:activities/text/Evaluator.Evaluator} */\n ev: null,\n /**\n * This is the label used by text activities for the `check` button, when present.\n * @name module:activities/text/TextActivityBase.TextActivityBase#checkButtonText\n * @type {string} */\n checkButtonText: null,\n /**\n * When `true`, a text will be shown before the beginning of the activity.\n * @name module:activities/text/TextActivityBase.TextActivityBase#prevScreen\n * @type {boolean} */\n prevScreen: false,\n /**\n * Optional text to be shown before the beginning of the activity. When `null`, this text is\n * the main document.\n * @name module:activities/text/TextActivityBase.TextActivityBase#prevScreenText\n * @type {string} */\n prevScreenText: null,\n /**\n * The style of the optional text to be shown before the beginning of the activity.\n * @name module:activities/text/TextActivityBase.TextActivityBase#prevScreenStyle\n * @type {module:boxes/BoxBase.BoxBase} */\n prevScreenStyle: null,\n /**\n * Maximum amount of time for showing the previous document.\n * @name module:activities/text/TextActivityBase.TextActivityBase#prevScreenMaxTime\n * @type {number} */\n prevScreenMaxTime: -1,\n});\n\n/**\n * The {@link module:Activity.ActivityPanel ActivityPanel} where text activities (based on {@link module:activities/text/TextActivityBase.TextActivityBase TextActivityBase}) are played.\n * @extends module:Activity.ActivityPanel\n */\n//export class TextActivityBasePanel extends Activity.Panel {\nexport class TextActivityBasePanel extends ActivityPanel {\n /**\n * TextActivityBasePanel 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 this.targets = [];\n }\n\n /**\n * Fills a jQuery DOM element (usually a 'div') with the specified {@link module:activities/text/TextActivityDocument.TextActivityDocument TextActivityDocument}.\n * @param {external:jQuery} $div - The jQuery DOM object to be filled with the document.\n * @param {module:activities/text/TextActivityDocument.TextActivityDocument} doc - The document\n */\n setDocContent($div, doc) {\n\n // Empties the container of any pre-existing content\n // and sets the background and other attributes indicated by the main\n // style of the document.\n // It also sets the 'overflow' CSS attribute to 'auto', which will display a\n // vertical scroll bar when needed\n $div.empty().css(doc.style['default'].css).css({ display: 'flex', 'flex-direction': 'column' });\n\n const $scroller = $('<div/>').css({ 'flex-grow': 1, overflow: 'auto' });\n const $doc = $('<div/>', { class: 'JClicTextDocument' }).css({ 'padding': 4 }).css(doc.style['default'].css);\n\n let currentPStyle = null;\n const popupSpans = [];\n\n //\n // Process paragraphs\n doc.p.forEach(p => {\n // Creates a new DOM paragraph\n const $p = $('<p/>').css({ margin: 0 });\n let empty = true;\n\n // Check if the paragraph has its own style\n if (p.style) {\n currentPStyle = doc.style[p.style].css;\n $p.css(currentPStyle);\n } else\n currentPStyle = null;\n\n // Check if the paragraph has a special alignment\n if (p.Alignment) {\n const al = Number(p.Alignment);\n $p.css({ 'text-align': al === 1 ? 'center' : al === 2 ? 'right' : 'left' });\n }\n\n // Process the paragraph elements\n p.elements.forEach(element => {\n // Elements will be inserted as 'span' DOM elements, or as simple text if they don't\n // have specific attributes.\n let $span;\n switch (element.objectType) {\n case 'text':\n const parsedText = $('<span/>').html(element.text).text();\n const fragments = this.spanText\n ? stringToWords(parsedText)\n : [{ text: parsedText, sep: '' }];\n fragments.forEach(({ text, sep }) => {\n let initialCSS = { ...this.act.document.style['default'].css };\n if (element?.attr?.style)\n initialCSS = { ...initialCSS, ...doc.style[element.attr.style].css };\n if (element?.attr?.css)\n initialCSS = { ...initialCSS, ...element.attr.css };\n const txtBlocs = this.spanChars ? [...text] : [text];\n txtBlocs.forEach((str) => {\n if (element.attr) {\n // Text uses a specific style and/or individual attributes\n $span = $('<span/>').html(str).css(initialCSS);\n // Save initialCSS for later use\n $span.initialCSS = initialCSS;\n $p.append(this.$createSpanElement($span));\n } else {\n if (this.spanText) {\n $span = $('<span/>').html(str);\n $p.append(this.$createSpanElement($span));\n }\n else\n $p.append(str);\n }\n });\n if (sep !== '')\n $p.append(sep);\n });\n break;\n\n case 'cell':\n // Create a new ActiveBox based on this ActiveBoxContent\n $span = $('<span/>');\n const box = ActiveBox.createCell($span.css({ position: 'relative' }), element);\n $span.css({ 'display': 'inline-block', 'vertical-align': 'middle' });\n if (element.mediaContent) {\n $span.on('click', event => {\n event.preventDefault();\n this.ps.stopMedia(1);\n box.playMedia(this.ps);\n return false;\n });\n }\n $p.append($span);\n break;\n\n case 'target':\n $span = $('<span/>');\n if (this.showingPrevScreen) {\n $span.text(element.text);\n $p.append($span);\n break;\n }\n\n const target = element;\n let $popup = null;\n // Process target popups\n if (target.infoMode !== 'no_info' && target.popupContent) {\n $popup = $('<span/>').css({ position: 'absolute', 'padding-top': '2pt', display: 'none' });\n // Create a new ActiveBox based on popupContent\n const popupBox = ActiveBox.createCell($popup, target.popupContent);\n if (target.popupContent.mediaContent) {\n $popup.on('click', event => {\n event.preventDefault();\n this.ps.stopMedia(1);\n if (popupBox)\n popupBox.playMedia(this.ps);\n else if (target.popupContent.mediaContent)\n this.ps.playMedia(target.popupContent.mediaContent);\n return false;\n });\n }\n target.$popup = $popup;\n // Save for later setting of top-margin\n popupSpans.push({ p: $p, span: $popup, box: popupBox });\n }\n\n $span = this.$createTargetElement(target, $span);\n target.num = this.targets.length;\n target.pos = target.num;\n this.targets.push(target);\n if ($span) {\n $span.css(doc.style['default'].css);\n if (currentPStyle)\n $span.css(currentPStyle);\n if (this.targetsMarked) {\n if (target.attr) {\n // Default style name for targets is 'target'\n if (!target.attr.style)\n target.attr.style = 'target';\n $span.css(doc.style[target.attr.style].css);\n // Check if target has specific attributes\n if (target.attr.css)\n $span.css(target.attr.css);\n } else if (doc.style['target'])\n $span.css(doc.style['target'].css);\n } else {\n target.targetStatus = 'HIDDEN';\n }\n\n // Catch on-demand popups with `F1`, cancel with `Escape`\n if ($popup !== null && target.infoMode === 'onDemand') {\n $span.keydown(ev => {\n if (ev.key === target.popupKey) {\n ev.preventDefault();\n this.showPopup($popup, target.popupMaxTime, target.popupDelay);\n } else if (ev.key === 'Escape') {\n ev.preventDefault();\n this.showPopup(null);\n }\n });\n }\n }\n\n if ($popup && $span) {\n if (target.isList)\n $p.append($span).append($popup);\n else\n $p.append($popup).append($span);\n } else if ($span)\n $p.append($span);\n\n target.$p = $p;\n break;\n }\n empty = false;\n });\n if (empty)\n // Don't leave paragraphs empty\n $p.html(' ');\n\n // Adds the paragraph to the DOM element\n $doc.append($p);\n });\n\n $div.append($scroller.append($doc));\n\n if (this.act.checkButtonText && !this.showingPrevScreen) {\n this.$checkButton = $('<button/>', { class: 'StockBtn' })\n .html(this.act.checkButtonText)\n .css({ width: '100%', 'flex-shrink': 0 })\n .on('click', () => this.evaluatePanel());\n $div.append(this.$checkButton);\n }\n\n // Place popups below its target baseline\n popupSpans.forEach(pspan => pspan.span.css({ 'margin-top': pspan.p.css('font-size') }));\n\n // Init Evaluator\n if (this.act.ev)\n this.act.ev.init(this.act.project.settings.locales);\n\n return $div;\n }\n\n /**\n * Creates a target DOM element.\n * This method can be overridden in subclasses to create specific types of targets.\n * @param {module:activities/text/TextActivityDocument.TextTarget} target - The target related to the DOM object to be created\n * @param {external:jQuery} $span - An initial DOM object (usually a `span`) that can be used\n * to store the target, or replaced by another type of object.\n * @returns {external:jQuery} - The jQuery DOM element loaded with the target data.\n */\n $createTargetElement(target, $span) {\n $span.text(target.text);\n target.$span = $span;\n return $span;\n }\n\n /**\n * Creates a 'span' element, used to isolate elements of text not involved in targets.\n * Used only when {@link spanText} is true.\n * @param {external:jQuery} $span - An initial DOM object (usually a `span`) that can be used\n * to store the target, or replaced by another type of object.\n * @returns {external:jQuery} - The jQuery DOM element loaded with the span data.\n */\n $createSpanElement($span) {\n return $span;\n }\n\n /**\n * Basic initialization procedure, common to all activities.\n * @override\n */\n initActivity() {\n if (this.act.prevScreen)\n this.preInitActivity();\n else\n this.startActivity();\n }\n\n /**\n * Called when the activity starts playing\n * @override\n */\n startActivity() {\n super.initActivity();\n this.setAndPlayMsg('initial', 'start');\n this.setDocContent(this.$div, this.act.document);\n this.playing = true;\n }\n\n /**\n * Called when the text activity has a 'previous screen' information to be shown before the\n * activity starts\n */\n preInitActivity() {\n if (!this.act.prevScreen)\n return;\n\n const prevScreenEnd = () => {\n this.showingPrevScreen = false;\n this.$div.unbind('click');\n if (this.prevScreenTimer) {\n window.clearTimeout(this.prevScreenTimer);\n this.prevScreenTimer = null;\n }\n this.startActivity();\n return true;\n };\n\n this.showingPrevScreen = true;\n this.$div.empty();\n\n if (!this.act.prevScreenText) {\n this.setDocContent(this.$div, this.act.document);\n } else {\n if (!this.act.prevScreenStyle)\n this.act.prevScreenStyle = new BoxBase();\n this.$div.css(this.act.prevScreenStyle.getCSS()).css('overflow', 'auto');\n const $html = $('<div/>', { class: 'JClicTextDocument' })\n .css({ 'padding': 4 })\n .css(this.act.prevScreenStyle.getCSS())\n .append(this.act.prevScreenText);\n this.$div.append($html);\n }\n\n this.enableCounters(true, false, false);\n this.ps.setCounterValue('time', 0);\n\n this.ps.setMsg(this.act.messages['previous']);\n\n if (this.act.prevScreenMaxTime > 0) {\n this.ps.setCountDown('time', this.act.prevScreenMaxTime);\n this.prevScreenTimer = window.setTimeout(prevScreenEnd, this.act.prevScreenMaxTime * 1000);\n }\n\n this.$div.on('click', prevScreenEnd);\n this.ps.playMsg();\n }\n\n /**\n * Called when the user clicks on the check button\n * @returns {boolean} - `true` when the panel is OK, `false` otherwise.\n */\n evaluatePanel() {\n this.finishActivity(true);\n return true;\n }\n\n /**\n * Ordinary ending of the activity, usually called form `processEvent`\n * @override\n * @param {boolean} result - `true` if the activity was successfully completed, `false` otherwise\n */\n finishActivity(result) {\n if (this.$checkButton)\n this.$checkButton.prop('disabled', true);\n this.targets.forEach(t => {\n if (t.$comboList)\n t.$comboList.attr('disabled', true);\n });\n this.showPopup(null);\n super.finishActivity(result);\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 return this.playing;\n }\n\n /**\n * @param {external:jQuery} $popup - The popup to display, or _null _ to just hide the current popup\n * @param {number} maxTime - The maximum time to mantain the popup on screen, in seconds\n * @param {number} waitTime - When set, indicates the number of seconds to wait before show the popup\n */\n showPopup($popup, maxTime, waitTime) {\n // Hide current popup\n if (this.$currentPopup) {\n this.$currentPopup.css({ display: 'none' });\n this.$currentPopup = null;\n if (this.currentPopupTimer) {\n window.clearTimeout(this.currentPopupTimer);\n this.currentPopupTimer = 0;\n }\n }\n\n // Clear popupWaitTimer\n if (this.popupWaitTimer) {\n window.clearTimeout(this.popupWaitTimer);\n this.popupWaitTimer = 0;\n }\n\n // Prepare popup timer\n if (waitTime) {\n this.popupWaitTimer = window.setTimeout(() => {\n this.showPopup($popup, maxTime);\n }, waitTime * 1000);\n return;\n }\n\n if ($popup) {\n $popup.css({ display: '' });\n $popup.trigger('click');\n\n this.$currentPopup = $popup;\n if (maxTime) {\n this.currentPopupTimer = window.setTimeout(() => {\n $popup.css({ display: 'none' });\n if (this.$currentPopup === $popup) {\n this.$currentPopup = null;\n this.currentPopupTimer = 0;\n }\n }, maxTime * 1000);\n }\n }\n }\n}\n\nObject.assign(TextActivityBasePanel.prototype, {\n /**\n * Array of jQuery DOM elements (usually of type 'span') containing the targets of this activity\n * @name module:activities/text/TextActivityBase.TextActivityBasePanel#targets\n * @type {external:jQuery[]} */\n targets: null,\n /**\n * Flag indicating if targets must be visually marked at the beginning of the activity.\n * Should be `true` except for {@link module:activities/text/IdentifyText.IdentifyText IdentifyText} activities.\n * @name module:activities/text/TextActivityBase.TextActivityBasePanel#targetsMarked\n * @type {boolean} */\n targetsMarked: true,\n /**\n * The button used to check the activity, only when `Activity.checkButtonText` is not null\n * @name module:activities/text/TextActivityBase.TextActivityBasePanel#$checkButton\n * @type {external:jQuery}*/\n $checkButton: null,\n /**\n * System timer used to close the previous document when act.maxTime is reached.\n * @name module:activities/text/TextActivityBase.TextActivityBasePanel#prevScreenTimer\n * @type {number} */\n prevScreenTimer: null,\n /**\n * The popup currently been displayed\n * @name module:activities/text/TextActivityBase.TextActivityBasePanel#$currentPopup\n * @type {external:jQuery} */\n $currentPopup: null,\n /**\n * A timer controlling the time the current popup will be displayed\n * @name module:activities/text/TextActivityBase.TextActivityBasePanel#currentPopupTimer\n * @type {number} */\n currentPopupTimer: 0,\n /**\n * A timer prepared to display a popup after a while\n * @name module:activities/text/TextActivityBase.TextActivityBasePanel#popupWaitTimer\n * @type {number} */\n popupWaitTimer: 0,\n /**\n * When true, all text outside of targets and cells will be inserted as independent words or letters,\n * using 'span' elements. {@link module:activities/text/TextActivityBase.TextActivityBasePanel#$createSpanElement} can be used\n * to customize these elements.\n * @name module:activities/text/TextActivityBase.TextActivityBasePanel#spanText\n * @type {boolean} */\n spanText: false,\n /**\n * When true, text spanning will be done at char level: each single letter will be a clickacle span.\n * Used only in activities of type \"itentify letters\"\n * @name module:activities/text/TextActivityBase.TextActivityBasePanel#spanChars\n * @type {boolean} */\n spanChars: false,\n});\n\n/**\n * Panel class associated to this type of activity: {@link module:activities/text/TextActivityBase.TextActivityBasePanel TextActivityBasePanel}\n * @type {class} */\nTextActivityBase.Panel = TextActivityBasePanel;\n\nexport default TextActivityBase;\n"],"names":[],"sourceRoot":""}
|