ueditor.rails 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/config.mindpin.default.coffee +59 -0
  3. data/app/assets/javascripts/ueditor.js +3 -2
  4. data/app/assets/stylesheets/ueditor/themes/mindpin/css/ueditor.css +1945 -0
  5. data/app/assets/stylesheets/ueditor/themes/mindpin/dialogbase.css +100 -0
  6. data/app/assets/stylesheets/ueditor/themes/mindpin/images/anchor.gif +0 -0
  7. data/app/assets/stylesheets/ueditor/themes/mindpin/images/arrow.png +0 -0
  8. data/app/assets/stylesheets/ueditor/themes/mindpin/images/arrow_down.png +0 -0
  9. data/app/assets/stylesheets/ueditor/themes/mindpin/images/arrow_up.png +0 -0
  10. data/app/assets/stylesheets/ueditor/themes/mindpin/images/button-bg.gif +0 -0
  11. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cancelbutton.gif +0 -0
  12. data/app/assets/stylesheets/ueditor/themes/mindpin/images/charts.png +0 -0
  13. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cursor_h.gif +0 -0
  14. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cursor_h.png +0 -0
  15. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cursor_v.gif +0 -0
  16. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cursor_v.png +0 -0
  17. data/app/assets/stylesheets/ueditor/themes/mindpin/images/dialog-title-bg.png +0 -0
  18. data/{vendor/assets/javascripts/ueditor/dialogs/attachment/images/alignicon.png → app/assets/stylesheets/ueditor/themes/mindpin/images/filescan.png} +0 -0
  19. data/app/assets/stylesheets/ueditor/themes/mindpin/images/highlighted.gif +0 -0
  20. data/app/assets/stylesheets/ueditor/themes/mindpin/images/icons-all.gif +0 -0
  21. data/app/assets/stylesheets/ueditor/themes/mindpin/images/icons.gif +0 -0
  22. data/app/assets/stylesheets/ueditor/themes/mindpin/images/icons.png +0 -0
  23. data/{vendor/assets/javascripts/ueditor/dialogs/attachment/images/bg.png → app/assets/stylesheets/ueditor/themes/mindpin/images/loaderror.png} +0 -0
  24. data/app/assets/stylesheets/ueditor/themes/mindpin/images/loading.gif +0 -0
  25. data/{vendor/assets/javascripts/ueditor/dialogs/attachment/images/alignicon.gif → app/assets/stylesheets/ueditor/themes/mindpin/images/lock.gif} +0 -0
  26. data/{vendor/assets/javascripts/ueditor/dialogs/emotion → app/assets/stylesheets/ueditor/themes/mindpin}/images/neweditor-tab-bg.png +0 -0
  27. data/app/assets/stylesheets/ueditor/themes/mindpin/images/pagebreak.gif +0 -0
  28. data/app/assets/stylesheets/ueditor/themes/mindpin/images/scale.png +0 -0
  29. data/{vendor/assets/javascripts/ueditor/dialogs/video/images/bg.png → app/assets/stylesheets/ueditor/themes/mindpin/images/sortable.png} +0 -0
  30. data/app/assets/stylesheets/ueditor/themes/mindpin/images/spacer.gif +0 -0
  31. data/app/assets/stylesheets/ueditor/themes/mindpin/images/sparator_v.png +0 -0
  32. data/app/assets/stylesheets/ueditor/themes/mindpin/images/table-cell-align.png +0 -0
  33. data/app/assets/stylesheets/ueditor/themes/mindpin/images/tangram-colorpicker.png +0 -0
  34. data/app/assets/stylesheets/ueditor/themes/mindpin/images/toolbar_bg.png +0 -0
  35. data/app/assets/stylesheets/ueditor/themes/mindpin/images/unhighlighted.gif +0 -0
  36. data/app/assets/stylesheets/ueditor/themes/mindpin/images/upload.png +0 -0
  37. data/app/assets/stylesheets/ueditor/themes/mindpin/images/videologo.gif +0 -0
  38. data/{vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_chm.gif → app/assets/stylesheets/ueditor/themes/mindpin/images/word.gif} +0 -0
  39. data/app/assets/stylesheets/ueditor/themes/mindpin/images/wordpaste.png +0 -0
  40. data/lib/ueditor/version.rb +1 -1
  41. data/test/dummy/log/development.log +105 -0
  42. data/test/dummy/tmp/cache/assets/development/sprockets/02b56f18dcd4ddec585a02528773c04b +0 -0
  43. data/test/dummy/tmp/cache/assets/development/sprockets/067a099f2392ac9d679fb27d72421548 +0 -0
  44. data/test/dummy/tmp/cache/assets/development/sprockets/07898ec696d976eeafb61ef6bb48e097 +0 -0
  45. data/test/dummy/tmp/cache/assets/development/sprockets/19694ecb6829b547affeb420f6c4f4ba +0 -0
  46. data/test/dummy/tmp/cache/assets/development/sprockets/22b4a109d4f3136884f5b96c0dafe5c4 +0 -0
  47. data/test/dummy/tmp/cache/assets/development/sprockets/2e810e09180be475ce270590eb6d79bf +0 -0
  48. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  49. data/test/dummy/tmp/cache/assets/development/sprockets/31b24023d7695b6c40fbe8b2d903e8db +0 -0
  50. data/test/dummy/tmp/cache/assets/development/sprockets/32e4b0cbcc7942738eb80e9c571e09ad +0 -0
  51. data/test/dummy/tmp/cache/assets/development/sprockets/3e6fbffe890d9471ace4284a35cf833e +0 -0
  52. data/test/dummy/tmp/cache/assets/development/sprockets/50a23c1131cabc18af0d7ce21df229ea +0 -0
  53. data/test/dummy/tmp/cache/assets/development/sprockets/792425c63374a4c75ca043ceeb960991 +0 -0
  54. data/test/dummy/tmp/cache/assets/development/sprockets/8165d0bcd2b5c04b4a98f4f0cbabef64 +0 -0
  55. data/test/dummy/tmp/cache/assets/development/sprockets/9bf28bcb944fe3baabaabb97036a4d6c +0 -0
  56. data/test/dummy/tmp/cache/assets/development/sprockets/9df06b25c7118a2446ff210358a7150a +0 -0
  57. data/test/dummy/tmp/cache/assets/development/sprockets/a0a5d0da6dc7907299fb15adbabc87e5 +0 -0
  58. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  59. data/test/dummy/tmp/cache/assets/development/sprockets/d3a9a64bc190424c032a25d0b7ee0ed1 +0 -0
  60. data/test/dummy/tmp/cache/assets/development/sprockets/eb17dc3da27134989a88ec01caa61d78 +0 -0
  61. data/test/dummy/tmp/cache/assets/development/sprockets/ef01c1c9fa9a8ace471702975febabf5 +0 -0
  62. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  63. data/test/dummy/tmp/cache/assets/development/sprockets/fa046bb067616da9d14862739bf2c67c +0 -0
  64. data/vendor/assets/javascripts/ueditor/index.html +0 -19
  65. data/vendor/assets/javascripts/ueditor/themes/iframe.css +0 -1
  66. data/vendor/assets/javascripts/ueditor/ueditor.all.js +2854 -12684
  67. data/vendor/assets/javascripts/ueditor/ueditor.all.min.js +10 -709
  68. data/vendor/assets/javascripts/ueditor/ueditor.config.js +2 -147
  69. data/vendor/assets/javascripts/ueditor/ueditor.parse.js +11 -602
  70. data/vendor/assets/javascripts/ueditor/ueditor.parse.min.js +1 -28
  71. metadata +82 -161
  72. data/app/assets/javascripts/default.config.js +0 -381
  73. data/vendor/assets/javascripts/ueditor/dialogs/anchor/anchor.html +0 -40
  74. data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.css +0 -681
  75. data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.html +0 -60
  76. data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.js +0 -754
  77. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
  78. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
  79. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
  80. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_jpg.gif +0 -0
  81. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
  82. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
  83. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
  84. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
  85. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
  86. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
  87. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
  88. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
  89. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/file-icons.gif +0 -0
  90. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/file-icons.png +0 -0
  91. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/icons.gif +0 -0
  92. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/icons.png +0 -0
  93. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/image.png +0 -0
  94. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/progress.png +0 -0
  95. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/success.gif +0 -0
  96. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/success.png +0 -0
  97. data/vendor/assets/javascripts/ueditor/dialogs/background/background.css +0 -94
  98. data/vendor/assets/javascripts/ueditor/dialogs/background/background.html +0 -56
  99. data/vendor/assets/javascripts/ueditor/dialogs/background/background.js +0 -376
  100. data/vendor/assets/javascripts/ueditor/dialogs/background/images/bg.png +0 -0
  101. data/vendor/assets/javascripts/ueditor/dialogs/background/images/success.png +0 -0
  102. data/vendor/assets/javascripts/ueditor/dialogs/charts/chart.config.js +0 -65
  103. data/vendor/assets/javascripts/ueditor/dialogs/charts/charts.css +0 -165
  104. data/vendor/assets/javascripts/ueditor/dialogs/charts/charts.html +0 -89
  105. data/vendor/assets/javascripts/ueditor/dialogs/charts/charts.js +0 -519
  106. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts0.png +0 -0
  107. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts1.png +0 -0
  108. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts2.png +0 -0
  109. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts3.png +0 -0
  110. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts4.png +0 -0
  111. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts5.png +0 -0
  112. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.css +0 -43
  113. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.html +0 -54
  114. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.js +0 -186
  115. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
  116. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
  117. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
  118. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
  119. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
  120. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
  121. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
  122. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
  123. data/vendor/assets/javascripts/ueditor/dialogs/gmap/gmap.html +0 -89
  124. data/vendor/assets/javascripts/ueditor/dialogs/help/help.css +0 -7
  125. data/vendor/assets/javascripts/ueditor/dialogs/help/help.html +0 -82
  126. data/vendor/assets/javascripts/ueditor/dialogs/help/help.js +0 -56
  127. data/vendor/assets/javascripts/ueditor/dialogs/image/image.css +0 -894
  128. data/vendor/assets/javascripts/ueditor/dialogs/image/image.html +0 -120
  129. data/vendor/assets/javascripts/ueditor/dialogs/image/image.js +0 -1139
  130. data/vendor/assets/javascripts/ueditor/dialogs/image/images/alignicon.jpg +0 -0
  131. data/vendor/assets/javascripts/ueditor/dialogs/image/images/bg.png +0 -0
  132. data/vendor/assets/javascripts/ueditor/dialogs/image/images/icons.gif +0 -0
  133. data/vendor/assets/javascripts/ueditor/dialogs/image/images/icons.png +0 -0
  134. data/vendor/assets/javascripts/ueditor/dialogs/image/images/image.png +0 -0
  135. data/vendor/assets/javascripts/ueditor/dialogs/image/images/progress.png +0 -0
  136. data/vendor/assets/javascripts/ueditor/dialogs/image/images/success.gif +0 -0
  137. data/vendor/assets/javascripts/ueditor/dialogs/image/images/success.png +0 -0
  138. data/vendor/assets/javascripts/ueditor/dialogs/insertframe/insertframe.html +0 -98
  139. data/vendor/assets/javascripts/ueditor/dialogs/map/map.html +0 -135
  140. data/vendor/assets/javascripts/ueditor/dialogs/map/show.html +0 -118
  141. data/vendor/assets/javascripts/ueditor/dialogs/music/music.css +0 -30
  142. data/vendor/assets/javascripts/ueditor/dialogs/music/music.html +0 -32
  143. data/vendor/assets/javascripts/ueditor/dialogs/music/music.js +0 -192
  144. data/vendor/assets/javascripts/ueditor/dialogs/preview/preview.html +0 -40
  145. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/addimg.png +0 -0
  146. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/brush.png +0 -0
  147. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/delimg.png +0 -0
  148. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/delimgH.png +0 -0
  149. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/empty.png +0 -0
  150. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/emptyH.png +0 -0
  151. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/eraser.png +0 -0
  152. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/redo.png +0 -0
  153. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/redoH.png +0 -0
  154. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/scale.png +0 -0
  155. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/scaleH.png +0 -0
  156. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/size.png +0 -0
  157. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/undo.png +0 -0
  158. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/undoH.png +0 -0
  159. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/scrawl.css +0 -72
  160. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/scrawl.html +0 -95
  161. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/scrawl.js +0 -671
  162. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.html +0 -102
  163. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.js +0 -164
  164. data/vendor/assets/javascripts/ueditor/dialogs/snapscreen/snapscreen.html +0 -58
  165. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.html +0 -21
  166. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.js +0 -57
  167. data/vendor/assets/javascripts/ueditor/dialogs/table/dragicon.png +0 -0
  168. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.css +0 -84
  169. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.html +0 -64
  170. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.js +0 -237
  171. data/vendor/assets/javascripts/ueditor/dialogs/table/edittd.html +0 -61
  172. data/vendor/assets/javascripts/ueditor/dialogs/table/edittip.html +0 -33
  173. data/vendor/assets/javascripts/ueditor/dialogs/template/config.js +0 -42
  174. data/vendor/assets/javascripts/ueditor/dialogs/template/images/bg.gif +0 -0
  175. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre0.png +0 -0
  176. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre1.png +0 -0
  177. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre2.png +0 -0
  178. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre3.png +0 -0
  179. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre4.png +0 -0
  180. data/vendor/assets/javascripts/ueditor/dialogs/template/template.css +0 -18
  181. data/vendor/assets/javascripts/ueditor/dialogs/template/template.html +0 -26
  182. data/vendor/assets/javascripts/ueditor/dialogs/template/template.js +0 -53
  183. data/vendor/assets/javascripts/ueditor/dialogs/video/images/center_focus.jpg +0 -0
  184. data/vendor/assets/javascripts/ueditor/dialogs/video/images/file-icons.gif +0 -0
  185. data/vendor/assets/javascripts/ueditor/dialogs/video/images/file-icons.png +0 -0
  186. data/vendor/assets/javascripts/ueditor/dialogs/video/images/icons.gif +0 -0
  187. data/vendor/assets/javascripts/ueditor/dialogs/video/images/icons.png +0 -0
  188. data/vendor/assets/javascripts/ueditor/dialogs/video/images/image.png +0 -0
  189. data/vendor/assets/javascripts/ueditor/dialogs/video/images/left_focus.jpg +0 -0
  190. data/vendor/assets/javascripts/ueditor/dialogs/video/images/none_focus.jpg +0 -0
  191. data/vendor/assets/javascripts/ueditor/dialogs/video/images/progress.png +0 -0
  192. data/vendor/assets/javascripts/ueditor/dialogs/video/images/right_focus.jpg +0 -0
  193. data/vendor/assets/javascripts/ueditor/dialogs/video/images/success.gif +0 -0
  194. data/vendor/assets/javascripts/ueditor/dialogs/video/images/success.png +0 -0
  195. data/vendor/assets/javascripts/ueditor/dialogs/video/video.css +0 -635
  196. data/vendor/assets/javascripts/ueditor/dialogs/video/video.html +0 -86
  197. data/vendor/assets/javascripts/ueditor/dialogs/video/video.js +0 -789
  198. data/vendor/assets/javascripts/ueditor/dialogs/webapp/webapp.html +0 -53
  199. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/fClipboard_ueditor.swf +0 -0
  200. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/imageUploader.swf +0 -0
  201. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/tangram.js +0 -1495
  202. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/wordimage.html +0 -111
  203. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/wordimage.js +0 -157
  204. data/vendor/assets/javascripts/ueditor/lang/en/en.js +0 -684
  205. data/vendor/assets/javascripts/ueditor/lang/en/images/addimage.png +0 -0
  206. data/vendor/assets/javascripts/ueditor/lang/en/images/alldeletebtnhoverskin.png +0 -0
  207. data/vendor/assets/javascripts/ueditor/lang/en/images/alldeletebtnupskin.png +0 -0
  208. data/vendor/assets/javascripts/ueditor/lang/en/images/background.png +0 -0
  209. data/vendor/assets/javascripts/ueditor/lang/en/images/button.png +0 -0
  210. data/vendor/assets/javascripts/ueditor/lang/en/images/copy.png +0 -0
  211. data/vendor/assets/javascripts/ueditor/lang/en/images/deletedisable.png +0 -0
  212. data/vendor/assets/javascripts/ueditor/lang/en/images/deleteenable.png +0 -0
  213. data/vendor/assets/javascripts/ueditor/lang/en/images/listbackground.png +0 -0
  214. data/vendor/assets/javascripts/ueditor/lang/en/images/localimage.png +0 -0
  215. data/vendor/assets/javascripts/ueditor/lang/en/images/music.png +0 -0
  216. data/vendor/assets/javascripts/ueditor/lang/en/images/rotateleftdisable.png +0 -0
  217. data/vendor/assets/javascripts/ueditor/lang/en/images/rotateleftenable.png +0 -0
  218. data/vendor/assets/javascripts/ueditor/lang/en/images/rotaterightdisable.png +0 -0
  219. data/vendor/assets/javascripts/ueditor/lang/en/images/rotaterightenable.png +0 -0
  220. data/vendor/assets/javascripts/ueditor/lang/en/images/upload.png +0 -0
  221. data/vendor/assets/javascripts/ueditor/third-party/zeroclipboard/ZeroClipboard.js +0 -1256
  222. data/vendor/assets/javascripts/ueditor/third-party/zeroclipboard/ZeroClipboard.min.js +0 -9
  223. data/vendor/assets/javascripts/ueditor/third-party/zeroclipboard/ZeroClipboard.swf +0 -0
