@mnykj/alleditor-vue 0.0.0-stage → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/README.md +51 -2
  2. package/nuxt.ts +67 -0
  3. package/package.json +62 -4
  4. package/scripts/sync-ueditor.mjs +28 -0
  5. package/src/AllEditor.vue +669 -0
  6. package/src/DualEditor.vue +7 -0
  7. package/src/UeHtmlEngine.vue +438 -0
  8. package/src/assets/iconfont/iconfont.css +27 -0
  9. package/src/assets/iconfont/iconfont.ttf +0 -0
  10. package/src/assets/iconfont/iconfont.woff +0 -0
  11. package/src/assets/iconfont/iconfont.woff2 +0 -0
  12. package/src/defaultToolbar.ts +115 -0
  13. package/src/importMenus.ts +158 -0
  14. package/src/index.ts +58 -0
  15. package/src/markdown.ts +46 -0
  16. package/src/stripJavascriptFromHtml.ts +28 -0
  17. package/src/ueToolbar.ts +257 -0
  18. package/src/ueditorBase.ts +2 -0
  19. package/src/ueditorPaths.ts +11 -0
  20. package/ueditor/dialogs/anchor/anchor.html +40 -0
  21. package/ueditor/dialogs/attachment/attachment.css +681 -0
  22. package/ueditor/dialogs/attachment/attachment.html +60 -0
  23. package/ueditor/dialogs/attachment/attachment.js +760 -0
  24. package/ueditor/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
  25. package/ueditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
  26. package/ueditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
  27. package/ueditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
  28. package/ueditor/dialogs/attachment/fileTypeImages/icon_jpg.gif +0 -0
  29. package/ueditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
  30. package/ueditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
  31. package/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
  32. package/ueditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
  33. package/ueditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
  34. package/ueditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
  35. package/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
  36. package/ueditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
  37. package/ueditor/dialogs/attachment/images/alignicon.gif +0 -0
  38. package/ueditor/dialogs/attachment/images/alignicon.png +0 -0
  39. package/ueditor/dialogs/attachment/images/bg.png +0 -0
  40. package/ueditor/dialogs/attachment/images/file-icons.gif +0 -0
  41. package/ueditor/dialogs/attachment/images/file-icons.png +0 -0
  42. package/ueditor/dialogs/attachment/images/icons.gif +0 -0
  43. package/ueditor/dialogs/attachment/images/icons.png +0 -0
  44. package/ueditor/dialogs/attachment/images/image.png +0 -0
  45. package/ueditor/dialogs/attachment/images/progress.png +0 -0
  46. package/ueditor/dialogs/attachment/images/success.gif +0 -0
  47. package/ueditor/dialogs/attachment/images/success.png +0 -0
  48. package/ueditor/dialogs/background/background.css +94 -0
  49. package/ueditor/dialogs/background/background.html +56 -0
  50. package/ueditor/dialogs/background/background.js +376 -0
  51. package/ueditor/dialogs/background/images/bg.png +0 -0
  52. package/ueditor/dialogs/background/images/success.png +0 -0
  53. package/ueditor/dialogs/charts/chart.config.js +65 -0
  54. package/ueditor/dialogs/charts/charts.css +165 -0
  55. package/ueditor/dialogs/charts/charts.html +89 -0
  56. package/ueditor/dialogs/charts/charts.js +519 -0
  57. package/ueditor/dialogs/charts/images/charts0.png +0 -0
  58. package/ueditor/dialogs/charts/images/charts1.png +0 -0
  59. package/ueditor/dialogs/charts/images/charts2.png +0 -0
  60. package/ueditor/dialogs/charts/images/charts3.png +0 -0
  61. package/ueditor/dialogs/charts/images/charts4.png +0 -0
  62. package/ueditor/dialogs/charts/images/charts5.png +0 -0
  63. package/ueditor/dialogs/emotion/emotion.css +43 -0
  64. package/ueditor/dialogs/emotion/emotion.html +54 -0
  65. package/ueditor/dialogs/emotion/emotion.js +186 -0
  66. package/ueditor/dialogs/emotion/images/0.gif +0 -0
  67. package/ueditor/dialogs/emotion/images/bface.gif +0 -0
  68. package/ueditor/dialogs/emotion/images/cface.gif +0 -0
  69. package/ueditor/dialogs/emotion/images/fface.gif +0 -0
  70. package/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
  71. package/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
  72. package/ueditor/dialogs/emotion/images/tface.gif +0 -0
  73. package/ueditor/dialogs/emotion/images/wface.gif +0 -0
  74. package/ueditor/dialogs/emotion/images/yface.gif +0 -0
  75. package/ueditor/dialogs/gmap/gmap.html +89 -0
  76. package/ueditor/dialogs/help/help.css +7 -0
  77. package/ueditor/dialogs/help/help.html +82 -0
  78. package/ueditor/dialogs/help/help.js +56 -0
  79. package/ueditor/dialogs/image/image.css +894 -0
  80. package/ueditor/dialogs/image/image.html +120 -0
  81. package/ueditor/dialogs/image/image.js +1123 -0
  82. package/ueditor/dialogs/image/images/alignicon.jpg +0 -0
  83. package/ueditor/dialogs/image/images/bg.png +0 -0
  84. package/ueditor/dialogs/image/images/icons.gif +0 -0
  85. package/ueditor/dialogs/image/images/icons.png +0 -0
  86. package/ueditor/dialogs/image/images/image.png +0 -0
  87. package/ueditor/dialogs/image/images/progress.png +0 -0
  88. package/ueditor/dialogs/image/images/success.gif +0 -0
  89. package/ueditor/dialogs/image/images/success.png +0 -0
  90. package/ueditor/dialogs/insertframe/insertframe.html +98 -0
  91. package/ueditor/dialogs/internal.js +81 -0
  92. package/ueditor/dialogs/link/link.html +132 -0
  93. package/ueditor/dialogs/map/map.html +135 -0
  94. package/ueditor/dialogs/map/show.html +118 -0
  95. package/ueditor/dialogs/music/music.css +30 -0
  96. package/ueditor/dialogs/music/music.html +32 -0
  97. package/ueditor/dialogs/music/music.js +192 -0
  98. package/ueditor/dialogs/preview/preview.html +40 -0
  99. package/ueditor/dialogs/scrawl/images/addimg.png +0 -0
  100. package/ueditor/dialogs/scrawl/images/brush.png +0 -0
  101. package/ueditor/dialogs/scrawl/images/delimg.png +0 -0
  102. package/ueditor/dialogs/scrawl/images/delimgH.png +0 -0
  103. package/ueditor/dialogs/scrawl/images/empty.png +0 -0
  104. package/ueditor/dialogs/scrawl/images/emptyH.png +0 -0
  105. package/ueditor/dialogs/scrawl/images/eraser.png +0 -0
  106. package/ueditor/dialogs/scrawl/images/redo.png +0 -0
  107. package/ueditor/dialogs/scrawl/images/redoH.png +0 -0
  108. package/ueditor/dialogs/scrawl/images/scale.png +0 -0
  109. package/ueditor/dialogs/scrawl/images/scaleH.png +0 -0
  110. package/ueditor/dialogs/scrawl/images/size.png +0 -0
  111. package/ueditor/dialogs/scrawl/images/undo.png +0 -0
  112. package/ueditor/dialogs/scrawl/images/undoH.png +0 -0
  113. package/ueditor/dialogs/scrawl/scrawl.css +72 -0
  114. package/ueditor/dialogs/scrawl/scrawl.html +95 -0
  115. package/ueditor/dialogs/scrawl/scrawl.js +670 -0
  116. package/ueditor/dialogs/searchreplace/searchreplace.html +102 -0
  117. package/ueditor/dialogs/searchreplace/searchreplace.js +170 -0
  118. package/ueditor/dialogs/snapscreen/snapscreen.html +58 -0
  119. package/ueditor/dialogs/spechars/spechars.html +21 -0
  120. package/ueditor/dialogs/spechars/spechars.js +57 -0
  121. package/ueditor/dialogs/table/dragicon.png +0 -0
  122. package/ueditor/dialogs/table/edittable.css +84 -0
  123. package/ueditor/dialogs/table/edittable.html +64 -0
  124. package/ueditor/dialogs/table/edittable.js +237 -0
  125. package/ueditor/dialogs/table/edittd.html +61 -0
  126. package/ueditor/dialogs/table/edittip.html +33 -0
  127. package/ueditor/dialogs/template/config.js +42 -0
  128. package/ueditor/dialogs/template/images/bg.gif +0 -0
  129. package/ueditor/dialogs/template/images/pre0.png +0 -0
  130. package/ueditor/dialogs/template/images/pre1.png +0 -0
  131. package/ueditor/dialogs/template/images/pre2.png +0 -0
  132. package/ueditor/dialogs/template/images/pre3.png +0 -0
  133. package/ueditor/dialogs/template/images/pre4.png +0 -0
  134. package/ueditor/dialogs/template/template.css +18 -0
  135. package/ueditor/dialogs/template/template.html +26 -0
  136. package/ueditor/dialogs/template/template.js +53 -0
  137. package/ueditor/dialogs/video/images/bg.png +0 -0
  138. package/ueditor/dialogs/video/images/center_focus.jpg +0 -0
  139. package/ueditor/dialogs/video/images/file-icons.gif +0 -0
  140. package/ueditor/dialogs/video/images/file-icons.png +0 -0
  141. package/ueditor/dialogs/video/images/icons.gif +0 -0
  142. package/ueditor/dialogs/video/images/icons.png +0 -0
  143. package/ueditor/dialogs/video/images/image.png +0 -0
  144. package/ueditor/dialogs/video/images/left_focus.jpg +0 -0
  145. package/ueditor/dialogs/video/images/none_focus.jpg +0 -0
  146. package/ueditor/dialogs/video/images/progress.png +0 -0
  147. package/ueditor/dialogs/video/images/right_focus.jpg +0 -0
  148. package/ueditor/dialogs/video/images/success.gif +0 -0
  149. package/ueditor/dialogs/video/images/success.png +0 -0
  150. package/ueditor/dialogs/video/video.css +635 -0
  151. package/ueditor/dialogs/video/video.html +86 -0
  152. package/ueditor/dialogs/video/video.js +791 -0
  153. package/ueditor/dialogs/webapp/webapp.html +53 -0
  154. package/ueditor/dialogs/wordimage/fClipboard_ueditor.swf +0 -0
  155. package/ueditor/dialogs/wordimage/imageUploader.swf +0 -0
  156. package/ueditor/dialogs/wordimage/tangram.js +1495 -0
  157. package/ueditor/dialogs/wordimage/wordimage.html +111 -0
  158. package/ueditor/dialogs/wordimage/wordimage.js +157 -0
  159. package/ueditor/lang/en/en.js +684 -0
  160. package/ueditor/lang/en/images/addimage.png +0 -0
  161. package/ueditor/lang/en/images/alldeletebtnhoverskin.png +0 -0
  162. package/ueditor/lang/en/images/alldeletebtnupskin.png +0 -0
  163. package/ueditor/lang/en/images/background.png +0 -0
  164. package/ueditor/lang/en/images/button.png +0 -0
  165. package/ueditor/lang/en/images/copy.png +0 -0
  166. package/ueditor/lang/en/images/deletedisable.png +0 -0
  167. package/ueditor/lang/en/images/deleteenable.png +0 -0
  168. package/ueditor/lang/en/images/listbackground.png +0 -0
  169. package/ueditor/lang/en/images/localimage.png +0 -0
  170. package/ueditor/lang/en/images/music.png +0 -0
  171. package/ueditor/lang/en/images/rotateleftdisable.png +0 -0
  172. package/ueditor/lang/en/images/rotateleftenable.png +0 -0
  173. package/ueditor/lang/en/images/rotaterightdisable.png +0 -0
  174. package/ueditor/lang/en/images/rotaterightenable.png +0 -0
  175. package/ueditor/lang/en/images/upload.png +0 -0
  176. package/ueditor/lang/zh-cn/images/copy.png +0 -0
  177. package/ueditor/lang/zh-cn/images/localimage.png +0 -0
  178. package/ueditor/lang/zh-cn/images/music.png +0 -0
  179. package/ueditor/lang/zh-cn/images/upload.png +0 -0
  180. package/ueditor/lang/zh-cn/zh-cn.js +669 -0
  181. package/ueditor/official-demo.html +175 -0
  182. package/ueditor/themes/default/css/ueditor.css +1906 -0
  183. package/ueditor/themes/default/css/ueditor.min.css +8 -0
  184. package/ueditor/themes/default/dialogbase.css +100 -0
  185. package/ueditor/themes/default/images/anchor.gif +0 -0
  186. package/ueditor/themes/default/images/arrow.png +0 -0
  187. package/ueditor/themes/default/images/arrow_down.png +0 -0
  188. package/ueditor/themes/default/images/arrow_up.png +0 -0
  189. package/ueditor/themes/default/images/button-bg.gif +0 -0
  190. package/ueditor/themes/default/images/cancelbutton.gif +0 -0
  191. package/ueditor/themes/default/images/charts.png +0 -0
  192. package/ueditor/themes/default/images/cursor_h.gif +0 -0
  193. package/ueditor/themes/default/images/cursor_h.png +0 -0
  194. package/ueditor/themes/default/images/cursor_v.gif +0 -0
  195. package/ueditor/themes/default/images/cursor_v.png +0 -0
  196. package/ueditor/themes/default/images/dialog-title-bg.png +0 -0
  197. package/ueditor/themes/default/images/filescan.png +0 -0
  198. package/ueditor/themes/default/images/highlighted.gif +0 -0
  199. package/ueditor/themes/default/images/icons-all.gif +0 -0
  200. package/ueditor/themes/default/images/icons.gif +0 -0
  201. package/ueditor/themes/default/images/icons.png +0 -0
  202. package/ueditor/themes/default/images/img-cracked.png +0 -0
  203. package/ueditor/themes/default/images/loaderror.png +0 -0
  204. package/ueditor/themes/default/images/loading.gif +0 -0
  205. package/ueditor/themes/default/images/lock.gif +0 -0
  206. package/ueditor/themes/default/images/neweditor-tab-bg.png +0 -0
  207. package/ueditor/themes/default/images/pagebreak.gif +0 -0
  208. package/ueditor/themes/default/images/scale.png +0 -0
  209. package/ueditor/themes/default/images/sortable.png +0 -0
  210. package/ueditor/themes/default/images/spacer.gif +0 -0
  211. package/ueditor/themes/default/images/sparator_v.png +0 -0
  212. package/ueditor/themes/default/images/table-cell-align.png +0 -0
  213. package/ueditor/themes/default/images/tangram-colorpicker.png +0 -0
  214. package/ueditor/themes/default/images/toolbar_bg.png +0 -0
  215. package/ueditor/themes/default/images/unhighlighted.gif +0 -0
  216. package/ueditor/themes/default/images/upload.png +0 -0
  217. package/ueditor/themes/default/images/videologo.gif +0 -0
  218. package/ueditor/themes/default/images/word.gif +0 -0
  219. package/ueditor/themes/default/images/wordpaste.png +0 -0
  220. package/ueditor/themes/iframe.css +1 -0
  221. package/ueditor/third-party/SyntaxHighlighter/shCore.js +3655 -0
  222. package/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css +1 -0
  223. package/ueditor/third-party/codemirror/codemirror.css +104 -0
  224. package/ueditor/third-party/codemirror/codemirror.js +3581 -0
  225. package/ueditor/third-party/highcharts/adapters/mootools-adapter.js +13 -0
  226. package/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js +313 -0
  227. package/ueditor/third-party/highcharts/adapters/prototype-adapter.js +15 -0
  228. package/ueditor/third-party/highcharts/adapters/prototype-adapter.src.js +316 -0
  229. package/ueditor/third-party/highcharts/adapters/standalone-framework.js +17 -0
  230. package/ueditor/third-party/highcharts/adapters/standalone-framework.src.js +583 -0
  231. package/ueditor/third-party/highcharts/highcharts-more.js +50 -0
  232. package/ueditor/third-party/highcharts/highcharts-more.src.js +2430 -0
  233. package/ueditor/third-party/highcharts/highcharts.js +283 -0
  234. package/ueditor/third-party/highcharts/highcharts.src.js +16974 -0
  235. package/ueditor/third-party/highcharts/modules/annotations.js +7 -0
  236. package/ueditor/third-party/highcharts/modules/annotations.src.js +401 -0
  237. package/ueditor/third-party/highcharts/modules/canvas-tools.js +133 -0
  238. package/ueditor/third-party/highcharts/modules/canvas-tools.src.js +3113 -0
  239. package/ueditor/third-party/highcharts/modules/data.js +17 -0
  240. package/ueditor/third-party/highcharts/modules/data.src.js +582 -0
  241. package/ueditor/third-party/highcharts/modules/drilldown.js +11 -0
  242. package/ueditor/third-party/highcharts/modules/drilldown.src.js +447 -0
  243. package/ueditor/third-party/highcharts/modules/exporting.js +22 -0
  244. package/ueditor/third-party/highcharts/modules/exporting.src.js +709 -0
  245. package/ueditor/third-party/highcharts/modules/funnel.js +12 -0
  246. package/ueditor/third-party/highcharts/modules/funnel.src.js +289 -0
  247. package/ueditor/third-party/highcharts/modules/heatmap.js +1 -0
  248. package/ueditor/third-party/highcharts/modules/heatmap.src.js +53 -0
  249. package/ueditor/third-party/highcharts/modules/map.js +27 -0
  250. package/ueditor/third-party/highcharts/modules/map.src.js +1002 -0
  251. package/ueditor/third-party/highcharts/modules/no-data-to-display.js +12 -0
  252. package/ueditor/third-party/highcharts/modules/no-data-to-display.src.js +128 -0
  253. package/ueditor/third-party/highcharts/themes/dark-blue.js +254 -0
  254. package/ueditor/third-party/highcharts/themes/dark-green.js +255 -0
  255. package/ueditor/third-party/highcharts/themes/gray.js +257 -0
  256. package/ueditor/third-party/highcharts/themes/grid.js +103 -0
  257. package/ueditor/third-party/highcharts/themes/skies.js +89 -0
  258. package/ueditor/third-party/jquery-1.10.2.js +9789 -0
  259. package/ueditor/third-party/jquery-1.10.2.min.js +6 -0
  260. package/ueditor/third-party/jquery-1.10.2.min.map +1 -0
  261. package/ueditor/third-party/snapscreen/UEditorSnapscreen.exe +0 -0
  262. package/ueditor/third-party/video-js/font/vjs.eot +0 -0
  263. package/ueditor/third-party/video-js/font/vjs.svg +65 -0
  264. package/ueditor/third-party/video-js/font/vjs.ttf +0 -0
  265. package/ueditor/third-party/video-js/font/vjs.woff +0 -0
  266. package/ueditor/third-party/video-js/video-js.css +766 -0
  267. package/ueditor/third-party/video-js/video-js.min.css +5 -0
  268. package/ueditor/third-party/video-js/video-js.swf +0 -0
  269. package/ueditor/third-party/video-js/video.dev.js +7108 -0
  270. package/ueditor/third-party/video-js/video.js +129 -0
  271. package/ueditor/third-party/webuploader/Uploader.swf +0 -0
  272. package/ueditor/third-party/webuploader/webuploader.css +28 -0
  273. package/ueditor/third-party/webuploader/webuploader.custom.js +5670 -0
  274. package/ueditor/third-party/webuploader/webuploader.custom.min.js +2 -0
  275. package/ueditor/third-party/webuploader/webuploader.flashonly.js +4176 -0
  276. package/ueditor/third-party/webuploader/webuploader.flashonly.min.js +2 -0
  277. package/ueditor/third-party/webuploader/webuploader.html5only.js +5559 -0
  278. package/ueditor/third-party/webuploader/webuploader.html5only.min.js +2 -0
  279. package/ueditor/third-party/webuploader/webuploader.js +6733 -0
  280. package/ueditor/third-party/webuploader/webuploader.min.js +2 -0
  281. package/ueditor/third-party/webuploader/webuploader.withoutimage.js +4593 -0
  282. package/ueditor/third-party/webuploader/webuploader.withoutimage.min.js +2 -0
  283. package/ueditor/third-party/zeroclipboard/ZeroClipboard.js +1256 -0
  284. package/ueditor/third-party/zeroclipboard/ZeroClipboard.min.js +9 -0
  285. package/ueditor/third-party/zeroclipboard/ZeroClipboard.swf +0 -0
  286. package/ueditor/ueditor.all.js +32931 -0
  287. package/ueditor/ueditor.all.min.js +17 -0
  288. package/ueditor/ueditor.config.js +507 -0
  289. package/ueditor/ueditor.parse.js +1230 -0
  290. package/ueditor/ueditor.parse.min.js +5 -0
  291. package/vite.ts +87 -0
