@oat-sa/tao-core-ui 1.58.1 → 1.58.2

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 (233) hide show
  1. package/dist/actionbar.js +386 -395
  2. package/dist/adder.js +21 -19
  3. package/dist/animable/absorbable/absorbable.js +204 -213
  4. package/dist/animable/absorbable/css/absorb.css +1 -0
  5. package/dist/animable/absorbable/css/absorb.css.map +1 -1
  6. package/dist/animable/pulsable/pulsable.js +168 -177
  7. package/dist/autocomplete/css/autocomplete.css +1 -0
  8. package/dist/autocomplete/css/autocomplete.css.map +1 -1
  9. package/dist/autocomplete.js +68 -66
  10. package/dist/badge/badge.js +188 -197
  11. package/dist/badge/css/badge.css +1 -0
  12. package/dist/badge/css/badge.css.map +1 -1
  13. package/dist/breadcrumbs.js +275 -284
  14. package/dist/btngrouper.js +5 -5
  15. package/dist/bulkActionPopup.js +490 -495
  16. package/dist/button.js +283 -291
  17. package/dist/cascadingComboBox.js +249 -258
  18. package/dist/ckeditor/ckConfigurator.js +26 -19
  19. package/dist/ckeditor/dtdHandler.js +11 -9
  20. package/dist/class/selector.js +441 -450
  21. package/dist/component/resizable.js +1 -1
  22. package/dist/component/windowed.js +285 -294
  23. package/dist/component.js +419 -428
  24. package/dist/contextualPopup.js +417 -426
  25. package/dist/dashboard.js +300 -309
  26. package/dist/datalist.js +753 -762
  27. package/dist/datatable/filterStrategy/multiple.js +1 -1
  28. package/dist/datatable/filterStrategy/single.js +1 -1
  29. package/dist/datatable.js +1527 -1550
  30. package/dist/dateRange/dateRange.js +393 -402
  31. package/dist/datetime/picker.js +665 -672
  32. package/dist/deleter.js +368 -377
  33. package/dist/destination/selector.js +286 -295
  34. package/dist/dialog/alert.js +3 -3
  35. package/dist/dialog/confirm.js +1 -1
  36. package/dist/dialog/confirmDelete.js +216 -225
  37. package/dist/dialog.js +650 -654
  38. package/dist/disabler.js +8 -8
  39. package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +166 -175
  40. package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +518 -527
  41. package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +380 -389
  42. package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +539 -548
  43. package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +369 -378
  44. package/dist/documentViewer/providers/pdfViewer.js +184 -193
  45. package/dist/documentViewer.js +292 -301
  46. package/dist/dropdown.js +383 -392
  47. package/dist/durationer.js +5 -5
  48. package/dist/dynamicComponent.js +597 -598
  49. package/dist/feedback.js +356 -362
  50. package/dist/figure/FigureStateActive.js +117 -108
  51. package/dist/filesender.js +2 -2
  52. package/dist/filter.js +230 -239
  53. package/dist/form/dropdownForm.js +355 -357
  54. package/dist/form/form.js +919 -690
  55. package/dist/form/simpleForm.js +1 -1
  56. package/dist/form/validator/renderer.js +233 -235
  57. package/dist/form/validator/validator.js +257 -189
  58. package/dist/form/widget/definitions.js +1 -1
  59. package/dist/form/widget/providers/checkBox.js +254 -259
  60. package/dist/form/widget/providers/comboBox.js +187 -192
  61. package/dist/form/widget/providers/default.js +8 -9
  62. package/dist/form/widget/providers/hidden.js +170 -179
  63. package/dist/form/widget/providers/hiddenBox.js +262 -267
  64. package/dist/form/widget/providers/radioBox.js +216 -225
  65. package/dist/form/widget/providers/textArea.js +187 -196
  66. package/dist/form/widget/providers/textBox.js +2 -3
  67. package/dist/form/widget/widget.js +473 -475
  68. package/dist/formValidator/formValidator.js +1 -1
  69. package/dist/formValidator/highlighters/message.js +1 -1
  70. package/dist/generis/form/form.js +314 -323
  71. package/dist/generis/validator/validator.js +209 -218
  72. package/dist/generis/widget/checkBox/checkBox.js +218 -227
  73. package/dist/generis/widget/comboBox/comboBox.js +179 -188
  74. package/dist/generis/widget/hiddenBox/hiddenBox.js +220 -229
  75. package/dist/generis/widget/textBox/textBox.js +169 -178
  76. package/dist/generis/widget/widget.js +246 -255
  77. package/dist/groupedComboBox.js +222 -231
  78. package/dist/groupvalidator.js +2 -2
  79. package/dist/highlighter.js +967 -958
  80. package/dist/image/ImgStateActive/helper.js +7 -5
  81. package/dist/image/ImgStateActive/initHelper.js +49 -43
  82. package/dist/image/ImgStateActive/initMediaEditor.js +24 -20
  83. package/dist/image/ImgStateActive/mediaSizer.js +14 -12
  84. package/dist/image/ImgStateActive.js +72 -70
  85. package/dist/incrementer.js +6 -6
  86. package/dist/inplacer.js +6 -6
  87. package/dist/itemButtonList/css/item-button-list.css +1 -0
  88. package/dist/itemButtonList/css/item-button-list.css.map +1 -1
  89. package/dist/itemButtonList.js +439 -435
  90. package/dist/keyNavigation/navigableDomElement.js +51 -38
  91. package/dist/keyNavigation/navigator.js +85 -70
  92. package/dist/listbox.js +460 -469
  93. package/dist/liststyler.js +8 -8
  94. package/dist/loadingButton/loadingButton.js +209 -218
  95. package/dist/lock.js +476 -485
  96. package/dist/login/login.js +475 -484
  97. package/dist/maths/calculator/basicCalculator.js +235 -244
  98. package/dist/maths/calculator/calculatorComponent.js +3 -3
  99. package/dist/maths/calculator/core/board.js +772 -781
  100. package/dist/maths/calculator/core/expression.js +476 -485
  101. package/dist/maths/calculator/core/labels.js +228 -237
  102. package/dist/maths/calculator/core/tokenizer.js +1 -1
  103. package/dist/maths/calculator/core/tokens.js +163 -170
  104. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +244 -253
  105. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +279 -288
  106. package/dist/maths/calculator/scientificCalculator.js +327 -336
  107. package/dist/mediaEditor/mediaEditorComponent.js +238 -245
  108. package/dist/mediaEditor/plugins/mediaAlignment/helper.js +7 -7
  109. package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +229 -235
  110. package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +580 -589
  111. package/dist/mediaplayer/players/html5.js +666 -675
  112. package/dist/mediaplayer/players/youtube.js +419 -424
  113. package/dist/mediaplayer/support.js +11 -10
  114. package/dist/mediaplayer/utils/reminder.js +14 -13
  115. package/dist/mediaplayer/utils/timeObserver.js +10 -11
  116. package/dist/mediaplayer/youtubeManager.js +164 -145
  117. package/dist/mediaplayer.js +1565 -1520
  118. package/dist/mediasizer.js +669 -678
  119. package/dist/modal.js +10 -17
  120. package/dist/pageSizeSelector.js +219 -228
  121. package/dist/pagination/providers/pages.js +280 -289
  122. package/dist/pagination/providers/simple.js +192 -201
  123. package/dist/previewer.js +30 -30
  124. package/dist/progressbar.js +4 -4
  125. package/dist/report.js +347 -356
  126. package/dist/resource/filters.js +271 -280
  127. package/dist/resource/list.js +1264 -1273
  128. package/dist/resource/selector.js +865 -874
  129. package/dist/resource/tree.js +1483 -1492
  130. package/dist/resourcemgr/fileBrowser.js +564 -569
  131. package/dist/resourcemgr/filePreview.js +16 -16
  132. package/dist/resourcemgr/fileSelector.js +515 -524
  133. package/dist/resourcemgr/util/updatePermissions.js +2 -2
  134. package/dist/resourcemgr.js +306 -315
  135. package/dist/searchModal/advancedSearch.js +796 -767
  136. package/dist/searchModal.js +114 -91
  137. package/dist/switch/switch.js +298 -307
  138. package/dist/tabs.js +598 -575
  139. package/dist/taskQueue/status.js +312 -321
  140. package/dist/taskQueue/table.js +375 -384
  141. package/dist/taskQueue/taskQueueModel.js +488 -472
  142. package/dist/taskQueueButton/taskable.js +264 -273
  143. package/dist/taskQueueButton/treeButton.js +189 -198
  144. package/dist/themeLoader.js +24 -23
  145. package/dist/themes.js +1 -1
  146. package/dist/toggler.js +3 -3
  147. package/dist/tooltip.js +295 -304
  148. package/dist/transformer.js +2 -2
  149. package/dist/tristateCheckboxGroup.js +311 -320
  150. package/dist/uploader.js +687 -696
  151. package/dist/validator/Report.js +1 -1
  152. package/dist/validator/Validator.js +3 -3
  153. package/dist/validator/validators.js +9 -9
  154. package/dist/validator.js +240 -230
  155. package/dist/waitForMedia.js +1 -1
  156. package/package.json +3 -3
  157. package/src/animable/absorbable/css/absorb.css +1 -0
  158. package/src/animable/absorbable/css/absorb.css.map +1 -1
  159. package/src/autocomplete/css/autocomplete.css +1 -0
  160. package/src/autocomplete/css/autocomplete.css.map +1 -1
  161. package/src/badge/css/badge.css +1 -0
  162. package/src/badge/css/badge.css.map +1 -1
  163. package/src/ckeditor/ckConfigurator.js +4 -0
  164. package/src/itemButtonList/css/item-button-list.css +1 -0
  165. package/src/itemButtonList/css/item-button-list.css.map +1 -1
  166. package/src/.DS_Store +0 -0
  167. package/src/css/basic.css +0 -7826
  168. package/src/css/basic.css.map +0 -1
  169. package/src/css/ckeditor/skins/tao/css/dialog.css +0 -950
  170. package/src/css/ckeditor/skins/tao/css/dialog.css.map +0 -1
  171. package/src/css/ckeditor/skins/tao/css/editor.css +0 -1850
  172. package/src/css/ckeditor/skins/tao/css/editor.css.map +0 -1
  173. package/src/scss/.DS_Store +0 -0
  174. package/src/scss/basic.scss +0 -16
  175. package/src/scss/ckeditor/skins/tao/scss/dialog.scss +0 -763
  176. package/src/scss/ckeditor/skins/tao/scss/editor.scss +0 -111
  177. package/src/scss/ckeditor/skins/tao/scss/inc/_ck-icons.scss +0 -59
  178. package/src/scss/ckeditor/skins/tao/scss/inc/_colorpanel.scss +0 -118
  179. package/src/scss/ckeditor/skins/tao/scss/inc/_elementspath.scss +0 -69
  180. package/src/scss/ckeditor/skins/tao/scss/inc/_mainui.scss +0 -194
  181. package/src/scss/ckeditor/skins/tao/scss/inc/_menu.scss +0 -181
  182. package/src/scss/ckeditor/skins/tao/scss/inc/_panel.scss +0 -200
  183. package/src/scss/ckeditor/skins/tao/scss/inc/_presets.scss +0 -32
  184. package/src/scss/ckeditor/skins/tao/scss/inc/_reset.scss +0 -101
  185. package/src/scss/ckeditor/skins/tao/scss/inc/_richcombo.scss +0 -213
  186. package/src/scss/ckeditor/skins/tao/scss/inc/_tao.scss +0 -59
  187. package/src/scss/ckeditor/skins/tao/scss/inc/_toolbar.scss +0 -301
  188. package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
  189. package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot.b64 +0 -1
  190. package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
  191. package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff.b64 +0 -1
  192. package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
  193. package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot.b64 +0 -1
  194. package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
  195. package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff.b64 +0 -1
  196. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot +0 -0
  197. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot.b64 +0 -1
  198. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff +0 -0
  199. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff.b64 +0 -1
  200. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
  201. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot.b64 +0 -1
  202. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
  203. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff.b64 +0 -1
  204. package/src/scss/font/tao/tao.eot +0 -0
  205. package/src/scss/font/tao/tao.svg +0 -235
  206. package/src/scss/font/tao/tao.ttf +0 -0
  207. package/src/scss/font/tao/tao.woff +0 -0
  208. package/src/scss/inc/_base.scss +0 -496
  209. package/src/scss/inc/_bootstrap.scss +0 -6
  210. package/src/scss/inc/_buttons.scss +0 -114
  211. package/src/scss/inc/_colors.scss +0 -88
  212. package/src/scss/inc/_feedback.scss +0 -150
  213. package/src/scss/inc/_flex-grid.scss +0 -15
  214. package/src/scss/inc/_fonts.scss +0 -4
  215. package/src/scss/inc/_forms.scss +0 -827
  216. package/src/scss/inc/_functions.scss +0 -283
  217. package/src/scss/inc/_grid.scss +0 -66
  218. package/src/scss/inc/_jquery.nouislider.scss +0 -254
  219. package/src/scss/inc/_normalize.scss +0 -528
  220. package/src/scss/inc/_report.scss +0 -68
  221. package/src/scss/inc/_secondary-properties.scss +0 -89
  222. package/src/scss/inc/_select2.scss +0 -634
  223. package/src/scss/inc/_toolbars.scss +0 -155
  224. package/src/scss/inc/_tooltip.scss +0 -312
  225. package/src/scss/inc/_variables.scss +0 -21
  226. package/src/scss/inc/base/_highlight.scss +0 -5
  227. package/src/scss/inc/base/_list-style.scss +0 -59
  228. package/src/scss/inc/base/_svg.scss +0 -3
  229. package/src/scss/inc/base/_table.scss +0 -63
  230. package/src/scss/inc/fonts/_source-sans-pro.scss +0 -29
  231. package/src/scss/inc/fonts/_tao-icon-classes.scss +0 -226
  232. package/src/scss/inc/fonts/_tao-icon-def.scss +0 -12
  233. package/src/scss/inc/fonts/_tao-icon-vars.scss +0 -240
