@oat-sa/tao-core-ui 1.60.2 → 1.62.0

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 (783) hide show
  1. package/LICENSE +339 -339
  2. package/README.md +23 -18
  3. package/dist/actionbar.js +393 -410
  4. package/dist/adder.js +143 -156
  5. package/dist/animable/absorbable/absorbable.js +208 -211
  6. package/dist/animable/absorbable/css/absorb.css +7 -8
  7. package/dist/animable/absorbable/css/absorb.css.map +1 -1
  8. package/dist/animable/pulsable/css/pulse.css +7 -7
  9. package/dist/animable/pulsable/css/pulse.css.map +1 -1
  10. package/dist/animable/pulsable/pulsable.js +174 -174
  11. package/dist/areaBroker.js +59 -72
  12. package/dist/autocomplete/css/autocomplete.css +7 -8
  13. package/dist/autocomplete/css/autocomplete.css.map +1 -1
  14. package/dist/autocomplete.js +494 -604
  15. package/dist/autoscroll.js +23 -25
  16. package/dist/badge/badge.js +201 -199
  17. package/dist/badge/css/badge.css +7 -8
  18. package/dist/badge/css/badge.css.map +1 -1
  19. package/dist/breadcrumbs/css/breadcrumbs.css +7 -7
  20. package/dist/breadcrumbs/css/breadcrumbs.css.map +1 -1
  21. package/dist/breadcrumbs.js +286 -285
  22. package/dist/btngrouper.js +83 -95
  23. package/dist/bulkActionPopup/css/bulkActionPopup.css +7 -7
  24. package/dist/bulkActionPopup/css/bulkActionPopup.css.map +1 -1
  25. package/dist/bulkActionPopup.js +503 -503
  26. package/dist/button.js +300 -293
  27. package/dist/calculator/css/calculator.css +10 -10
  28. package/dist/calculator/css/calculator.css.map +1 -1
  29. package/dist/calculator.js +59 -72
  30. package/dist/cascadingComboBox.js +257 -256
  31. package/dist/ckeditor/ckConfigurator.js +130 -154
  32. package/dist/ckeditor/dtdHandler.js +305 -345
  33. package/dist/class/css/selector.css +7 -7
  34. package/dist/class/css/selector.css.map +1 -1
  35. package/dist/class/selector.js +437 -470
  36. package/dist/component/alignable.js +97 -121
  37. package/dist/component/containable.js +53 -58
  38. package/dist/component/css/components.css +7 -7
  39. package/dist/component/css/components.css.map +1 -1
  40. package/dist/component/css/windowComponent.css +7 -7
  41. package/dist/component/css/windowComponent.css.map +1 -1
  42. package/dist/component/draggable.js +34 -36
  43. package/dist/component/placeable.js +84 -102
  44. package/dist/component/resizable.js +79 -89
  45. package/dist/component/stackable.js +21 -27
  46. package/dist/component/windowed.js +284 -297
  47. package/dist/component.js +439 -467
  48. package/dist/container.js +79 -98
  49. package/dist/contextualPopup/css/contextualPopup.css +7 -7
  50. package/dist/contextualPopup/css/contextualPopup.css.map +1 -1
  51. package/dist/contextualPopup.js +417 -436
  52. package/dist/dashboard/css/dashboard.css +7 -7
  53. package/dist/dashboard/css/dashboard.css.map +1 -1
  54. package/dist/dashboard.js +302 -305
  55. package/dist/datalist/css/datalist.css +7 -7
  56. package/dist/datalist/css/datalist.css.map +1 -1
  57. package/dist/datalist.js +783 -791
  58. package/dist/datatable/css/datatable.css +11 -7
  59. package/dist/datatable/css/datatable.css.map +1 -1
  60. package/dist/datatable/filterStrategy/filterStrategy.js +28 -30
  61. package/dist/datatable/filterStrategy/multiple.js +26 -45
  62. package/dist/datatable/filterStrategy/single.js +28 -40
  63. package/dist/datatable.js +1591 -1616
  64. package/dist/dateRange/css/dateRange.css +7 -7
  65. package/dist/dateRange/css/dateRange.css.map +1 -1
  66. package/dist/dateRange/dateRange.js +398 -412
  67. package/dist/datetime/css/picker.css +7 -7
  68. package/dist/datetime/css/picker.css.map +1 -1
  69. package/dist/datetime/picker.js +670 -703
  70. package/dist/deleter.js +383 -398
  71. package/dist/destination/css/selector.css +7 -7
  72. package/dist/destination/css/selector.css.map +1 -1
  73. package/dist/destination/selector.js +295 -293
  74. package/dist/dialog/alert.js +30 -32
  75. package/dist/dialog/confirm.js +29 -32
  76. package/dist/dialog/confirmDelete.js +223 -221
  77. package/dist/dialog.js +651 -695
  78. package/dist/disabler.js +108 -119
  79. package/dist/documentViewer/css/documentViewer.css +7 -7
  80. package/dist/documentViewer/css/documentViewer.css.map +1 -1
  81. package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +172 -169
  82. package/dist/documentViewer/providers/pdfViewer/pdfjs/areaBroker.js +32 -29
  83. package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +523 -564
  84. package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +376 -393
  85. package/dist/documentViewer/providers/pdfViewer/pdfjs/pagesManager.js +53 -68
  86. package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +517 -567
  87. package/dist/documentViewer/providers/pdfViewer/pdfjs/textManager.js +73 -96
  88. package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +381 -392
  89. package/dist/documentViewer/providers/pdfViewer/pdfjs/wrapper.js +125 -152
  90. package/dist/documentViewer/providers/pdfViewer.js +189 -191
  91. package/dist/documentViewer/viewerFactory.js +76 -81
  92. package/dist/documentViewer.js +303 -311
  93. package/dist/dropdown/css/dropdown.css +7 -7
  94. package/dist/dropdown/css/dropdown.css.map +1 -1
  95. package/dist/dropdown.js +392 -412
  96. package/dist/durationer.js +77 -85
  97. package/dist/dynamicComponent/css/dynamicComponent.css +7 -7
  98. package/dist/dynamicComponent/css/dynamicComponent.css.map +1 -1
  99. package/dist/dynamicComponent.js +595 -630
  100. package/dist/feedback.js +365 -375
  101. package/dist/figure/FigureStateActive.js +246 -296
  102. package/dist/filesender.js +44 -54
  103. package/dist/filter.js +244 -240
  104. package/dist/form/css/dropdownForm.css +7 -7
  105. package/dist/form/css/dropdownForm.css.map +1 -1
  106. package/dist/form/css/form.css +7 -7
  107. package/dist/form/css/form.css.map +1 -1
  108. package/dist/form/dropdownForm.js +357 -362
  109. package/dist/form/form.js +703 -984
  110. package/dist/form/simpleForm.js +74 -77
  111. package/dist/form/validator/css/validator.css +7 -7
  112. package/dist/form/validator/css/validator.css.map +1 -1
  113. package/dist/form/validator/renderer.js +235 -241
  114. package/dist/form/validator/validator.js +181 -267
  115. package/dist/form/widget/css/widget.css +7 -7
  116. package/dist/form/widget/css/widget.css.map +1 -1
  117. package/dist/form/widget/definitions.js +27 -28
  118. package/dist/form/widget/loader.js +16 -16
  119. package/dist/form/widget/providers/checkBox.js +257 -264
  120. package/dist/form/widget/providers/comboBox.js +194 -193
  121. package/dist/form/widget/providers/default.js +44 -50
  122. package/dist/form/widget/providers/hidden.js +179 -176
  123. package/dist/form/widget/providers/hiddenBox.js +262 -272
  124. package/dist/form/widget/providers/radioBox.js +222 -223
  125. package/dist/form/widget/providers/textArea.js +197 -193
  126. package/dist/form/widget/providers/textBox.js +36 -37
  127. package/dist/form/widget/widget.js +480 -508
  128. package/dist/form.js +12 -17
  129. package/dist/formValidator/formValidator.js +74 -91
  130. package/dist/formValidator/highlighters/highlighter.js +43 -51
  131. package/dist/formValidator/highlighters/message.js +31 -32
  132. package/dist/formValidator/highlighters/tooltip.js +33 -35
  133. package/dist/generis/form/css/form.css +7 -7
  134. package/dist/generis/form/css/form.css.map +1 -1
  135. package/dist/generis/form/form.js +323 -331
  136. package/dist/generis/validator/css/validator.css +7 -7
  137. package/dist/generis/validator/css/validator.css.map +1 -1
  138. package/dist/generis/validator/validator.js +215 -216
  139. package/dist/generis/widget/checkBox/checkBox.js +227 -225
  140. package/dist/generis/widget/comboBox/comboBox.js +189 -183
  141. package/dist/generis/widget/css/widget.css +7 -7
  142. package/dist/generis/widget/css/widget.css.map +1 -1
  143. package/dist/generis/widget/hiddenBox/hiddenBox.js +231 -232
  144. package/dist/generis/widget/loader.js +21 -23
  145. package/dist/generis/widget/textBox/textBox.js +178 -172
  146. package/dist/generis/widget/widget.js +255 -266
  147. package/dist/groupedComboBox.js +231 -226
  148. package/dist/groupvalidator.js +30 -34
  149. package/dist/hider.js +43 -50
  150. package/dist/highlighter.js +946 -1057
  151. package/dist/image/ImgStateActive/extractLabel.js +20 -21
  152. package/dist/image/ImgStateActive/helper.js +21 -25
  153. package/dist/image/ImgStateActive/initHelper.js +133 -162
  154. package/dist/image/ImgStateActive/initMediaEditor.js +72 -92
  155. package/dist/image/ImgStateActive/mediaSizer.js +48 -58
  156. package/dist/image/ImgStateActive.js +185 -215
  157. package/dist/incrementer.js +91 -110
  158. package/dist/inplacer.js +108 -132
  159. package/dist/interactUtils.js +56 -67
  160. package/dist/itemButtonList/css/item-button-list.css +23 -24
  161. package/dist/itemButtonList/css/item-button-list.css.map +1 -1
  162. package/dist/itemButtonList.js +444 -469
  163. package/dist/keyNavigation/navigableDomElement.js +124 -158
  164. package/dist/keyNavigation/navigator.js +235 -312
  165. package/dist/listbox/css/listbox.css +7 -7
  166. package/dist/listbox/css/listbox.css.map +1 -1
  167. package/dist/listbox.js +463 -476
  168. package/dist/liststyler.js +75 -76
  169. package/dist/loadingButton/css/button.css +7 -7
  170. package/dist/loadingButton/css/button.css.map +1 -1
  171. package/dist/loadingButton/loadingButton.js +219 -218
  172. package/dist/lock.js +484 -509
  173. package/dist/login/login.js +471 -486
  174. package/dist/maths/calculator/basicCalculator.js +247 -242
  175. package/dist/maths/calculator/calculatorComponent.js +34 -36
  176. package/dist/maths/calculator/core/areaBroker.js +30 -28
  177. package/dist/maths/calculator/core/board.js +805 -872
  178. package/dist/maths/calculator/core/expression.js +500 -518
  179. package/dist/maths/calculator/core/labels.js +240 -235
  180. package/dist/maths/calculator/core/plugin.js +20 -20
  181. package/dist/maths/calculator/core/terms.js +27 -27
  182. package/dist/maths/calculator/core/tokenizer.js +119 -132
  183. package/dist/maths/calculator/core/tokens.js +157 -168
  184. package/dist/maths/calculator/css/calculator.css +7 -7
  185. package/dist/maths/calculator/css/calculator.css.map +1 -1
  186. package/dist/maths/calculator/defaultCalculator.js +24 -27
  187. package/dist/maths/calculator/plugins/core/degrad.js +22 -30
  188. package/dist/maths/calculator/plugins/core/history.js +55 -67
  189. package/dist/maths/calculator/plugins/core/remind.js +22 -25
  190. package/dist/maths/calculator/plugins/core/stepNavigation.js +33 -49
  191. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +255 -258
  192. package/dist/maths/calculator/plugins/modifiers/pow10.js +47 -52
  193. package/dist/maths/calculator/plugins/modifiers/sign.js +103 -130
  194. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +288 -293
  195. package/dist/maths/calculator/pluginsLoader.js +22 -22
  196. package/dist/maths/calculator/scientificCalculator.js +339 -334
  197. package/dist/mediaEditor/mediaEditorComponent.js +244 -249
  198. package/dist/mediaEditor/plugins/mediaAlignment/helper.js +28 -33
  199. package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +228 -236
  200. package/dist/mediaEditor/plugins/mediaAlignment/style.css +7 -7
  201. package/dist/mediaEditor/plugins/mediaDimension/helper.js +81 -106
  202. package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +597 -635
  203. package/dist/mediaEditor/plugins/mediaDimension/style.css +141 -141
  204. package/dist/mediaplayer/css/player.css +7 -7
  205. package/dist/mediaplayer/css/player.css.map +1 -1
  206. package/dist/mediaplayer/players/html5.js +646 -706
  207. package/dist/mediaplayer/players/youtube.js +393 -438
  208. package/dist/mediaplayer/players.js +19 -19
  209. package/dist/mediaplayer/support.js +66 -79
  210. package/dist/mediaplayer/utils/reminder.js +117 -128
  211. package/dist/mediaplayer/utils/timeObserver.js +106 -109
  212. package/dist/mediaplayer/youtubeManager.js +142 -170
  213. package/dist/mediaplayer.js +1484 -1774
  214. package/dist/mediasizer.js +633 -676
  215. package/dist/modal.js +137 -153
  216. package/dist/movableComponent.js +37 -37
  217. package/dist/pageSizeSelector.js +231 -224
  218. package/dist/pageStatus.js +43 -46
  219. package/dist/pagination/css/pagination.css +7 -7
  220. package/dist/pagination/css/pagination.css.map +1 -1
  221. package/dist/pagination/paginationStrategy.js +24 -25
  222. package/dist/pagination/providers/pages.js +281 -291
  223. package/dist/pagination/providers/simple.js +202 -196
  224. package/dist/pagination.js +49 -72
  225. package/dist/previewer.js +113 -138
  226. package/dist/progressbar.js +70 -80
  227. package/dist/propertySelector/css/propertySelector.css +74 -0
  228. package/dist/propertySelector/css/propertySelector.css.map +1 -0
  229. package/dist/propertySelector/propertySelector.js +489 -0
  230. package/dist/report.js +356 -359
  231. package/dist/resource/css/selector.css +7 -7
  232. package/dist/resource/css/selector.css.map +1 -1
  233. package/dist/resource/filters.js +275 -289
  234. package/dist/resource/list.js +1589 -1371
  235. package/dist/resource/selectable.js +101 -136
  236. package/dist/resource/selector.js +855 -914
  237. package/dist/resource/tree.js +1796 -1612
  238. package/dist/resourcemgr/css/resourcemgr.css +7 -7
  239. package/dist/resourcemgr/css/resourcemgr.css.map +1 -1
  240. package/dist/resourcemgr/fileBrowser.js +540 -587
  241. package/dist/resourcemgr/filePreview.js +16 -25
  242. package/dist/resourcemgr/fileSelector.js +520 -547
  243. package/dist/resourcemgr/util/updatePermissions.js +10 -18
  244. package/dist/resourcemgr.js +325 -332
  245. package/dist/scroller.js +29 -33
  246. package/dist/searchModal/advancedSearch.js +949 -833
  247. package/dist/searchModal/css/advancedSearch.css +7 -14
  248. package/dist/searchModal/css/advancedSearch.css.map +1 -1
  249. package/dist/searchModal/css/searchModal.css +28 -8
  250. package/dist/searchModal/css/searchModal.css.map +1 -1
  251. package/dist/searchModal.js +616 -335
  252. package/dist/selecter.js +21 -28
  253. package/dist/stacker.js +52 -60
  254. package/dist/switch/css/switch.css +7 -7
  255. package/dist/switch/css/switch.css.map +1 -1
  256. package/dist/switch/switch.js +305 -311
  257. package/dist/tableModel.js +39 -49
  258. package/dist/tabs/css/tabs.css +12 -12
  259. package/dist/tabs/css/tabs.css.map +1 -1
  260. package/dist/tabs.js +588 -639
  261. package/dist/taskQueue/css/taskQueue.css +7 -7
  262. package/dist/taskQueue/css/taskQueue.css.map +1 -1
  263. package/dist/taskQueue/status.js +317 -322
  264. package/dist/taskQueue/table.js +383 -394
  265. package/dist/taskQueue/taskQueue.js +19 -19
  266. package/dist/taskQueue/taskQueueModel.js +459 -538
  267. package/dist/taskQueue.js +49 -67
  268. package/dist/taskQueueButton/css/taskable.css +7 -7
  269. package/dist/taskQueueButton/css/taskable.css.map +1 -1
  270. package/dist/taskQueueButton/css/treeButton.css +7 -7
  271. package/dist/taskQueueButton/css/treeButton.css.map +1 -1
  272. package/dist/taskQueueButton/standardButton.js +45 -43
  273. package/dist/taskQueueButton/taskable.js +267 -272
  274. package/dist/taskQueueButton/treeButton.js +200 -198
  275. package/dist/themeLoader.js +109 -129
  276. package/dist/themes.js +86 -100
  277. package/dist/toggler.js +76 -88
  278. package/dist/tooltip.js +296 -311
  279. package/dist/tooltipster.js +17 -17
  280. package/dist/transformer.js +140 -169
  281. package/dist/tristateCheckboxGroup/css/tristateCheckboxGroup.css +7 -7
  282. package/dist/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +1 -1
  283. package/dist/tristateCheckboxGroup.js +319 -325
  284. package/dist/uploader.js +691 -724
  285. package/dist/validator/Report.js +1 -2
  286. package/dist/validator/Validator.js +6 -25
  287. package/dist/validator/validators.js +66 -80
  288. package/dist/validator.js +218 -254
  289. package/dist/waitForMedia.js +45 -51
  290. package/dist/waitingDialog/css/waitingDialog.css +7 -7
  291. package/dist/waitingDialog/css/waitingDialog.css.map +1 -1
  292. package/dist/waitingDialog/waitingDialog.js +59 -77
  293. package/package.json +109 -107
  294. package/scss/basic.scss +16 -16
  295. package/scss/ckeditor/skins/tao/scss/inc/_ck-icons.scss +59 -59
  296. package/scss/ckeditor/skins/tao/scss/inc/_tao.scss +59 -59
  297. package/scss/font/tao/tao.svg +234 -234
  298. package/scss/inc/_base.scss +495 -495
  299. package/scss/inc/_bootstrap.scss +6 -6
  300. package/scss/inc/_buttons.scss +114 -114
  301. package/scss/inc/_colors.scss +93 -88
  302. package/scss/inc/_feedback.scss +150 -150
  303. package/scss/inc/_flex-grid.scss +15 -15
  304. package/scss/inc/_fonts.scss +4 -4
  305. package/scss/inc/_forms.scss +832 -832
  306. package/scss/inc/_functions.scss +283 -283
  307. package/scss/inc/_jquery.nouislider.scss +254 -254
  308. package/scss/inc/_normalize.scss +528 -528
  309. package/scss/inc/_report.scss +67 -67
  310. package/scss/inc/_secondary-properties.scss +89 -89
  311. package/scss/inc/_select2.scss +634 -634
  312. package/scss/inc/_toolbars.scss +155 -155
  313. package/scss/inc/_tooltip.scss +312 -312
  314. package/scss/inc/_variables.scss +21 -21
  315. package/scss/inc/base/_highlight.scss +5 -5
  316. package/scss/inc/base/_list-style.scss +58 -58
  317. package/scss/inc/base/_svg.scss +3 -3
  318. package/scss/inc/base/_table.scss +62 -62
  319. package/scss/inc/fonts/_source-sans-pro.scss +29 -29
  320. package/scss/inc/fonts/_tao-icon-classes.scss +226 -226
  321. package/scss/inc/fonts/_tao-icon-def.scss +12 -12
  322. package/scss/inc/fonts/_tao-icon-vars.scss +240 -240
  323. package/src/actionbar/tpl/main.tpl +8 -8
  324. package/src/actionbar.js +251 -251
  325. package/src/adder.js +250 -250
  326. package/src/animable/absorbable/absorbable.js +134 -134
  327. package/src/animable/absorbable/css/absorb.css +7 -8
  328. package/src/animable/absorbable/css/absorb.css.map +1 -1
  329. package/src/animable/absorbable/scss/absorb.scss +37 -37
  330. package/src/animable/pulsable/css/pulse.css +7 -7
  331. package/src/animable/pulsable/css/pulse.css.map +1 -1
  332. package/src/animable/pulsable/pulsable.js +90 -90
  333. package/src/animable/pulsable/scss/pulse.scss +22 -22
  334. package/src/areaBroker.js +160 -160
  335. package/src/autocomplete/css/autocomplete.css +7 -8
  336. package/src/autocomplete/css/autocomplete.css.map +1 -1
  337. package/src/autocomplete/scss/autocomplete.scss +37 -37
  338. package/src/autocomplete.js +1029 -1029
  339. package/src/autoscroll.js +57 -57
  340. package/src/badge/badge.js +119 -119
  341. package/src/badge/css/badge.css +7 -8
  342. package/src/badge/css/badge.css.map +1 -1
  343. package/src/badge/scss/badge.scss +92 -92
  344. package/src/badge/tpl/badge.tpl +4 -4
  345. package/src/breadcrumbs/css/breadcrumbs.css +7 -7
  346. package/src/breadcrumbs/css/breadcrumbs.css.map +1 -1
  347. package/src/breadcrumbs/scss/breadcrumbs.scss +52 -52
  348. package/src/breadcrumbs/tpl/breadcrumbs.tpl +20 -20
  349. package/src/breadcrumbs.js +99 -99
  350. package/src/btngrouper.js +213 -213
  351. package/src/bulkActionPopup/css/bulkActionPopup.css +7 -7
  352. package/src/bulkActionPopup/css/bulkActionPopup.css.map +1 -1
  353. package/src/bulkActionPopup/scss/bulkActionPopup.scss +63 -63
  354. package/src/bulkActionPopup/tpl/layout.tpl +76 -76
  355. package/src/bulkActionPopup/tpl/select.tpl +8 -8
  356. package/src/bulkActionPopup.js +274 -274
  357. package/src/button/tpl/button.tpl +4 -4
  358. package/src/button.js +135 -135
  359. package/src/calculator/css/calculator.css +10 -10
  360. package/src/calculator/css/calculator.css.map +1 -1
  361. package/src/calculator/scss/calculator.scss +139 -139
  362. package/src/calculator.js +188 -188
  363. package/src/cascadingComboBox.js +126 -126
  364. package/src/ckeditor/ckConfigurator.js +736 -736
  365. package/src/ckeditor/dtdHandler.js +1030 -1030
  366. package/src/class/css/selector.css +7 -7
  367. package/src/class/css/selector.css.map +1 -1
  368. package/src/class/scss/selector.scss +101 -101
  369. package/src/class/selector.js +329 -329
  370. package/src/class/tpl/listItem.tpl +9 -9
  371. package/src/class/tpl/selector.tpl +10 -10
  372. package/src/component/alignable.js +274 -274
  373. package/src/component/containable.js +122 -122
  374. package/src/component/css/components.css +7 -7
  375. package/src/component/css/components.css.map +1 -1
  376. package/src/component/css/windowComponent.css +7 -7
  377. package/src/component/css/windowComponent.css.map +1 -1
  378. package/src/component/draggable.js +104 -104
  379. package/src/component/placeable.js +233 -233
  380. package/src/component/resizable.js +195 -195
  381. package/src/component/scss/components.scss +507 -507
  382. package/src/component/scss/windowComponent.scss +62 -62
  383. package/src/component/stackable.js +67 -67
  384. package/src/component/tpl/window.tpl +7 -7
  385. package/src/component/windowed.js +206 -206
  386. package/src/component.js +401 -401
  387. package/src/container.js +200 -200
  388. package/src/contextualPopup/css/contextualPopup.css +7 -7
  389. package/src/contextualPopup/css/contextualPopup.css.map +1 -1
  390. package/src/contextualPopup/scss/contextualPopup.scss +78 -78
  391. package/src/contextualPopup/tpl/popup.tpl +10 -10
  392. package/src/contextualPopup.js +297 -297
  393. package/src/css/basic.css +103 -106
  394. package/src/css/basic.css.map +1 -1
  395. package/src/dashboard/css/dashboard.css +7 -7
  396. package/src/dashboard/css/dashboard.css.map +1 -1
  397. package/src/dashboard/scss/dashboard.scss +93 -93
  398. package/src/dashboard/tpl/dashboard.tpl +16 -16
  399. package/src/dashboard/tpl/dashboardMetricsList.tpl +15 -15
  400. package/src/dashboard.js +184 -184
  401. package/src/datalist/css/datalist.css +7 -7
  402. package/src/datalist/css/datalist.css.map +1 -1
  403. package/src/datalist/scss/datalist.scss +116 -116
  404. package/src/datalist/tpl/list.tpl +24 -24
  405. package/src/datalist/tpl/main.tpl +44 -44
  406. package/src/datalist.js +500 -500
  407. package/src/datatable/css/datatable.css +11 -7
  408. package/src/datatable/css/datatable.css.map +1 -1
  409. package/src/datatable/filterStrategy/filterStrategy.js +70 -70
  410. package/src/datatable/filterStrategy/multiple.js +126 -126
  411. package/src/datatable/filterStrategy/single.js +108 -108
  412. package/src/datatable/scss/datatable.scss +149 -146
  413. package/src/datatable/tpl/button.tpl +6 -6
  414. package/src/datatable/tpl/layout.tpl +158 -158
  415. package/src/datatable.js +1056 -1056
  416. package/src/dateRange/css/dateRange.css +7 -7
  417. package/src/dateRange/css/dateRange.css.map +1 -1
  418. package/src/dateRange/dateRange.js +341 -341
  419. package/src/dateRange/scss/dateRange.scss +7 -7
  420. package/src/dateRange/tpl/select.tpl +18 -18
  421. package/src/datetime/css/picker.css +7 -7
  422. package/src/datetime/css/picker.css.map +1 -1
  423. package/src/datetime/picker.js +576 -576
  424. package/src/datetime/scss/picker.scss +192 -192
  425. package/src/datetime/tpl/picker.tpl +18 -18
  426. package/src/deleter/undo.tpl +6 -6
  427. package/src/deleter.js +296 -296
  428. package/src/destination/css/selector.css +7 -7
  429. package/src/destination/css/selector.css.map +1 -1
  430. package/src/destination/scss/selector.scss +36 -36
  431. package/src/destination/selector.js +195 -195
  432. package/src/destination/tpl/selector.tpl +13 -13
  433. package/src/dialog/alert.js +70 -70
  434. package/src/dialog/confirm.js +85 -85
  435. package/src/dialog/confirmDelete.js +95 -95
  436. package/src/dialog/tpl/body.tpl +24 -24
  437. package/src/dialog/tpl/buttons.tpl +6 -6
  438. package/src/dialog/tpl/checkbox.tpl +5 -5
  439. package/src/dialog.js +517 -517
  440. package/src/disabler.js +230 -230
  441. package/src/documentViewer/css/documentViewer.css +7 -7
  442. package/src/documentViewer/css/documentViewer.css.map +1 -1
  443. package/src/documentViewer/providers/pdfViewer/fallback/viewer.js +69 -69
  444. package/src/documentViewer/providers/pdfViewer/pdfjs/areaBroker.js +41 -41
  445. package/src/documentViewer/providers/pdfViewer/pdfjs/findBar.js +475 -475
  446. package/src/documentViewer/providers/pdfViewer/pdfjs/findBar.tpl +20 -20
  447. package/src/documentViewer/providers/pdfViewer/pdfjs/match.tpl +1 -1
  448. package/src/documentViewer/providers/pdfViewer/pdfjs/page.tpl +4 -4
  449. package/src/documentViewer/providers/pdfViewer/pdfjs/pageView.js +318 -318
  450. package/src/documentViewer/providers/pdfViewer/pdfjs/pagesManager.js +167 -167
  451. package/src/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +451 -451
  452. package/src/documentViewer/providers/pdfViewer/pdfjs/textManager.js +252 -252
  453. package/src/documentViewer/providers/pdfViewer/pdfjs/viewer.js +299 -299
  454. package/src/documentViewer/providers/pdfViewer/pdfjs/viewer.tpl +16 -16
  455. package/src/documentViewer/providers/pdfViewer/pdfjs/wrapper.js +351 -351
  456. package/src/documentViewer/providers/pdfViewer.js +93 -93
  457. package/src/documentViewer/scss/documentViewer.scss +184 -184
  458. package/src/documentViewer/viewerFactory.js +191 -191
  459. package/src/documentViewer.js +238 -238
  460. package/src/dropdown/css/dropdown.css +7 -7
  461. package/src/dropdown/css/dropdown.css.map +1 -1
  462. package/src/dropdown/scss/dropdown.scss +99 -99
  463. package/src/dropdown/tpl/dropdown.tpl +8 -8
  464. package/src/dropdown/tpl/list-item.tpl +4 -4
  465. package/src/dropdown.js +255 -255
  466. package/src/durationer.js +222 -222
  467. package/src/dynamicComponent/css/dynamicComponent.css +7 -7
  468. package/src/dynamicComponent/css/dynamicComponent.css.map +1 -1
  469. package/src/dynamicComponent/scss/dynamicComponent.scss +98 -98
  470. package/src/dynamicComponent/tpl/layout.tpl +17 -17
  471. package/src/dynamicComponent.js +554 -554
  472. package/src/feedback/feedback.tpl +7 -7
  473. package/src/feedback.js +295 -295
  474. package/src/figure/FigureStateActive.js +174 -174
  475. package/src/filesender.js +114 -114
  476. package/src/filter/template.tpl +5 -5
  477. package/src/filter.js +135 -135
  478. package/src/form/css/dropdownForm.css +7 -7
  479. package/src/form/css/dropdownForm.css.map +1 -1
  480. package/src/form/css/form.css +7 -7
  481. package/src/form/css/form.css.map +1 -1
  482. package/src/form/dropdownForm.js +281 -281
  483. package/src/form/form.js +688 -688
  484. package/src/form/scss/dropdownForm.scss +60 -60
  485. package/src/form/scss/form.scss +25 -25
  486. package/src/form/simpleForm.js +125 -125
  487. package/src/form/tpl/dropdownForm.tpl +4 -4
  488. package/src/form/tpl/form.tpl +7 -7
  489. package/src/form/validator/css/validator.css +7 -7
  490. package/src/form/validator/css/validator.css.map +1 -1
  491. package/src/form/validator/renderer.js +118 -118
  492. package/src/form/validator/scss/validator.scss +14 -14
  493. package/src/form/validator/tpl/message.tpl +1 -1
  494. package/src/form/validator/tpl/validator.tpl +1 -1
  495. package/src/form/validator/validator.js +220 -220
  496. package/src/form/widget/css/widget.css +7 -7
  497. package/src/form/widget/css/widget.css.map +1 -1
  498. package/src/form/widget/definitions.js +51 -51
  499. package/src/form/widget/loader.js +40 -40
  500. package/src/form/widget/providers/checkBox.js +138 -138
  501. package/src/form/widget/providers/comboBox.js +63 -63
  502. package/src/form/widget/providers/default.js +90 -90
  503. package/src/form/widget/providers/hidden.js +62 -62
  504. package/src/form/widget/providers/hiddenBox.js +152 -152
  505. package/src/form/widget/providers/radioBox.js +99 -99
  506. package/src/form/widget/providers/textArea.js +52 -52
  507. package/src/form/widget/providers/textBox.js +48 -48
  508. package/src/form/widget/scss/widget.scss +55 -55
  509. package/src/form/widget/tpl/checkBox.tpl +25 -25
  510. package/src/form/widget/tpl/comboBox.tpl +13 -13
  511. package/src/form/widget/tpl/hidden.tpl +1 -1
  512. package/src/form/widget/tpl/hiddenBox.tpl +17 -17
  513. package/src/form/widget/tpl/label.tpl +6 -6
  514. package/src/form/widget/tpl/radioBox.tpl +25 -25
  515. package/src/form/widget/tpl/textArea.tpl +8 -8
  516. package/src/form/widget/tpl/widget.tpl +8 -8
  517. package/src/form/widget/widget.js +372 -372
  518. package/src/form.js +53 -53
  519. package/src/formValidator/formValidator.js +253 -253
  520. package/src/formValidator/highlighters/highlighter.js +102 -102
  521. package/src/formValidator/highlighters/message.js +70 -70
  522. package/src/formValidator/highlighters/tooltip.js +78 -78
  523. package/src/generis/form/css/form.css +7 -7
  524. package/src/generis/form/css/form.css.map +1 -1
  525. package/src/generis/form/form.js +239 -239
  526. package/src/generis/form/readme.md +70 -70
  527. package/src/generis/form/scss/form.scss +23 -23
  528. package/src/generis/form/tpl/form.tpl +16 -16
  529. package/src/generis/validator/css/validator.css +7 -7
  530. package/src/generis/validator/css/validator.css.map +1 -1
  531. package/src/generis/validator/readme.md +46 -46
  532. package/src/generis/validator/scss/validator.scss +13 -13
  533. package/src/generis/validator/validator.js +128 -128
  534. package/src/generis/widget/checkBox/checkBox.js +112 -112
  535. package/src/generis/widget/checkBox/checkBox.tpl +18 -18
  536. package/src/generis/widget/comboBox/comboBox.js +67 -67
  537. package/src/generis/widget/comboBox/comboBox.tpl +12 -12
  538. package/src/generis/widget/css/widget.css +7 -7
  539. package/src/generis/widget/css/widget.css.map +1 -1
  540. package/src/generis/widget/hiddenBox/hiddenBox.js +132 -132
  541. package/src/generis/widget/hiddenBox/hiddenBox.tpl +16 -16
  542. package/src/generis/widget/loader.js +49 -49
  543. package/src/generis/widget/readme.md +59 -59
  544. package/src/generis/widget/scss/widget.scss +61 -61
  545. package/src/generis/widget/textBox/textBox.js +65 -65
  546. package/src/generis/widget/textBox/textBox.tpl +7 -7
  547. package/src/generis/widget/widget.js +164 -164
  548. package/src/generis/widget/widget.tpl +5 -5
  549. package/src/groupedComboBox.js +99 -99
  550. package/src/groupvalidator.js +84 -84
  551. package/src/hider.js +88 -88
  552. package/src/highlighter.js +1166 -1166
  553. package/src/image/ImgStateActive/extractLabel.js +29 -29
  554. package/src/image/ImgStateActive/helper.js +36 -36
  555. package/src/image/ImgStateActive/initHelper.js +137 -137
  556. package/src/image/ImgStateActive/initMediaEditor.js +92 -92
  557. package/src/image/ImgStateActive/mediaSizer.js +63 -63
  558. package/src/image/ImgStateActive.js +115 -115
  559. package/src/incrementer.js +319 -319
  560. package/src/inplacer.js +316 -316
  561. package/src/interactUtils.js +140 -140
  562. package/src/itemButtonList/css/item-button-list.css +23 -24
  563. package/src/itemButtonList/css/item-button-list.css.map +1 -1
  564. package/src/itemButtonList/scss/item-button-list.scss +236 -236
  565. package/src/itemButtonList/tpl/itemButtonList.tpl +21 -21
  566. package/src/itemButtonList.js +274 -274
  567. package/src/keyNavigation/navigableDomElement.js +282 -282
  568. package/src/keyNavigation/navigator.js +543 -543
  569. package/src/listbox/css/listbox.css +7 -7
  570. package/src/listbox/css/listbox.css.map +1 -1
  571. package/src/listbox/scss/listbox.scss +116 -116
  572. package/src/listbox/tpl/list.tpl +14 -14
  573. package/src/listbox/tpl/main.tpl +9 -9
  574. package/src/listbox.js +251 -251
  575. package/src/liststyler.js +155 -155
  576. package/src/loadingButton/css/button.css +7 -7
  577. package/src/loadingButton/css/button.css.map +1 -1
  578. package/src/loadingButton/loadingButton.js +110 -110
  579. package/src/loadingButton/scss/button.scss +41 -41
  580. package/src/loadingButton/tpl/button.tpl +5 -5
  581. package/src/lock/lock.tpl +16 -16
  582. package/src/lock.js +395 -395
  583. package/src/login/login.js +322 -322
  584. package/src/login/tpl/login.tpl +29 -29
  585. package/src/login/tpl/passwordReveal.tpl +7 -7
  586. package/src/maths/calculator/basicCalculator.js +55 -55
  587. package/src/maths/calculator/calculatorComponent.js +128 -128
  588. package/src/maths/calculator/core/areaBroker.js +38 -38
  589. package/src/maths/calculator/core/board.js +841 -841
  590. package/src/maths/calculator/core/expression.js +430 -430
  591. package/src/maths/calculator/core/labels.js +116 -116
  592. package/src/maths/calculator/core/plugin.js +40 -40
  593. package/src/maths/calculator/core/terms.js +459 -459
  594. package/src/maths/calculator/core/tokenizer.js +245 -245
  595. package/src/maths/calculator/core/tokens.js +178 -178
  596. package/src/maths/calculator/core/tpl/board.tpl +4 -4
  597. package/src/maths/calculator/css/calculator.css +7 -7
  598. package/src/maths/calculator/css/calculator.css.map +1 -1
  599. package/src/maths/calculator/defaultCalculator.js +66 -66
  600. package/src/maths/calculator/plugins/core/degrad.js +90 -90
  601. package/src/maths/calculator/plugins/core/history.js +166 -166
  602. package/src/maths/calculator/plugins/core/remind.js +96 -96
  603. package/src/maths/calculator/plugins/core/stepNavigation.js +175 -175
  604. package/src/maths/calculator/plugins/keyboard/templateKeyboard/defaultTemplate.tpl +36 -36
  605. package/src/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +91 -91
  606. package/src/maths/calculator/plugins/modifiers/pow10.js +143 -143
  607. package/src/maths/calculator/plugins/modifiers/sign.js +339 -339
  608. package/src/maths/calculator/plugins/screen/simpleScreen/defaultTemplate.tpl +3 -3
  609. package/src/maths/calculator/plugins/screen/simpleScreen/history.tpl +3 -3
  610. package/src/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +191 -191
  611. package/src/maths/calculator/pluginsLoader.js +46 -46
  612. package/src/maths/calculator/scientificCalculator.js +74 -74
  613. package/src/maths/calculator/scss/calculator.scss +396 -396
  614. package/src/maths/calculator/tpl/basicKeyboard.tpl +37 -37
  615. package/src/maths/calculator/tpl/basicScreen.tpl +2 -2
  616. package/src/maths/calculator/tpl/scientificKeyboard.tpl +61 -61
  617. package/src/maths/calculator/tpl/scientificScreen.tpl +3 -3
  618. package/src/mediaEditor/mediaEditorComponent.js +141 -141
  619. package/src/mediaEditor/plugins/mediaAlignment/helper.js +62 -62
  620. package/src/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +99 -99
  621. package/src/mediaEditor/plugins/mediaAlignment/style.css +7 -7
  622. package/src/mediaEditor/plugins/mediaAlignment/tpl/mediaAlignment.tpl +25 -25
  623. package/src/mediaEditor/plugins/mediaDimension/helper.js +189 -189
  624. package/src/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +561 -561
  625. package/src/mediaEditor/plugins/mediaDimension/style.css +141 -141
  626. package/src/mediaEditor/plugins/mediaDimension/tpl/mediaDimension.tpl +55 -55
  627. package/src/mediaEditor/tpl/editor.tpl +4 -4
  628. package/src/mediaplayer/css/player.css +7 -7
  629. package/src/mediaplayer/css/player.css.map +1 -1
  630. package/src/mediaplayer/players/html5.js +564 -564
  631. package/src/mediaplayer/players/youtube.js +323 -323
  632. package/src/mediaplayer/players.js +29 -29
  633. package/src/mediaplayer/readme.md +305 -305
  634. package/src/mediaplayer/scss/player.scss +569 -569
  635. package/src/mediaplayer/support.js +126 -126
  636. package/src/mediaplayer/tpl/audio.tpl +6 -6
  637. package/src/mediaplayer/tpl/player.tpl +37 -37
  638. package/src/mediaplayer/tpl/source.tpl +1 -1
  639. package/src/mediaplayer/tpl/video.tpl +6 -6
  640. package/src/mediaplayer/tpl/youtube.tpl +1 -1
  641. package/src/mediaplayer/utils/reminder.js +184 -184
  642. package/src/mediaplayer/utils/timeObserver.js +143 -143
  643. package/src/mediaplayer/youtubeManager.js +161 -161
  644. package/src/mediaplayer.js +1606 -1606
  645. package/src/mediasizer/mediasizer.tpl +55 -55
  646. package/src/mediasizer.js +635 -635
  647. package/src/modal.js +365 -365
  648. package/src/movableComponent.js +78 -78
  649. package/src/pageSizeSelector/tpl/pageSizeSelector.tpl +9 -9
  650. package/src/pageSizeSelector.js +107 -107
  651. package/src/pageStatus.js +147 -147
  652. package/src/pagination/css/pagination.css +7 -7
  653. package/src/pagination/css/pagination.css.map +1 -1
  654. package/src/pagination/paginationStrategy.js +53 -53
  655. package/src/pagination/providers/pages.js +161 -161
  656. package/src/pagination/providers/simple.js +74 -74
  657. package/src/pagination/providers/tpl/pages/page.tpl +1 -1
  658. package/src/pagination/providers/tpl/pages.tpl +8 -8
  659. package/src/pagination/providers/tpl/simple.tpl +7 -7
  660. package/src/pagination/scss/pagination.scss +111 -111
  661. package/src/pagination.js +237 -237
  662. package/src/previewer.js +300 -300
  663. package/src/progressbar.js +165 -165
  664. package/src/propertySelector/css/propertySelector.css +74 -0
  665. package/src/propertySelector/css/propertySelector.css.map +1 -0
  666. package/src/propertySelector/propertySelector.js +286 -0
  667. package/src/propertySelector/scss/propertySelector.scss +66 -0
  668. package/src/propertySelector/tpl/highlighted-text.tpl +1 -0
  669. package/src/propertySelector/tpl/property-description.tpl +13 -0
  670. package/src/propertySelector/tpl/property-selector.tpl +7 -0
  671. package/src/report/feedback.tpl +11 -11
  672. package/src/report/layout.tpl +10 -10
  673. package/src/report.js +184 -184
  674. package/src/resource/css/selector.css +7 -7
  675. package/src/resource/css/selector.css.map +1 -1
  676. package/src/resource/filters.js +208 -208
  677. package/src/resource/list.js +200 -200
  678. package/src/resource/scss/_filters.scss +26 -26
  679. package/src/resource/scss/_resource-list.scss +107 -107
  680. package/src/resource/scss/_resource-tree.scss +205 -205
  681. package/src/resource/scss/selector.scss +187 -187
  682. package/src/resource/selectable.js +322 -322
  683. package/src/resource/selector.js +871 -871
  684. package/src/resource/tpl/filters.tpl +2 -2
  685. package/src/resource/tpl/list.tpl +7 -7
  686. package/src/resource/tpl/listNode.tpl +4 -4
  687. package/src/resource/tpl/selector.tpl +46 -46
  688. package/src/resource/tpl/tree.tpl +4 -4
  689. package/src/resource/tpl/treeNode.tpl +30 -30
  690. package/src/resource/tree.js +400 -400
  691. package/src/resourcemgr/css/resourcemgr.css +7 -7
  692. package/src/resourcemgr/css/resourcemgr.css.map +1 -1
  693. package/src/resourcemgr/fileBrowser.js +381 -381
  694. package/src/resourcemgr/filePreview.js +73 -73
  695. package/src/resourcemgr/fileSelector.js +348 -348
  696. package/src/resourcemgr/scss/resourcemgr.scss +254 -254
  697. package/src/resourcemgr/tpl/fileSelect.tpl +39 -39
  698. package/src/resourcemgr/tpl/folder.tpl +11 -11
  699. package/src/resourcemgr/tpl/layout.tpl +84 -84
  700. package/src/resourcemgr/tpl/rootFolder.tpl +13 -13
  701. package/src/resourcemgr/util/updatePermissions.js +53 -53
  702. package/src/resourcemgr.js +216 -216
  703. package/src/scroller.js +94 -94
  704. package/src/scss/basic.scss +16 -16
  705. package/src/searchModal/advancedSearch.js +638 -601
  706. package/src/searchModal/css/advancedSearch.css +7 -14
  707. package/src/searchModal/css/advancedSearch.css.map +1 -1
  708. package/src/searchModal/css/searchModal.css +28 -8
  709. package/src/searchModal/css/searchModal.css.map +1 -1
  710. package/src/searchModal/scss/advancedSearch.scss +171 -177
  711. package/src/searchModal/scss/searchModal.scss +393 -375
  712. package/src/searchModal/tpl/advanced-search.tpl +9 -9
  713. package/src/searchModal/tpl/criteria-alias.tpl +1 -0
  714. package/src/searchModal/tpl/criteria-class-label.tpl +1 -0
  715. package/src/searchModal/tpl/criteria-label.tpl +1 -0
  716. package/src/searchModal/tpl/highlighted-text.tpl +1 -0
  717. package/src/searchModal/tpl/info-message.tpl +3 -3
  718. package/src/searchModal/tpl/invalid-criteria-warning.tpl +10 -10
  719. package/src/searchModal/tpl/layout.tpl +27 -25
  720. package/src/searchModal/tpl/list-checkbox-criterion.tpl +17 -12
  721. package/src/searchModal/tpl/list-select-criterion.tpl +12 -6
  722. package/src/searchModal/tpl/property-select-button.tpl +1 -0
  723. package/src/searchModal/tpl/results-container.tpl +1 -0
  724. package/src/searchModal/tpl/text-criterion.tpl +11 -6
  725. package/src/searchModal.js +761 -496
  726. package/src/selecter.js +43 -43
  727. package/src/stacker.js +133 -133
  728. package/src/switch/css/switch.css +7 -7
  729. package/src/switch/css/switch.css.map +1 -1
  730. package/src/switch/scss/switch.scss +83 -83
  731. package/src/switch/switch.js +195 -195
  732. package/src/switch/tpl/switch.tpl +7 -7
  733. package/src/tableModel.js +112 -112
  734. package/src/tabs/css/tabs.css +12 -12
  735. package/src/tabs/css/tabs.css.map +1 -1
  736. package/src/tabs/scss/tabs.scss +50 -50
  737. package/src/tabs/tpl/panel.tpl +3 -3
  738. package/src/tabs/tpl/tabs.tpl +10 -10
  739. package/src/tabs.js +528 -528
  740. package/src/taskQueue/css/taskQueue.css +7 -7
  741. package/src/taskQueue/css/taskQueue.css.map +1 -1
  742. package/src/taskQueue/scss/taskQueue.scss +47 -47
  743. package/src/taskQueue/status.js +228 -228
  744. package/src/taskQueue/table.js +350 -350
  745. package/src/taskQueue/taskQueue.js +33 -33
  746. package/src/taskQueue/taskQueueModel.js +548 -548
  747. package/src/taskQueue/tpl/statusMessage.tpl +7 -7
  748. package/src/taskQueue.js +218 -218
  749. package/src/taskQueueButton/css/taskable.css +7 -7
  750. package/src/taskQueueButton/css/taskable.css.map +1 -1
  751. package/src/taskQueueButton/css/treeButton.css +7 -7
  752. package/src/taskQueueButton/css/treeButton.css.map +1 -1
  753. package/src/taskQueueButton/scss/taskable.scss +4 -4
  754. package/src/taskQueueButton/scss/treeButton.scss +34 -34
  755. package/src/taskQueueButton/standardButton.js +108 -108
  756. package/src/taskQueueButton/taskable.js +202 -202
  757. package/src/taskQueueButton/tpl/report.tpl +5 -5
  758. package/src/taskQueueButton/tpl/treeButton.tpl +6 -6
  759. package/src/taskQueueButton/treeButton.js +109 -109
  760. package/src/themeLoader.js +252 -252
  761. package/src/themes.js +162 -162
  762. package/src/toggler.js +200 -200
  763. package/src/tooltip/default.tpl +3 -3
  764. package/src/tooltip.js +160 -160
  765. package/src/tooltipster.js +25 -25
  766. package/src/transformer.js +327 -327
  767. package/src/tristateCheckboxGroup/css/tristateCheckboxGroup.css +7 -7
  768. package/src/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +1 -1
  769. package/src/tristateCheckboxGroup/scss/tristateCheckboxGroup.scss +15 -15
  770. package/src/tristateCheckboxGroup/tpl/li.tpl +6 -6
  771. package/src/tristateCheckboxGroup.js +207 -207
  772. package/src/uploader/fileEntry.tpl +6 -6
  773. package/src/uploader/uploader.tpl +32 -32
  774. package/src/uploader.js +594 -594
  775. package/src/validator/Report.js +10 -10
  776. package/src/validator/Validator.js +108 -108
  777. package/src/validator/validators.js +220 -220
  778. package/src/validator.js +264 -264
  779. package/src/waitForMedia.js +82 -82
  780. package/src/waitingDialog/css/waitingDialog.css +7 -7
  781. package/src/waitingDialog/css/waitingDialog.css.map +1 -1
  782. package/src/waitingDialog/scss/waitingDialog.scss +34 -34
  783. package/src/waitingDialog/waitingDialog.js +240 -240
