glebtv-ckeditor 4.7.3.1 → 4.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (284) hide show
  1. checksums.yaml +5 -5
  2. data/Rakefile +0 -9
  3. data/app/assets/javascripts/ckeditor/config.js.erb +3 -3
  4. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js +317 -313
  5. data/config/locales/bg.ckeditor.yml +9 -0
  6. data/config/locales/cs.ckeditor.yml +9 -0
  7. data/config/locales/de.ckeditor.yml +9 -0
  8. data/config/locales/el-GR.cdkeditor.yml +9 -0
  9. data/config/locales/es.ckeditor.yml +9 -0
  10. data/config/locales/fr.ckeditor.yml +9 -0
  11. data/config/locales/hu.ckeditor.yml +9 -0
  12. data/config/locales/it.ckeditor.yml +9 -0
  13. data/config/locales/ja.ckeditor.yml +9 -0
  14. data/config/locales/nb.ckeditor.yml +9 -0
  15. data/config/locales/nl.ckeditor.yml +9 -0
  16. data/config/locales/pl.ckeditor.yml +9 -0
  17. data/config/locales/pt-BR.ckeditor.yml +9 -0
  18. data/config/locales/pt-PT.ckeditor.yml +9 -0
  19. data/config/locales/pt.ckeditor.yml +9 -0
  20. data/config/locales/sq.ckeditor.yml +9 -0
  21. data/config/locales/sv-SE.ckeditor.yml +9 -0
  22. data/config/locales/tr.ckeditor.yml +9 -0
  23. data/config/locales/uk.ckeditor.yml +9 -0
  24. data/config/locales/zh-CN.ckeditor.yml +9 -0
  25. data/config/locales/zh-TW.ckeditor.yml +9 -0
  26. data/lib/ckeditor/asset_response.rb +6 -2
  27. data/lib/ckeditor/http.rb +5 -7
  28. data/lib/ckeditor/utils/content_type_detector.rb +3 -3
  29. data/lib/ckeditor/version.rb +2 -2
  30. data/vendor/assets/javascripts/ckeditor/CHANGES.md +1128 -849
  31. data/vendor/assets/javascripts/ckeditor/LICENSE.md +3 -3
  32. data/vendor/assets/javascripts/ckeditor/README.md +6 -6
  33. data/vendor/assets/javascripts/ckeditor/adapters/jquery.js +2 -2
  34. data/vendor/assets/javascripts/ckeditor/build-config.js +11 -6
  35. data/vendor/assets/javascripts/ckeditor/ckeditor.js +825 -688
  36. data/vendor/assets/javascripts/ckeditor/config.js +2 -2
  37. data/vendor/assets/javascripts/ckeditor/contents.css +7 -7
  38. data/vendor/assets/javascripts/ckeditor/lang/af.js +5 -0
  39. data/vendor/assets/javascripts/ckeditor/lang/ar.js +5 -0
  40. data/vendor/assets/javascripts/ckeditor/lang/az.js +5 -0
  41. data/vendor/assets/javascripts/ckeditor/lang/bg.js +5 -0
  42. data/vendor/assets/javascripts/ckeditor/lang/bn.js +5 -0
  43. data/vendor/assets/javascripts/ckeditor/lang/bs.js +5 -0
  44. data/vendor/assets/javascripts/ckeditor/lang/ca.js +5 -0
  45. data/vendor/assets/javascripts/ckeditor/lang/cs.js +5 -0
  46. data/vendor/assets/javascripts/ckeditor/lang/cy.js +5 -0
  47. data/vendor/assets/javascripts/ckeditor/lang/da.js +5 -0
  48. data/vendor/assets/javascripts/ckeditor/lang/de-ch.js +5 -0
  49. data/vendor/assets/javascripts/ckeditor/lang/de.js +5 -0
  50. data/vendor/assets/javascripts/ckeditor/lang/el.js +5 -0
  51. data/vendor/assets/javascripts/ckeditor/lang/en-au.js +5 -0
  52. data/vendor/assets/javascripts/ckeditor/lang/en-ca.js +5 -0
  53. data/vendor/assets/javascripts/ckeditor/lang/en-gb.js +5 -0
  54. data/vendor/assets/javascripts/ckeditor/lang/en.js +3 -3
  55. data/vendor/assets/javascripts/ckeditor/lang/eo.js +5 -0
  56. data/vendor/assets/javascripts/ckeditor/lang/es-mx.js +5 -0
  57. data/vendor/assets/javascripts/ckeditor/lang/es.js +5 -0
  58. data/vendor/assets/javascripts/ckeditor/lang/et.js +5 -0
  59. data/vendor/assets/javascripts/ckeditor/lang/eu.js +5 -0
  60. data/vendor/assets/javascripts/ckeditor/lang/fa.js +5 -0
  61. data/vendor/assets/javascripts/ckeditor/lang/fi.js +5 -0
  62. data/vendor/assets/javascripts/ckeditor/lang/fo.js +5 -0
  63. data/vendor/assets/javascripts/ckeditor/lang/fr-ca.js +5 -0
  64. data/vendor/assets/javascripts/ckeditor/lang/fr.js +5 -0
  65. data/vendor/assets/javascripts/ckeditor/lang/gl.js +5 -0
  66. data/vendor/assets/javascripts/ckeditor/lang/gu.js +5 -0
  67. data/vendor/assets/javascripts/ckeditor/lang/he.js +5 -0
  68. data/vendor/assets/javascripts/ckeditor/lang/hi.js +5 -0
  69. data/vendor/assets/javascripts/ckeditor/lang/hr.js +5 -0
  70. data/vendor/assets/javascripts/ckeditor/lang/hu.js +5 -0
  71. data/vendor/assets/javascripts/ckeditor/lang/id.js +5 -0
  72. data/vendor/assets/javascripts/ckeditor/lang/is.js +5 -0
  73. data/vendor/assets/javascripts/ckeditor/lang/it.js +5 -0
  74. data/vendor/assets/javascripts/ckeditor/lang/ja.js +5 -0
  75. data/vendor/assets/javascripts/ckeditor/lang/ka.js +5 -0
  76. data/vendor/assets/javascripts/ckeditor/lang/km.js +5 -0
  77. data/vendor/assets/javascripts/ckeditor/lang/ko.js +5 -0
  78. data/vendor/assets/javascripts/ckeditor/lang/ku.js +5 -0
  79. data/vendor/assets/javascripts/ckeditor/lang/lt.js +5 -0
  80. data/vendor/assets/javascripts/ckeditor/lang/lv.js +5 -0
  81. data/vendor/assets/javascripts/ckeditor/lang/mk.js +5 -0
  82. data/vendor/assets/javascripts/ckeditor/lang/mn.js +5 -0
  83. data/vendor/assets/javascripts/ckeditor/lang/ms.js +5 -0
  84. data/vendor/assets/javascripts/ckeditor/lang/nb.js +5 -0
  85. data/vendor/assets/javascripts/ckeditor/lang/nl.js +5 -0
  86. data/vendor/assets/javascripts/ckeditor/lang/no.js +5 -0
  87. data/vendor/assets/javascripts/ckeditor/lang/oc.js +5 -0
  88. data/vendor/assets/javascripts/ckeditor/lang/pl.js +5 -0
  89. data/vendor/assets/javascripts/ckeditor/lang/pt-br.js +5 -0
  90. data/vendor/assets/javascripts/ckeditor/lang/pt.js +5 -0
  91. data/vendor/assets/javascripts/ckeditor/lang/ro.js +5 -0
  92. data/vendor/assets/javascripts/ckeditor/lang/ru.js +3 -3
  93. data/vendor/assets/javascripts/ckeditor/lang/si.js +5 -0
  94. data/vendor/assets/javascripts/ckeditor/lang/sk.js +5 -0
  95. data/vendor/assets/javascripts/ckeditor/lang/sl.js +5 -0
  96. data/vendor/assets/javascripts/ckeditor/lang/sq.js +5 -0
  97. data/vendor/assets/javascripts/ckeditor/lang/sr-latn.js +5 -0
  98. data/vendor/assets/javascripts/ckeditor/lang/sr.js +5 -0
  99. data/vendor/assets/javascripts/ckeditor/lang/sv.js +5 -0
  100. data/vendor/assets/javascripts/ckeditor/lang/th.js +5 -0
  101. data/vendor/assets/javascripts/ckeditor/lang/tr.js +5 -0
  102. data/vendor/assets/javascripts/ckeditor/lang/tt.js +5 -0
  103. data/vendor/assets/javascripts/ckeditor/lang/ug.js +5 -0
  104. data/vendor/assets/javascripts/ckeditor/lang/uk.js +5 -0
  105. data/vendor/assets/javascripts/ckeditor/lang/vi.js +5 -0
  106. data/vendor/assets/javascripts/ckeditor/lang/zh-cn.js +5 -0
  107. data/vendor/assets/javascripts/ckeditor/lang/zh.js +5 -0
  108. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +7 -7
  109. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +2 -2
  110. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +3 -3
  111. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +5 -5
  112. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png +0 -0
  113. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
  114. data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +11 -0
  115. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
  116. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/autoformat.png +0 -0
  117. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/searchcode.png +0 -0
  118. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/uncommentselectedrange.png +0 -0
  119. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/autocomplete.png +0 -0
  120. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/autoformat.png +0 -0
  121. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/commentselectedrange.png +0 -0
  122. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/searchcode.png +0 -0
  123. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/images/uncommentselectedrange.png +0 -0
  124. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +2 -2
  125. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +2 -2
  126. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
  127. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -6
  128. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +1 -1
  129. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.handlebars.min.js +1 -0
  130. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -2
  131. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
  132. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +3 -3
  133. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -1
  134. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +231 -217
  135. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/darcula.css +46 -0
  136. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/gruvbox-dark.css +34 -0
  137. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/idea.css +42 -0
  138. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +1 -1
  139. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lucario.css +37 -0
  140. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +5 -0
  141. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/oceanic-next.css +44 -0
  142. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/shadowfox.css +52 -0
  143. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +0 -1
  144. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ssms.css +16 -0
  145. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.css +2 -2
  146. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +11 -11
  147. data/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +2 -2
  148. data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +23 -23
  149. data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +5 -5
  150. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +2 -2
  151. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +3 -3
  152. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +2 -2
  153. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +2 -2
  154. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +7 -7
  155. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +4 -3
  156. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +3 -3
  157. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +3 -3
  158. data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  159. data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
  160. data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +3 -3
  161. data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +1259 -44
  162. data/vendor/assets/javascripts/ckeditor/plugins/image/icons/hidpi/image.png +0 -0
  163. data/vendor/assets/javascripts/ckeditor/plugins/image/icons/image.png +0 -0
  164. data/vendor/assets/javascripts/ckeditor/plugins/image/lang/en.js +25 -0
  165. data/vendor/assets/javascripts/ckeditor/plugins/image/lang/ru.js +25 -0
  166. data/vendor/assets/javascripts/ckeditor/plugins/image/plugin.js +184 -0
  167. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
  168. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
  169. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/contents.css +35 -0
  170. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/image2.html +339 -0
  171. data/vendor/assets/javascripts/ckeditor/plugins/image2/dialogs/image2.js +553 -0
  172. data/vendor/assets/javascripts/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
  173. data/vendor/assets/javascripts/ckeditor/plugins/image2/icons/image.png +0 -0
  174. data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/en.js +21 -0
  175. data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/ru.js +21 -0
  176. data/vendor/assets/javascripts/ckeditor/plugins/image2/plugin.js +1720 -0
  177. data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
  178. data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
  179. data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/image2.html +68 -0
  180. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +1 -1
  181. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +2 -2
  182. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +28 -26
  183. data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +7 -7
  184. data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/plugin.js +2 -2
  185. data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +53 -51
  186. data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +31 -32
  187. data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +2 -2
  188. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +2 -2
  189. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +2 -2
  190. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +2 -2
  191. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +6 -6
  192. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +6 -6
  193. data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +4 -4
  194. data/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +16 -15
  195. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +2 -2
  196. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +2 -2
  197. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +2 -2
  198. data/vendor/assets/javascripts/ckeditor/plugins/widget/images/handle.png +0 -0
  199. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +1 -0
  200. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +2 -1
  201. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +468 -377
  202. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/samples/maxParagraphs.html +26 -0
  203. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +82 -82
  204. data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +449 -448
  205. data/vendor/assets/javascripts/ckeditor/samples/css/samples.css +28 -23
  206. data/vendor/assets/javascripts/ckeditor/samples/img/logo.png +0 -0
  207. data/vendor/assets/javascripts/ckeditor/samples/img/logo.svg +13 -0
  208. data/vendor/assets/javascripts/ckeditor/samples/index.html +16 -16
  209. data/vendor/assets/javascripts/ckeditor/samples/js/sample.js +4 -4
  210. data/vendor/assets/javascripts/ckeditor/samples/js/sf.js +2 -2
  211. data/vendor/assets/javascripts/ckeditor/samples/old/ajax.html +5 -5
  212. data/vendor/assets/javascripts/ckeditor/samples/old/api.html +14 -14
  213. data/vendor/assets/javascripts/ckeditor/samples/old/appendto.html +7 -7
  214. data/vendor/assets/javascripts/ckeditor/samples/old/assets/outputxhtml/outputxhtml.css +2 -2
  215. data/vendor/assets/javascripts/ckeditor/samples/old/assets/posteddata.php +4 -4
  216. data/vendor/assets/javascripts/ckeditor/samples/old/assets/uilanguages/languages.js +2 -2
  217. data/vendor/assets/javascripts/ckeditor/samples/old/datafiltering.html +14 -14
  218. data/vendor/assets/javascripts/ckeditor/samples/old/dialog/assets/my_dialog.js +2 -2
  219. data/vendor/assets/javascripts/ckeditor/samples/old/dialog/dialog.html +8 -8
  220. data/vendor/assets/javascripts/ckeditor/samples/old/divreplace.html +5 -5
  221. data/vendor/assets/javascripts/ckeditor/samples/old/enterkey/enterkey.html +8 -8
  222. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputforflash.html +6 -6
  223. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputhtml.html +7 -7
  224. data/vendor/assets/javascripts/ckeditor/samples/old/index.html +8 -5
  225. data/vendor/assets/javascripts/ckeditor/samples/old/inlineall.html +10 -10
  226. data/vendor/assets/javascripts/ckeditor/samples/old/inlinebycode.html +6 -6
  227. data/vendor/assets/javascripts/ckeditor/samples/old/inlinetextarea.html +6 -6
  228. data/vendor/assets/javascripts/ckeditor/samples/old/jquery.html +6 -6
  229. data/vendor/assets/javascripts/ckeditor/samples/old/magicline/magicline.html +5 -5
  230. data/vendor/assets/javascripts/ckeditor/samples/old/readonly.html +8 -8
  231. data/vendor/assets/javascripts/ckeditor/samples/old/replacebyclass.html +5 -5
  232. data/vendor/assets/javascripts/ckeditor/samples/old/replacebycode.html +5 -5
  233. data/vendor/assets/javascripts/ckeditor/samples/old/sample.css +2 -2
  234. data/vendor/assets/javascripts/ckeditor/samples/old/sample.js +2 -2
  235. data/vendor/assets/javascripts/ckeditor/samples/old/sample_posteddata.php +2 -2
  236. data/vendor/assets/javascripts/ckeditor/samples/old/stylesheetparser/assets/sample.css +70 -0
  237. data/vendor/assets/javascripts/ckeditor/samples/old/stylesheetparser/stylesheetparser.html +85 -0
  238. data/vendor/assets/javascripts/ckeditor/samples/old/tabindex.html +5 -5
  239. data/vendor/assets/javascripts/ckeditor/samples/old/toolbar/toolbar.html +8 -8
  240. data/vendor/assets/javascripts/ckeditor/samples/old/uicolor.html +6 -6
  241. data/vendor/assets/javascripts/ckeditor/samples/old/uilanguages.html +8 -8
  242. data/vendor/assets/javascripts/ckeditor/samples/old/wysiwygarea/fullpage.html +5 -5
  243. data/vendor/assets/javascripts/ckeditor/samples/old/xhtmlstyle.html +6 -6
  244. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/index.html +12 -12
  245. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor.css +123 -1
  246. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +1 -1
  247. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +1 -1
  248. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +1 -1
  249. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +1 -1
  250. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +1 -1
  251. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
  252. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
  253. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog.css +3 -3
  254. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie.css +3 -3
  255. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie8.css +3 -3
  256. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_iequirks.css +3 -3
  257. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor.css +3 -3
  258. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_gecko.css +3 -3
  259. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie.css +3 -3
  260. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie8.css +3 -3
  261. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_iequirks.css +3 -3
  262. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/icons.png +0 -0
  263. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/icons_hidpi.png +0 -0
  264. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/readme.md +3 -3
  265. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/skin.js +2 -2
  266. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +3 -3
  267. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +3 -3
  268. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +3 -3
  269. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +3 -3
  270. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +3 -3
  271. data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +3 -3
  272. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +3 -3
  273. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +3 -3
  274. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +3 -3
  275. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +3 -3
  276. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +3 -3
  277. data/vendor/assets/javascripts/ckeditor/skins/moono/readme.md +4 -4
  278. data/vendor/assets/javascripts/ckeditor/skins/moono/skin.js +2 -2
  279. data/vendor/assets/javascripts/ckeditor/styles.js +4 -4
  280. metadata +179 -56
  281. data/vendor/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +0 -169
  282. data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/en.js +0 -7
  283. data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +0 -7
  284. data/vendor/assets/javascripts/ckeditor/plugins/notification/plugin.js +0 -929
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6690f7032cb8255fe295eff357c58e86dd8aacad
4
- data.tar.gz: 04faca4d589feec640d6bd4e1c4bb982bc5e054c
2
+ SHA256:
3
+ metadata.gz: 0603cf877f654ef3b6b8a03a9ab39000688a79e968340d4a0366dbc0e991062a
4
+ data.tar.gz: cd8fd5bebce7098578a6f0d0c5acbb6bdc34be7d5e0da0261a1abf0dac76dd13
5
5
  SHA512:
6
- metadata.gz: 73aa6c097949b6a5b82c539e993bb6521e28389c6f0fce1de7618c0d9d20ce28a22ee6019328478eb32a52ad02030de516bd785c3c23b1f2aed2585fb0ef0ec9
7
- data.tar.gz: 39ad25188be993dc58815a505e165e7812cbc33bf1a592de49cb0879db9f0f5fb60498380ed9dc91e92a9d33dc154a2ef5586f7e9c9f85b67566a656d83d13e5
6
+ metadata.gz: 2283617d51ccc0e7a93563980223917b2166a65f5e3976caadcf515f9a461b6a9cdc4cd0cfbc3571f316b76a1796216ddc8d44ceda9a396f5c703e48029fc189
7
+ data.tar.gz: cc9fd7bdeb7229799b319e95416d5ad1896a4af07c6359ad7d8b0ccf63f21cedf3ed7b5d0349c999ad1366d5b24e05ece10200cbdb4989ae9f70a0fb9d07a974
data/Rakefile CHANGED
@@ -7,7 +7,6 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  require 'rake'
10
- require 'rdoc/task'
11
10
  require 'bundler/gem_tasks'
12
11
  require 'rake/testtask'
13
12
 
@@ -54,11 +53,3 @@ Rake::TestTask.new("test:functional") do |t|
54
53
  end