@@ -23,14 +23,14 @@ define(function () { 'use strict';
23
23
  * @type {RegExp}
24
24
  * @private
25
25
  */
26
- const reAppleMobiles = /ip(hone|od)/i;
26
+ var reAppleMobiles = /ip(hone|od)/i;
27
27
  /**
28
28
  * A list of MIME types with codec declaration
29
29
  * @type {Object}
30
30
  * @private
31
31
  */
32
32
 
33
- const supportedMimeTypes = {
33
+ var supportedMimeTypes = {
34
34
  // video
35
35
  'video/webm': 'video/webm; codecs="vp8, vorbis"',
36
36
  'video/mp4': 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
@@ -49,7 +49,9 @@ define(function () { 'use strict';
49
49
  * @private
50
50
  */
51
51
 
52
- const findSupport = (media, mimeType) => media.canPlayType(mimeType).replace(/no/, '');
52
+ var findSupport = function findSupport(media, mimeType) {
53
+ return media.canPlayType(mimeType).replace(/no/, '');
54
+ };
53
55
  /**
54
56
  * Support detection
55
57
  * @type {Object}
@@ -64,8 +66,8 @@ define(function () { 'use strict';
64
66
  * @returns {Boolean}
65
67
  * @private
66
68
  */
67
- checkSupport(media, mimeType) {
68
- const support = media.canPlayType;
69
+ checkSupport: function checkSupport(media, mimeType) {
70
+ var support = media.canPlayType;
69
71
 
70
72
  if (support && mimeType) {
71
73
  return !!(supportedMimeTypes[mimeType] && findSupport(media, supportedMimeTypes[mimeType]) || findSupport(media, mimeType));
@@ -80,7 +82,7 @@ define(function () { 'use strict';
80
82
  * @param {String} [mime] A media MIME type to check
81
83
  * @returns {Boolean}
82
84
  */
83
- canPlay(type, mime) {
85
+ canPlay: function canPlay(type, mime) {
84
86
  if (type) {
85
87
  switch (type.toLowerCase()) {
86
88
  case 'audio':
@@ -105,7 +107,7 @@ define(function () { 'use strict';
105
107
  * @param {String} [mime] A media MIME type to check
106
108
  * @returns {Boolean}
107
109
  */
108
- canPlayAudio(mime) {
110
+ canPlayAudio: function canPlayAudio(mime) {
109
111
  return this.checkSupport(document.createElement('audio'), mime);
110
112
  },
111
113
 
@@ -114,7 +116,7 @@ define(function () { 'use strict';
114
116
  * @param {String} [mime] A media MIME type to check
115
117
  * @returns {Boolean}
116
118
  */
117
- canPlayVideo(mime) {
119
+ canPlayVideo: function canPlayVideo(mime) {
118
120
  return this.checkSupport(document.createElement('video'), mime);
119
121
  },
120
122
 
@@ -122,10 +124,9 @@ define(function () { 'use strict';
122
124
  * Checks if the browser allows to control the media playback
123
125
  * @returns {Boolean}
124
126
  */
125
- canControl() {
127
+ canControl: function canControl() {
126
128
  return !reAppleMobiles.test(window.navigator.userAgent);
127
129
  }
128
-
129
130
  };
130
131
 
131
132
  return support;
@@ -49,18 +49,18 @@ define(function () { 'use strict';
49
49
  */
50
50
  function reminderManagerFactory() {
51
51
  // Keep track of the running state
52
- let running = false; // Timestamp of the last start
52
+ var running = false; // Timestamp of the last start
53
53
 
54
- let last = 0; // A list of reminders to callback
54
+ var last = 0; // A list of reminders to callback
55
55
 
56
- const reminders = new Map();
56
+ var reminders = new Map();
57
57
  /**
58
58
  * Cancels a schedule for a particular reminder.
59
59
  * @param {object} state - A sate object containing the timeout handler for the reminder.
60
60
  * @private
61
61
  */
62
62
 
63
- const stopReminder = state => {
63
+ var stopReminder = function stopReminder(state) {
64
64
  if (state && state.timeout) {
65
65
  clearTimeout(state.timeout);
66
66
  state.timeout = null;
@@ -72,15 +72,17 @@ define(function () { 'use strict';
72
72
  */
73
73
 
74
74
 
75
- const stopAllReminders = () => reminders.forEach(stopReminder);
75
+ var stopAllReminders = function stopAllReminders() {
76
+ return reminders.forEach(stopReminder);
77
+ };
76
78
  /**
77
79
  * Schedule all reminders.
78
80
  * @private
79
81
  */
80
82
 
81
83
 
82
- const startAllReminders = () => {
83
- reminders.forEach((state, reminder) => {
84
+ var startAllReminders = function startAllReminders() {
85
+ reminders.forEach(function (state, reminder) {
84
86
  stopReminder(state);
85
87
  state.timeout = setTimeout(reminder, state.delay);
86
88
  });
@@ -128,7 +130,7 @@ define(function () { 'use strict';
128
130
  * @function start
129
131
  * @memberOf reminderManager
130
132
  */
131
- start() {
133
+ start: function start() {
132
134
  running = true;
133
135
  last = performance.now();
134
136
  startAllReminders();
@@ -142,7 +144,7 @@ define(function () { 'use strict';
142
144
  * @function stop
143
145
  * @memberOf reminderManager
144
146
  */
145
- stop() {
147
+ stop: function stop() {
146
148
  running = false;
147
149
  stopAllReminders();
148
150
  return this;
@@ -158,11 +160,11 @@ define(function () { 'use strict';
158
160
  * @function remind
159
161
  * @memberOf reminderManager
160
162
  */
161
- remind(cb, delay) {
163
+ remind: function remind(cb, delay) {
162
164
  if ('function' === typeof cb && delay) {
163
165
  stopReminder(reminders.get(cb));
164
166
  reminders.set(cb, {
165
- delay
167
+ delay: delay
166
168
  });
167
169
  }
168
170
 
@@ -177,7 +179,7 @@ define(function () { 'use strict';
177
179
  * @function forget
178
180
  * @memberOf reminderManager
179
181
  */
180
- forget(cb) {
182
+ forget: function forget(cb) {
181
183
  if ('undefined' !== typeof cb) {
182
184
  stopReminder(reminders.get(cb));
183
185
  reminders.delete(cb);
@@ -188,7 +190,6 @@ define(function () { 'use strict';
188
190
 
189
191
  return this;
190
192
  }
191
-
192
193
  };
193
194
  }
194
195
 
@@ -52,13 +52,13 @@ define(['core/eventifier'], function (eventifier) { 'use strict';
52
52
  */
53
53
 
54
54
  function timeObserverFactory() {
55
- let interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
55
+ var interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
56
56
  // Current time position
57
- let position = 0; // Total duration expected
57
+ var position = 0; // Total duration expected
58
58
 
59
- let duration = 0; // Last position forced
59
+ var duration = 0; // Last position forced
60
60
 
61
- let seek = 0;
61
+ var _seek = 0;
62
62
  /**
63
63
  * Defines the API of a time observer.
64
64
  *
@@ -101,8 +101,8 @@ define(['core/eventifier'], function (eventifier) { 'use strict';
101
101
  * @function init
102
102
  * @memberOf timeObserver
103
103
  */
104
- init(initPosition, initDuration) {
105
- position = seek = initPosition;
104
+ init: function init(initPosition, initDuration) {
105
+ position = _seek = initPosition;
106
106
  duration = initDuration;
107
107
  return this;
108
108
  },
@@ -116,8 +116,8 @@ define(['core/eventifier'], function (eventifier) { 'use strict';
116
116
  *
117
117
  * @fires irregularity
118
118
  */
119
- update(newPosition) {
120
- if (newPosition > seek && newPosition - position > interval) {
119
+ update: function update(newPosition) {
120
+ if (newPosition > _seek && newPosition - position > interval) {
121
121
  /**
122
122
  * Notifies an irregularity in the time update
123
123
  * @event irregularity
@@ -137,11 +137,10 @@ define(['core/eventifier'], function (eventifier) { 'use strict';
137
137
  * @param {number} seekPosition
138
138
  * @returns {timeObserver}
139
139
  */
140
- seek(seekPosition) {
141
- position = seek = seekPosition;
140
+ seek: function seek(seekPosition) {
141
+ position = _seek = seekPosition;
142
142
  return this;
143
143
  }
144
-
145
144
  });
146
145
  }
147
146
 
@@ -1,171 +1,190 @@
1
1
  define(['jquery'], function ($) { 'use strict';
2
2
 
3
- $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
3
+ $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
4
+
5
+ function _toConsumableArray(arr) {
6
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
7
+ }
8
+
9
+ function _arrayWithoutHoles(arr) {
10
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
11
+ }
12
+
13
+ function _iterableToArray(iter) {
14
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
15
+ }
16
+
17
+ function _unsupportedIterableToArray(o, minLen) {
18
+ if (!o) return;
19
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
20
+ var n = Object.prototype.toString.call(o).slice(8, -1);
21
+ if (n === "Object" && o.constructor) n = o.constructor.name;
22
+ if (n === "Map" || n === "Set") return Array.from(o);
23
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
24
+ }
25
+
26
+ function _arrayLikeToArray(arr, len) {
27
+ if (len == null || len > arr.length) len = arr.length;
28
+
29
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
30
+
31
+ return arr2;
32
+ }
33
+
34
+ function _nonIterableSpread() {
35
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
36
+ }
37
+
38
+ /**
39
+ * CDN for the YouTube API
40
+ * @type {String}
41
+ */
42
+
43
+ var youtubeApi = 'https://www.youtube.com/iframe_api';
44
+ /**
45
+ * A Regex to extract ID from Youtube URLs
46
+ * @type {RegExp}
47
+ */
48
+
49
+ var reYoutube = /([?&\/]v[=\/])([\w-]+)([&\/]?)/;
50
+ /**
51
+ * Installs a Youtube player. The Youtube API must be ready
52
+ * @param {String|jQuery|HTMLElement} elem
53
+ * @param {Object} player
54
+ * @param {Object} [options]
55
+ * @param {Boolean} [options.controls]
56
+ */
57
+
58
+ function addYoutubePlayer(elem, player) {
59
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
60
+ var $elem = $(elem);
61
+ new window.YT.Player($elem.get(0), {
62
+ height: '360',
63
+ width: '640',
64
+ videoId: $elem.data('videoId'),
65
+ playerVars: {
66
+ //hd: true,
67
+ autoplay: 0,
68
+ controls: options && options.controls ? 1 : 0,
69
+ rel: 0,
70
+ showinfo: 0,
71
+ wmode: 'transparent',
72
+ modestbranding: 1,
73
+ disablekb: 1,
74
+ playsinline: 1,
75
+ enablejsapi: 1,
76
+ origin: location.hostname
77
+ },
78
+ events: {
79
+ onReady: function onReady(ev) {
80
+ return player.onReady(ev);
81
+ },
82
+ onStateChange: function onStateChange(ev) {
83
+ return player.onStateChange(ev);
84
+ }
85
+ }
86
+ });
87
+ }
88
+ /**
89
+ * A local manager for Youtube players.
90
+ * Relies on https://developers.google.com/youtube/iframe_api_reference
91
+ * @type {Object}
92
+ */
4
93
 
5
- /**
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; under version 2
9
- * of the License (non-upgradable).
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
- *
20
- * Copyright (c) 2015-2021 (original work) Open Assessment Technologies SA ;
21
- */
22
- /**
23
- * CDN for the YouTube API
24
- * @type {String}
25
- */
26
94
 
27
- const youtubeApi = 'https://www.youtube.com/iframe_api';
28
- /**
29
- * A Regex to extract ID from Youtube URLs
30
- * @type {RegExp}
31
- */
95
+ function youtubeManagerFactory() {
96
+ // The Youtube API injection state
97
+ var injected = false; // The Youtube API ready state
32
98
 
33
- const reYoutube = /([?&\/]v[=\/])([\w-]+)([&\/]?)/;
99
+ var ready = false; // A list of pending players
100
+
101
+ var pending = [];
34
102
  /**
35
- * Installs a Youtube player. The Youtube API must be ready
36
- * @param {String|jQuery|HTMLElement} elem
37
- * @param {Object} player
38
- * @param {Object} [options]
39
- * @param {Boolean} [options.controls]
103
+ * Checks if the Youtube API is ready to use
104
+ * @returns {Boolean}
40
105
  */
41
106
 
42
- function addYoutubePlayer(elem, player) {
43
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
44
- const $elem = $(elem);
45
- new window.YT.Player($elem.get(0), {
46
- height: '360',
47
- width: '640',
48
- videoId: $elem.data('videoId'),
49
- playerVars: {
50
- //hd: true,
51
- autoplay: 0,
52
- controls: options && options.controls ? 1 : 0,
53
- rel: 0,
54
- showinfo: 0,
55
- wmode: 'transparent',
56
- modestbranding: 1,
57
- disablekb: 1,
58
- playsinline: 1,
59
- enablejsapi: 1,
60
- origin: location.hostname
61
- },
62
- events: {
63
- onReady: ev => player.onReady(ev),
64
- onStateChange: ev => player.onStateChange(ev)
65
- }
66
- });
107
+ function isApiReady() {
108
+ var apiReady = typeof window.YT !== 'undefined' && typeof window.YT.Player !== 'undefined';
109
+
110
+ if (apiReady && !ready) {
111
+ ready = true;
112
+ pending.forEach(function (args) {
113
+ if (args) {
114
+ addYoutubePlayer.apply(void 0, _toConsumableArray(args));
115
+ }
116
+ });
117
+ pending = [];
118
+ }
119
+
120
+ return apiReady;
67
121
  }
68
122
  /**
69
- * A local manager for Youtube players.
70
- * Relies on https://developers.google.com/youtube/iframe_api_reference
71
- * @type {Object}
123
+ * Injects the Youtube API into the page
72
124
  */
73
125
 
74
126
 
75
- function youtubeManagerFactory() {
76
- // The Youtube API injection state
77
- let injected = false; // The Youtube API ready state
127
+ function injectApi() {
128
+ if (!isApiReady()) {
129
+ window.require([youtubeApi], function () {
130
+ var check = function check() {
131
+ if (!isApiReady()) {
132
+ setTimeout(check, 100);
133
+ }
134
+ };
78
135
 
79
- let ready = false; // A list of pending players
136
+ check();
137
+ });
138
+ }
139
+
140
+ injected = true;
141
+ }
80
142
 
81
- let pending = [];
143
+ return {
82
144
  /**
83
- * Checks if the Youtube API is ready to use
84
- * @returns {Boolean}
145
+ * Adds a Youtube player
146
+ * @param {String|jQuery|HTMLElement} elem
147
+ * @param {Object} player
148
+ * @param {Object} [options]
149
+ * @param {Boolean} [options.controls]
85
150
  */
86
-
87
- function isApiReady() {
88
- const apiReady = typeof window.YT !== 'undefined' && typeof window.YT.Player !== 'undefined';
89
-
90
- if (apiReady && !ready) {
91
- ready = true;
92
- pending.forEach(args => {
93
- if (args) {
94
- addYoutubePlayer(...args);
95
- }
96
- });
97
- pending = [];
151
+ add: function add(elem, player, options) {
152
+ if (ready) {
153
+ addYoutubePlayer(elem, player, options);
154
+ } else {
155
+ pending.push([elem, player, options]);
156
+
157
+ if (!injected) {
158
+ injectApi();
159
+ }
98
160
  }
161
+ },
99
162
 
100
- return apiReady;
101
- }
102
163
  /**
103
- * Injects the Youtube API into the page
164
+ * Removes a pending Youtube player
165
+ * @param {String|jQuery|HTMLElement} elem
166
+ * @param {Object} player
104
167
  */
105
-
106
-
107
- function injectApi() {
108
- if (!isApiReady()) {
109
- window.require([youtubeApi], () => {
110
- const check = () => {
111
- if (!isApiReady()) {
112
- setTimeout(check, 100);
113
- }
114
- };
115
-
116
- check();
117
- });
118
- }
119
-
120
- injected = true;
121
- }
122
-
123
- return {
124
- /**
125
- * Adds a Youtube player
126
- * @param {String|jQuery|HTMLElement} elem
127
- * @param {Object} player
128
- * @param {Object} [options]
129
- * @param {Boolean} [options.controls]
130
- */
131
- add(elem, player, options) {
132
- if (ready) {
133
- addYoutubePlayer(elem, player, options);
134
- } else {
135
- pending.push([elem, player, options]);
136
-
137
- if (!injected) {
138
- injectApi();
139
- }
168
+ remove: function remove(elem, player) {
169
+ pending.forEach(function (args, idx) {
170
+ if (args && elem === args[0] && player === args[1]) {
171
+ pending[idx] = null;
140
172
  }
141
- },
142
-
143
- /**
144
- * Removes a pending Youtube player
145
- * @param {String|jQuery|HTMLElement} elem
146
- * @param {Object} player
147
- */
148
- remove(elem, player) {
149
- pending.forEach((args, idx) => {
150
- if (args && elem === args[0] && player === args[1]) {
151
- pending[idx] = null;
152
- }
153
- });
154
- },
155
-
156
- /**
157
- * Extracts the ID of a Youtube video from an URL
158
- * @param {String} url
159
- * @returns {String}
160
- */
161
- extractYoutubeId(url) {
162
- const res = reYoutube.exec(url);
163
- return res && res[2] || url;
164
- }
173
+ });
174
+ },
165
175
 
166
- };
167
- }
176
+ /**
177
+ * Extracts the ID of a Youtube video from an URL
178
+ * @param {String} url
179
+ * @returns {String}
180
+ */
181
+ extractYoutubeId: function extractYoutubeId(url) {
182
+ var res = reYoutube.exec(url);
183
+ return res && res[2] || url;
184
+ }
185
+ };
186
+ }
168
187
 
169
- return youtubeManagerFactory;
188
+ return youtubeManagerFactory;
170
189
 
171
190
  });