@@ -1,1876 +1,1586 @@
1
1
  define(['jquery', 'lodash', 'async', 'util/urlParser', 'core/eventifier', 'core/mimetype', 'core/store', 'ui/mediaplayer/support', 'ui/mediaplayer/players', 'handlebars', 'i18n', 'lib/dompurify/purify', 'css!ui/mediaplayer/css/player.css', 'nouislider'], function ($$1, _, async, UrlParser, eventifier, mimetype, store, support, players, Handlebars, __, DOMPurify, player_css, nouislider) { 'use strict';
2
2
 
3
- $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
- _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
- async = async && Object.prototype.hasOwnProperty.call(async, 'default') ? async['default'] : async;
6
- UrlParser = UrlParser && Object.prototype.hasOwnProperty.call(UrlParser, 'default') ? UrlParser['default'] : UrlParser;
7
- eventifier = eventifier && Object.prototype.hasOwnProperty.call(eventifier, 'default') ? eventifier['default'] : eventifier;
8
- mimetype = mimetype && Object.prototype.hasOwnProperty.call(mimetype, 'default') ? mimetype['default'] : mimetype;
9
- store = store && Object.prototype.hasOwnProperty.call(store, 'default') ? store['default'] : store;
10
- support = support && Object.prototype.hasOwnProperty.call(support, 'default') ? support['default'] : support;
11
- players = players && Object.prototype.hasOwnProperty.call(players, 'default') ? players['default'] : players;
12
- Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
13
- __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
14
- DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
15
-
16
- function _typeof(obj) {
17
- "@babel/helpers - typeof";
18
-
19
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
20
- return typeof obj;
21
- } : function (obj) {
22
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
23
- }, _typeof(obj);
24
- }
25
-
26
- function Helpers0 (hb) {
27
- //register a i18n helper
28
- hb.registerHelper('__', function (key) {
29
- return __(key);
30
- });
31
- /**
32
- * Register dompurify helper
33
- *
34
- * https://github.com/cure53/DOMPurify
35
- * with config SAFE_FOR_TEMPLATES: true
36
- * to make output safe for template systems
37
- */
38
-
39
- hb.registerHelper('dompurify', function (context) {
40
- return DOMPurify.sanitize(context);
41
- });
42
- /**
43
- * Register join helper
44
- *
45
- * Example :
46
- * var values = {a:v1, b:v2, c:v3};
47
- * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
48
- * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
3
+ $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
+ _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
+ async = async && Object.prototype.hasOwnProperty.call(async, 'default') ? async['default'] : async;
6
+ UrlParser = UrlParser && Object.prototype.hasOwnProperty.call(UrlParser, 'default') ? UrlParser['default'] : UrlParser;
7
+ eventifier = eventifier && Object.prototype.hasOwnProperty.call(eventifier, 'default') ? eventifier['default'] : eventifier;
8
+ mimetype = mimetype && Object.prototype.hasOwnProperty.call(mimetype, 'default') ? mimetype['default'] : mimetype;
9
+ store = store && Object.prototype.hasOwnProperty.call(store, 'default') ? store['default'] : store;
10
+ support = support && Object.prototype.hasOwnProperty.call(support, 'default') ? support['default'] : support;
11
+ players = players && Object.prototype.hasOwnProperty.call(players, 'default') ? players['default'] : players;
12
+ Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
13
+ __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
14
+ DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
15
+
16
+ /**
17
+ * This program is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU General Public License
19
+ * as published by the Free Software Foundation; under version 2
20
+ * of the License (non-upgradable).
21
+ *
22
+ * This program is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with this program; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30
+ *
31
+ * Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
32
+ *
33
+ *
49
34
  */
35
+ function Helpers0 (hb) {
36
+ //register a i18n helper
37
+ hb.registerHelper('__', function (key) {
38
+ return __(key);
39
+ });
50
40
 
51
- hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
52
- var fragments = [];
53
- keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
54
- fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
55
- wrapper = typeof wrapper === 'string' ? wrapper : '"';
56
-
57
- _.forIn(arr, function (value, key) {
58
- var fragment = '';
41
+ /**
42
+ * Register dompurify helper
43
+ *
44
+ * https://github.com/cure53/DOMPurify
45
+ * with config SAFE_FOR_TEMPLATES: true
46
+ * to make output safe for template systems
47
+ */
48
+ hb.registerHelper('dompurify', function (context) {
49
+ return DOMPurify.sanitize(context);
50
+ });
59
51
 
60
- if (value !== null || value !== undefined) {
61
- if (typeof value === 'boolean') {
62
- value = value ? 'true' : 'false';
63
- } else if (_typeof(value) === 'object') {
64
- value = _.values(value).join(' ');
52
+ /**
53
+ * Register join helper
54
+ *
55
+ * Example :
56
+ * var values = {a:v1, b:v2, c:v3};
57
+ * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
58
+ * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
59
+ */
60
+ hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
61
+ var fragments = [];
62
+ keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
63
+ fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
64
+ wrapper = typeof wrapper === 'string' ? wrapper : '"';
65
+ _.forIn(arr, function (value, key) {
66
+ var fragment = '';
67
+ if (value !== null || value !== undefined) {
68
+ if (typeof value === 'boolean') {
69
+ value = value ? 'true' : 'false';
70
+ } else if (typeof value === 'object') {
71
+ value = _.values(value).join(' ');
72
+ }
73
+ } else {
74
+ value = '';
65
75
  }
66
- } else {
67
- value = '';
68
- }
76
+ if (keyValueGlue !== undefined) {
77
+ fragment += key + keyValueGlue;
78
+ }
79
+ fragment += wrapper + value + wrapper;
80
+ fragments.push(fragment);
81
+ });
82
+ return fragments.join(fragmentGlue);
83
+ });
69
84
 
70
- if (keyValueGlue !== undefined) {
71
- fragment += key + keyValueGlue;
85
+ //register a classic "for loop" helper
86
+ //it also adds a local variable "i" as the index in each iteration loop
87
+ hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
88
+ var ret = '';
89
+ startIndex = parseInt(startIndex);
90
+ stopIndex = parseInt(stopIndex);
91
+ increment = parseInt(increment);
92
+ for (var i = startIndex; i < stopIndex; i += increment) {
93
+ ret += options.fn(_.extend({}, this, {
94
+ i: i
95
+ }));
96
+ }
97
+ return ret;
98
+ });
99
+ hb.registerHelper('equal', function (var1, var2, options) {
100
+ if (var1 == var2) {
101
+ return options.fn(this);
102
+ } else {
103
+ return options.inverse(this);
72
104
  }
73
-
74
- fragment += wrapper + value + wrapper;
75
- fragments.push(fragment);
76
105
  });
77
106
 
78
- return fragments.join(fragmentGlue);
79
- }); //register a classic "for loop" helper
80
- //it also adds a local variable "i" as the index in each iteration loop
81
-
82
- hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
83
- var ret = '';
84
- startIndex = parseInt(startIndex);
85
- stopIndex = parseInt(stopIndex);
86
- increment = parseInt(increment);
87
-
88
- for (var i = startIndex; i < stopIndex; i += increment) {
89
- ret += options.fn(_.extend({}, this, {
90
- i: i
91
- }));
92
- }
93
-
94
- return ret;
95
- });
96
- hb.registerHelper('equal', function (var1, var2, options) {
97
- if (var1 == var2) {
98
- return options.fn(this);
99
- } else {
100
- return options.inverse(this);
101
- }
102
- }); // register a "get property" helper
103
- // it gets the named property from the provided context
104
-
105
- hb.registerHelper('property', function (name, context) {
106
- return context[name] || '';
107
- }); // register an 'includes' helper
108
- // it checks if value is in array
109
-
110
- hb.registerHelper('includes', function (haystack, needle, options) {
111
- if (_.contains(haystack, needle)) {
112
- return options.fn(this);
113
- }
114
- });
115
- }
116
-
117
- if (!Helpers0.__initialized) {
118
- Helpers0(Handlebars);
119
- Helpers0.__initialized = true;
120
- }
121
- var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
122
- this.compilerInfo = [4,'>= 1.0.0'];
123
- helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
124
- var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing;
125
-
126
-
127
- buffer += "<div class=\"mediaplayer ";
128
- if (helper = helpers.type) { stack1 = helper.call(depth0, {hash:{},data:data}); }
129
- else { helper = (depth0 && depth0.type); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
130
- buffer += escapeExpression(stack1)
131
- + "\">\r\n <div class=\"player\">\r\n <div class=\"player-overlay\">\r\n <a class=\"action play\" data-control=\"play\"><span class=\"icon icon-play\" title=\""
132
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Play", options) : helperMissing.call(depth0, "__", "Play", options)))
133
- + "\"></span></a>\r\n <a class=\"action play\" data-control=\"pause\"><span class=\"icon icon-pause\" title=\""
134
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Pause", options) : helperMissing.call(depth0, "__", "Pause", options)))
135
- + "\"></span></a>\r\n <a class=\"action reload\" data-control=\"start\">\r\n <span class=\"icon icon-play\" title=\""
136
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Start", options) : helperMissing.call(depth0, "__", "Start", options)))
137
- + "\"></span>\r\n <div class=\"message\">"
138
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Click to start", options) : helperMissing.call(depth0, "__", "Click to start", options)))
139
- + "</div>\r\n </a>\r\n <a class=\"action reload\" data-control=\"reload\">\r\n <div class=\"icon icon-reload\" title=\""
140
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Reload", options) : helperMissing.call(depth0, "__", "Reload", options)))
141
- + "\"></div>\r\n <div class=\"message\">"
142
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "You are encountering a prolonged connectivity loss.", options) : helperMissing.call(depth0, "__", "You are encountering a prolonged connectivity loss.", options)))
143
- + " "
144
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Click to reload.", options) : helperMissing.call(depth0, "__", "Click to reload.", options)))
145
- + "</div>\r\n </a>\r\n </div>\r\n </div>\r\n <div class=\"controls\">\r\n <div class=\"bar\">\r\n <div class=\"control actions playback\">\r\n <a class=\"action play\" data-control=\"play\" title=\""
146
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Play", options) : helperMissing.call(depth0, "__", "Play", options)))
147
- + "\"><span class=\"icon icon-play\"></span></a>\r\n <a class=\"action play\" data-control=\"pause\" title=\""
148
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Pause", options) : helperMissing.call(depth0, "__", "Pause", options)))
149
- + "\"><span class=\"icon icon-pause\"></span></a>\r\n </div>\r\n <div class=\"control seek\"><div class=\"slider\"></div></div>\r\n <div class=\"control infos timer\">\r\n <span class=\"info time\" data-control=\"time-cur\" title=\""
150
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Current playback position", options) : helperMissing.call(depth0, "__", "Current playback position", options)))
151
- + "\">--:--</span>\r\n <span class=\"info time\" data-control=\"time-end\" title=\""
152
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Total duration", options) : helperMissing.call(depth0, "__", "Total duration", options)))
153
- + "\">--:--</span>\r\n </div>\r\n <div class=\"control actions sound\">\r\n <div class=\"volume\"><div class=\"slider\"></div></div>\r\n <a class=\"action mute\" data-control=\"mute\" title=\""
154
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Mute", options) : helperMissing.call(depth0, "__", "Mute", options)))
155
- + "\"><span class=\"icon icon-sound\"></span></a>\r\n <a class=\"action mute\" data-control=\"unmute\" title=\""
156
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Restore sound", options) : helperMissing.call(depth0, "__", "Restore sound", options)))
157
- + "\"><span class=\"icon icon-mute\"></span></a>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"error\">\r\n <div class=\"message\">"
158
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "This media cannot be played!", options) : helperMissing.call(depth0, "__", "This media cannot be played!", options)))
159
- + "</div>\r\n </div>\r\n</div>\r\n";
160
- return buffer;
161
- });
162
- function playerTpl(data, options, asString) {
163
- var html = Template(data, options);
164
- return (asString || true) ? html : $(html);
165
- }
166
-
167
- /**
168
- * This program is free software; you can redistribute it and/or
169
- * modify it under the terms of the GNU General Public License
170
- * as published by the Free Software Foundation; under version 2
171
- * of the License (non-upgradable).
172
- *
173
- * This program is distributed in the hope that it will be useful,
174
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
175
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
176
- * GNU General Public License for more details.
177
- *
178
- * You should have received a copy of the GNU General Public License
179
- * along with this program; if not, write to the Free Software
180
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
181
- *
182
- * Copyright (c) 2015-2021 (original work) Open Assessment Technologies SA ;
183
- */
184
- /**
185
- * CSS namespace
186
- * @type {String}
187
- */
188
-
189
- var ns = '.mediaplayer';
190
- /**
191
- * Minimum value of the volume
192
- * @type {Number}
193
- */
194
-
195
- var volumeMin = 0;
196
- /**
197
- * Maximum value of the volume
198
- * @type {Number}
199
- */
200
-
201
- var volumeMax = 100;
202
- /**
203
- * Threshold (minimum required space above the player) to display the volume
204
- * above the bar.
205
- * @type {Number}
206
- */
207
-
208
- var volumePositionThreshold = 200;
209
- /**
210
- * Some default values
211
- * @type {Object}
212
- */
107
+ // register a "get property" helper
108
+ // it gets the named property from the provided context
109
+ hb.registerHelper('property', function (name, context) {
110
+ return context[name] || '';
111
+ });
213
112
 