55
54
 
56
55
  task :default => :test
57
-
58
- RDoc::Task.new do |rdoc|
59
- rdoc.rdoc_dir = 'rdoc'
60
- rdoc.title = 'Ckeditor'
61
- rdoc.options << '--line-numbers' << '--inline-source'
62
- rdoc.rdoc_files.include('README.rdoc')
63
- rdoc.rdoc_files.include('lib/**/*.rb')
64
- end
@@ -21,13 +21,13 @@ CKEDITOR.editorConfig = function( config ) {
21
21
  config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
22
22
 
23
23
  // The location of a script that handles file uploads in the Image dialog.
24
- config.filebrowserImageUploadUrl = "/ckeditor/pictures";
24
+ config.filebrowserImageUploadUrl = "/ckeditor/pictures?";
25
25
 
26
26
  // The location of a script that handles file uploads.
27
27
  config.filebrowserUploadUrl = "/ckeditor/attachment_files";
28
28
 
29
29
  config.stylesSet = [];
30
- config.extraPlugins = "colorbutton,colordialog,font,magicline,codemirror,stylesheetparser,loremipsum,CKCss,wordcount,youtube,lineheight";
30
+ config.extraPlugins = "colorbutton,colordialog,font,magicline,codemirror,loremipsum,CKCss,wordcount,youtube,lineheight,image2,uploadimage,filebrowser";
31
31
  config.contentsCss = "<%= stylesheet_path('ckcontent.css') %>";
32
32
 
33
33
  config.tabSpaces = 2;
@@ -38,7 +38,7 @@ CKEDITOR.editorConfig = function( config ) {
38
38
  ['Styles','Format','Font','FontSize', 'TextColor', 'BGColor'], ['JustifyLeft','JustifyCenter', 'JustifyRight', 'JustifyBlock'],
39
39
  '/',
40
40
  ['Bold','Italic','Underline'], ['NumberedList','BulletedList','Blockquote'],
41
- ['Link','Unlink'], ['lineheight'], ['Image', 'Flash'],
41
+ ['Link','Unlink'], ['lineheight'], ['Image'],
42
42
  ['Table','HorizontalRule','SpecialChar'], ['Maximize', 'Subscript', 'Superscript'], ['Outdent','Indent', 'ShowBlocks'],
43
43
  ['loremipsum', 'CKCss', 'Youtube']
44
44
  ];
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * http://github.com/valums/file-uploader
3
- *
4
- * Multiple file upload component with progress-bar, drag-and-drop.
5
- * © 2010 Andrew Valums ( andrew(at)valums.com )
6
- *
3
+ *
4
+ * Multiple file upload component with progress-bar, drag-and-drop.
5
+ * © 2010 Andrew Valums ( andrew(at)valums.com )
6
+ *
7
7
  * Licensed under GNU GPL 2 or later, see license.txt.
8
- */
8
+ */
9
9
 
10
10
  //
11
11
  // Helper functions
@@ -15,12 +15,12 @@ var qq = qq || {};
15
15
 
16
16
  /**
17
17
  * Adds all missing properties from second obj to first obj
18
- */
18
+ */
19
19
  qq.extend = function(first, second){
20
20
  for (var prop in second){
21
21
  first[prop] = second[prop];
22
22
  }
23
- };
23
+ };
24
24
 
25
25
  /**
26
26
  * Searches for a given element in the array, returns -1 if it is not present.
@@ -28,20 +28,20 @@ qq.extend = function(first, second){
28
28
  */
