glebtv-ckeditor 4.13.1 → 4.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ckeditor/version.rb +2 -2
  3. data/vendor/assets/javascripts/ckeditor/CHANGES.md +387 -297
  4. data/vendor/assets/javascripts/ckeditor/LICENSE.md +6 -6
  5. data/vendor/assets/javascripts/ckeditor/README.md +5 -5
  6. data/vendor/assets/javascripts/ckeditor/adapters/jquery.js +1 -1
  7. data/vendor/assets/javascripts/ckeditor/build-config.js +5 -3
  8. data/vendor/assets/javascripts/ckeditor/ckeditor.js +620 -609
  9. data/vendor/assets/javascripts/ckeditor/config.js +1 -1
  10. data/vendor/assets/javascripts/ckeditor/contents.css +1 -1
  11. data/vendor/assets/javascripts/ckeditor/lang/en.js +2 -2
  12. data/vendor/assets/javascripts/ckeditor/lang/ru.js +2 -2
  13. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +1 -1
  14. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +1 -1
  15. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +1 -1
  16. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +1 -1
  17. data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +1 -1
  18. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +2 -4
  19. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.handlebars.min.js +1 -1
  20. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -2
  21. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
  22. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +2 -2
  23. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -1
  24. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-day.css +41 -41
  25. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-night.css +39 -39
  26. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/abcdef.css +32 -32
  27. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance-mobile.css +5 -5
  28. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +74 -74
  29. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-dark.css +38 -38
  30. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-light.css +38 -38
  31. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/bespin.css +34 -34
  32. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/blackboard.css +32 -32
  33. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +25 -25
  34. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/colorforth.css +33 -33
  35. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/darcula.css +51 -51
  36. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/dracula.css +40 -40
  37. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-dark.css +35 -35
  38. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-light.css +36 -36
  39. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +23 -23
  40. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/elegant.css +13 -13
  41. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +34 -34
  42. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/gruvbox-dark.css +37 -37
  43. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/hopscotch.css +34 -34
  44. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/icecoder.css +43 -43
  45. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/idea.css +41 -41
  46. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/isotope.css +34 -34
  47. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +47 -47
  48. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/liquibyte.css +95 -95
  49. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lucario.css +37 -37
  50. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/material.css +53 -53
  51. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mbo.css +37 -37
  52. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mdn-like.css +46 -46
  53. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/midnight.css +43 -43
  54. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +41 -41
  55. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/neat.css +12 -12
  56. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/neo.css +43 -43
  57. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +27 -27
  58. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/nord.css +42 -42
  59. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/oceanic-next.css +44 -44
  60. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +85 -85
  61. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-dark.css +38 -38
  62. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-light.css +38 -38
  63. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +52 -52
  64. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/railscasts.css +34 -34
  65. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +25 -25
  66. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/seti.css +44 -44
  67. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/shadowfox.css +52 -52
  68. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +168 -168
  69. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ssms.css +16 -16
  70. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/the-matrix.css +30 -30
  71. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-bright.css +35 -35
  72. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-eighties.css +38 -38
  73. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ttcn.css +64 -64
  74. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +32 -32
  75. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +34 -34
  76. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +53 -53
  77. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-light.css +43 -43
  78. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/yeti.css +44 -44
  79. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/yonce.css +59 -59
  80. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/zenburn.css +37 -37
  81. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.css +1 -1
  82. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +1 -1
  83. data/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +1 -1
  84. data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +1 -1
  85. data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +1 -1
  86. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +1 -1
  87. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +1 -1
  88. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +1 -1
  89. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +1 -1
  90. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +1 -1
  91. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +1 -1
  92. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +1 -1
  93. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +1 -1
  94. data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  95. data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
  96. data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +1 -1
  97. data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +1 -1
  98. data/vendor/assets/javascripts/ckeditor/plugins/image/lang/en.js +1 -1
  99. data/vendor/assets/javascripts/ckeditor/plugins/image/lang/ru.js +1 -1
  100. data/vendor/assets/javascripts/ckeditor/plugins/image/plugin.js +1 -1
  101. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/contents.css +1 -1
  102. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/image2.html +2 -2
  103. data/vendor/assets/javascripts/ckeditor/plugins/image2/dialogs/image2.js +1 -1
  104. data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/en.js +1 -1
  105. data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/ru.js +1 -1
  106. data/vendor/assets/javascripts/ckeditor/plugins/image2/plugin.js +1 -1
  107. data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/image2.html +4 -3
  108. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/plugin.js +1 -1
  109. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +1 -1
  110. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +21 -21
  111. data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +1 -1
  112. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/fr.js +8 -0
  113. data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +34 -34
  114. data/vendor/assets/javascripts/ckeditor/plugins/pastetools/filter/common.js +19 -16
  115. data/vendor/assets/javascripts/ckeditor/plugins/pastetools/filter/image.js +6 -0
  116. data/vendor/assets/javascripts/ckeditor/plugins/preview/images/pagebreak.gif +0 -0
  117. data/vendor/assets/javascripts/ckeditor/plugins/preview/styles/screen.css +10 -0
  118. data/vendor/assets/javascripts/ckeditor/plugins/scayt/CHANGELOG.md +1 -17
  119. data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +1 -1
  120. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +1 -1
  121. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +1 -1
  122. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +11 -11
  123. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +7 -7
  124. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +5 -4
  125. data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +1 -1
  126. data/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +15 -15
  127. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +1 -1
  128. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +1 -1
  129. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +1 -1
  130. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/LICENSE.md +21 -0
  131. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/README.md +106 -0
  132. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +1 -1
  133. data/vendor/assets/javascripts/ckeditor/plugins/youtube/LICENSE.md +15 -0
  134. data/vendor/assets/javascripts/ckeditor/plugins/youtube/README.md +156 -0
  135. data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +449 -449
  136. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor.css +1 -1
  137. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +1 -1
  138. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +1 -1
  139. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +1 -1
  140. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +1 -1
  141. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +1 -1
  142. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
  143. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
  144. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog.css +1 -1
  145. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie.css +1 -1
  146. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie8.css +1 -1
  147. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_iequirks.css +1 -1
  148. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor.css +1 -1
  149. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_gecko.css +1 -1
  150. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie.css +1 -1
  151. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie8.css +1 -1
  152. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_iequirks.css +1 -1
  153. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/readme.md +1 -1
  154. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/skin.js +1 -1
  155. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +1 -1
  156. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +1 -1
  157. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +1 -1
  158. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +1 -1
  159. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +1 -1
  160. data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +2 -2
  161. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +2 -2
  162. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +2 -2
  163. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +2 -2
  164. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +2 -2
  165. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +2 -2
  166. data/vendor/assets/javascripts/ckeditor/skins/moono/readme.md +1 -1
  167. data/vendor/assets/javascripts/ckeditor/skins/moono/skin.js +1 -1
  168. data/vendor/assets/javascripts/ckeditor/styles.js +1 -1
  169. metadata +53 -115
  170. data/vendor/assets/javascripts/ckeditor/lang/af.js +0 -5
  171. data/vendor/assets/javascripts/ckeditor/lang/ar.js +0 -5
  172. data/vendor/assets/javascripts/ckeditor/lang/az.js +0 -5
  173. data/vendor/assets/javascripts/ckeditor/lang/bg.js +0 -5
  174. data/vendor/assets/javascripts/ckeditor/lang/bn.js +0 -5
  175. data/vendor/assets/javascripts/ckeditor/lang/bs.js +0 -5
  176. data/vendor/assets/javascripts/ckeditor/lang/ca.js +0 -5
  177. data/vendor/assets/javascripts/ckeditor/lang/cs.js +0 -5
  178. data/vendor/assets/javascripts/ckeditor/lang/cy.js +0 -5
  179. data/vendor/assets/javascripts/ckeditor/lang/da.js +0 -5
  180. data/vendor/assets/javascripts/ckeditor/lang/de-ch.js +0 -5
  181. data/vendor/assets/javascripts/ckeditor/lang/de.js +0 -5
  182. data/vendor/assets/javascripts/ckeditor/lang/el.js +0 -5
  183. data/vendor/assets/javascripts/ckeditor/lang/en-au.js +0 -5
  184. data/vendor/assets/javascripts/ckeditor/lang/en-ca.js +0 -5
  185. data/vendor/assets/javascripts/ckeditor/lang/en-gb.js +0 -5
  186. data/vendor/assets/javascripts/ckeditor/lang/eo.js +0 -5
  187. data/vendor/assets/javascripts/ckeditor/lang/es-mx.js +0 -5
  188. data/vendor/assets/javascripts/ckeditor/lang/es.js +0 -5
  189. data/vendor/assets/javascripts/ckeditor/lang/et.js +0 -5
  190. data/vendor/assets/javascripts/ckeditor/lang/eu.js +0 -5
  191. data/vendor/assets/javascripts/ckeditor/lang/fa.js +0 -5
  192. data/vendor/assets/javascripts/ckeditor/lang/fi.js +0 -5
  193. data/vendor/assets/javascripts/ckeditor/lang/fo.js +0 -5
  194. data/vendor/assets/javascripts/ckeditor/lang/fr-ca.js +0 -5
  195. data/vendor/assets/javascripts/ckeditor/lang/fr.js +0 -5
  196. data/vendor/assets/javascripts/ckeditor/lang/gl.js +0 -5
  197. data/vendor/assets/javascripts/ckeditor/lang/gu.js +0 -5
  198. data/vendor/assets/javascripts/ckeditor/lang/he.js +0 -5
  199. data/vendor/assets/javascripts/ckeditor/lang/hi.js +0 -5
  200. data/vendor/assets/javascripts/ckeditor/lang/hr.js +0 -5
  201. data/vendor/assets/javascripts/ckeditor/lang/hu.js +0 -5
  202. data/vendor/assets/javascripts/ckeditor/lang/id.js +0 -5
  203. data/vendor/assets/javascripts/ckeditor/lang/is.js +0 -5
  204. data/vendor/assets/javascripts/ckeditor/lang/it.js +0 -5
  205. data/vendor/assets/javascripts/ckeditor/lang/ja.js +0 -5
  206. data/vendor/assets/javascripts/ckeditor/lang/ka.js +0 -5
  207. data/vendor/assets/javascripts/ckeditor/lang/km.js +0 -5
  208. data/vendor/assets/javascripts/ckeditor/lang/ko.js +0 -5
  209. data/vendor/assets/javascripts/ckeditor/lang/ku.js +0 -5
  210. data/vendor/assets/javascripts/ckeditor/lang/lt.js +0 -5
  211. data/vendor/assets/javascripts/ckeditor/lang/lv.js +0 -5
  212. data/vendor/assets/javascripts/ckeditor/lang/mk.js +0 -5
  213. data/vendor/assets/javascripts/ckeditor/lang/mn.js +0 -5
  214. data/vendor/assets/javascripts/ckeditor/lang/ms.js +0 -5
  215. data/vendor/assets/javascripts/ckeditor/lang/nb.js +0 -5
  216. data/vendor/assets/javascripts/ckeditor/lang/nl.js +0 -5
  217. data/vendor/assets/javascripts/ckeditor/lang/no.js +0 -5
  218. data/vendor/assets/javascripts/ckeditor/lang/oc.js +0 -5
  219. data/vendor/assets/javascripts/ckeditor/lang/pl.js +0 -5
  220. data/vendor/assets/javascripts/ckeditor/lang/pt-br.js +0 -5
  221. data/vendor/assets/javascripts/ckeditor/lang/pt.js +0 -5
  222. data/vendor/assets/javascripts/ckeditor/lang/ro.js +0 -5
  223. data/vendor/assets/javascripts/ckeditor/lang/si.js +0 -5
  224. data/vendor/assets/javascripts/ckeditor/lang/sk.js +0 -5
  225. data/vendor/assets/javascripts/ckeditor/lang/sl.js +0 -5
  226. data/vendor/assets/javascripts/ckeditor/lang/sq.js +0 -5
  227. data/vendor/assets/javascripts/ckeditor/lang/sr-latn.js +0 -5
  228. data/vendor/assets/javascripts/ckeditor/lang/sr.js +0 -5
  229. data/vendor/assets/javascripts/ckeditor/lang/sv.js +0 -5
  230. data/vendor/assets/javascripts/ckeditor/lang/th.js +0 -5
  231. data/vendor/assets/javascripts/ckeditor/lang/tr.js +0 -5
  232. data/vendor/assets/javascripts/ckeditor/lang/tt.js +0 -5
  233. data/vendor/assets/javascripts/ckeditor/lang/ug.js +0 -5
  234. data/vendor/assets/javascripts/ckeditor/lang/uk.js +0 -5
  235. data/vendor/assets/javascripts/ckeditor/lang/vi.js +0 -5
  236. data/vendor/assets/javascripts/ckeditor/lang/zh-cn.js +0 -5
  237. data/vendor/assets/javascripts/ckeditor/lang/zh.js +0 -5
  238. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +0 -3
  239. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/ru.js +0 -8
  240. data/vendor/assets/javascripts/ckeditor/skins/minimalist/skin.js +0 -10