214
- var defaults = {
215
- type: 'video/mp4',
216
- video: {
217
- width: '100%',
218
- height: 'auto'
219
- },
220
- audio: {
221
- width: '100%',
222
- height: 'auto'
223
- },
224
- youtube: {
225
- width: 640,
226
- height: 360
227
- },
228
- options: {
229
- volume: 80,
230
- startMuted: false,
231
- maxPlays: 0,
232
- replayTimeout: 0,
233
- canPause: true,
234
- canSeek: true,
235
- loop: false,
236
- autoStart: false,
237
- preview: true,
238
- debug: false
113
+ // register an 'includes' helper
114
+ // it checks if value is in array
115
+ hb.registerHelper('includes', function (haystack, needle, options) {
116
+ if (_.contains(haystack, needle)) {
117
+ return options.fn(this);
118
+ }
119
+ });
239
120
  }
240
- };
241
- /**
242
- * Ensures a value is a number
243
- * @param {Number|String} value
244
- * @returns {Number}
245
- */
246
-
247
- var ensureNumber = function ensureNumber(value) {
248
- var floatValue = parseFloat(value);
249
- return isFinite(floatValue) ? floatValue : 0;
250
- };
251
- /**
252
- * Format a number to string with leading zeros
253
- * @param {Number} n
254
- * @param {Number} len
255
- * @returns {String}
256
- */
257
121
 