29
29
  qq.indexOf = function(arr, elt, from){
30
30
  if (arr.indexOf) return arr.indexOf(elt, from);
31
-
31
+
32
32
  from = from || 0;
33
- var len = arr.length;
34
-
35
- if (from < 0) from += len;
33
+ var len = arr.length;
36
34
 
37
- for (; from < len; from++){
38
- if (from in arr && arr[from] === elt){
35
+ if (from < 0) from += len;
36
+
37
+ for (; from < len; from++){
38
+ if (from in arr && arr[from] === elt){
39
39
  return from;
40
40
  }
41
- }
42
- return -1;
43
- };
44
-
41
+ }
42
+ return -1;
43
+ };
44
+
45
45
  qq.getUniqueId = (function(){
46
46
  var id = 0;
47
47
  return function(){ return id++; };
@@ -86,10 +86,10 @@ qq.remove = function(element){
86
86
  element.parentNode.removeChild(element);
87
87
  };
88
88
 
89
- qq.contains = function(parent, descendant){
89
+ qq.contains = function(parent, descendant){
90
90
  // compareposition returns false in this case
91
91
  if (parent == descendant) return true;
92
-
92
+
93
93
  if (parent.contains){
94
94
  return parent.contains(descendant);
95
95
  } else {
@@ -181,7 +181,7 @@ qq.getByClass = function(element, className){
181
181
  /**
182
182
  * obj2url() takes a json-object as argument and generates
183
183
  * a querystring. pretty much like jQuery.param()
184
- *
184
+ *
185
185
  * how to use:
186
186
  *
187
187
  * `qq.obj2url({a:'b',c:'d'},'http://any.url/upload?otherParam=value');`
@@ -198,21 +198,21 @@ qq.obj2url = function(obj, temp, prefixDone){
198
198
  var uristrings = [],
199
199
  prefix = '&',
200
200
  add = function(nextObj, i){
201
- var nextTemp = temp
201
+ var nextTemp = temp
202
202
  ? (/\[\]$/.test(temp)) // prevent double-encoding
203
203
  ? temp
204
204
  : temp+'['+i+']'
205
205
  : i;
206
- if ((nextTemp != 'undefined') && (i != 'undefined')) {
206
+ if ((nextTemp != 'undefined') && (i != 'undefined')) {
207
207
  uristrings.push(
208
- (typeof nextObj === 'object')
208
+ (typeof nextObj === 'object')
209
209
  ? qq.obj2url(nextObj, nextTemp, true)
210
210
  : (Object.prototype.toString.call(nextObj) === '[object Function]')
211
211
  ? encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj())
212
- : encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj)
212
+ : encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj)
213
213
  );
214
214
  }
215
- };
215
+ };
216
216
 
217
217
  if (!prefixDone && temp) {
218
218
  prefix = (/\?/.test(temp)) ? (/\?$/.test(temp)) ? '' : '&' : '?';
@@ -234,7 +234,7 @@ qq.obj2url = function(obj, temp, prefixDone){
234
234
 
235
235
  return uristrings.join(prefix)
236
236
  .replace(/^&/, '')
237
- .replace(/%20/g, '+');
237
+ .replace(/%20/g, '+');
238
238
  };
239
239
 
240
240
  //
@@ -244,9 +244,9 @@ qq.obj2url = function(obj, temp, prefixDone){
244
244
  //
245
245
 
246
246
  var qq = qq || {};
247
-
247
+
248
248
  /**
249
- * Creates upload button, validates upload, but doesn't create file list or dd.
249
+ * Creates upload button, validates upload, but doesn't create file list or dd.
250
250
  */
251
251
  qq.FileUploaderBasic = function(o){
252
252
  this._options = {
@@ -259,9 +259,9 @@ qq.FileUploaderBasic = function(o){
259
259
  maxConnections: 3,
260
260
  method: 'POST',
261
261
  fieldName: 'qqfile',
262
- // validation
263
- allowedExtensions: [],
264
- sizeLimit: 0,
262
+ // validation
263
+ allowedExtensions: [],
264
+ sizeLimit: 0,
265
265
  minSizeLimit: 0,
266
266
  maxFilesCount: 0, // 0 - no limit, works only in multiple mode
267
267
  minFilesCount: 0, // 0 - no limit, works only in multiple mode
@@ -271,7 +271,7 @@ qq.FileUploaderBasic = function(o){
271
271
  onProgress: function(id, fileName, loaded, total){},
272
272
  onComplete: function(id, fileName, responseJSON){},
273
273
  onCancel: function(id, fileName){},
274
- // messages
274
+ // messages
275
275
  messages: {
276
276
  typeError: "{file} has invalid extension. Only {extensions} are allowed.",
277
277
  sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
@@ -282,62 +282,62 @@ qq.FileUploaderBasic = function(o){
282
282
  minFilesError: "You must select more then {minFilesCount} files."
283
283
  },
284
284
  showMessage: function(message){
285
- alert(message);
286
- }
285
+ alert(message);
286
+ }
287
287
  };
288
288
  qq.extend(this._options, o);
289
-
289
+
290
290
  // number of files being uploaded
291
291
  this._filesInProgress = 0;
292
292
  // number of files was processed
293
293
  this._filesUploaded = 0;
294
- this._handler = this._createUploadHandler();
295
-
296
- if (this._options.button){
294
+ this._handler = this._createUploadHandler();
295
+
296
+ if (this._options.button){
297
297
  this._button = this._createUploadButton(this._options.button);
298
298
  }
299
-
300
- this._preventLeaveInProgress();
299
+
300
+ this._preventLeaveInProgress();
301
301
  };
302
-
302
+
303
303
  qq.FileUploaderBasic.prototype = {
304
304
  setParams: function(params){
305
305
  this._options.params = params;
306
306
  },
307
307
  getInProgress: function(){
308
- return this._filesInProgress;
308
+ return this._filesInProgress;
309
309
  },
310
310
  _createUploadButton: function(element){
311
311
  var self = this;
312
-
312
+
313
313
  return new qq.UploadButton({
314
314
  element: element,
315
315
  multiple: this._options.multiple && qq.UploadHandlerXhr.isSupported(),
316
316
  onChange: function(input){
317
317
  self._onInputChange(input);
318
- }
319
- });
320
- },
318
+ }
319
+ });
320
+ },
321
321
  _createUploadHandler: function(){
322
322
  var self = this,
323
- handlerClass;
324
-
325
- if(qq.UploadHandlerXhr.isSupported()){
326
- handlerClass = 'UploadHandlerXhr';
323
+ handlerClass;
324
+
325
+ if(qq.UploadHandlerXhr.isSupported()){
326
+ handlerClass = 'UploadHandlerXhr';
327
327
  } else {
328
328
  handlerClass = 'UploadHandlerForm';
329
329
  }
330
330
 
331
331
  var handler = new qq[handlerClass]({
332
332
  debug: this._options.debug,
333
- action: this._options.action,
333
+ action: this._options.action,
334
334
  maxConnections: this._options.maxConnections,
335
335
  fieldName: this._options.fieldName,
336
- method: this._options.method,
337
- onProgress: function(id, fileName, loaded, total){
336
+ method: this._options.method,
337
+ onProgress: function(id, fileName, loaded, total){
338
338
  self._onProgress(id, fileName, loaded, total);
339
- self._options.onProgress(id, fileName, loaded, total);
340
- },
339
+ self._options.onProgress(id, fileName, loaded, total);
340
+ },
341
341
  onComplete: function(id, fileName, result){
342
342
  self._onComplete(id, fileName, result);
343
343
  self._options.onComplete(id, fileName, result);
@@ -349,92 +349,94 @@ qq.FileUploaderBasic.prototype = {
349
349
  });
350
350
 
351
351
  return handler;
352
- },
352
+ },
353
353
  _preventLeaveInProgress: function(){
354
354
  var self = this;
355
-
355
+
356
356
  qq.attach(window, 'beforeunload', function(e){
357
357
  if (!self._filesInProgress){return;}
358
-
358
+
359
359
  var e = e || window.event;
360
360
  // for ie, ff
361
361
  e.returnValue = self._options.messages.onLeave;
362
362
  // for webkit
363
- return self._options.messages.onLeave;
364
- });
365
- },
363
+ return self._options.messages.onLeave;
364
+ });
365
+ },
366
366
  _onSubmit: function(id, fileName){
367
- this._filesInProgress++;
367
+ this._filesInProgress++;
368
368
  },
369
- _onProgress: function(id, fileName, loaded, total){
369
+ _onProgress: function(id, fileName, loaded, total){
370
370
  },
371
371
  _onComplete: function(id, fileName, result){
372
- this._filesInProgress--;
372
+ this._filesInProgress--;
373
373
  if (result.error){
374
374
  this._options.showMessage(result.error);
375
375
  } else {
376
376
  this._filesUploaded++;
377
- }
377
+ }
378
378
  },
379
379
  _onCancel: function(id, fileName){
380
- this._filesInProgress--;
380
+ this._filesInProgress--;
381
381
  },
382
382
  _onInputChange: function(input){
383
- if (this._handler instanceof qq.UploadHandlerXhr){
384
- this._uploadFileList(input.files);
385
- } else {
386
- if (this._validateFile(input)){
387
- this._uploadFile(input);
388
- }
389
- }
390
- this._button.reset();
391
- },
383
+ if (this._handler instanceof qq.UploadHandlerXhr){
384
+ this._uploadFileList(input.files);
385
+ } else {
386
+ if (this._validateFile(input)){
387
+ this._uploadFile(input);
388
+ }
389
+ }
390
+ this._button.reset();
391
+ },
392
392
  _uploadFileList: function(files){
393
393
  if ( this._validateFiles(files) ) {
394
394
  for (var i=0; i<files.length; i++){
395
- this._uploadFile(files[i]);
395
+ this._uploadFile(files[i]);
396
396
  }
397
397
  }
398
- },
399
- _uploadFile: function(fileContainer){
398
+ },
399
+ _uploadFile: function(fileContainer){
400
400
  var id = this._handler.add(fileContainer);
401
401
  var fileName = this._handler.getName(id);
402
-
402
+
403
403
  if (this._options.onSubmit(id, fileName) !== false){
404
- this._onSubmit(id, fileName);
405
- this._handler.upload(id, this._options.params);
404
+ this._onSubmit(id, fileName);
405
+ console.log(this._handler)
406
+ console.log(id, this._options.params)
407
+ this._handler.upload(id, this._options.params);
406
408
  }
407
409
  },
408
410
  _validateFiles: function(files){
409
411
  var uploadedCount = this._filesUploaded + files.length;
410
-
412
+
411
413
  if (this._options.maxFilesCount > 0) {
412
- if ( uploadedCount > this._options.maxFilesCount) {
414
+ if ( uploadedCount > this._options.maxFilesCount) {
413
415
  this._error('maxFilesError', 'name');
414
416
  return false;
415
417
  }
416
418
  }
417
-
419
+
418
420
  if (this._options.minFilesCount > 0) {
419
421
  if ( uploadedCount < this._options.minFilesCount) {
420
422
  this._error('minFilesError', 'name');
421
423
  return false;
422
424
  }
423
425
  }
424
-
426
+
425
427
  for (var i=0; i<files.length; i++){
426
428
  if ( !this._validateFile(files[i])){
427
429
  return false;
428
- }
430
+ }
429
431
  }
430
-
432
+
431
433
  return true;
432
- },
434
+ },
433
435
  _validateFile: function(file){
434
436
  var name, size;
435
-
437
+
436
438
  if (file.value){
437
- // it is a file input
439
+ // it is a file input
438
440
  // get input value and remove path to normalize
439
441
  name = file.value.replace(/.*(\/|\\)/, "");
440
442
  } else {
@@ -442,69 +444,69 @@ qq.FileUploaderBasic.prototype = {
442
444
  name = file.fileName != null ? file.fileName : file.name;
443
445
  size = file.fileSize != null ? file.fileSize : file.size;
444
446
  }
445
-
446
- if (! this._isAllowedExtension(name)){
447
+
448
+ if (! this._isAllowedExtension(name)){
447
449
  this._error('typeError', name);
448
450
  return false;
449
-
450
- } else if (size === 0){
451
+
452
+ } else if (size === 0){
451
453
  this._error('emptyError', name);
452
454
  return false;
453
-
454
- } else if (size && this._options.sizeLimit && size > this._options.sizeLimit){
455
+
456
+ } else if (size && this._options.sizeLimit && size > this._options.sizeLimit){
455
457
  this._error('sizeError', name);
456
458
  return false;
457
-
459
+
458
460
  } else if (size && size < this._options.minSizeLimit){
459
461
  this._error('minSizeError', name);
460
- return false;
462
+ return false;
461
463
  }
462
-
463
- return true;
464
+
465
+ return true;
464
466
  },
465
467
  _error: function(code, fileName){
466
- var message = this._options.messages[code];
468
+ var message = this._options.messages[code];
467
469
  function r(name, replacement){ message = message.replace(name, replacement); }
468
-
469
- r('{file}', this._formatFileName(fileName));
470
+
471
+ r('{file}', this._formatFileName(fileName));
470
472
  r('{extensions}', this._options.allowedExtensions.join(', '));
471
473
  r('{sizeLimit}', this._formatSize(this._options.sizeLimit));
472
474
  r('{minSizeLimit}', this._formatSize(this._options.minSizeLimit));
473
475
  r('{maxFilesCount}', this._options.maxFilesCount);
474
476
  r('{minFilesCount}', this._options.minFilesCount);
475
-
476
- this._options.showMessage(message);
477
+
478
+ this._options.showMessage(message);
477
479
  },
478
480
  _formatFileName: function(name){
479
481
  if (name.length > 33){
480
- name = name.slice(0, 19) + '...' + name.slice(-13);
482
+ name = name.slice(0, 19) + '...' + name.slice(-13);
481
483
  }
482
484
  return name;
483
485
  },
484
486
  _isAllowedExtension: function(fileName){
485
487
  var ext = (-1 !== fileName.indexOf('.')) ? fileName.replace(/.*[.]/, '').toLowerCase() : '';
486
488
  var allowed = this._options.allowedExtensions;
487
-
488
- if (!allowed.length){return true;}
489
-
489
+
490
+ if (!allowed.length){return true;}
491
+
490
492
  for (var i=0; i<allowed.length; i++){
491
- if (allowed[i].toLowerCase() == ext){ return true;}
493
+ if (allowed[i].toLowerCase() == ext){ return true;}
492
494
  }
493
-
495
+
494
496
  return false;
495
- },
497
+ },
496
498
  _formatSize: function(bytes){
497
- var i = -1;
499
+ var i = -1;
498
500
  do {
499
501
  bytes = bytes / 1024;
500
- i++;
502
+ i++;
501
503
  } while (bytes > 99);
502
-
503
- return Math.max(bytes, 0.1).toFixed(1) + ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'][i];
504
+
505
+ return Math.max(bytes, 0.1).toFixed(1) + ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'][i];
504
506
  }
505
507
  };
506
-
507
-
508
+
509
+
508
510
  /**
509
511
  * Class that creates upload widget with drag-and-drop and file list
510
512
  * @inherits qq.FileUploaderBasic
@@ -512,17 +514,17 @@ qq.FileUploaderBasic.prototype = {
512
514
  qq.FileUploader = function(o){
513
515
  // call parent constructor
514
516
  qq.FileUploaderBasic.apply(this, arguments);
515
-
516
- // additional options
517
+
518
+ // additional options
517
519
  qq.extend(this._options, {
518
520
  element: null,
519
521
  // if set, will be used instead of qq-upload-list in template
520
522
  listElement: null,
521
-
522
- template: '<div class="qq-uploader">' +
523
+
524
+ template: '<div class="qq-uploader">' +
523
525
  '<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
524
526
  '<div class="qq-upload-button">Upload a file</div>' +
525
- '<ul class="qq-upload-list"></ul>' +
527
+ '<ul class="qq-upload-list"></ul>' +
526
528
  '</div>',
527
529
 
528
530
  // template for one item in file list
@@ -532,15 +534,15 @@ qq.FileUploader = function(o){
532
534
  '<span class="qq-upload-size"></span>' +
533
535
  '<a class="qq-upload-cancel" href="#">Cancel</a>' +
534
536
  '<span class="qq-upload-failed-text">Failed</span>' +
535
- '</li>',
536
-
537
+ '</li>',
538
+
537
539
  classes: {
538
540
  // used to get elements from templates
539
541
  button: 'qq-upload-button',
540
542
  drop: 'qq-upload-drop-area',
541
543
  dropActive: 'qq-upload-drop-area-active',
542
544
  list: 'qq-upload-list',
543
-
545
+
544
546
  file: 'qq-upload-file',
545
547
  spinner: 'qq-upload-spinner',
546
548
  size: 'qq-upload-size',
@@ -552,17 +554,17 @@ qq.FileUploader = function(o){
552
554
  fail: 'qq-upload-fail'
553
555
  }
554
556
  });
555
- // overwrite options with user supplied
556
- qq.extend(this._options, o);
557
+ // overwrite options with user supplied
558
+ qq.extend(this._options, o);
557
559
 
558
560
  this._element = this._options.element;
559
- this._element.innerHTML = this._options.template;
561
+ this._element.innerHTML = this._options.template;
560
562
  this._listElement = this._options.listElement || this._find(this._element, 'list');
561
-
563
+
562
564
  this._classes = this._options.classes;
563
-
564
- this._button = this._createUploadButton(this._find(this._element, 'button'));
565
-
565
+
566
+ this._button = this._createUploadButton(this._find(this._element, 'button'));
567
+
566
568
  this._bindCancelEvent();
567
569
  this._setupDragDrop();
568
570
  };
@@ -574,17 +576,17 @@ qq.extend(qq.FileUploader.prototype, {
574
576
  /**
575
577
  * Gets one of the elements listed in this._options.classes
576
578
  **/
577
- _find: function(parent, type){
578
- var element = qq.getByClass(parent, this._options.classes[type])[0];
579
+ _find: function(parent, type){
580
+ var element = qq.getByClass(parent, this._options.classes[type])[0];
579
581
  if (!element){
580
582
  throw new Error('element not found ' + type);
581
583
  }
582
-
584
+
583
585
  return element;
584
586
  },
585
587
  _setupDragDrop: function(){
586
588
  var self = this,
587
- dropArea = this._find(this._element, 'drop');
589
+ dropArea = this._find(this._element, 'drop');
588
590
 
589
591
  var dz = new qq.UploadDropZone({
590
592
  element: dropArea,
@@ -596,35 +598,35 @@ qq.extend(qq.FileUploader.prototype, {
596
598
  e.stopPropagation();
597
599
  },
598
600
  onLeaveNotDescendants: function(e){
599
- qq.removeClass(dropArea, self._classes.dropActive);
601
+ qq.removeClass(dropArea, self._classes.dropActive);
600
602
  },
601
603
  onDrop: function(e){
602
604
  dropArea.style.display = 'none';
603
605
  qq.removeClass(dropArea, self._classes.dropActive);
604
- self._uploadFileList(e.dataTransfer.files);
606
+ self._uploadFileList(e.dataTransfer.files);
605
607
  }
606
608
  });
607
-
609
+
608
610
  dropArea.style.display = 'none';
609
611
 
610
- qq.attach(document, 'dragenter', function(e){
611
- if (!dz._isValidFileDrag(e)) return;
612
-
613
- dropArea.style.display = 'block';
614
- });
612
+ qq.attach(document, 'dragenter', function(e){
613
+ if (!dz._isValidFileDrag(e)) return;
614
+
615
+ dropArea.style.display = 'block';
616
+ });
615
617
  qq.attach(document, 'dragleave', function(e){
616
- if (!dz._isValidFileDrag(e)) return;
617
-
618
+ if (!dz._isValidFileDrag(e)) return;
619
+
618
620
  var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
619
621
  // only fire when leaving document out
620
- if ( ! relatedTarget || relatedTarget.nodeName == "HTML"){
621
- dropArea.style.display = 'none';
622
+ if ( ! relatedTarget || relatedTarget.nodeName == "HTML"){
623
+ dropArea.style.display = 'none';
622
624
  }
623
- });
625
+ });
624
626
  },
625
627
  _onSubmit: function(id, fileName){
626
628
  qq.FileUploaderBasic.prototype._onSubmit.apply(this, arguments);
627
- this._addToList(id, fileName);
629
+ this._addToList(id, fileName);
628
630
  },
629
631
  _onProgress: function(id, fileName, loaded, total){
630
632
  qq.FileUploaderBasic.prototype._onProgress.apply(this, arguments);
@@ -632,87 +634,87 @@ qq.extend(qq.FileUploader.prototype, {
632
634
  var item = this._getItemByFileId(id);
633
635
  var size = this._find(item, 'size');
634
636
  size.style.display = 'inline';
635
-
636
- var text;
637
+
638
+ var text;
637
639
  if (loaded != total){
638
640
  text = Math.round(loaded / total * 100) + '% from ' + this._formatSize(total);
639
- } else {
641
+ } else {
640
642
  text = this._formatSize(total);
641
- }
642
-
643
- qq.setText(size, text);
643
+ }
644
+
645
+ qq.setText(size, text);
644
646
  },
645
647
  _onComplete: function(id, fileName, result){
646
648
  qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);
647
649
 
648
650
  // mark completed
649
- var item = this._getItemByFileId(id);
651
+ var item = this._getItemByFileId(id);
650
652
  qq.remove(this._find(item, 'cancel'));
651
653
  qq.remove(this._find(item, 'spinner'));
652
-
654
+
653
655
  if (result.success){
654
- qq.addClass(item, this._classes.success);
656
+ qq.addClass(item, this._classes.success);
655
657
  } else {
656
658
  qq.addClass(item, this._classes.fail);
657
- }
659
+ }
658
660
  },
659
661
  _addToList: function(id, fileName){
660
- var item = qq.toElement(this._options.fileTemplate);
662
+ var item = qq.toElement(this._options.fileTemplate);
661
663
  item.qqFileId = id;
662
664
 
663
- var fileElement = this._find(item, 'file');
665
+ var fileElement = this._find(item, 'file');
664
666
  qq.setText(fileElement, this._formatFileName(fileName));
665
- this._find(item, 'size').style.display = 'none';
667
+ this._find(item, 'size').style.display = 'none';
666
668
 
667
669
  this._listElement.appendChild(item);
668
670
  },
669
671
  _getItemByFileId: function(id){
670
- var item = this._listElement.firstChild;
671
-
672
+ var item = this._listElement.firstChild;
673
+
672
674
  // there can't be txt nodes in dynamically created list
673
675
  // and we can use nextSibling
674
- while (item){
675
- if (item.qqFileId == id) return item;
676
+ while (item){
677
+ if (item.qqFileId == id) return item;
676
678
  item = item.nextSibling;
677
- }
679
+ }
678
680
  },
679
681
  /**
680
- * delegate click event for cancel link
682
+ * delegate click event for cancel link
681
683
  **/
682
684
  _bindCancelEvent: function(){
683
685
  var self = this,
684
- list = this._listElement;
685
-
686
- qq.attach(list, 'click', function(e){
686
+ list = this._listElement;
687
+
688
+ qq.attach(list, 'click', function(e){
687
689
  e = e || window.event;
688
690
  var target = e.target || e.srcElement;
689
-
690
- if (qq.hasClass(target, self._classes.cancel)){
691
+
692
+ if (qq.hasClass(target, self._classes.cancel)){
691
693
  qq.preventDefault(e);
692
-
694
+
693
695
  var item = target.parentNode;
694
696
  self._handler.cancel(item.qqFileId);
695
697
  qq.remove(item);
696
698
  }
697
699
  });
698
- }
700
+ }
699
701
  });
700
-
702
+
701
703
  qq.UploadDropZone = function(o){
702
704
  this._options = {
703
- element: null,
705
+ element: null,
704
706
  onEnter: function(e){},
705
- onLeave: function(e){},
706
- // is not fired when leaving element by hovering descendants
707
- onLeaveNotDescendants: function(e){},
708
- onDrop: function(e){}
707
+ onLeave: function(e){},
708
+ // is not fired when leaving element by hovering descendants
709
+ onLeaveNotDescendants: function(e){},
710
+ onDrop: function(e){}
709
711
  };
710
- qq.extend(this._options, o);
711
-
712
+ qq.extend(this._options, o);
713
+
712
714
  this._element = this._options.element;
713
-
715
+
714
716
  this._disableDropOutside();
715
- this._attachEvents();
717
+ this._attachEvents();
716
718
  };
717
719
 
718
720
  qq.UploadDropZone.prototype = {
@@ -723,84 +725,84 @@ qq.UploadDropZone.prototype = {
723
725
  qq.attach(document, 'dragover', function(e){
724
726
  if (e.dataTransfer){
725
727
  e.dataTransfer.dropEffect = 'none';
726
- e.preventDefault();
727
- }
728
+ e.preventDefault();
729
+ }
728
730
  });
729
-
730
- qq.UploadDropZone.dropOutsideDisabled = true;
731
- }
731
+
732
+ qq.UploadDropZone.dropOutsideDisabled = true;
733
+ }
732
734
  },
733
735
  _attachEvents: function(){
734
- var self = this;
735
-
736
+ var self = this;
737
+
736
738
  qq.attach(self._element, 'dragover', function(e){
737
739
  if (!self._isValidFileDrag(e)) return;
738
-
740
+
739
741
  var effect = e.dataTransfer.effectAllowed;
740
742
  if (effect == 'move' || effect == 'linkMove'){
741
- e.dataTransfer.dropEffect = 'move'; // for FF (only move allowed)
742
- } else {
743
+ e.dataTransfer.dropEffect = 'move'; // for FF (only move allowed)
744
+ } else {
743
745
  e.dataTransfer.dropEffect = 'copy'; // for Chrome
744
746
  }
745
-
747
+
746
748
  e.stopPropagation();
747
- e.preventDefault();
749
+ e.preventDefault();
748
750
  });
749
-
751
+
750
752
  qq.attach(self._element, 'dragenter', function(e){
751
753
  if (!self._isValidFileDrag(e)) return;
752
-
754
+
753
755
  self._options.onEnter(e);
754
756
  });
755
-
757
+
756
758
  qq.attach(self._element, 'dragleave', function(e){
757
759
  if (!self._isValidFileDrag(e)) return;
758
-
760
+
759
761
  self._options.onLeave(e);
760
-
761
- var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
762
+
763
+ var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
762
764
  // do not fire when moving a mouse over a descendant
763
765
  if (qq.contains(this, relatedTarget)) return;
764
-
765
- self._options.onLeaveNotDescendants(e);
766
+
767
+ self._options.onLeaveNotDescendants(e);
766
768
  });
767
-
769
+
768
770
  qq.attach(self._element, 'drop', function(e){
769
771
  if (!self._isValidFileDrag(e)) return;
770
-
772
+
771
773
  e.preventDefault();
772
774
  self._options.onDrop(e);
773
- });
775
+ });
774
776
  },