@@ -1,449 +1,449 @@
1
- /*
2
- * Youtube Embed Plugin
3
- *
4
- * @author Jonnas Fonini <jonnasfonini@gmail.com>
5
- * @version 2.1.13
6
- */
7
- (function () {
8
- CKEDITOR.plugins.add('youtube', {
9
- lang: [ 'en', 'bg', 'pt', 'pt-br', 'ja', 'hu', 'it', 'fr', 'tr', 'ru', 'de', 'ar', 'nl', 'pl', 'vi', 'zh', 'el', 'he', 'es', 'nb', 'nn', 'fi', 'et', 'sk', 'cs', 'ko', 'eu', 'uk'],
10
- init: function (editor) {
11
- editor.addCommand('youtube', new CKEDITOR.dialogCommand('youtube', {
12
- allowedContent: 'div{*}(*); iframe{*}[!width,!height,!src,!frameborder,!allowfullscreen,!allow]; object param[*]; a[*]; img[*]'
13
- }));
14
-
15
- editor.ui.addButton('Youtube', {
16
- label : editor.lang.youtube.button,
17
- toolbar : 'insert',
18
- command : 'youtube',
19
- icon : this.path + 'images/icon.png'
20
- });
21
-
22
- CKEDITOR.dialog.add('youtube', function (instance) {
23
- var video,
24
- disabled = editor.config.youtube_disabled_fields || [];
25
-
26
- return {
27
- title : editor.lang.youtube.title,
28
- minWidth : 510,
29
- minHeight : 200,
30
- onShow: function () {
31
- for (var i = 0; i < disabled.length; i++) {
32
- this.getContentElement('youtubePlugin', disabled[i]).disable();
33
- }
34
- },
35
- contents :
36
- [{
37
- id : 'youtubePlugin',
38
- expand : true,
39
- elements :
40
- [{
41
- id : 'txtEmbed',
42
- type : 'textarea',
43
- label : editor.lang.youtube.txtEmbed,
44
- onChange : function (api) {
45
- handleEmbedChange(this, api);
46
- },
47
- onKeyUp : function (api) {
48
- handleEmbedChange(this, api);
49
- },
50
- validate : function () {
51
- if (this.isEnabled()) {
52
- if (!this.getValue()) {
53
- alert(editor.lang.youtube.noCode);
54
- return false;
55
- }
56
- else
57
- if (this.getValue().length === 0 || this.getValue().indexOf('//') === -1) {
58
- alert(editor.lang.youtube.invalidEmbed);
59
- return false;
60
- }
61
- }
62
- }
63
- },
64
- {
65
- type : 'html',
66
- html : editor.lang.youtube.or + '<hr>'
67
- },
68
- {
69
- type : 'hbox',
70
- widths : [ '70%', '15%', '15%' ],
71
- children :
72
- [
73
- {
74
- id : 'txtUrl',
75
- type : 'text',
76
- label : editor.lang.youtube.txtUrl,
77
- onChange : function (api) {
78
- handleLinkChange(this, api);
79
- },
80
- onKeyUp : function (api) {
81
- handleLinkChange(this, api);
82
- },
83
- validate : function () {
84
- if (this.isEnabled()) {
85
- if (!this.getValue()) {
86
- alert(editor.lang.youtube.noCode);
87
- return false;
88
- }
89
- else{
90
- video = ytVidId(this.getValue());
91
-
92
- if (this.getValue().length === 0 || video === false)
93
- {
94
- alert(editor.lang.youtube.invalidUrl);
95
- return false;
96
- }
97
- }
98
- }
99
- }
100
- },
101
- {
102
- type : 'text',
103
- id : 'txtWidth',
104
- width : '60px',
105
- label : editor.lang.youtube.txtWidth,
106
- 'default' : editor.config.youtube_width != null ? editor.config.youtube_width : '640',
107
- validate : function () {
108
- if (this.getValue()) {
109
- var width = parseInt (this.getValue()) || 0;
110
-
111
- if (width === 0) {
112
- alert(editor.lang.youtube.invalidWidth);
113
- return false;
114
- }
115
- }
116
- else {
117
- alert(editor.lang.youtube.noWidth);
118
- return false;
119
- }
120
- }
121
- },
122
- {
123
- type : 'text',
124
- id : 'txtHeight',
125
- width : '60px',
126
- label : editor.lang.youtube.txtHeight,
127
- 'default' : editor.config.youtube_height != null ? editor.config.youtube_height : '360',
128
- validate : function () {
129
- if (this.getValue()) {
130
- var height = parseInt(this.getValue()) || 0;
131
-
132
- if (height === 0) {
133
- alert(editor.lang.youtube.invalidHeight);
134
- return false;
135
- }
136
- }
137
- else {
138
- alert(editor.lang.youtube.noHeight);
139
- return false;
140
- }
141
- }
142
- }
143
- ]
144
- },
145
- {
146
- type : 'hbox',
147
- widths : [ '55%', '45%' ],
148
- children :
149
- [
150
- {
151
- id : 'chkResponsive',
152
- type : 'checkbox',
153
- label : editor.lang.youtube.txtResponsive,
154
- 'default' : editor.config.youtube_responsive != null ? editor.config.youtube_responsive : false
155
- },
156
- {
157
- id : 'chkNoEmbed',
158
- type : 'checkbox',
159
- label : editor.lang.youtube.txtNoEmbed,
160
- 'default' : editor.config.youtube_noembed != null ? editor.config.youtube_noembed : false
161
- }
162
- ]
163
- },
164
- {
165
- type : 'hbox',
166
- widths : [ '55%', '45%' ],
167
- children :
168
- [
169
- {
170
- id : 'chkRelated',
171
- type : 'checkbox',
172
- 'default' : editor.config.youtube_related != null ? editor.config.youtube_related : true,
173
- label : editor.lang.youtube.chkRelated
174
- },
175
- {
176
- id : 'chkOlderCode',
177
- type : 'checkbox',
178
- 'default' : editor.config.youtube_older != null ? editor.config.youtube_older : false,
179
- label : editor.lang.youtube.chkOlderCode
180
- }
181
- ]
182
- },
183
- {
184
- type : 'hbox',
185
- widths : [ '55%', '45%' ],
186
- children :
187
- [
188
- {
189
- id : 'chkPrivacy',
190
- type : 'checkbox',
191
- label : editor.lang.youtube.chkPrivacy,
192
- 'default' : editor.config.youtube_privacy != null ? editor.config.youtube_privacy : false
193
- },
194
- {
195
- id : 'chkAutoplay',
196
- type : 'checkbox',
197
- 'default' : editor.config.youtube_autoplay != null ? editor.config.youtube_autoplay : false,
198
- label : editor.lang.youtube.chkAutoplay
199
- }
200
- ]
201
- },
202
- {
203
- type : 'hbox',
204
- widths : [ '55%', '45%'],
205
- children :
206
- [
207
- {
208
- id : 'txtStartAt',
209
- type : 'text',
210
- label : editor.lang.youtube.txtStartAt,
211
- validate : function () {
212
- if (this.getValue()) {
213
- var str = this.getValue();
214
-
215
- if (!/^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$/i.test(str)) {
216
- alert(editor.lang.youtube.invalidTime);
217
- return false;
218
- }
219
- }
220
- }
221
- },
222
- {
223
- id : 'chkControls',
224
- type : 'checkbox',
225
- 'default' : editor.config.youtube_controls != null ? editor.config.youtube_controls : true,
226
- label : editor.lang.youtube.chkControls
227
- }
228
- ]
229
- }
230
- ]
231
- }
232
- ],
233
- onOk: function()
234
- {
235
- var content = '';
236
- var responsiveStyle = '';
237
-
238
- if (this.getContentElement('youtubePlugin', 'txtEmbed').isEnabled()) {
239
- content = this.getValueOf('youtubePlugin', 'txtEmbed');
240
- }
241
- else {
242
- var url = 'https://', params = [], startSecs, paramAutoplay='';
243
- var width = this.getValueOf('youtubePlugin', 'txtWidth');
244
- var height = this.getValueOf('youtubePlugin', 'txtHeight');
245
-
246
- if (this.getContentElement('youtubePlugin', 'chkPrivacy').getValue() === true) {
247
- url += 'www.youtube-nocookie.com/';
248
- }
249
- else {
250
- url += 'www.youtube.com/';
251
- }
252
-
253
- url += 'embed/' + video;
254
-
255
- if (this.getContentElement('youtubePlugin', 'chkRelated').getValue() === false) {
256
- params.push('rel=0');
257
- }
258
-
259
- if (this.getContentElement('youtubePlugin', 'chkAutoplay').getValue() === true) {
260
- params.push('autoplay=1');
261
- paramAutoplay='autoplay';
262
- }
263
-
264
- if (this.getContentElement('youtubePlugin', 'chkControls').getValue() === false) {
265
- params.push('controls=0');
266
- }
267
-
268
- startSecs = this.getValueOf('youtubePlugin', 'txtStartAt');
269
-
270
- if (startSecs) {
271
- var seconds = hmsToSeconds(startSecs);
272
-
273
- params.push('start=' + seconds);
274
- }
275
-
276
- if (params.length > 0) {
277
- url = url + '?' + params.join('&');
278
- }
279
-
280
- if (this.getContentElement('youtubePlugin', 'chkResponsive').getValue() === true) {
281
- content += '<div class="youtube-embed-wrapper" style="position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden">';
282
- responsiveStyle = 'style="position:absolute;top:0;left:0;width:100%;height:100%"';
283
- }
284
-
285
- if (this.getContentElement('youtubePlugin', 'chkOlderCode').getValue() === true) {
286
- url = url.replace('embed/', 'v/');
287
- url = url.replace(/&/g, '&amp;');
288
-
289
- if (url.indexOf('?') === -1) {
290
- url += '?';
291
- }
292
- else {
293
- url += '&amp;';
294
- }
295
- url += 'hl=' + (this.getParentEditor().config.language ? this.getParentEditor().config.language : 'en') + '&amp;version=3';
296
-
297
- content += '<object width="' + width + '" height="' + height + '" ' + responsiveStyle + '>';
298
- content += '<param name="movie" value="' + url + '"></param>';
299
- content += '<param name="allowFullScreen" value="true"></param>';
300
- content += '<param name="allowscriptaccess" value="always"></param>';
301
- content += '<embed src="' + url + '" type="application/x-shockwave-flash" ';
302
- content += 'width="' + width + '" height="' + height + '" '+ responsiveStyle + ' allowscriptaccess="always" ';
303
- content += 'allowfullscreen="true"></embed>';
304
- content += '</object>';
305
- }
306
- else
307
- if (this.getContentElement('youtubePlugin', 'chkNoEmbed').getValue() === true) {
308
- var imgSrc = '//img.youtube.com/vi/' + video + '/sddefault.jpg';
309
- content += '<a href="' + url + '" ><img width="' + width + '" height="' + height + '" src="' + imgSrc + '" ' + responsiveStyle + '/></a>';
310
- }
311
- else {
312
- content += '<iframe allow="' + paramAutoplay + ';" width="' + width + '" height="' + height + '" src="' + url + '" ' + responsiveStyle;
313
- content += 'frameborder="0" allowfullscreen></iframe>';
314
- }
315
-
316
- if (this.getContentElement('youtubePlugin', 'chkResponsive').getValue() === true) {
317
- content += '</div>';
318
- }
319
- }
320
-
321
- var element = CKEDITOR.dom.element.createFromHtml(content);
322
- var instance = this.getParentEditor();
323
- instance.insertElement(element);
324
- }
325
- };
326
- });
327
- }
328
- });
329
- })();
330
-
331
- function handleLinkChange(el, api) {
332
- var video = ytVidId(el.getValue());
333
- var time = ytVidTime(el.getValue());
334
-
335
- if (el.getValue().length > 0) {
336
- el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').disable();
337
- }
338
- else {
339
- el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').enable();
340
- }
341
-
342
- if (video && time) {
343
- var seconds = timeParamToSeconds(time);
344
- var hms = secondsToHms(seconds);
345
- el.getDialog().getContentElement('youtubePlugin', 'txtStartAt').setValue(hms);
346
- }
347
- }
348
-
349
- function handleEmbedChange(el, api) {
350
- if (el.getValue().length > 0) {
351
- el.getDialog().getContentElement('youtubePlugin', 'txtUrl').disable();
352
- }
353
- else {
354
- el.getDialog().getContentElement('youtubePlugin', 'txtUrl').enable();
355
- }
356
- }
357
-
358
-
359
- /**
360
- * JavaScript function to match (and return) the video Id
361
- * of any valid Youtube Url, given as input string.
362
- * @author: Stephan Schmitz <eyecatchup@gmail.com>
363
- * @url: http://stackoverflow.com/a/10315969/624466
364
- */
365
- function ytVidId(url) {
366
- var p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
367
- return (url.match(p)) ? RegExp.$1 : false;
368
- }
369
-
370
- /**
371
- * Matches and returns time param in YouTube Urls.
372
- */
373
- function ytVidTime(url) {
374
- var p = /t=([0-9hms]+)/;
375
- return (url.match(p)) ? RegExp.$1 : false;
376
- }
377
-
378
- /**
379
- * Converts time in hms format to seconds only
380
- */
381
- function hmsToSeconds(time) {
382
- var arr = time.split(':'), s = 0, m = 1;
383
-
384
- while (arr.length > 0) {
385
- s += m * parseInt(arr.pop(), 10);
386
- m *= 60;
387
- }
388
-
389
- return s;
390
- }
391
-
392
- /**
393
- * Converts seconds to hms format
394
- */
395
- function secondsToHms(seconds) {
396
- var h = Math.floor(seconds / 3600);
397
- var m = Math.floor((seconds / 60) % 60);
398
- var s = seconds % 60;
399
-
400
- var pad = function (n) {
401
- n = String(n);
402
- return n.length >= 2 ? n : "0" + n;
403
- };
404
-
405
- if (h > 0) {
406
- return pad(h) + ':' + pad(m) + ':' + pad(s);
407
- }
408
- else {
409
- return pad(m) + ':' + pad(s);
410
- }
411
- }
412
-
413
- /**
414
- * Converts time in youtube t-param format to seconds
415
- */
416
- function timeParamToSeconds(param) {
417
- var componentValue = function (si) {
418
- var regex = new RegExp('(\\d+)' + si);
419
- return param.match(regex) ? parseInt(RegExp.$1, 10) : 0;
420
- };
421
-
422
- return componentValue('h') * 3600
423
- + componentValue('m') * 60
424
- + componentValue('s');
425
- }
426
-
427
- /**
428
- * Converts seconds into youtube t-param value, e.g. 1h4m30s
429
- */
430
- function secondsToTimeParam(seconds) {
431
- var h = Math.floor(seconds / 3600);
432
- var m = Math.floor((seconds / 60) % 60);
433
- var s = seconds % 60;
434
- var param = '';
435
-
436
- if (h > 0) {
437
- param += h + 'h';
438
- }
439
-
440
- if (m > 0) {
441
- param += m + 'm';
442
- }
443
-
444
- if (s > 0) {
445
- param += s + 's';
446
- }
447
-
448
- return param;
449
- }
1
+ /*
2
+ * Youtube Embed Plugin
3
+ *
4
+ * @author Jonnas Fonini <jonnasfonini@gmail.com>
5
+ * @version 2.1.14
6
+ */
7
+ (function () {
8
+ CKEDITOR.plugins.add('youtube', {
9
+ lang: [ 'en', 'bg', 'pt', 'pt-br', 'ja', 'hu', 'it', 'fr', 'tr', 'ru', 'de', 'ar', 'nl', 'pl', 'vi', 'zh', 'el', 'he', 'es', 'nb', 'nn', 'fi', 'et', 'sk', 'cs', 'ko', 'eu', 'uk'],
10
+ init: function (editor) {
11
+ editor.addCommand('youtube', new CKEDITOR.dialogCommand('youtube', {
12
+ allowedContent: 'div{*}(*); iframe{*}[!width,!height,!src,!frameborder,!allowfullscreen,!allow]; object param[*]; a[*]; img[*]'
13
+ }));
14
+
15
+ editor.ui.addButton('Youtube', {
16
+ label : editor.lang.youtube.button,
17
+ toolbar : 'insert',
18
+ command : 'youtube',
19
+ icon : this.path + 'images/icon.png'
20
+ });
21
+
22
+ CKEDITOR.dialog.add('youtube', function (instance) {
23
+ var video,
24
+ disabled = editor.config.youtube_disabled_fields || [];
25
+
26
+ return {
27
+ title : editor.lang.youtube.title,
28
+ minWidth : 510,
29
+ minHeight : 200,
30
+ onShow: function () {
31
+ for (var i = 0; i < disabled.length; i++) {
32
+ this.getContentElement('youtubePlugin', disabled[i]).disable();
33
+ }
34
+ },
35
+ contents :
36
+ [{
37
+ id : 'youtubePlugin',
38
+ expand : true,
39
+ elements :
40
+ [{
41
+ id : 'txtEmbed',
42
+ type : 'textarea',
43
+ label : editor.lang.youtube.txtEmbed,
44
+ onChange : function (api) {
45
+ handleEmbedChange(this, api);
46
+ },
47
+ onKeyUp : function (api) {
48
+ handleEmbedChange(this, api);
49
+ },
50
+ validate : function () {
51
+ if (this.isEnabled()) {
52
+ if (!this.getValue()) {
53
+ alert(editor.lang.youtube.noCode);
54
+ return false;
55
+ }
56
+ else
57
+ if (this.getValue().length === 0 || this.getValue().indexOf('//') === -1) {
58
+ alert(editor.lang.youtube.invalidEmbed);
59
+ return false;
60
+ }
61
+ }
62
+ }
63
+ },
64
+ {
65
+ type : 'html',
66
+ html : editor.lang.youtube.or + '<hr>'
67
+ },
68
+ {
69
+ type : 'hbox',
70
+ widths : [ '70%', '15%', '15%' ],
71
+ children :
72
+ [
73
+ {
74
+ id : 'txtUrl',
75
+ type : 'text',
76
+ label : editor.lang.youtube.txtUrl,
77
+ onChange : function (api) {
78
+ handleLinkChange(this, api);
79
+ },
80
+ onKeyUp : function (api) {
81
+ handleLinkChange(this, api);
82
+ },
83
+ validate : function () {
84
+ if (this.isEnabled()) {
85
+ if (!this.getValue()) {
86
+ alert(editor.lang.youtube.noCode);
87
+ return false;
88
+ }
89
+ else{
90
+ video = ytVidId(this.getValue());
91
+
92
+ if (this.getValue().length === 0 || video === false)
93
+ {
94
+ alert(editor.lang.youtube.invalidUrl);
95
+ return false;
96
+ }
97
+ }
98
+ }
99
+ }
100
+ },
101
+ {
102
+ type : 'text',
103
+ id : 'txtWidth',
104
+ width : '60px',
105
+ label : editor.lang.youtube.txtWidth,
106
+ 'default' : editor.config.youtube_width != null ? editor.config.youtube_width : '640',
107
+ validate : function () {
108
+ if (this.getValue()) {
109
+ var width = parseInt (this.getValue()) || 0;
110
+
111
+ if (width === 0) {
112
+ alert(editor.lang.youtube.invalidWidth);
113
+ return false;
114
+ }
115
+ }
116
+ else {
117
+ alert(editor.lang.youtube.noWidth);
118
+ return false;
119
+ }
120
+ }
121
+ },
122
+ {
123
+ type : 'text',
124
+ id : 'txtHeight',
125
+ width : '60px',
126
+ label : editor.lang.youtube.txtHeight,
127
+ 'default' : editor.config.youtube_height != null ? editor.config.youtube_height : '360',
128
+ validate : function () {
129
+ if (this.getValue()) {
130
+ var height = parseInt(this.getValue()) || 0;
131
+
132
+ if (height === 0) {
133
+ alert(editor.lang.youtube.invalidHeight);
134
+ return false;
135
+ }
136
+ }
137
+ else {
138
+ alert(editor.lang.youtube.noHeight);
139
+ return false;
140
+ }
141
+ }
142
+ }
143
+ ]
144
+ },
145
+ {
146
+ type : 'hbox',
147
+ widths : [ '55%', '45%' ],
148
+ children :
149
+ [
150
+ {
151
+ id : 'chkResponsive',
152
+ type : 'checkbox',
153
+ label : editor.lang.youtube.txtResponsive,
154
+ 'default' : editor.config.youtube_responsive != null ? editor.config.youtube_responsive : false
155
+ },
156
+ {
157
+ id : 'chkNoEmbed',
158
+ type : 'checkbox',
159
+ label : editor.lang.youtube.txtNoEmbed,
160
+ 'default' : editor.config.youtube_noembed != null ? editor.config.youtube_noembed : false
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ type : 'hbox',
166
+ widths : [ '55%', '45%' ],
167
+ children :
168
+ [
169
+ {
170
+ id : 'chkRelated',
171
+ type : 'checkbox',
172
+ 'default' : editor.config.youtube_related != null ? editor.config.youtube_related : true,
173
+ label : editor.lang.youtube.chkRelated
174
+ },
175
+ {
176
+ id : 'chkOlderCode',
177
+ type : 'checkbox',
178
+ 'default' : editor.config.youtube_older != null ? editor.config.youtube_older : false,
179
+ label : editor.lang.youtube.chkOlderCode
180
+ }
181
+ ]
182
+ },
183
+ {
184
+ type : 'hbox',
185
+ widths : [ '55%', '45%' ],
186
+ children :
187
+ [
188
+ {
189
+ id : 'chkPrivacy',
190
+ type : 'checkbox',
191
+ label : editor.lang.youtube.chkPrivacy,
192
+ 'default' : editor.config.youtube_privacy != null ? editor.config.youtube_privacy : false
193
+ },
194
+ {
195
+ id : 'chkAutoplay',
196
+ type : 'checkbox',
197
+ 'default' : editor.config.youtube_autoplay != null ? editor.config.youtube_autoplay : false,
198
+ label : editor.lang.youtube.chkAutoplay
199
+ }
200
+ ]
201
+ },
202
+ {
203
+ type : 'hbox',
204
+ widths : [ '55%', '45%'],
205
+ children :
206
+ [
207
+ {
208
+ id : 'txtStartAt',
209
+ type : 'text',
210
+ label : editor.lang.youtube.txtStartAt,
211
+ validate : function () {
212
+ if (this.getValue()) {
213
+ var str = this.getValue();
214
+
215
+ if (!/^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$/i.test(str)) {
216
+ alert(editor.lang.youtube.invalidTime);
217
+ return false;
218
+ }
219
+ }
220
+ }
221
+ },
222
+ {
223
+ id : 'chkControls',
224
+ type : 'checkbox',
225
+ 'default' : editor.config.youtube_controls != null ? editor.config.youtube_controls : true,
226
+ label : editor.lang.youtube.chkControls
227
+ }
228
+ ]
229
+ }
230
+ ]
231
+ }
232
+ ],
233
+ onOk: function()
234
+ {
235
+ var content = '';
236
+ var responsiveStyle = '';
237
+
238
+ if (this.getContentElement('youtubePlugin', 'txtEmbed').isEnabled()) {
239
+ content = this.getValueOf('youtubePlugin', 'txtEmbed');
240
+ }
241
+ else {
242
+ var url = 'https://', params = [], startSecs, paramAutoplay='';
243
+ var width = this.getValueOf('youtubePlugin', 'txtWidth');
244
+ var height = this.getValueOf('youtubePlugin', 'txtHeight');
245
+
246
+ if (this.getContentElement('youtubePlugin', 'chkPrivacy').getValue() === true) {
247
+ url += 'www.youtube-nocookie.com/';
248
+ }
249
+ else {
250
+ url += 'www.youtube.com/';
251
+ }
252
+
253
+ url += 'embed/' + video;
254
+
255
+ if (this.getContentElement('youtubePlugin', 'chkRelated').getValue() === false) {
256
+ params.push('rel=0');
257
+ }
258
+
259
+ if (this.getContentElement('youtubePlugin', 'chkAutoplay').getValue() === true) {
260
+ params.push('autoplay=1');
261
+ paramAutoplay='autoplay';
262
+ }
263
+
264
+ if (this.getContentElement('youtubePlugin', 'chkControls').getValue() === false) {
265
+ params.push('controls=0');
266
+ }
267
+
268
+ startSecs = this.getValueOf('youtubePlugin', 'txtStartAt');
269
+
270
+ if (startSecs) {
271
+ var seconds = hmsToSeconds(startSecs);
272
+
273
+ params.push('start=' + seconds);
274
+ }
275
+
276
+ if (params.length > 0) {
277
+ url = url + '?' + params.join('&');
278
+ }
279
+
280
+ if (this.getContentElement('youtubePlugin', 'chkResponsive').getValue() === true) {
281
+ content += '<div class="youtube-embed-wrapper" style="position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden">';
282
+ responsiveStyle = 'style="position:absolute;top:0;left:0;width:100%;height:100%"';
283
+ }
284
+
285
+ if (this.getContentElement('youtubePlugin', 'chkOlderCode').getValue() === true) {
286
+ url = url.replace('embed/', 'v/');
287
+ url = url.replace(/&/g, '&amp;');
288
+
289
+ if (url.indexOf('?') === -1) {
290
+ url += '?';
291
+ }
292
+ else {
293
+ url += '&amp;';
294
+ }
295
+ url += 'hl=' + (this.getParentEditor().config.language ? this.getParentEditor().config.language : 'en') + '&amp;version=3';
296
+
297
+ content += '<object width="' + width + '" height="' + height + '" ' + responsiveStyle + '>';
298
+ content += '<param name="movie" value="' + url + '"></param>';
299
+ content += '<param name="allowFullScreen" value="true"></param>';
300
+ content += '<param name="allowscriptaccess" value="always"></param>';
301
+ content += '<embed src="' + url + '" type="application/x-shockwave-flash" ';
302
+ content += 'width="' + width + '" height="' + height + '" '+ responsiveStyle + ' allowscriptaccess="always" ';
303
+ content += 'allowfullscreen="true"></embed>';
304
+ content += '</object>';
305
+ }
306
+ else
307
+ if (this.getContentElement('youtubePlugin', 'chkNoEmbed').getValue() === true) {
308
+ var imgSrc = 'https://img.youtube.com/vi/' + video + '/sddefault.jpg';
309
+ content += '<a href="' + url + '" ><img width="' + width + '" height="' + height + '" src="' + imgSrc + '" ' + responsiveStyle + '/></a>';
310
+ }
311
+ else {
312
+ content += '<iframe ' + (paramAutoplay ? 'allow="' + paramAutoplay + ';" ' : '') + 'width="' + width + '" height="' + height + '" src="' + url + '" ' + responsiveStyle;
313
+ content += 'frameborder="0" allowfullscreen></iframe>';
314
+ }
315
+
316
+ if (this.getContentElement('youtubePlugin', 'chkResponsive').getValue() === true) {
317
+ content += '</div>';
318
+ }
319
+ }
320
+
321
+ var element = CKEDITOR.dom.element.createFromHtml(content);
322
+ var instance = this.getParentEditor();
323
+ instance.insertElement(element);
324
+ }
325
+ };
326
+ });
327
+ }
328
+ });
329
+ })();
330
+
331
+ function handleLinkChange(el, api) {
332
+ var video = ytVidId(el.getValue());
333
+ var time = ytVidTime(el.getValue());
334
+
335
+ if (el.getValue().length > 0) {
336
+ el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').disable();
337
+ }
338
+ else if (!disabled.length || !disabled.includes('txtEmbed')) {
339
+ el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').enable();
340
+ }
341
+
342
+ if (video && time) {
343
+ var seconds = timeParamToSeconds(time);
344
+ var hms = secondsToHms(seconds);
345
+ el.getDialog().getContentElement('youtubePlugin', 'txtStartAt').setValue(hms);
346
+ }
347
+ }
348
+
349
+ function handleEmbedChange(el, api) {
350
+ if (el.getValue().length > 0) {
351
+ el.getDialog().getContentElement('youtubePlugin', 'txtUrl').disable();
352
+ }
353
+ else {
354
+ el.getDialog().getContentElement('youtubePlugin', 'txtUrl').enable();
355
+ }
356
+ }
357
+
358
+
359
+ /**
360
+ * JavaScript function to match (and return) the video Id
361
+ * of any valid Youtube Url, given as input string.
362
+ * @author: Stephan Schmitz <eyecatchup@gmail.com>
363
+ * @url: http://stackoverflow.com/a/10315969/624466
364
+ */
365
+ function ytVidId(url) {
366
+ var p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
367
+ return (url.match(p)) ? RegExp.$1 : false;
368
+ }
369
+
370
+ /**
371
+ * Matches and returns time param in YouTube Urls.
372
+ */
373
+ function ytVidTime(url) {
374
+ var p = /t=([0-9hms]+)/;
375
+ return (url.match(p)) ? RegExp.$1 : false;
376
+ }
377
+
378
+ /**
379
+ * Converts time in hms format to seconds only
380
+ */
381
+ function hmsToSeconds(time) {
382
+ var arr = time.split(':'), s = 0, m = 1;
383
+
384
+ while (arr.length > 0) {
385
+ s += m * parseInt(arr.pop(), 10);
386
+ m *= 60;
387
+ }
388
+
389
+ return s;
390
+ }
391
+
392
+ /**
393
+ * Converts seconds to hms format
394
+ */
395
+ function secondsToHms(seconds) {
396
+ var h = Math.floor(seconds / 3600);
397
+ var m = Math.floor((seconds / 60) % 60);
398
+ var s = seconds % 60;
399
+
400
+ var pad = function (n) {
401
+ n = String(n);
402
+ return n.length >= 2 ? n : "0" + n;
403
+ };
404
+
405
+ if (h > 0) {
406
+ return pad(h) + ':' + pad(m) + ':' + pad(s);
407
+ }
408
+ else {
409
+ return pad(m) + ':' + pad(s);
410
+ }
411
+ }
412
+
413
+ /**
414
+ * Converts time in youtube t-param format to seconds
415
+ */
416
+ function timeParamToSeconds(param) {
417
+ var componentValue = function (si) {
418
+ var regex = new RegExp('(\\d+)' + si);
419
+ return param.match(regex) ? parseInt(RegExp.$1, 10) : 0;
420
+ };
421
+
422
+ return componentValue('h') * 3600
423
+ + componentValue('m') * 60
424
+ + componentValue('s');
425
+ }
426
+
427
+ /**
428
+ * Converts seconds into youtube t-param value, e.g. 1h4m30s
429
+ */
430
+ function secondsToTimeParam(seconds) {
431
+ var h = Math.floor(seconds / 3600);
432
+ var m = Math.floor((seconds / 60) % 60);
433
+ var s = seconds % 60;
434
+ var param = '';
435
+
436
+ if (h > 0) {
437
+ param += h + 'h';
438
+ }
439
+
440
+ if (m > 0) {
441
+ param += m + 'm';
442
+ }
443
+
444
+ if (s > 0) {
445
+ param += s + 's';
446
+ }
447
+
448
+ return param;
449
+ }