258
-
259
- var leadingZero = function leadingZero(n, len) {
260
- var value = n.toString();
261
-
262
- while (value.length < len) {
263
- value = "0".concat(value);
122
+ if (!Helpers0.__initialized) {
123
+ Helpers0(Handlebars);
124
+ Helpers0.__initialized = true;
264
125
  }
265
-
266
- return value;
267
- };
268
- /**
269
- * Formats a time value to string
270
- * @param {Number} time
271
- * @returns {String}
272
- */
273
-
274
-
275
- var timerFormat = function timerFormat(time) {
276
- var seconds = Math.floor(time % 60);
277
- var minutes = Math.floor(time / 60) % 60;
278
- var hours = Math.floor(time / 3600);
279
- var parts = [];
280
-
281
- if (hours) {
282
- parts.push(hours);
126
+ var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
127
+ this.compilerInfo = [4,'>= 1.0.0'];
128
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
129
+ var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing;
130
+
131
+
132
+ buffer += "<div class=\"mediaplayer ";
133
+ if (helper = helpers.type) { stack1 = helper.call(depth0, {hash:{},data:data}); }
134
+ else { helper = (depth0 && depth0.type); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
135
+ buffer += escapeExpression(stack1)
136
+ + "\">\n <div class=\"player\">\n <div class=\"player-overlay\">\n <a class=\"action play\" data-control=\"play\"><span class=\"icon icon-play\" title=\""
137
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Play", options) : helperMissing.call(depth0, "__", "Play", options)))
138
+ + "\"></span></a>\n <a class=\"action play\" data-control=\"pause\"><span class=\"icon icon-pause\" title=\""
139
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Pause", options) : helperMissing.call(depth0, "__", "Pause", options)))
140
+ + "\"></span></a>\n <a class=\"action reload\" data-control=\"start\">\n <span class=\"icon icon-play\" title=\""
141
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Start", options) : helperMissing.call(depth0, "__", "Start", options)))
142
+ + "\"></span>\n <div class=\"message\">"
143
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Click to start", options) : helperMissing.call(depth0, "__", "Click to start", options)))
144
+ + "</div>\n </a>\n <a class=\"action reload\" data-control=\"reload\">\n <div class=\"icon icon-reload\" title=\""
145
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Reload", options) : helperMissing.call(depth0, "__", "Reload", options)))
146
+ + "\"></div>\n <div class=\"message\">"
147
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "You are encountering a prolonged connectivity loss.", options) : helperMissing.call(depth0, "__", "You are encountering a prolonged connectivity loss.", options)))
148
+ + " "
149
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Click to reload.", options) : helperMissing.call(depth0, "__", "Click to reload.", options)))
150
+ + "</div>\n </a>\n </div>\n </div>\n <div class=\"controls\">\n <div class=\"bar\">\n <div class=\"control actions playback\">\n <a class=\"action play\" data-control=\"play\" title=\""
151
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Play", options) : helperMissing.call(depth0, "__", "Play", options)))
152
+ + "\"><span class=\"icon icon-play\"></span></a>\n <a class=\"action play\" data-control=\"pause\" title=\""
153
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Pause", options) : helperMissing.call(depth0, "__", "Pause", options)))
154
+ + "\"><span class=\"icon icon-pause\"></span></a>\n </div>\n <div class=\"control seek\"><div class=\"slider\"></div></div>\n <div class=\"control infos timer\">\n <span class=\"info time\" data-control=\"time-cur\" title=\""
155
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Current playback position", options) : helperMissing.call(depth0, "__", "Current playback position", options)))
156
+ + "\">--:--</span>\n <span class=\"info time\" data-control=\"time-end\" title=\""
157
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Total duration", options) : helperMissing.call(depth0, "__", "Total duration", options)))
158
+ + "\">--:--</span>\n </div>\n <div class=\"control actions sound\">\n <div class=\"volume\"><div class=\"slider\"></div></div>\n <a class=\"action mute\" data-control=\"mute\" title=\""
159
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Mute", options) : helperMissing.call(depth0, "__", "Mute", options)))
160
+ + "\"><span class=\"icon icon-sound\"></span></a>\n <a class=\"action mute\" data-control=\"unmute\" title=\""
161
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Restore sound", options) : helperMissing.call(depth0, "__", "Restore sound", options)))
162
+ + "\"><span class=\"icon icon-mute\"></span></a>\n </div>\n </div>\n </div>\n <div class=\"error\">\n <div class=\"message\">"
163
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "This media cannot be played!", options) : helperMissing.call(depth0, "__", "This media cannot be played!", options)))
164
+ + "</div>\n </div>\n</div>\n";
165
+ return buffer;
166
+ });
167
+ function playerTpl(data, options, asString) {
168
+ var html = Template(data, options);
169
+ return (asString || true) ? html : $(html);
283
170
  }
284
171
 
285
- parts.push(leadingZero(minutes, 2));
286
- parts.push(leadingZero(seconds, 2));
287
- return parts.join(':');
288
- };
289
- /**
290
- * Checks if a type needs to be adjusted
291
- * @param {String} type
292
- * @returns {Boolean}
293
- */
294
-
295
-
296
- var needTypeAdjust = function needTypeAdjust(type) {
297
- return 'string' === typeof type && type.indexOf('application') === 0;
298
- };
299
- /**
300
- * Adjust bad type by apllying heuristic on URI
301
- * @param {Object|String} source
302
- * @returns {String}
303
- */
304
-
305
-
306
- var getAdjustedType = function getAdjustedType(source) {
307
- var type = 'video/ogg';
308
- var url = source && source.src || source;
309
- var ext = url && url.substr(-4);
310
-
311
- if (ext === '.ogg' || ext === '.oga') {
312
- type = 'audio/ogg';
313
- }
172
+ /**
173
+ * This program is free software; you can redistribute it and/or
174
+ * modify it under the terms of the GNU General Public License
175
+ * as published by the Free Software Foundation; under version 2
176
+ * of the License (non-upgradable).
177
+ *
178
+ * This program is distributed in the hope that it will be useful,
179
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
180
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
181
+ * GNU General Public License for more details.
182
+ *
183
+ * You should have received a copy of the GNU General Public License
184
+ * along with this program; if not, write to the Free Software
185
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
186
+ *
187
+ * Copyright (c) 2015-2021 (original work) Open Assessment Technologies SA ;
188
+ */
314
189
 
315
- return type;
316
- };
317
- /**
318
- * Extract a list of media sources from a config object
319
- * @param {Object} config
320
- * @returns {Array}
321
- */
190
+ /**
191
+ * CSS namespace
192
+ * @type {String}
193
+ */
194
+ const ns = '.mediaplayer';
322
195
 
196
+ /**
197
+ * Minimum value of the volume
198
+ * @type {Number}
199
+ */
200
+ const volumeMin = 0;
323
201
 