775
777
  _isValidFileDrag: function(e){
776
778
  var dt = e.dataTransfer,
777
- // do not check dt.types.contains in webkit, because it crashes safari 4
778
- isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1;
779
+ // do not check dt.types.contains in webkit, because it crashes safari 4
780
+ isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1;
779
781
 
780
782
  // dt.effectAllowed is none in Safari 5
781
- // dt.types.contains check is for firefox
782
- return dt && dt.effectAllowed != 'none' &&
783
+ // dt.types.contains check is for firefox
784
+ return dt && dt.effectAllowed != 'none' &&
783
785
  (dt.files || (!isWebkit && dt.types.contains && dt.types.contains('Files')));
784
-
785
- }
786
- };
786
+
787
+ }
788
+ };
787
789
 
788
790
  qq.UploadButton = function(o){
789
791
  this._options = {
790
- element: null,
791
- // if set to true adds multiple attribute to file input
792
+ element: null,
793
+ // if set to true adds multiple attribute to file input
792
794
  multiple: false,
793
795
  // name attribute of file input
794
796
  name: 'file',
795
797
  onChange: function(input){},
796
798
  hoverClass: 'qq-upload-button-hover',
797
- focusClass: 'qq-upload-button-focus'
799
+ focusClass: 'qq-upload-button-focus'
798
800
  };
799
-
801
+
800
802
  qq.extend(this._options, o);
801
-
803
+
802
804
  this._element = this._options.element;
803
-
805
+
804
806
  // make button suitable container for input
805
807
  qq.css(this._element, {
806
808
  position: 'relative',
@@ -808,35 +810,35 @@ qq.UploadButton = function(o){
808
810
  // Make sure browse button is in the right side
809
811
  // in Internet Explorer
810
812
  direction: 'ltr'
811
- });
812
-
813
+ });
814
+
813
815
  this._input = this._createInput();
