baidu_ueditor_rails5 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/baidu_ueditor.js +1 -1
  4. data/app/assets/javascripts/ueditor/dialogs/anchor/anchor.html +40 -0
  5. data/app/assets/javascripts/ueditor/dialogs/attachment/attachment.css +681 -0
  6. data/app/assets/javascripts/ueditor/dialogs/attachment/attachment.html +60 -0
  7. data/app/assets/javascripts/ueditor/dialogs/attachment/attachment.js +754 -0
  8. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
  9. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
  10. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
  11. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
  12. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_jpg.gif +0 -0
  13. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
  14. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
  15. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
  16. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
  17. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
  18. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
  19. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
  20. data/app/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
  21. data/app/assets/javascripts/ueditor/dialogs/attachment/images/alignicon.gif +0 -0
  22. data/app/assets/javascripts/ueditor/dialogs/attachment/images/alignicon.png +0 -0
  23. data/app/assets/javascripts/ueditor/dialogs/attachment/images/bg.png +0 -0
  24. data/app/assets/javascripts/ueditor/dialogs/attachment/images/file-icons.gif +0 -0
  25. data/app/assets/javascripts/ueditor/dialogs/attachment/images/file-icons.png +0 -0
  26. data/app/assets/javascripts/ueditor/dialogs/attachment/images/icons.gif +0 -0
  27. data/app/assets/javascripts/ueditor/dialogs/attachment/images/icons.png +0 -0
  28. data/app/assets/javascripts/ueditor/dialogs/attachment/images/image.png +0 -0
  29. data/app/assets/javascripts/ueditor/dialogs/attachment/images/progress.png +0 -0
  30. data/app/assets/javascripts/ueditor/dialogs/attachment/images/success.gif +0 -0
  31. data/app/assets/javascripts/ueditor/dialogs/attachment/images/success.png +0 -0
  32. data/app/assets/javascripts/ueditor/dialogs/background/background.css +94 -0
  33. data/app/assets/javascripts/ueditor/dialogs/background/background.html +56 -0
  34. data/app/assets/javascripts/ueditor/dialogs/background/background.js +376 -0
  35. data/app/assets/javascripts/ueditor/dialogs/background/images/bg.png +0 -0
  36. data/app/assets/javascripts/ueditor/dialogs/background/images/success.png +0 -0
  37. data/app/assets/javascripts/ueditor/dialogs/charts/chart.config.js +65 -0
  38. data/app/assets/javascripts/ueditor/dialogs/charts/charts.css +165 -0
  39. data/app/assets/javascripts/ueditor/dialogs/charts/charts.html +89 -0
  40. data/app/assets/javascripts/ueditor/dialogs/charts/charts.js +519 -0
  41. data/app/assets/javascripts/ueditor/dialogs/charts/images/charts0.png +0 -0
  42. data/app/assets/javascripts/ueditor/dialogs/charts/images/charts1.png +0 -0
  43. data/app/assets/javascripts/ueditor/dialogs/charts/images/charts2.png +0 -0
  44. data/app/assets/javascripts/ueditor/dialogs/charts/images/charts3.png +0 -0
  45. data/app/assets/javascripts/ueditor/dialogs/charts/images/charts4.png +0 -0
  46. data/app/assets/javascripts/ueditor/dialogs/charts/images/charts5.png +0 -0
  47. data/app/assets/javascripts/ueditor/dialogs/emotion/emotion.css +43 -0
  48. data/app/assets/javascripts/ueditor/dialogs/emotion/emotion.html +54 -0
  49. data/app/assets/javascripts/ueditor/dialogs/emotion/emotion.js +186 -0
  50. data/app/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
  51. data/app/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
  52. data/app/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
  53. data/app/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
  54. data/app/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
  55. data/app/assets/javascripts/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
  56. data/app/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
  57. data/app/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
  58. data/app/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
  59. data/app/assets/javascripts/ueditor/dialogs/gmap/gmap.html +89 -0
  60. data/app/assets/javascripts/ueditor/dialogs/help/help.css +7 -0
  61. data/app/assets/javascripts/ueditor/dialogs/help/help.html +82 -0
  62. data/app/assets/javascripts/ueditor/dialogs/help/help.js +56 -0
  63. data/app/assets/javascripts/ueditor/dialogs/image/image.css +894 -0
  64. data/app/assets/javascripts/ueditor/dialogs/image/image.html +120 -0
  65. data/app/assets/javascripts/ueditor/dialogs/image/image.js +1142 -0
  66. data/app/assets/javascripts/ueditor/dialogs/image/images/alignicon.jpg +0 -0
  67. data/app/assets/javascripts/ueditor/dialogs/image/images/bg.png +0 -0
  68. data/app/assets/javascripts/ueditor/dialogs/image/images/icons.gif +0 -0
  69. data/app/assets/javascripts/ueditor/dialogs/image/images/icons.png +0 -0
  70. data/app/assets/javascripts/ueditor/dialogs/image/images/image.png +0 -0
  71. data/app/assets/javascripts/ueditor/dialogs/image/images/progress.png +0 -0
  72. data/app/assets/javascripts/ueditor/dialogs/image/images/success.gif +0 -0
  73. data/app/assets/javascripts/ueditor/dialogs/image/images/success.png +0 -0
  74. data/app/assets/javascripts/ueditor/dialogs/insertframe/insertframe.html +98 -0
  75. data/app/assets/javascripts/ueditor/dialogs/internal.js +81 -0
  76. data/app/assets/javascripts/ueditor/dialogs/link/link.html +126 -0
  77. data/app/assets/javascripts/ueditor/dialogs/map/map.html +135 -0
  78. data/app/assets/javascripts/ueditor/dialogs/map/show.html +118 -0
  79. data/app/assets/javascripts/ueditor/dialogs/music/music.css +30 -0
  80. data/app/assets/javascripts/ueditor/dialogs/music/music.html +32 -0
  81. data/app/assets/javascripts/ueditor/dialogs/music/music.js +192 -0
  82. data/app/assets/javascripts/ueditor/dialogs/preview/preview.html +40 -0
  83. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/addimg.png +0 -0
  84. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/brush.png +0 -0
  85. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/delimg.png +0 -0
  86. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/delimgH.png +0 -0
  87. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/empty.png +0 -0
  88. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/emptyH.png +0 -0
  89. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/eraser.png +0 -0
  90. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/redo.png +0 -0
  91. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/redoH.png +0 -0
  92. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/scale.png +0 -0
  93. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/scaleH.png +0 -0
  94. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/size.png +0 -0
  95. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/undo.png +0 -0
  96. data/app/assets/javascripts/ueditor/dialogs/scrawl/images/undoH.png +0 -0
  97. data/app/assets/javascripts/ueditor/dialogs/scrawl/scrawl.css +72 -0
  98. data/app/assets/javascripts/ueditor/dialogs/scrawl/scrawl.html +95 -0
  99. data/app/assets/javascripts/ueditor/dialogs/scrawl/scrawl.js +671 -0
  100. data/app/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.html +102 -0
  101. data/app/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.js +164 -0
  102. data/app/assets/javascripts/ueditor/dialogs/snapscreen/snapscreen.html +58 -0
  103. data/app/assets/javascripts/ueditor/dialogs/spechars/spechars.html +21 -0
  104. data/app/assets/javascripts/ueditor/dialogs/spechars/spechars.js +57 -0
  105. data/app/assets/javascripts/ueditor/dialogs/table/dragicon.png +0 -0
  106. data/app/assets/javascripts/ueditor/dialogs/table/edittable.css +84 -0
  107. data/app/assets/javascripts/ueditor/dialogs/table/edittable.html +64 -0
  108. data/app/assets/javascripts/ueditor/dialogs/table/edittable.js +237 -0
  109. data/app/assets/javascripts/ueditor/dialogs/table/edittd.html +61 -0
  110. data/app/assets/javascripts/ueditor/dialogs/table/edittip.html +33 -0
  111. data/app/assets/javascripts/ueditor/dialogs/template/config.js +42 -0
  112. data/app/assets/javascripts/ueditor/dialogs/template/images/bg.gif +0 -0
  113. data/app/assets/javascripts/ueditor/dialogs/template/images/pre0.png +0 -0
  114. data/app/assets/javascripts/ueditor/dialogs/template/images/pre1.png +0 -0
  115. data/app/assets/javascripts/ueditor/dialogs/template/images/pre2.png +0 -0
  116. data/app/assets/javascripts/ueditor/dialogs/template/images/pre3.png +0 -0
  117. data/app/assets/javascripts/ueditor/dialogs/template/images/pre4.png +0 -0
  118. data/app/assets/javascripts/ueditor/dialogs/template/template.css +18 -0
  119. data/app/assets/javascripts/ueditor/dialogs/template/template.html +26 -0
  120. data/app/assets/javascripts/ueditor/dialogs/template/template.js +53 -0
  121. data/app/assets/javascripts/ueditor/dialogs/video/images/bg.png +0 -0
  122. data/app/assets/javascripts/ueditor/dialogs/video/images/center_focus.jpg +0 -0
  123. data/app/assets/javascripts/ueditor/dialogs/video/images/file-icons.gif +0 -0
  124. data/app/assets/javascripts/ueditor/dialogs/video/images/file-icons.png +0 -0
  125. data/app/assets/javascripts/ueditor/dialogs/video/images/icons.gif +0 -0
  126. data/app/assets/javascripts/ueditor/dialogs/video/images/icons.png +0 -0
  127. data/app/assets/javascripts/ueditor/dialogs/video/images/image.png +0 -0
  128. data/app/assets/javascripts/ueditor/dialogs/video/images/left_focus.jpg +0 -0
  129. data/app/assets/javascripts/ueditor/dialogs/video/images/none_focus.jpg +0 -0
  130. data/app/assets/javascripts/ueditor/dialogs/video/images/progress.png +0 -0
  131. data/app/assets/javascripts/ueditor/dialogs/video/images/right_focus.jpg +0 -0
  132. data/app/assets/javascripts/ueditor/dialogs/video/images/success.gif +0 -0
  133. data/app/assets/javascripts/ueditor/dialogs/video/images/success.png +0 -0
  134. data/app/assets/javascripts/ueditor/dialogs/video/video.css +635 -0
  135. data/app/assets/javascripts/ueditor/dialogs/video/video.html +86 -0
  136. data/app/assets/javascripts/ueditor/dialogs/video/video.js +791 -0
  137. data/app/assets/javascripts/ueditor/dialogs/webapp/webapp.html +53 -0
  138. data/app/assets/javascripts/ueditor/dialogs/wordimage/fClipboard_ueditor.swf +0 -0
  139. data/app/assets/javascripts/ueditor/dialogs/wordimage/imageUploader.swf +0 -0
  140. data/app/assets/javascripts/ueditor/dialogs/wordimage/tangram.js +1495 -0
  141. data/app/assets/javascripts/ueditor/dialogs/wordimage/wordimage.html +111 -0
  142. data/app/assets/javascripts/ueditor/dialogs/wordimage/wordimage.js +157 -0
  143. data/app/assets/javascripts/ueditor/index.html +175 -0
  144. data/app/assets/javascripts/ueditor/lang/en/en.js +684 -0
  145. data/app/assets/javascripts/ueditor/lang/en/images/addimage.png +0 -0
  146. data/app/assets/javascripts/ueditor/lang/en/images/alldeletebtnhoverskin.png +0 -0
  147. data/app/assets/javascripts/ueditor/lang/en/images/alldeletebtnupskin.png +0 -0
  148. data/app/assets/javascripts/ueditor/lang/en/images/background.png +0 -0
  149. data/app/assets/javascripts/ueditor/lang/en/images/button.png +0 -0
  150. data/app/assets/javascripts/ueditor/lang/en/images/copy.png +0 -0
  151. data/app/assets/javascripts/ueditor/lang/en/images/deletedisable.png +0 -0
  152. data/app/assets/javascripts/ueditor/lang/en/images/deleteenable.png +0 -0
  153. data/app/assets/javascripts/ueditor/lang/en/images/listbackground.png +0 -0
  154. data/app/assets/javascripts/ueditor/lang/en/images/localimage.png +0 -0
  155. data/app/assets/javascripts/ueditor/lang/en/images/music.png +0 -0
  156. data/app/assets/javascripts/ueditor/lang/en/images/rotateleftdisable.png +0 -0
  157. data/app/assets/javascripts/ueditor/lang/en/images/rotateleftenable.png +0 -0
  158. data/app/assets/javascripts/ueditor/lang/en/images/rotaterightdisable.png +0 -0
  159. data/app/assets/javascripts/ueditor/lang/en/images/rotaterightenable.png +0 -0
  160. data/app/assets/javascripts/ueditor/lang/en/images/upload.png +0 -0
  161. data/app/assets/javascripts/ueditor/lang/zh-cn/images/copy.png +0 -0
  162. data/app/assets/javascripts/ueditor/lang/zh-cn/images/localimage.png +0 -0
  163. data/app/assets/javascripts/ueditor/lang/zh-cn/images/music.png +0 -0
  164. data/app/assets/javascripts/ueditor/lang/zh-cn/images/upload.png +0 -0
  165. data/app/assets/javascripts/ueditor/lang/zh-cn/zh-cn.js +669 -0
  166. data/app/assets/javascripts/ueditor/themes/default/css/ueditor.css +1903 -0
  167. data/app/assets/javascripts/ueditor/themes/default/css/ueditor.min.css +8 -0
  168. data/app/assets/javascripts/ueditor/themes/default/dialogbase.css +100 -0
  169. data/app/assets/javascripts/ueditor/themes/default/images/anchor.gif +0 -0
  170. data/app/assets/javascripts/ueditor/themes/default/images/arrow.png +0 -0
  171. data/app/assets/javascripts/ueditor/themes/default/images/arrow_down.png +0 -0
  172. data/app/assets/javascripts/ueditor/themes/default/images/arrow_up.png +0 -0
  173. data/app/assets/javascripts/ueditor/themes/default/images/button-bg.gif +0 -0
  174. data/app/assets/javascripts/ueditor/themes/default/images/cancelbutton.gif +0 -0
  175. data/app/assets/javascripts/ueditor/themes/default/images/charts.png +0 -0
  176. data/app/assets/javascripts/ueditor/themes/default/images/cursor_h.gif +0 -0
  177. data/app/assets/javascripts/ueditor/themes/default/images/cursor_h.png +0 -0
  178. data/app/assets/javascripts/ueditor/themes/default/images/cursor_v.gif +0 -0
  179. data/app/assets/javascripts/ueditor/themes/default/images/cursor_v.png +0 -0
  180. data/app/assets/javascripts/ueditor/themes/default/images/dialog-title-bg.png +0 -0
  181. data/app/assets/javascripts/ueditor/themes/default/images/filescan.png +0 -0
  182. data/app/assets/javascripts/ueditor/themes/default/images/highlighted.gif +0 -0
  183. data/app/assets/javascripts/ueditor/themes/default/images/icons-all.gif +0 -0
  184. data/app/assets/javascripts/ueditor/themes/default/images/icons.gif +0 -0
  185. data/app/assets/javascripts/ueditor/themes/default/images/icons.png +0 -0
  186. data/app/assets/javascripts/ueditor/themes/default/images/loaderror.png +0 -0
  187. data/app/assets/javascripts/ueditor/themes/default/images/loading.gif +0 -0
  188. data/app/assets/javascripts/ueditor/themes/default/images/lock.gif +0 -0
  189. data/app/assets/javascripts/ueditor/themes/default/images/neweditor-tab-bg.png +0 -0
  190. data/app/assets/javascripts/ueditor/themes/default/images/pagebreak.gif +0 -0
  191. data/app/assets/javascripts/ueditor/themes/default/images/scale.png +0 -0
  192. data/app/assets/javascripts/ueditor/themes/default/images/sortable.png +0 -0
  193. data/app/assets/javascripts/ueditor/themes/default/images/spacer.gif +0 -0
  194. data/app/assets/javascripts/ueditor/themes/default/images/sparator_v.png +0 -0
  195. data/app/assets/javascripts/ueditor/themes/default/images/table-cell-align.png +0 -0
  196. data/app/assets/javascripts/ueditor/themes/default/images/tangram-colorpicker.png +0 -0
  197. data/app/assets/javascripts/ueditor/themes/default/images/toolbar_bg.png +0 -0
  198. data/app/assets/javascripts/ueditor/themes/default/images/unhighlighted.gif +0 -0
  199. data/app/assets/javascripts/ueditor/themes/default/images/upload.png +0 -0
  200. data/app/assets/javascripts/ueditor/themes/default/images/videologo.gif +0 -0
  201. data/app/assets/javascripts/ueditor/themes/default/images/word.gif +0 -0
  202. data/app/assets/javascripts/ueditor/themes/default/images/wordpaste.png +0 -0
  203. data/app/assets/javascripts/ueditor/themes/iframe.css +1 -0
  204. data/app/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCore.js +3655 -0
  205. data/app/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css +1 -0
  206. data/app/assets/javascripts/ueditor/third-party/codemirror/codemirror.css +104 -0
  207. data/app/assets/javascripts/ueditor/third-party/codemirror/codemirror.js +3581 -0
  208. data/app/assets/javascripts/ueditor/third-party/highcharts/adapters/mootools-adapter.js +13 -0
  209. data/app/assets/javascripts/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js +313 -0
  210. data/app/assets/javascripts/ueditor/third-party/highcharts/adapters/prototype-adapter.js +15 -0
  211. data/app/assets/javascripts/ueditor/third-party/highcharts/adapters/prototype-adapter.src.js +316 -0
  212. data/app/assets/javascripts/ueditor/third-party/highcharts/adapters/standalone-framework.js +17 -0
  213. data/app/assets/javascripts/ueditor/third-party/highcharts/adapters/standalone-framework.src.js +583 -0
  214. data/app/assets/javascripts/ueditor/third-party/highcharts/highcharts-more.js +50 -0
  215. data/app/assets/javascripts/ueditor/third-party/highcharts/highcharts-more.src.js +2430 -0
  216. data/app/assets/javascripts/ueditor/third-party/highcharts/highcharts.js +283 -0
  217. data/app/assets/javascripts/ueditor/third-party/highcharts/highcharts.src.js +16974 -0
  218. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/annotations.js +7 -0
  219. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/annotations.src.js +401 -0
  220. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/canvas-tools.js +133 -0
  221. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/canvas-tools.src.js +3113 -0
  222. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/data.js +17 -0
  223. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/data.src.js +582 -0
  224. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/drilldown.js +11 -0
  225. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/drilldown.src.js +447 -0
  226. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/exporting.js +22 -0
  227. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/exporting.src.js +709 -0
  228. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/funnel.js +12 -0
  229. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/funnel.src.js +289 -0
  230. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/heatmap.js +1 -0
  231. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/heatmap.src.js +53 -0
  232. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/map.js +27 -0
  233. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/map.src.js +1002 -0
  234. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/no-data-to-display.js +12 -0
  235. data/app/assets/javascripts/ueditor/third-party/highcharts/modules/no-data-to-display.src.js +128 -0
  236. data/app/assets/javascripts/ueditor/third-party/highcharts/themes/dark-blue.js +254 -0
  237. data/app/assets/javascripts/ueditor/third-party/highcharts/themes/dark-green.js +255 -0
  238. data/app/assets/javascripts/ueditor/third-party/highcharts/themes/gray.js +257 -0
  239. data/app/assets/javascripts/ueditor/third-party/highcharts/themes/grid.js +103 -0
  240. data/app/assets/javascripts/ueditor/third-party/highcharts/themes/skies.js +89 -0
  241. data/app/assets/javascripts/ueditor/third-party/jquery-1.10.2.js +9789 -0
  242. data/app/assets/javascripts/ueditor/third-party/jquery-1.10.2.min.js +6 -0
  243. data/app/assets/javascripts/ueditor/third-party/jquery-1.10.2.min.map +1 -0
  244. data/app/assets/javascripts/ueditor/third-party/snapscreen/UEditorSnapscreen.exe +0 -0
  245. data/app/assets/javascripts/ueditor/third-party/video-js/font/vjs.eot +0 -0
  246. data/app/assets/javascripts/ueditor/third-party/video-js/font/vjs.svg +65 -0
  247. data/app/assets/javascripts/ueditor/third-party/video-js/font/vjs.ttf +0 -0
  248. data/app/assets/javascripts/ueditor/third-party/video-js/font/vjs.woff +0 -0
  249. data/app/assets/javascripts/ueditor/third-party/video-js/video-js.css +766 -0
  250. data/app/assets/javascripts/ueditor/third-party/video-js/video-js.min.css +5 -0
  251. data/app/assets/javascripts/ueditor/third-party/video-js/video-js.swf +0 -0
  252. data/app/assets/javascripts/ueditor/third-party/video-js/video.dev.js +7108 -0
  253. data/app/assets/javascripts/ueditor/third-party/video-js/video.js +129 -0
  254. data/app/assets/javascripts/ueditor/third-party/webuploader/Uploader.swf +0 -0
  255. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.css +28 -0
  256. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.custom.js +5670 -0
  257. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.custom.min.js +2 -0
  258. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.flashonly.js +4176 -0
  259. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.flashonly.min.js +2 -0
  260. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.html5only.js +5559 -0
  261. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.html5only.min.js +2 -0
  262. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.js +6733 -0
  263. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.min.js +2 -0
  264. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.withoutimage.js +4593 -0
  265. data/app/assets/javascripts/ueditor/third-party/webuploader/webuploader.withoutimage.min.js +2 -0
  266. data/app/assets/javascripts/ueditor/third-party/xss.min.js +1 -0
  267. data/app/assets/javascripts/ueditor/third-party/zeroclipboard/ZeroClipboard.js +1256 -0
  268. data/app/assets/javascripts/ueditor/third-party/zeroclipboard/ZeroClipboard.min.js +9 -0
  269. data/app/assets/javascripts/ueditor/third-party/zeroclipboard/ZeroClipboard.swf +0 -0
  270. data/app/assets/javascripts/ueditor/ueditor.all.js +29568 -0
  271. data/app/assets/javascripts/ueditor/ueditor.all.min.js +18 -0
  272. data/app/assets/javascripts/ueditor/ueditor.config.js +497 -0
  273. data/app/assets/javascripts/ueditor/ueditor.parse.js +1022 -0
  274. data/app/assets/javascripts/ueditor/ueditor.parse.min.js +7 -0
  275. data/app/assets/javascripts/{ueditor → ueditor_custom}/preinit.js.erb +0 -0
  276. data/lib/baidu_ueditor_rails/version.rb +1 -1
  277. metadata +292 -21