@@ -0,0 +1,791 @@
1
+ /**
2
+ * Created by JetBrains PhpStorm.
3
+ * User: taoqili
4
+ * Date: 12-2-20
5
+ * Time: 上午11:19
6
+ * To change this template use File | Settings | File Templates.
7
+ */
8
+
9
+ (function(){
10
+
11
+ var video = {},
12
+ uploadVideoList = [],
13
+ isModifyUploadVideo = false,
14
+ uploadFile;
15
+
16
+ window.onload = function(){
17
+ $focus($G("videoUrl"));
18
+ initTabs();
19
+ initVideo();
20
+ initUpload();
21
+ };
22
+
23
+ /* 初始化tab标签 */
24
+ function initTabs(){
25
+ var tabs = $G('tabHeads').children;
26
+ for (var i = 0; i < tabs.length; i++) {
27
+ domUtils.on(tabs[i], "click", function (e) {
28
+ var j, bodyId, target = e.target || e.srcElement;
29
+ for (j = 0; j < tabs.length; j++) {
30
+ bodyId = tabs[j].getAttribute('data-content-id');
31
+ if(tabs[j] == target){
32
+ domUtils.addClass(tabs[j], 'focus');
33
+ domUtils.addClass($G(bodyId), 'focus');
34
+ }else {
35
+ domUtils.removeClasses(tabs[j], 'focus');
36
+ domUtils.removeClasses($G(bodyId), 'focus');
37
+ }
38
+ }
39
+ });
40
+ }
41
+ }
42
+
43
+ function initVideo(){
44
+ createAlignButton( ["videoFloat", "upload_alignment"] );
45
+ addUrlChangeListener($G("videoUrl"));
46
+ addOkListener();
47
+
48
+ //编辑视频时初始化相关信息
49
+ (function(){
50
+ var img = editor.selection.getRange().getClosedNode(),url;
51
+ if(img && img.className){
52
+ var hasFakedClass = (img.className == "edui-faked-video"),
53
+ hasUploadClass = img.className.indexOf("edui-upload-video")!=-1;
54
+ if(hasFakedClass || hasUploadClass) {
55
+ $G("videoUrl").value = url = img.getAttribute("_url");
56
+ $G("videoWidth").value = img.width;
57
+ $G("videoHeight").value = img.height;
58
+ var align = domUtils.getComputedStyle(img,"float"),
59
+ parentAlign = domUtils.getComputedStyle(img.parentNode,"text-align");
60
+ updateAlignButton(parentAlign==="center"?"center":align);
61
+ }
62
+ if(hasUploadClass) {
63
+ isModifyUploadVideo = true;
64
+ }
65
+ }
66
+ createPreviewVideo(url);
67
+ })();
68
+ }
69
+
70
+ /**
71
+ * 监听确认和取消两个按钮事件,用户执行插入或者清空正在播放的视频实例操作
72
+ */
73
+ function addOkListener(){
74
+ dialog.onok = function(){
75
+ $G("preview").innerHTML = "";
76
+ var currentTab = findFocus("tabHeads","tabSrc");
77
+ switch(currentTab){
78
+ case "video":
79
+ return insertSingle();
80
+ break;
81
+ case "videoSearch":
82
+ return insertSearch("searchList");
83
+ break;
84
+ case "upload":
85
+ return insertUpload();
86
+ break;
87
+ }
88
+ };
89
+ dialog.oncancel = function(){
90
+ $G("preview").innerHTML = "";
91
+ };
92
+ }
93
+
94
+ /**
95
+ * 依据传入的align值更新按钮信息
96
+ * @param align
97
+ */
98
+ function updateAlignButton( align ) {
99
+ var aligns = $G( "videoFloat" ).children;
100
+ for ( var i = 0, ci; ci = aligns[i++]; ) {
101
+ if ( ci.getAttribute( "name" ) == align ) {
102
+ if ( ci.className !="focus" ) {
103
+ ci.className = "focus";
104
+ }
105
+ } else {
106
+ if ( ci.className =="focus" ) {
107
+ ci.className = "";
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ /**
114
+ * 将单个视频信息插入编辑器中
115
+ */
116
+ function insertSingle(){
117
+ var width = $G("videoWidth"),
118
+ height = $G("videoHeight"),
119
+ url=$G('videoUrl').value,
120
+ align = findFocus("videoFloat","name");
121
+ if(!url) return false;
122
+ if ( !checkNum( [width, height] ) ) return false;
123
+ editor.execCommand('insertvideo', {
124
+ url: convert_url(url),
125
+ width: width.value,
126
+ height: height.value,
127
+ align: align
128
+ }, isModifyUploadVideo ? 'upload':null);
129
+ }
130
+
131
+ /**
132
+ * 将元素id下的所有代表视频的图片插入编辑器中
133
+ * @param id
134
+ */
135
+ function insertSearch(id){
136
+ var imgs = domUtils.getElementsByTagName($G(id),"img"),
137
+ videoObjs=[];
138
+ for(var i=0,img; img=imgs[i++];){
139
+ if(img.getAttribute("selected")){
140
+ videoObjs.push({
141
+ url:img.getAttribute("ue_video_url"),
142
+ width:420,
143
+ height:280,
144
+ align:"none"
145
+ });
146
+ }
147
+ }
148
+ editor.execCommand('insertvideo',videoObjs);
149
+ }
150
+
151
+ /**
152
+ * 找到id下具有focus类的节点并返回该节点下的某个属性
153
+ * @param id
154
+ * @param returnProperty
155
+ */
156
+ function findFocus( id, returnProperty ) {
157
+ var tabs = $G( id ).children,
158
+ property;
159
+ for ( var i = 0, ci; ci = tabs[i++]; ) {
160
+ if ( ci.className=="focus" ) {
161
+ property = ci.getAttribute( returnProperty );
162
+ break;
163
+ }
164
+ }
165
+ return property;
166
+ }
167
+ function convert_url(url){
168
+ if ( !url ) return '';
169
+ url = utils.trim(url)
170
+ .replace(/v\.youku\.com\/v_show\/id_([\w\-=]+)\.html/i, 'player.youku.com/player.php/sid/$1/v.swf')
171
+ .replace(/(www\.)?youtube\.com\/watch\?v=([\w\-]+)/i, "www.youtube.com/v/$2")
172
+ .replace(/youtu.be\/(\w+)$/i, "www.youtube.com/v/$1")
173
+ .replace(/v\.ku6\.com\/.+\/([\w\.]+)\.html.*$/i, "player.ku6.com/refer/$1/v.swf")
174
+ .replace(/www\.56\.com\/u\d+\/v_([\w\-]+)\.html/i, "player.56.com/v_$1.swf")
175
+ .replace(/www.56.com\/w\d+\/play_album\-aid\-\d+_vid\-([^.]+)\.html/i, "player.56.com/v_$1.swf")
176
+ .replace(/v\.pps\.tv\/play_([\w]+)\.html.*$/i, "player.pps.tv/player/sid/$1/v.swf")
177
+ .replace(/www\.letv\.com\/ptv\/vplay\/([\d]+)\.html.*$/i, "i7.imgs.letv.com/player/swfPlayer.swf?id=$1&autoplay=0")
178
+ .replace(/www\.tudou\.com\/programs\/view\/([\w\-]+)\/?/i, "www.tudou.com/v/$1")
179
+ .replace(/v\.qq\.com\/cover\/[\w]+\/[\w]+\/([\w]+)\.html/i, "static.video.qq.com/TPout.swf?vid=$1")
180
+ .replace(/v\.qq\.com\/.+[\?\&]vid=([^&]+).*$/i, "static.video.qq.com/TPout.swf?vid=$1")
181
+ .replace(/my\.tv\.sohu\.com\/[\w]+\/[\d]+\/([\d]+)\.shtml.*$/i, "share.vrs.sohu.com/my/v.swf&id=$1");
182
+
183
+ return url;
184
+ }
185
+
186
+ /**
187
+ * 检测传入的所有input框中输入的长宽是否是正数
188
+ * @param nodes input框集合,
189
+ */
190
+ function checkNum( nodes ) {
191
+ for ( var i = 0, ci; ci = nodes[i++]; ) {
192
+ var value = ci.value;
193
+ if ( !isNumber( value ) && value) {
194
+ alert( lang.numError );
195
+ ci.value = "";
196
+ ci.focus();
197
+ return false;
198
+ }
199
+ }
200
+ return true;
201
+ }
202
+
203
+ /**
204
+ * 数字判断
205
+ * @param value
206
+ */
207
+ function isNumber( value ) {
208
+ return /(0|^[1-9]\d*$)/.test( value );
209
+ }
210
+
211
+ /**
212
+ * 创建图片浮动选择按钮
213
+ * @param ids
214
+ */
215
+ function createAlignButton( ids ) {
216
+ for ( var i = 0, ci; ci = ids[i++]; ) {
217
+ var floatContainer = $G( ci ),
218
+ nameMaps = {"none":lang['default'], "left":lang.floatLeft, "right":lang.floatRight, "center":lang.block};
219
+ for ( var j in nameMaps ) {
220
+ var div = document.createElement( "div" );
221
+ div.setAttribute( "name", j );
222
+ if ( j == "none" ) div.className="focus";
223
+ div.style.cssText = "background:url(images/" + j + "_focus.jpg);";
224
+ div.setAttribute( "title", nameMaps[j] );
225
+ floatContainer.appendChild( div );
226
+ }
227
+ switchSelect( ci );
228
+ }
229
+ }
230
+
231
+ /**
232
+ * 选择切换
233
+ * @param selectParentId
234
+ */
235
+ function switchSelect( selectParentId ) {
236
+ var selects = $G( selectParentId ).children;
237
+ for ( var i = 0, ci; ci = selects[i++]; ) {
238
+ domUtils.on( ci, "click", function () {
239
+ for ( var j = 0, cj; cj = selects[j++]; ) {
240
+ cj.className = "";
241
+ cj.removeAttribute && cj.removeAttribute( "class" );
242
+ }
243
+ this.className = "focus";
244
+ } )
245
+ }
246
+ }
247
+
248
+ /**
249
+ * 监听url改变事件
250
+ * @param url
251
+ */
252
+ function addUrlChangeListener(url){
253
+ if (browser.ie) {
254
+ url.onpropertychange = function () {
255
+ createPreviewVideo( this.value );
256
+ }
257
+ } else {
258
+ url.addEventListener( "input", function () {
259
+ createPreviewVideo( this.value );
260
+ }, false );
261
+ }
262
+ }
263
+
264
+ /**
265
+ * 根据url生成视频预览
266
+ * @param url
267
+ */
268
+ function createPreviewVideo(url){
269
+ if ( !url )return;
270
+
271
+ var conUrl = convert_url(url);
272
+
273
+ $G("preview").innerHTML = '<div class="previewMsg"><span>'+lang.urlError+'</span></div>'+
274
+ '<embed class="previewVideo" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"' +
275
+ ' src="' + conUrl + '"' +
276
+ ' width="' + 420 + '"' +
277
+ ' height="' + 280 + '"' +
278
+ ' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >' +
279
+ '</embed>';
280
+ }
281
+
282
+
283
+ /* 插入上传视频 */
284
+ function insertUpload(){
285
+ var videoObjs=[],
286
+ uploadDir = editor.getOpt('videoUrlPrefix'),
287
+ width = $G('upload_width').value || 420,
288
+ height = $G('upload_height').value || 280,
289
+ align = findFocus("upload_alignment","name") || 'none';
290
+ for(var key in uploadVideoList) {
291
+ var file = uploadVideoList[key];
292
+ videoObjs.push({
293
+ url: uploadDir + file.url,
294
+ width:width,
295
+ height:height,
296
+ align:align
297
+ });
298
+ }
299
+
300
+ var count = uploadFile.getQueueCount();
301
+ if (count) {
302
+ $('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>');
303
+ return false;
304
+ } else {
305
+ editor.execCommand('insertvideo', videoObjs, 'upload');
306
+ }
307
+ }
308
+
309
+ /*初始化上传标签*/
310
+ function initUpload(){
311
+ uploadFile = new UploadFile('queueList');
312
+ }
313
+
314
+
315
+ /* 上传附件 */
316
+ function UploadFile(target) {
317
+ this.$wrap = target.constructor == String ? $('#' + target) : $(target);
318
+ this.init();
319
+ }
320
+ UploadFile.prototype = {
321
+ init: function () {
322
+ this.fileList = [];
323
+ this.initContainer();
324
+ this.initUploader();
325
+ },
326
+ initContainer: function () {
327
+ this.$queue = this.$wrap.find('.filelist');
328
+ },
329
+ /* 初始化容器 */
330
+ initUploader: function () {
331
+ var _this = this,
332
+ $ = jQuery, // just in case. Make sure it's not an other libaray.
333
+ $wrap = _this.$wrap,
334
+ // 图片容器
335
+ $queue = $wrap.find('.filelist'),
336
+ // 状态栏,包括进度和控制按钮
337
+ $statusBar = $wrap.find('.statusBar'),
338
+ // 文件总体选择信息。
339
+ $info = $statusBar.find('.info'),
340
+ // 上传按钮
341
+ $upload = $wrap.find('.uploadBtn'),
342
+ // 上传按钮
343
+ $filePickerBtn = $wrap.find('.filePickerBtn'),
344
+ // 上传按钮
345
+ $filePickerBlock = $wrap.find('.filePickerBlock'),
346
+ // 没选择文件之前的内容。
347
+ $placeHolder = $wrap.find('.placeholder'),
348
+ // 总体进度条
349
+ $progress = $statusBar.find('.progress').hide(),
350
+ // 添加的文件数量
351
+ fileCount = 0,
352
+ // 添加的文件总大小
353
+ fileSize = 0,
354
+ // 优化retina, 在retina下这个值是2
355
+ ratio = window.devicePixelRatio || 1,
356
+ // 缩略图大小
357
+ thumbnailWidth = 113 * ratio,
358
+ thumbnailHeight = 113 * ratio,
359
+ // 可能有pedding, ready, uploading, confirm, done.
360
+ state = '',
361
+ // 所有文件的进度信息,key为file id
362
+ percentages = {},
363
+ supportTransition = (function () {
364
+ var s = document.createElement('p').style,
365
+ r = 'transition' in s ||
366
+ 'WebkitTransition' in s ||
367
+ 'MozTransition' in s ||
368
+ 'msTransition' in s ||
369
+ 'OTransition' in s;
370
+ s = null;
371
+ return r;
372
+ })(),
373
+ // WebUploader实例
374
+ uploader,
375
+ actionUrl = editor.getActionUrl(editor.getOpt('videoActionName')),
376
+ fileMaxSize = editor.getOpt('videoMaxSize'),
377
+ acceptExtensions = (editor.getOpt('videoAllowFiles') || []).join('').replace(/\./g, ',').replace(/^[,]/, '');;
378
+
379
+ if (!WebUploader.Uploader.support()) {
380
+ $('#filePickerReady').after($('<div>').html(lang.errorNotSupport)).hide();
381
+ return;
382
+ } else if (!editor.getOpt('videoActionName')) {
383
+ $('#filePickerReady').after($('<div>').html(lang.errorLoadConfig)).hide();
384
+ return;
385
+ }
386
+
387
+ uploader = _this.uploader = WebUploader.create({
388
+ pick: {
389
+ id: '#filePickerReady',
390
+ label: lang.uploadSelectFile
391
+ },
392
+ swf: '../../third-party/webuploader/Uploader.swf',
393
+ server: actionUrl,
394
+ fileVal: editor.getOpt('videoFieldName'),
395
+ duplicate: true,
396
+ fileSingleSizeLimit: fileMaxSize,
397
+ compress: false
398
+ });
399
+ uploader.addButton({
400
+ id: '#filePickerBlock'
401
+ });
402
+ uploader.addButton({
403
+ id: '#filePickerBtn',
404
+ label: lang.uploadAddFile
405
+ });
406
+
407
+ setState('pedding');
408
+
409
+ // 当有文件添加进来时执行,负责view的创建
410
+ function addFile(file) {
411
+ var $li = $('<li id="' + file.id + '">' +
412
+ '<p class="title">' + file.name + '</p>' +
413
+ '<p class="imgWrap"></p>' +
414
+ '<p class="progress"><span></span></p>' +
415
+ '</li>'),
416
+
417
+ $btns = $('<div class="file-panel">' +
418
+ '<span class="cancel">' + lang.uploadDelete + '</span>' +
419
+ '<span class="rotateRight">' + lang.uploadTurnRight + '</span>' +
420
+ '<span class="rotateLeft">' + lang.uploadTurnLeft + '</span></div>').appendTo($li),
421
+ $prgress = $li.find('p.progress span'),
422
+ $wrap = $li.find('p.imgWrap'),
423
+ $info = $('<p class="error"></p>').hide().appendTo($li),
424
+
425
+ showError = function (code) {
426
+ switch (code) {
427
+ case 'exceed_size':
428
+ text = lang.errorExceedSize;
429
+ break;
430
+ case 'interrupt':
431
+ text = lang.errorInterrupt;
432
+ break;
433
+ case 'http':
434
+ text = lang.errorHttp;
435
+ break;
436
+ case 'not_allow_type':
437
+ text = lang.errorFileType;
438
+ break;
439
+ default:
440
+ text = lang.errorUploadRetry;
441
+ break;
442
+ }
443
+ $info.text(text).show();
444
+ };
445
+
446
+ if (file.getStatus() === 'invalid') {
447
+ showError(file.statusText);
448
+ } else {
449
+ $wrap.text(lang.uploadPreview);
450
+ if ('|png|jpg|jpeg|bmp|gif|'.indexOf('|'+file.ext.toLowerCase()+'|') == -1) {
451
+ $wrap.empty().addClass('notimage').append('<i class="file-preview file-type-' + file.ext.toLowerCase() + '"></i>' +
452
+ '<span class="file-title">' + file.name + '</span>');
453
+ } else {
454
+ if (browser.ie && browser.version <= 7) {
455
+ $wrap.text(lang.uploadNoPreview);
456
+ } else {
457
+ uploader.makeThumb(file, function (error, src) {
458
+ if (error || !src || (/^data:/.test(src) && browser.ie && browser.version <= 7)) {
459
+ $wrap.text(lang.uploadNoPreview);
460
+ } else {
461
+ var $img = $('<img src="' + src + '">');
462
+ $wrap.empty().append($img);
463
+ $img.on('error', function () {
464
+ $wrap.text(lang.uploadNoPreview);
465
+ });
466
+ }
467
+ }, thumbnailWidth, thumbnailHeight);
468
+ }
469
+ }
470
+ percentages[ file.id ] = [ file.size, 0 ];
471
+ file.rotation = 0;
472
+
473
+ /* 检查文件格式 */
474
+ if (!file.ext || acceptExtensions.indexOf(file.ext.toLowerCase()) == -1) {
475
+ showError('not_allow_type');
476
+ uploader.removeFile(file);
477
+ }
478
+ }
479
+
480
+ file.on('statuschange', function (cur, prev) {
481
+ if (prev === 'progress') {
482
+ $prgress.hide().width(0);
483
+ } else if (prev === 'queued') {
484
+ $li.off('mouseenter mouseleave');
485
+ $btns.remove();
486
+ }
487
+ // 成功
488
+ if (cur === 'error' || cur === 'invalid') {
489
+ showError(file.statusText);
490
+ percentages[ file.id ][ 1 ] = 1;
491
+ } else if (cur === 'interrupt') {
492
+ showError('interrupt');
493
+ } else if (cur === 'queued') {
494
+ percentages[ file.id ][ 1 ] = 0;
495
+ } else if (cur === 'progress') {
496
+ $info.hide();
497
+ $prgress.css('display', 'block');
498
+ } else if (cur === 'complete') {
499
+ }
500
+
501
+ $li.removeClass('state-' + prev).addClass('state-' + cur);
502
+ });
503
+
504
+ $li.on('mouseenter', function () {
505
+ $btns.stop().animate({height: 30});
506
+ });
507
+ $li.on('mouseleave', function () {
508
+ $btns.stop().animate({height: 0});
509
+ });
510
+
511
+ $btns.on('click', 'span', function () {
512
+ var index = $(this).index(),
513
+ deg;
514
+
515
+ switch (index) {
516
+ case 0:
517
+ uploader.removeFile(file);
518
+ return;
519
+ case 1:
520
+ file.rotation += 90;
521
+ break;
522
+ case 2:
523
+ file.rotation -= 90;
524
+ break;
525
+ }
526
+
527
+ if (supportTransition) {
528
+ deg = 'rotate(' + file.rotation + 'deg)';
529
+ $wrap.css({
530
+ '-webkit-transform': deg,
531
+ '-mos-transform': deg,
532
+ '-o-transform': deg,
533
+ 'transform': deg
534
+ });
535
+ } else {
536
+ $wrap.css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + (~~((file.rotation / 90) % 4 + 4) % 4) + ')');
537
+ }
538
+
539
+ });
540
+
541
+ $li.insertBefore($filePickerBlock);
542
+ }
543
+
544
+ // 负责view的销毁
545
+ function removeFile(file) {
546
+ var $li = $('#' + file.id);
547
+ delete percentages[ file.id ];
548
+ updateTotalProgress();
549
+ $li.off().find('.file-panel').off().end().remove();
550
+ }
551
+
552
+ function updateTotalProgress() {
553
+ var loaded = 0,
554
+ total = 0,
555
+ spans = $progress.children(),
556
+ percent;
557
+
558
+ $.each(percentages, function (k, v) {
559
+ total += v[ 0 ];
560
+ loaded += v[ 0 ] * v[ 1 ];
561
+ });
562
+
563
+ percent = total ? loaded / total : 0;
564
+
565
+ spans.eq(0).text(Math.round(percent * 100) + '%');
566
+ spans.eq(1).css('width', Math.round(percent * 100) + '%');
567
+ updateStatus();
568
+ }
569
+
570
+ function setState(val, files) {
571
+
572
+ if (val != state) {
573
+
574
+ var stats = uploader.getStats();
575
+
576
+ $upload.removeClass('state-' + state);
577
+ $upload.addClass('state-' + val);
578
+
579
+ switch (val) {
580
+
581
+ /* 未选择文件 */
582
+ case 'pedding':
583
+ $queue.addClass('element-invisible');
584
+ $statusBar.addClass('element-invisible');
585
+ $placeHolder.removeClass('element-invisible');
586
+ $progress.hide(); $info.hide();
587
+ uploader.refresh();
588
+ break;
589
+
590
+ /* 可以开始上传 */
591
+ case 'ready':
592
+ $placeHolder.addClass('element-invisible');
593
+ $queue.removeClass('element-invisible');
594
+ $statusBar.removeClass('element-invisible');
595
+ $progress.hide(); $info.show();
596
+ $upload.text(lang.uploadStart);
597
+ uploader.refresh();
598
+ break;
599
+
600
+ /* 上传中 */
601
+ case 'uploading':
602
+ $progress.show(); $info.hide();
603
+ $upload.text(lang.uploadPause);
604
+ break;
605
+
606
+ /* 暂停上传 */
607
+ case 'paused':
608
+ $progress.show(); $info.hide();
609
+ $upload.text(lang.uploadContinue);
610
+ break;
611
+
612
+ case 'confirm':
613
+ $progress.show(); $info.hide();
614
+ $upload.text(lang.uploadStart);
615
+
616
+ stats = uploader.getStats();
617
+ if (stats.successNum && !stats.uploadFailNum) {
618
+ setState('finish');
619
+ return;
620
+ }
621
+ break;
622
+
623
+ case 'finish':
624
+ $progress.hide(); $info.show();
625
+ if (stats.uploadFailNum) {
626
+ $upload.text(lang.uploadRetry);
627
+ } else {
628
+ $upload.text(lang.uploadStart);
629
+ }
630
+ break;
631
+ }
632
+
633
+ state = val;
634
+ updateStatus();
635
+
636
+ }
637
+
638
+ if (!_this.getQueueCount()) {
639
+ $upload.addClass('disabled')
640
+ } else {
641
+ $upload.removeClass('disabled')
642
+ }
643
+
644
+ }
645
+
646
+ function updateStatus() {
647
+ var text = '', stats;
648
+
649
+ if (state === 'ready') {
650
+ text = lang.updateStatusReady.replace('_', fileCount).replace('_KB', WebUploader.formatSize(fileSize));
651
+ } else if (state === 'confirm') {
652
+ stats = uploader.getStats();
653
+ if (stats.uploadFailNum) {
654
+ text = lang.updateStatusConfirm.replace('_', stats.successNum).replace('_', stats.successNum);
655
+ }
656
+ } else {
657
+ stats = uploader.getStats();
658
+ text = lang.updateStatusFinish.replace('_', fileCount).
659
+ replace('_KB', WebUploader.formatSize(fileSize)).
660
+ replace('_', stats.successNum);
661
+
662
+ if (stats.uploadFailNum) {
663
+ text += lang.updateStatusError.replace('_', stats.uploadFailNum);
664
+ }
665
+ }
666
+
667
+ $info.html(text);
668
+ }
669
+
670
+ uploader.on('fileQueued', function (file) {
671
+ fileCount++;
672
+ fileSize += file.size;
673
+
674
+ if (fileCount === 1) {
675
+ $placeHolder.addClass('element-invisible');
676
+ $statusBar.show();
677
+ }
678
+
679
+ addFile(file);
680
+ });
681
+
682
+ uploader.on('fileDequeued', function (file) {
683
+ fileCount--;
684
+ fileSize -= file.size;
685
+
686
+ removeFile(file);
687
+ updateTotalProgress();
688
+ });
689
+
690
+ uploader.on('filesQueued', function (file) {
691
+ if (!uploader.isInProgress() && (state == 'pedding' || state == 'finish' || state == 'confirm' || state == 'ready')) {
692
+ setState('ready');
693
+ }
694
+ updateTotalProgress();
695
+ });
696
+
697
+ uploader.on('all', function (type, files) {
698
+ switch (type) {
699
+ case 'uploadFinished':
700
+ setState('confirm', files);
701
+ break;
702
+ case 'startUpload':
703
+ /* 添加额外的GET参数 */
704
+ var params = utils.serializeParam(editor.queryCommandValue('serverparam')) || '',
705
+ url = utils.formatUrl(actionUrl + (actionUrl.indexOf('?') == -1 ? '?':'&') + 'encode=utf-8&' + params);
706
+ uploader.option('server', url);
707
+ setState('uploading', files);
708
+ break;
709
+ case 'stopUpload':
710
+ setState('paused', files);
711
+ break;
712
+ }
713
+ });
714
+
715
+ uploader.on('uploadBeforeSend', function (file, data, header) {
716
+ //这里可以通过data对象添加POST参数
717
+ if (actionUrl.toLowerCase().indexOf('jsp') != -1) {
718
+ header['X_Requested_With'] = 'XMLHttpRequest';
719
+ }
720
+ });
721
+
722
+ uploader.on('uploadProgress', function (file, percentage) {
723
+ var $li = $('#' + file.id),
724
+ $percent = $li.find('.progress span');
725
+
726
+ $percent.css('width', percentage * 100 + '%');
727
+ percentages[ file.id ][ 1 ] = percentage;
728
+ updateTotalProgress();
729
+ });
730
+
731
+ uploader.on('uploadSuccess', function (file, ret) {
732
+ var $file = $('#' + file.id);
733
+ try {
734
+ var responseText = (ret._raw || ret),
735
+ json = utils.str2json(responseText);
736
+ if (json.state == 'SUCCESS') {
737
+ uploadVideoList.push({
738
+ 'url': json.url,
739
+ 'type': json.type,
740
+ 'original':json.original
741
+ });
742
+ $file.append('<span class="success"></span>');
743
+ } else {
744
+ $file.find('.error').text(json.state).show();
745
+ }
746
+ } catch (e) {
747
+ $file.find('.error').text(lang.errorServerUpload).show();
748
+ }
749
+ });
750
+
751
+ uploader.on('uploadError', function (file, code) {
752
+ });
753
+ uploader.on('error', function (code, file) {
754
+ if (code == 'Q_TYPE_DENIED' || code == 'F_EXCEED_SIZE') {
755
+ addFile(file);
756
+ }
757
+ });
758
+ uploader.on('uploadComplete', function (file, ret) {
759
+ });
760
+
761
+ $upload.on('click', function () {
762
+ if ($(this).hasClass('disabled')) {
763
+ return false;
764
+ }
765
+
766
+ if (state === 'ready') {
767
+ uploader.upload();
768
+ } else if (state === 'paused') {
769
+ uploader.upload();
770
+ } else if (state === 'uploading') {
771
+ uploader.stop();
772
+ }
773
+ });
774
+
775
+ $upload.addClass('state-' + state);
776
+ updateTotalProgress();
777
+ },
778
+ getQueueCount: function () {
779
+ var file, i, status, readyFile = 0, files = this.uploader.getFiles();
780
+ for (i = 0; file = files[i++]; ) {
781
+ status = file.getStatus();
782
+ if (status == 'queued' || status == 'uploading' || status == 'progress') readyFile++;
783
+ }
784
+ return readyFile;
785
+ },
786
+ refresh: function(){
787
+ this.uploader.refresh();
788
+ }
789
+ };
790
+
791
+ })();