814
816
  };
815
817
 
816
818
  qq.UploadButton.prototype = {
817
- /* returns file input element */
819
+ /* returns file input element */
818
820
  getInput: function(){
819
821
  return this._input;
820
822
  },
821
823
  /* cleans/recreates the file input */
822
824
  reset: function(){
823
825
  if (this._input.parentNode){
824
- qq.remove(this._input);
825
- }
826
-
826
+ qq.remove(this._input);
827
+ }
828
+
827
829
  qq.removeClass(this._element, this._options.focusClass);
828
830
  this._input = this._createInput();
829
- },
830
- _createInput: function(){
831
+ },
832
+ _createInput: function(){
831
833
  var input = document.createElement("input");
832
-
834
+
833
835
  if (this._options.multiple){
834
836
  input.setAttribute("multiple", "multiple");
835
837
  }
836
-
838
+
837
839
  input.setAttribute("type", "file");
838
840
  input.setAttribute("name", this._options.name);
839
-
841
+
840
842
  qq.css(input, {
841
843
  position: 'absolute',
842
844
  // in Opera only 'browse' button
@@ -852,14 +854,14 @@ qq.UploadButton.prototype = {
852
854
  cursor: 'pointer',
853
855
  opacity: 0
854
856
  });
855
-
857
+
856
858
  this._element.appendChild(input);
857
859
 
858
860
  var self = this;
859
861
  qq.attach(input, 'change', function(){
860
862
  self._options.onChange(input);
861
863
  });
862
-
864
+
863
865
  qq.attach(input, 'mouseover', function(){
864
866
  qq.addClass(self._element, self._options.hoverClass);
865
867
  });
@@ -880,8 +882,8 @@ qq.UploadButton.prototype = {
880
882
  input.setAttribute('tabIndex', "-1");
881
883
  }
882
884
 
883
- return input;
884
- }
885
+ return input;
886
+ }
885
887
  };