@@ -0,0 +1,53 @@
1
+ <!DOCTYPE>
2
+ <html>
3
+ <head>
4
+ <title></title>
5
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
6
+ <script type="text/javascript" src="../internal.js"></script>
7
+ <style type="text/css">
8
+ .wrapper{width: 540px; margin: 10px auto;}
9
+ #appShow {border: 1px solid #ddd;}
10
+ .errorMsg{font-size: 13px;margin: 10px;color: #dd0000}
11
+ </style>
12
+ </head>
13
+ <body>
14
+ <div class="wrapper">
15
+ <div id="appShow"></div>
16
+ </div>
17
+ <script type="text/javascript">
18
+ //此处配置您在百度上申请到的appkey。
19
+ var apikey = editor.options.webAppKey;
20
+ if ( apikey && apikey.length == 24 ) {
21
+ var searchConfig = {
22
+ container:'appShow', //容器ID
23
+ tips:"", //该值用于自动清空
24
+ search:1, //是否显示搜索框
25
+ ps:12, //每页显示的条数
26
+ suggest:1, //是否开启搜索自动完成
27
+ limit:0, //搜索结果显示条数,0表示无限制
28
+ searchNow:0, //是否在初始化完成时立即搜索
29
+ apikey:apikey, //每人得
30
+ pager:1,
31
+ cid:7134562,
32
+ outputHTML:1
33
+ },baiduApp;
34
+
35
+ function clickCallback() {
36
+ baiduApp.addEventListener( 'getAppHTML', function ( e, data ) {
37
+ var url = 'http://app.baidu.com/app/enter?appid='+data.data['app_id'] +'&tn=app_canvas&app_spce_id=1&apikey='+apikey+'&api_key=' + apikey;
38
+ editor.execCommand( "webapp", {url:url,width:data.uniWidth,height:data.uniHeight+60,logo:data.data['app_logo'],title:data.data['app_name']});
39
+ dialog.close();
40
+ } );
41
+ }
42
+
43
+ var script = document.createElement( "script" );
44
+ script.type = "text/javascript";
45
+ script.src = "http://app.baidu.com/appweb/api/search?auto=yes&container=container&apikey=" + apikey + "&instanceName=baiduApp&callback=clickCallback&config=searchConfig";
46
+ document.body.appendChild( script );
47
+ } else {
48
+ $G( "appShow" ).innerHTML = "<p class='errorMsg'>"+lang.tip1+"<a title='"+lang.anthorApi+"' href='http://app.baidu.com/static/cms/getapikey.html' target='_blank'>"+lang.applyFor+"</a></p><p class='errorMsg'>"+lang.tip2+"</p>" ;
49
+ }
50
+
51
+ </script>
52
+ </body>
53
+ </html>
@@ -0,0 +1,1495 @@
1
+ // Copyright (c) 2009, Baidu Inc. All rights reserved.
2
+ //
3
+ // Licensed under the BSD License
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http:// tangram.baidu.com/license.html
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS-IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ /**
15
+ * @namespace T Tangram七巧板
16
+ * @name T
17
+ * @version 1.6.0
18
+ */
19
+
20
+ /**
21
+ * 声明baidu包
22
+ * @author: allstar, erik, meizz, berg
23
+ */
24
+ var T,
25
+ baidu = T = baidu || {version: "1.5.0"};
26
+ baidu.guid = "$BAIDU$";
27
+ baidu.$$ = window[baidu.guid] = window[baidu.guid] || {global:{}};
28
+
29
+ /**
30
+ * 使用flash资源封装的一些功能
31
+ * @namespace baidu.flash
32
+ */
33
+ baidu.flash = baidu.flash || {};
34
+
35
+ /**
36
+ * 操作dom的方法
37
+ * @namespace baidu.dom
38
+ */
39
+ baidu.dom = baidu.dom || {};
40
+
41
+
42
+ /**
43
+ * 从文档中获取指定的DOM元素
44
+ * @name baidu.dom.g
45
+ * @function
46
+ * @grammar baidu.dom.g(id)
47
+ * @param {string|HTMLElement} id 元素的id或DOM元素.
48
+ * @shortcut g,T.G
49
+ * @meta standard
50
+ * @see baidu.dom.q
51
+ *
52
+ * @return {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数.
53
+ */
54
+ baidu.dom.g = function(id) {
55
+ if (!id) return null;
56
+ if ('string' == typeof id || id instanceof String) {
57
+ return document.getElementById(id);
58
+ } else if (id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) {
59
+ return id;
60
+ }
61
+ return null;
62
+ };
63
+ baidu.g = baidu.G = baidu.dom.g;
64
+
65
+
66
+ /**
67
+ * 操作数组的方法
68
+ * @namespace baidu.array
69
+ */
70
+
71
+ baidu.array = baidu.array || {};
72
+
73
+
74
+ /**
75
+ * 遍历数组中所有元素
76
+ * @name baidu.array.each
77
+ * @function
78
+ * @grammar baidu.array.each(source, iterator[, thisObject])
79
+ * @param {Array} source 需要遍历的数组
80
+ * @param {Function} iterator 对每个数组元素进行调用的函数,该函数有两个参数,第一个为数组元素,第二个为数组索引值,function (item, index)。
81
+ * @param {Object} [thisObject] 函数调用时的this指针,如果没有此参数,默认是当前遍历的数组
82
+ * @remark
83
+ * each方法不支持对Object的遍历,对Object的遍历使用baidu.object.each 。
84
+ * @shortcut each
85
+ * @meta standard
86
+ *
87
+ * @returns {Array} 遍历的数组
88
+ */
89
+
90
+ baidu.each = baidu.array.forEach = baidu.array.each = function (source, iterator, thisObject) {
91
+ var returnValue, item, i, len = source.length;
92
+
93
+ if ('function' == typeof iterator) {
94
+ for (i = 0; i < len; i++) {
95
+ item = source[i];
96
+ returnValue = iterator.call(thisObject || source, item, i);
97
+
98
+ if (returnValue === false) {
99
+ break;
100
+ }
101
+ }
102
+ }
103
+ return source;
104
+ };
105
+
106
+ /**
107
+ * 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。
108
+ * @namespace baidu.lang
109
+ */
110
+ baidu.lang = baidu.lang || {};
111
+
112
+
113
+ /**
114
+ * 判断目标参数是否为function或Function实例
115
+ * @name baidu.lang.isFunction
116
+ * @function
117
+ * @grammar baidu.lang.isFunction(source)
118
+ * @param {Any} source 目标参数
119
+ * @version 1.2
120
+ * @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
121
+ * @meta standard
122
+ * @returns {boolean} 类型判断结果
123
+ */
124
+ baidu.lang.isFunction = function (source) {
125
+ return '[object Function]' == Object.prototype.toString.call(source);
126
+ };
127
+
128
+ /**
129
+ * 判断目标参数是否string类型或String对象
130
+ * @name baidu.lang.isString
131
+ * @function
132
+ * @grammar baidu.lang.isString(source)
133
+ * @param {Any} source 目标参数
134
+ * @shortcut isString
135
+ * @meta standard
136
+ * @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
137
+ *
138
+ * @returns {boolean} 类型判断结果
139
+ */
140
+ baidu.lang.isString = function (source) {
141
+ return '[object String]' == Object.prototype.toString.call(source);
142
+ };
143
+ baidu.isString = baidu.lang.isString;
144
+
145
+
146
+ /**
147
+ * 判断浏览器类型和特性的属性
148
+ * @namespace baidu.browser
149
+ */
150
+ baidu.browser = baidu.browser || {};
151
+
152
+
153
+ /**
154
+ * 判断是否为opera浏览器
155
+ * @property opera opera版本号
156
+ * @grammar baidu.browser.opera
157
+ * @meta standard
158
+ * @see baidu.browser.ie,baidu.browser.firefox,baidu.browser.safari,baidu.browser.chrome
159
+ * @returns {Number} opera版本号
160
+ */
161
+
162
+ /**
163
+ * opera 从10开始不是用opera后面的字符串进行版本的判断
164
+ * 在Browser identification最后添加Version + 数字进行版本标识
165
+ * opera后面的数字保持在9.80不变
166
+ */
167
+ baidu.browser.opera = /opera(\/| )(\d+(\.\d+)?)(.+?(version\/(\d+(\.\d+)?)))?/i.test(navigator.userAgent) ? + ( RegExp["\x246"] || RegExp["\x242"] ) : undefined;
168
+
169
+
170
+ /**
171
+ * 在目标元素的指定位置插入HTML代码
172
+ * @name baidu.dom.insertHTML
173
+ * @function
174
+ * @grammar baidu.dom.insertHTML(element, position, html)
175
+ * @param {HTMLElement|string} element 目标元素或目标元素的id
176
+ * @param {string} position 插入html的位置信息,取值为beforeBegin,afterBegin,beforeEnd,afterEnd
177
+ * @param {string} html 要插入的html
178
+ * @remark
179
+ *
180
+ * 对于position参数,大小写不敏感<br>
181
+ * 参数的意思:beforeBegin&lt;span&gt;afterBegin this is span! beforeEnd&lt;/span&gt; afterEnd <br />
182
+ * 此外,如果使用本函数插入带有script标签的HTML字符串,script标签对应的脚本将不会被执行。
183
+ *
184
+ * @shortcut insertHTML
185
+ * @meta standard
186
+ *
187
+ * @returns {HTMLElement} 目标元素
188
+ */
189
+ baidu.dom.insertHTML = function (element, position, html) {
190
+ element = baidu.dom.g(element);
191
+ var range,begin;
192
+ if (element.insertAdjacentHTML && !baidu.browser.opera) {
193
+ element.insertAdjacentHTML(position, html);
194
+ } else {
195
+ range = element.ownerDocument.createRange();
196
+ position = position.toUpperCase();
197
+ if (position == 'AFTERBEGIN' || position == 'BEFOREEND') {
198
+ range.selectNodeContents(element);
199
+ range.collapse(position == 'AFTERBEGIN');
200
+ } else {
201
+ begin = position == 'BEFOREBEGIN';
202
+ range[begin ? 'setStartBefore' : 'setEndAfter'](element);
203
+ range.collapse(begin);
204
+ }
205
+ range.insertNode(range.createContextualFragment(html));
206
+ }
207
+ return element;
208
+ };
209
+
210
+ baidu.insertHTML = baidu.dom.insertHTML;
211
+
212
+ /**
213
+ * 操作flash对象的方法,包括创建flash对象、获取flash对象以及判断flash插件的版本号
214
+ * @namespace baidu.swf
215
+ */
216
+ baidu.swf = baidu.swf || {};
217
+
218
+
219
+ /**
220
+ * 浏览器支持的flash插件版本
221
+ * @property version 浏览器支持的flash插件版本
222
+ * @grammar baidu.swf.version
223
+ * @return {String} 版本号
224
+ * @meta standard
225
+ */
226
+ baidu.swf.version = (function () {
227
+ var n = navigator;
228
+ if (n.plugins && n.mimeTypes.length) {
229
+ var plugin = n.plugins["Shockwave Flash"];
230
+ if (plugin && plugin.description) {
231
+ return plugin.description
232
+ .replace(/([a-zA-Z]|\s)+/, "")
233
+ .replace(/(\s)+r/, ".") + ".0";
234
+ }
235
+ } else if (window.ActiveXObject && !window.opera) {
236
+ for (var i = 12; i >= 2; i--) {
237
+ try {
238
+ var c = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.' + i);
239
+ if (c) {
240
+ var version = c.GetVariable("$version");
241
+ return version.replace(/WIN/g,'').replace(/,/g,'.');
242
+ }
243
+ } catch(e) {}
244
+ }
245
+ }
246
+ })();
247
+
248
+ /**
249
+ * 操作字符串的方法
250
+ * @namespace baidu.string
251
+ */
252
+ baidu.string = baidu.string || {};
253
+
254
+
255
+ /**
256
+ * 对目标字符串进行html编码
257
+ * @name baidu.string.encodeHTML
258
+ * @function
259
+ * @grammar baidu.string.encodeHTML(source)
260
+ * @param {string} source 目标字符串
261
+ * @remark
262
+ * 编码字符有5个:&<>"'
263
+ * @shortcut encodeHTML
264
+ * @meta standard
265
+ * @see baidu.string.decodeHTML
266
+ *
267
+ * @returns {string} html编码后的字符串
268
+ */
269
+ baidu.string.encodeHTML = function (source) {
270
+ return String(source)
271
+ .replace(/&/g,'&amp;')
272
+ .replace(/</g,'&lt;')
273
+ .replace(/>/g,'&gt;')
274
+ .replace(/"/g, "&quot;")
275
+ .replace(/'/g, "&#39;");
276
+ };
277
+
278
+ baidu.encodeHTML = baidu.string.encodeHTML;
279
+
280
+ /**
281
+ * 创建flash对象的html字符串
282
+ * @name baidu.swf.createHTML
283
+ * @function
284
+ * @grammar baidu.swf.createHTML(options)
285
+ *
286
+ * @param {Object} options 创建flash的选项参数
287
+ * @param {string} options.id 要创建的flash的标识
288
+ * @param {string} options.url flash文件的url
289
+ * @param {String} options.errorMessage 未安装flash player或flash player版本号过低时的提示
290
+ * @param {string} options.ver 最低需要的flash player版本号
291
+ * @param {string} options.width flash的宽度
292
+ * @param {string} options.height flash的高度
293
+ * @param {string} options.align flash的对齐方式,允许值:middle/left/right/top/bottom
294
+ * @param {string} options.base 设置用于解析swf文件中的所有相对路径语句的基本目录或URL
295
+ * @param {string} options.bgcolor swf文件的背景色
296
+ * @param {string} options.salign 设置缩放的swf文件在由width和height设置定义的区域内的位置。允许值:l/r/t/b/tl/tr/bl/br
297
+ * @param {boolean} options.menu 是否显示右键菜单,允许值:true/false
298
+ * @param {boolean} options.loop 播放到最后一帧时是否重新播放,允许值: true/false
299
+ * @param {boolean} options.play flash是否在浏览器加载时就开始播放。允许值:true/false
300
+ * @param {string} options.quality 设置flash播放的画质,允许值:low/medium/high/autolow/autohigh/best
301
+ * @param {string} options.scale 设置flash内容如何缩放来适应设置的宽高。允许值:showall/noborder/exactfit
302
+ * @param {string} options.wmode 设置flash的显示模式。允许值:window/opaque/transparent
303
+ * @param {string} options.allowscriptaccess 设置flash与页面的通信权限。允许值:always/never/sameDomain
304
+ * @param {string} options.allownetworking 设置swf文件中允许使用的网络API。允许值:all/internal/none
305
+ * @param {boolean} options.allowfullscreen 是否允许flash全屏。允许值:true/false
306
+ * @param {boolean} options.seamlesstabbing 允许设置执行无缝跳格,从而使用户能跳出flash应用程序。该参数只能在安装Flash7及更高版本的Windows中使用。允许值:true/false
307
+ * @param {boolean} options.devicefont 设置静态文本对象是否以设备字体呈现。允许值:true/false
308
+ * @param {boolean} options.swliveconnect 第一次加载flash时浏览器是否应启动Java。允许值:true/false
309
+ * @param {Object} options.vars 要传递给flash的参数,支持JSON或string类型。
310
+ *
311
+ * @see baidu.swf.create
312
+ * @meta standard
313
+ * @returns {string} flash对象的html字符串
314
+ */
315
+ baidu.swf.createHTML = function (options) {
316
+ options = options || {};
317
+ var version = baidu.swf.version,
318
+ needVersion = options['ver'] || '6.0.0',
319
+ vUnit1, vUnit2, i, k, len, item, tmpOpt = {},
320
+ encodeHTML = baidu.string.encodeHTML;
321
+ for (k in options) {
322
+ tmpOpt[k] = options[k];
323
+ }
324
+ options = tmpOpt;
325
+ if (version) {
326
+ version = version.split('.');
327
+ needVersion = needVersion.split('.');
328
+ for (i = 0; i < 3; i++) {
329
+ vUnit1 = parseInt(version[i], 10);
330
+ vUnit2 = parseInt(needVersion[i], 10);
331
+ if (vUnit2 < vUnit1) {
332
+ break;
333
+ } else if (vUnit2 > vUnit1) {
334
+ return '';
335
+ }
336
+ }
337
+ } else {
338
+ return '';
339
+ }
340
+
341
+ var vars = options['vars'],
342
+ objProperties = ['classid', 'codebase', 'id', 'width', 'height', 'align'];
343
+ options['align'] = options['align'] || 'middle';
344
+ options['classid'] = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
345
+ options['codebase'] = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0';
346
+ options['movie'] = options['url'] || '';
347
+ delete options['vars'];
348
+ delete options['url'];
349
+ if ('string' == typeof vars) {
350
+ options['flashvars'] = vars;
351
+ } else {
352
+ var fvars = [];
353
+ for (k in vars) {
354
+ item = vars[k];
355
+ fvars.push(k + "=" + encodeURIComponent(item));
356
+ }
357
+ options['flashvars'] = fvars.join('&');
358
+ }
359
+ var str = ['<object '];
360
+ for (i = 0, len = objProperties.length; i < len; i++) {
361
+ item = objProperties[i];
362
+ str.push(' ', item, '="', encodeHTML(options[item]), '"');
363
+ }
364
+ str.push('>');
365
+ var params = {
366
+ 'wmode' : 1,
367
+ 'scale' : 1,
368
+ 'quality' : 1,
369
+ 'play' : 1,
370
+ 'loop' : 1,
371
+ 'menu' : 1,
372
+ 'salign' : 1,
373
+ 'bgcolor' : 1,
374
+ 'base' : 1,
375
+ 'allowscriptaccess' : 1,
376
+ 'allownetworking' : 1,
377
+ 'allowfullscreen' : 1,
378
+ 'seamlesstabbing' : 1,
379
+ 'devicefont' : 1,
380
+ 'swliveconnect' : 1,
381
+ 'flashvars' : 1,
382
+ 'movie' : 1
383
+ };
384
+
385
+ for (k in options) {
386
+ item = options[k];
387
+ k = k.toLowerCase();
388
+ if (params[k] && (item || item === false || item === 0)) {
389
+ str.push('<param name="' + k + '" value="' + encodeHTML(item) + '" />');
390
+ }
391
+ }
392
+ options['src'] = options['movie'];
393
+ options['name'] = options['id'];
394
+ delete options['id'];
395
+ delete options['movie'];
396
+ delete options['classid'];
397
+ delete options['codebase'];
398
+ options['type'] = 'application/x-shockwave-flash';
399
+ options['pluginspage'] = 'http://www.macromedia.com/go/getflashplayer';
400
+ str.push('<embed');
401
+ var salign;
402
+ for (k in options) {
403
+ item = options[k];
404
+ if (item || item === false || item === 0) {
405
+ if ((new RegExp("^salign\x24", "i")).test(k)) {
406
+ salign = item;
407
+ continue;
408
+ }
409
+
410
+ str.push(' ', k, '="', encodeHTML(item), '"');
411
+ }
412
+ }
413
+
414
+ if (salign) {
415
+ str.push(' salign="', encodeHTML(salign), '"');
416
+ }
417
+ str.push('></embed></object>');
418
+
419
+ return str.join('');
420
+ };
421
+
422
+
423
+ /**
424
+ * 在页面中创建一个flash对象
425
+ * @name baidu.swf.create
426
+ * @function
427
+ * @grammar baidu.swf.create(options[, container])
428
+ *
429
+ * @param {Object} options 创建flash的选项参数
430
+ * @param {string} options.id 要创建的flash的标识
431
+ * @param {string} options.url flash文件的url
432
+ * @param {String} options.errorMessage 未安装flash player或flash player版本号过低时的提示
433
+ * @param {string} options.ver 最低需要的flash player版本号
434
+ * @param {string} options.width flash的宽度
435
+ * @param {string} options.height flash的高度
436
+ * @param {string} options.align flash的对齐方式,允许值:middle/left/right/top/bottom
437
+ * @param {string} options.base 设置用于解析swf文件中的所有相对路径语句的基本目录或URL
438
+ * @param {string} options.bgcolor swf文件的背景色
439
+ * @param {string} options.salign 设置缩放的swf文件在由width和height设置定义的区域内的位置。允许值:l/r/t/b/tl/tr/bl/br
440
+ * @param {boolean} options.menu 是否显示右键菜单,允许值:true/false
441
+ * @param {boolean} options.loop 播放到最后一帧时是否重新播放,允许值: true/false
442
+ * @param {boolean} options.play flash是否在浏览器加载时就开始播放。允许值:true/false
443
+ * @param {string} options.quality 设置flash播放的画质,允许值:low/medium/high/autolow/autohigh/best
444
+ * @param {string} options.scale 设置flash内容如何缩放来适应设置的宽高。允许值:showall/noborder/exactfit
445
+ * @param {string} options.wmode 设置flash的显示模式。允许值:window/opaque/transparent
446
+ * @param {string} options.allowscriptaccess 设置flash与页面的通信权限。允许值:always/never/sameDomain
447
+ * @param {string} options.allownetworking 设置swf文件中允许使用的网络API。允许值:all/internal/none
448
+ * @param {boolean} options.allowfullscreen 是否允许flash全屏。允许值:true/false
449
+ * @param {boolean} options.seamlesstabbing 允许设置执行无缝跳格,从而使用户能跳出flash应用程序。该参数只能在安装Flash7及更高版本的Windows中使用。允许值:true/false
450
+ * @param {boolean} options.devicefont 设置静态文本对象是否以设备字体呈现。允许值:true/false
451
+ * @param {boolean} options.swliveconnect 第一次加载flash时浏览器是否应启动Java。允许值:true/false
452
+ * @param {Object} options.vars 要传递给flash的参数,支持JSON或string类型。
453
+ *
454
+ * @param {HTMLElement|string} [container] flash对象的父容器元素,不传递该参数时在当前代码位置创建flash对象。
455
+ * @meta standard
456
+ * @see baidu.swf.createHTML,baidu.swf.getMovie
457
+ */
458
+ baidu.swf.create = function (options, target) {
459
+ options = options || {};
460
+ var html = baidu.swf.createHTML(options)
461
+ || options['errorMessage']
462
+ || '';
463
+
464
+ if (target && 'string' == typeof target) {
465
+ target = document.getElementById(target);
466
+ }
467
+ baidu.dom.insertHTML( target || document.body ,'beforeEnd',html );
468
+ };
469
+ /**
470
+ * 判断是否为ie浏览器
471
+ * @name baidu.browser.ie
472
+ * @field
473
+ * @grammar baidu.browser.ie
474
+ * @returns {Number} IE版本号
475
+ */
476
+ baidu.browser.ie = baidu.ie = /msie (\d+\.\d+)/i.test(navigator.userAgent) ? (document.documentMode || + RegExp['\x241']) : undefined;
477
+
478
+ /**
479
+ * 移除数组中的项
480
+ * @name baidu.array.remove
481
+ * @function
482
+ * @grammar baidu.array.remove(source, match)
483
+ * @param {Array} source 需要移除项的数组
484
+ * @param {Any} match 要移除的项
485
+ * @meta standard
486
+ * @see baidu.array.removeAt
487
+ *
488
+ * @returns {Array} 移除后的数组
489
+ */
490
+ baidu.array.remove = function (source, match) {
491
+ var len = source.length;
492
+
493
+ while (len--) {
494
+ if (len in source && source[len] === match) {
495
+ source.splice(len, 1);
496
+ }
497
+ }
498
+ return source;
499
+ };
500
+
501
+ /**
502
+ * 判断目标参数是否Array对象
503
+ * @name baidu.lang.isArray
504
+ * @function
505
+ * @grammar baidu.lang.isArray(source)
506
+ * @param {Any} source 目标参数
507
+ * @meta standard
508
+ * @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
509
+ *
510
+ * @returns {boolean} 类型判断结果
511
+ */
512
+ baidu.lang.isArray = function (source) {
513
+ return '[object Array]' == Object.prototype.toString.call(source);
514
+ };
515
+
516
+
517
+
518
+ /**
519
+ * 将一个变量转换成array
520
+ * @name baidu.lang.toArray
521
+ * @function
522
+ * @grammar baidu.lang.toArray(source)
523
+ * @param {mix} source 需要转换成array的变量
524
+ * @version 1.3
525
+ * @meta standard
526
+ * @returns {array} 转换后的array
527
+ */
528
+ baidu.lang.toArray = function (source) {
529
+ if (source === null || source === undefined)
530
+ return [];
531
+ if (baidu.lang.isArray(source))
532
+ return source;
533
+ if (typeof source.length !== 'number' || typeof source === 'string' || baidu.lang.isFunction(source)) {
534
+ return [source];
535
+ }
536
+ if (source.item) {
537
+ var l = source.length, array = new Array(l);
538
+ while (l--)
539
+ array[l] = source[l];
540
+ return array;
541
+ }
542
+
543
+ return [].slice.call(source);
544
+ };
545
+
546
+ /**
547
+ * 获得flash对象的实例
548
+ * @name baidu.swf.getMovie
549
+ * @function
550
+ * @grammar baidu.swf.getMovie(name)
551
+ * @param {string} name flash对象的名称
552
+ * @see baidu.swf.create
553
+ * @meta standard
554
+ * @returns {HTMLElement} flash对象的实例
555
+ */
556
+ baidu.swf.getMovie = function (name) {
557
+ var movie = document[name], ret;
558
+ return baidu.browser.ie == 9 ?
559
+ movie && movie.length ?
560
+ (ret = baidu.array.remove(baidu.lang.toArray(movie),function(item){
561
+ return item.tagName.toLowerCase() != "embed";
562
+ })).length == 1 ? ret[0] : ret
563
+ : movie
564
+ : movie || window[name];
565
+ };
566
+
567
+
568
+ baidu.flash._Base = (function(){
569
+
570
+ var prefix = 'bd__flash__';
571
+
572
+ /**
573
+ * 创建一个随机的字符串
574
+ * @private
575
+ * @return {String}
576
+ */
577
+ function _createString(){
578
+ return prefix + Math.floor(Math.random() * 2147483648).toString(36);
579
+ };
580
+
581
+ /**
582
+ * 检查flash状态
583
+ * @private
584
+ * @param {Object} target flash对象
585
+ * @return {Boolean}
586
+ */
587
+ function _checkReady(target){
588
+ if(typeof target !== 'undefined' && typeof target.flashInit !== 'undefined' && target.flashInit()){
589
+ return true;
590
+ }else{
591
+ return false;
592
+ }
593
+ };
594
+
595
+ /**
596
+ * 调用之前进行压栈的函数
597
+ * @private
598
+ * @param {Array} callQueue 调用队列
599
+ * @param {Object} target flash对象
600
+ * @return {Null}
601
+ */
602
+ function _callFn(callQueue, target){
603
+ var result = null;
604
+
605
+ callQueue = callQueue.reverse();
606
+ baidu.each(callQueue, function(item){
607
+ result = target.call(item.fnName, item.params);
608
+ item.callBack(result);
609
+ });
610
+ };
611
+
612
+ /**
613
+ * 为传入的匿名函数创建函数名
614
+ * @private
615
+ * @param {String|Function} fun 传入的匿名函数或者函数名
616
+ * @return {String}
617
+ */
618
+ function _createFunName(fun){
619
+ var name = '';
620
+
621
+ if(baidu.lang.isFunction(fun)){
622
+ name = _createString();
623
+ window[name] = function(){
624
+ fun.apply(window, arguments);
625
+ };
626
+
627
+ return name;
628
+ }else if(baidu.lang.isString){
629
+ return fun;
630
+ }
631
+ };
632
+
633
+ /**
634
+ * 绘制flash
635
+ * @private
636
+ * @param {Object} options 创建参数
637
+ * @return {Object}
638
+ */
639
+ function _render(options){
640
+ if(!options.id){
641
+ options.id = _createString();
642
+ }
643
+
644
+ var container = options.container || '';
645
+ delete(options.container);
646
+
647
+ baidu.swf.create(options, container);
648
+
649
+ return baidu.swf.getMovie(options.id);
650
+ };
651
+
652
+ return function(options, callBack){
653
+ var me = this,
654
+ autoRender = (typeof options.autoRender !== 'undefined' ? options.autoRender : true),
655
+ createOptions = options.createOptions || {},
656
+ target = null,
657
+ isReady = false,
658
+ callQueue = [],
659
+ timeHandle = null,
660
+ callBack = callBack || [];
661
+
662
+ /**
663
+ * 将flash文件绘制到页面上
664
+ * @public
665
+ * @return {Null}
666
+ */
667
+ me.render = function(){
668
+ target = _render(createOptions);
669
+
670
+ if(callBack.length > 0){
671
+ baidu.each(callBack, function(funName, index){
672
+ callBack[index] = _createFunName(options[funName] || new Function());
673
+ });
674
+ }
675
+ me.call('setJSFuncName', [callBack]);
676
+ };
677
+
678
+ /**
679
+ * 返回flash状态
680
+ * @return {Boolean}
681
+ */
682
+ me.isReady = function(){
683
+ return isReady;
684
+ };
685
+
686
+ /**
687
+ * 调用flash接口的统一入口
688
+ * @param {String} fnName 调用的函数名
689
+ * @param {Array} params 传入的参数组成的数组,若不许要参数,需传入空数组
690
+ * @param {Function} [callBack] 异步调用后将返回值作为参数的调用回调函数,如无返回值,可以不传入此参数
691
+ * @return {Null}
692
+ */
693
+ me.call = function(fnName, params, callBack){
694
+ if(!fnName) return null;
695
+ callBack = callBack || new Function();
696
+
697
+ var result = null;
698
+
699
+ if(isReady){
700
+ result = target.call(fnName, params);
701
+ callBack(result);
702
+ }else{
703
+ callQueue.push({
704
+ fnName: fnName,
705
+ params: params,
706
+ callBack: callBack
707
+ });
708
+
709
+ (!timeHandle) && (timeHandle = setInterval(_check, 200));
710
+ }
711
+ };
712
+
713
+ /**
714
+ * 为传入的匿名函数创建函数名
715
+ * @public
716
+ * @param {String|Function} fun 传入的匿名函数或者函数名
717
+ * @return {String}
718
+ */
719
+ me.createFunName = function(fun){
720
+ return _createFunName(fun);
721
+ };
722
+
723
+ /**
724
+ * 检查flash是否ready, 并进行调用
725
+ * @private
726
+ * @return {Null}
727
+ */
728
+ function _check(){
729
+ if(_checkReady(target)){
730
+ clearInterval(timeHandle);
731
+ timeHandle = null;
732
+ _call();
733
+
734
+ isReady = true;
735
+ }
736
+ };
737
+
738
+ /**
739
+ * 调用之前进行压栈的函数
740
+ * @private
741
+ * @return {Null}
742
+ */
743
+ function _call(){
744
+ _callFn(callQueue, target);
745
+ callQueue = [];
746
+ }
747
+
748
+ autoRender && me.render();
749
+ };
750
+ })();
751
+
752
+
753
+
754
+ /**
755
+ * 创建flash based imageUploader
756
+ * @class
757
+ * @grammar baidu.flash.imageUploader(options)
758
+ * @param {Object} createOptions 创建flash时需要的参数,请参照baidu.swf.create文档
759
+ * @config {Object} vars 创建imageUploader时所需要的参数
760
+ * @config {Number} vars.gridWidth 每一个预览图片所占的宽度,应该为flash寛的整除
761
+ * @config {Number} vars.gridHeight 每一个预览图片所占的高度,应该为flash高的整除
762
+ * @config {Number} vars.picWidth 单张预览图片的宽度
763
+ * @config {Number} vars.picHeight 单张预览图片的高度
764
+ * @config {String} vars.uploadDataFieldName POST请求中图片数据的key,默认值'picdata'
765
+ * @config {String} vars.picDescFieldName POST请求中图片描述的key,默认值'picDesc'
766
+ * @config {Number} vars.maxSize 文件的最大体积,单位'MB'
767
+ * @config {Number} vars.compressSize 上传前如果图片体积超过该值,会先压缩
768
+ * @config {Number} vars.maxNum:32 最大上传多少个文件
769
+ * @config {Number} vars.compressLength 能接受的最大边长,超过该值会等比压缩
770
+ * @config {String} vars.url 上传的url地址
771
+ * @config {Number} vars.mode mode == 0时,是使用滚动条,mode == 1时,拉伸flash, 默认值为0
772
+ * @see baidu.swf.createHTML
773
+ * @param {String} backgroundUrl 背景图片路径
774
+ * @param {String} listBacgroundkUrl 布局控件背景
775
+ * @param {String} buttonUrl 按钮图片不背景
776
+ * @param {String|Function} selectFileCallback 选择文件的回调
777
+ * @param {String|Function} exceedFileCallback文件超出限制的最大体积时的回调
778
+ * @param {String|Function} deleteFileCallback 删除文件的回调
779
+ * @param {String|Function} startUploadCallback 开始上传某个文件时的回调
780
+ * @param {String|Function} uploadCompleteCallback 某个文件上传完成的回调
781
+ * @param {String|Function} uploadErrorCallback 某个文件上传失败的回调
782
+ * @param {String|Function} allCompleteCallback 全部上传完成时的回调
783
+ * @param {String|Function} changeFlashHeight 改变Flash的高度,mode==1的时候才有用
784
+ */
785
+ baidu.flash.imageUploader = baidu.flash.imageUploader || function(options){
786
+
787
+ var me = this,
788
+ options = options || {},
789
+ _flash = new baidu.flash._Base(options, [
790
+ 'selectFileCallback',
791
+ 'exceedFileCallback',
792
+ 'deleteFileCallback',
793
+ 'startUploadCallback',
794
+ 'uploadCompleteCallback',
795
+ 'uploadErrorCallback',
796
+ 'allCompleteCallback',
797
+ 'changeFlashHeight'
798
+ ]);
799
+ /**
800
+ * 开始或回复上传图片
801
+ * @public
802
+ * @return {Null}
803
+ */
804
+ me.upload = function(){
805
+ _flash.call('upload');
806
+ };
807
+
808
+ /**
809
+ * 暂停上传图片
810
+ * @public
811
+ * @return {Null}
812
+ */
813
+ me.pause = function(){
814
+ _flash.call('pause');
815
+ };
816
+ me.addCustomizedParams = function(index,obj){
817
+ _flash.call('addCustomizedParams',[index,obj]);
818
+ }
819
+ };
820
+
821
+ /**
822
+ * 操作原生对象的方法
823
+ * @namespace baidu.object
824
+ */
825
+ baidu.object = baidu.object || {};
826
+
827
+
828
+ /**
829
+ * 将源对象的所有属性拷贝到目标对象中
830
+ * @author erik
831
+ * @name baidu.object.extend
832
+ * @function
833
+ * @grammar baidu.object.extend(target, source)
834
+ * @param {Object} target 目标对象
835
+ * @param {Object} source 源对象
836
+ * @see baidu.array.merge
837
+ * @remark
838
+ *
839
+ 1.目标对象中,与源对象key相同的成员将会被覆盖。<br>
840
+ 2.源对象的prototype成员不会拷贝。
841
+
842
+ * @shortcut extend
843
+ * @meta standard
844
+ *
845
+ * @returns {Object} 目标对象
846
+ */
847
+ baidu.extend =
848
+ baidu.object.extend = function (target, source) {
849
+ for (var p in source) {
850
+ if (source.hasOwnProperty(p)) {
851
+ target[p] = source[p];
852
+ }
853
+ }
854
+
855
+ return target;
856
+ };
857
+
858
+
859
+
860
+
861
+
862
+ /**
863
+ * 创建flash based fileUploader
864
+ * @class
865
+ * @grammar baidu.flash.fileUploader(options)
866
+ * @param {Object} options
867
+ * @config {Object} createOptions 创建flash时需要的参数,请参照baidu.swf.create文档
868
+ * @config {String} createOptions.width
869
+ * @config {String} createOptions.height
870
+ * @config {Number} maxNum 最大可选文件数
871
+ * @config {Function|String} selectFile
872
+ * @config {Function|String} exceedMaxSize
873
+ * @config {Function|String} deleteFile
874
+ * @config {Function|String} uploadStart
875
+ * @config {Function|String} uploadComplete
876
+ * @config {Function|String} uploadError
877
+ * @config {Function|String} uploadProgress
878
+ */
879
+ baidu.flash.fileUploader = baidu.flash.fileUploader || function(options){
880
+ var me = this,
881
+ options = options || {};
882
+
883
+ options.createOptions = baidu.extend({
884
+ wmod: 'transparent'
885
+ },options.createOptions || {});
886
+
887
+ var _flash = new baidu.flash._Base(options, [
888
+ 'selectFile',
889
+ 'exceedMaxSize',
890
+ 'deleteFile',
891
+ 'uploadStart',
892
+ 'uploadComplete',
893
+ 'uploadError',
894
+ 'uploadProgress'
895
+ ]);
896
+
897
+ _flash.call('setMaxNum', options.maxNum ? [options.maxNum] : [1]);
898
+
899
+ /**
900
+ * 设置当鼠标移动到flash上时,是否变成手型
901
+ * @public
902
+ * @param {Boolean} isCursor
903
+ * @return {Null}
904
+ */
905
+ me.setHandCursor = function(isCursor){
906
+ _flash.call('setHandCursor', [isCursor || false]);
907
+ };
908
+
909
+ /**
910
+ * 设置鼠标相应函数名
911
+ * @param {String|Function} fun
912
+ */
913
+ me.setMSFunName = function(fun){
914
+ _flash.call('setMSFunName',[_flash.createFunName(fun)]);
915
+ };
916
+
917
+ /**
918
+ * 执行上传操作
919
+ * @param {String} url 上传的url
920
+ * @param {String} fieldName 上传的表单字段名
921
+ * @param {Object} postData 键值对,上传的POST数据
922
+ * @param {Number|Array|null|-1} [index]上传的文件序列
923
+ * Int值上传该文件
924
+ * Array一次串行上传该序列文件
925
+ * -1/null上传所有文件
926
+ * @return {Null}
927
+ */
928
+ me.upload = function(url, fieldName, postData, index){
929
+
930
+ if(typeof url !== 'string' || typeof fieldName !== 'string') return null;
931
+ if(typeof index === 'undefined') index = -1;
932
+
933
+ _flash.call('upload', [url, fieldName, postData, index]);
934
+ };
935
+
936
+ /**
937
+ * 取消上传操作
938
+ * @public
939
+ * @param {Number|-1} index
940
+ */
941
+ me.cancel = function(index){
942
+ if(typeof index === 'undefined') index = -1;
943
+ _flash.call('cancel', [index]);
944
+ };
945
+
946
+ /**
947
+ * 删除文件
948
+ * @public
949
+ * @param {Number|Array} [index] 要删除的index,不传则全部删除
950
+ * @param {Function} callBack
951
+ * */
952
+ me.deleteFile = function(index, callBack){
953
+
954
+ var callBackAll = function(list){
955
+ callBack && callBack(list);
956
+ };
957
+
958
+ if(typeof index === 'undefined'){
959
+ _flash.call('deleteFilesAll', [], callBackAll);
960
+ return;
961
+ };
962
+
963
+ if(typeof index === 'Number') index = [index];
964
+ index.sort(function(a,b){
965
+ return b-a;
966
+ });
967
+ baidu.each(index, function(item){
968
+ _flash.call('deleteFileBy', item, callBackAll);
969
+ });
970
+ };
971
+
972
+ /**
973
+ * 添加文件类型,支持macType
974
+ * @public
975
+ * @param {Object|Array[Object]} type {description:String, extention:String}
976
+ * @return {Null};
977
+ */
978
+ me.addFileType = function(type){
979
+ var type = type || [[]];
980
+
981
+ if(type instanceof Array) type = [type];
982
+ else type = [[type]];
983
+ _flash.call('addFileTypes', type);
984
+ };
985
+
986
+ /**
987
+ * 设置文件类型,支持macType
988
+ * @public
989
+ * @param {Object|Array[Object]} type {description:String, extention:String}
990
+ * @return {Null};
991
+ */
992
+ me.setFileType = function(type){
993
+ var type = type || [[]];
994
+
995
+ if(type instanceof Array) type = [type];
996
+ else type = [[type]];
997
+ _flash.call('setFileTypes', type);
998
+ };
999
+
1000
+ /**
1001
+ * 设置可选文件的数量限制
1002
+ * @public
1003
+ * @param {Number} num
1004
+ * @return {Null}
1005
+ */
1006
+ me.setMaxNum = function(num){
1007
+ _flash.call('setMaxNum', [num]);
1008
+ };
1009
+
1010
+ /**
1011
+ * 设置可选文件大小限制,以兆M为单位
1012
+ * @public
1013
+ * @param {Number} num,0为无限制
1014
+ * @return {Null}
1015
+ */
1016
+ me.setMaxSize = function(num){
1017
+ _flash.call('setMaxSize', [num]);
1018
+ };
1019
+
1020
+ /**
1021
+ * @public
1022
+ */
1023
+ me.getFileAll = function(callBack){
1024
+ _flash.call('getFileAll', [], callBack);
1025
+ };
1026
+
1027
+ /**
1028
+ * @public
1029
+ * @param {Number} index
1030
+ * @param {Function} [callBack]
1031
+ */
1032
+ me.getFileByIndex = function(index, callBack){
1033
+ _flash.call('getFileByIndex', [], callBack);
1034
+ };
1035
+
1036
+ /**
1037
+ * @public
1038
+ * @param {Number} index
1039
+ * @param {function} [callBack]
1040
+ */
1041
+ me.getStatusByIndex = function(index, callBack){
1042
+ _flash.call('getStatusByIndex', [], callBack);
1043
+ };
1044
+ };
1045
+
1046
+ /**
1047
+ * 使用动态script标签请求服务器资源,包括由服务器端的回调和浏览器端的回调
1048
+ * @namespace baidu.sio
1049
+ */
1050
+ baidu.sio = baidu.sio || {};
1051
+
1052
+ /**
1053
+ *
1054
+ * @param {HTMLElement} src script节点
1055
+ * @param {String} url script节点的地址
1056
+ * @param {String} [charset] 编码
1057
+ */
1058
+ baidu.sio._createScriptTag = function(scr, url, charset){
1059
+ scr.setAttribute('type', 'text/javascript');
1060
+ charset && scr.setAttribute('charset', charset);
1061
+ scr.setAttribute('src', url);
1062
+ document.getElementsByTagName('head')[0].appendChild(scr);
1063
+ };
1064
+
1065
+ /**
1066
+ * 删除script的属性,再删除script标签,以解决修复内存泄漏的问题
1067
+ *
1068
+ * @param {HTMLElement} src script节点
1069
+ */
1070
+ baidu.sio._removeScriptTag = function(scr){
1071
+ if (scr.clearAttributes) {
1072
+ scr.clearAttributes();
1073
+ } else {
1074
+ for (var attr in scr) {
1075
+ if (scr.hasOwnProperty(attr)) {
1076
+ delete scr[attr];
1077
+ }
1078
+ }
1079
+ }
1080
+ if(scr && scr.parentNode){
1081
+ scr.parentNode.removeChild(scr);
1082
+ }
1083
+ scr = null;
1084
+ };
1085
+
1086
+
1087
+ /**
1088
+ * 通过script标签加载数据,加载完成由浏览器端触发回调
1089
+ * @name baidu.sio.callByBrowser
1090
+ * @function
1091
+ * @grammar baidu.sio.callByBrowser(url, opt_callback, opt_options)
1092
+ * @param {string} url 加载数据的url
1093
+ * @param {Function|string} opt_callback 数据加载结束时调用的函数或函数名
1094
+ * @param {Object} opt_options 其他可选项
1095
+ * @config {String} [charset] script的字符集
1096
+ * @config {Integer} [timeOut] 超时时间,超过这个时间将不再响应本请求,并触发onfailure函数
1097
+ * @config {Function} [onfailure] timeOut设定后才生效,到达超时时间时触发本函数
1098
+ * @remark
1099
+ * 1、与callByServer不同,callback参数只支持Function类型,不支持string。
1100
+ * 2、如果请求了一个不存在的页面,callback函数在IE/opera下也会被调用,因此使用者需要在onsuccess函数中判断数据是否正确加载。
1101
+ * @meta standard
1102
+ * @see baidu.sio.callByServer
1103
+ */
1104
+ baidu.sio.callByBrowser = function (url, opt_callback, opt_options) {
1105
+ var scr = document.createElement("SCRIPT"),
1106
+ scriptLoaded = 0,
1107
+ options = opt_options || {},
1108
+ charset = options['charset'],
1109
+ callback = opt_callback || function(){},
1110
+ timeOut = options['timeOut'] || 0,
1111
+ timer;
1112
+ scr.onload = scr.onreadystatechange = function () {
1113
+ if (scriptLoaded) {
1114
+ return;
1115
+ }
1116
+
1117
+ var readyState = scr.readyState;
1118
+ if ('undefined' == typeof readyState
1119
+ || readyState == "loaded"
1120
+ || readyState == "complete") {
1121
+ scriptLoaded = 1;
1122
+ try {
1123
+ callback();
1124
+ clearTimeout(timer);
1125
+ } finally {
1126
+ scr.onload = scr.onreadystatechange = null;
1127
+ baidu.sio._removeScriptTag(scr);
1128
+ }
1129
+ }
1130
+ };
1131
+
1132
+ if( timeOut ){
1133
+ timer = setTimeout(function(){
1134
+ scr.onload = scr.onreadystatechange = null;
1135
+ baidu.sio._removeScriptTag(scr);
1136
+ options.onfailure && options.onfailure();
1137
+ }, timeOut);
1138
+ }
1139
+
1140
+ baidu.sio._createScriptTag(scr, url, charset);
1141
+ };
1142
+
1143
+ /**
1144
+ * 通过script标签加载数据,加载完成由服务器端触发回调
1145
+ * @name baidu.sio.callByServer
1146
+ * @function
1147
+ * @grammar baidu.sio.callByServer(url, callback[, opt_options])
1148
+ * @param {string} url 加载数据的url.
1149
+ * @param {Function|string} callback 服务器端调用的函数或函数名。如果没有指定本参数,将在URL中寻找options['queryField']做为callback的方法名.
1150
+ * @param {Object} opt_options 加载数据时的选项.
1151
+ * @config {string} [charset] script的字符集
1152
+ * @config {string} [queryField] 服务器端callback请求字段名,默认为callback
1153
+ * @config {Integer} [timeOut] 超时时间(单位:ms),超过这个时间将不再响应本请求,并触发onfailure函数
1154
+ * @config {Function} [onfailure] timeOut设定后才生效,到达超时时间时触发本函数
1155
+ * @remark
1156
+ * 如果url中已经包含key为“options['queryField']”的query项,将会被替换成callback中参数传递或自动生成的函数名。
1157
+ * @meta standard
1158
+ * @see baidu.sio.callByBrowser
1159
+ */
1160
+ baidu.sio.callByServer = /**@function*/function(url, callback, opt_options) {
1161
+ var scr = document.createElement('SCRIPT'),
1162
+ prefix = 'bd__cbs__',
1163
+ callbackName,
1164
+ callbackImpl,
1165
+ options = opt_options || {},
1166
+ charset = options['charset'],
1167
+ queryField = options['queryField'] || 'callback',
1168
+ timeOut = options['timeOut'] || 0,
1169
+ timer,
1170
+ reg = new RegExp('(\\?|&)' + queryField + '=([^&]*)'),
1171
+ matches;
1172
+
1173
+ if (baidu.lang.isFunction(callback)) {
1174
+ callbackName = prefix + Math.floor(Math.random() * 2147483648).toString(36);
1175
+ window[callbackName] = getCallBack(0);
1176
+ } else if(baidu.lang.isString(callback)){
1177
+ callbackName = callback;
1178
+ } else {
1179
+ if (matches = reg.exec(url)) {
1180
+ callbackName = matches[2];
1181
+ }
1182
+ }
1183
+
1184
+ if( timeOut ){
1185
+ timer = setTimeout(getCallBack(1), timeOut);
1186
+ }
1187
+ url = url.replace(reg, '\x241' + queryField + '=' + callbackName);
1188
+
1189
+ if (url.search(reg) < 0) {
1190
+ url += (url.indexOf('?') < 0 ? '?' : '&') + queryField + '=' + callbackName;
1191
+ }
1192
+ baidu.sio._createScriptTag(scr, url, charset);
1193
+
1194
+ /*
1195
+ * 返回一个函数,用于立即(挂在window上)或者超时(挂在setTimeout中)时执行
1196
+ */
1197
+ function getCallBack(onTimeOut){
1198
+ /*global callbackName, callback, scr, options;*/
1199
+ return function(){
1200
+ try {
1201
+ if( onTimeOut ){
1202
+ options.onfailure && options.onfailure();
1203
+ }else{
1204
+ callback.apply(window, arguments);
1205
+ clearTimeout(timer);
1206
+ }
1207
+ window[callbackName] = null;
1208
+ delete window[callbackName];
1209
+ } catch (exception) {
1210
+ } finally {
1211
+ baidu.sio._removeScriptTag(scr);
1212
+ }
1213
+ }
1214
+ }
1215
+ };
1216
+
1217
+ /**
1218
+ * 通过请求一个图片的方式令服务器存储一条日志
1219
+ * @function
1220
+ * @grammar baidu.sio.log(url)
1221
+ * @param {string} url 要发送的地址.
1222
+ * @author: int08h,leeight
1223
+ */
1224
+ baidu.sio.log = function(url) {
1225
+ var img = new Image(),
1226
+ key = 'tangram_sio_log_' + Math.floor(Math.random() *
1227
+ 2147483648).toString(36);
1228
+ window[key] = img;
1229
+
1230
+ img.onload = img.onerror = img.onabort = function() {
1231
+ img.onload = img.onerror = img.onabort = null;
1232
+
1233
+ window[key] = null;
1234
+ img = null;
1235
+ };
1236
+ img.src = url;
1237
+ };
1238
+
1239
+
1240
+
1241
+ /*
1242
+ * Tangram
1243
+ * Copyright 2009 Baidu Inc. All rights reserved.
1244
+ *
1245
+ * path: baidu/json.js
1246
+ * author: erik
1247
+ * version: 1.1.0
1248
+ * date: 2009/12/02
1249
+ */
1250
+
1251
+
1252
+ /**
1253
+ * 操作json对象的方法
1254
+ * @namespace baidu.json
1255
+ */
1256
+ baidu.json = baidu.json || {};
1257
+ /*
1258
+ * Tangram
1259
+ * Copyright 2009 Baidu Inc. All rights reserved.
1260
+ *
1261
+ * path: baidu/json/parse.js
1262
+ * author: erik, berg
1263
+ * version: 1.2
1264
+ * date: 2009/11/23
1265
+ */
1266
+
1267
+
1268
+
1269
+ /**
1270
+ * 将字符串解析成json对象。注:不会自动祛除空格
1271
+ * @name baidu.json.parse
1272
+ * @function
1273
+ * @grammar baidu.json.parse(data)
1274
+ * @param {string} source 需要解析的字符串
1275
+ * @remark
1276
+ * 该方法的实现与ecma-262第五版中规定的JSON.parse不同,暂时只支持传入一个参数。后续会进行功能丰富。
1277
+ * @meta standard
1278
+ * @see baidu.json.stringify,baidu.json.decode
1279
+ *
1280
+ * @returns {JSON} 解析结果json对象
1281
+ */
1282
+ baidu.json.parse = function (data) {
1283
+ //2010/12/09:更新至不使用原生parse,不检测用户输入是否正确
1284
+ return (new Function("return (" + data + ")"))();
1285
+ };
1286
+ /*
1287
+ * Tangram
1288
+ * Copyright 2009 Baidu Inc. All rights reserved.
1289
+ *
1290
+ * path: baidu/json/decode.js
1291
+ * author: erik, cat
1292
+ * version: 1.3.4
1293
+ * date: 2010/12/23
1294
+ */
1295
+
1296
+
1297
+
1298
+ /**
1299
+ * 将字符串解析成json对象,为过时接口,今后会被baidu.json.parse代替
1300
+ * @name baidu.json.decode
1301
+ * @function
1302
+ * @grammar baidu.json.decode(source)
1303
+ * @param {string} source 需要解析的字符串
1304
+ * @meta out
1305
+ * @see baidu.json.encode,baidu.json.parse
1306
+ *
1307
+ * @returns {JSON} 解析结果json对象
1308
+ */
1309
+ baidu.json.decode = baidu.json.parse;
1310
+ /*
1311
+ * Tangram
1312
+ * Copyright 2009 Baidu Inc. All rights reserved.
1313
+ *
1314
+ * path: baidu/json/stringify.js
1315
+ * author: erik
1316
+ * version: 1.1.0
1317
+ * date: 2010/01/11
1318
+ */
1319
+
1320
+
1321
+
1322
+ /**
1323
+ * 将json对象序列化
1324
+ * @name baidu.json.stringify
1325
+ * @function
1326
+ * @grammar baidu.json.stringify(value)
1327
+ * @param {JSON} value 需要序列化的json对象
1328
+ * @remark
1329
+ * 该方法的实现与ecma-262第五版中规定的JSON.stringify不同,暂时只支持传入一个参数。后续会进行功能丰富。
1330
+ * @meta standard
1331
+ * @see baidu.json.parse,baidu.json.encode
1332
+ *
1333
+ * @returns {string} 序列化后的字符串
1334
+ */
1335
+ baidu.json.stringify = (function () {
1336
+ /**
1337
+ * 字符串处理时需要转义的字符表
1338
+ * @private
1339
+ */
1340
+ var escapeMap = {
1341
+ "\b": '\\b',
1342
+ "\t": '\\t',
1343
+ "\n": '\\n',
1344
+ "\f": '\\f',
1345
+ "\r": '\\r',
1346
+ '"' : '\\"',
1347
+ "\\": '\\\\'
1348
+ };
1349
+
1350
+ /**
1351
+ * 字符串序列化
1352
+ * @private
1353
+ */
1354
+ function encodeString(source) {
1355
+ if (/["\\\x00-\x1f]/.test(source)) {
1356
+ source = source.replace(
1357
+ /["\\\x00-\x1f]/g,
1358
+ function (match) {
1359
+ var c = escapeMap[match];
1360
+ if (c) {
1361
+ return c;
1362
+ }
1363
+ c = match.charCodeAt();
1364
+ return "\\u00"
1365
+ + Math.floor(c / 16).toString(16)
1366
+ + (c % 16).toString(16);
1367
+ });
1368
+ }
1369
+ return '"' + source + '"';
1370
+ }
1371
+
1372
+ /**
1373
+ * 数组序列化
1374
+ * @private
1375
+ */
1376
+ function encodeArray(source) {
1377
+ var result = ["["],
1378
+ l = source.length,
1379
+ preComma, i, item;
1380
+
1381
+ for (i = 0; i < l; i++) {
1382
+ item = source[i];
1383
+
1384
+ switch (typeof item) {
1385
+ case "undefined":
1386
+ case "function":
1387
+ case "unknown":
1388
+ break;
1389
+ default:
1390
+ if(preComma) {
1391
+ result.push(',');
1392
+ }
1393
+ result.push(baidu.json.stringify(item));
1394
+ preComma = 1;
1395
+ }
1396
+ }
1397
+ result.push("]");
1398
+ return result.join("");
1399
+ }
1400
+
1401
+ /**
1402
+ * 处理日期序列化时的补零
1403
+ * @private
1404
+ */
1405
+ function pad(source) {
1406
+ return source < 10 ? '0' + source : source;
1407
+ }
1408
+
1409
+ /**
1410
+ * 日期序列化
1411
+ * @private
1412
+ */
1413
+ function encodeDate(source){
1414
+ return '"' + source.getFullYear() + "-"
1415
+ + pad(source.getMonth() + 1) + "-"
1416
+ + pad(source.getDate()) + "T"
1417
+ + pad(source.getHours()) + ":"
1418
+ + pad(source.getMinutes()) + ":"
1419
+ + pad(source.getSeconds()) + '"';
1420
+ }
1421
+
1422
+ return function (value) {
1423
+ switch (typeof value) {
1424
+ case 'undefined':
1425
+ return 'undefined';
1426
+
1427
+ case 'number':
1428
+ return isFinite(value) ? String(value) : "null";
1429
+
1430
+ case 'string':
1431
+ return encodeString(value);
1432
+
1433
+ case 'boolean':
1434
+ return String(value);
1435
+
1436
+ default:
1437
+ if (value === null) {
1438
+ return 'null';
1439
+ } else if (value instanceof Array) {
1440
+ return encodeArray(value);
1441
+ } else if (value instanceof Date) {
1442
+ return encodeDate(value);
1443
+ } else {
1444
+ var result = ['{'],
1445
+ encode = baidu.json.stringify,
1446
+ preComma,
1447
+ item;
1448
+
1449
+ for (var key in value) {
1450
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
1451
+ item = value[key];
1452
+ switch (typeof item) {
1453
+ case 'undefined':
1454
+ case 'unknown':
1455
+ case 'function':
1456
+ break;
1457
+ default:
1458
+ if (preComma) {
1459
+ result.push(',');
1460
+ }
1461
+ preComma = 1;
1462
+ result.push(encode(key) + ':' + encode(item));
1463
+ }
1464
+ }
1465
+ }
1466
+ result.push('}');
1467
+ return result.join('');
1468
+ }
1469
+ }
1470
+ };
1471
+ })();
1472
+ /*
1473
+ * Tangram
1474
+ * Copyright 2009 Baidu Inc. All rights reserved.
1475
+ *
1476
+ * path: baidu/json/encode.js
1477
+ * author: erik, cat
1478
+ * version: 1.3.4
1479
+ * date: 2010/12/23
1480
+ */
1481
+
1482
+
1483
+
1484
+ /**
1485
+ * 将json对象序列化,为过时接口,今后会被baidu.json.stringify代替
1486
+ * @name baidu.json.encode
1487
+ * @function
1488
+ * @grammar baidu.json.encode(value)
1489
+ * @param {JSON} value 需要序列化的json对象
1490
+ * @meta out
1491
+ * @see baidu.json.decode,baidu.json.stringify
1492
+ *
1493
+ * @returns {string} 序列化后的字符串
1494
+ */
1495
+ baidu.json.encode = baidu.json.stringify;