@@ -1,60 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>ueditor图片对话框</title>
6
- <script type="text/javascript" src="../internal.js"></script>
7
-
8
- <!-- jquery -->
9
- <script type="text/javascript" src="../../third-party/jquery-1.10.2.min.js"></script>
10
-
11
- <!-- webuploader -->
12
- <script src="../../third-party/webuploader/webuploader.min.js"></script>
13
- <link rel="stylesheet" type="text/css" href="../../third-party/webuploader/webuploader.css">
14
-
15
- <!-- attachment dialog -->
16
- <link rel="stylesheet" href="attachment.css" type="text/css" />
17
- </head>
18
- <body>
19
-
20
- <div class="wrapper">
21
- <div id="tabhead" class="tabhead">
22
- <span class="tab focus" data-content-id="upload"><var id="lang_tab_upload"></var></span>
23
- <span class="tab" data-content-id="online"><var id="lang_tab_online"></var></span>
24
- </div>
25
- <div id="tabbody" class="tabbody">
26
- <!-- 上传图片 -->
27
- <div id="upload" class="panel focus">
28
- <div id="queueList" class="queueList">
29
- <div class="statusBar element-invisible">
30
- <div class="progress">
31
- <span class="text">0%</span>
32
- <span class="percentage"></span>
33
- </div><div class="info"></div>
34
- <div class="btns">
35
- <div id="filePickerBtn"></div>
36
- <div class="uploadBtn"><var id="lang_start_upload"></var></div>
37
- </div>
38
- </div>
39
- <div id="dndArea" class="placeholder">
40
- <div class="filePickerContainer">
41
- <div id="filePickerReady"></div>
42
- </div>
43
- </div>
44
- <ul class="filelist element-invisible">
45
- <li id="filePickerBlock" class="filePickerBlock"></li>
46
- </ul>
47
- </div>
48
- </div>
49
-
50
- <!-- 在线图片 -->
51
- <div id="online" class="panel">
52
- <div id="fileList"><var id="lang_imgLoading"></var></div>
53
- </div>
54
-
55
- </div>
56
- </div>
57
- <script type="text/javascript" src="attachment.js"></script>
58
-
59
- </body>
60
- </html>
@@ -1,754 +0,0 @@
1
- /**
2
- * User: Jinqn
3
- * Date: 14-04-08
4
- * Time: 下午16:34
5
- * 上传图片对话框逻辑代码,包括tab: 远程图片/上传图片/在线图片/搜索图片
6
- */
7
-
8
- (function () {
9
-
10
- var uploadFile,
11
- onlineFile;
12
-
13
- window.onload = function () {
14
- initTabs();
15
- initButtons();
16
- };
17
-
18
- /* 初始化tab标签 */
19
- function initTabs() {
20
- var tabs = $G('tabhead').children;
21
- for (var i = 0; i < tabs.length; i++) {
22
- domUtils.on(tabs[i], "click", function (e) {
23
- var target = e.target || e.srcElement;
24
- setTabFocus(target.getAttribute('data-content-id'));
25
- });
26
- }
27
-
28
- setTabFocus('upload');
29
- }
30
-
31
- /* 初始化tabbody */
32
- function setTabFocus(id) {
33
- if(!id) return;
34
- var i, bodyId, tabs = $G('tabhead').children;
35
- for (i = 0; i < tabs.length; i++) {
36
- bodyId = tabs[i].getAttribute('data-content-id')
37
- if (bodyId == id) {
38
- domUtils.addClass(tabs[i], 'focus');
39
- domUtils.addClass($G(bodyId), 'focus');
40
- } else {
41
- domUtils.removeClasses(tabs[i], 'focus');
42
- domUtils.removeClasses($G(bodyId), 'focus');
43
- }
44
- }
45
- switch (id) {
46
- case 'upload':
47
- uploadFile = uploadFile || new UploadFile('queueList');
48
- break;
49
- case 'online':
50
- onlineFile = onlineFile || new OnlineFile('fileList');
51
- break;
52
- }
53
- }
54
-
55
- /* 初始化onok事件 */
56
- function initButtons() {
57
-
58
- dialog.onok = function () {
59
- var list = [], id, tabs = $G('tabhead').children;
60
- for (var i = 0; i < tabs.length; i++) {
61
- if (domUtils.hasClass(tabs[i], 'focus')) {
62
- id = tabs[i].getAttribute('data-content-id');
63
- break;
64
- }
65
- }
66
-
67
- switch (id) {
68
- case 'upload':
69
- list = uploadFile.getInsertList();
70
- var count = uploadFile.getQueueCount();
71
- if (count) {
72
- $('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>');
73
- return false;
74
- }
75
- break;
76
- case 'online':
77
- list = onlineFile.getInsertList();
78
- break;
79
- }
80
-
81
- editor.execCommand('insertfile', list);
82
- };
83
- }
84
-
85
-
86
- /* 上传附件 */
87
- function UploadFile(target) {
88
- this.$wrap = target.constructor == String ? $('#' + target) : $(target);
89
- this.init();
90
- }
91
- UploadFile.prototype = {
92
- init: function () {
93
- this.fileList = [];
94
- this.initContainer();
95
- this.initUploader();
96
- },
97
- initContainer: function () {
98
- this.$queue = this.$wrap.find('.filelist');
99
- },
100
- /* 初始化容器 */
101
- initUploader: function () {
102
- var _this = this,
103
- $ = jQuery, // just in case. Make sure it's not an other libaray.
104
- $wrap = _this.$wrap,
105
- // 图片容器
106
- $queue = $wrap.find('.filelist'),
107
- // 状态栏,包括进度和控制按钮
108
- $statusBar = $wrap.find('.statusBar'),
109
- // 文件总体选择信息。
110
- $info = $statusBar.find('.info'),
111
- // 上传按钮
112
- $upload = $wrap.find('.uploadBtn'),
113
- // 上传按钮
114
- $filePickerBtn = $wrap.find('.filePickerBtn'),
115
- // 上传按钮
116
- $filePickerBlock = $wrap.find('.filePickerBlock'),
117
- // 没选择文件之前的内容。
118
- $placeHolder = $wrap.find('.placeholder'),
119
- // 总体进度条
120
- $progress = $statusBar.find('.progress').hide(),
121
- // 添加的文件数量
122
- fileCount = 0,
123
- // 添加的文件总大小
124
- fileSize = 0,
125
- // 优化retina, 在retina下这个值是2
126
- ratio = window.devicePixelRatio || 1,
127
- // 缩略图大小
128
- thumbnailWidth = 113 * ratio,
129
- thumbnailHeight = 113 * ratio,
130
- // 可能有pedding, ready, uploading, confirm, done.
131
- state = '',
132
- // 所有文件的进度信息,key为file id
133
- percentages = {},
134
- supportTransition = (function () {
135
- var s = document.createElement('p').style,
136
- r = 'transition' in s ||
137
- 'WebkitTransition' in s ||
138
- 'MozTransition' in s ||
139
- 'msTransition' in s ||
140
- 'OTransition' in s;
141
- s = null;
142
- return r;
143
- })(),
144
- // WebUploader实例
145
- uploader,
146
- actionUrl = editor.getActionUrl(editor.getOpt('fileActionName')),
147
- fileMaxSize = editor.getOpt('fileMaxSize'),
148
- acceptExtensions = (editor.getOpt('fileAllowFiles') || []).join('').replace(/\./g, ',').replace(/^[,]/, '');;
149
-
150
- if (!WebUploader.Uploader.support()) {
151
- $('#filePickerReady').after($('<div>').html(lang.errorNotSupport)).hide();
152
- return;
153
- } else if (!editor.getOpt('fileActionName')) {
154
- $('#filePickerReady').after($('<div>').html(lang.errorLoadConfig)).hide();
155
- return;
156
- }
157
-
158
- uploader = _this.uploader = WebUploader.create({
159
- pick: {
160
- id: '#filePickerReady',
161
- label: lang.uploadSelectFile
162
- },
163
- swf: '../../third-party/webuploader/Uploader.swf',
164
- server: actionUrl,
165
- fileVal: editor.getOpt('fileFieldName'),
166
- duplicate: true,
167
- fileSingleSizeLimit: fileMaxSize,
168
- compress: false
169
- });
170
- uploader.addButton({
171
- id: '#filePickerBlock'
172
- });
173
- uploader.addButton({
174
- id: '#filePickerBtn',
175
- label: lang.uploadAddFile
176
- });
177
-
178
- setState('pedding');
179
-
180
- // 当有文件添加进来时执行,负责view的创建
181
- function addFile(file) {
182
- var $li = $('<li id="' + file.id + '">' +
183
- '<p class="title">' + file.name + '</p>' +
184
- '<p class="imgWrap"></p>' +
185
- '<p class="progress"><span></span></p>' +
186
- '</li>'),
187
-
188
- $btns = $('<div class="file-panel">' +
189
- '<span class="cancel">' + lang.uploadDelete + '</span>' +
190
- '<span class="rotateRight">' + lang.uploadTurnRight + '</span>' +
191
- '<span class="rotateLeft">' + lang.uploadTurnLeft + '</span></div>').appendTo($li),
192
- $prgress = $li.find('p.progress span'),
193
- $wrap = $li.find('p.imgWrap'),
194
- $info = $('<p class="error"></p>').hide().appendTo($li),
195
-
196
- showError = function (code) {
197
- switch (code) {
198
- case 'exceed_size':
199
- text = lang.errorExceedSize;
200
- break;
201
- case 'interrupt':
202
- text = lang.errorInterrupt;
203
- break;
204
- case 'http':
205
- text = lang.errorHttp;
206
- break;
207
- case 'not_allow_type':
208
- text = lang.errorFileType;
209
- break;
210
- default:
211
- text = lang.errorUploadRetry;
212
- break;
213
- }
214
- $info.text(text).show();
215
- };
216
-
217
- if (file.getStatus() === 'invalid') {
218
- showError(file.statusText);
219
- } else {
220
- $wrap.text(lang.uploadPreview);
221
- if ('|png|jpg|jpeg|bmp|gif|'.indexOf('|'+file.ext.toLowerCase()+'|') == -1) {
222
- $wrap.empty().addClass('notimage').append('<i class="file-preview file-type-' + file.ext.toLowerCase() + '"></i>' +
223
- '<span class="file-title" title="' + file.name + '">' + file.name + '</span>');
224
- } else {
225
- if (browser.ie && browser.version <= 7) {
226
- $wrap.text(lang.uploadNoPreview);
227
- } else {
228
- uploader.makeThumb(file, function (error, src) {
229
- if (error || !src) {
230
- $wrap.text(lang.uploadNoPreview);
231
- } else {
232
- var $img = $('<img src="' + src + '">');
233
- $wrap.empty().append($img);
234
- $img.on('error', function () {
235
- $wrap.text(lang.uploadNoPreview);
236
- });
237
- }
238
- }, thumbnailWidth, thumbnailHeight);
239
- }
240
- }
241
- percentages[ file.id ] = [ file.size, 0 ];
242
- file.rotation = 0;
243
-
244
- /* 检查文件格式 */
245
- if (!file.ext || acceptExtensions.indexOf(file.ext.toLowerCase()) == -1) {
246
- showError('not_allow_type');
247
- uploader.removeFile(file);
248
- }
249
- }
250
-
251
- file.on('statuschange', function (cur, prev) {
252
- if (prev === 'progress') {
253
- $prgress.hide().width(0);
254
- } else if (prev === 'queued') {
255
- $li.off('mouseenter mouseleave');
256
- $btns.remove();
257
- }
258
- // 成功
259
- if (cur === 'error' || cur === 'invalid') {
260
- showError(file.statusText);
261
- percentages[ file.id ][ 1 ] = 1;
262
- } else if (cur === 'interrupt') {
263
- showError('interrupt');
264
- } else if (cur === 'queued') {
265
- percentages[ file.id ][ 1 ] = 0;
266
- } else if (cur === 'progress') {
267
- $info.hide();
268
- $prgress.css('display', 'block');
269
- } else if (cur === 'complete') {
270
- }
271
-
272
- $li.removeClass('state-' + prev).addClass('state-' + cur);
273
- });
274
-
275
- $li.on('mouseenter', function () {
276
- $btns.stop().animate({height: 30});
277
- });
278
- $li.on('mouseleave', function () {
279
- $btns.stop().animate({height: 0});
280
- });
281
-
282
- $btns.on('click', 'span', function () {
283
- var index = $(this).index(),
284
- deg;
285
-
286
- switch (index) {
287
- case 0:
288
- uploader.removeFile(file);
289
- return;
290
- case 1:
291
- file.rotation += 90;
292
- break;
293
- case 2:
294
- file.rotation -= 90;
295
- break;
296
- }
297
-
298
- if (supportTransition) {
299
- deg = 'rotate(' + file.rotation + 'deg)';
300
- $wrap.css({
301
- '-webkit-transform': deg,
302
- '-mos-transform': deg,
303
- '-o-transform': deg,
304
- 'transform': deg
305
- });
306
- } else {
307
- $wrap.css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + (~~((file.rotation / 90) % 4 + 4) % 4) + ')');
308
- }
309
-
310
- });
311
-
312
- $li.insertBefore($filePickerBlock);
313
- }
314
-
315
- // 负责view的销毁
316
- function removeFile(file) {
317
- var $li = $('#' + file.id);
318
- delete percentages[ file.id ];
319
- updateTotalProgress();
320
- $li.off().find('.file-panel').off().end().remove();
321
- }
322
-
323
- function updateTotalProgress() {
324
- var loaded = 0,
325
- total = 0,
326
- spans = $progress.children(),
327
- percent;
328
-
329
- $.each(percentages, function (k, v) {
330
- total += v[ 0 ];
331
- loaded += v[ 0 ] * v[ 1 ];
332
- });
333
-
334
- percent = total ? loaded / total : 0;
335
-
336
- spans.eq(0).text(Math.round(percent * 100) + '%');
337
- spans.eq(1).css('width', Math.round(percent * 100) + '%');
338
- updateStatus();
339
- }
340
-
341
- function setState(val, files) {
342
-
343
- if (val != state) {
344
-
345
- var stats = uploader.getStats();
346
-
347
- $upload.removeClass('state-' + state);
348
- $upload.addClass('state-' + val);
349
-
350
- switch (val) {
351
-
352
- /* 未选择文件 */
353
- case 'pedding':
354
- $queue.addClass('element-invisible');
355
- $statusBar.addClass('element-invisible');
356
- $placeHolder.removeClass('element-invisible');
357
- $progress.hide(); $info.hide();
358
- uploader.refresh();
359
- break;
360
-
361
- /* 可以开始上传 */
362
- case 'ready':
363
- $placeHolder.addClass('element-invisible');
364
- $queue.removeClass('element-invisible');
365
- $statusBar.removeClass('element-invisible');
366
- $progress.hide(); $info.show();
367
- $upload.text(lang.uploadStart);
368
- uploader.refresh();
369
- break;
370
-
371
- /* 上传中 */
372
- case 'uploading':
373
- $progress.show(); $info.hide();
374
- $upload.text(lang.uploadPause);
375
- break;
376
-
377
- /* 暂停上传 */
378
- case 'paused':
379
- $progress.show(); $info.hide();
380
- $upload.text(lang.uploadContinue);
381
- break;
382
-
383
- case 'confirm':
384
- $progress.show(); $info.hide();
385
- $upload.text(lang.uploadStart);
386
-
387
- stats = uploader.getStats();
388
- if (stats.successNum && !stats.uploadFailNum) {
389
- setState('finish');
390
- return;
391
- }
392
- break;
393
-
394
- case 'finish':
395
- $progress.hide(); $info.show();
396
- if (stats.uploadFailNum) {
397
- $upload.text(lang.uploadRetry);
398
- } else {
399
- $upload.text(lang.uploadStart);
400
- }
401
- break;
402
- }
403
-
404
- state = val;
405
- updateStatus();
406
-
407
- }
408
-
409
- if (!_this.getQueueCount()) {
410
- $upload.addClass('disabled')
411
- } else {
412
- $upload.removeClass('disabled')
413
- }
414
-
415
- }
416
-
417
- function updateStatus() {
418
- var text = '', stats;
419
-
420
- if (state === 'ready') {
421
- text = lang.updateStatusReady.replace('_', fileCount).replace('_KB', WebUploader.formatSize(fileSize));
422
- } else if (state === 'confirm') {
423
- stats = uploader.getStats();
424
- if (stats.uploadFailNum) {
425
- text = lang.updateStatusConfirm.replace('_', stats.successNum).replace('_', stats.successNum);
426
- }
427
- } else {
428
- stats = uploader.getStats();
429
- text = lang.updateStatusFinish.replace('_', fileCount).
430
- replace('_KB', WebUploader.formatSize(fileSize)).
431
- replace('_', stats.successNum);
432
-
433
- if (stats.uploadFailNum) {
434
- text += lang.updateStatusError.replace('_', stats.uploadFailNum);
435
- }
436
- }
437
-
438
- $info.html(text);
439
- }
440
-
441
- uploader.on('fileQueued', function (file) {
442
- fileCount++;
443
- fileSize += file.size;
444
-
445
- if (fileCount === 1) {
446
- $placeHolder.addClass('element-invisible');
447
- $statusBar.show();
448
- }
449
-
450
- addFile(file);
451
- });
452
-
453
- uploader.on('fileDequeued', function (file) {
454
- fileCount--;
455
- fileSize -= file.size;
456
-
457
- removeFile(file);
458
- updateTotalProgress();
459
- });
460
-
461
- uploader.on('filesQueued', function (file) {
462
- if (!uploader.isInProgress() && (state == 'pedding' || state == 'finish' || state == 'confirm' || state == 'ready')) {
463
- setState('ready');
464
- }
465
- updateTotalProgress();
466
- });
467
-
468
- uploader.on('all', function (type, files) {
469
- switch (type) {
470
- case 'uploadFinished':
471
- setState('confirm', files);
472
- break;
473
- case 'startUpload':
474
- /* 添加额外的GET参数 */
475
- var params = utils.serializeParam(editor.queryCommandValue('serverparam')) || '',
476
- url = utils.formatUrl(actionUrl + (actionUrl.indexOf('?') == -1 ? '?':'&') + 'encode=utf-8&' + params);
477
- uploader.option('server', url);
478
- setState('uploading', files);
479
- break;
480
- case 'stopUpload':
481
- setState('paused', files);
482
- break;
483
- }
484
- });
485
-
486
- uploader.on('uploadBeforeSend', function (file, data, header) {
487
- //这里可以通过data对象添加POST参数
488
- header['X_Requested_With'] = 'XMLHttpRequest';
489
- });
490
-
491
- uploader.on('uploadProgress', function (file, percentage) {
492
- var $li = $('#' + file.id),
493
- $percent = $li.find('.progress span');
494
-
495
- $percent.css('width', percentage * 100 + '%');
496
- percentages[ file.id ][ 1 ] = percentage;
497
- updateTotalProgress();
498
- });
499
-
500
- uploader.on('uploadSuccess', function (file, ret) {
501
- var $file = $('#' + file.id);
502
- try {
503
- var responseText = (ret._raw || ret),
504
- json = utils.str2json(responseText);
505
- if (json.state == 'SUCCESS') {
506
- _this.fileList.push(json);
507
- $file.append('<span class="success"></span>');
508
- } else {
509
- $file.find('.error').text(json.state).show();
510
- }
511
- } catch (e) {
512
- $file.find('.error').text(lang.errorServerUpload).show();
513
- }
514
- });
515
-
516
- uploader.on('uploadError', function (file, code) {
517
- });
518
- uploader.on('error', function (code, file) {
519
- if (code == 'Q_TYPE_DENIED' || code == 'F_EXCEED_SIZE') {
520
- addFile(file);
521
- }
522
- });
523
- uploader.on('uploadComplete', function (file, ret) {
524
- });
525
-
526
- $upload.on('click', function () {
527
- if ($(this).hasClass('disabled')) {
528
- return false;
529
- }
530
-
531
- if (state === 'ready') {
532
- uploader.upload();
533
- } else if (state === 'paused') {
534
- uploader.upload();
535
- } else if (state === 'uploading') {
536
- uploader.stop();
537
- }
538
- });
539
-
540
- $upload.addClass('state-' + state);
541
- updateTotalProgress();
542
- },
543
- getQueueCount: function () {
544
- var file, i, status, readyFile = 0, files = this.uploader.getFiles();
545
- for (i = 0; file = files[i++]; ) {
546
- status = file.getStatus();
547
- if (status == 'queued' || status == 'uploading' || status == 'progress') readyFile++;
548
- }
549
- return readyFile;
550
- },
551
- getInsertList: function () {
552
- var i, link, data, list = [],
553
- prefix = editor.getOpt('fileUrlPrefix');
554
- for (i = 0; i < this.fileList.length; i++) {
555
- data = this.fileList[i];
556
- link = data.url;
557
- list.push({
558
- title: data.original || link.substr(link.lastIndexOf('/') + 1),
559
- url: prefix + link
560
- });
561
- }
562
- return list;
563
- }
564
- };
565
-
566
-
567
- /* 在线附件 */
568
- function OnlineFile(target) {
569
- this.container = utils.isString(target) ? document.getElementById(target) : target;
570
- this.init();
571
- }
572
- OnlineFile.prototype = {
573
- init: function () {
574
- this.initContainer();
575
- this.initEvents();
576
- this.initData();
577
- },
578
- /* 初始化容器 */
579
- initContainer: function () {
580
- this.container.innerHTML = '';
581
- this.list = document.createElement('ul');
582
- this.clearFloat = document.createElement('li');
583
-
584
- domUtils.addClass(this.list, 'list');
585
- domUtils.addClass(this.clearFloat, 'clearFloat');
586
-
587
- this.list.appendChild(this.clearFloat);
588
- this.container.appendChild(this.list);
589
- },
590
- /* 初始化滚动事件,滚动到地步自动拉取数据 */
591
- initEvents: function () {
592
- var _this = this;
593
-
594
- /* 滚动拉取图片 */
595
- domUtils.on($G('fileList'), 'scroll', function(e){
596
- var panel = this;
597
- if (panel.scrollHeight - (panel.offsetHeight + panel.scrollTop) < 10) {
598
- _this.getFileData();
599
- }
600
- });
601
- /* 选中图片 */
602
- domUtils.on(this.list, 'click', function (e) {
603
- var target = e.target || e.srcElement,
604
- li = target.parentNode;
605
-
606
- if (li.tagName.toLowerCase() == 'li') {
607
- if (domUtils.hasClass(li, 'selected')) {
608
- domUtils.removeClasses(li, 'selected');
609
- } else {
610
- domUtils.addClass(li, 'selected');
611
- }
612
- }
613
- });
614
- },
615
- /* 初始化第一次的数据 */
616
- initData: function () {
617
-
618
- /* 拉取数据需要使用的值 */
619
- this.state = 0;
620
- this.listSize = editor.getOpt('fileManagerListSize');
621
- this.listIndex = 0;
622
- this.listEnd = false;
623
-
624
- /* 第一次拉取数据 */
625
- this.getFileData();
626
- },
627
- /* 向后台拉取图片列表数据 */
628
- getFileData: function () {
629
- var _this = this;
630
-
631
- if(!_this.listEnd && !this.isLoadingData) {
632
- this.isLoadingData = true;
633
- ajax.request(editor.getActionUrl(editor.getOpt('fileManagerActionName')), {
634
- timeout: 100000,
635
- data: utils.extend({
636
- start: this.listIndex,
637
- size: this.listSize
638
- }, editor.queryCommandValue('serverparam')),
639
- method: 'get',
640
- onsuccess: function (r) {
641
- try {
642
- var json = eval('(' + r.responseText + ')');
643
- if (json.state == 'SUCCESS') {
644
- _this.pushData(json.list);
645
- _this.listIndex = parseInt(json.start) + parseInt(json.list.length);
646
- if(_this.listIndex >= json.total) {
647
- _this.listEnd = true;
648
- }
649
- _this.isLoadingData = false;
650
- }
651
- } catch (e) {
652
- if(r.responseText.indexOf('ue_separate_ue') != -1) {
653
- var list = r.responseText.split(r.responseText);
654
- _this.pushData(list);
655
- _this.listIndex = parseInt(list.length);
656
- _this.listEnd = true;
657
- _this.isLoadingData = false;
658
- }
659
- }
660
- },
661
- onerror: function () {
662
- _this.isLoadingData = false;
663
- }
664
- });
665
- }
666
- },
667
- /* 添加图片到列表界面上 */
668
- pushData: function (list) {
669
- var i, item, img, filetype, preview, icon, _this = this,
670
- urlPrefix = editor.getOpt('fileManagerUrlPrefix');
671
- for (i = 0; i < list.length; i++) {
672
- if(list[i] && list[i].url) {
673
- item = document.createElement('li');
674
- icon = document.createElement('span');
675
- filetype = list[i].url.substr(list[i].url.lastIndexOf('.') + 1);
676
-
677
- if ( "png|jpg|jpeg|gif|bmp".indexOf(filetype) != -1 ) {
678
- preview = document.createElement('img');
679
- domUtils.on(preview, 'load', (function(image){
680
- return function(){
681
- _this.scale(image, image.parentNode.offsetWidth, image.parentNode.offsetHeight);
682
- };
683
- })(preview));
684
- preview.width = 113;
685
- preview.setAttribute('src', urlPrefix + list[i].url + (list[i].url.indexOf('?') == -1 ? '?noCache=':'&noCache=') + (+new Date()).toString(36) );
686
- } else {
687
- var ic = document.createElement('i'),
688
- textSpan = document.createElement('span');
689
- textSpan.innerHTML = list[i].url.substr(list[i].url.lastIndexOf('/') + 1);
690
- preview = document.createElement('div');
691
- preview.appendChild(ic);
692
- preview.appendChild(textSpan);
693
- domUtils.addClass(preview, 'file-wrapper');
694
- domUtils.addClass(textSpan, 'file-title');
695
- domUtils.addClass(ic, 'file-type-' + filetype);
696
- domUtils.addClass(ic, 'file-preview');
697
- }
698
- domUtils.addClass(icon, 'icon');
699
- item.setAttribute('data-url', urlPrefix + list[i].url);
700
- if (list[i].original) {
701
- item.setAttribute('data-title', list[i].original);
702
- }
703
-
704
- item.appendChild(preview);
705
- item.appendChild(icon);
706
- this.list.insertBefore(item, this.clearFloat);
707
- }
708
- }
709
- },
710
- /* 改变图片大小 */
711
- scale: function (img, w, h, type) {
712
- var ow = img.width,
713
- oh = img.height;
714
-
715
- if (type == 'justify') {
716
- if (ow >= oh) {
717
- img.width = w;
718
- img.height = h * oh / ow;
719
- img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
720
- } else {
721
- img.width = w * ow / oh;
722
- img.height = h;
723
- img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
724
- }
725
- } else {
726
- if (ow >= oh) {
727
- img.width = w * ow / oh;
728
- img.height = h;
729
- img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
730
- } else {
731
- img.width = w;
732
- img.height = h * oh / ow;
733
- img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
734
- }
735
- }
736
- },
737
- getInsertList: function () {
738
- var i, lis = this.list.children, list = [];
739
- for (i = 0; i < lis.length; i++) {
740
- if (domUtils.hasClass(lis[i], 'selected')) {
741
- var url = lis[i].getAttribute('data-url');
742
- var title = lis[i].getAttribute('data-title') || url.substr(url.lastIndexOf('/') + 1);
743
- list.push({
744
- title: title,
745
- url: url
746
- });
747
- }
748
- }
749
- return list;
750
- }
751
- };
752
-
753
-
754
- })();