activeadmin_ueditor 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (289) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +56 -0
  3. data/Gemfile +3 -0
  4. data/LICENSE +21 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +61 -0
  7. data/Rakefile +3 -0
  8. data/activeadmin_ueditor.gemspec +20 -0
  9. data/app/assets/javascripts/.DS_Store +0 -0
  10. data/app/assets/javascripts/activeadmin/.DS_Store +0 -0
  11. data/app/assets/javascripts/activeadmin/ueditor/.DS_Store +0 -0
  12. data/app/assets/javascripts/activeadmin/ueditor/ueditor.all.js +29568 -0
  13. data/app/assets/javascripts/activeadmin/ueditor/ueditor.all.min.js +18 -0
  14. data/app/assets/javascripts/activeadmin/ueditor/ueditor.config.js +414 -0
  15. data/app/assets/javascripts/activeadmin/ueditor_input.js +14 -0
  16. data/lib/activeadmin/ueditor/engine.rb +11 -0
  17. data/lib/activeadmin/ueditor/version.rb +7 -0
  18. data/lib/activeadmin/ueditor.rb +3 -0
  19. data/lib/activeadmin_ueditor.rb +5 -0
  20. data/lib/formtastic/inputs/ueditor_input.rb +16 -0
  21. data/public/assets/ueditor/dialogs/anchor/anchor.html +40 -0
  22. data/public/assets/ueditor/dialogs/attachment/attachment.css +681 -0
  23. data/public/assets/ueditor/dialogs/attachment/attachment.html +60 -0
  24. data/public/assets/ueditor/dialogs/attachment/attachment.js +754 -0
  25. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
  26. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
  27. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
  28. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
  29. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_jpg.gif +0 -0
  30. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
  31. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
  32. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
  33. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
  34. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
  35. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
  36. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
  37. data/public/assets/ueditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
  38. data/public/assets/ueditor/dialogs/attachment/images/alignicon.gif +0 -0
  39. data/public/assets/ueditor/dialogs/attachment/images/alignicon.png +0 -0
  40. data/public/assets/ueditor/dialogs/attachment/images/bg.png +0 -0
  41. data/public/assets/ueditor/dialogs/attachment/images/file-icons.gif +0 -0
  42. data/public/assets/ueditor/dialogs/attachment/images/file-icons.png +0 -0
  43. data/public/assets/ueditor/dialogs/attachment/images/icons.gif +0 -0
  44. data/public/assets/ueditor/dialogs/attachment/images/icons.png +0 -0
  45. data/public/assets/ueditor/dialogs/attachment/images/image.png +0 -0
  46. data/public/assets/ueditor/dialogs/attachment/images/progress.png +0 -0
  47. data/public/assets/ueditor/dialogs/attachment/images/success.gif +0 -0
  48. data/public/assets/ueditor/dialogs/attachment/images/success.png +0 -0
  49. data/public/assets/ueditor/dialogs/background/background.css +94 -0
  50. data/public/assets/ueditor/dialogs/background/background.html +56 -0
  51. data/public/assets/ueditor/dialogs/background/background.js +376 -0
  52. data/public/assets/ueditor/dialogs/background/images/bg.png +0 -0
  53. data/public/assets/ueditor/dialogs/background/images/success.png +0 -0
  54. data/public/assets/ueditor/dialogs/charts/chart.config.js +65 -0
  55. data/public/assets/ueditor/dialogs/charts/charts.css +165 -0
  56. data/public/assets/ueditor/dialogs/charts/charts.html +89 -0
  57. data/public/assets/ueditor/dialogs/charts/charts.js +519 -0
  58. data/public/assets/ueditor/dialogs/charts/images/charts0.png +0 -0
  59. data/public/assets/ueditor/dialogs/charts/images/charts1.png +0 -0
  60. data/public/assets/ueditor/dialogs/charts/images/charts2.png +0 -0
  61. data/public/assets/ueditor/dialogs/charts/images/charts3.png +0 -0
  62. data/public/assets/ueditor/dialogs/charts/images/charts4.png +0 -0
  63. data/public/assets/ueditor/dialogs/charts/images/charts5.png +0 -0
  64. data/public/assets/ueditor/dialogs/emotion/emotion.css +43 -0
  65. data/public/assets/ueditor/dialogs/emotion/emotion.html +54 -0
  66. data/public/assets/ueditor/dialogs/emotion/emotion.js +186 -0
  67. data/public/assets/ueditor/dialogs/emotion/images/0.gif +0 -0
  68. data/public/assets/ueditor/dialogs/emotion/images/bface.gif +0 -0
  69. data/public/assets/ueditor/dialogs/emotion/images/cface.gif +0 -0
  70. data/public/assets/ueditor/dialogs/emotion/images/fface.gif +0 -0
  71. data/public/assets/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
  72. data/public/assets/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
  73. data/public/assets/ueditor/dialogs/emotion/images/tface.gif +0 -0
  74. data/public/assets/ueditor/dialogs/emotion/images/wface.gif +0 -0
  75. data/public/assets/ueditor/dialogs/emotion/images/yface.gif +0 -0
  76. data/public/assets/ueditor/dialogs/gmap/gmap.html +89 -0
  77. data/public/assets/ueditor/dialogs/help/help.css +7 -0
  78. data/public/assets/ueditor/dialogs/help/help.html +82 -0
  79. data/public/assets/ueditor/dialogs/help/help.js +56 -0
  80. data/public/assets/ueditor/dialogs/image/image.css +894 -0
  81. data/public/assets/ueditor/dialogs/image/image.html +120 -0
  82. data/public/assets/ueditor/dialogs/image/image.js +1142 -0
  83. data/public/assets/ueditor/dialogs/image/images/alignicon.jpg +0 -0
  84. data/public/assets/ueditor/dialogs/image/images/bg.png +0 -0
  85. data/public/assets/ueditor/dialogs/image/images/icons.gif +0 -0
  86. data/public/assets/ueditor/dialogs/image/images/icons.png +0 -0
  87. data/public/assets/ueditor/dialogs/image/images/image.png +0 -0
  88. data/public/assets/ueditor/dialogs/image/images/progress.png +0 -0
  89. data/public/assets/ueditor/dialogs/image/images/success.gif +0 -0
  90. data/public/assets/ueditor/dialogs/image/images/success.png +0 -0
  91. data/public/assets/ueditor/dialogs/insertframe/insertframe.html +98 -0
  92. data/public/assets/ueditor/dialogs/internal.js +81 -0
  93. data/public/assets/ueditor/dialogs/link/link.html +126 -0
  94. data/public/assets/ueditor/dialogs/map/map.html +135 -0
  95. data/public/assets/ueditor/dialogs/map/show.html +118 -0
  96. data/public/assets/ueditor/dialogs/music/music.css +30 -0
  97. data/public/assets/ueditor/dialogs/music/music.html +32 -0
  98. data/public/assets/ueditor/dialogs/music/music.js +192 -0
  99. data/public/assets/ueditor/dialogs/preview/preview.html +40 -0
  100. data/public/assets/ueditor/dialogs/scrawl/images/addimg.png +0 -0
  101. data/public/assets/ueditor/dialogs/scrawl/images/brush.png +0 -0
  102. data/public/assets/ueditor/dialogs/scrawl/images/delimg.png +0 -0
  103. data/public/assets/ueditor/dialogs/scrawl/images/delimgH.png +0 -0
  104. data/public/assets/ueditor/dialogs/scrawl/images/empty.png +0 -0
  105. data/public/assets/ueditor/dialogs/scrawl/images/emptyH.png +0 -0
  106. data/public/assets/ueditor/dialogs/scrawl/images/eraser.png +0 -0
  107. data/public/assets/ueditor/dialogs/scrawl/images/redo.png +0 -0
  108. data/public/assets/ueditor/dialogs/scrawl/images/redoH.png +0 -0
  109. data/public/assets/ueditor/dialogs/scrawl/images/scale.png +0 -0
  110. data/public/assets/ueditor/dialogs/scrawl/images/scaleH.png +0 -0
  111. data/public/assets/ueditor/dialogs/scrawl/images/size.png +0 -0
  112. data/public/assets/ueditor/dialogs/scrawl/images/undo.png +0 -0
  113. data/public/assets/ueditor/dialogs/scrawl/images/undoH.png +0 -0
  114. data/public/assets/ueditor/dialogs/scrawl/scrawl.css +72 -0
  115. data/public/assets/ueditor/dialogs/scrawl/scrawl.html +95 -0
  116. data/public/assets/ueditor/dialogs/scrawl/scrawl.js +671 -0
  117. data/public/assets/ueditor/dialogs/searchreplace/searchreplace.html +102 -0
  118. data/public/assets/ueditor/dialogs/searchreplace/searchreplace.js +164 -0
  119. data/public/assets/ueditor/dialogs/snapscreen/snapscreen.html +58 -0
  120. data/public/assets/ueditor/dialogs/spechars/spechars.html +21 -0
  121. data/public/assets/ueditor/dialogs/spechars/spechars.js +57 -0
  122. data/public/assets/ueditor/dialogs/table/dragicon.png +0 -0
  123. data/public/assets/ueditor/dialogs/table/edittable.css +84 -0
  124. data/public/assets/ueditor/dialogs/table/edittable.html +64 -0
  125. data/public/assets/ueditor/dialogs/table/edittable.js +237 -0
  126. data/public/assets/ueditor/dialogs/table/edittd.html +61 -0
  127. data/public/assets/ueditor/dialogs/table/edittip.html +33 -0
  128. data/public/assets/ueditor/dialogs/template/config.js +42 -0
  129. data/public/assets/ueditor/dialogs/template/images/bg.gif +0 -0
  130. data/public/assets/ueditor/dialogs/template/images/pre0.png +0 -0
  131. data/public/assets/ueditor/dialogs/template/images/pre1.png +0 -0
  132. data/public/assets/ueditor/dialogs/template/images/pre2.png +0 -0
  133. data/public/assets/ueditor/dialogs/template/images/pre3.png +0 -0
  134. data/public/assets/ueditor/dialogs/template/images/pre4.png +0 -0
  135. data/public/assets/ueditor/dialogs/template/template.css +18 -0
  136. data/public/assets/ueditor/dialogs/template/template.html +26 -0
  137. data/public/assets/ueditor/dialogs/template/template.js +53 -0
  138. data/public/assets/ueditor/dialogs/video/images/bg.png +0 -0
  139. data/public/assets/ueditor/dialogs/video/images/center_focus.jpg +0 -0
  140. data/public/assets/ueditor/dialogs/video/images/file-icons.gif +0 -0
  141. data/public/assets/ueditor/dialogs/video/images/file-icons.png +0 -0
  142. data/public/assets/ueditor/dialogs/video/images/icons.gif +0 -0
  143. data/public/assets/ueditor/dialogs/video/images/icons.png +0 -0
  144. data/public/assets/ueditor/dialogs/video/images/image.png +0 -0
  145. data/public/assets/ueditor/dialogs/video/images/left_focus.jpg +0 -0
  146. data/public/assets/ueditor/dialogs/video/images/none_focus.jpg +0 -0
  147. data/public/assets/ueditor/dialogs/video/images/progress.png +0 -0
  148. data/public/assets/ueditor/dialogs/video/images/right_focus.jpg +0 -0
  149. data/public/assets/ueditor/dialogs/video/images/success.gif +0 -0
  150. data/public/assets/ueditor/dialogs/video/images/success.png +0 -0
  151. data/public/assets/ueditor/dialogs/video/video.css +635 -0
  152. data/public/assets/ueditor/dialogs/video/video.html +86 -0
  153. data/public/assets/ueditor/dialogs/video/video.js +791 -0
  154. data/public/assets/ueditor/dialogs/webapp/webapp.html +53 -0
  155. data/public/assets/ueditor/dialogs/wordimage/fClipboard_ueditor.swf +0 -0
  156. data/public/assets/ueditor/dialogs/wordimage/imageUploader.swf +0 -0
  157. data/public/assets/ueditor/dialogs/wordimage/tangram.js +1495 -0
  158. data/public/assets/ueditor/dialogs/wordimage/wordimage.html +111 -0
  159. data/public/assets/ueditor/dialogs/wordimage/wordimage.js +157 -0
  160. data/public/assets/ueditor/lang/en/en.js +684 -0
  161. data/public/assets/ueditor/lang/en/images/addimage.png +0 -0
  162. data/public/assets/ueditor/lang/en/images/alldeletebtnhoverskin.png +0 -0
  163. data/public/assets/ueditor/lang/en/images/alldeletebtnupskin.png +0 -0
  164. data/public/assets/ueditor/lang/en/images/background.png +0 -0
  165. data/public/assets/ueditor/lang/en/images/button.png +0 -0
  166. data/public/assets/ueditor/lang/en/images/copy.png +0 -0
  167. data/public/assets/ueditor/lang/en/images/deletedisable.png +0 -0
  168. data/public/assets/ueditor/lang/en/images/deleteenable.png +0 -0
  169. data/public/assets/ueditor/lang/en/images/listbackground.png +0 -0
  170. data/public/assets/ueditor/lang/en/images/localimage.png +0 -0
  171. data/public/assets/ueditor/lang/en/images/music.png +0 -0
  172. data/public/assets/ueditor/lang/en/images/rotateleftdisable.png +0 -0
  173. data/public/assets/ueditor/lang/en/images/rotateleftenable.png +0 -0
  174. data/public/assets/ueditor/lang/en/images/rotaterightdisable.png +0 -0
  175. data/public/assets/ueditor/lang/en/images/rotaterightenable.png +0 -0
  176. data/public/assets/ueditor/lang/en/images/upload.png +0 -0
  177. data/public/assets/ueditor/lang/zh-cn/images/copy.png +0 -0
  178. data/public/assets/ueditor/lang/zh-cn/images/localimage.png +0 -0
  179. data/public/assets/ueditor/lang/zh-cn/images/music.png +0 -0
  180. data/public/assets/ueditor/lang/zh-cn/images/upload.png +0 -0
  181. data/public/assets/ueditor/lang/zh-cn/zh-cn.js +669 -0
  182. data/public/assets/ueditor/themes/default/css/ueditor.css +1903 -0
  183. data/public/assets/ueditor/themes/default/css/ueditor.min.css +8 -0
  184. data/public/assets/ueditor/themes/default/dialogbase.css +100 -0
  185. data/public/assets/ueditor/themes/default/images/anchor.gif +0 -0
  186. data/public/assets/ueditor/themes/default/images/arrow.png +0 -0
  187. data/public/assets/ueditor/themes/default/images/arrow_down.png +0 -0
  188. data/public/assets/ueditor/themes/default/images/arrow_up.png +0 -0
  189. data/public/assets/ueditor/themes/default/images/button-bg.gif +0 -0
  190. data/public/assets/ueditor/themes/default/images/cancelbutton.gif +0 -0
  191. data/public/assets/ueditor/themes/default/images/charts.png +0 -0
  192. data/public/assets/ueditor/themes/default/images/cursor_h.gif +0 -0
  193. data/public/assets/ueditor/themes/default/images/cursor_h.png +0 -0
  194. data/public/assets/ueditor/themes/default/images/cursor_v.gif +0 -0
  195. data/public/assets/ueditor/themes/default/images/cursor_v.png +0 -0
  196. data/public/assets/ueditor/themes/default/images/dialog-title-bg.png +0 -0
  197. data/public/assets/ueditor/themes/default/images/filescan.png +0 -0
  198. data/public/assets/ueditor/themes/default/images/highlighted.gif +0 -0
  199. data/public/assets/ueditor/themes/default/images/icons-all.gif +0 -0
  200. data/public/assets/ueditor/themes/default/images/icons.gif +0 -0
  201. data/public/assets/ueditor/themes/default/images/icons.png +0 -0
  202. data/public/assets/ueditor/themes/default/images/loaderror.png +0 -0
  203. data/public/assets/ueditor/themes/default/images/loading.gif +0 -0
  204. data/public/assets/ueditor/themes/default/images/lock.gif +0 -0
  205. data/public/assets/ueditor/themes/default/images/neweditor-tab-bg.png +0 -0
  206. data/public/assets/ueditor/themes/default/images/pagebreak.gif +0 -0
  207. data/public/assets/ueditor/themes/default/images/scale.png +0 -0
  208. data/public/assets/ueditor/themes/default/images/sortable.png +0 -0
  209. data/public/assets/ueditor/themes/default/images/spacer.gif +0 -0
  210. data/public/assets/ueditor/themes/default/images/sparator_v.png +0 -0
  211. data/public/assets/ueditor/themes/default/images/table-cell-align.png +0 -0
  212. data/public/assets/ueditor/themes/default/images/tangram-colorpicker.png +0 -0
  213. data/public/assets/ueditor/themes/default/images/toolbar_bg.png +0 -0
  214. data/public/assets/ueditor/themes/default/images/unhighlighted.gif +0 -0
  215. data/public/assets/ueditor/themes/default/images/upload.png +0 -0
  216. data/public/assets/ueditor/themes/default/images/videologo.gif +0 -0
  217. data/public/assets/ueditor/themes/default/images/word.gif +0 -0
  218. data/public/assets/ueditor/themes/default/images/wordpaste.png +0 -0
  219. data/public/assets/ueditor/themes/iframe.css +1 -0
  220. data/public/assets/ueditor/third-party/SyntaxHighlighter/shCore.js +3655 -0
  221. data/public/assets/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css +1 -0
  222. data/public/assets/ueditor/third-party/codemirror/codemirror.css +104 -0
  223. data/public/assets/ueditor/third-party/codemirror/codemirror.js +3581 -0
  224. data/public/assets/ueditor/third-party/highcharts/adapters/mootools-adapter.js +13 -0
  225. data/public/assets/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js +313 -0
  226. data/public/assets/ueditor/third-party/highcharts/adapters/prototype-adapter.js +15 -0
  227. data/public/assets/ueditor/third-party/highcharts/adapters/prototype-adapter.src.js +316 -0
  228. data/public/assets/ueditor/third-party/highcharts/adapters/standalone-framework.js +17 -0
  229. data/public/assets/ueditor/third-party/highcharts/adapters/standalone-framework.src.js +583 -0
  230. data/public/assets/ueditor/third-party/highcharts/highcharts-more.js +50 -0
  231. data/public/assets/ueditor/third-party/highcharts/highcharts-more.src.js +2430 -0
  232. data/public/assets/ueditor/third-party/highcharts/highcharts.js +283 -0
  233. data/public/assets/ueditor/third-party/highcharts/highcharts.src.js +16974 -0
  234. data/public/assets/ueditor/third-party/highcharts/modules/annotations.js +7 -0
  235. data/public/assets/ueditor/third-party/highcharts/modules/annotations.src.js +401 -0
  236. data/public/assets/ueditor/third-party/highcharts/modules/canvas-tools.js +133 -0
  237. data/public/assets/ueditor/third-party/highcharts/modules/canvas-tools.src.js +3113 -0
  238. data/public/assets/ueditor/third-party/highcharts/modules/data.js +17 -0
  239. data/public/assets/ueditor/third-party/highcharts/modules/data.src.js +582 -0
  240. data/public/assets/ueditor/third-party/highcharts/modules/drilldown.js +11 -0
  241. data/public/assets/ueditor/third-party/highcharts/modules/drilldown.src.js +447 -0
  242. data/public/assets/ueditor/third-party/highcharts/modules/exporting.js +22 -0
  243. data/public/assets/ueditor/third-party/highcharts/modules/exporting.src.js +709 -0
  244. data/public/assets/ueditor/third-party/highcharts/modules/funnel.js +12 -0
  245. data/public/assets/ueditor/third-party/highcharts/modules/funnel.src.js +289 -0
  246. data/public/assets/ueditor/third-party/highcharts/modules/heatmap.js +1 -0
  247. data/public/assets/ueditor/third-party/highcharts/modules/heatmap.src.js +53 -0
  248. data/public/assets/ueditor/third-party/highcharts/modules/map.js +27 -0
  249. data/public/assets/ueditor/third-party/highcharts/modules/map.src.js +1002 -0
  250. data/public/assets/ueditor/third-party/highcharts/modules/no-data-to-display.js +12 -0
  251. data/public/assets/ueditor/third-party/highcharts/modules/no-data-to-display.src.js +128 -0
  252. data/public/assets/ueditor/third-party/highcharts/themes/dark-blue.js +254 -0
  253. data/public/assets/ueditor/third-party/highcharts/themes/dark-green.js +255 -0
  254. data/public/assets/ueditor/third-party/highcharts/themes/gray.js +257 -0
  255. data/public/assets/ueditor/third-party/highcharts/themes/grid.js +103 -0
  256. data/public/assets/ueditor/third-party/highcharts/themes/skies.js +89 -0
  257. data/public/assets/ueditor/third-party/jquery-1.10.2.js +9789 -0
  258. data/public/assets/ueditor/third-party/jquery-1.10.2.min.js +6 -0
  259. data/public/assets/ueditor/third-party/jquery-1.10.2.min.map +1 -0
  260. data/public/assets/ueditor/third-party/snapscreen/UEditorSnapscreen.exe +0 -0
  261. data/public/assets/ueditor/third-party/video-js/font/vjs.eot +0 -0
  262. data/public/assets/ueditor/third-party/video-js/font/vjs.svg +65 -0
  263. data/public/assets/ueditor/third-party/video-js/font/vjs.ttf +0 -0
  264. data/public/assets/ueditor/third-party/video-js/font/vjs.woff +0 -0
  265. data/public/assets/ueditor/third-party/video-js/video-js.css +766 -0
  266. data/public/assets/ueditor/third-party/video-js/video-js.min.css +5 -0
  267. data/public/assets/ueditor/third-party/video-js/video-js.swf +0 -0
  268. data/public/assets/ueditor/third-party/video-js/video.dev.js +7108 -0
  269. data/public/assets/ueditor/third-party/video-js/video.js +129 -0
  270. data/public/assets/ueditor/third-party/webuploader/Uploader.swf +0 -0
  271. data/public/assets/ueditor/third-party/webuploader/webuploader.css +28 -0
  272. data/public/assets/ueditor/third-party/webuploader/webuploader.custom.js +5670 -0
  273. data/public/assets/ueditor/third-party/webuploader/webuploader.custom.min.js +2 -0
  274. data/public/assets/ueditor/third-party/webuploader/webuploader.flashonly.js +4176 -0
  275. data/public/assets/ueditor/third-party/webuploader/webuploader.flashonly.min.js +2 -0
  276. data/public/assets/ueditor/third-party/webuploader/webuploader.html5only.js +5559 -0
  277. data/public/assets/ueditor/third-party/webuploader/webuploader.html5only.min.js +2 -0
  278. data/public/assets/ueditor/third-party/webuploader/webuploader.js +6733 -0
  279. data/public/assets/ueditor/third-party/webuploader/webuploader.min.js +2 -0
  280. data/public/assets/ueditor/third-party/webuploader/webuploader.withoutimage.js +4593 -0
  281. data/public/assets/ueditor/third-party/webuploader/webuploader.withoutimage.min.js +2 -0
  282. data/public/assets/ueditor/third-party/xss.min.js +1 -0
  283. data/public/assets/ueditor/third-party/zeroclipboard/ZeroClipboard.js +1256 -0
  284. data/public/assets/ueditor/third-party/zeroclipboard/ZeroClipboard.min.js +9 -0
  285. data/public/assets/ueditor/third-party/zeroclipboard/ZeroClipboard.swf +0 -0
  286. data/public/assets/ueditor/ueditor.parse.js +1022 -0
  287. data/public/assets/ueditor/ueditor.parse.min.js +7 -0
  288. data/screenshot.png +0 -0
  289. metadata +343 -0