886
888
 
887
889
  /**
@@ -893,26 +895,26 @@ qq.UploadHandlerAbstract = function(o){
893
895
  action: '/upload.php',
894
896
  method: 'POST',
895
897
  fieldName: 'qqfile',
896
- // maximum number of concurrent uploads
898
+ // maximum number of concurrent uploads
897
899
  maxConnections: 999,
898
900
  onProgress: function(id, fileName, loaded, total){},
899
901
  onComplete: function(id, fileName, response){},
900
902
  onCancel: function(id, fileName){}
901
903
  };
902
- qq.extend(this._options, o);
903
-
904
+ qq.extend(this._options, o);
905
+
904
906
  this._queue = [];
905
907
  // params for files in queue
906
908
  this._params = [];
907
909
  };
908
910
  qq.UploadHandlerAbstract.prototype = {
909
911
  log: function(str){
910
- if (this._options.debug && window.console) console.log('[uploader] ' + str);
912
+ if (this._options.debug && window.console) console.log('[uploader] ' + str);
911
913
  },
912
914
  /**
913
915
  * Adds file or file input to the queue
914
916
  * @returns id
915
- **/
917
+ **/
916
918
  add: function(file){},
917
919
  /**
918
920
  * Sends the file identified by id and additional query params to the server
@@ -920,12 +922,12 @@ qq.UploadHandlerAbstract.prototype = {
920
922
  upload: function(id, params){
921
923
  var len = this._queue.push(id);
922
924
 
923
- var copy = {};
925
+ var copy = {};
924
926
  qq.extend(copy, params);
925
- this._params[id] = copy;
926
-
927
+ this._params[id] = copy;
928
+
927
929
  // if too many active uploads, wait...
928
- if (len <= this._options.maxConnections){
930
+ if (len <= this._options.maxConnections){
929
931
  this._upload(id, this._params[id]);
930
932
  }
931
933
  },
@@ -951,7 +953,7 @@ qq.UploadHandlerAbstract.prototype = {
951
953
  getName: function(id){},
952
954
  /**
953
955
  * Returns size of the file identified by id
954
- */
956
+ */
955
957
  getSize: function(id){},
956
958
  /**
957
959
  * Returns id of files being uploaded or
@@ -967,21 +969,21 @@ qq.UploadHandlerAbstract.prototype = {
967
969
  /**
968
970
  * Actual cancel method
969
971
  */
970
- _cancel: function(id){},
972
+ _cancel: function(id){},
971
973
  /**
972
974
  * Removes element from queue, starts upload of next
973
975
  */
974
976
  _dequeue: function(id){
975
977
  var i = qq.indexOf(this._queue, id);
976
978
  this._queue.splice(i, 1);
977
-
979
+
978
980
  var max = this._options.maxConnections;
979
-
981
+
980
982
  if (this._queue.length >= max && i < max){
981
983
  var nextId = this._queue[max-1];
982
984
  this._upload(nextId, this._params[nextId]);
983
985
  }
984
- }
986
+ }
985
987
  };
986
988
 
987
989
  /**
@@ -990,7 +992,7 @@ qq.UploadHandlerAbstract.prototype = {
990
992
  */
991
993
  qq.UploadHandlerForm = function(o){
992
994
  qq.UploadHandlerAbstract.apply(this, arguments);
993
-
995
+
994
996
  this._inputs = {};
995
997
  };
996
998
  // @inherits qq.UploadHandlerAbstract
