ueditor.rails 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/config.mindpin.default.coffee +59 -0
  3. data/app/assets/javascripts/ueditor.js +3 -2
  4. data/app/assets/stylesheets/ueditor/themes/mindpin/css/ueditor.css +1945 -0
  5. data/app/assets/stylesheets/ueditor/themes/mindpin/dialogbase.css +100 -0
  6. data/app/assets/stylesheets/ueditor/themes/mindpin/images/anchor.gif +0 -0
  7. data/app/assets/stylesheets/ueditor/themes/mindpin/images/arrow.png +0 -0
  8. data/app/assets/stylesheets/ueditor/themes/mindpin/images/arrow_down.png +0 -0
  9. data/app/assets/stylesheets/ueditor/themes/mindpin/images/arrow_up.png +0 -0
  10. data/app/assets/stylesheets/ueditor/themes/mindpin/images/button-bg.gif +0 -0
  11. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cancelbutton.gif +0 -0
  12. data/app/assets/stylesheets/ueditor/themes/mindpin/images/charts.png +0 -0
  13. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cursor_h.gif +0 -0
  14. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cursor_h.png +0 -0
  15. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cursor_v.gif +0 -0
  16. data/app/assets/stylesheets/ueditor/themes/mindpin/images/cursor_v.png +0 -0
  17. data/app/assets/stylesheets/ueditor/themes/mindpin/images/dialog-title-bg.png +0 -0
  18. data/{vendor/assets/javascripts/ueditor/dialogs/attachment/images/alignicon.png → app/assets/stylesheets/ueditor/themes/mindpin/images/filescan.png} +0 -0
  19. data/app/assets/stylesheets/ueditor/themes/mindpin/images/highlighted.gif +0 -0
  20. data/app/assets/stylesheets/ueditor/themes/mindpin/images/icons-all.gif +0 -0
  21. data/app/assets/stylesheets/ueditor/themes/mindpin/images/icons.gif +0 -0
  22. data/app/assets/stylesheets/ueditor/themes/mindpin/images/icons.png +0 -0
  23. data/{vendor/assets/javascripts/ueditor/dialogs/attachment/images/bg.png → app/assets/stylesheets/ueditor/themes/mindpin/images/loaderror.png} +0 -0
  24. data/app/assets/stylesheets/ueditor/themes/mindpin/images/loading.gif +0 -0
  25. data/{vendor/assets/javascripts/ueditor/dialogs/attachment/images/alignicon.gif → app/assets/stylesheets/ueditor/themes/mindpin/images/lock.gif} +0 -0
  26. data/{vendor/assets/javascripts/ueditor/dialogs/emotion → app/assets/stylesheets/ueditor/themes/mindpin}/images/neweditor-tab-bg.png +0 -0
  27. data/app/assets/stylesheets/ueditor/themes/mindpin/images/pagebreak.gif +0 -0
  28. data/app/assets/stylesheets/ueditor/themes/mindpin/images/scale.png +0 -0
  29. data/{vendor/assets/javascripts/ueditor/dialogs/video/images/bg.png → app/assets/stylesheets/ueditor/themes/mindpin/images/sortable.png} +0 -0
  30. data/app/assets/stylesheets/ueditor/themes/mindpin/images/spacer.gif +0 -0
  31. data/app/assets/stylesheets/ueditor/themes/mindpin/images/sparator_v.png +0 -0
  32. data/app/assets/stylesheets/ueditor/themes/mindpin/images/table-cell-align.png +0 -0
  33. data/app/assets/stylesheets/ueditor/themes/mindpin/images/tangram-colorpicker.png +0 -0
  34. data/app/assets/stylesheets/ueditor/themes/mindpin/images/toolbar_bg.png +0 -0
  35. data/app/assets/stylesheets/ueditor/themes/mindpin/images/unhighlighted.gif +0 -0
  36. data/app/assets/stylesheets/ueditor/themes/mindpin/images/upload.png +0 -0
  37. data/app/assets/stylesheets/ueditor/themes/mindpin/images/videologo.gif +0 -0
  38. data/{vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_chm.gif → app/assets/stylesheets/ueditor/themes/mindpin/images/word.gif} +0 -0
  39. data/app/assets/stylesheets/ueditor/themes/mindpin/images/wordpaste.png +0 -0
  40. data/lib/ueditor/version.rb +1 -1
  41. data/test/dummy/log/development.log +105 -0
  42. data/test/dummy/tmp/cache/assets/development/sprockets/02b56f18dcd4ddec585a02528773c04b +0 -0
  43. data/test/dummy/tmp/cache/assets/development/sprockets/067a099f2392ac9d679fb27d72421548 +0 -0
  44. data/test/dummy/tmp/cache/assets/development/sprockets/07898ec696d976eeafb61ef6bb48e097 +0 -0
  45. data/test/dummy/tmp/cache/assets/development/sprockets/19694ecb6829b547affeb420f6c4f4ba +0 -0
  46. data/test/dummy/tmp/cache/assets/development/sprockets/22b4a109d4f3136884f5b96c0dafe5c4 +0 -0
  47. data/test/dummy/tmp/cache/assets/development/sprockets/2e810e09180be475ce270590eb6d79bf +0 -0
  48. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  49. data/test/dummy/tmp/cache/assets/development/sprockets/31b24023d7695b6c40fbe8b2d903e8db +0 -0
  50. data/test/dummy/tmp/cache/assets/development/sprockets/32e4b0cbcc7942738eb80e9c571e09ad +0 -0
  51. data/test/dummy/tmp/cache/assets/development/sprockets/3e6fbffe890d9471ace4284a35cf833e +0 -0
  52. data/test/dummy/tmp/cache/assets/development/sprockets/50a23c1131cabc18af0d7ce21df229ea +0 -0
  53. data/test/dummy/tmp/cache/assets/development/sprockets/792425c63374a4c75ca043ceeb960991 +0 -0
  54. data/test/dummy/tmp/cache/assets/development/sprockets/8165d0bcd2b5c04b4a98f4f0cbabef64 +0 -0
  55. data/test/dummy/tmp/cache/assets/development/sprockets/9bf28bcb944fe3baabaabb97036a4d6c +0 -0
  56. data/test/dummy/tmp/cache/assets/development/sprockets/9df06b25c7118a2446ff210358a7150a +0 -0
  57. data/test/dummy/tmp/cache/assets/development/sprockets/a0a5d0da6dc7907299fb15adbabc87e5 +0 -0
  58. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  59. data/test/dummy/tmp/cache/assets/development/sprockets/d3a9a64bc190424c032a25d0b7ee0ed1 +0 -0
  60. data/test/dummy/tmp/cache/assets/development/sprockets/eb17dc3da27134989a88ec01caa61d78 +0 -0
  61. data/test/dummy/tmp/cache/assets/development/sprockets/ef01c1c9fa9a8ace471702975febabf5 +0 -0
  62. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  63. data/test/dummy/tmp/cache/assets/development/sprockets/fa046bb067616da9d14862739bf2c67c +0 -0
  64. data/vendor/assets/javascripts/ueditor/index.html +0 -19
  65. data/vendor/assets/javascripts/ueditor/themes/iframe.css +0 -1
  66. data/vendor/assets/javascripts/ueditor/ueditor.all.js +2854 -12684
  67. data/vendor/assets/javascripts/ueditor/ueditor.all.min.js +10 -709
  68. data/vendor/assets/javascripts/ueditor/ueditor.config.js +2 -147
  69. data/vendor/assets/javascripts/ueditor/ueditor.parse.js +11 -602
  70. data/vendor/assets/javascripts/ueditor/ueditor.parse.min.js +1 -28
  71. metadata +82 -161
  72. data/app/assets/javascripts/default.config.js +0 -381
  73. data/vendor/assets/javascripts/ueditor/dialogs/anchor/anchor.html +0 -40
  74. data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.css +0 -681
  75. data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.html +0 -60
  76. data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.js +0 -754
  77. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
  78. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
  79. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
  80. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_jpg.gif +0 -0
  81. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
  82. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
  83. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
  84. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
  85. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
  86. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
  87. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
  88. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
  89. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/file-icons.gif +0 -0
  90. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/file-icons.png +0 -0
  91. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/icons.gif +0 -0
  92. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/icons.png +0 -0
  93. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/image.png +0 -0
  94. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/progress.png +0 -0
  95. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/success.gif +0 -0
  96. data/vendor/assets/javascripts/ueditor/dialogs/attachment/images/success.png +0 -0
  97. data/vendor/assets/javascripts/ueditor/dialogs/background/background.css +0 -94
  98. data/vendor/assets/javascripts/ueditor/dialogs/background/background.html +0 -56
  99. data/vendor/assets/javascripts/ueditor/dialogs/background/background.js +0 -376
  100. data/vendor/assets/javascripts/ueditor/dialogs/background/images/bg.png +0 -0
  101. data/vendor/assets/javascripts/ueditor/dialogs/background/images/success.png +0 -0
  102. data/vendor/assets/javascripts/ueditor/dialogs/charts/chart.config.js +0 -65
  103. data/vendor/assets/javascripts/ueditor/dialogs/charts/charts.css +0 -165
  104. data/vendor/assets/javascripts/ueditor/dialogs/charts/charts.html +0 -89
  105. data/vendor/assets/javascripts/ueditor/dialogs/charts/charts.js +0 -519
  106. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts0.png +0 -0
  107. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts1.png +0 -0
  108. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts2.png +0 -0
  109. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts3.png +0 -0
  110. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts4.png +0 -0
  111. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts5.png +0 -0
  112. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.css +0 -43
  113. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.html +0 -54
  114. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.js +0 -186
  115. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
  116. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
  117. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
  118. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
  119. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
  120. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
  121. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
  122. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
  123. data/vendor/assets/javascripts/ueditor/dialogs/gmap/gmap.html +0 -89
  124. data/vendor/assets/javascripts/ueditor/dialogs/help/help.css +0 -7
  125. data/vendor/assets/javascripts/ueditor/dialogs/help/help.html +0 -82
  126. data/vendor/assets/javascripts/ueditor/dialogs/help/help.js +0 -56
  127. data/vendor/assets/javascripts/ueditor/dialogs/image/image.css +0 -894
  128. data/vendor/assets/javascripts/ueditor/dialogs/image/image.html +0 -120
  129. data/vendor/assets/javascripts/ueditor/dialogs/image/image.js +0 -1139
  130. data/vendor/assets/javascripts/ueditor/dialogs/image/images/alignicon.jpg +0 -0
  131. data/vendor/assets/javascripts/ueditor/dialogs/image/images/bg.png +0 -0
  132. data/vendor/assets/javascripts/ueditor/dialogs/image/images/icons.gif +0 -0
  133. data/vendor/assets/javascripts/ueditor/dialogs/image/images/icons.png +0 -0
  134. data/vendor/assets/javascripts/ueditor/dialogs/image/images/image.png +0 -0
  135. data/vendor/assets/javascripts/ueditor/dialogs/image/images/progress.png +0 -0
  136. data/vendor/assets/javascripts/ueditor/dialogs/image/images/success.gif +0 -0
  137. data/vendor/assets/javascripts/ueditor/dialogs/image/images/success.png +0 -0
  138. data/vendor/assets/javascripts/ueditor/dialogs/insertframe/insertframe.html +0 -98
  139. data/vendor/assets/javascripts/ueditor/dialogs/map/map.html +0 -135
  140. data/vendor/assets/javascripts/ueditor/dialogs/map/show.html +0 -118
  141. data/vendor/assets/javascripts/ueditor/dialogs/music/music.css +0 -30
  142. data/vendor/assets/javascripts/ueditor/dialogs/music/music.html +0 -32
  143. data/vendor/assets/javascripts/ueditor/dialogs/music/music.js +0 -192
  144. data/vendor/assets/javascripts/ueditor/dialogs/preview/preview.html +0 -40
  145. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/addimg.png +0 -0
  146. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/brush.png +0 -0
  147. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/delimg.png +0 -0
  148. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/delimgH.png +0 -0
  149. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/empty.png +0 -0
  150. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/emptyH.png +0 -0
  151. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/eraser.png +0 -0
  152. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/redo.png +0 -0
  153. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/redoH.png +0 -0
  154. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/scale.png +0 -0
  155. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/scaleH.png +0 -0
  156. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/size.png +0 -0
  157. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/undo.png +0 -0
  158. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/undoH.png +0 -0
  159. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/scrawl.css +0 -72
  160. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/scrawl.html +0 -95
  161. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/scrawl.js +0 -671
  162. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.html +0 -102
  163. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.js +0 -164
  164. data/vendor/assets/javascripts/ueditor/dialogs/snapscreen/snapscreen.html +0 -58
  165. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.html +0 -21
  166. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.js +0 -57
  167. data/vendor/assets/javascripts/ueditor/dialogs/table/dragicon.png +0 -0
  168. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.css +0 -84
  169. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.html +0 -64
  170. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.js +0 -237
  171. data/vendor/assets/javascripts/ueditor/dialogs/table/edittd.html +0 -61
  172. data/vendor/assets/javascripts/ueditor/dialogs/table/edittip.html +0 -33
  173. data/vendor/assets/javascripts/ueditor/dialogs/template/config.js +0 -42
  174. data/vendor/assets/javascripts/ueditor/dialogs/template/images/bg.gif +0 -0
  175. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre0.png +0 -0
  176. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre1.png +0 -0
  177. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre2.png +0 -0
  178. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre3.png +0 -0
  179. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre4.png +0 -0
  180. data/vendor/assets/javascripts/ueditor/dialogs/template/template.css +0 -18
  181. data/vendor/assets/javascripts/ueditor/dialogs/template/template.html +0 -26
  182. data/vendor/assets/javascripts/ueditor/dialogs/template/template.js +0 -53
  183. data/vendor/assets/javascripts/ueditor/dialogs/video/images/center_focus.jpg +0 -0
  184. data/vendor/assets/javascripts/ueditor/dialogs/video/images/file-icons.gif +0 -0
  185. data/vendor/assets/javascripts/ueditor/dialogs/video/images/file-icons.png +0 -0
  186. data/vendor/assets/javascripts/ueditor/dialogs/video/images/icons.gif +0 -0
  187. data/vendor/assets/javascripts/ueditor/dialogs/video/images/icons.png +0 -0
  188. data/vendor/assets/javascripts/ueditor/dialogs/video/images/image.png +0 -0
  189. data/vendor/assets/javascripts/ueditor/dialogs/video/images/left_focus.jpg +0 -0
  190. data/vendor/assets/javascripts/ueditor/dialogs/video/images/none_focus.jpg +0 -0
  191. data/vendor/assets/javascripts/ueditor/dialogs/video/images/progress.png +0 -0
  192. data/vendor/assets/javascripts/ueditor/dialogs/video/images/right_focus.jpg +0 -0
  193. data/vendor/assets/javascripts/ueditor/dialogs/video/images/success.gif +0 -0
  194. data/vendor/assets/javascripts/ueditor/dialogs/video/images/success.png +0 -0
  195. data/vendor/assets/javascripts/ueditor/dialogs/video/video.css +0 -635
  196. data/vendor/assets/javascripts/ueditor/dialogs/video/video.html +0 -86
  197. data/vendor/assets/javascripts/ueditor/dialogs/video/video.js +0 -789
  198. data/vendor/assets/javascripts/ueditor/dialogs/webapp/webapp.html +0 -53
  199. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/fClipboard_ueditor.swf +0 -0
  200. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/imageUploader.swf +0 -0
  201. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/tangram.js +0 -1495
  202. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/wordimage.html +0 -111
  203. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/wordimage.js +0 -157
  204. data/vendor/assets/javascripts/ueditor/lang/en/en.js +0 -684
  205. data/vendor/assets/javascripts/ueditor/lang/en/images/addimage.png +0 -0
  206. data/vendor/assets/javascripts/ueditor/lang/en/images/alldeletebtnhoverskin.png +0 -0
  207. data/vendor/assets/javascripts/ueditor/lang/en/images/alldeletebtnupskin.png +0 -0
  208. data/vendor/assets/javascripts/ueditor/lang/en/images/background.png +0 -0
  209. data/vendor/assets/javascripts/ueditor/lang/en/images/button.png +0 -0
  210. data/vendor/assets/javascripts/ueditor/lang/en/images/copy.png +0 -0
  211. data/vendor/assets/javascripts/ueditor/lang/en/images/deletedisable.png +0 -0
  212. data/vendor/assets/javascripts/ueditor/lang/en/images/deleteenable.png +0 -0
  213. data/vendor/assets/javascripts/ueditor/lang/en/images/listbackground.png +0 -0
  214. data/vendor/assets/javascripts/ueditor/lang/en/images/localimage.png +0 -0
  215. data/vendor/assets/javascripts/ueditor/lang/en/images/music.png +0 -0
  216. data/vendor/assets/javascripts/ueditor/lang/en/images/rotateleftdisable.png +0 -0
  217. data/vendor/assets/javascripts/ueditor/lang/en/images/rotateleftenable.png +0 -0
  218. data/vendor/assets/javascripts/ueditor/lang/en/images/rotaterightdisable.png +0 -0
  219. data/vendor/assets/javascripts/ueditor/lang/en/images/rotaterightenable.png +0 -0
  220. data/vendor/assets/javascripts/ueditor/lang/en/images/upload.png +0 -0
  221. data/vendor/assets/javascripts/ueditor/third-party/zeroclipboard/ZeroClipboard.js +0 -1256
  222. data/vendor/assets/javascripts/ueditor/third-party/zeroclipboard/ZeroClipboard.min.js +0 -9
  223. data/vendor/assets/javascripts/ueditor/third-party/zeroclipboard/ZeroClipboard.swf +0 -0