@@ -0,0 +1,1002 @@
1
+ /**
2
+ * @license Map plugin v0.1 for Highcharts
3
+ *
4
+ * (c) 2011-2013 Torstein Hønsi
5
+ *
6
+ * License: www.highcharts.com/license
7
+ */
8
+
9
+ /*
10
+ * See www.highcharts.com/studies/world-map.htm for use case.
11
+ *
12
+ * To do:
13
+ * - Optimize long variable names and alias adapter methods and Highcharts namespace variables
14
+ * - Zoom and pan GUI
15
+ */
16
+ (function (Highcharts) {
17
+ var UNDEFINED,
18
+ Axis = Highcharts.Axis,
19
+ Chart = Highcharts.Chart,
20
+ Point = Highcharts.Point,
21
+ Pointer = Highcharts.Pointer,
22
+ each = Highcharts.each,
23
+ extend = Highcharts.extend,
24
+ merge = Highcharts.merge,
25
+ pick = Highcharts.pick,
26
+ numberFormat = Highcharts.numberFormat,
27
+ defaultOptions = Highcharts.getOptions(),
28
+ seriesTypes = Highcharts.seriesTypes,
29
+ plotOptions = defaultOptions.plotOptions,
30
+ wrap = Highcharts.wrap,
31
+ Color = Highcharts.Color,
32
+ noop = function () {};
33
+
34
+
35
+
36
+ /*
37
+ * Return an intermediate color between two colors, according to pos where 0
38
+ * is the from color and 1 is the to color
39
+ */
40
+ function tweenColors(from, to, pos) {
41
+ var i = 4,
42
+ rgba = [];
43
+
44
+ while (i--) {
45
+ rgba[i] = Math.round(
46
+ to.rgba[i] + (from.rgba[i] - to.rgba[i]) * (1 - pos)
47
+ );
48
+ }
49
+ return 'rgba(' + rgba.join(',') + ')';
50
+ }
51
+
52
+ // Set the default map navigation options
53
+ defaultOptions.mapNavigation = {
54
+ buttonOptions: {
55
+ align: 'right',
56
+ verticalAlign: 'bottom',
57
+ x: 0,
58
+ width: 18,
59
+ height: 18,
60
+ style: {
61
+ fontSize: '15px',
62
+ fontWeight: 'bold',
63
+ textAlign: 'center'
64
+ }
65
+ },
66
+ buttons: {
67
+ zoomIn: {
68
+ onclick: function () {
69
+ this.mapZoom(0.5);
70
+ },
71
+ text: '+',
72
+ y: -32
73
+ },
74
+ zoomOut: {
75
+ onclick: function () {
76
+ this.mapZoom(2);
77
+ },
78
+ text: '-',
79
+ y: 0
80
+ }
81
+ }
82
+ // enableButtons: false,
83
+ // enableTouchZoom: false,
84
+ // zoomOnDoubleClick: false,
85
+ // zoomOnMouseWheel: false
86
+
87
+ };
88
+
89
+ /**
90
+ * Utility for reading SVG paths directly.
91
+ */
92
+ Highcharts.splitPath = function (path) {
93
+ var i;
94
+
95
+ // Move letters apart
96
+ path = path.replace(/([A-Za-z])/g, ' $1 ');
97
+ // Trim
98
+ path = path.replace(/^\s*/, "").replace(/\s*$/, "");
99
+
100
+ // Split on spaces and commas
101
+ path = path.split(/[ ,]+/);
102
+
103
+ // Parse numbers
104
+ for (i = 0; i < path.length; i++) {
105
+ if (!/[a-zA-Z]/.test(path[i])) {
106
+ path[i] = parseFloat(path[i]);
107
+ }
108
+ }
109
+ return path;
110
+ };
111
+
112
+ // A placeholder for map definitions
113
+ Highcharts.maps = {};
114
+
115
+ /**
116
+ * Override to use the extreme coordinates from the SVG shape, not the
117
+ * data values
118
+ */
119
+ wrap(Axis.prototype, 'getSeriesExtremes', function (proceed) {
120
+ var isXAxis = this.isXAxis,
121
+ dataMin,
122
+ dataMax,
123
+ xData = [];
124
+
125
+ // Remove the xData array and cache it locally so that the proceed method doesn't use it
126
+ each(this.series, function (series, i) {
127
+ if (series.useMapGeometry) {
128
+ xData[i] = series.xData;
129
+ series.xData = [];
130
+ }
131
+ });
132
+
133
+ // Call base to reach normal cartesian series (like mappoint)
134
+ proceed.call(this);
135
+
136
+ // Run extremes logic for map and mapline
137
+ dataMin = pick(this.dataMin, Number.MAX_VALUE);
138
+ dataMax = pick(this.dataMax, Number.MIN_VALUE);
139
+ each(this.series, function (series, i) {
140
+ if (series.useMapGeometry) {
141
+ dataMin = Math.min(dataMin, series[isXAxis ? 'minX' : 'minY']);
142
+ dataMax = Math.max(dataMax, series[isXAxis ? 'maxX' : 'maxY']);
143
+ series.xData = xData[i]; // Reset xData array
144
+ }
145
+ });
146
+
147
+ this.dataMin = dataMin;
148
+ this.dataMax = dataMax;
149
+ });
150
+
151
+ /**
152
+ * Override axis translation to make sure the aspect ratio is always kept
153
+ */
154
+ wrap(Axis.prototype, 'setAxisTranslation', function (proceed) {
155
+ var chart = this.chart,
156
+ mapRatio,
157
+ plotRatio = chart.plotWidth / chart.plotHeight,
158
+ isXAxis = this.isXAxis,
159
+ adjustedAxisLength,
160
+ xAxis = chart.xAxis[0],
161
+ padAxis;
162
+
163
+ // Run the parent method
164
+ proceed.call(this);
165
+
166
+ // On Y axis, handle both
167
+ if (chart.options.chart.type === 'map' && !isXAxis && xAxis.transA !== UNDEFINED) {
168
+
169
+ // Use the same translation for both axes
170
+ this.transA = xAxis.transA = Math.min(this.transA, xAxis.transA);
171
+
172
+ mapRatio = (xAxis.max - xAxis.min) / (this.max - this.min);
173
+
174
+ // What axis to pad to put the map in the middle
175
+ padAxis = mapRatio > plotRatio ? this : xAxis;
176
+
177
+ // Pad it
178
+ adjustedAxisLength = (padAxis.max - padAxis.min) * padAxis.transA;
179
+ padAxis.minPixelPadding = (padAxis.len - adjustedAxisLength) / 2;
180
+ }
181
+ });
182
+
183
+
184
+ //--- Start zooming and panning features
185
+
186
+ wrap(Chart.prototype, 'render', function (proceed) {
187
+ var chart = this,
188
+ mapNavigation = chart.options.mapNavigation;
189
+
190
+ proceed.call(chart);
191
+
192
+ // Render the plus and minus buttons
193
+ chart.renderMapNavigation();
194
+
195
+ // Add the double click event
196
+ if (mapNavigation.zoomOnDoubleClick) {
197
+ Highcharts.addEvent(chart.container, 'dblclick', function (e) {
198
+ chart.pointer.onContainerDblClick(e);
199
+ });
200
+ }
201
+
202
+ // Add the mousewheel event
203
+ if (mapNavigation.zoomOnMouseWheel) {
204
+ Highcharts.addEvent(chart.container, document.onmousewheel === undefined ? 'DOMMouseScroll' : 'mousewheel', function (e) {
205
+ chart.pointer.onContainerMouseWheel(e);
206
+ });
207
+ }
208
+ });
209
+
210
+ // Extend the Pointer
211
+ extend(Pointer.prototype, {
212
+
213
+ /**
214
+ * The event handler for the doubleclick event
215
+ */
216
+ onContainerDblClick: function (e) {
217
+ var chart = this.chart;
218
+
219
+ e = this.normalize(e);
220
+
221
+ if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
222
+ chart.mapZoom(
223
+ 0.5,
224
+ chart.xAxis[0].toValue(e.chartX),
225
+ chart.yAxis[0].toValue(e.chartY)
226
+ );
227
+ }
228
+ },
229
+
230
+ /**
231
+ * The event handler for the mouse scroll event
232
+ */
233
+ onContainerMouseWheel: function (e) {
234
+ var chart = this.chart,
235
+ delta;
236
+
237
+ e = this.normalize(e);
238
+
239
+ // Firefox uses e.detail, WebKit and IE uses wheelDelta
240
+ delta = e.detail || -(e.wheelDelta / 120);
241
+ if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
242
+ chart.mapZoom(
243
+ delta > 0 ? 2 : 0.5,
244
+ chart.xAxis[0].toValue(e.chartX),
245
+ chart.yAxis[0].toValue(e.chartY)
246
+ );
247
+ }
248
+ }
249
+ });
250
+ // Implement the pinchType option
251
+ wrap(Pointer.prototype, 'init', function (proceed, chart, options) {
252
+
253
+ proceed.call(this, chart, options);
254
+
255
+ // Pinch status
256
+ if (options.mapNavigation.enableTouchZoom) {
257
+ this.pinchX = this.pinchHor =
258
+ this.pinchY = this.pinchVert = true;
259
+ }
260
+ });
261
+
262
+ // Add events to the Chart object itself
263
+ extend(Chart.prototype, {
264
+ renderMapNavigation: function () {
265
+ var chart = this,
266
+ options = this.options.mapNavigation,
267
+ buttons = options.buttons,
268
+ n,
269
+ button,
270
+ buttonOptions,
271
+ outerHandler = function () {
272
+ this.handler.call(chart);
273
+ };
274
+
275
+ if (options.enableButtons) {
276
+ for (n in buttons) {
277
+ if (buttons.hasOwnProperty(n)) {
278
+ buttonOptions = merge(options.buttonOptions, buttons[n]);
279
+
280
+ button = chart.renderer.button(buttonOptions.text, 0, 0, outerHandler)
281
+ .attr({
282
+ width: buttonOptions.width,
283
+ height: buttonOptions.height
284
+ })
285
+ .css(buttonOptions.style)
286
+ .add();
287
+ button.handler = buttonOptions.onclick;
288
+ button.align(extend(buttonOptions, { width: button.width, height: button.height }), null, 'spacingBox');
289
+ }
290
+ }
291
+ }
292
+ },
293
+
294
+ /**
295
+ * Fit an inner box to an outer. If the inner box overflows left or right, align it to the sides of the
296
+ * outer. If it overflows both sides, fit it within the outer. This is a pattern that occurs more places
297
+ * in Highcharts, perhaps it should be elevated to a common utility function.
298
+ */
299
+ fitToBox: function (inner, outer) {
300
+ each([['x', 'width'], ['y', 'height']], function (dim) {
301
+ var pos = dim[0],
302
+ size = dim[1];
303
+ if (inner[pos] + inner[size] > outer[pos] + outer[size]) { // right overflow
304
+ if (inner[size] > outer[size]) { // the general size is greater, fit fully to outer
305
+ inner[size] = outer[size];
306
+ inner[pos] = outer[pos];
307
+ } else { // align right
308
+ inner[pos] = outer[pos] + outer[size] - inner[size];
309
+ }
310
+ }
311
+ if (inner[size] > outer[size]) {
312
+ inner[size] = outer[size];
313
+ }
314
+ if (inner[pos] < outer[pos]) {
315
+ inner[pos] = outer[pos];
316
+ }
317
+
318
+ });
319
+
320
+ return inner;
321
+ },
322
+
323
+ /**
324
+ * Zoom the map in or out by a certain amount. Less than 1 zooms in, greater than 1 zooms out.
325
+ */
326
+ mapZoom: function (howMuch, centerXArg, centerYArg) {
327
+
328
+ if (this.isMapZooming) {
329
+ return;
330
+ }
331
+
332
+ var chart = this,
333
+ xAxis = chart.xAxis[0],
334
+ xRange = xAxis.max - xAxis.min,
335
+ centerX = pick(centerXArg, xAxis.min + xRange / 2),
336
+ newXRange = xRange * howMuch,
337
+ yAxis = chart.yAxis[0],
338
+ yRange = yAxis.max - yAxis.min,
339
+ centerY = pick(centerYArg, yAxis.min + yRange / 2),
340
+ newYRange = yRange * howMuch,
341
+ newXMin = centerX - newXRange / 2,
342
+ newYMin = centerY - newYRange / 2,
343
+ animation = pick(chart.options.chart.animation, true),
344
+ delay,
345
+ newExt = chart.fitToBox({
346
+ x: newXMin,
347
+ y: newYMin,
348
+ width: newXRange,
349
+ height: newYRange
350
+ }, {
351
+ x: xAxis.dataMin,
352
+ y: yAxis.dataMin,
353
+ width: xAxis.dataMax - xAxis.dataMin,
354
+ height: yAxis.dataMax - yAxis.dataMin
355
+ });
356
+
357
+ xAxis.setExtremes(newExt.x, newExt.x + newExt.width, false);
358
+ yAxis.setExtremes(newExt.y, newExt.y + newExt.height, false);
359
+
360
+ // Prevent zooming until this one is finished animating
361
+ delay = animation ? animation.duration || 500 : 0;
362
+ if (delay) {
363
+ chart.isMapZooming = true;
364
+ setTimeout(function () {
365
+ chart.isMapZooming = false;
366
+ }, delay);
367
+ }
368
+
369
+ chart.redraw();
370
+ }
371
+ });
372
+
373
+ /**
374
+ * Extend the default options with map options
375
+ */
376
+ plotOptions.map = merge(plotOptions.scatter, {
377
+ animation: false, // makes the complex shapes slow
378
+ nullColor: '#F8F8F8',
379
+ borderColor: 'silver',
380
+ borderWidth: 1,
381
+ marker: null,
382
+ stickyTracking: false,
383
+ dataLabels: {
384
+ verticalAlign: 'middle'
385
+ },
386
+ turboThreshold: 0,
387
+ tooltip: {
388
+ followPointer: true,
389
+ pointFormat: '{point.name}: {point.y}<br/>'
390
+ },
391
+ states: {
392
+ normal: {
393
+ animation: true
394
+ }
395
+ }
396
+ });
397
+
398
+ var MapAreaPoint = Highcharts.extendClass(Point, {
399
+ /**
400
+ * Extend the Point object to split paths
401
+ */
402
+ applyOptions: function (options, x) {
403
+
404
+ var point = Point.prototype.applyOptions.call(this, options, x);
405
+
406
+ if (point.path && typeof point.path === 'string') {
407
+ point.path = point.options.path = Highcharts.splitPath(point.path);
408
+ }
409
+
410
+ return point;
411
+ },
412
+ /**
413
+ * Stop the fade-out
414
+ */
415
+ onMouseOver: function () {
416
+ clearTimeout(this.colorInterval);
417
+ Point.prototype.onMouseOver.call(this);
418
+ },
419
+ /**
420
+ * Custom animation for tweening out the colors. Animation reduces blinking when hovering
421
+ * over islands and coast lines. We run a custom implementation of animation becuase we
422
+ * need to be able to run this independently from other animations like zoom redraw. Also,
423
+ * adding color animation to the adapters would introduce almost the same amount of code.
424
+ */
425
+ onMouseOut: function () {
426
+ var point = this,
427
+ start = +new Date(),
428
+ normalColor = Color(point.options.color),
429
+ hoverColor = Color(point.pointAttr.hover.fill),
430
+ animation = point.series.options.states.normal.animation,
431
+ duration = animation && (animation.duration || 500);
432
+
433
+ if (duration && normalColor.rgba.length === 4 && hoverColor.rgba.length === 4) {
434
+ delete point.pointAttr[''].fill; // avoid resetting it in Point.setState
435
+
436
+ clearTimeout(point.colorInterval);
437
+ point.colorInterval = setInterval(function () {
438
+ var pos = (new Date() - start) / duration,
439
+ graphic = point.graphic;
440
+ if (pos > 1) {
441
+ pos = 1;
442
+ }
443
+ if (graphic) {
444
+ graphic.attr('fill', tweenColors(hoverColor, normalColor, pos));
445
+ }
446
+ if (pos >= 1) {
447
+ clearTimeout(point.colorInterval);
448
+ }
449
+ }, 13);
450
+ }
451
+ Point.prototype.onMouseOut.call(point);
452
+ }
453
+ });
454
+
455
+ /**
456
+ * Add the series type
457
+ */
458
+ seriesTypes.map = Highcharts.extendClass(seriesTypes.scatter, {
459
+ type: 'map',
460
+ pointAttrToOptions: { // mapping between SVG attributes and the corresponding options
461
+ stroke: 'borderColor',
462
+ 'stroke-width': 'borderWidth',
463
+ fill: 'color'
464
+ },
465
+ colorKey: 'y',
466
+ pointClass: MapAreaPoint,
467
+ trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
468
+ getSymbol: noop,
469
+ supportsDrilldown: true,
470
+ getExtremesFromAll: true,
471
+ useMapGeometry: true, // get axis extremes from paths, not values
472
+ init: function (chart) {
473
+ var series = this,
474
+ valueDecimals = chart.options.legend.valueDecimals,
475
+ legendItems = [],
476
+ name,
477
+ from,
478
+ to,
479
+ fromLabel,
480
+ toLabel,
481
+ colorRange,
482
+ valueRanges,
483
+ gradientColor,
484
+ grad,
485
+ tmpLabel,
486
+ horizontal = chart.options.legend.layout === 'horizontal';
487
+
488
+
489
+ Highcharts.Series.prototype.init.apply(this, arguments);
490
+ colorRange = series.options.colorRange;
491
+ valueRanges = series.options.valueRanges;
492
+
493
+ if (valueRanges) {
494
+ each(valueRanges, function (range) {
495
+ from = range.from;
496
+ to = range.to;
497
+
498
+ // Assemble the default name. This can be overridden by legend.options.labelFormatter
499
+ name = '';
500
+ if (from === UNDEFINED) {
501
+ name = '< ';
502
+ } else if (to === UNDEFINED) {
503
+ name = '> ';
504
+ }
505
+ if (from !== UNDEFINED) {
506
+ name += numberFormat(from, valueDecimals);
507
+ }
508
+ if (from !== UNDEFINED && to !== UNDEFINED) {
509
+ name += ' - ';
510
+ }
511
+ if (to !== UNDEFINED) {
512
+ name += numberFormat(to, valueDecimals);
513
+ }
514
+
515
+ // Add a mock object to the legend items
516
+ legendItems.push(Highcharts.extend({
517
+ chart: series.chart,
518
+ name: name,
519
+ options: {},
520
+ drawLegendSymbol: seriesTypes.area.prototype.drawLegendSymbol,
521
+ visible: true,
522
+ setState: function () {},
523
+ setVisible: function () {}
524
+ }, range));
525
+ });
526
+ series.legendItems = legendItems;
527
+
528
+ } else if (colorRange) {
529
+
530
+ from = colorRange.from;
531
+ to = colorRange.to;
532
+ fromLabel = colorRange.fromLabel;
533
+ toLabel = colorRange.toLabel;
534
+
535
+ // Flips linearGradient variables and label text.
536
+ grad = horizontal ? [0, 0, 1, 0] : [0, 1, 0, 0];
537
+ if (!horizontal) {
538
+ tmpLabel = fromLabel;
539
+ fromLabel = toLabel;
540
+ toLabel = tmpLabel;
541
+ }
542
+
543
+ // Creates color gradient.
544
+ gradientColor = {
545
+ linearGradient: { x1: grad[0], y1: grad[1], x2: grad[2], y2: grad[3] },
546
+ stops:
547
+ [
548
+ [0, from],
549
+ [1, to]
550
+ ]
551
+ };
552
+
553
+ // Add a mock object to the legend items.
554
+ legendItems = [{
555
+ chart: series.chart,
556
+ options: {},
557
+ fromLabel: fromLabel,
558
+ toLabel: toLabel,
559
+ color: gradientColor,
560
+ drawLegendSymbol: this.drawLegendSymbolGradient,
561
+ visible: true,
562
+ setState: function () {},
563
+ setVisible: function () {}
564
+ }];
565
+
566
+ series.legendItems = legendItems;
567
+ }
568
+ },
569
+
570
+ /**
571
+ * If neither valueRanges nor colorRanges are defined, use basic area symbol.
572
+ */
573
+ drawLegendSymbol: seriesTypes.area.prototype.drawLegendSymbol,
574
+
575
+ /**
576
+ * Gets the series' symbol in the legend and extended legend with more information.
577
+ *
578
+ * @param {Object} legend The legend object
579
+ * @param {Object} item The series (this) or point
580
+ */
581
+ drawLegendSymbolGradient: function (legend, item) {
582
+ var spacing = legend.options.symbolPadding,
583
+ padding = pick(legend.options.padding, 8),
584
+ positionY,
585
+ positionX,
586
+ gradientSize = this.chart.renderer.fontMetrics(legend.options.itemStyle.fontSize).h,
587
+ horizontal = legend.options.layout === 'horizontal',
588
+ box1,
589
+ box2,
590
+ box3,
591
+ rectangleLength = pick(legend.options.rectangleLength, 200);
592
+
593
+ // Set local variables based on option.
594
+ if (horizontal) {
595
+ positionY = -(spacing / 2);
596
+ positionX = 0;
597
+ } else {
598
+ positionY = -rectangleLength + legend.baseline - (spacing / 2);
599
+ positionX = padding + gradientSize;
600
+ }
601
+
602
+ // Creates the from text.
603
+ item.fromText = this.chart.renderer.text(
604
+ item.fromLabel, // Text.
605
+ positionX, // Lower left x.
606
+ positionY // Lower left y.
607
+ ).attr({
608
+ zIndex: 2
609
+ }).add(item.legendGroup);
610
+ box1 = item.fromText.getBBox();
611
+
612
+ // Creates legend symbol.
613
+ // Ternary changes variables based on option.
614
+ item.legendSymbol = this.chart.renderer.rect(
615
+ horizontal ? box1.x + box1.width + spacing : box1.x - gradientSize - spacing, // Upper left x.
616
+ box1.y, // Upper left y.
617
+ horizontal ? rectangleLength : gradientSize, // Width.
618
+ horizontal ? gradientSize : rectangleLength, // Height.
619
+ 2 // Corner radius.
620
+ ).attr({
621
+ zIndex: 1
622
+ }).add(item.legendGroup);
623
+ box2 = item.legendSymbol.getBBox();
624
+
625
+ // Creates the to text.
626
+ // Vertical coordinate changed based on option.
627
+ item.toText = this.chart.renderer.text(
628
+ item.toLabel,
629
+ box2.x + box2.width + spacing,
630
+ horizontal ? positionY : box2.y + box2.height - spacing
631
+ ).attr({
632
+ zIndex: 2
633
+ }).add(item.legendGroup);
634
+ box3 = item.toText.getBBox();
635
+
636
+ // Changes legend box settings based on option.
637
+ if (horizontal) {
638
+ legend.offsetWidth = box1.width + box2.width + box3.width + (spacing * 2) + padding;
639
+ legend.itemY = gradientSize + padding;
640
+ } else {
641
+ legend.offsetWidth = Math.max(box1.width, box3.width) + (spacing) + box2.width + padding;
642
+ legend.itemY = box2.height + padding;
643
+ legend.itemX = spacing;
644
+ }
645
+ },
646
+
647
+ /**
648
+ * Get the bounding box of all paths in the map combined.
649
+ */
650
+ getBox: function (paths) {
651
+ var maxX = Number.MIN_VALUE,
652
+ minX = Number.MAX_VALUE,
653
+ maxY = Number.MIN_VALUE,
654
+ minY = Number.MAX_VALUE;
655
+
656
+
657
+ // Find the bounding box
658
+ each(paths || this.options.data, function (point) {
659
+ var path = point.path,
660
+ i = path.length,
661
+ even = false, // while loop reads from the end
662
+ pointMaxX = Number.MIN_VALUE,
663
+ pointMinX = Number.MAX_VALUE,
664
+ pointMaxY = Number.MIN_VALUE,
665
+ pointMinY = Number.MAX_VALUE;
666
+
667
+ while (i--) {
668
+ if (typeof path[i] === 'number' && !isNaN(path[i])) {
669
+ if (even) { // even = x
670
+ pointMaxX = Math.max(pointMaxX, path[i]);
671
+ pointMinX = Math.min(pointMinX, path[i]);
672
+ } else { // odd = Y
673
+ pointMaxY = Math.max(pointMaxY, path[i]);
674
+ pointMinY = Math.min(pointMinY, path[i]);
675
+ }
676
+ even = !even;
677
+ }
678
+ }
679
+ // Cache point bounding box for use to position data labels
680
+ point._maxX = pointMaxX;
681
+ point._minX = pointMinX;
682
+ point._maxY = pointMaxY;
683
+ point._minY = pointMinY;
684
+
685
+ maxX = Math.max(maxX, pointMaxX);
686
+ minX = Math.min(minX, pointMinX);
687
+ maxY = Math.max(maxY, pointMaxY);
688
+ minY = Math.min(minY, pointMinY);
689
+ });
690
+ this.minY = minY;
691
+ this.maxY = maxY;
692
+ this.minX = minX;
693
+ this.maxX = maxX;
694
+
695
+ },
696
+
697
+
698
+
699
+ /**
700
+ * Translate the path so that it automatically fits into the plot area box
701
+ * @param {Object} path
702
+ */
703
+ translatePath: function (path) {
704
+
705
+ var series = this,
706
+ even = false, // while loop reads from the end
707
+ xAxis = series.xAxis,
708
+ yAxis = series.yAxis,
709
+ i;
710
+
711
+ // Preserve the original
712
+ path = [].concat(path);
713
+
714
+ // Do the translation
715
+ i = path.length;
716
+ while (i--) {
717
+ if (typeof path[i] === 'number') {
718
+ if (even) { // even = x
719
+ path[i] = Math.round(xAxis.translate(path[i]));
720
+ } else { // odd = Y
721
+ path[i] = Math.round(yAxis.len - yAxis.translate(path[i]));
722
+ }
723
+ even = !even;
724
+ }
725
+ }
726
+ return path;
727
+ },
728
+
729
+ setData: function () {
730
+ Highcharts.Series.prototype.setData.apply(this, arguments);
731
+ this.getBox();
732
+ },
733
+
734
+ /**
735
+ * Add the path option for data points. Find the max value for color calculation.
736
+ */
737
+ translate: function () {
738
+ var series = this,
739
+ dataMin = Number.MAX_VALUE,
740
+ dataMax = Number.MIN_VALUE;
741
+
742
+ series.generatePoints();
743
+
744
+ each(series.data, function (point) {
745
+
746
+ point.shapeType = 'path';
747
+ point.shapeArgs = {
748
+ d: series.translatePath(point.path)
749
+ };
750
+
751
+ // TODO: do point colors in drawPoints instead of point.init
752
+ if (typeof point.y === 'number') {
753
+ if (point.y > dataMax) {
754
+ dataMax = point.y;
755
+ } else if (point.y < dataMin) {
756
+ dataMin = point.y;
757
+ }
758
+ }
759
+ });
760
+
761
+ series.translateColors(dataMin, dataMax);
762
+ },
763
+
764
+ /**
765
+ * In choropleth maps, the color is a result of the value, so this needs translation too
766
+ */
767
+ translateColors: function (dataMin, dataMax) {
768
+
769
+ var seriesOptions = this.options,
770
+ valueRanges = seriesOptions.valueRanges,
771
+ colorRange = seriesOptions.colorRange,
772
+ colorKey = this.colorKey,
773
+ from,
774
+ to;
775
+
776
+ if (colorRange) {
777
+ from = Color(colorRange.from);
778
+ to = Color(colorRange.to);
779
+ }
780
+
781
+ each(this.data, function (point) {
782
+ var value = point[colorKey],
783
+ range,
784
+ color,
785
+ i,
786
+ pos;
787
+
788
+ if (valueRanges) {
789
+ i = valueRanges.length;
790
+ while (i--) {
791
+ range = valueRanges[i];
792
+ from = range.from;
793
+ to = range.to;
794
+ if ((from === UNDEFINED || value >= from) && (to === UNDEFINED || value <= to)) {
795
+ color = range.color;
796
+ break;
797
+ }
798
+
799
+ }
800
+ } else if (colorRange && value !== undefined) {
801
+
802
+ pos = 1 - ((dataMax - value) / (dataMax - dataMin));
803
+ color = value === null ? seriesOptions.nullColor : tweenColors(from, to, pos);
804
+ }
805
+
806
+ if (color) {
807
+ point.color = null; // reset from previous drilldowns, use of the same data options
808
+ point.options.color = color;
809
+ }
810
+ });
811
+ },
812
+
813
+ drawGraph: noop,
814
+
815
+ /**
816
+ * We need the points' bounding boxes in order to draw the data labels, so
817
+ * we skip it now and call if from drawPoints instead.
818
+ */
819
+ drawDataLabels: noop,
820
+
821
+ /**
822
+ * Use the drawPoints method of column, that is able to handle simple shapeArgs.
823
+ * Extend it by assigning the tooltip position.
824
+ */
825
+ drawPoints: function () {
826
+ var series = this,
827
+ xAxis = series.xAxis,
828
+ yAxis = series.yAxis,
829
+ colorKey = series.colorKey;
830
+
831
+ // Make points pass test in drawing
832
+ each(series.data, function (point) {
833
+ point.plotY = 1; // pass null test in column.drawPoints
834
+ if (point[colorKey] === null) {
835
+ point[colorKey] = 0;
836
+ point.isNull = true;
837
+ }
838
+ });
839
+
840
+ // Draw them
841
+ seriesTypes.column.prototype.drawPoints.apply(series);
842
+
843
+ each(series.data, function (point) {
844
+
845
+ var dataLabels = point.dataLabels,
846
+ minX = xAxis.toPixels(point._minX, true),
847
+ maxX = xAxis.toPixels(point._maxX, true),
848
+ minY = yAxis.toPixels(point._minY, true),
849
+ maxY = yAxis.toPixels(point._maxY, true);
850
+
851
+ point.plotX = Math.round(minX + (maxX - minX) * pick(dataLabels && dataLabels.anchorX, 0.5));
852
+ point.plotY = Math.round(minY + (maxY - minY) * pick(dataLabels && dataLabels.anchorY, 0.5));
853
+
854
+
855
+ // Reset escaped null points
856
+ if (point.isNull) {
857
+ point[colorKey] = null;
858
+ }
859
+ });
860
+
861
+ // Now draw the data labels
862
+ Highcharts.Series.prototype.drawDataLabels.call(series);
863
+
864
+ },
865
+
866
+ /**
867
+ * Animate in the new series from the clicked point in the old series.
868
+ * Depends on the drilldown.js module
869
+ */
870
+ animateDrilldown: function (init) {
871
+ var toBox = this.chart.plotBox,
872
+ level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1],
873
+ fromBox = level.bBox,
874
+ animationOptions = this.chart.options.drilldown.animation,
875
+ scale;
876
+
877
+ if (!init) {
878
+
879
+ scale = Math.min(fromBox.width / toBox.width, fromBox.height / toBox.height);
880
+ level.shapeArgs = {
881
+ scaleX: scale,
882
+ scaleY: scale,
883
+ translateX: fromBox.x,
884
+ translateY: fromBox.y
885
+ };
886
+
887
+ // TODO: Animate this.group instead
888
+ each(this.points, function (point) {
889
+
890
+ point.graphic
891
+ .attr(level.shapeArgs)
892
+ .animate({
893
+ scaleX: 1,
894
+ scaleY: 1,
895
+ translateX: 0,
896
+ translateY: 0
897
+ }, animationOptions);
898
+
899
+ });
900
+
901
+ delete this.animate;
902
+ }
903
+
904
+ },
905
+
906
+ /**
907
+ * When drilling up, pull out the individual point graphics from the lower series
908
+ * and animate them into the origin point in the upper series.
909
+ */
910
+ animateDrillupFrom: function (level) {
911
+ seriesTypes.column.prototype.animateDrillupFrom.call(this, level);
912
+ },
913
+
914
+
915
+ /**
916
+ * When drilling up, keep the upper series invisible until the lower series has
917
+ * moved into place
918
+ */
919
+ animateDrillupTo: function (init) {
920
+ seriesTypes.column.prototype.animateDrillupTo.call(this, init);
921
+ }
922
+ });
923
+
924
+
925
+ // The mapline series type
926
+ plotOptions.mapline = merge(plotOptions.map, {
927
+ lineWidth: 1,
928
+ backgroundColor: 'none'
929
+ });
930
+ seriesTypes.mapline = Highcharts.extendClass(seriesTypes.map, {
931
+ type: 'mapline',
932
+ pointAttrToOptions: { // mapping between SVG attributes and the corresponding options
933
+ stroke: 'color',
934
+ 'stroke-width': 'lineWidth',
935
+ fill: 'backgroundColor'
936
+ },
937
+ drawLegendSymbol: seriesTypes.line.prototype.drawLegendSymbol
938
+ });
939
+
940
+ // The mappoint series type
941
+ plotOptions.mappoint = merge(plotOptions.scatter, {
942
+ dataLabels: {
943
+ enabled: true,
944
+ format: '{point.name}',
945
+ color: 'black',
946
+ style: {
947
+ textShadow: '0 0 5px white'
948
+ }
949
+ }
950
+ });
951
+ seriesTypes.mappoint = Highcharts.extendClass(seriesTypes.scatter, {
952
+ type: 'mappoint'
953
+ });
954
+
955
+
956
+
957
+ /**
958
+ * A wrapper for Chart with all the default values for a Map
959
+ */
960
+ Highcharts.Map = function (options, callback) {
961
+
962
+ var hiddenAxis = {
963
+ endOnTick: false,
964
+ gridLineWidth: 0,
965
+ labels: {
966
+ enabled: false
967
+ },
968
+ lineWidth: 0,
969
+ minPadding: 0,
970
+ maxPadding: 0,
971
+ startOnTick: false,
972
+ tickWidth: 0,
973
+ title: null
974
+ },
975
+ seriesOptions;
976
+
977
+ // Don't merge the data
978
+ seriesOptions = options.series;
979
+ options.series = null;
980
+
981
+ options = merge({
982
+ chart: {
983
+ type: 'map',
984
+ panning: 'xy'
985
+ },
986
+ xAxis: hiddenAxis,
987
+ yAxis: merge(hiddenAxis, { reversed: true })
988
+ },
989
+ options, // user's options
990
+
991
+ { // forced options
992
+ chart: {
993
+ inverted: false
994
+ }
995
+ });
996
+
997
+ options.series = seriesOptions;
998
+
999
+
1000
+ return new Highcharts.Chart(options, callback);
1001
+ };
1002
+ }(Highcharts));