@@ -999,25 +1001,25 @@ qq.extend(qq.UploadHandlerForm.prototype, qq.UploadHandlerAbstract.prototype);
999
1001
  qq.extend(qq.UploadHandlerForm.prototype, {
1000
1002
  add: function(fileInput){
1001
1003
  fileInput.setAttribute('name', this._options.fieldName);
1002
- var id = 'qq-upload-handler-iframe' + qq.getUniqueId();
1003
-
1004
+ var id = 'qq-upload-handler-iframe' + qq.getUniqueId();
1005
+
1004
1006
  this._inputs[id] = fileInput;
1005
-
1007
+
1006
1008
  // remove file input from DOM
1007
1009
  if (fileInput.parentNode){
1008
1010
  qq.remove(fileInput);
1009
1011
  }
1010
-
1012
+
1011
1013
  return id;
1012
1014
  },
1013
1015
  getName: function(id){
1014
1016
  // get input value and remove path to normalize
1015
1017
  return this._inputs[id].value.replace(/.*(\/|\\)/, "");
1016
- },
1018
+ },
1017
1019
  _cancel: function(id){
1018
1020
  this._options.onCancel(id, this.getName(id));
1019
-
1020
- delete this._inputs[id];
1021
+
1022
+ delete this._inputs[id];
1021
1023
 
1022
1024
  var iframe = document.getElementById(id);
1023
1025
  if (iframe){
@@ -1028,29 +1030,29 @@ qq.extend(qq.UploadHandlerForm.prototype, {
1028
1030
 
1029
1031
  qq.remove(iframe);
1030
1032
  }
1031
- },
1032
- _upload: function(id, params){
1033
+ },
1034
+ _upload: function(id, params){
1033
1035
  var input = this._inputs[id];
1034
-
1036
+
1035
1037
  if (!input){
1036
1038
  throw new Error('file with passed id was not added, or already uploaded or cancelled');
1037
- }
1039
+ }
1038
1040
 
1039
1041
  var fileName = this.getName(id);
1040
-
1042
+
1041
1043
  var iframe = this._createIframe(id);
1042
1044
  var form = this._createForm(iframe, params);
1043
1045
  form.appendChild(input);
1044
1046
 
1045
1047
  var self = this;
1046
- this._attachLoadEvent(iframe, function(){
1048
+ this._attachLoadEvent(iframe, function(){
1047
1049
  self.log('iframe loaded');
1048
-
1050
+
1049
1051
  var response = self._getIframeContentJSON(iframe);
1050
1052
 
1051
1053
  self._options.onComplete(id, fileName, response);
1052
1054
  self._dequeue(id);
1053
-
1055
+
1054
1056
  delete self._inputs[id];
1055
1057
  // timeout added to fix busy state in FF3.6
1056
1058
  setTimeout(function(){
@@ -1058,11 +1060,11 @@ qq.extend(qq.UploadHandlerForm.prototype, {
1058
1060
  }, 1);
1059
1061
  });
1060
1062
 
1061
- form.submit();
1062
- qq.remove(form);
1063
-
1063
+ form.submit();
1064
+ qq.remove(form);
1065
+
1064
1066
  return id;
1065
- },
1067
+ },
1066
1068
  _attachLoadEvent: function(iframe, callback){
1067
1069
  qq.attach(iframe, 'load', function(){
1068
1070
  // when we remove iframe from dom
@@ -1093,15 +1095,15 @@ qq.extend(qq.UploadHandlerForm.prototype, {
1093
1095
  // iframe.contentWindow.document - for IE<7
1094
1096
  var doc = iframe.contentDocument ? iframe.contentDocument: iframe.contentWindow.document,
1095
1097
  response;
1096
-
1098
+
1097
1099
  this.log("converting iframe's innerHTML to JSON");
1098
1100
  this.log("innerHTML = " + doc.body.innerHTML);
1099
-
1101
+
1100
1102
  try {
1101
1103
  response = eval("(" + doc.body.innerHTML + ")");
1102
1104
  } catch(err){
1103
1105
  response = {};
1104
- }
1106
+ }
1105
1107
 
1106
1108
  return response;
1107
1109
  },
@@ -1137,7 +1139,7 @@ qq.extend(qq.UploadHandlerForm.prototype, {
1137
1139
  var form = qq.toElement('<form enctype="multipart/form-data"></form>');
1138
1140
 
1139
1141
  var queryString = qq.obj2url(params, this._options.action);
1140
-
1142
+
1141
1143
  form.setAttribute('method', this._options.method);
1142
1144
  form.setAttribute('action', queryString);
1143
1145
  form.setAttribute('target', iframe.name);
@@ -1147,10 +1149,10 @@ qq.extend(qq.UploadHandlerForm.prototype, {
1147
1149
  var token = $('meta[name="csrf-token"]').attr('content');
1148
1150
  var param = $('meta[name="csrf-param"]').attr('content');
1149
1151
  var input = qq.toElement('<input type="hidden" />');
1150
-
1152
+
1151
1153
  input.setAttribute('name', param);
1152
1154
  input.setAttribute('value', token);
1153
-
1155
+
1154
1156
  form.appendChild(input);
1155
1157
  document.body.appendChild(form);
1156
1158
 
@@ -1167,20 +1169,20 @@ qq.UploadHandlerXhr = function(o){
1167
1169
 
1168
1170
  this._files = [];
1169
1171
  this._xhrs = [];
1170
-
1171
- // current loaded size in bytes for each file
1172
+
1173
+ // current loaded size in bytes for each file
1172
1174
  this._loaded = [];
1173
1175
  };
1174
1176
 
1175
1177
  // static method
1176
1178
  qq.UploadHandlerXhr.isSupported = function(){
1177
1179
  var input = document.createElement('input');
1178
- input.type = 'file';
1179
-
1180
+ input.type = 'file';
1181
+
1180
1182
  return (
1181
1183
  'multiple' in input &&
1182
1184
  typeof File != "undefined" &&
1183
- typeof (new XMLHttpRequest()).upload != "undefined" );
1185
+ typeof (new XMLHttpRequest()).upload != "undefined" );
1184
1186
  };
1185
1187
 
1186
1188
  // @inherits qq.UploadHandlerAbstract
@@ -1190,43 +1192,43 @@ qq.extend(qq.UploadHandlerXhr.prototype, {
1190
1192
  /**
1191
1193
  * Adds file to the queue
1192
1194
  * Returns id to use with upload, cancel
1193
- **/
1195
+ **/
1194
1196
  add: function(file){
1195
1197
  if (!(file instanceof File)){
1196
1198
  throw new Error('Passed obj in not a File (in qq.UploadHandlerXhr)');
1197
1199
  }
1198
-
1199
- return this._files.push(file) - 1;
1200
+
1201
+ return this._files.push(file) - 1;
1200
1202
  },
1201
- getName: function(id){
1203
+ getName: function(id){
1202
1204
  var file = this._files[id];
1203
1205
  // fix missing name in Safari 4
1204
- return file.fileName != null ? file.fileName : file.name;
1206
+ return file.fileName != null ? file.fileName : file.name;
1205
1207
  },
1206
1208
  getSize: function(id){
1207
1209
  var file = this._files[id];
1208
1210
  return file.fileSize != null ? file.fileSize : file.size;
1209
- },
1211
+ },
1210
1212
  /**
1211
- * Returns uploaded bytes for file identified by id
1212
- */
1213
+ * Returns uploaded bytes for file identified by id
1214
+ */
1213
1215
  getLoaded: function(id){
1214
- return this._loaded[id] || 0;
1216
+ return this._loaded[id] || 0;
1215
1217
  },
1216
1218
  /**
1217
1219
  * Sends the file identified by id and additional query params to the server
1218
1220
  * @param {Object} params name-value string pairs
1219
- */
1221
+ */
1220
1222
  _upload: function(id, params){
1221
1223
  var file = this._files[id],
1222
1224
  name = this.getName(id),
1223
1225
  size = this.getSize(id);
1224
-
1226
+
1225
1227
  this._loaded[id] = 0;
1226
-
1228
+
1227
1229
  var xhr = this._xhrs[id] = new XMLHttpRequest();
1228
1230
  var self = this;
1229
-
1231
+
1230
1232
  xhr.upload.onprogress = function(e){
1231
1233
  if (e.lengthComputable){
1232
1234
  self._loaded[id] = e.loaded;
@@ -1234,15 +1236,16 @@ qq.extend(qq.UploadHandlerXhr.prototype, {
1234
1236
  }
1235
1237
  };
1236
1238
 
1237
- xhr.onreadystatechange = function(){
1239
+ xhr.onreadystatechange = function(){
1238
1240
  if (xhr.readyState == 4){
1239
- self._onComplete(id, xhr);
1241
+ self._onComplete(id, xhr);
1240
1242
  }
1241
1243
  };
1242
1244
 
1243
1245
  // build query string
1244
1246
  params = params || {};
1245
1247
  params[this._options.fieldName] = name;
1248
+ console.log("params")
1246
1249
  var queryString = qq.obj2url(params, this._options.action);
1247
1250
 
1248
1251
  xhr.open(this._options.method, queryString, true);
@@ -1253,49 +1256,50 @@ qq.extend(qq.UploadHandlerXhr.prototype, {
1253
1256
  xhr.setRequestHeader("Content-Type", "application/octet-stream");
1254
1257
 
1255
1258
  // Rails CSRFProtection
1256
- if ($.rails) $.rails.CSRFProtection(xhr);
1259
+ if ($.rails) $.rails.CSRFProtection(xhr);
1257
1260
 
1258
1261
  xhr.send(file);
1259
1262
  },
1260
1263
  _onComplete: function(id, xhr){
1261
1264
  // the request was aborted/cancelled
1262
1265
  if (!this._files[id]) return;
1263
-
1266
+
1264
1267
  var name = this.getName(id);
1265
1268
  var size = this.getSize(id);
1266
-
1269
+
1267
1270
  this._options.onProgress(id, name, size, size);
1268
-
1271
+
1269
1272
  if ([200, 201].indexOf( xhr.status ) > -1){
1270
1273
  this.log("xhr - server response received");
1271
1274
  this.log("responseText = " + xhr.responseText);
1272
-
1275
+
1273
1276
  var response;
1274
-
1277
+
1275
1278
  try {
1276
1279
  response = eval("(" + xhr.responseText + ")");
1277
1280
  } catch(err){
1278
1281
  response = {};
1279
1282
  }
1280
-
1283
+
1284
+ console.log(id, name, response)
1281
1285
  this._options.onComplete(id, name, response);
1282
-
1283
- } else {
1286
+
1287
+ } else {
1284
1288
  this._options.onComplete(id, name, {});
1285
1289
  }
1286
-
1290
+
1287
1291
  this._files[id] = null;
1288
- this._xhrs[id] = null;
1289
- this._dequeue(id);
1292
+ this._xhrs[id] = null;
1293
+ this._dequeue(id);
1290
1294
  },
1291
1295
  _cancel: function(id){
1292
1296
  this._options.onCancel(id, this.getName(id));
1293
-
1297
+
1294
1298
  this._files[id] = null;
1295
-
1299
+
1296
1300
  if (this._xhrs[id]){
1297
1301
  this._xhrs[id].abort();
1298
- this._xhrs[id] = null;
1302
+ this._xhrs[id] = null;
1299
1303
  }
1300
1304
  }
1301
1305
  });