@@ -1,1256 +0,0 @@
1
- /*!
2
- * ZeroClipboard
3
- * The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
4
- * Copyright (c) 2014 Jon Rohan, James M. Greene
5
- * Licensed MIT
6
- * http://zeroclipboard.org/
7
- * v2.0.0-beta.5
8
- */
9
- (function(window) {
10
- "use strict";
11
- var _currentElement;
12
- var _flashState = {
13
- bridge: null,
14
- version: "0.0.0",
15
- pluginType: "unknown",
16
- disabled: null,
17
- outdated: null,
18
- unavailable: null,
19
- deactivated: null,
20
- overdue: null,
21
- ready: null
22
- };
23
- var _clipData = {};
24
- var _clipDataFormatMap = null;
25
- var _clientIdCounter = 0;
26
- var _clientMeta = {};
27
- var _elementIdCounter = 0;
28
- var _elementMeta = {};
29
- var _swfPath = function() {
30
- var i, jsDir, tmpJsPath, jsPath, swfPath = "ZeroClipboard.swf";
31
- if (!(document.currentScript && (jsPath = document.currentScript.src))) {
32
- var scripts = document.getElementsByTagName("script");
33
- if ("readyState" in scripts[0]) {
34
- for (i = scripts.length; i--; ) {
35
- if (scripts[i].readyState === "interactive" && (jsPath = scripts[i].src)) {
36
- break;
37
- }
38
- }
39
- } else if (document.readyState === "loading") {
40
- jsPath = scripts[scripts.length - 1].src;
41
- } else {
42
- for (i = scripts.length; i--; ) {
43
- tmpJsPath = scripts[i].src;
44
- if (!tmpJsPath) {
45
- jsDir = null;
46
- break;
47
- }
48
- tmpJsPath = tmpJsPath.split("#")[0].split("?")[0];
49
- tmpJsPath = tmpJsPath.slice(0, tmpJsPath.lastIndexOf("/") + 1);
50
- if (jsDir == null) {
51
- jsDir = tmpJsPath;
52
- } else if (jsDir !== tmpJsPath) {
53
- jsDir = null;
54
- break;
55
- }
56
- }
57
- if (jsDir !== null) {
58
- jsPath = jsDir;
59
- }
60
- }
61
- }
62
- if (jsPath) {
63
- jsPath = jsPath.split("#")[0].split("?")[0];
64
- swfPath = jsPath.slice(0, jsPath.lastIndexOf("/") + 1) + swfPath;
65
- }
66
- return swfPath;
67
- }();
68
- var _camelizeCssPropName = function() {
69
- var matcherRegex = /\-([a-z])/g, replacerFn = function(match, group) {
70
- return group.toUpperCase();
71
- };
72
- return function(prop) {
73
- return prop.replace(matcherRegex, replacerFn);
74
- };
75
- }();
76
- var _getStyle = function(el, prop) {
77
- var value, camelProp, tagName;
78
- if (window.getComputedStyle) {
79
- value = window.getComputedStyle(el, null).getPropertyValue(prop);
80
- } else {
81
- camelProp = _camelizeCssPropName(prop);
82
- if (el.currentStyle) {
83
- value = el.currentStyle[camelProp];
84
- } else {
85
- value = el.style[camelProp];
86
- }
87
- }
88
- if (prop === "cursor") {
89
- if (!value || value === "auto") {
90
- tagName = el.tagName.toLowerCase();
91
- if (tagName === "a") {
92
- return "pointer";
93
- }
94
- }
95
- }
96
- return value;
97
- };
98
- var _elementMouseOver = function(event) {
99
- if (!event) {
100
- event = window.event;
101
- }
102
- var target;
103
- if (this !== window) {
104
- target = this;
105
- } else if (event.target) {
106
- target = event.target;
107
- } else if (event.srcElement) {
108
- target = event.srcElement;
109
- }
110
- ZeroClipboard.activate(target);
111
- };
112
- var _addEventHandler = function(element, method, func) {
113
- if (!element || element.nodeType !== 1) {
114
- return;
115
- }
116
- if (element.addEventListener) {
117
- element.addEventListener(method, func, false);
118
- } else if (element.attachEvent) {
119
- element.attachEvent("on" + method, func);
120
- }
121
- };
122
- var _removeEventHandler = function(element, method, func) {
123
- if (!element || element.nodeType !== 1) {
124
- return;
125
- }
126
- if (element.removeEventListener) {
127
- element.removeEventListener(method, func, false);
128
- } else if (element.detachEvent) {
129
- element.detachEvent("on" + method, func);
130
- }
131
- };
132
- var _addClass = function(element, value) {
133
- if (!element || element.nodeType !== 1) {
134
- return element;
135
- }
136
- if (element.classList) {
137
- if (!element.classList.contains(value)) {
138
- element.classList.add(value);
139
- }
140
- return element;
141
- }
142
- if (value && typeof value === "string") {
143
- var classNames = (value || "").split(/\s+/);
144
- if (element.nodeType === 1) {
145
- if (!element.className) {
146
- element.className = value;
147
- } else {
148
- var className = " " + element.className + " ", setClass = element.className;
149
- for (var c = 0, cl = classNames.length; c < cl; c++) {
150
- if (className.indexOf(" " + classNames[c] + " ") < 0) {
151
- setClass += " " + classNames[c];
152
- }
153
- }
154
- element.className = setClass.replace(/^\s+|\s+$/g, "");
155
- }
156
- }
157
- }
158
- return element;
159
- };
160
- var _removeClass = function(element, value) {
161
- if (!element || element.nodeType !== 1) {
162
- return element;
163
- }
164
- if (element.classList) {
165
- if (element.classList.contains(value)) {
166
- element.classList.remove(value);
167
- }
168
- return element;
169
- }
170
- if (value && typeof value === "string" || value === undefined) {
171
- var classNames = (value || "").split(/\s+/);
172
- if (element.nodeType === 1 && element.className) {
173
- if (value) {
174
- var className = (" " + element.className + " ").replace(/[\n\t]/g, " ");
175
- for (var c = 0, cl = classNames.length; c < cl; c++) {
176
- className = className.replace(" " + classNames[c] + " ", " ");
177
- }
178
- element.className = className.replace(/^\s+|\s+$/g, "");
179
- } else {
180
- element.className = "";
181
- }
182
- }
183
- }
184
- return element;
185
- };
186
- var _getZoomFactor = function() {
187
- var rect, physicalWidth, logicalWidth, zoomFactor = 1;
188
- if (typeof document.body.getBoundingClientRect === "function") {
189
- rect = document.body.getBoundingClientRect();
190
- physicalWidth = rect.right - rect.left;
191
- logicalWidth = document.body.offsetWidth;
192
- zoomFactor = Math.round(physicalWidth / logicalWidth * 100) / 100;
193
- }
194
- return zoomFactor;
195
- };
196
- var _getDOMObjectPosition = function(obj, defaultZIndex) {
197
- var info = {
198
- left: 0,
199
- top: 0,
200
- width: 0,
201
- height: 0,
202
- zIndex: _getSafeZIndex(defaultZIndex) - 1
203
- };
204
- if (obj.getBoundingClientRect) {
205
- var rect = obj.getBoundingClientRect();
206
- var pageXOffset, pageYOffset, zoomFactor;
207
- if ("pageXOffset" in window && "pageYOffset" in window) {
208
- pageXOffset = window.pageXOffset;
209
- pageYOffset = window.pageYOffset;
210
- } else {
211
- zoomFactor = _getZoomFactor();
212
- pageXOffset = Math.round(document.documentElement.scrollLeft / zoomFactor);
213
- pageYOffset = Math.round(document.documentElement.scrollTop / zoomFactor);
214
- }
215
- var leftBorderWidth = document.documentElement.clientLeft || 0;
216
- var topBorderWidth = document.documentElement.clientTop || 0;
217
- info.left = rect.left + pageXOffset - leftBorderWidth;
218
- info.top = rect.top + pageYOffset - topBorderWidth;
219
- info.width = "width" in rect ? rect.width : rect.right - rect.left;
220
- info.height = "height" in rect ? rect.height : rect.bottom - rect.top;
221
- }
222
- return info;
223
- };
224
- var _cacheBust = function(path, options) {
225
- var cacheBust = options == null || options && options.cacheBust === true;
226
- if (cacheBust) {
227
- return (path.indexOf("?") === -1 ? "?" : "&") + "noCache=" + new Date().getTime();
228
- } else {
229
- return "";
230
- }
231
- };
232
- var _vars = function(options) {
233
- var i, len, domain, domains, str = "", trustedOriginsExpanded = [];
234
- if (options.trustedDomains) {
235
- if (typeof options.trustedDomains === "string") {
236
- domains = [ options.trustedDomains ];
237
- } else if (typeof options.trustedDomains === "object" && "length" in options.trustedDomains) {
238
- domains = options.trustedDomains;
239
- }
240
- }
241
- if (domains && domains.length) {
242
- for (i = 0, len = domains.length; i < len; i++) {
243
- if (domains.hasOwnProperty(i) && domains[i] && typeof domains[i] === "string") {
244
- domain = _extractDomain(domains[i]);
245
- if (!domain) {
246
- continue;
247
- }
248
- if (domain === "*") {
249
- trustedOriginsExpanded = [ domain ];
250
- break;
251
- }
252
- trustedOriginsExpanded.push.apply(trustedOriginsExpanded, [ domain, "//" + domain, window.location.protocol + "//" + domain ]);
253
- }
254
- }
255
- }
256
- if (trustedOriginsExpanded.length) {
257
- str += "trustedOrigins=" + encodeURIComponent(trustedOriginsExpanded.join(","));
258
- }
259
- if (options.forceEnhancedClipboard === true) {
260
- str += (str ? "&" : "") + "forceEnhancedClipboard=true";
261
- }
262
- return str;
263
- };
264
- var _inArray = function(elem, array, fromIndex) {
265
- if (typeof array.indexOf === "function") {
266
- return array.indexOf(elem, fromIndex);
267
- }
268
- var i, len = array.length;
269
- if (typeof fromIndex === "undefined") {
270
- fromIndex = 0;
271
- } else if (fromIndex < 0) {
272
- fromIndex = len + fromIndex;
273
- }
274
- for (i = fromIndex; i < len; i++) {
275
- if (array.hasOwnProperty(i) && array[i] === elem) {
276
- return i;
277
- }
278
- }
279
- return -1;
280
- };
281
- var _prepClip = function(elements) {
282
- if (typeof elements === "string") {
283
- throw new TypeError("ZeroClipboard doesn't accept query strings.");
284
- }
285
- return typeof elements.length !== "number" ? [ elements ] : elements;
286
- };
287
- var _dispatchCallback = function(func, context, args, async) {
288
- if (async) {
289
- window.setTimeout(function() {
290
- func.apply(context, args);
291
- }, 0);
292
- } else {
293
- func.apply(context, args);
294
- }
295
- };
296
- var _getSafeZIndex = function(val) {
297
- var zIndex, tmp;
298
- if (val) {
299
- if (typeof val === "number" && val > 0) {
300
- zIndex = val;
301
- } else if (typeof val === "string" && (tmp = parseInt(val, 10)) && !isNaN(tmp) && tmp > 0) {
302
- zIndex = tmp;
303
- }
304
- }
305
- if (!zIndex) {
306
- if (typeof _globalConfig.zIndex === "number" && _globalConfig.zIndex > 0) {
307
- zIndex = _globalConfig.zIndex;
308
- } else if (typeof _globalConfig.zIndex === "string" && (tmp = parseInt(_globalConfig.zIndex, 10)) && !isNaN(tmp) && tmp > 0) {
309
- zIndex = tmp;
310
- }
311
- }
312
- return zIndex || 0;
313
- };
314
- var _extend = function() {
315
- var i, len, arg, prop, src, copy, target = arguments[0] || {};
316
- for (i = 1, len = arguments.length; i < len; i++) {
317
- if ((arg = arguments[i]) != null) {
318
- for (prop in arg) {
319
- if (arg.hasOwnProperty(prop)) {
320
- src = target[prop];
321
- copy = arg[prop];
322
- if (target === copy) {
323
- continue;
324
- }
325
- if (copy !== undefined) {
326
- target[prop] = copy;
327
- }
328
- }
329
- }
330
- }
331
- }
332
- return target;
333
- };
334
- var _extractDomain = function(originOrUrl) {
335
- if (originOrUrl == null || originOrUrl === "") {
336
- return null;
337
- }
338
- originOrUrl = originOrUrl.replace(/^\s+|\s+$/g, "");
339
- if (originOrUrl === "") {
340
- return null;
341
- }
342
- var protocolIndex = originOrUrl.indexOf("//");
343
- originOrUrl = protocolIndex === -1 ? originOrUrl : originOrUrl.slice(protocolIndex + 2);
344
- var pathIndex = originOrUrl.indexOf("/");
345
- originOrUrl = pathIndex === -1 ? originOrUrl : protocolIndex === -1 || pathIndex === 0 ? null : originOrUrl.slice(0, pathIndex);
346
- if (originOrUrl && originOrUrl.slice(-4).toLowerCase() === ".swf") {
347
- return null;
348
- }
349
- return originOrUrl || null;
350
- };
351
- var _determineScriptAccess = function() {
352
- var _extractAllDomains = function(origins, resultsArray) {
353
- var i, len, tmp;
354
- if (origins == null || resultsArray[0] === "*") {
355
- return;
356
- }
357
- if (typeof origins === "string") {
358
- origins = [ origins ];
359
- }
360
- if (!(typeof origins === "object" && typeof origins.length === "number")) {
361
- return;
362
- }
363
- for (i = 0, len = origins.length; i < len; i++) {
364
- if (origins.hasOwnProperty(i) && (tmp = _extractDomain(origins[i]))) {
365
- if (tmp === "*") {
366
- resultsArray.length = 0;
367
- resultsArray.push("*");
368
- break;
369
- }
370
- if (_inArray(tmp, resultsArray) === -1) {
371
- resultsArray.push(tmp);
372
- }
373
- }
374
- }
375
- };
376
- return function(currentDomain, configOptions) {
377
- var swfDomain = _extractDomain(configOptions.swfPath);
378
- if (swfDomain === null) {
379
- swfDomain = currentDomain;
380
- }
381
- var trustedDomains = [];
382
- _extractAllDomains(configOptions.trustedOrigins, trustedDomains);
383
- _extractAllDomains(configOptions.trustedDomains, trustedDomains);
384
- var len = trustedDomains.length;
385
- if (len > 0) {
386
- if (len === 1 && trustedDomains[0] === "*") {
387
- return "always";
388
- }
389
- if (_inArray(currentDomain, trustedDomains) !== -1) {
390
- if (len === 1 && currentDomain === swfDomain) {
391
- return "sameDomain";
392
- }
393
- return "always";
394
- }
395
- }
396
- return "never";
397
- };
398
- }();
399
- var _objectKeys = function(obj) {
400
- if (obj == null) {
401
- return [];
402
- }
403
- if (Object.keys) {
404
- return Object.keys(obj);
405
- }
406
- var keys = [];
407
- for (var prop in obj) {
408
- if (obj.hasOwnProperty(prop)) {
409
- keys.push(prop);
410
- }
411
- }
412
- return keys;
413
- };
414
- var _deleteOwnProperties = function(obj) {
415
- if (obj) {
416
- for (var prop in obj) {
417
- if (obj.hasOwnProperty(prop)) {
418
- delete obj[prop];
419
- }
420
- }
421
- }
422
- return obj;
423
- };
424
- var _safeActiveElement = function() {
425
- try {
426
- return document.activeElement;
427
- } catch (err) {}
428
- return null;
429
- };
430
- var _pick = function(obj, keys) {
431
- var newObj = {};
432
- for (var i = 0, len = keys.length; i < len; i++) {
433
- if (keys[i] in obj) {
434
- newObj[keys[i]] = obj[keys[i]];
435
- }
436
- }
437
- return newObj;
438
- };
439
- var _omit = function(obj, keys) {
440
- var newObj = {};
441
- for (var prop in obj) {
442
- if (_inArray(prop, keys) === -1) {
443
- newObj[prop] = obj[prop];
444
- }
445
- }
446
- return newObj;
447
- };
448
- var _mapClipDataToFlash = function(clipData) {
449
- var newClipData = {}, formatMap = {};
450
- if (!(typeof clipData === "object" && clipData)) {
451
- return;
452
- }
453
- for (var dataFormat in clipData) {
454
- if (dataFormat && clipData.hasOwnProperty(dataFormat) && typeof clipData[dataFormat] === "string" && clipData[dataFormat]) {
455
- switch (dataFormat.toLowerCase()) {
456
- case "text/plain":
457
- case "text":
458
- case "air:text":
459
- case "flash:text":
460
- newClipData.text = clipData[dataFormat];
461
- formatMap.text = dataFormat;
462
- break;
463
-
464
- case "text/html":
465
- case "html":
466
- case "air:html":
467
- case "flash:html":
468
- newClipData.html = clipData[dataFormat];
469
- formatMap.html = dataFormat;
470
- break;
471
-
472
- case "application/rtf":
473
- case "text/rtf":
474
- case "rtf":
475
- case "richtext":
476
- case "air:rtf":
477
- case "flash:rtf":
478
- newClipData.rtf = clipData[dataFormat];
479
- formatMap.rtf = dataFormat;
480
- break;
481
-
482
- default:
483
- break;
484
- }
485
- }
486
- }
487
- return {
488
- data: newClipData,
489
- formatMap: formatMap
490
- };
491
- };
492
- var _mapClipResultsFromFlash = function(clipResults, formatMap) {
493
- if (!(typeof clipResults === "object" && clipResults && typeof formatMap === "object" && formatMap)) {
494
- return clipResults;
495
- }
496
- var newResults = {};
497
- for (var prop in clipResults) {
498
- if (clipResults.hasOwnProperty(prop)) {
499
- if (prop !== "success" && prop !== "data") {
500
- newResults[prop] = clipResults[prop];
501
- continue;
502
- }
503
- newResults[prop] = {};
504
- var tmpHash = clipResults[prop];
505
- for (var dataFormat in tmpHash) {
506
- if (dataFormat && tmpHash.hasOwnProperty(dataFormat) && formatMap.hasOwnProperty(dataFormat)) {
507
- newResults[prop][formatMap[dataFormat]] = tmpHash[dataFormat];
508
- }
509
- }
510
- }
511
- }
512
- return newResults;
513
- };
514
- var _args = function(arraySlice) {
515
- return function(args) {
516
- return arraySlice.call(args, 0);
517
- };
518
- }(window.Array.prototype.slice);
519
- var _detectFlashSupport = function() {
520
- var plugin, ax, mimeType, hasFlash = false, isActiveX = false, isPPAPI = false, flashVersion = "";
521
- function parseFlashVersion(desc) {
522
- var matches = desc.match(/[\d]+/g);
523
- matches.length = 3;
524
- return matches.join(".");
525
- }
526
- function isPepperFlash(flashPlayerFileName) {
527
- return !!flashPlayerFileName && (flashPlayerFileName = flashPlayerFileName.toLowerCase()) && (/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(flashPlayerFileName) || flashPlayerFileName.slice(-13) === "chrome.plugin");
528
- }
529
- function inspectPlugin(plugin) {
530
- if (plugin) {
531
- hasFlash = true;
532
- if (plugin.version) {
533
- flashVersion = parseFlashVersion(plugin.version);
534
- }
535
- if (!flashVersion && plugin.description) {
536
- flashVersion = parseFlashVersion(plugin.description);
537
- }
538
- if (plugin.filename) {
539
- isPPAPI = isPepperFlash(plugin.filename);
540
- }
541
- }
542
- }
543
- if (navigator.plugins && navigator.plugins.length) {
544
- plugin = navigator.plugins["Shockwave Flash"];
545
- inspectPlugin(plugin);
546
- if (navigator.plugins["Shockwave Flash 2.0"]) {
547
- hasFlash = true;
548
- flashVersion = "2.0.0.11";
549
- }
550
- } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
551
- mimeType = navigator.mimeTypes["application/x-shockwave-flash"];
552
- plugin = mimeType && mimeType.enabledPlugin;
553
- inspectPlugin(plugin);
554
- } else if (typeof ActiveXObject !== "undefined") {
555
- isActiveX = true;
556
- try {
557
- ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
558
- hasFlash = true;
559
- flashVersion = parseFlashVersion(ax.GetVariable("$version"));
560
- } catch (e1) {
561
- try {
562
- ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
563
- hasFlash = true;
564
- flashVersion = "6.0.21";
565
- } catch (e2) {
566
- try {
567
- ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
568
- hasFlash = true;
569
- flashVersion = parseFlashVersion(ax.GetVariable("$version"));
570
- } catch (e3) {
571
- isActiveX = false;
572
- }
573
- }
574
- }
575
- }
576
- _flashState.disabled = hasFlash !== true;
577
- _flashState.outdated = flashVersion && parseFloat(flashVersion) < 11;
578
- _flashState.version = flashVersion || "0.0.0";
579
- _flashState.pluginType = isPPAPI ? "pepper" : isActiveX ? "activex" : hasFlash ? "netscape" : "unknown";
580
- };
581
- _detectFlashSupport();
582
- var ZeroClipboard = function(elements) {
583
- if (!(this instanceof ZeroClipboard)) {
584
- return new ZeroClipboard(elements);
585
- }
586
- this.id = "" + _clientIdCounter++;
587
- _clientMeta[this.id] = {
588
- instance: this,
589
- elements: [],
590
- handlers: {}
591
- };
592
- if (elements) {
593
- this.clip(elements);
594
- }
595
- if (typeof _flashState.ready !== "boolean") {
596
- _flashState.ready = false;
597
- }
598
- if (!ZeroClipboard.isFlashUnusable() && _flashState.bridge === null) {
599
- var _client = this;
600
- var maxWait = _globalConfig.flashLoadTimeout;
601
- if (typeof maxWait === "number" && maxWait >= 0) {
602
- setTimeout(function() {
603
- if (typeof _flashState.deactivated !== "boolean") {
604
- _flashState.deactivated = true;
605
- }
606
- if (_flashState.deactivated === true) {
607
- ZeroClipboard.emit({
608
- type: "error",
609
- name: "flash-deactivated",
610
- client: _client
611
- });
612
- }
613
- }, maxWait);
614
- }
615
- _flashState.overdue = false;
616
- _bridge();
617
- }
618
- };
619
- ZeroClipboard.prototype.setText = function(text) {
620
- ZeroClipboard.setData("text/plain", text);
621
- return this;
622
- };
623
- ZeroClipboard.prototype.setHtml = function(html) {
624
- ZeroClipboard.setData("text/html", html);
625
- return this;
626
- };
627
- ZeroClipboard.prototype.setRichText = function(richText) {
628
- ZeroClipboard.setData("application/rtf", richText);
629
- return this;
630
- };
631
- ZeroClipboard.prototype.setData = function() {
632
- ZeroClipboard.setData.apply(ZeroClipboard, _args(arguments));
633
- return this;
634
- };
635
- ZeroClipboard.prototype.clearData = function() {
636
- ZeroClipboard.clearData.apply(ZeroClipboard, _args(arguments));
637
- return this;
638
- };
639
- ZeroClipboard.prototype.setSize = function(width, height) {
640
- _setSize(width, height);
641
- return this;
642
- };
643
- var _setHandCursor = function(enabled) {
644
- if (_flashState.ready === true && _flashState.bridge && typeof _flashState.bridge.setHandCursor === "function") {
645
- _flashState.bridge.setHandCursor(enabled);
646
- } else {
647
- _flashState.ready = false;
648
- }
649
- };
650
- ZeroClipboard.prototype.destroy = function() {
651
- this.unclip();
652
- this.off();
653
- delete _clientMeta[this.id];
654
- };
655
- var _getAllClients = function() {
656
- var i, len, client, clients = [], clientIds = _objectKeys(_clientMeta);
657
- for (i = 0, len = clientIds.length; i < len; i++) {
658
- client = _clientMeta[clientIds[i]].instance;
659
- if (client && client instanceof ZeroClipboard) {
660
- clients.push(client);
661
- }
662
- }
663
- return clients;
664
- };
665
- ZeroClipboard.version = "2.0.0-beta.5";
666
- var _globalConfig = {
667
- swfPath: _swfPath,
668
- trustedDomains: window.location.host ? [ window.location.host ] : [],
669
- cacheBust: true,
670
- forceHandCursor: false,
671
- forceEnhancedClipboard: false,
672
- zIndex: 999999999,
673
- debug: false,
674
- title: null,
675
- autoActivate: true,
676
- flashLoadTimeout: 3e4
677
- };
678
- ZeroClipboard.isFlashUnusable = function() {
679
- return !!(_flashState.disabled || _flashState.outdated || _flashState.unavailable || _flashState.deactivated);
680
- };
681
- ZeroClipboard.config = function(options) {
682
- if (typeof options === "object" && options !== null) {
683
- _extend(_globalConfig, options);
684
- }
685
- if (typeof options === "string" && options) {
686
- if (_globalConfig.hasOwnProperty(options)) {
687
- return _globalConfig[options];
688
- }
689
- return;
690
- }
691
- var copy = {};
692
- for (var prop in _globalConfig) {
693
- if (_globalConfig.hasOwnProperty(prop)) {
694
- if (typeof _globalConfig[prop] === "object" && _globalConfig[prop] !== null) {
695
- if ("length" in _globalConfig[prop]) {
696
- copy[prop] = _globalConfig[prop].slice(0);
697
- } else {
698
- copy[prop] = _extend({}, _globalConfig[prop]);
699
- }
700
- } else {
701
- copy[prop] = _globalConfig[prop];
702
- }
703
- }
704
- }
705
- return copy;
706
- };
707
- ZeroClipboard.destroy = function() {
708
- ZeroClipboard.deactivate();
709
- for (var clientId in _clientMeta) {
710
- if (_clientMeta.hasOwnProperty(clientId) && _clientMeta[clientId]) {
711
- var client = _clientMeta[clientId].instance;
712
- if (client && typeof client.destroy === "function") {
713
- client.destroy();
714
- }
715
- }
716
- }
717
- var flashBridge = _flashState.bridge;
718
- if (flashBridge) {
719
- var htmlBridge = _getHtmlBridge(flashBridge);
720
- if (htmlBridge) {
721
- if (_flashState.pluginType === "activex" && "readyState" in flashBridge) {
722
- flashBridge.style.display = "none";
723
- (function removeSwfFromIE() {
724
- if (flashBridge.readyState === 4) {
725
- for (var prop in flashBridge) {
726
- if (typeof flashBridge[prop] === "function") {
727
- flashBridge[prop] = null;
728
- }
729
- }
730
- flashBridge.parentNode.removeChild(flashBridge);
731
- if (htmlBridge.parentNode) {
732
- htmlBridge.parentNode.removeChild(htmlBridge);
733
- }
734
- } else {
735
- setTimeout(removeSwfFromIE, 10);
736
- }
737
- })();
738
- } else {
739
- flashBridge.parentNode.removeChild(flashBridge);
740
- if (htmlBridge.parentNode) {
741
- htmlBridge.parentNode.removeChild(htmlBridge);
742
- }
743
- }
744
- }
745
- _flashState.ready = null;
746
- _flashState.bridge = null;
747
- _flashState.deactivated = null;
748
- }
749
- ZeroClipboard.clearData();
750
- };
751
- ZeroClipboard.activate = function(element) {
752
- if (_currentElement) {
753
- _removeClass(_currentElement, _globalConfig.hoverClass);
754
- _removeClass(_currentElement, _globalConfig.activeClass);
755
- }
756
- _currentElement = element;
757
- _addClass(element, _globalConfig.hoverClass);
758
- _reposition();
759
- var newTitle = _globalConfig.title || element.getAttribute("title");
760
- if (newTitle) {
761
- var htmlBridge = _getHtmlBridge(_flashState.bridge);
762
- if (htmlBridge) {
763
- htmlBridge.setAttribute("title", newTitle);
764
- }
765
- }
766
- var useHandCursor = _globalConfig.forceHandCursor === true || _getStyle(element, "cursor") === "pointer";
767
- _setHandCursor(useHandCursor);
768
- };
769
- ZeroClipboard.deactivate = function() {
770
- var htmlBridge = _getHtmlBridge(_flashState.bridge);
771
- if (htmlBridge) {
772
- htmlBridge.removeAttribute("title");
773
- htmlBridge.style.left = "0px";
774
- htmlBridge.style.top = "-9999px";
775
- _setSize(1, 1);
776
- }
777
- if (_currentElement) {
778
- _removeClass(_currentElement, _globalConfig.hoverClass);
779
- _removeClass(_currentElement, _globalConfig.activeClass);
780
- _currentElement = null;
781
- }
782
- };
783
- ZeroClipboard.state = function() {
784
- return {
785
- browser: _pick(window.navigator, [ "userAgent", "platform", "appName" ]),
786
- flash: _omit(_flashState, [ "bridge" ]),
787
- zeroclipboard: {
788
- version: ZeroClipboard.version,
789
- config: ZeroClipboard.config()
790
- }
791
- };
792
- };
793
- ZeroClipboard.setData = function(format, data) {
794
- var dataObj;
795
- if (typeof format === "object" && format && typeof data === "undefined") {
796
- dataObj = format;
797
- ZeroClipboard.clearData();
798
- } else if (typeof format === "string" && format) {
799
- dataObj = {};
800
- dataObj[format] = data;
801
- } else {
802
- return;
803
- }
804
- for (var dataFormat in dataObj) {
805
- if (dataFormat && dataObj.hasOwnProperty(dataFormat) && typeof dataObj[dataFormat] === "string" && dataObj[dataFormat]) {
806
- _clipData[dataFormat] = dataObj[dataFormat];
807
- }
808
- }
809
- };
810
- ZeroClipboard.clearData = function(format) {
811
- if (typeof format === "undefined") {
812
- _deleteOwnProperties(_clipData);
813
- _clipDataFormatMap = null;
814
- } else if (typeof format === "string" && _clipData.hasOwnProperty(format)) {
815
- delete _clipData[format];
816
- }
817
- };
818
- var _bridge = function() {
819
- var flashBridge, len;
820
- var container = document.getElementById("global-zeroclipboard-html-bridge");
821
- if (!container) {
822
- var allowScriptAccess = _determineScriptAccess(window.location.host, _globalConfig);
823
- var allowNetworking = allowScriptAccess === "never" ? "none" : "all";
824
- var flashvars = _vars(_globalConfig);
825
- var swfUrl = _globalConfig.swfPath + _cacheBust(_globalConfig.swfPath, _globalConfig);
826
- container = _createHtmlBridge();
827
- var divToBeReplaced = document.createElement("div");
828
- container.appendChild(divToBeReplaced);
829
- document.body.appendChild(container);
830
- var tmpDiv = document.createElement("div");
831
- var oldIE = _flashState.pluginType === "activex";
832
- tmpDiv.innerHTML = '<object id="global-zeroclipboard-flash-bridge" name="global-zeroclipboard-flash-bridge" ' + 'width="100%" height="100%" ' + (oldIE ? 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' : 'type="application/x-shockwave-flash" data="' + swfUrl + '"') + ">" + (oldIE ? '<param name="movie" value="' + swfUrl + '"/>' : "") + '<param name="allowScriptAccess" value="' + allowScriptAccess + '"/>' + '<param name="allowNetworking" value="' + allowNetworking + '"/>' + '<param name="menu" value="false"/>' + '<param name="wmode" value="transparent"/>' + '<param name="flashvars" value="' + flashvars + '"/>' + "</object>";
833
- flashBridge = tmpDiv.firstChild;
834
- tmpDiv = null;
835
- flashBridge.ZeroClipboard = ZeroClipboard;
836
- container.replaceChild(flashBridge, divToBeReplaced);
837
- }
838
- if (!flashBridge) {
839
- flashBridge = document["global-zeroclipboard-flash-bridge"];
840
- if (flashBridge && (len = flashBridge.length)) {
841
- flashBridge = flashBridge[len - 1];
842
- }
843
- if (!flashBridge) {
844
- flashBridge = container.firstChild;
845
- }
846
- }
847
- _flashState.bridge = flashBridge || null;
848
- };
849
- var _createHtmlBridge = function() {
850
- var container = document.createElement("div");
851
- container.id = "global-zeroclipboard-html-bridge";
852
- container.className = "global-zeroclipboard-container";
853
- container.style.position = "absolute";
854
- container.style.left = "0px";
855
- container.style.top = "-9999px";
856
- container.style.width = "1px";
857
- container.style.height = "1px";
858
- container.style.zIndex = "" + _getSafeZIndex(_globalConfig.zIndex);
859
- return container;
860
- };
861
- var _getHtmlBridge = function(flashBridge) {
862
- var htmlBridge = flashBridge && flashBridge.parentNode;
863
- while (htmlBridge && htmlBridge.nodeName === "OBJECT" && htmlBridge.parentNode) {
864
- htmlBridge = htmlBridge.parentNode;
865
- }
866
- return htmlBridge || null;
867
- };
868
- var _reposition = function() {
869
- if (_currentElement) {
870
- var pos = _getDOMObjectPosition(_currentElement, _globalConfig.zIndex);
871
- var htmlBridge = _getHtmlBridge(_flashState.bridge);
872
- if (htmlBridge) {
873
- htmlBridge.style.top = pos.top + "px";
874
- htmlBridge.style.left = pos.left + "px";
875
- htmlBridge.style.width = pos.width + "px";
876
- htmlBridge.style.height = pos.height + "px";
877
- htmlBridge.style.zIndex = pos.zIndex + 1;
878
- }
879
- _setSize(pos.width, pos.height);
880
- }
881
- };
882
- var _setSize = function(width, height) {
883
- var htmlBridge = _getHtmlBridge(_flashState.bridge);
884
- if (htmlBridge) {
885
- htmlBridge.style.width = width + "px";
886
- htmlBridge.style.height = height + "px";
887
- }
888
- };
889
- ZeroClipboard.emit = function(event) {
890
- var eventType, eventObj, performCallbackAsync, clients, i, len, eventCopy, returnVal, tmp;
891
- if (typeof event === "string" && event) {
892
- eventType = event;
893
- }
894
- if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
895
- eventType = event.type;
896
- eventObj = event;
897
- }
898
- if (!eventType) {
899
- return;
900
- }
901
- event = _createEvent(eventType, eventObj);
902
- _preprocessEvent(event);
903
- if (event.type === "ready" && _flashState.overdue === true) {
904
- return ZeroClipboard.emit({
905
- type: "error",
906
- name: "flash-overdue"
907
- });
908
- }
909
- performCallbackAsync = !/^(before)?copy$/.test(event.type);
910
- if (event.client) {
911
- _dispatchClientCallbacks.call(event.client, event, performCallbackAsync);
912
- } else {
913
- clients = event.target && event.target !== window && _globalConfig.autoActivate === true ? _getAllClientsClippedToElement(event.target) : _getAllClients();
914
- for (i = 0, len = clients.length; i < len; i++) {
915
- eventCopy = _extend({}, event, {
916
- client: clients[i]
917
- });
918
- _dispatchClientCallbacks.call(clients[i], eventCopy, performCallbackAsync);
919
- }
920
- }
921
- if (event.type === "copy") {
922
- tmp = _mapClipDataToFlash(_clipData);
923
- returnVal = tmp.data;
924
- _clipDataFormatMap = tmp.formatMap;
925
- }
926
- return returnVal;
927
- };
928
- var _dispatchClientCallbacks = function(event, async) {
929
- var handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers[event.type];
930
- if (handlers && handlers.length) {
931
- var i, len, func, context, originalContext = this;
932
- for (i = 0, len = handlers.length; i < len; i++) {
933
- func = handlers[i];
934
- context = originalContext;
935
- if (typeof func === "string" && typeof window[func] === "function") {
936
- func = window[func];
937
- }
938
- if (typeof func === "object" && func && typeof func.handleEvent === "function") {
939
- context = func;
940
- func = func.handleEvent;
941
- }
942
- if (typeof func === "function") {
943
- _dispatchCallback(func, context, [ event ], async);
944
- }
945
- }
946
- }
947
- return this;
948
- };
949
- var _eventMessages = {
950
- ready: "Flash communication is established",
951
- error: {
952
- "flash-disabled": "Flash is disabled or not installed",
953
- "flash-outdated": "Flash is too outdated to support ZeroClipboard",
954
- "flash-unavailable": "Flash is unable to communicate bidirectionally with JavaScript",
955
- "flash-deactivated": "Flash is too outdated for your browser and/or is configured as click-to-activate",
956
- "flash-overdue": "Flash communication was established but NOT within the acceptable time limit"
957
- }
958
- };
959
- var _createEvent = function(eventType, event) {
960
- if (!(eventType || event && event.type)) {
961
- return;
962
- }
963
- event = event || {};
964
- eventType = (eventType || event.type).toLowerCase();
965
- _extend(event, {
966
- type: eventType,
967
- target: event.target || _currentElement || null,
968
- relatedTarget: event.relatedTarget || null,
969
- currentTarget: _flashState && _flashState.bridge || null
970
- });
971
- var msg = _eventMessages[event.type];
972
- if (event.type === "error" && event.name && msg) {
973
- msg = msg[event.name];
974
- }
975
- if (msg) {
976
- event.message = msg;
977
- }
978
- if (event.type === "ready") {
979
- _extend(event, {
980
- target: null,
981
- version: _flashState.version
982
- });
983
- }
984
- if (event.type === "error") {
985
- event.target = null;
986
- if (/^flash-(outdated|unavailable|deactivated|overdue)$/.test(event.name)) {
987
- _extend(event, {
988
- version: _flashState.version,
989
- minimumVersion: "11.0.0"
990
- });
991
- }
992
- }
993
- if (event.type === "copy") {
994
- event.clipboardData = {
995
- setData: ZeroClipboard.setData,
996
- clearData: ZeroClipboard.clearData
997
- };
998
- }
999
- if (event.type === "aftercopy") {
1000
- event = _mapClipResultsFromFlash(event, _clipDataFormatMap);
1001
- }
1002
- if (event.target && !event.relatedTarget) {
1003
- event.relatedTarget = _getRelatedTarget(event.target);
1004
- }
1005
- return event;
1006
- };
1007
- var _getRelatedTarget = function(targetEl) {
1008
- var relatedTargetId = targetEl && targetEl.getAttribute && targetEl.getAttribute("data-clipboard-target");
1009
- return relatedTargetId ? document.getElementById(relatedTargetId) : null;
1010
- };
1011
- var _preprocessEvent = function(event) {
1012
- var element = event.target || _currentElement;
1013
- switch (event.type) {
1014
- case "error":
1015
- if (_inArray(event.name, [ "flash-disabled", "flash-outdated", "flash-deactivated", "flash-overdue" ])) {
1016
- _extend(_flashState, {
1017
- disabled: event.name === "flash-disabled",
1018
- outdated: event.name === "flash-outdated",
1019
- unavailable: event.name === "flash-unavailable",
1020
- deactivated: event.name === "flash-deactivated",
1021
- overdue: event.name === "flash-overdue",
1022
- ready: false
1023
- });
1024
- }
1025
- break;
1026
-
1027
- case "ready":
1028
- var wasDeactivated = _flashState.deactivated === true;
1029
- _extend(_flashState, {
1030
- disabled: false,
1031
- outdated: false,
1032
- unavailable: false,
1033
- deactivated: false,
1034
- overdue: wasDeactivated,
1035
- ready: !wasDeactivated
1036
- });
1037
- break;
1038
-
1039
- case "copy":
1040
- var textContent, htmlContent, targetEl = event.relatedTarget;
1041
- if (!(_clipData["text/html"] || _clipData["text/plain"]) && targetEl && (htmlContent = targetEl.value || targetEl.outerHTML || targetEl.innerHTML) && (textContent = targetEl.value || targetEl.textContent || targetEl.innerText)) {
1042
- event.clipboardData.clearData();
1043
- event.clipboardData.setData("text/plain", textContent);
1044
- if (htmlContent !== textContent) {
1045
- event.clipboardData.setData("text/html", htmlContent);
1046
- }
1047
- } else if (!_clipData["text/plain"] && event.target && (textContent = event.target.getAttribute("data-clipboard-text"))) {
1048
- event.clipboardData.clearData();
1049
- event.clipboardData.setData("text/plain", textContent);
1050
- }
1051
- break;
1052
-
1053
- case "aftercopy":
1054
- ZeroClipboard.clearData();
1055
- if (element && element !== _safeActiveElement() && element.focus) {
1056
- element.focus();
1057
- }
1058
- break;
1059
-
1060
- case "mouseover":
1061
- _addClass(element, _globalConfig.hoverClass);
1062
- break;
1063
-
1064
- case "mouseout":
1065
- if (_globalConfig.autoActivate === true) {
1066
- ZeroClipboard.deactivate();
1067
- }
1068
- break;
1069
-
1070
- case "mousedown":
1071
- _addClass(element, _globalConfig.activeClass);
1072
- break;
1073
-
1074
- case "mouseup":
1075
- _removeClass(element, _globalConfig.activeClass);
1076
- break;
1077
- }
1078
- };
1079
- ZeroClipboard.prototype.on = function(eventName, func) {
1080
- var i, len, events, added = {}, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
1081
- if (typeof eventName === "string" && eventName) {
1082
- events = eventName.toLowerCase().split(/\s+/);
1083
- } else if (typeof eventName === "object" && eventName && typeof func === "undefined") {
1084
- for (i in eventName) {
1085
- if (eventName.hasOwnProperty(i) && typeof i === "string" && i && typeof eventName[i] === "function") {
1086
- this.on(i, eventName[i]);
1087
- }
1088
- }
1089
- }
1090
- if (events && events.length) {
1091
- for (i = 0, len = events.length; i < len; i++) {
1092
- eventName = events[i].replace(/^on/, "");
1093
- added[eventName] = true;
1094
- if (!handlers[eventName]) {
1095
- handlers[eventName] = [];
1096
- }
1097
- handlers[eventName].push(func);
1098
- }
1099
- if (added.ready && _flashState.ready) {
1100
- ZeroClipboard.emit({
1101
- type: "ready",
1102
- client: this
1103
- });
1104
- }
1105
- if (added.error) {
1106
- var errorTypes = [ "disabled", "outdated", "unavailable", "deactivated", "overdue" ];
1107
- for (i = 0, len = errorTypes.length; i < len; i++) {
1108
- if (_flashState[errorTypes[i]]) {
1109
- ZeroClipboard.emit({
1110
- type: "error",
1111
- name: "flash-" + errorTypes[i],
1112
- client: this
1113
- });
1114
- break;
1115
- }
1116
- }
1117
- }
1118
- }
1119
- return this;
1120
- };
1121
- ZeroClipboard.prototype.off = function(eventName, func) {
1122
- var i, len, foundIndex, events, perEventHandlers, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
1123
- if (arguments.length === 0) {
1124
- events = _objectKeys(handlers);
1125
- } else if (typeof eventName === "string" && eventName) {
1126
- events = eventName.split(/\s+/);
1127
- } else if (typeof eventName === "object" && eventName && typeof func === "undefined") {
1128
- for (i in eventName) {
1129
- if (eventName.hasOwnProperty(i) && typeof i === "string" && i && typeof eventName[i] === "function") {
1130
- this.off(i, eventName[i]);
1131
- }
1132
- }
1133
- }
1134
- if (events && events.length) {
1135
- for (i = 0, len = events.length; i < len; i++) {
1136
- eventName = events[i].toLowerCase().replace(/^on/, "");
1137
- perEventHandlers = handlers[eventName];
1138
- if (perEventHandlers && perEventHandlers.length) {
1139
- if (func) {
1140
- foundIndex = _inArray(func, perEventHandlers);
1141
- while (foundIndex !== -1) {
1142
- perEventHandlers.splice(foundIndex, 1);
1143
- foundIndex = _inArray(func, perEventHandlers, foundIndex);
1144
- }
1145
- } else {
1146
- handlers[eventName].length = 0;
1147
- }
1148
- }
1149
- }
1150
- }
1151
- return this;
1152
- };
1153
- ZeroClipboard.prototype.handlers = function(eventName) {
1154
- var prop, copy = null, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
1155
- if (handlers) {
1156
- if (typeof eventName === "string" && eventName) {
1157
- return handlers[eventName] ? handlers[eventName].slice(0) : null;
1158
- }
1159
- copy = {};
1160
- for (prop in handlers) {
1161
- if (handlers.hasOwnProperty(prop) && handlers[prop]) {
1162
- copy[prop] = handlers[prop].slice(0);
1163
- }
1164
- }
1165
- }
1166
- return copy;
1167
- };
1168
- ZeroClipboard.prototype.clip = function(elements) {
1169
- elements = _prepClip(elements);
1170
- for (var i = 0; i < elements.length; i++) {
1171
- if (elements.hasOwnProperty(i) && elements[i] && elements[i].nodeType === 1) {
1172
- if (!elements[i].zcClippingId) {
1173
- elements[i].zcClippingId = "zcClippingId_" + _elementIdCounter++;
1174
- _elementMeta[elements[i].zcClippingId] = [ this.id ];
1175
- if (_globalConfig.autoActivate === true) {
1176
- _addEventHandler(elements[i], "mouseover", _elementMouseOver);
1177
- }
1178
- } else if (_inArray(this.id, _elementMeta[elements[i].zcClippingId]) === -1) {
1179
- _elementMeta[elements[i].zcClippingId].push(this.id);
1180
- }
1181
- var clippedElements = _clientMeta[this.id].elements;
1182
- if (_inArray(elements[i], clippedElements) === -1) {
1183
- clippedElements.push(elements[i]);
1184
- }
1185
- }
1186
- }
1187
- return this;
1188
- };
1189
- ZeroClipboard.prototype.unclip = function(elements) {
1190
- var meta = _clientMeta[this.id];
1191
- if (!meta) {
1192
- return this;
1193
- }
1194
- var clippedElements = meta.elements;
1195
- var arrayIndex;
1196
- if (typeof elements === "undefined") {
1197
- elements = clippedElements.slice(0);
1198
- } else {
1199
- elements = _prepClip(elements);
1200
- }
1201
- for (var i = elements.length; i--; ) {
1202
- if (elements.hasOwnProperty(i) && elements[i] && elements[i].nodeType === 1) {
1203
- arrayIndex = 0;
1204
- while ((arrayIndex = _inArray(elements[i], clippedElements, arrayIndex)) !== -1) {
1205
- clippedElements.splice(arrayIndex, 1);
1206
- }
1207
- var clientIds = _elementMeta[elements[i].zcClippingId];
1208
- if (clientIds) {
1209
- arrayIndex = 0;
1210
- while ((arrayIndex = _inArray(this.id, clientIds, arrayIndex)) !== -1) {
1211
- clientIds.splice(arrayIndex, 1);
1212
- }
1213
- if (clientIds.length === 0) {
1214
- if (_globalConfig.autoActivate === true) {
1215
- _removeEventHandler(elements[i], "mouseover", _elementMouseOver);
1216
- }
1217
- delete elements[i].zcClippingId;
1218
- }
1219
- }
1220
- }
1221
- }
1222
- return this;
1223
- };
1224
- ZeroClipboard.prototype.elements = function() {
1225
- var meta = _clientMeta[this.id];
1226
- return meta && meta.elements ? meta.elements.slice(0) : [];
1227
- };
1228
- var _getAllClientsClippedToElement = function(element) {
1229
- var elementMetaId, clientIds, i, len, client, clients = [];
1230
- if (element && element.nodeType === 1 && (elementMetaId = element.zcClippingId) && _elementMeta.hasOwnProperty(elementMetaId)) {
1231
- clientIds = _elementMeta[elementMetaId];
1232
- if (clientIds && clientIds.length) {
1233
- for (i = 0, len = clientIds.length; i < len; i++) {
1234
- client = _clientMeta[clientIds[i]].instance;
1235
- if (client && client instanceof ZeroClipboard) {
1236
- clients.push(client);
1237
- }
1238
- }
1239
- }
1240
- }
1241
- return clients;
1242
- };
1243
- _globalConfig.hoverClass = "zeroclipboard-is-hover";
1244
- _globalConfig.activeClass = "zeroclipboard-is-active";
1245
- if (typeof define === "function" && define.amd) {
1246
- define(function() {
1247
- return ZeroClipboard;
1248
- });
1249
- } else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports) {
1250
- module.exports = ZeroClipboard;
1251
- } else {
1252
- window.ZeroClipboard = ZeroClipboard;
1253
- }
1254
- })(function() {
1255
- return this;
1256
- }());