324
- var configToSources = function configToSources(config) {
325
- var sources = config.sources || [];
326
- var url = config.url;
202
+ /**
203
+ * Maximum value of the volume
204
+ * @type {Number}
205
+ */
206
+ const volumeMax = 100;
327
207
 
328
- if (!_.isArray(sources)) {
329
- sources = [sources];
330
- }
208
+ /**
209
+ * Threshold (minimum required space above the player) to display the volume
210
+ * above the bar.
211
+ * @type {Number}
212
+ */
213
+ const volumePositionThreshold = 200;
331
214
 
332
- if (url) {
333
- if (!_.isArray(config.url)) {
334
- url = [url];
215
+ /**
216
+ * Some default values
217
+ * @type {Object}
218
+ */
219
+ const defaults = {
220
+ type: 'video/mp4',
221
+ video: {
222
+ width: '100%',
223
+ height: 'auto'
224
+ },
225
+ audio: {
226
+ width: '100%',
227
+ height: 'auto'
228
+ },
229
+ youtube: {
230
+ width: 640,
231
+ height: 360
232
+ },
233
+ options: {
234
+ volume: 80,
235
+ startMuted: false,
236
+ maxPlays: 0,
237
+ replayTimeout: 0,
238
+ canPause: true,
239
+ canSeek: true,
240
+ loop: false,
241
+ autoStart: false,
242
+ preview: true,
243
+ debug: false
335
244
  }
245
+ };
336
246
 
337
- sources = sources.concat(url);
338
- }
339
-
340
- return sources;
341
- };
342
- /**
343
- * Checks if the browser can play media
344
- * @param {String} sizeProps Width or Height
345
- * @returns {Boolean}
346
- */
347
-
348
-
349
- var isResponsiveSize = function isResponsiveSize(sizeProps) {
350
- return /%/.test(sizeProps) || sizeProps === 'auto';
351
- };
352
- /**
353
- * Builds a media player instance
354
- * @param {Object} config
355
- * @param {String} config.type - The type of media to play, say `audio`, `video`, or `youtube`. The default is `video`.
356
- * It might also contain the MIME type of the media as a shorthand.
357
- * @param {String|Array} [config.url] - The URL to the media. If several media are proposed as alternatives,
358
- * please look at the `sources` option instead.
359
- * @param {String} [config.mimeType] - The MIME type of the media. If omitted, the player will try to extract it
360
- * from the `type` property, otherwise it will request the server to get the content-type.
361
- * @param {Array} [config.sources] - A list of URL if several media can be proposed. Each entry may be either a
362
- * string (single URL), or an object containing both the URL and the MIME type ({src: string, type: string}).
363
- * @param {String|jQuery|HTMLElement} [config.renderTo] - An optional container in which renders the player
364
- * @param {Boolean} [config.canSeek] - The player allows to reach an arbitrary position within the media using the duration bar
365
- * @param {Boolean} [config.loop] - The media will be played continuously
366
- * @param {Boolean} [config.canPause] - The player can be paused
367
- * @param {Boolean} [config.startMuted] - The player should be initially muted
368
- * @param {Boolean} [config.autoStart] - The player starts as soon as it is displayed
369
- * @param {Number} [config.autoStartAt] - The time position at which the player should start
370
- * @param {Number} [config.maxPlays] - Sets a few number of plays (default: infinite)
371
- * @param {Number} [config.replayTimeout] - disable the possibility to replay a media after this timeout, in seconds (default: 0)
372
- * @param {Number} [config.volume] - Sets the sound volume (default: 80)
373
- * @param {Number} [config.width] - Sets the width of the player (default: depends on media type)
374
- * @param {Number} [config.height] - Sets the height of the player (default: depends on media type)
375
- * @param {Boolean} [config.preview] - Enables the media preview (load media metadata)
376
- * @param {Boolean} [config.debug] - Enables the debug mode
377
- * @param {number} [config.config.stalledDetectionDelay] - The delay before considering a media is stalled
378
- * @event render - Event triggered when the player is rendering
379
- * @event error - Event triggered when the player throws an unrecoverable error
380
- * @event ready - Event triggered when the player is fully ready
381
- * @event play - Event triggered when the playback is starting
382
- * @event update - Event triggered while the player is playing
383
- * @event pause - Event triggered when the playback is paused
384
- * @event ended - Event triggered when the playback is ended
385
- * @event limitreached - Event triggered when the play limit has been reached
386
- * @event destroy - Event triggered when the player is destroying
387
- * @returns {mediaplayer}
388
- */
247
+ /**
248
+ * Ensures a value is a number
249
+ * @param {Number|String} value
250
+ * @returns {Number}
251
+ */
252
+ const ensureNumber = value => {
253
+ const floatValue = parseFloat(value);
254
+ return isFinite(floatValue) ? floatValue : 0;
255
+ };
389
256
 
257
+ /**
258
+ * Format a number to string with leading zeros
259
+ * @param {Number} n
260
+ * @param {Number} len
261
+ * @returns {String}
262
+ */
263
+ const leadingZero = (n, len) => {
264
+ let value = n.toString();
265
+ while (value.length < len) {
266
+ value = `0${value}`;
267
+ }
268
+ return value;
269
+ };
390
270
 
391
- function mediaplayerFactory(config) {
392
- /**
393
- * Defines a media player object
394
- * @type {Object}
271
+ /**
272
+ * Formats a time value to string
273
+ * @param {Number} time
274
+ * @returns {String}
395
275
  */
396
- var mediaplayer = {
397
- /**
398
- * Initializes the media player
399
- * @param {Object} config
400
- * @returns {mediaplayer}
401
- */
402
- init: function init(config) {
403
- var _this = this;
276
+ const timerFormat = time => {
277
+ const seconds = Math.floor(time % 60);
278
+ const minutes = Math.floor(time / 60) % 60;
279
+ const hours = Math.floor(time / 3600);
280
+ const parts = [];
281
+ if (hours) {
282
+ parts.push(hours);
283
+ }
284
+ parts.push(leadingZero(minutes, 2));
285
+ parts.push(leadingZero(seconds, 2));
286
+ return parts.join(':');
287
+ };
404
288
 
405
- // load the config set, discard null values in order to allow defaults to be set
406
- this.config = _.omit(config || {}, function (value) {
407
- return typeof value === 'undefined' || value === null;
408
- });
289
+ /**
290
+ * Checks if a type needs to be adjusted
291
+ * @param {String} type
292
+ * @returns {Boolean}
293
+ */
294
+ const needTypeAdjust = type => {
295
+ return 'string' === typeof type && type.indexOf('application') === 0;
296
+ };
409
297
 
410
- _.defaults(this.config, defaults.options);
298
+ /**
299
+ * Adjust bad type by apllying heuristic on URI
300
+ * @param {Object|String} source
301
+ * @returns {String}
302
+ */
303
+ const getAdjustedType = source => {
304
+ let type = 'video/ogg';
305
+ const url = source && source.src || source;
306
+ const ext = url && url.substr(-4);
307
+ if (ext === '.ogg' || ext === '.oga') {
308
+ type = 'audio/ogg';
309
+ }
310
+ return type;
311
+ };
411
312
 
412
- if (!this.config.mimeType && 'string' === typeof this.config.type && this.config.type.indexOf('/') > 0) {
413
- this.config.mimeType = this.config.type;
313
+ /**
314
+ * Extract a list of media sources from a config object
315
+ * @param {Object} config
316
+ * @returns {Array}
317
+ */
318
+ const configToSources = config => {
319
+ let sources = config.sources || [];
320
+ let url = config.url;
321
+ if (!_.isArray(sources)) {
322
+ sources = [sources];
323
+ }
324
+ if (url) {
325
+ if (!_.isArray(config.url)) {
326
+ url = [url];
414
327
  }
328
+ sources = sources.concat(url);
329
+ }
330
+ return sources;
331
+ };
415
332
 
416
- this._setType(this.config.type || defaults.type);
417
-
418
- this._reset();
419
-
420
- this._updateVolumeFromStore();
421
-
422
- this._initEvents();
423
-
424
- this._initSources(function () {
425
- if (!_this.is('youtube')) {
426
- _.forEach(_this.config.sources, function (source) {
427
- if (source && source.type && source.type.indexOf('audio') === 0) {
428
- _this._setType(source.type);
429
-
430
- _this._initType();
333
+ /**
334
+ * Checks if the browser can play media
335
+ * @param {String} sizeProps Width or Height
336
+ * @returns {Boolean}
337
+ */
338
+ const isResponsiveSize = sizeProps => {
339
+ return /%/.test(sizeProps) || sizeProps === 'auto';
340
+ };
431
341
 
432
- return false;
433
- }
434
- });
342
+ /**
343
+ * Builds a media player instance
344
+ * @param {Object} config
345
+ * @param {String} config.type - The type of media to play, say `audio`, `video`, or `youtube`. The default is `video`.
346
+ * It might also contain the MIME type of the media as a shorthand.
347
+ * @param {String|Array} [config.url] - The URL to the media. If several media are proposed as alternatives,
348
+ * please look at the `sources` option instead.
349
+ * @param {String} [config.mimeType] - The MIME type of the media. If omitted, the player will try to extract it
350
+ * from the `type` property, otherwise it will request the server to get the content-type.
351
+ * @param {Array} [config.sources] - A list of URL if several media can be proposed. Each entry may be either a
352
+ * string (single URL), or an object containing both the URL and the MIME type ({src: string, type: string}).
353
+ * @param {String|jQuery|HTMLElement} [config.renderTo] - An optional container in which renders the player
354
+ * @param {Boolean} [config.canSeek] - The player allows to reach an arbitrary position within the media using the duration bar
355
+ * @param {Boolean} [config.loop] - The media will be played continuously
356
+ * @param {Boolean} [config.canPause] - The player can be paused
357
+ * @param {Boolean} [config.startMuted] - The player should be initially muted
358
+ * @param {Boolean} [config.autoStart] - The player starts as soon as it is displayed
359
+ * @param {Number} [config.autoStartAt] - The time position at which the player should start
360
+ * @param {Number} [config.maxPlays] - Sets a few number of plays (default: infinite)
361
+ * @param {Number} [config.replayTimeout] - disable the possibility to replay a media after this timeout, in seconds (default: 0)
362
+ * @param {Number} [config.volume] - Sets the sound volume (default: 80)
363
+ * @param {Number} [config.width] - Sets the width of the player (default: depends on media type)
364
+ * @param {Number} [config.height] - Sets the height of the player (default: depends on media type)
365
+ * @param {Boolean} [config.preview] - Enables the media preview (load media metadata)
366
+ * @param {Boolean} [config.debug] - Enables the debug mode
367
+ * @param {number} [config.config.stalledDetectionDelay] - The delay before considering a media is stalled
368
+ * @event render - Event triggered when the player is rendering
369
+ * @event error - Event triggered when the player throws an unrecoverable error
370
+ * @event ready - Event triggered when the player is fully ready
371
+ * @event play - Event triggered when the playback is starting
372
+ * @event update - Event triggered while the player is playing
373
+ * @event pause - Event triggered when the playback is paused
374
+ * @event ended - Event triggered when the playback is ended
375
+ * @event limitreached - Event triggered when the play limit has been reached
376
+ * @event destroy - Event triggered when the player is destroying
377
+ * @returns {mediaplayer}
378
+ */
379
+ function mediaplayerFactory(config) {
380
+ /**
381
+ * Defines a media player object
382
+ * @type {Object}
383
+ */
384
+ const mediaplayer = {
385
+ /**
386
+ * Initializes the media player
387
+ * @param {Object} config
388
+ * @returns {mediaplayer}
389
+ */
390
+ init(config) {
391
+ // load the config set, discard null values in order to allow defaults to be set
392
+ this.config = _.omit(config || {}, value => typeof value === 'undefined' || value === null);
393
+ _.defaults(this.config, defaults.options);
394
+ if (!this.config.mimeType && 'string' === typeof this.config.type && this.config.type.indexOf('/') > 0) {
395
+ this.config.mimeType = this.config.type;
435
396
  }
436
-
437
- if (_this.config.renderTo) {
438
- _.defer(function () {
439
- return _this.render();
440
- });
397
+ this._setType(this.config.type || defaults.type);
398
+ this._reset();
399
+ this._updateVolumeFromStore();
400
+ this._initEvents();
401
+ this._initSources(() => {
402
+ if (!this.is('youtube')) {
403
+ _.forEach(this.config.sources, source => {
404
+ if (source && source.type && source.type.indexOf('audio') === 0) {
405
+ this._setType(source.type);
406
+ this._initType();
407
+ return false;
408
+ }
409
+ });
410
+ }
411
+ if (this.config.renderTo) {
412
+ _.defer(() => this.render());
413
+ }
414
+ });
415
+ return this;
416
+ },
417
+ /**
418
+ * Uninstalls the media player
419
+ * @returns {mediaplayer}
420
+ */
421
+ destroy() {
422
+ /**
423
+ * Triggers a destroy event
424
+ * @event mediaplayer#destroy
425
+ */
426
+ this.trigger('destroy');
427
+ if (this.player) {
428
+ this.player.destroy();
441
429
  }
442
- });
443
-
444
- return this;
445
- },
446
-
447
- /**
448
- * Uninstalls the media player
449
- * @returns {mediaplayer}
450
- */
451
- destroy: function destroy() {
452
- /**
453
- * Triggers a destroy event
454
- * @event mediaplayer#destroy
430
+ if (this.$component) {
431
+ this._unbindEvents();
432
+ this._destroySlider(this.$seekSlider);
433
+ this._destroySlider(this.$volumeSlider);
434
+ this.$component.remove();
435
+ }
436
+ this._reset();
437
+ return this;
438
+ },
439
+ /**
440
+ * Renders the media player according to the media type
441
+ * @param {String|jQuery|HTMLElement} [to]
442
+ * @returns {mediaplayer}
455
443
  */
456
- this.trigger('destroy');
457
-
458
- if (this.player) {
459
- this.player.destroy();
460
- }
461
-
462
- if (this.$component) {
463
- this._unbindEvents();
464
-
465
- this._destroySlider(this.$seekSlider);
466
-
467
- this._destroySlider(this.$volumeSlider);
468
-
469
- this.$component.remove();
470
- }
471
-
472
- this._reset();
473
-
474
- return this;
475
- },
476
-
477
- /**
478
- * Renders the media player according to the media type
479
- * @param {String|jQuery|HTMLElement} [to]
480
- * @returns {mediaplayer}
481
- */
482
- render: function render(to) {
483
- var renderTo = to || this.config.renderTo || this.$container;
484
-
485
- if (this.$component) {
486
- this.destroy();
487
- }
488
-
489
- this._initState();
490
-
491
- this._buildDom();
492
-
493
- if (this.config.preview) {
494
- this._updateDuration(0);
495
-
496
- this._updatePosition(0);
497
- }
498
-
499
- this._bindEvents();
500
-
501
- this._playingState(false, true);
502
-
503
- this._initPlayer();
504
-
505
- this._initSize(); // Resize for old items with defined height to avoid big jump
506
-
507
-
508
- if (this.config.height && this.config.height !== 'auto') {
509
- this.resize('100%', 'auto');
510
- } else {
511
- this.resize(this.config.width, this.config.height);
512
- }
513
-
514
- this.config.is.rendered = true;
515
-
516
- if (renderTo) {
517
- this.$container = $$1(renderTo).append(this.$component);
518
- } // add class if it is stalled
444
+ render(to) {
445
+ const renderTo = to || this.config.renderTo || this.$container;
446
+ if (this.$component) {
447
+ this.destroy();
448
+ }
449
+ this._initState();
450
+ this._buildDom();
451
+ if (this.config.preview) {
452
+ this._updateDuration(0);
453
+ this._updatePosition(0);
454
+ }
455
+ this._bindEvents();
456
+ this._playingState(false, true);
457
+ this._initPlayer();
458
+ this._initSize();
459
+
460
+ // Resize for old items with defined height to avoid big jump
461
+ if (this.config.height && this.config.height !== 'auto') {
462
+ this.resize('100%', 'auto');
463
+ } else {
464
+ this.resize(this.config.width, this.config.height);
465
+ }
466
+ this.config.is.rendered = true;
467
+ if (renderTo) {
468
+ this.$container = $$1(renderTo).append(this.$component);
469
+ }
519
470
 
471
+ // add class if it is stalled
472
+ if (this.is('stalled')) {
473
+ this._setState('stalled', true);
474
+ }
520
475
 
521
- if (this.is('stalled')) {
522
- this._setState('stalled', true);
523
- }
524
- /**
525
- * Triggers a render event
526
- * @event mediaplayer#render
527
- * @param {jQuery} $component
476
+ /**
477
+ * Triggers a render event
478
+ * @event mediaplayer#render
479
+ * @param {jQuery} $component
480
+ */
481
+ this.trigger('render', this.$component);
482
+ return this;
483
+ },
484
+ /**
485
+ * Reloads media player after it was stalled
528
486
  */
529
-
530
-
531
- this.trigger('render', this.$component);
532
- return this;
533
- },
534
-
535
- /**
536
- * Reloads media player after it was stalled
537
- */
538
- reload: function reload() {
539
- /**
540
- * Triggers a reload event
541
- * @event mediaplayer#reload
487
+ reload() {
488
+ /**
489
+ * Triggers a reload event
490
+ * @event mediaplayer#reload
491
+ */
492
+ this.trigger('reload');
493
+ if (this.player) {
494
+ this.player.recover();
495
+ }
496
+ this._setState('stalled', false);
497
+ this.setInitialStates();
498
+ },
499
+ /**
500
+ * Set initial states
542
501
  */
543
- this.trigger('reload');
544
-
545
- if (this.player) {
546
- this.player.recover();
547
- }
548
-
549
- this._setState('stalled', false);
550
-
551
- this.setInitialStates();
552
- },
553
-
554
- /**
555
- * Set initial states
556
- */
557
- setInitialStates: function setInitialStates() {
558
- if (!this.is('stalled')) {
559
- this._setState('ready', true);
560
- }
561
-
562
- this._setState('canplay', true);
563
-
564
- this._setState('canpause', this.config.canPause);
565
-
566
- this._setState('canseek', this.config.canSeek);
567
-
568
- this._setState('loading', false);
569
- },
570
-
571
- /**
572
- * Sets the start position inside the media
573
- * @param {Number} time - The start position in seconds
574
- * @param {*} [internal] - Internal use
575
- * @returns {mediaplayer}
576
- */
577
- seek: function seek(time, internal) {
578
- if (this._canPlay()) {
579
- this._updatePosition(time, internal);
580
-
581
- this.execute('seek', this.position);
582
-
583
- if (!this.is('ready')) {
584
- this.autoStartAt = this.position;
502
+ setInitialStates() {
503
+ if (!this.is('stalled')) {
504
+ this._setState('ready', true);
585
505
  }
586
-
587
- this.loop = !!this.config.loop;
588
- }
589
-
590
- return this;
591
- },
592
-
593
- /**
594
- * Plays the media
595
- * @param {Number} [time] - An optional start position in seconds
596
- * @returns {mediaplayer}
597
- */
598
- play: function play(time) {
599
- if (this._canPlay()) {
600
- if (typeof time !== 'undefined') {
601
- this.seek(time);
506
+ this._setState('canplay', true);
507
+ this._setState('canpause', this.config.canPause);
508
+ this._setState('canseek', this.config.canSeek);
509
+ this._setState('loading', false);
510
+ },
511
+ /**
512
+ * Sets the start position inside the media
513
+ * @param {Number} time - The start position in seconds
514
+ * @param {*} [internal] - Internal use
515
+ * @returns {mediaplayer}
516
+ */
517
+ seek(time, internal) {
518
+ if (this._canPlay()) {
519
+ this._updatePosition(time, internal);
520
+ this.execute('seek', this.position);
521
+ if (!this.is('ready')) {
522
+ this.autoStartAt = this.position;
523
+ }
524
+ this.loop = !!this.config.loop;
602
525
  }
603
-
604
- this.execute('play');
605
-
606
- if (!this.is('ready')) {
607
- this.autoStart = true;
526
+ return this;
527
+ },
528
+ /**
529
+ * Plays the media
530
+ * @param {Number} [time] - An optional start position in seconds
531
+ * @returns {mediaplayer}
532
+ */
533
+ play(time) {
534
+ if (this._canPlay()) {
535
+ if (typeof time !== 'undefined') {
536
+ this.seek(time);
537
+ }
538
+ this.execute('play');
539
+ if (!this.is('ready')) {
540
+ this.autoStart = true;
541
+ }
542
+ this.loop = !!this.config.loop;
543
+ if (this.timerId) {
544
+ cancelAnimationFrame(this.timerId);
545
+ }
608
546
  }
609
-
610
- this.loop = !!this.config.loop;
611
-
612
- if (this.timerId) {
613
- cancelAnimationFrame(this.timerId);
547
+ return this;
548
+ },
549
+ /**
550
+ * Pauses the media
551
+ * @param {Number} [time] - An optional time position in seconds
552
+ * @returns {mediaplayer}
553
+ */
554
+ pause(time) {
555
+ if (this._canPause()) {
556
+ if (typeof time !== 'undefined') {
557
+ this.seek(time);
558
+ }
559
+ this.execute('pause');
560
+ if (!this.is('ready')) {
561
+ this.autoStart = false;
562
+ }
614
563
  }
615
- }
616
-
617
- return this;
618
- },
619
-
620
- /**
621
- * Pauses the media
622
- * @param {Number} [time] - An optional time position in seconds
623
- * @returns {mediaplayer}
624
- */
625
- pause: function pause(time) {
626
- if (this._canPause()) {
627
- if (typeof time !== 'undefined') {
628
- this.seek(time);
564
+ return this;
565
+ },
566
+ /**
567
+ * Resumes the media
568
+ * @returns {mediaplayer}
569
+ */
570
+ resume() {
571
+ if (this._canResume()) {
572
+ this.play();
629
573
  }
630
-
631
- this.execute('pause');
632
-
574
+ return this;
575
+ },
576
+ /**
577
+ * Stops the playback
578
+ * @returns {mediaplayer}
579
+ */
580
+ stop() {
581
+ this.loop = false;
582
+ this.execute('stop');
633
583
  if (!this.is('ready')) {
634
584
  this.autoStart = false;
635
585
  }
636
- }
637
-
638
- return this;
639
- },
640
-
641
- /**
642
- * Resumes the media
643
- * @returns {mediaplayer}
644
- */
645
- resume: function resume() {
646
- if (this._canResume()) {
586
+ return this;
587
+ },
588
+ /**
589
+ * Starts the media
590
+ * @returns {mediaplayer}
591
+ */
592
+ start() {
593
+ this._setState('preview', true);
594
+ this._setState('loading', true);
647
595
  this.play();
648
- }
649
-
650
- return this;
651
- },
652
-
653
- /**
654
- * Stops the playback
655
- * @returns {mediaplayer}
656
- */
657
- stop: function stop() {
658
- this.loop = false;
659
- this.execute('stop');
660
-
661
- if (!this.is('ready')) {
662
- this.autoStart = false;
663
- }
664
-
665
- return this;
666
- },
667
-
668
- /**
669
- * Starts the media
670
- * @returns {mediaplayer}
671
- */
672
- start: function start() {
673
- this._setState('preview', true);
674
-
675
- this._setState('loading', true);
676
-
677
- this.play();
678
- },
679
-
680
- /**
681
- * Restarts the media from the beginning
682
- * @returns {mediaplayer}
683
- */
684
- restart: function restart() {
685
- this.play(0);
686
- return this;
687
- },
688
-
689
- /**
690
- * Rewind the media to the beginning
691
- * @returns {mediaplayer}
692
- */
693
- rewind: function rewind() {
694
- this.seek(0);
695
- return this;
696
- },
697
-
698
- /**
699
- * Mutes the media
700
- * @param {Boolean} [state] - A flag to set the mute state (default: true)
701
- * @returns {mediaplayer}
702
- */
703
- mute: function mute(state) {
704
- if (typeof state === 'undefined') {
705
- state = true;
706
- }
707
-
708
- this.execute('mute', state);
709
-
710
- this._setState('muted', state);
711
-
712
- if (!this.is('ready')) {
713
- this.startMuted = state;
714
- }
715
-
716
- return this;
717
- },
718
-
719
- /**
720
- * Restore the sound of the media after a mute
721
- * @returns {mediaplayer}
722
- */
723
- unmute: function unmute() {
724
- this.mute(false);
725
- return this;
726
- },
727
-
728
- /**
729
- * Sets the sound volume of the media being played
730
- * @param {Number} value - A value between 0 and 100
731
- * @param {*} [internal] - Internal use
732
- * @returns {mediaplayer}
733
- */
734
- setVolume: function setVolume(value, internal) {
735
- this._updateVolume(value, internal);
736
-
737
- this.execute('setVolume', this.volume);
738
- return this;
739
- },
740
-
741
- /**
742
- * Gets the sound volume applied to the media being played
743
- * @returns {Number} Returns a value between 0 and 100
744
- */
745
- getVolume: function getVolume() {
746
- return this.volume;
747
- },
748
-
749
- /**
750
- * Gets the current displayed position inside the media
751
- * @returns {Number}
752
- */
753
- getPosition: function getPosition() {
754
- return this.position;
755
- },
756
-
757
- /**
758
- * Gets the duration of the media
759
- * @returns {Number}
760
- */
761
- getDuration: function getDuration() {
762
- return this.duration;
763
- },
764
-
765
- /**
766
- * Gets the number of times the media has been played
767
- * @returns {Number}
768
- */
769
- getTimesPlayed: function getTimesPlayed() {
770
- return this.timesPlayed;
771
- },
772
-
773
- /**
774
- * Gets the type of player
775
- * @returns {String}
776
- */
777
- getType: function getType() {
778
- return this.type;
779
- },
780
-
781
- /**
782
- * Gets the DOM container
783
- * @returns {jQuery}
784
- */
785
- getContainer: function getContainer() {
786
- if (!this.$container && this.$component) {
787
- var $container = this.$component.parent();
788
-
789
- if ($container.length) {
790
- this.$container = $container;
596
+ },
597
+ /**
598
+ * Restarts the media from the beginning
599
+ * @returns {mediaplayer}
600
+ */
601
+ restart() {
602
+ this.play(0);
603
+ return this;
604
+ },
605
+ /**
606
+ * Rewind the media to the beginning
607
+ * @returns {mediaplayer}
608
+ */
609
+ rewind() {
610
+ this.seek(0);
611
+ return this;
612
+ },
613
+ /**
614
+ * Mutes the media
615
+ * @param {Boolean} [state] - A flag to set the mute state (default: true)
616
+ * @returns {mediaplayer}
617
+ */
618
+ mute(state) {
619
+ if (typeof state === 'undefined') {
620
+ state = true;
791
621
  }
792
- }
793
-
794
- return this.$container;
795
- },
796
-
797
- /**
798
- * Gets the underlying DOM element
799
- * @returns {jQuery}
800
- */
801
- getElement: function getElement() {
802
- return this.$component;
803
- },
804
-
805
- /**
806
- * Gets the list of media
807
- * @returns {Array}
808
- */
809
- getSources: function getSources() {
810
- return this.config.sources.slice();
811
- },
812
-
813
- /**
814
- * Sets the media source. If a source has been already set, it will be replaced.
815
- * @param {String|Object} src - The media URL, or an object containing the source and the type
816
- * @param {Function} [callback] - A function called to provide the added media source object
817
- * @returns {mediaplayer}
818
- */
819
- setSource: function setSource(src, callback) {
820
- var _this2 = this;
821
-
822
- this._getSource(src, function (source) {
823
- _this2.config.sources = [source];
824
-
825
- if (_this2.is('rendered')) {
826
- _this2.player.setMedia(source.src, source.type);
622
+ this.execute('mute', state);
623
+ this._setState('muted', state);
624
+ if (!this.is('ready')) {
625
+ this.startMuted = state;
827
626
  }
828
-
829
- if (callback) {
830
- callback.call(_this2, source);
627
+ return this;
628
+ },
629
+ /**
630
+ * Restore the sound of the media after a mute
631
+ * @returns {mediaplayer}
632
+ */
633
+ unmute() {
634
+ this.mute(false);
635
+ return this;
636
+ },
637
+ /**
638
+ * Sets the sound volume of the media being played
639
+ * @param {Number} value - A value between 0 and 100
640
+ * @param {*} [internal] - Internal use
641
+ * @returns {mediaplayer}
642
+ */
643
+ setVolume(value, internal) {
644
+ this._updateVolume(value, internal);
645
+ this.execute('setVolume', this.volume);
646
+ return this;
647
+ },
648
+ /**
649
+ * Gets the sound volume applied to the media being played
650
+ * @returns {Number} Returns a value between 0 and 100
651
+ */
652
+ getVolume() {
653
+ return this.volume;
654
+ },
655
+ /**
656
+ * Gets the current displayed position inside the media
657
+ * @returns {Number}
658
+ */
659
+ getPosition() {
660
+ return this.position;
661
+ },
662
+ /**
663
+ * Gets the duration of the media
664
+ * @returns {Number}
665
+ */
666
+ getDuration() {
667
+ return this.duration;
668
+ },
669
+ /**
670
+ * Gets the number of times the media has been played
671
+ * @returns {Number}
672
+ */
673
+ getTimesPlayed() {
674
+ return this.timesPlayed;
675
+ },
676
+ /**
677
+ * Gets the type of player
678
+ * @returns {String}
679
+ */
680
+ getType() {
681
+ return this.type;
682
+ },
683
+ /**
684
+ * Gets the DOM container
685
+ * @returns {jQuery}
686
+ */
687
+ getContainer() {
688
+ if (!this.$container && this.$component) {
689
+ let $container = this.$component.parent();
690
+ if ($container.length) {
691
+ this.$container = $container;
692
+ }
831
693
  }
832
- });
833
-
834
- return this;
835
- },
836
-
837
- /**
838
- * Adds a media source.
839
- * @param {String|Object} src - The media URL, or an object containing the source and the type
840
- * @param {Function} [callback] - A function called to provide the added media source object
841
- * @returns {mediaplayer}
842
- */
843
- addSource: function addSource(src, callback) {
844
- var _this3 = this;
845
-
846
- this._getSource(src, function (source) {
847
- _this3.config.sources.push(source);
848
-
849
- if (_this3.is('rendered')) {
850
- _this3.player.addMedia(source.src, source.type);
694
+ return this.$container;
695
+ },
696
+ /**
697
+ * Gets the underlying DOM element
698
+ * @returns {jQuery}
699
+ */
700
+ getElement() {
701
+ return this.$component;
702
+ },
703
+ /**
704
+ * Gets the list of media
705
+ * @returns {Array}
706
+ */
707
+ getSources() {
708
+ return this.config.sources.slice();
709
+ },
710
+ /**
711
+ * Sets the media source. If a source has been already set, it will be replaced.
712
+ * @param {String|Object} src - The media URL, or an object containing the source and the type
713
+ * @param {Function} [callback] - A function called to provide the added media source object
714
+ * @returns {mediaplayer}
715
+ */
716
+ setSource(src, callback) {
717
+ this._getSource(src, source => {
718
+ this.config.sources = [source];
719
+ if (this.is('rendered')) {
720
+ this.player.setMedia(source.src, source.type);
721
+ }
722
+ if (callback) {
723
+ callback.call(this, source);
724
+ }
725
+ });
726
+ return this;
727
+ },
728
+ /**
729
+ * Adds a media source.
730
+ * @param {String|Object} src - The media URL, or an object containing the source and the type
731
+ * @param {Function} [callback] - A function called to provide the added media source object
732
+ * @returns {mediaplayer}
733
+ */
734
+ addSource(src, callback) {
735
+ this._getSource(src, source => {
736
+ this.config.sources.push(source);
737
+ if (this.is('rendered')) {
738
+ this.player.addMedia(source.src, source.type);
739
+ }
740
+ if (callback) {
741
+ callback.call(this, source);
742
+ }
743
+ });
744
+ return this;
745
+ },
746
+ /**
747
+ * Tells if the media is in a particular state
748
+ * @param {String} state
749
+ * @returns {Boolean}
750
+ */
751
+ is(state) {
752
+ return !!this.config.is[state];
753
+ },
754
+ /**
755
+ * Changes the size of the player
756
+ * @param {Number} width
757
+ * @param {Number} height
758
+ * @returns {mediaplayer}
759
+ */
760
+ resize(width, height) {
761
+ if (isResponsiveSize(width) && !isResponsiveSize(height) || this.is('youtube')) {
762
+ // responsive width height should be auto
763
+ // for youtube iframe height is limited by ration
764
+ height = 'auto';
851
765
  }
852
-
853
- if (callback) {
854
- callback.call(_this3, source);
766
+ this.execute('setSize', width, height);
767
+ return this;
768
+ },
769
+ /**
770
+ * Enables the media player
771
+ * @returns {mediaplayer}
772
+ */
773
+ enable() {
774
+ this._fromState('disabled');
775
+ return this;
776
+ },
777
+ /**
778
+ * Disables the media player
779
+ * @returns {mediaplayer}
780
+ */
781
+ disable() {
782
+ this._toState('disabled');
783
+ this.trigger('disabled');
784
+ return this;
785
+ },
786
+ /**
787
+ * Shows the media player
788
+ * @returns {mediaplayer}
789
+ */
790
+ show() {
791
+ this._fromState('hidden');
792
+ return this;
793
+ },
794
+ /**
795
+ * hides the media player
796
+ * @returns {mediaplayer}
797
+ */
798
+ hide() {
799
+ this._toState('hidden');
800
+ return this;
801
+ },
802
+ /**
803
+ * get media original size
804
+ * @returns {Object}
805
+ */
806
+ getMediaOriginalSize() {
807
+ if (this.is('youtube')) {
808
+ return defaults.youtube;
855
809
  }
856
- });
857
-
858
- return this;
859
- },
860
-
861
- /**
862
- * Tells if the media is in a particular state
863
- * @param {String} state
864
- * @returns {Boolean}
865
- */
866
- is: function is(state) {
867
- return !!this.config.is[state];
868
- },
869
-
870
- /**
871
- * Changes the size of the player
872
- * @param {Number} width
873
- * @param {Number} height
874
- * @returns {mediaplayer}
875
- */
876
- resize: function resize(width, height) {
877
- if (isResponsiveSize(width) && !isResponsiveSize(height) || this.is('youtube')) {
878
- // responsive width height should be auto
879
- // for youtube iframe height is limited by ration
880
- height = 'auto';
881
- }
882
-
883
- this.execute('setSize', width, height);
884
- return this;
885
- },
886
-
887
- /**
888
- * Enables the media player
889
- * @returns {mediaplayer}
890
- */
891
- enable: function enable() {
892
- this._fromState('disabled');
893
-
894
- return this;
895
- },
896
-
897
- /**
898
- * Disables the media player
899
- * @returns {mediaplayer}
900
- */
901
- disable: function disable() {
902
- this._toState('disabled');
903
-
904
- this.trigger('disabled');
905
- return this;
906
- },
907
-
908
- /**
909
- * Shows the media player
910
- * @returns {mediaplayer}
911
- */
912
- show: function show() {
913
- this._fromState('hidden');
914
-
915
- return this;
916
- },
917
-
918
- /**
919
- * hides the media player
920
- * @returns {mediaplayer}
921
- */
922
- hide: function hide() {
923
- this._toState('hidden');
924
-
925
- return this;
926
- },
927
-
928
- /**
929
- * get media original size
930
- * @returns {Object}
931
- */
932
- getMediaOriginalSize: function getMediaOriginalSize() {
933
- if (this.is('youtube')) {
934
- return defaults.youtube;
935
- }
936
-
937
- if (this.is('video') && this.player) {
938
- return this.player.getMediaSize();
939
- }
940
-
941
- return {};
942
- },
943
-
944
- /**
945
- * Ensures the right media type is set
946
- * @param {String} type
947
- * @private
948
- */
949
- _setType: function _setType(type) {
950
- if (type.indexOf('youtube') !== -1) {
951
- this.type = 'youtube';
952
- } else if (type.indexOf('audio') === 0) {
953
- this.type = 'audio';
954
- } else {
955
- this.type = 'video';
956
- }
957
- },
958
-
959
- /**
960
- * Ensures the type is correctly applied
961
- * @private
962
- */
963
- _initType: function _initType() {
964
- var is = this.config.is;
965
- is.youtube = 'youtube' === this.type;
966
- is.video = 'video' === this.type || 'youtube' === this.type;
967
- is.audio = 'audio' === this.type;
968
- },
969
-
970
- /**
971
- * Gets a source descriptor.
972
- * @param {String|Object} src - The media URL, or an object containing the source and the type
973
- * @param {Function} callback - A function called to provide the media source object
974
- */
975
- _getSource: function _getSource(src, callback) {
976
- var _this4 = this;
977
-
978
- var source;
979
-
980
- var done = function done() {
981
- if (needTypeAdjust(source.type)) {
982
- source.type = getAdjustedType(source);
810
+ if (this.is('video') && this.player) {
811
+ return this.player.getMediaSize();
983
812
  }
984
-
985
- callback.call(_this4, source);
986
- };
987
-
988
- if (_.isString(src)) {
989
- source = {
990
- src: src
991
- };
992
- } else {
993
- source = _.clone(src);
994
- }
995
-
996
- if (!source.type) {
997
- if (this.is('youtube')) {
998
- source.type = defaults.type;
999
- } else if (this.config.mimeType) {
1000
- source.type = this.config.mimeType;
813
+ return {};
814
+ },
815
+ /**
816
+ * Ensures the right media type is set
817
+ * @param {String} type
818
+ * @private
819
+ */
820
+ _setType(type) {
821
+ if (type.indexOf('youtube') !== -1) {
822
+ this.type = 'youtube';
823
+ } else if (type.indexOf('audio') === 0) {
824
+ this.type = 'audio';
825
+ } else {
826
+ this.type = 'video';
1001
827
  }
1002
- }
1003
-
1004
- if (!source.type) {
1005
- mimetype.getResourceType(source.src, function (err, type) {
1006
- if (err) {
1007
- type = defaults.type;
828
+ },
829
+ /**
830
+ * Ensures the type is correctly applied
831
+ * @private
832
+ */
833
+ _initType() {
834
+ const is = this.config.is;
835
+ is.youtube = 'youtube' === this.type;
836
+ is.video = 'video' === this.type || 'youtube' === this.type;
837
+ is.audio = 'audio' === this.type;
838
+ },
839
+ /**
840
+ * Gets a source descriptor.
841
+ * @param {String|Object} src - The media URL, or an object containing the source and the type
842
+ * @param {Function} callback - A function called to provide the media source object
843
+ */
844
+ _getSource(src, callback) {
845
+ let source;
846
+ const done = () => {
847
+ if (needTypeAdjust(source.type)) {
848
+ source.type = getAdjustedType(source);
1008
849
  }
1009
-
1010
- source.type = type;
1011
- done();
1012
- });
1013
- } else {
1014
- done();
1015
- }
1016
- },
1017
-
1018
- /**
1019
- * Ensures the sources are correctly set
1020
- * @param {Function} callback - A function called once all sources have been initialized
1021
- * @private
1022
- */
1023
- _initSources: function _initSources(callback) {
1024
- var _this5 = this;
1025
-
1026
- var sources = configToSources(this.config);
1027
- this.config.sources = [];
1028
- async.each(sources, function (source, cb) {
1029
- _this5.addSource(source, function (src) {
1030
- return cb(null, src);
1031
- });
1032
- }, callback);
1033
- },
1034
-
1035
- /**
1036
- * Installs the events manager onto the instance
1037
- * @private
1038
- */
1039
- _initEvents: function _initEvents() {
1040
- eventifier(this);
1041
- var triggerEvent = this.trigger;
1042
-
1043
- this.trigger = function trigger(eventName) {
1044
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1045
- args[_key - 1] = arguments[_key];
850
+ callback.call(this, source);
851
+ };
852
+ if (_.isString(src)) {
853
+ source = {
854
+ src: src
855
+ };
856
+ } else {
857
+ source = _.clone(src);
1046
858
  }
1047
-
1048
- if (this.$component) {
1049
- var _this$$component;
1050
-
1051
- (_this$$component = this.$component).trigger.apply(_this$$component, [eventName + ns].concat(args));
859
+ if (!source.type) {
860
+ if (this.is('youtube')) {
861
+ source.type = defaults.type;
862
+ } else if (this.config.mimeType) {
863
+ source.type = this.config.mimeType;
864
+ }
1052
865
  }
1053
-
1054
- return triggerEvent.call.apply(triggerEvent, [this, eventName].concat(args));
1055
- };
1056
- },
1057
-
1058
- /**
1059
- * Ensures the right size is set according to the media type
1060
- * @private
1061
- */
1062
- _initSize: function _initSize() {
1063
- var type = this.is('video') ? 'video' : 'audio';
1064
- var mediaConfig = defaults[type] || defaults.video;
1065
- this.config.width = this.config.width || mediaConfig.width;
1066
- this.config.height = this.config.height || mediaConfig.height;
1067
-
1068
- if (isResponsiveSize(this.config.width) && !isResponsiveSize(this.config.height) || this.is('youtube')) {
1069
- // responsive width height should be auto
1070
- // for youtube iframe height is limited by ration
1071
- this.config.height = 'auto';
1072
- }
1073
- },
1074
-
1075
- /**
1076
- * Initializes the right player instance
1077
- * @private
1078
- */
1079
- _initPlayer: function _initPlayer() {
1080
- var _this6 = this;
1081
-
1082
- var playerFactory = players[this.type];
1083
- var error;
1084
-
1085
- if (support.canPlay(this.type)) {
1086
- if (_.isFunction(playerFactory)) {
1087
- var playerConfig = {
1088
- type: this.getType(),
1089
- sources: this.getSources(),
1090
- preview: this.config.preview,
1091
- debug: this.config.debug,
1092
- stalledDetectionDelay: this.config.stalledDetectionDelay
1093
- };
1094
- this.player = playerFactory(this.$player, playerConfig).on('resize', function (width, height) {
1095
- if (_this6.$component) {
1096
- _this6.$component.width(width).height(height);
866
+ if (!source.type) {
867
+ mimetype.getResourceType(source.src, (err, type) => {
868
+ if (err) {
869
+ type = defaults.type;
1097
870
  }
1098
- }).on('ready', function () {
1099
- return _this6._onReady();
1100
- }).on('play', function () {
1101
- return _this6._onPlay();
1102
- }).on('pause', function () {
1103
- return _this6._onPause();
1104
- }).on('timeupdate', function () {
1105
- return _this6._onTimeUpdate();
1106
- }).on('stalled', function () {
1107
- return _this6._onStalled();
1108
- }).on('playing', function () {
1109
- return _this6._onPlaying();
1110
- }).on('end', function () {
1111
- return _this6._onEnd();
1112
- }).on('error', function () {
1113
- return _this6._onError();
871
+ source.type = type;
872
+ done();
1114
873
  });
874
+ } else {
875
+ done();
1115
876
  }
1116
-
1117
- if (this.player) {
1118
- error = !this.player.init();
877
+ },
878
+ /**
879
+ * Ensures the sources are correctly set
880
+ * @param {Function} callback - A function called once all sources have been initialized
881
+ * @private
882
+ */
883
+ _initSources(callback) {
884
+ const sources = configToSources(this.config);
885
+ this.config.sources = [];
886
+ async.each(sources, (source, cb) => {
887
+ this.addSource(source, src => cb(null, src));
888
+ }, callback);
889
+ },
890
+ /**
891
+ * Installs the events manager onto the instance
892
+ * @private
893
+ */
894
+ _initEvents() {
895
+ eventifier(this);
896
+ const triggerEvent = this.trigger;
897
+ this.trigger = function trigger(eventName) {
898
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
899
+ args[_key - 1] = arguments[_key];
900
+ }
901
+ if (this.$component) {
902
+ this.$component.trigger(eventName + ns, ...args);
903
+ }
904
+ return triggerEvent.call(this, eventName, ...args);
905
+ };
906
+ },
907
+ /**
908
+ * Ensures the right size is set according to the media type
909
+ * @private
910
+ */
911
+ _initSize() {
912
+ const type = this.is('video') ? 'video' : 'audio';
913
+ const mediaConfig = defaults[type] || defaults.video;
914
+ this.config.width = this.config.width || mediaConfig.width;
915
+ this.config.height = this.config.height || mediaConfig.height;
916
+ if (isResponsiveSize(this.config.width) && !isResponsiveSize(this.config.height) || this.is('youtube')) {
917
+ // responsive width height should be auto
918
+ // for youtube iframe height is limited by ration
919
+ this.config.height = 'auto';
920
+ }
921
+ },
922
+ /**
923
+ * Initializes the right player instance
924
+ * @private
925
+ */
926
+ _initPlayer() {
927
+ const playerFactory = players[this.type];
928
+ let error;
929
+ if (support.canPlay(this.type)) {
930
+ if (_.isFunction(playerFactory)) {
931
+ const playerConfig = {
932
+ type: this.getType(),
933
+ sources: this.getSources(),
934
+ preview: this.config.preview,
935
+ debug: this.config.debug,
936
+ stalledDetectionDelay: this.config.stalledDetectionDelay
937
+ };
938
+ this.player = playerFactory(this.$player, playerConfig).on('resize', (width, height) => {
939
+ if (this.$component) {
940
+ this.$component.width(width).height(height);
941
+ }
942
+ }).on('ready', () => this._onReady()).on('play', () => this._onPlay()).on('pause', () => this._onPause()).on('timeupdate', () => this._onTimeUpdate()).on('stalled', () => this._onStalled()).on('playing', () => this._onPlaying()).on('end', () => this._onEnd()).on('error', () => this._onError());
943
+ }
944
+ if (this.player) {
945
+ error = !this.player.init();
946
+ } else {
947
+ error = true;
948
+ }
1119
949
  } else {
1120
950
  error = true;
1121
951
  }
1122
- } else {
1123
- error = true;
1124
- }
1125
-
1126
- this._setState('error', error);
1127
-
1128
- this._setState('nogui', !support.canControl());
1129
-
1130
- this._setState('preview', this.config.preview);
1131
-
1132
- this._setState('loading', !error);
1133
-
1134
- if (error) {
1135
- this._setState('ready', true);
1136
-
1137
- this.trigger('ready');
1138
- }
1139
- },
1140
-
1141
- /**
1142
- * Initializes the player state
1143
- * @private
1144
- */
1145
- _initState: function _initState() {
1146
- var isCORS = false;
1147
- var page;
1148
-
1149
- if (!this.is('youtube')) {
1150
- page = new UrlParser(window.location);
1151
- isCORS = _.some(this.config.sources, function (source) {
1152
- return !page.sameDomain(source.src);
1153
- });
1154
- }
1155
-
1156
- this._setState('cors', isCORS);
1157
-
1158
- this._setState('ready', false);
1159
- },
1160
-
1161
- /**
1162
- * Resets the internals attributes
1163
- * @private
1164
- */
1165
- _reset: function _reset() {
1166
- this.config.is = {};
1167
-
1168
- this._initType();
1169
-
1170
- this.$component = null;
1171
- this.$container = null;
1172
- this.$player = null;
1173
- this.$controls = null;
1174
- this.$seek = null;
1175
- this.$seekSlider = null;
1176
- this.$sound = null;
1177
- this.$volume = null;
1178
- this.$volumeControl = null;
1179
- this.$volumeSlider = null;
1180
- this.$position = null;
1181
- this.$duration = null;
1182
- this.player = null;
1183
- this.duration = 0;
1184
- this.position = 0;
1185
- this.timesPlayed = 0;
1186
- this.volume = this.config.volume;
1187
- this.autoStart = this.config.autoStart;
1188
- this.autoStartAt = this.config.autoStartAt;
1189
- this.startMuted = this.config.startMuted;
1190
- },
1191
-
1192
- /**
1193
- * Builds the DOM content
1194
- * @private
1195
- */
1196
- _buildDom: function _buildDom() {
1197
- var configForTemplate = _.clone(this.config);
1198
-
1199
- configForTemplate.type = this.type;
1200
- this.$component = $$1(playerTpl(configForTemplate));
1201
- this.$player = this.$component.find('.player');
1202
- this.$controls = this.$component.find('.controls');
1203
- this.$seek = this.$controls.find('.seek .slider');
1204
- this.$sound = this.$controls.find('.sound');
1205
- this.$volumeControl = this.$controls.find('.volume');
1206
- this.$volume = this.$controls.find('.volume .slider');
1207
- this.$position = this.$controls.find('[data-control="time-cur"]');
1208
- this.$duration = this.$controls.find('[data-control="time-end"]');
1209
- this.$volumeSlider = this._renderSlider(this.$volume, this.volume, volumeMin, volumeMax, true);
1210
- },
1211
-
1212
- /**
1213
- * Renders a slider onto an element
1214
- * @param {jQuery} $elt - The element on which renders the slider
1215
- * @param {Number} [value] - The current value of the slider
1216
- * @param {Number} [min] - The min value of the slider
1217
- * @param {Number} [max] - The max value of the slider
1218
- * @param {Boolean} [vertical] - Tells if the slider must be vertical
1219
- * @returns {jQuery} - Returns the element
1220
- * @private
1221
- */
1222
- _renderSlider: function _renderSlider($elt, value, min, max, vertical) {
1223
- var orientation, direction;
1224
-
1225
- if (vertical) {
1226
- orientation = 'vertical';
1227
- direction = 'rtl';
1228
- } else {
1229
- orientation = 'horizontal';
1230
- direction = 'ltr';
1231
- }
1232
-
1233
- return $elt.noUiSlider({
1234
- start: ensureNumber(value) || 0,
1235
- step: 1,
1236
- connect: 'lower',
1237
- orientation: orientation,
1238
- direction: direction,
1239
- animate: true,
1240
- range: {
1241
- min: ensureNumber(min) || 0,
1242
- max: ensureNumber(max) || 0
952
+ this._setState('error', error);
953
+ this._setState('nogui', !support.canControl());
954
+ this._setState('preview', this.config.preview);
955
+ this._setState('loading', !error);
956
+ if (error) {
957
+ this._setState('ready', true);
958
+ this.trigger('ready');
1243
959
  }
1244
- });
1245
- },
1246
-
1247
- /**
1248
- * Destroys a slider bound to an element
1249
- * @param {jQuery} $elt
1250
- * @private
1251
- */
1252
- _destroySlider: function _destroySlider($elt) {
1253
- if ($elt) {
1254
- $elt.get(0).destroy();
1255
- }
1256
- },
1257
-
1258
- /**
1259
- * Binds events onto the rendered player
1260
- * @private
1261
- */
1262
- _bindEvents: function _bindEvents() {
1263
- var _this7 = this;
1264
-
1265
- var overing = false;
1266
- this.$component.on("contextmenu".concat(ns), function (event) {
1267
- return event.preventDefault();
1268
- });
1269
- this.$controls.on("click".concat(ns), '.action', function (event) {
1270
- var $target = $$1(event.target);
1271
- var $action = $target.closest('.action');
1272
- var id = $action.data('control');
1273
-
1274
- if (_.isFunction(_this7[id])) {
1275
- _this7[id]();
960
+ },
961
+ /**
962
+ * Initializes the player state
963
+ * @private
964
+ */
965
+ _initState() {
966
+ let isCORS = false;
967
+ let page;
968
+ if (!this.is('youtube')) {
969
+ page = new UrlParser(window.location);
970
+ isCORS = _.some(this.config.sources, source => !page.sameDomain(source.src));
1276
971
  }
1277
- });
1278
- this.$player.on("click".concat(ns), function (event) {
1279
- var $target = $$1(event.target);
1280
- var $action = $target.closest('.action'); // if action was clicked
1281
-
1282
- if ($action.length) {
1283
- var id = $action.data('control');
1284
-
1285
- if (_.isFunction(_this7[id])) {
1286
- _this7[id]();
1287
- }
972
+ this._setState('cors', isCORS);
973
+ this._setState('ready', false);
974
+ },
975
+ /**
976
+ * Resets the internals attributes
977
+ * @private
978
+ */
979
+ _reset() {
980
+ this.config.is = {};
981
+ this._initType();
982
+ this.$component = null;
983
+ this.$container = null;
984
+ this.$player = null;
985
+ this.$controls = null;
986
+ this.$seek = null;
987
+ this.$seekSlider = null;
988
+ this.$sound = null;
989
+ this.$volume = null;
990
+ this.$volumeControl = null;
991
+ this.$volumeSlider = null;
992
+ this.$position = null;
993
+ this.$duration = null;
994
+ this.player = null;
995
+ this.duration = 0;
996
+ this.position = 0;
997
+ this.timesPlayed = 0;
998
+ this.volume = this.config.volume;
999
+ this.autoStart = this.config.autoStart;
1000
+ this.autoStartAt = this.config.autoStartAt;
1001
+ this.startMuted = this.config.startMuted;
1002
+ },
1003
+ /**
1004
+ * Builds the DOM content
1005
+ * @private
1006
+ */
1007
+ _buildDom() {
1008
+ const configForTemplate = _.clone(this.config);
1009
+ configForTemplate.type = this.type;
1010
+ this.$component = $$1(playerTpl(configForTemplate));
1011
+ this.$player = this.$component.find('.player');
1012
+ this.$controls = this.$component.find('.controls');
1013
+ this.$seek = this.$controls.find('.seek .slider');
1014
+ this.$sound = this.$controls.find('.sound');
1015
+ this.$volumeControl = this.$controls.find('.volume');
1016
+ this.$volume = this.$controls.find('.volume .slider');
1017
+ this.$position = this.$controls.find('[data-control="time-cur"]');
1018
+ this.$duration = this.$controls.find('[data-control="time-end"]');
1019
+ this.$volumeSlider = this._renderSlider(this.$volume, this.volume, volumeMin, volumeMax, true);
1020
+ },
1021
+ /**
1022
+ * Renders a slider onto an element
1023
+ * @param {jQuery} $elt - The element on which renders the slider
1024
+ * @param {Number} [value] - The current value of the slider
1025
+ * @param {Number} [min] - The min value of the slider
1026
+ * @param {Number} [max] - The max value of the slider
1027
+ * @param {Boolean} [vertical] - Tells if the slider must be vertical
1028
+ * @returns {jQuery} - Returns the element
1029
+ * @private
1030
+ */
1031
+ _renderSlider($elt, value, min, max, vertical) {
1032
+ let orientation, direction;
1033
+ if (vertical) {
1034
+ orientation = 'vertical';
1035
+ direction = 'rtl';
1288
1036
  } else {
1289
- // default action is toggle play
1290
- if (_this7.is('playing')) {
1291
- _this7.pause();
1292
- } else {
1293
- _this7.play();
1037
+ orientation = 'horizontal';
1038
+ direction = 'ltr';
1039
+ }
1040
+ return $elt.noUiSlider({
1041
+ start: ensureNumber(value) || 0,
1042
+ step: 1,
1043
+ connect: 'lower',
1044
+ orientation: orientation,
1045
+ direction: direction,
1046
+ animate: true,
1047
+ range: {
1048
+ min: ensureNumber(min) || 0,
1049
+ max: ensureNumber(max) || 0
1294
1050
  }
1051
+ });
1052
+ },
1053
+ /**
1054
+ * Destroys a slider bound to an element
1055
+ * @param {jQuery} $elt
1056
+ * @private
1057
+ */
1058
+ _destroySlider($elt) {
1059
+ if ($elt) {
1060
+ $elt.get(0).destroy();
1295
1061
  }
1296
- });
1297
- this.$seek.on("change".concat(ns), function (event, value) {
1298
- _this7.seek(value, true);
1299
- });
1300
- $$1(document).on("updateVolume".concat(ns), function (event, value) {
1301
- _this7.setVolume(value);
1302
- });
1303
- this.$volume.on("change".concat(ns), function (event, value) {
1304
- _this7.unmute();
1305
-
1306
- $$1(document).trigger("updateVolume".concat(ns), value);
1307
-
1308
- _this7.setVolume(value, true);
1309
- });
1310
- this.$sound.on("mouseover".concat(ns), 'a', function () {
1311
- var position;
1312
-
1313
- if (!overing && !_this7.$volumeControl.hasClass('up') && !_this7.$volumeControl.hasClass('down')) {
1314
- overing = true;
1315
- position = _this7.$controls[0].getBoundingClientRect();
1316
-
1317
- if (position && position.top && position.top < volumePositionThreshold) {
1318
- _this7.$volumeControl.addClass('down');
1062
+ },
1063
+ /**
1064
+ * Binds events onto the rendered player
1065
+ * @private
1066
+ */
1067
+ _bindEvents() {
1068
+ let overing = false;
1069
+ this.$component.on(`contextmenu${ns}`, event => event.preventDefault());
1070
+ this.$controls.on(`click${ns}`, '.action', event => {
1071
+ const $target = $$1(event.target);
1072
+ const $action = $target.closest('.action');
1073
+ const id = $action.data('control');
1074
+ if (_.isFunction(this[id])) {
1075
+ this[id]();
1076
+ }
1077
+ });
1078
+ this.$player.on(`click${ns}`, event => {
1079
+ const $target = $$1(event.target);
1080
+ const $action = $target.closest('.action');
1081
+
1082
+ // if action was clicked
1083
+ if ($action.length) {
1084
+ const id = $action.data('control');
1085
+ if (_.isFunction(this[id])) {
1086
+ this[id]();
1087
+ }
1319
1088
  } else {
1320
- _this7.$volumeControl.addClass('up');
1321
- } //close the volume control after 15s
1322
-
1323
-
1324
- _this7.overingTimer = _.delay(function () {
1325
- if (_this7.$volumeControl) {
1326
- _this7.$volumeControl.removeClass('up down');
1089
+ // default action is toggle play
1090
+ if (this.is('playing')) {
1091
+ this.pause();
1092
+ } else {
1093
+ this.play();
1094
+ }
1095
+ }
1096
+ });
1097
+ this.$seek.on(`change${ns}`, (event, value) => {
1098
+ this.seek(value, true);
1099
+ });
1100
+ $$1(document).on(`updateVolume${ns}`, (event, value) => {
1101
+ this.setVolume(value);
1102
+ });
1103
+ this.$volume.on(`change${ns}`, (event, value) => {
1104
+ this.unmute();
1105
+ $$1(document).trigger(`updateVolume${ns}`, value);
1106
+ this.setVolume(value, true);
1107
+ });
1108
+ this.$sound.on(`mouseover${ns}`, 'a', () => {
1109
+ let position;
1110
+ if (!overing && !this.$volumeControl.hasClass('up') && !this.$volumeControl.hasClass('down')) {
1111
+ overing = true;
1112
+ position = this.$controls[0].getBoundingClientRect();
1113
+ if (position && position.top && position.top < volumePositionThreshold) {
1114
+ this.$volumeControl.addClass('down');
1115
+ } else {
1116
+ this.$volumeControl.addClass('up');
1327
1117
  }
1328
1118
 
1329
- overing = false;
1330
- }, 15000);
1331
-
1332
- _this7.$volumeControl.one("mouseleave".concat(ns), function () {
1333
- _this7.$volumeControl.removeClass('up down');
1334
-
1335
- overing = false;
1336
- });
1119
+ //close the volume control after 15s
1120
+ this.overingTimer = _.delay(() => {
1121
+ if (this.$volumeControl) {
1122
+ this.$volumeControl.removeClass('up down');
1123
+ }
1124
+ overing = false;
1125
+ }, 15000);
1126
+ this.$volumeControl.one(`mouseleave${ns}`, () => {
1127
+ this.$volumeControl.removeClass('up down');
1128
+ overing = false;
1129
+ });
1130
+ }
1131
+ });
1132
+ },
1133
+ /**
1134
+ * Unbinds events from the rendered player
1135
+ * @private
1136
+ */
1137
+ _unbindEvents() {
1138
+ this.$component.off(ns);
1139
+ this.$player.off(ns);
1140
+ this.$controls.off(ns);
1141
+ this.$seek.off(ns);
1142
+ this.$volume.off(ns);
1143
+
1144
+ //if the volume is opened and the player destroyed,
1145
+ //prevent the callback to run
1146
+ if (this.overingTimer) {
1147
+ clearTimeout(this.overingTimer);
1148
+ }
1149
+ $$1(document).off(ns);
1150
+ },
1151
+ /**
1152
+ * Updates the volume slider
1153
+ * @param {Number} value
1154
+ * @private
1155
+ */
1156
+ _updateVolumeSlider(value) {
1157
+ if (this.$volumeSlider) {
1158
+ this.$volumeSlider.val(value);
1159
+ }
1160
+ },
1161
+ /**
1162
+ * Updates the displayed volume
1163
+ * @param {Number} value
1164
+ * @param {*} [internal]
1165
+ * @private
1166
+ */
1167
+ _updateVolume(value, internal) {
1168
+ this.volume = Math.max(volumeMin, Math.min(volumeMax, parseFloat(value)));
1169
+ this._storeVolume(this.volume);
1170
+ if (!internal) {
1171
+ this._updateVolumeSlider(value);
1172
+ }
1173
+ },
1174
+ /**
1175
+ * Updates the time slider
1176
+ * @param {Number} value
1177
+ * @private
1178
+ */
1179
+ _updatePositionSlider(value) {
1180
+ if (this.$seekSlider) {
1181
+ this.$seekSlider.val(value);
1182
+ }
1183
+ },
1184
+ /**
1185
+ * Updates the time label
1186
+ * @param {Number} value
1187
+ * @private
1188
+ */
1189
+ _updatePositionLabel(value) {
1190
+ if (this.$position) {
1191
+ this.$position.text(timerFormat(value));
1192
+ }
1193
+ },
1194
+ /**
1195
+ * Updates the displayed time position
1196
+ * @param {Number} value
1197
+ * @param {*} [internal]
1198
+ * @private
1199
+ */
1200
+ _updatePosition(value, internal) {
1201
+ this.position = Math.max(0, Math.min(this.duration || +Infinity, parseFloat(value)));
1202
+ if (!internal && this.duration) {
1203
+ this._updatePositionSlider(this.position);
1204
+ }
1205
+ this._updatePositionLabel(this.position);
1206
+ },
1207
+ /**
1208
+ * Updates the duration slider
1209
+ * @param {Number} value
1210
+ * @private
1211
+ */
1212
+ _updateDurationSlider(value) {
1213
+ if (this.$seekSlider) {
1214
+ this._destroySlider(this.$seekSlider);
1215
+ this.$seekSlider = null;
1337
1216
  }
1338
- });
1339
- },
1340
-
1341
- /**
1342
- * Unbinds events from the rendered player
1343
- * @private
1344
- */
1345
- _unbindEvents: function _unbindEvents() {
1346
- this.$component.off(ns);
1347
- this.$player.off(ns);
1348
- this.$controls.off(ns);
1349
- this.$seek.off(ns);
1350
- this.$volume.off(ns); //if the volume is opened and the player destroyed,
1351
- //prevent the callback to run
1352
-
1353
- if (this.overingTimer) {
1354
- clearTimeout(this.overingTimer);
1355
- }
1356
-
1357
- $$1(document).off(ns);
1358
- },
1359
-
1360
- /**
1361
- * Updates the volume slider
1362
- * @param {Number} value
1363
- * @private
1364
- */
1365
- _updateVolumeSlider: function _updateVolumeSlider(value) {
1366
- if (this.$volumeSlider) {
1367
- this.$volumeSlider.val(value);
1368
- }
1369
- },
1370
-
1371
- /**
1372
- * Updates the displayed volume
1373
- * @param {Number} value
1374
- * @param {*} [internal]
1375
- * @private
1376
- */
1377
- _updateVolume: function _updateVolume(value, internal) {
1378
- this.volume = Math.max(volumeMin, Math.min(volumeMax, parseFloat(value)));
1379
-
1380
- this._storeVolume(this.volume);
1381
-
1382
- if (!internal) {
1383
- this._updateVolumeSlider(value);
1384
- }
1385
- },
1386
-
1387
- /**
1388
- * Updates the time slider
1389
- * @param {Number} value
1390
- * @private
1391
- */
1392
- _updatePositionSlider: function _updatePositionSlider(value) {
1393
- if (this.$seekSlider) {
1394
- this.$seekSlider.val(value);
1395
- }
1396
- },
1397
-
1398
- /**
1399
- * Updates the time label
1400
- * @param {Number} value
1401
- * @private
1402
- */
1403
- _updatePositionLabel: function _updatePositionLabel(value) {
1404
- if (this.$position) {
1405
- this.$position.text(timerFormat(value));
1406
- }
1407
- },
1408
-
1409
- /**
1410
- * Updates the displayed time position
1411
- * @param {Number} value
1412
- * @param {*} [internal]
1413
- * @private
1414
- */
1415
- _updatePosition: function _updatePosition(value, internal) {
1416
- this.position = Math.max(0, Math.min(this.duration || +Infinity, parseFloat(value)));
1417
-
1418
- if (!internal && this.duration) {
1419
- this._updatePositionSlider(this.position);
1420
- }
1421
-
1422
- this._updatePositionLabel(this.position);
1423
- },
1424
-
1425
- /**
1426
- * Updates the duration slider
1427
- * @param {Number} value
1428
- * @private
1429
- */
1430
- _updateDurationSlider: function _updateDurationSlider(value) {
1431
- if (this.$seekSlider) {
1432
- this._destroySlider(this.$seekSlider);
1433
-
1434
- this.$seekSlider = null;
1435
- }
1436
-
1437
- if (value && isFinite(value)) {
1438
- this.$seekSlider = this._renderSlider(this.$seek, 0, 0, value);
1439
- this.$seekSlider.attr('disabled', !this.config.canSeek);
1440
- }
1441
- },
1442
-
1443
- /**
1444
- * Updates the duration label
1445
- * @param {Number} value
1446
- * @private
1447
- */
1448
- _updateDurationLabel: function _updateDurationLabel(value) {
1449
- if (this.$duration) {
1450
1217
  if (value && isFinite(value)) {
1451
- this.$duration.text(timerFormat(value)).show();
1452
- } else {
1453
- this.$duration.hide();
1218
+ this.$seekSlider = this._renderSlider(this.$seek, 0, 0, value);
1219
+ this.$seekSlider.attr('disabled', !this.config.canSeek);
1454
1220
  }
1455
- }
1456
- },
1457
-
1458
- /**
1459
- * Updates the displayed duration
1460
- * @param {Number|String} value
1461
- * @private
1462
- */
1463
- _updateDuration: function _updateDuration(value) {
1464
- var duration = Math.abs(parseFloat(value));
1465
-
1466
- if (duration !== this.duration) {
1467
- this.duration = duration;
1468
-
1469
- this._updateDurationSlider(this.duration);
1470
-
1471
- this._updateDurationLabel(this.duration);
1472
- }
1473
- },
1474
-
1475
- /**
1476
- * Event called when the media is ready
1477
- * @private
1478
- */
1479
- _onReady: function _onReady() {
1480
- if (this.is('error')) {
1481
- this._setState('error', false);
1482
- }
1483
-
1484
- var duration = this.player.getDuration();
1485
- var timePreview = this.config.preview || duration;
1486
-
1487
- if (timePreview) {
1488
- this._updateDuration(duration);
1489
- }
1490
-
1491
- this.setInitialStates();
1492
- /**
1493
- * Triggers a media ready event
1494
- * @event mediaplayer#ready
1221
+ },
1222
+ /**
1223
+ * Updates the duration label
1224
+ * @param {Number} value
1225
+ * @private
1495
1226
  */
1227
+ _updateDurationLabel(value) {
1228
+ if (this.$duration) {
1229
+ if (value && isFinite(value)) {
1230
+ this.$duration.text(timerFormat(value)).show();
1231
+ } else {
1232
+ this.$duration.hide();
1233
+ }
1234
+ }
1235
+ },
1236
+ /**
1237
+ * Updates the displayed duration
1238
+ * @param {Number|String} value
1239
+ * @private
1240
+ */
1241
+ _updateDuration(value) {
1242
+ const duration = Math.abs(parseFloat(value));
1243
+ if (duration !== this.duration) {
1244
+ this.duration = duration;
1245
+ this._updateDurationSlider(this.duration);
1246
+ this._updateDurationLabel(this.duration);
1247
+ }
1248
+ },
1249
+ /**
1250
+ * Event called when the media is ready
1251
+ * @private
1252
+ */
1253
+ _onReady() {
1254
+ if (this.is('error')) {
1255
+ this._setState('error', false);
1256
+ }
1257
+ const duration = this.player.getDuration();
1258
+ const timePreview = this.config.preview || duration;
1259
+ if (timePreview) {
1260
+ this._updateDuration(duration);
1261
+ }
1262
+ this.setInitialStates();
1496
1263
 
1497
- this.trigger('ready'); // set the initial state
1498
-
1499
- this.setVolume(this.volume);
1500
- this.mute(!!this.startMuted);
1501
-
1502
- if (this.autoStartAt) {
1503
- this.seek(this.autoStartAt);
1504
- } else if (this.autoStart) {
1505
- this.play();
1506
- }
1507
-
1508
- if (this.config.preview && this.$container && this.config.height && this.config.height !== 'auto') {
1509
- this._setMaxHeight();
1510
- }
1511
- },
1512
-
1513
- /**
1514
- * Set max height limit for container
1515
- * using by old media items with defined height.
1516
- * @private
1517
- */
1518
- _setMaxHeight: function _setMaxHeight() {
1519
- var $video = this.$container.find('video.video');
1520
- var controlsHeight = parseInt(window.getComputedStyle(this.$controls[0]).height);
1521
- var scale = $video.height() / this.config.height;
1522
- var playerWidth = this.$container.find('.player').width();
1523
- var videoWidth = $video.width() / scale;
1264
+ /**
1265
+ * Triggers a media ready event
1266
+ * @event mediaplayer#ready
1267
+ */
1268
+ this.trigger('ready');
1524
1269
 
1525
- if (videoWidth > playerWidth) {
1526
- this.execute('setSize', '100%', 'auto');
1527
- } else {
1528
- this.$component.css({
1529
- maxHeight: "".concat(this.config.height + controlsHeight, "px")
1270
+ // set the initial state
1271
+ this.setVolume(this.volume);
1272
+ this.mute(!!this.startMuted);
1273
+ if (this.autoStartAt) {
1274
+ this.seek(this.autoStartAt);
1275
+ } else if (this.autoStart) {
1276
+ this.play();
1277
+ }
1278
+ if (this.config.preview && this.$container && this.config.height && this.config.height !== 'auto') {
1279
+ this._setMaxHeight();
1280
+ }
1281
+ },
1282
+ /**
1283
+ * Set max height limit for container
1284
+ * using by old media items with defined height.
1285
+ * @private
1286
+ */
1287
+ _setMaxHeight() {
1288
+ const $video = this.$container.find('video.video');
1289
+ const controlsHeight = parseInt(window.getComputedStyle(this.$controls[0]).height);
1290
+ const scale = $video.height() / this.config.height;
1291
+ const playerWidth = this.$container.find('.player').width();
1292
+ const videoWidth = $video.width() / scale;
1293
+ if (videoWidth > playerWidth) {
1294
+ this.execute('setSize', '100%', 'auto');
1295
+ } else {
1296
+ this.$component.css({
1297
+ maxHeight: `${this.config.height + controlsHeight}px`
1298
+ });
1299
+ this.execute('setSize', Math.floor(videoWidth), 'auto');
1300
+ }
1301
+ },
1302
+ /**
1303
+ * Update volume in DBIndex store
1304
+ * @param {Number} volume
1305
+ * @returns {Promise}
1306
+ * @private
1307
+ */
1308
+ _storeVolume(volume) {
1309
+ return store('mediaVolume').then(volumeStore => volumeStore.setItem('volume', volume));
1310
+ },
1311
+ /**
1312
+ * Get volume from DBIndex store
1313
+ * @returns {Promise}
1314
+ * @private
1315
+ */
1316
+ _updateVolumeFromStore() {
1317
+ return store('mediaVolume').then(volumeStore => volumeStore.getItem('volume')).then(volume => {
1318
+ if (_.isNumber(volume)) {
1319
+ this.volume = Math.max(volumeMin, Math.min(volumeMax, parseFloat(volume)));
1320
+ this.setVolume(this.volume);
1321
+ }
1530
1322
  });
1531
- this.execute('setSize', Math.floor(videoWidth), 'auto');
1532
- }
1533
- },
1323
+ },
1324
+ /**
1325
+ * Event called when the media throws unrecoverable error
1326
+ * @private
1327
+ */
1328
+ _onError() {
1329
+ this._setState('error', true);
1330
+ this._setState('loading', false);
1534
1331
 
1535
- /**
1536
- * Update volume in DBIndex store
1537
- * @param {Number} volume
1538
- * @returns {Promise}
1539
- * @private
1540
- */
1541
- _storeVolume: function _storeVolume(volume) {
1542
- return store('mediaVolume').then(function (volumeStore) {
1543
- return volumeStore.setItem('volume', volume);
1544
- });
1545
- },
1332
+ /**
1333
+ * Triggers an unrecoverable media error event
1334
+ * @event mediaplayer#error
1335
+ */
1336
+ this.trigger('error');
1337
+ },
1338
+ /**
1339
+ * Event called when the media is played
1340
+ * @private
1341
+ */
1342
+ _onPlay() {
1343
+ this._playingState(true);
1344
+ this._setState('preview', true);
1546
1345
 
1547
- /**
1548
- * Get volume from DBIndex store
1549
- * @returns {Promise}
1550
- * @private
1551
- */
1552
- _updateVolumeFromStore: function _updateVolumeFromStore() {
1553
- var _this8 = this;
1346
+ /**
1347
+ * Triggers a media playback event
1348
+ * @event mediaplayer#play
1349
+ */
1350
+ this.trigger('play', this.player && this.player.getMedia());
1351
+ },
1352
+ /**
1353
+ * Event called when the media is paused
1354
+ * @private
1355
+ */
1356
+ _onPause() {
1357
+ this._playingState(false);
1554
1358
 
1555
- return store('mediaVolume').then(function (volumeStore) {
1556
- return volumeStore.getItem('volume');
1557
- }).then(function (volume) {
1558
- if (_.isNumber(volume)) {
1559
- _this8.volume = Math.max(volumeMin, Math.min(volumeMax, parseFloat(volume)));
1359
+ /**
1360
+ * Triggers a media paused event
1361
+ * @event mediaplayer#pause
1362
+ */
1363
+ this.trigger('pause');
1364
+ },
1365
+ /**
1366
+ * Event called when the media is ended
1367
+ * @private
1368
+ */
1369
+ _onEnd() {
1370
+ this.timesPlayed++;
1371
+ this._playingState(false, true);
1372
+ this._updatePosition(0);
1560
1373
 
1561
- _this8.setVolume(_this8.volume);
1374
+ // disable when the play limit is reached
1375
+ if (this._playLimitReached()) {
1376
+ if (!this.is('disabled')) {
1377
+ this.disable();
1378
+ }
1379
+ /**
1380
+ * Triggers a play limit reached event
1381
+ * @event mediaplayer#limitreached
1382
+ */
1383
+ this.trigger('limitreached');
1384
+ } else if (this.loop) {
1385
+ this.restart();
1386
+ } else if (parseInt(this.config.replayTimeout, 10) > 0) {
1387
+ this.replayTimeoutStartMs = new window.Date().getTime();
1388
+ this._replayTimeout();
1562
1389
  }
1563
- });
1564
- },
1565
-
1566
- /**
1567
- * Event called when the media throws unrecoverable error
1568
- * @private
1569
- */
1570
- _onError: function _onError() {
1571
- this._setState('error', true);
1572
1390
 
1573
- this._setState('loading', false);
1574
- /**
1575
- * Triggers an unrecoverable media error event
1576
- * @event mediaplayer#error
1391
+ /**
1392
+ * Triggers a media ended event
1393
+ * @event mediaplayer#ended
1394
+ */
1395
+ this.trigger('ended');
1396
+ },
1397
+ /**
1398
+ * Event called when the playback is playing
1399
+ * @private
1577
1400
  */
1578
-
1579
-
1580
- this.trigger('error');
1581
- },
1582
-
1583
- /**
1584
- * Event called when the media is played
1585
- * @private
1586
- */
1587
- _onPlay: function _onPlay() {
1588
- this._playingState(true);
1589
-
1590
- this._setState('preview', true);
1591
- /**
1592
- * Triggers a media playback event
1593
- * @event mediaplayer#play
1401
+ _onPlaying() {
1402
+ this._setState('preview', true);
1403
+ this._setState('stalled', false);
1404
+ this._setState('ready', true);
1405
+ },
1406
+ /**
1407
+ * Event called when the playback is stalled
1408
+ * @private
1594
1409
  */
1595
-
1596
-
1597
- this.trigger('play', this.player && this.player.getMedia());
1598
- },
1599
-
1600
- /**
1601
- * Event called when the media is paused
1602
- * @private
1603
- */
1604
- _onPause: function _onPause() {
1605
- this._playingState(false);
1606
- /**
1607
- * Triggers a media paused event
1608
- * @event mediaplayer#pause
1410
+ _onStalled() {
1411
+ this._setState('stalled', true);
1412
+ this._setState('ready', false);
1413
+ },
1414
+ /**
1415
+ * Event called when the time position has changed
1416
+ * @private
1609
1417
  */
1418
+ _onTimeUpdate() {
1419
+ this._updatePosition(this.player.getPosition());
1610
1420
 
1611
-
1612
- this.trigger('pause');
1613
- },
1614
-
1615
- /**
1616
- * Event called when the media is ended
1617
- * @private
1618
- */
1619
- _onEnd: function _onEnd() {
1620
- this.timesPlayed++;
1621
-
1622
- this._playingState(false, true);
1623
-
1624
- this._updatePosition(0); // disable when the play limit is reached
1625
-
1626
-
1627
- if (this._playLimitReached()) {
1628
- if (!this.is('disabled')) {
1421
+ /**
1422
+ * Triggers a media time update event
1423
+ * @event mediaplayer#update
1424
+ */
1425
+ this.trigger('update');
1426
+ },
1427
+ /**
1428
+ * Run a timer to disable the possibility of replaying a media
1429
+ * @private
1430
+ */
1431
+ _replayTimeout() {
1432
+ const nowMs = new window.Date().getTime(),
1433
+ elapsedSeconds = Math.floor((nowMs - this.replayTimeoutStartMs) / 1000);
1434
+ this.timerId = requestAnimationFrame(this._replayTimeout.bind(this));
1435
+ if (elapsedSeconds >= parseInt(this.config.replayTimeout, 10)) {
1629
1436
  this.disable();
1437
+ cancelAnimationFrame(this.timerId);
1630
1438
  }
1631
- /**
1632
- * Triggers a play limit reached event
1633
- * @event mediaplayer#limitreached
1634
- */
1635
-
1636
-
1637
- this.trigger('limitreached');
1638
- } else if (this.loop) {
1639
- this.restart();
1640
- } else if (parseInt(this.config.replayTimeout, 10) > 0) {
1641
- this.replayTimeoutStartMs = new window.Date().getTime();
1642
-
1643
- this._replayTimeout();
1644
- }
1645
- /**
1646
- * Triggers a media ended event
1647
- * @event mediaplayer#ended
1439
+ },
1440
+ /**
1441
+ * Checks if the play limit has been reached
1442
+ * @returns {Boolean}
1443
+ * @private
1648
1444
  */
1649
-
1650
-
1651
- this.trigger('ended');
1652
- },
1653
-
1654
- /**
1655
- * Event called when the playback is playing
1656
- * @private
1657
- */
1658
- _onPlaying: function _onPlaying() {
1659
- this._setState('preview', true);
1660
-
1661
- this._setState('stalled', false);
1662
-
1663
- this._setState('ready', true);
1664
- },
1665
-
1666
- /**
1667
- * Event called when the playback is stalled
1668
- * @private
1669
- */
1670
- _onStalled: function _onStalled() {
1671
- this._setState('stalled', true);
1672
-
1673
- this._setState('ready', false);
1674
- },
1675
-
1676
- /**
1677
- * Event called when the time position has changed
1678
- * @private
1679
- */
1680
- _onTimeUpdate: function _onTimeUpdate() {
1681
- this._updatePosition(this.player.getPosition());
1682
- /**
1683
- * Triggers a media time update event
1684
- * @event mediaplayer#update
1445
+ _playLimitReached() {
1446
+ return this.config.maxPlays && this.timesPlayed >= this.config.maxPlays;
1447
+ },
1448
+ /**
1449
+ * Checks if the media can be played
1450
+ * @returns {Boolean}
1451
+ * @private
1685
1452
  */
1686
-
1687
-
1688
- this.trigger('update');
1689
- },
1690
-
1691
- /**
1692
- * Run a timer to disable the possibility of replaying a media
1693
- * @private
1694
- */
1695
- _replayTimeout: function _replayTimeout() {
1696
- var nowMs = new window.Date().getTime(),
1697
- elapsedSeconds = Math.floor((nowMs - this.replayTimeoutStartMs) / 1000);
1698
- this.timerId = requestAnimationFrame(this._replayTimeout.bind(this));
1699
-
1700
- if (elapsedSeconds >= parseInt(this.config.replayTimeout, 10)) {
1701
- this.disable();
1702
- cancelAnimationFrame(this.timerId);
1703
- }
1704
- },
1705
-
1706
- /**
1707
- * Checks if the play limit has been reached
1708
- * @returns {Boolean}
1709
- * @private
1710
- */
1711
- _playLimitReached: function _playLimitReached() {
1712
- return this.config.maxPlays && this.timesPlayed >= this.config.maxPlays;
1713
- },
1714
-
1715
- /**
1716
- * Checks if the media can be played
1717
- * @returns {Boolean}
1718
- * @private
1719
- */
1720
- _canPlay: function _canPlay() {
1721
- return (this.is('ready') || this.is('stalled')) && !this.is('disabled') && !this.is('hidden') && !this._playLimitReached();
1722
- },
1723
-
1724
- /**
1725
- * Checks if the media can be paused
1726
- * @returns {Boolean}
1727
- * @private
1728
- */
1729
- _canPause: function _canPause() {
1730
- return !!this.config.canPause;
1731
- },
1732
-
1733
- /**
1734
- * Checks if the media can be sought
1735
- * @returns {Boolean}
1736
- * @private
1737
- */
1738
- _canSeek: function _canSeek() {
1739
- return !!this.config.canSeek;
1740
- },
1741
-
1742
- /**
1743
- * Checks if the playback can be resumed
1744
- * @returns {Boolean}
1745
- * @private
1746
- */
1747
- _canResume: function _canResume() {
1748
- return this.is('paused') && this._canPlay();
1749
- },
1750
-
1751
- /**
1752
- * Sets the media is in a particular state
1753
- * @param {String} name
1754
- * @param {Boolean} value
1755
- * @returns {mediaplayer}
1756
- */
1757
- _setState: function _setState(name, value) {
1758
- value = !!value;
1759
- this.config.is[name] = value;
1760
-
1761
- if (this.$component) {
1762
- this.$component.toggleClass(name, value);
1763
- }
1764
-
1765
- return this;
1766
- },
1767
-
1768
- /**
1769
- * Restores the media player from a particular state and resumes the playback
1770
- * @param {String} stateName
1771
- * @returns {mediaplayer}
1772
- * @private
1773
- */
1774
- _fromState: function _fromState(stateName) {
1775
- this._setState(stateName, false);
1776
-
1777
- this.resume();
1778
- return this;
1779
- },
1780
-
1781
- /**
1782
- * Sets the media player to a particular state and pauses the playback
1783
- * @param {String} stateName
1784
- * @returns {mediaplayer}
1785
- * @private
1786
- */
1787
- _toState: function _toState(stateName) {
1788
- this.pause();
1789
-
1790
- this._setState(stateName, true);
1791
-
1792
- return this;
1793
- },
1794
-
1795
- /**
1796
- * Sets the playing state
1797
- * @param {Boolean} state
1798
- * @param {Boolean} [ended]
1799
- * @returns {mediaplayer}
1800
- * @private
1801
- */
1802
- _playingState: function _playingState(state, ended) {
1803
- this._setState('playing', !!state);
1804
-
1805
- this._setState('paused', !state);
1806
-
1807
- this._setState('ended', !!ended);
1808
-
1809
- return this;
1810
- },
1811
-
1812
- /**
1813
- * Executes a command onto the media
1814
- * @param {String} command - The name of the command to execute
1815
- * @param {*} args - additional arguments
1816
- * @returns {*}
1817
- * @private
1818
- */
1819
- execute: function execute(command) {
1820
- if (this.player && 'function' === typeof this.player[command]) {
1821
- var _this$player;
1822
-
1823
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1824
- args[_key2 - 1] = arguments[_key2];
1453
+ _canPlay() {
1454
+ return (this.is('ready') || this.is('stalled')) && !this.is('disabled') && !this.is('hidden') && !this._playLimitReached();
1455
+ },
1456
+ /**
1457
+ * Checks if the media can be paused
1458
+ * @returns {Boolean}
1459
+ * @private
1460
+ */
1461
+ _canPause() {
1462
+ return !!this.config.canPause;
1463
+ },
1464
+ /**
1465
+ * Checks if the media can be sought
1466
+ * @returns {Boolean}
1467
+ * @private
1468
+ */
1469
+ _canSeek() {
1470
+ return !!this.config.canSeek;
1471
+ },
1472
+ /**
1473
+ * Checks if the playback can be resumed
1474
+ * @returns {Boolean}
1475
+ * @private
1476
+ */
1477
+ _canResume() {
1478
+ return this.is('paused') && this._canPlay();
1479
+ },
1480
+ /**
1481
+ * Sets the media is in a particular state
1482
+ * @param {String} name
1483
+ * @param {Boolean} value
1484
+ * @returns {mediaplayer}
1485
+ */
1486
+ _setState(name, value) {
1487
+ value = !!value;
1488
+ this.config.is[name] = value;
1489
+ if (this.$component) {
1490
+ this.$component.toggleClass(name, value);
1491
+ }
1492
+ return this;
1493
+ },
1494
+ /**
1495
+ * Restores the media player from a particular state and resumes the playback
1496
+ * @param {String} stateName
1497
+ * @returns {mediaplayer}
1498
+ * @private
1499
+ */
1500
+ _fromState(stateName) {
1501
+ this._setState(stateName, false);
1502
+ this.resume();
1503
+ return this;
1504
+ },
1505
+ /**
1506
+ * Sets the media player to a particular state and pauses the playback
1507
+ * @param {String} stateName
1508
+ * @returns {mediaplayer}
1509
+ * @private
1510
+ */
1511
+ _toState(stateName) {
1512
+ this.pause();
1513
+ this._setState(stateName, true);
1514
+ return this;
1515
+ },
1516
+ /**
1517
+ * Sets the playing state
1518
+ * @param {Boolean} state
1519
+ * @param {Boolean} [ended]
1520
+ * @returns {mediaplayer}
1521
+ * @private
1522
+ */
1523
+ _playingState(state, ended) {
1524
+ this._setState('playing', !!state);
1525
+ this._setState('paused', !state);
1526
+ this._setState('ended', !!ended);
1527
+ return this;
1528
+ },
1529
+ /**
1530
+ * Executes a command onto the media
1531
+ * @param {String} command - The name of the command to execute
1532
+ * @param {*} args - additional arguments
1533
+ * @returns {*}
1534
+ * @private
1535
+ */
1536
+ execute(command) {
1537
+ if (this.player && 'function' === typeof this.player[command]) {
1538
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1539
+ args[_key2 - 1] = arguments[_key2];
1540
+ }
1541
+ return this.player[command](...args);
1825
1542
  }
1826
-
1827
- return (_this$player = this.player)[command].apply(_this$player, args);
1828
1543
  }
1829
- }
1830
- };
1831
- return mediaplayer.init(config);
1832
- }
1833
- /**
1834
- * Tells if the browser can play audio and video
1835
- * @param {String} [type] The type of media (audio or video)
1836
- * @param {String} [mime] A media MIME type to check
1837
- * @type {Boolean}
1838
- */
1839
-
1840
-
1841
- mediaplayerFactory.canPlay = function canPlay(type, mime) {
1842
- return support.canPlay(type, mime);
1843
- };
1844
- /**
1845
- * Tells if the browser can play audio
1846
- * @param {String} [mime] A media MIME type to check
1847
- * @type {Boolean}
1848
- */
1849
-
1850
-
1851
- mediaplayerFactory.canPlayAudio = function canPlayAudio(mime) {
1852
- return support.canPlayAudio(mime);
1853
- };
1854
- /**
1855
- * Tells if the browser can play video
1856
- * @param {String} [mime] A media MIME type to check
1857
- * @type {Boolean}
1858
- */
1544
+ };
1545
+ return mediaplayer.init(config);
1546
+ }
1859
1547
 
1548
+ /**
1549
+ * Tells if the browser can play audio and video
1550
+ * @param {String} [type] The type of media (audio or video)
1551
+ * @param {String} [mime] A media MIME type to check
1552
+ * @type {Boolean}
1553
+ */
1554
+ mediaplayerFactory.canPlay = function canPlay(type, mime) {
1555
+ return support.canPlay(type, mime);
1556
+ };
1860
1557
 
1861
- mediaplayerFactory.canPlayVideo = function canPlayVideo(mime) {
1862
- return support.canPlayVideo(mime);
1863
- };
1864
- /**
1865
- * Checks if the browser allows to control the media playback
1866
- * @returns {Boolean}
1867
- */
1558
+ /**
1559
+ * Tells if the browser can play audio
1560
+ * @param {String} [mime] A media MIME type to check
1561
+ * @type {Boolean}
1562
+ */
1563
+ mediaplayerFactory.canPlayAudio = function canPlayAudio(mime) {
1564
+ return support.canPlayAudio(mime);
1565
+ };
1868
1566
 
1567
+ /**
1568
+ * Tells if the browser can play video
1569
+ * @param {String} [mime] A media MIME type to check
1570
+ * @type {Boolean}
1571
+ */
1572
+ mediaplayerFactory.canPlayVideo = function canPlayVideo(mime) {
1573
+ return support.canPlayVideo(mime);
1574
+ };
1869
1575
 
1870
- mediaplayerFactory.canControl = function canControl() {
1871
- return support.canControl();
1872
- };
1576
+ /**
1577
+ * Checks if the browser allows to control the media playback
1578
+ * @returns {Boolean}
1579
+ */
1580
+ mediaplayerFactory.canControl = function canControl() {
1581
+ return support.canControl();
1582
+ };
1873
1583
 
1874
- return mediaplayerFactory;
1584
+ return mediaplayerFactory;
1875
1585
 
1876
1586
  });