mosaico 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (425) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE +680 -0
  5. data/README.md +179 -0
  6. data/Rakefile +5 -0
  7. data/app/assets/images/mosaico/logo_transparent.png +0 -0
  8. data/app/assets/javascripts/mosaico/application.js.erb +51 -0
  9. data/app/assets/javascripts/mosaico/plugins/debug.js.erb +10 -0
  10. data/app/assets/javascripts/mosaico/plugins/logo.js.erb +10 -0
  11. data/app/assets/javascripts/mosaico/plugins/preview.js +85 -0
  12. data/app/assets/javascripts/mosaico/plugins/save.js.erb +72 -0
  13. data/app/assets/javascripts/mosaico/plugins/template_path.js.erb +22 -0
  14. data/app/assets/javascripts/mosaico/plugins/translations.js +10 -0
  15. data/app/assets/javascripts/mosaico/utilities.js +25 -0
  16. data/app/assets/stylesheets/mosaico/application.css +6 -0
  17. data/app/controllers/mosaico/application_controller.rb +17 -0
  18. data/app/controllers/mosaico/images_controller.rb +142 -0
  19. data/app/controllers/mosaico/projects_controller.rb +31 -0
  20. data/app/controllers/mosaico/templates_controller.rb +8 -0
  21. data/app/helpers/mosaico/application_helper.rb +7 -0
  22. data/app/models/mosaico/image.rb +9 -0
  23. data/app/models/mosaico/placeholder_image.rb +9 -0
  24. data/app/models/mosaico/project.rb +13 -0
  25. data/app/models/mosaico/uploaded_image.rb +26 -0
  26. data/app/views/layouts/mosaico/application.html.erb +13 -0
  27. data/app/views/mosaico/projects/new.html.erb +1 -0
  28. data/app/views/mosaico/projects/show.html.erb +1 -0
  29. data/app/views/mosaico/shared/_metadata.html.erb +12 -0
  30. data/config/routes.rb +12 -0
  31. data/db/migrate/20170817202255_add_images.rb +14 -0
  32. data/db/migrate/20170824233755_add_projects.rb +11 -0
  33. data/lib/mosaico.rb +100 -0
  34. data/lib/mosaico/engine.rb +72 -0
  35. data/lib/mosaico/local_backend.rb +23 -0
  36. data/lib/mosaico/local_image_backend.rb +7 -0
  37. data/lib/mosaico/local_placeholder_backend.rb +7 -0
  38. data/lib/mosaico/placeholder.png +0 -0
  39. data/lib/mosaico/template.rb +89 -0
  40. data/lib/mosaico/versafix_template.rb +43 -0
  41. data/lib/mosaico/version.rb +4 -0
  42. data/lib/tasks/makeThumbs.js.erb +57 -0
  43. data/lib/tasks/thumbs.rake +35 -0
  44. data/mosaico.gemspec +22 -0
  45. data/screenshot.png +0 -0
  46. data/vendor/assets/fonts/LiberationSans-Regular.ttf +0 -0
  47. data/vendor/assets/mosaico-0.16.0/mosaico/.jsbeautifyrc +6 -0
  48. data/vendor/assets/mosaico-0.16.0/mosaico/.jshintrc +8 -0
  49. data/vendor/assets/mosaico-0.16.0/mosaico/.travis.yml +6 -0
  50. data/vendor/assets/mosaico-0.16.0/mosaico/CONTRIBUTING.md +37 -0
  51. data/vendor/assets/mosaico-0.16.0/mosaico/Dockerfile +21 -0
  52. data/vendor/assets/mosaico-0.16.0/mosaico/Gruntfile.js +241 -0
  53. data/vendor/assets/mosaico-0.16.0/mosaico/LICENSE +680 -0
  54. data/vendor/assets/mosaico-0.16.0/mosaico/NOTICE.txt +87 -0
  55. data/vendor/assets/mosaico-0.16.0/mosaico/README.md +73 -0
  56. data/vendor/assets/mosaico-0.16.0/mosaico/backend/README.txt +23 -0
  57. data/vendor/assets/mosaico-0.16.0/mosaico/backend/main.js +162 -0
  58. data/vendor/assets/mosaico-0.16.0/mosaico/bower.json +76 -0
  59. data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico-material.css +7425 -0
  60. data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.css +7133 -0
  61. data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.debug.js +1517 -0
  62. data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.js +12828 -0
  63. data/vendor/assets/mosaico-0.16.0/mosaico/build/templates.js +15 -0
  64. data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.eot +0 -0
  65. data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.svg +685 -0
  66. data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.ttf +0 -0
  67. data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.woff +0 -0
  68. data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.woff2 +0 -0
  69. data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/byvoxmail.png +0 -0
  70. data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico-badge.gif +0 -0
  71. data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico-v.gif +0 -0
  72. data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico32.png +0 -0
  73. data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaicologo.png +0 -0
  74. data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/screenshot-orig.png +0 -0
  75. data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/screenshot.png +0 -0
  76. data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/README.md +26 -0
  77. data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-de.json +88 -0
  78. data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-en.json +88 -0
  79. data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-es.json +88 -0
  80. data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-fr.json +88 -0
  81. data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-it.json +88 -0
  82. data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-nl.json +88 -0
  83. data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-sv.json +88 -0
  84. data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico-material.min.css +5 -0
  85. data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico-material.min.css.map +1 -0
  86. data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.css +5 -0
  87. data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.css.map +1 -0
  88. data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.js +1517 -0
  89. data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.js.map +147 -0
  90. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/canvas-to-blob.min.js +2 -0
  91. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery-ui.min.css +7 -0
  92. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery-ui.min.js +13 -0
  93. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-image.js +324 -0
  94. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-process.js +175 -0
  95. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-validate.js +122 -0
  96. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload.js +1482 -0
  97. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.iframe-transport.js +217 -0
  98. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.min.js +5 -0
  99. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.min.map +1 -0
  100. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.ui.touch-punch.min.js +11 -0
  101. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/knockout-jqueryui.min.js +1 -0
  102. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/knockout.js +123 -0
  103. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/load-image.all.min.js +2 -0
  104. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.eot +0 -0
  105. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.ttf +0 -0
  106. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.woff +0 -0
  107. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/stylesheet.css +9 -0
  108. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/advlist/plugin.js +101 -0
  109. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/advlist/plugin.min.js +1 -0
  110. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/anchor/plugin.js +55 -0
  111. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/anchor/plugin.min.js +1 -0
  112. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autolink/plugin.js +204 -0
  113. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autolink/plugin.min.js +1 -0
  114. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autoresize/plugin.js +162 -0
  115. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autoresize/plugin.min.js +1 -0
  116. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autosave/plugin.js +165 -0
  117. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autosave/plugin.min.js +1 -0
  118. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/bbcode/plugin.js +123 -0
  119. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/bbcode/plugin.min.js +1 -0
  120. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/charmap/plugin.js +462 -0
  121. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/charmap/plugin.min.js +1 -0
  122. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js +60 -0
  123. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.min.js +1 -0
  124. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/css/prism.css +138 -0
  125. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/plugin.js +1319 -0
  126. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/plugin.min.js +1 -0
  127. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/colorpicker/plugin.js +112 -0
  128. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/colorpicker/plugin.min.js +1 -0
  129. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/contextmenu/plugin.js +100 -0
  130. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/contextmenu/plugin.min.js +1 -0
  131. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/directionality/plugin.js +64 -0
  132. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/directionality/plugin.min.js +1 -0
  133. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-cool.gif +0 -0
  134. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-cry.gif +0 -0
  135. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-embarassed.gif +0 -0
  136. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
  137. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-frown.gif +0 -0
  138. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-innocent.gif +0 -0
  139. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-kiss.gif +0 -0
  140. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-laughing.gif +0 -0
  141. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
  142. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-sealed.gif +0 -0
  143. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-smile.gif +0 -0
  144. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-surprised.gif +0 -0
  145. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
  146. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-undecided.gif +0 -0
  147. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-wink.gif +0 -0
  148. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-yell.gif +0 -0
  149. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js +65 -0
  150. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.min.js +1 -0
  151. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullpage/plugin.js +490 -0
  152. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullpage/plugin.min.js +1 -0
  153. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullscreen/plugin.js +154 -0
  154. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullscreen/plugin.min.js +1 -0
  155. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/hr/plugin.js +30 -0
  156. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/hr/plugin.min.js +1 -0
  157. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/image/plugin.js +630 -0
  158. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/image/plugin.min.js +1 -0
  159. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/imagetools/plugin.js +2944 -0
  160. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/imagetools/plugin.min.js +1 -0
  161. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/importcss/plugin.js +273 -0
  162. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/importcss/plugin.min.js +1 -0
  163. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/insertdatetime/plugin.js +121 -0
  164. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/insertdatetime/plugin.min.js +1 -0
  165. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/layer/plugin.js +225 -0
  166. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/layer/plugin.min.js +1 -0
  167. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/legacyoutput/plugin.js +208 -0
  168. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/legacyoutput/plugin.min.js +1 -0
  169. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/link/plugin.js +403 -0
  170. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/link/plugin.min.js +1 -0
  171. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/lists/plugin.js +965 -0
  172. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/lists/plugin.min.js +1 -0
  173. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/moxieplayer.swf +0 -0
  174. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/plugin.js +879 -0
  175. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/plugin.min.js +1 -0
  176. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/nonbreaking/plugin.js +53 -0
  177. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/nonbreaking/plugin.min.js +1 -0
  178. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/noneditable/plugin.js +101 -0
  179. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/noneditable/plugin.min.js +1 -0
  180. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/pagebreak/plugin.js +88 -0
  181. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/pagebreak/plugin.min.js +1 -0
  182. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/paste/plugin.js +1844 -0
  183. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/paste/plugin.min.js +1 -0
  184. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/preview/plugin.js +101 -0
  185. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/preview/plugin.min.js +1 -0
  186. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/print/plugin.js +32 -0
  187. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/print/plugin.min.js +1 -0
  188. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/save/plugin.js +98 -0
  189. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/save/plugin.min.js +1 -0
  190. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/searchreplace/plugin.js +609 -0
  191. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/searchreplace/plugin.min.js +1 -0
  192. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/spellchecker/plugin.js +1031 -0
  193. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/spellchecker/plugin.min.js +1 -0
  194. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/tabfocus/plugin.js +120 -0
  195. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/tabfocus/plugin.min.js +1 -0
  196. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/table/plugin.js +4400 -0
  197. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/table/plugin.min.js +2 -0
  198. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/template/plugin.js +276 -0
  199. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/template/plugin.min.js +1 -0
  200. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textcolor/plugin.js +297 -0
  201. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textcolor/plugin.min.js +1 -0
  202. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textpattern/plugin.js +268 -0
  203. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textpattern/plugin.min.js +1 -0
  204. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/css/visualblocks.css +135 -0
  205. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/plugin.js +86 -0
  206. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/plugin.min.js +1 -0
  207. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualchars/plugin.js +123 -0
  208. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualchars/plugin.min.js +1 -0
  209. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/wordcount/plugin.js +69 -0
  210. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/wordcount/plugin.min.js +1 -0
  211. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/Variables.less +196 -0
  212. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/content.inline.min.css +1 -0
  213. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/content.min.css +1 -0
  214. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/readme.md +1 -0
  215. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.eot +0 -0
  216. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.json +1277 -0
  217. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.svg +63 -0
  218. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.ttf +0 -0
  219. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.woff +0 -0
  220. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.eot +0 -0
  221. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.json +1972 -0
  222. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.svg +98 -0
  223. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.ttf +0 -0
  224. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.woff +0 -0
  225. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/anchor.gif +0 -0
  226. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/loader.gif +0 -0
  227. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/object.gif +0 -0
  228. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/trans.gif +0 -0
  229. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.ie7.min.css +1 -0
  230. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.json +79 -0
  231. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.min.css +1 -0
  232. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/content.inline.min.css +1 -0
  233. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/content.min.css +1 -0
  234. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.eot +0 -0
  235. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.svg +63 -0
  236. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  237. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.woff +0 -0
  238. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.eot +0 -0
  239. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.svg +129 -0
  240. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.ttf +0 -0
  241. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.woff +0 -0
  242. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/anchor.gif +0 -0
  243. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/loader.gif +0 -0
  244. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/object.gif +0 -0
  245. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/trans.gif +0 -0
  246. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/skin.ie7.min.css +1 -0
  247. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/skin.min.css +1 -0
  248. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/inlite/theme.js +1828 -0
  249. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/inlite/theme.min.js +1 -0
  250. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/modern/theme.js +934 -0
  251. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/modern/theme.min.js +1 -0
  252. data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/tinymce.min.js +14 -0
  253. data/vendor/assets/mosaico-0.16.0/mosaico/editor.html +63 -0
  254. data/vendor/assets/mosaico-0.16.0/mosaico/favicon.ico +0 -0
  255. data/vendor/assets/mosaico-0.16.0/mosaico/index.html +368 -0
  256. data/vendor/assets/mosaico-0.16.0/mosaico/package.json +92 -0
  257. data/vendor/assets/mosaico-0.16.0/mosaico/res/img/byvoxmail.png +0 -0
  258. data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico-badge.gif +0 -0
  259. data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico-v.gif +0 -0
  260. data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico32.png +0 -0
  261. data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaicologo.png +0 -0
  262. data/vendor/assets/mosaico-0.16.0/mosaico/res/img/screenshot-orig.png +0 -0
  263. data/vendor/assets/mosaico-0.16.0/mosaico/res/img/screenshot.png +0 -0
  264. data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/README.md +26 -0
  265. data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-de.json +88 -0
  266. data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-en.json +88 -0
  267. data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-es.json +88 -0
  268. data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-fr.json +88 -0
  269. data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-it.json +88 -0
  270. data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-nl.json +88 -0
  271. data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-sv.json +88 -0
  272. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/Variables.less +196 -0
  273. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/content.inline.min.css +1 -0
  274. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/content.min.css +1 -0
  275. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/readme.md +1 -0
  276. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.eot +0 -0
  277. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.json +1277 -0
  278. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.svg +63 -0
  279. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.ttf +0 -0
  280. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.woff +0 -0
  281. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.eot +0 -0
  282. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.json +1972 -0
  283. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.svg +98 -0
  284. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.ttf +0 -0
  285. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.woff +0 -0
  286. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/anchor.gif +0 -0
  287. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/loader.gif +0 -0
  288. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/object.gif +0 -0
  289. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/trans.gif +0 -0
  290. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.ie7.min.css +1 -0
  291. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.json +79 -0
  292. data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.min.css +1 -0
  293. data/vendor/assets/mosaico-0.16.0/mosaico/server-config.js +12 -0
  294. data/vendor/assets/mosaico-0.16.0/mosaico/spec/converter-spec.js +115 -0
  295. data/vendor/assets/mosaico-0.16.0/mosaico/spec/data/template-versafix-1.model.json +137 -0
  296. data/vendor/assets/mosaico-0.16.0/mosaico/spec/declarations-spec.js +282 -0
  297. data/vendor/assets/mosaico-0.16.0/mosaico/spec/mensch-spec.js +114 -0
  298. data/vendor/assets/mosaico-0.16.0/mosaico/spec/model-spec.js +88 -0
  299. data/vendor/assets/mosaico-0.16.0/mosaico/spec/stylesheet-spec.js +177 -0
  300. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/app_standalone.less +7 -0
  301. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/app_standalone_material.less +350 -0
  302. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/safarihack.css +17 -0
  303. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements.less +497 -0
  304. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_jquery.less +344 -0
  305. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_mixins.less +406 -0
  306. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_moxie.less +130 -0
  307. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico.less +529 -0
  308. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico_content.less +391 -0
  309. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico_tools.less +1043 -0
  310. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_reset.less +45 -0
  311. data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_variables.less +156 -0
  312. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/app.js +167 -0
  313. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/bind-iframe.js +64 -0
  314. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/blocks.js +118 -0
  315. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/choose-template.js +7 -0
  316. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/colorpicker.js +58 -0
  317. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/csstext.js +16 -0
  318. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/droppable.js +87 -0
  319. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/eventable.js +33 -0
  320. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/extender-pagination.js +60 -0
  321. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/extsortables.js +103 -0
  322. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/fileupload.js +373 -0
  323. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/if-subs.js +110 -0
  324. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js +31 -0
  325. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-tabs.js +17 -0
  326. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/script-template.js +30 -0
  327. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/scrollfix.js +48 -0
  328. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/scrollintoview.js +83 -0
  329. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/string-template.js +76 -0
  330. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/tooltips.js +36 -0
  331. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/validated-value.js +40 -0
  332. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/virtuals.js +102 -0
  333. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/wysiwygs.js +304 -0
  334. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/checkmodel.js +114 -0
  335. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/declarations.js +279 -0
  336. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/domutils.js +93 -0
  337. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/editor.js +411 -0
  338. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/main.js +42 -0
  339. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/model.js +536 -0
  340. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/parser.js +485 -0
  341. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/stylesheet.js +205 -0
  342. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/utils.js +156 -0
  343. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/wrapper.js +308 -0
  344. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/color.js +53 -0
  345. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/inliner.js +35 -0
  346. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/localstorage.js +100 -0
  347. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ko-bindings.js +22 -0
  348. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/template-loader.js +446 -0
  349. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/timed-call.js +31 -0
  350. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/undomanager/undomain.js +49 -0
  351. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/undomanager/undoserializer.js +120 -0
  352. data/vendor/assets/mosaico-0.16.0/mosaico/src/js/viewmodel.js +595 -0
  353. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/array.tmpl.html +1 -0
  354. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/block-show.tmpl.html +1 -0
  355. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/block-wysiwyg.tmpl.html +18 -0
  356. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/blocks-show.tmpl.html +1 -0
  357. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/blocks-wysiwyg.tmpl.html +2 -0
  358. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/customstyle.tmpl.html +3 -0
  359. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/empty.tmpl.html +0 -0
  360. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/error.tmpl.html +1 -0
  361. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/gallery-images.tmpl.html +16 -0
  362. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/img-wysiwyg.tmpl.html +43 -0
  363. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/main.tmpl.html +102 -0
  364. data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/toolbox.tmpl.html +111 -0
  365. data/vendor/assets/mosaico-0.16.0/mosaico/tasks/combineKOTemplates.js +24 -0
  366. data/vendor/assets/mosaico-0.16.0/mosaico/tasks/lib/phantom-thumbnailer-editor.js +168 -0
  367. data/vendor/assets/mosaico-0.16.0/mosaico/tasks/makeThumbs.js +79 -0
  368. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/README.md +1 -0
  369. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/_full.png +0 -0
  370. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/footerBlock.png +0 -0
  371. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/headerBlock.png +0 -0
  372. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/heroBlock.png +0 -0
  373. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/socialBlock.png +0 -0
  374. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/threetwoBlock.png +0 -0
  375. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/twoColumnBlock.png +0 -0
  376. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/template-tedc15.html +567 -0
  377. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/HeaderAndText.png +0 -0
  378. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/_full.png +0 -0
  379. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/fixedlist.png +0 -0
  380. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/mosaico-tutorial.md +335 -0
  381. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/mosaico-tutorial.pdf +0 -0
  382. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_384.jpg +0 -0
  383. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_385.jpg +0 -0
  384. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_386.jpg +0 -0
  385. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_387.jpg +0 -0
  386. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_407.jpg +0 -0
  387. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_408.jpg +0 -0
  388. data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/template-tutorial.html +68 -0
  389. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/_full.png +0 -0
  390. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/buttonBlock.png +0 -0
  391. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/doubleArticleBlock.png +0 -0
  392. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/doubleImageBlock.png +0 -0
  393. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/hrBlock.png +0 -0
  394. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/imageBlock.png +0 -0
  395. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/logoBlock.png +0 -0
  396. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/sideArticleBlock.png +0 -0
  397. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/singleArticleBlock.png +0 -0
  398. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/socialBlock.png +0 -0
  399. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/spacerBlock.png +0 -0
  400. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/textBlock.png +0 -0
  401. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/titleBlock.png +0 -0
  402. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/tripleArticleBlock.png +0 -0
  403. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/tripleImageBlock.png +0 -0
  404. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/facebook_bw_ok.png +0 -0
  405. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/facebook_ok.png +0 -0
  406. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/flickr_bw_ok.png +0 -0
  407. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/flickr_ok.png +0 -0
  408. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/google+_bw_ok.png +0 -0
  409. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/google+_ok.png +0 -0
  410. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/instagram_bw_ok.png +0 -0
  411. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/instagram_ok.png +0 -0
  412. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/linkedin_bw_ok.png +0 -0
  413. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/linkedin_ok.png +0 -0
  414. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/twitter_bw_ok.png +0 -0
  415. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/twitter_ok.png +0 -0
  416. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/vimeo_bw_ok.png +0 -0
  417. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/vimeo_ok.png +0 -0
  418. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/web_bw_ok.png +0 -0
  419. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/web_ok.png +0 -0
  420. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/youtube_bw_ok.png +0 -0
  421. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/youtube_ok.png +0 -0
  422. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/sponsor.gif +0 -0
  423. data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/template-versafix-1.html +1531 -0
  424. data/vendor/assets/mosaico-0.16.0/mosaico/uploads/README.md +1 -0
  425. metadata +536 -0
@@ -0,0 +1,175 @@
1
+ /*
2
+ * jQuery File Upload Processing Plugin
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2012, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://www.opensource.org/licenses/MIT
10
+ */
11
+
12
+ /* jshint nomen:false */
13
+ /* global define, require, window */
14
+
15
+ ;(function (factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define([
20
+ 'jquery',
21
+ './jquery.fileupload'
22
+ ], factory);
23
+ } else if (typeof exports === 'object') {
24
+ // Node/CommonJS:
25
+ factory(require('jquery'));
26
+ } else {
27
+ // Browser globals:
28
+ factory(
29
+ window.jQuery
30
+ );
31
+ }
32
+ }(function ($) {
33
+ 'use strict';
34
+
35
+ var originalAdd = $.blueimp.fileupload.prototype.options.add;
36
+
37
+ // The File Upload Processing plugin extends the fileupload widget
38
+ // with file processing functionality:
39
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
40
+
41
+ options: {
42
+ // The list of processing actions:
43
+ processQueue: [
44
+ /*
45
+ {
46
+ action: 'log',
47
+ type: 'debug'
48
+ }
49
+ */
50
+ ],
51
+ add: function (e, data) {
52
+ var $this = $(this);
53
+ data.process(function () {
54
+ return $this.fileupload('process', data);
55
+ });
56
+ originalAdd.call(this, e, data);
57
+ }
58
+ },
59
+
60
+ processActions: {
61
+ /*
62
+ log: function (data, options) {
63
+ console[options.type](
64
+ 'Processing "' + data.files[data.index].name + '"'
65
+ );
66
+ }
67
+ */
68
+ },
69
+
70
+ _processFile: function (data, originalData) {
71
+ var that = this,
72
+ dfd = $.Deferred().resolveWith(that, [data]),
73
+ chain = dfd.promise();
74
+ this._trigger('process', null, data);
75
+ $.each(data.processQueue, function (i, settings) {
76
+ var func = function (data) {
77
+ if (originalData.errorThrown) {
78
+ return $.Deferred()
79
+ .rejectWith(that, [originalData]).promise();
80
+ }
81
+ return that.processActions[settings.action].call(
82
+ that,
83
+ data,
84
+ settings
85
+ );
86
+ };
87
+ chain = chain.then(func, settings.always && func);
88
+ });
89
+ chain
90
+ .done(function () {
91
+ that._trigger('processdone', null, data);
92
+ that._trigger('processalways', null, data);
93
+ })
94
+ .fail(function () {
95
+ that._trigger('processfail', null, data);
96
+ that._trigger('processalways', null, data);
97
+ });
98
+ return chain;
99
+ },
100
+
101
+ // Replaces the settings of each processQueue item that
102
+ // are strings starting with an "@", using the remaining
103
+ // substring as key for the option map,
104
+ // e.g. "@autoUpload" is replaced with options.autoUpload:
105
+ _transformProcessQueue: function (options) {
106
+ var processQueue = [];
107
+ $.each(options.processQueue, function () {
108
+ var settings = {},
109
+ action = this.action,
110
+ prefix = this.prefix === true ? action : this.prefix;
111
+ $.each(this, function (key, value) {
112
+ if ($.type(value) === 'string' &&
113
+ value.charAt(0) === '@') {
114
+ settings[key] = options[
115
+ value.slice(1) || (prefix ? prefix +
116
+ key.charAt(0).toUpperCase() + key.slice(1) : key)
117
+ ];
118
+ } else {
119
+ settings[key] = value;
120
+ }
121
+
122
+ });
123
+ processQueue.push(settings);
124
+ });
125
+ options.processQueue = processQueue;
126
+ },
127
+
128
+ // Returns the number of files currently in the processsing queue:
129
+ processing: function () {
130
+ return this._processing;
131
+ },
132
+
133
+ // Processes the files given as files property of the data parameter,
134
+ // returns a Promise object that allows to bind callbacks:
135
+ process: function (data) {
136
+ var that = this,
137
+ options = $.extend({}, this.options, data);
138
+ if (options.processQueue && options.processQueue.length) {
139
+ this._transformProcessQueue(options);
140
+ if (this._processing === 0) {
141
+ this._trigger('processstart');
142
+ }
143
+ $.each(data.files, function (index) {
144
+ var opts = index ? $.extend({}, options) : options,
145
+ func = function () {
146
+ if (data.errorThrown) {
147
+ return $.Deferred()
148
+ .rejectWith(that, [data]).promise();
149
+ }
150
+ return that._processFile(opts, data);
151
+ };
152
+ opts.index = index;
153
+ that._processing += 1;
154
+ that._processingQueue = that._processingQueue.then(func, func)
155
+ .always(function () {
156
+ that._processing -= 1;
157
+ if (that._processing === 0) {
158
+ that._trigger('processstop');
159
+ }
160
+ });
161
+ });
162
+ }
163
+ return this._processingQueue;
164
+ },
165
+
166
+ _create: function () {
167
+ this._super();
168
+ this._processing = 0;
169
+ this._processingQueue = $.Deferred().resolveWith(this)
170
+ .promise();
171
+ }
172
+
173
+ });
174
+
175
+ }));
@@ -0,0 +1,122 @@
1
+ /*
2
+ * jQuery File Upload Validation Plugin
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2013, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://www.opensource.org/licenses/MIT
10
+ */
11
+
12
+ /* global define, require, window */
13
+
14
+ ;(function (factory) {
15
+ 'use strict';
16
+ if (typeof define === 'function' && define.amd) {
17
+ // Register as an anonymous AMD module:
18
+ define([
19
+ 'jquery',
20
+ './jquery.fileupload-process'
21
+ ], factory);
22
+ } else if (typeof exports === 'object') {
23
+ // Node/CommonJS:
24
+ factory(require('jquery'));
25
+ } else {
26
+ // Browser globals:
27
+ factory(
28
+ window.jQuery
29
+ );
30
+ }
31
+ }(function ($) {
32
+ 'use strict';
33
+
34
+ // Append to the default processQueue:
35
+ $.blueimp.fileupload.prototype.options.processQueue.push(
36
+ {
37
+ action: 'validate',
38
+ // Always trigger this action,
39
+ // even if the previous action was rejected:
40
+ always: true,
41
+ // Options taken from the global options map:
42
+ acceptFileTypes: '@',
43
+ maxFileSize: '@',
44
+ minFileSize: '@',
45
+ maxNumberOfFiles: '@',
46
+ disabled: '@disableValidation'
47
+ }
48
+ );
49
+
50
+ // The File Upload Validation plugin extends the fileupload widget
51
+ // with file validation functionality:
52
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
53
+
54
+ options: {
55
+ /*
56
+ // The regular expression for allowed file types, matches
57
+ // against either file type or file name:
58
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
59
+ // The maximum allowed file size in bytes:
60
+ maxFileSize: 10000000, // 10 MB
61
+ // The minimum allowed file size in bytes:
62
+ minFileSize: undefined, // No minimal file size
63
+ // The limit of files to be uploaded:
64
+ maxNumberOfFiles: 10,
65
+ */
66
+
67
+ // Function returning the current number of files,
68
+ // has to be overriden for maxNumberOfFiles validation:
69
+ getNumberOfFiles: $.noop,
70
+
71
+ // Error and info messages:
72
+ messages: {
73
+ maxNumberOfFiles: 'Maximum number of files exceeded',
74
+ acceptFileTypes: 'File type not allowed',
75
+ maxFileSize: 'File is too large',
76
+ minFileSize: 'File is too small'
77
+ }
78
+ },
79
+
80
+ processActions: {
81
+
82
+ validate: function (data, options) {
83
+ if (options.disabled) {
84
+ return data;
85
+ }
86
+ var dfd = $.Deferred(),
87
+ settings = this.options,
88
+ file = data.files[data.index],
89
+ fileSize;
90
+ if (options.minFileSize || options.maxFileSize) {
91
+ fileSize = file.size;
92
+ }
93
+ if ($.type(options.maxNumberOfFiles) === 'number' &&
94
+ (settings.getNumberOfFiles() || 0) + data.files.length >
95
+ options.maxNumberOfFiles) {
96
+ file.error = settings.i18n('maxNumberOfFiles');
97
+ } else if (options.acceptFileTypes &&
98
+ !(options.acceptFileTypes.test(file.type) ||
99
+ options.acceptFileTypes.test(file.name))) {
100
+ file.error = settings.i18n('acceptFileTypes');
101
+ } else if (fileSize > options.maxFileSize) {
102
+ file.error = settings.i18n('maxFileSize');
103
+ } else if ($.type(fileSize) === 'number' &&
104
+ fileSize < options.minFileSize) {
105
+ file.error = settings.i18n('minFileSize');
106
+ } else {
107
+ delete file.error;
108
+ }
109
+ if (file.error || data.files.error) {
110
+ data.files.error = true;
111
+ dfd.rejectWith(this, [data]);
112
+ } else {
113
+ dfd.resolveWith(this, [data]);
114
+ }
115
+ return dfd.promise();
116
+ }
117
+
118
+ }
119
+
120
+ });
121
+
122
+ }));
@@ -0,0 +1,1482 @@
1
+ /*
2
+ * jQuery File Upload Plugin
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2010, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://www.opensource.org/licenses/MIT
10
+ */
11
+
12
+ /* jshint nomen:false */
13
+ /* global define, require, window, document, location, Blob, FormData */
14
+
15
+ ;(function (factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define([
20
+ 'jquery',
21
+ 'jquery-ui/widget'
22
+ ], factory);
23
+ } else if (typeof exports === 'object') {
24
+ // Node/CommonJS:
25
+ factory(
26
+ require('jquery'),
27
+ require('./vendor/jquery.ui.widget')
28
+ );
29
+ } else {
30
+ // Browser globals:
31
+ factory(window.jQuery);
32
+ }
33
+ }(function ($) {
34
+ 'use strict';
35
+
36
+ // Detect file input support, based on
37
+ // http://viljamis.com/blog/2012/file-upload-support-on-mobile/
38
+ $.support.fileInput = !(new RegExp(
39
+ // Handle devices which give false positives for the feature detection:
40
+ '(Android (1\\.[0156]|2\\.[01]))' +
41
+ '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
42
+ '|(w(eb)?OSBrowser)|(webOS)' +
43
+ '|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
44
+ ).test(window.navigator.userAgent) ||
45
+ // Feature detection for all other devices:
46
+ $('<input type="file">').prop('disabled'));
47
+
48
+ // The FileReader API is not actually used, but works as feature detection,
49
+ // as some Safari versions (5?) support XHR file uploads via the FormData API,
50
+ // but not non-multipart XHR file uploads.
51
+ // window.XMLHttpRequestUpload is not available on IE10, so we check for
52
+ // window.ProgressEvent instead to detect XHR2 file upload capability:
53
+ $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader);
54
+ $.support.xhrFormDataFileUpload = !!window.FormData;
55
+
56
+ // Detect support for Blob slicing (required for chunked uploads):
57
+ $.support.blobSlice = window.Blob && (Blob.prototype.slice ||
58
+ Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
59
+
60
+ // Helper function to create drag handlers for dragover/dragenter/dragleave:
61
+ function getDragHandler(type) {
62
+ var isDragOver = type === 'dragover';
63
+ return function (e) {
64
+ e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
65
+ var dataTransfer = e.dataTransfer;
66
+ if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
67
+ this._trigger(
68
+ type,
69
+ $.Event(type, {delegatedEvent: e})
70
+ ) !== false) {
71
+ e.preventDefault();
72
+ if (isDragOver) {
73
+ dataTransfer.dropEffect = 'copy';
74
+ }
75
+ }
76
+ };
77
+ }
78
+
79
+ // The fileupload widget listens for change events on file input fields defined
80
+ // via fileInput setting and paste or drop events of the given dropZone.
81
+ // In addition to the default jQuery Widget methods, the fileupload widget
82
+ // exposes the "add" and "send" methods, to add or directly send files using
83
+ // the fileupload API.
84
+ // By default, files added via file input selection, paste, drag & drop or
85
+ // "add" method are uploaded immediately, but it is possible to override
86
+ // the "add" callback option to queue file uploads.
87
+ $.widget('blueimp.fileupload', {
88
+
89
+ options: {
90
+ // The drop target element(s), by the default the complete document.
91
+ // Set to null to disable drag & drop support:
92
+ dropZone: $(document),
93
+ // The paste target element(s), by the default undefined.
94
+ // Set to a DOM node or jQuery object to enable file pasting:
95
+ pasteZone: undefined,
96
+ // The file input field(s), that are listened to for change events.
97
+ // If undefined, it is set to the file input fields inside
98
+ // of the widget element on plugin initialization.
99
+ // Set to null to disable the change listener.
100
+ fileInput: undefined,
101
+ // By default, the file input field is replaced with a clone after
102
+ // each input field change event. This is required for iframe transport
103
+ // queues and allows change events to be fired for the same file
104
+ // selection, but can be disabled by setting the following option to false:
105
+ replaceFileInput: true,
106
+ // The parameter name for the file form data (the request argument name).
107
+ // If undefined or empty, the name property of the file input field is
108
+ // used, or "files[]" if the file input name property is also empty,
109
+ // can be a string or an array of strings:
110
+ paramName: undefined,
111
+ // By default, each file of a selection is uploaded using an individual
112
+ // request for XHR type uploads. Set to false to upload file
113
+ // selections in one request each:
114
+ singleFileUploads: true,
115
+ // To limit the number of files uploaded with one XHR request,
116
+ // set the following option to an integer greater than 0:
117
+ limitMultiFileUploads: undefined,
118
+ // The following option limits the number of files uploaded with one
119
+ // XHR request to keep the request size under or equal to the defined
120
+ // limit in bytes:
121
+ limitMultiFileUploadSize: undefined,
122
+ // Multipart file uploads add a number of bytes to each uploaded file,
123
+ // therefore the following option adds an overhead for each file used
124
+ // in the limitMultiFileUploadSize configuration:
125
+ limitMultiFileUploadSizeOverhead: 512,
126
+ // Set the following option to true to issue all file upload requests
127
+ // in a sequential order:
128
+ sequentialUploads: false,
129
+ // To limit the number of concurrent uploads,
130
+ // set the following option to an integer greater than 0:
131
+ limitConcurrentUploads: undefined,
132
+ // Set the following option to true to force iframe transport uploads:
133
+ forceIframeTransport: false,
134
+ // Set the following option to the location of a redirect url on the
135
+ // origin server, for cross-domain iframe transport uploads:
136
+ redirect: undefined,
137
+ // The parameter name for the redirect url, sent as part of the form
138
+ // data and set to 'redirect' if this option is empty:
139
+ redirectParamName: undefined,
140
+ // Set the following option to the location of a postMessage window,
141
+ // to enable postMessage transport uploads:
142
+ postMessage: undefined,
143
+ // By default, XHR file uploads are sent as multipart/form-data.
144
+ // The iframe transport is always using multipart/form-data.
145
+ // Set to false to enable non-multipart XHR uploads:
146
+ multipart: true,
147
+ // To upload large files in smaller chunks, set the following option
148
+ // to a preferred maximum chunk size. If set to 0, null or undefined,
149
+ // or the browser does not support the required Blob API, files will
150
+ // be uploaded as a whole.
151
+ maxChunkSize: undefined,
152
+ // When a non-multipart upload or a chunked multipart upload has been
153
+ // aborted, this option can be used to resume the upload by setting
154
+ // it to the size of the already uploaded bytes. This option is most
155
+ // useful when modifying the options object inside of the "add" or
156
+ // "send" callbacks, as the options are cloned for each file upload.
157
+ uploadedBytes: undefined,
158
+ // By default, failed (abort or error) file uploads are removed from the
159
+ // global progress calculation. Set the following option to false to
160
+ // prevent recalculating the global progress data:
161
+ recalculateProgress: true,
162
+ // Interval in milliseconds to calculate and trigger progress events:
163
+ progressInterval: 100,
164
+ // Interval in milliseconds to calculate progress bitrate:
165
+ bitrateInterval: 500,
166
+ // By default, uploads are started automatically when adding files:
167
+ autoUpload: true,
168
+
169
+ // Error and info messages:
170
+ messages: {
171
+ uploadedBytes: 'Uploaded bytes exceed file size'
172
+ },
173
+
174
+ // Translation function, gets the message key to be translated
175
+ // and an object with context specific data as arguments:
176
+ i18n: function (message, context) {
177
+ message = this.messages[message] || message.toString();
178
+ if (context) {
179
+ $.each(context, function (key, value) {
180
+ message = message.replace('{' + key + '}', value);
181
+ });
182
+ }
183
+ return message;
184
+ },
185
+
186
+ // Additional form data to be sent along with the file uploads can be set
187
+ // using this option, which accepts an array of objects with name and
188
+ // value properties, a function returning such an array, a FormData
189
+ // object (for XHR file uploads), or a simple object.
190
+ // The form of the first fileInput is given as parameter to the function:
191
+ formData: function (form) {
192
+ return form.serializeArray();
193
+ },
194
+
195
+ // The add callback is invoked as soon as files are added to the fileupload
196
+ // widget (via file input selection, drag & drop, paste or add API call).
197
+ // If the singleFileUploads option is enabled, this callback will be
198
+ // called once for each file in the selection for XHR file uploads, else
199
+ // once for each file selection.
200
+ //
201
+ // The upload starts when the submit method is invoked on the data parameter.
202
+ // The data object contains a files property holding the added files
203
+ // and allows you to override plugin options as well as define ajax settings.
204
+ //
205
+ // Listeners for this callback can also be bound the following way:
206
+ // .bind('fileuploadadd', func);
207
+ //
208
+ // data.submit() returns a Promise object and allows to attach additional
209
+ // handlers using jQuery's Deferred callbacks:
210
+ // data.submit().done(func).fail(func).always(func);
211
+ add: function (e, data) {
212
+ if (e.isDefaultPrevented()) {
213
+ return false;
214
+ }
215
+ if (data.autoUpload || (data.autoUpload !== false &&
216
+ $(this).fileupload('option', 'autoUpload'))) {
217
+ data.process().done(function () {
218
+ data.submit();
219
+ });
220
+ }
221
+ },
222
+
223
+ // Other callbacks:
224
+
225
+ // Callback for the submit event of each file upload:
226
+ // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
227
+
228
+ // Callback for the start of each file upload request:
229
+ // send: function (e, data) {}, // .bind('fileuploadsend', func);
230
+
231
+ // Callback for successful uploads:
232
+ // done: function (e, data) {}, // .bind('fileuploaddone', func);
233
+
234
+ // Callback for failed (abort or error) uploads:
235
+ // fail: function (e, data) {}, // .bind('fileuploadfail', func);
236
+
237
+ // Callback for completed (success, abort or error) requests:
238
+ // always: function (e, data) {}, // .bind('fileuploadalways', func);
239
+
240
+ // Callback for upload progress events:
241
+ // progress: function (e, data) {}, // .bind('fileuploadprogress', func);
242
+
243
+ // Callback for global upload progress events:
244
+ // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
245
+
246
+ // Callback for uploads start, equivalent to the global ajaxStart event:
247
+ // start: function (e) {}, // .bind('fileuploadstart', func);
248
+
249
+ // Callback for uploads stop, equivalent to the global ajaxStop event:
250
+ // stop: function (e) {}, // .bind('fileuploadstop', func);
251
+
252
+ // Callback for change events of the fileInput(s):
253
+ // change: function (e, data) {}, // .bind('fileuploadchange', func);
254
+
255
+ // Callback for paste events to the pasteZone(s):
256
+ // paste: function (e, data) {}, // .bind('fileuploadpaste', func);
257
+
258
+ // Callback for drop events of the dropZone(s):
259
+ // drop: function (e, data) {}, // .bind('fileuploaddrop', func);
260
+
261
+ // Callback for dragover events of the dropZone(s):
262
+ // dragover: function (e) {}, // .bind('fileuploaddragover', func);
263
+
264
+ // Callback for the start of each chunk upload request:
265
+ // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
266
+
267
+ // Callback for successful chunk uploads:
268
+ // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
269
+
270
+ // Callback for failed (abort or error) chunk uploads:
271
+ // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
272
+
273
+ // Callback for completed (success, abort or error) chunk upload requests:
274
+ // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
275
+
276
+ // The plugin options are used as settings object for the ajax calls.
277
+ // The following are jQuery ajax settings required for the file uploads:
278
+ processData: false,
279
+ contentType: false,
280
+ cache: false,
281
+ timeout: 0
282
+ },
283
+
284
+ // A list of options that require reinitializing event listeners and/or
285
+ // special initialization code:
286
+ _specialOptions: [
287
+ 'fileInput',
288
+ 'dropZone',
289
+ 'pasteZone',
290
+ 'multipart',
291
+ 'forceIframeTransport'
292
+ ],
293
+
294
+ _blobSlice: $.support.blobSlice && function () {
295
+ var slice = this.slice || this.webkitSlice || this.mozSlice;
296
+ return slice.apply(this, arguments);
297
+ },
298
+
299
+ _BitrateTimer: function () {
300
+ this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
301
+ this.loaded = 0;
302
+ this.bitrate = 0;
303
+ this.getBitrate = function (now, loaded, interval) {
304
+ var timeDiff = now - this.timestamp;
305
+ if (!this.bitrate || !interval || timeDiff > interval) {
306
+ this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
307
+ this.loaded = loaded;
308
+ this.timestamp = now;
309
+ }
310
+ return this.bitrate;
311
+ };
312
+ },
313
+
314
+ _isXHRUpload: function (options) {
315
+ return !options.forceIframeTransport &&
316
+ ((!options.multipart && $.support.xhrFileUpload) ||
317
+ $.support.xhrFormDataFileUpload);
318
+ },
319
+
320
+ _getFormData: function (options) {
321
+ var formData;
322
+ if ($.type(options.formData) === 'function') {
323
+ return options.formData(options.form);
324
+ }
325
+ if ($.isArray(options.formData)) {
326
+ return options.formData;
327
+ }
328
+ if ($.type(options.formData) === 'object') {
329
+ formData = [];
330
+ $.each(options.formData, function (name, value) {
331
+ formData.push({name: name, value: value});
332
+ });
333
+ return formData;
334
+ }
335
+ return [];
336
+ },
337
+
338
+ _getTotal: function (files) {
339
+ var total = 0;
340
+ $.each(files, function (index, file) {
341
+ total += file.size || 1;
342
+ });
343
+ return total;
344
+ },
345
+
346
+ _initProgressObject: function (obj) {
347
+ var progress = {
348
+ loaded: 0,
349
+ total: 0,
350
+ bitrate: 0
351
+ };
352
+ if (obj._progress) {
353
+ $.extend(obj._progress, progress);
354
+ } else {
355
+ obj._progress = progress;
356
+ }
357
+ },
358
+
359
+ _initResponseObject: function (obj) {
360
+ var prop;
361
+ if (obj._response) {
362
+ for (prop in obj._response) {
363
+ if (obj._response.hasOwnProperty(prop)) {
364
+ delete obj._response[prop];
365
+ }
366
+ }
367
+ } else {
368
+ obj._response = {};
369
+ }
370
+ },
371
+
372
+ _onProgress: function (e, data) {
373
+ if (e.lengthComputable) {
374
+ var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
375
+ loaded;
376
+ if (data._time && data.progressInterval &&
377
+ (now - data._time < data.progressInterval) &&
378
+ e.loaded !== e.total) {
379
+ return;
380
+ }
381
+ data._time = now;
382
+ loaded = Math.floor(
383
+ e.loaded / e.total * (data.chunkSize || data._progress.total)
384
+ ) + (data.uploadedBytes || 0);
385
+ // Add the difference from the previously loaded state
386
+ // to the global loaded counter:
387
+ this._progress.loaded += (loaded - data._progress.loaded);
388
+ this._progress.bitrate = this._bitrateTimer.getBitrate(
389
+ now,
390
+ this._progress.loaded,
391
+ data.bitrateInterval
392
+ );
393
+ data._progress.loaded = data.loaded = loaded;
394
+ data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
395
+ now,
396
+ loaded,
397
+ data.bitrateInterval
398
+ );
399
+ // Trigger a custom progress event with a total data property set
400
+ // to the file size(s) of the current upload and a loaded data
401
+ // property calculated accordingly:
402
+ this._trigger(
403
+ 'progress',
404
+ $.Event('progress', {delegatedEvent: e}),
405
+ data
406
+ );
407
+ // Trigger a global progress event for all current file uploads,
408
+ // including ajax calls queued for sequential file uploads:
409
+ this._trigger(
410
+ 'progressall',
411
+ $.Event('progressall', {delegatedEvent: e}),
412
+ this._progress
413
+ );
414
+ }
415
+ },
416
+
417
+ _initProgressListener: function (options) {
418
+ var that = this,
419
+ xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
420
+ // Accesss to the native XHR object is required to add event listeners
421
+ // for the upload progress event:
422
+ if (xhr.upload) {
423
+ $(xhr.upload).bind('progress', function (e) {
424
+ var oe = e.originalEvent;
425
+ // Make sure the progress event properties get copied over:
426
+ e.lengthComputable = oe.lengthComputable;
427
+ e.loaded = oe.loaded;
428
+ e.total = oe.total;
429
+ that._onProgress(e, options);
430
+ });
431
+ options.xhr = function () {
432
+ return xhr;
433
+ };
434
+ }
435
+ },
436
+
437
+ _isInstanceOf: function (type, obj) {
438
+ // Cross-frame instanceof check
439
+ return Object.prototype.toString.call(obj) === '[object ' + type + ']';
440
+ },
441
+
442
+ _initXHRData: function (options) {
443
+ var that = this,
444
+ formData,
445
+ file = options.files[0],
446
+ // Ignore non-multipart setting if not supported:
447
+ multipart = options.multipart || !$.support.xhrFileUpload,
448
+ paramName = $.type(options.paramName) === 'array' ?
449
+ options.paramName[0] : options.paramName;
450
+ options.headers = $.extend({}, options.headers);
451
+ if (options.contentRange) {
452
+ options.headers['Content-Range'] = options.contentRange;
453
+ }
454
+ if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
455
+ options.headers['Content-Disposition'] = 'attachment; filename="' +
456
+ encodeURI(file.name) + '"';
457
+ }
458
+ if (!multipart) {
459
+ options.contentType = file.type || 'application/octet-stream';
460
+ options.data = options.blob || file;
461
+ } else if ($.support.xhrFormDataFileUpload) {
462
+ if (options.postMessage) {
463
+ // window.postMessage does not allow sending FormData
464
+ // objects, so we just add the File/Blob objects to
465
+ // the formData array and let the postMessage window
466
+ // create the FormData object out of this array:
467
+ formData = this._getFormData(options);
468
+ if (options.blob) {
469
+ formData.push({
470
+ name: paramName,
471
+ value: options.blob
472
+ });
473
+ } else {
474
+ $.each(options.files, function (index, file) {
475
+ formData.push({
476
+ name: ($.type(options.paramName) === 'array' &&
477
+ options.paramName[index]) || paramName,
478
+ value: file
479
+ });
480
+ });
481
+ }
482
+ } else {
483
+ if (that._isInstanceOf('FormData', options.formData)) {
484
+ formData = options.formData;
485
+ } else {
486
+ formData = new FormData();
487
+ $.each(this._getFormData(options), function (index, field) {
488
+ formData.append(field.name, field.value);
489
+ });
490
+ }
491
+ if (options.blob) {
492
+ formData.append(paramName, options.blob, file.name);
493
+ } else {
494
+ $.each(options.files, function (index, file) {
495
+ // This check allows the tests to run with
496
+ // dummy objects:
497
+ if (that._isInstanceOf('File', file) ||
498
+ that._isInstanceOf('Blob', file)) {
499
+ formData.append(
500
+ ($.type(options.paramName) === 'array' &&
501
+ options.paramName[index]) || paramName,
502
+ file,
503
+ file.uploadName || file.name
504
+ );
505
+ }
506
+ });
507
+ }
508
+ }
509
+ options.data = formData;
510
+ }
511
+ // Blob reference is not needed anymore, free memory:
512
+ options.blob = null;
513
+ },
514
+
515
+ _initIframeSettings: function (options) {
516
+ var targetHost = $('<a></a>').prop('href', options.url).prop('host');
517
+ // Setting the dataType to iframe enables the iframe transport:
518
+ options.dataType = 'iframe ' + (options.dataType || '');
519
+ // The iframe transport accepts a serialized array as form data:
520
+ options.formData = this._getFormData(options);
521
+ // Add redirect url to form data on cross-domain uploads:
522
+ if (options.redirect && targetHost && targetHost !== location.host) {
523
+ options.formData.push({
524
+ name: options.redirectParamName || 'redirect',
525
+ value: options.redirect
526
+ });
527
+ }
528
+ },
529
+
530
+ _initDataSettings: function (options) {
531
+ if (this._isXHRUpload(options)) {
532
+ if (!this._chunkedUpload(options, true)) {
533
+ if (!options.data) {
534
+ this._initXHRData(options);
535
+ }
536
+ this._initProgressListener(options);
537
+ }
538
+ if (options.postMessage) {
539
+ // Setting the dataType to postmessage enables the
540
+ // postMessage transport:
541
+ options.dataType = 'postmessage ' + (options.dataType || '');
542
+ }
543
+ } else {
544
+ this._initIframeSettings(options);
545
+ }
546
+ },
547
+
548
+ _getParamName: function (options) {
549
+ var fileInput = $(options.fileInput),
550
+ paramName = options.paramName;
551
+ if (!paramName) {
552
+ paramName = [];
553
+ fileInput.each(function () {
554
+ var input = $(this),
555
+ name = input.prop('name') || 'files[]',
556
+ i = (input.prop('files') || [1]).length;
557
+ while (i) {
558
+ paramName.push(name);
559
+ i -= 1;
560
+ }
561
+ });
562
+ if (!paramName.length) {
563
+ paramName = [fileInput.prop('name') || 'files[]'];
564
+ }
565
+ } else if (!$.isArray(paramName)) {
566
+ paramName = [paramName];
567
+ }
568
+ return paramName;
569
+ },
570
+
571
+ _initFormSettings: function (options) {
572
+ // Retrieve missing options from the input field and the
573
+ // associated form, if available:
574
+ if (!options.form || !options.form.length) {
575
+ options.form = $(options.fileInput.prop('form'));
576
+ // If the given file input doesn't have an associated form,
577
+ // use the default widget file input's form:
578
+ if (!options.form.length) {
579
+ options.form = $(this.options.fileInput.prop('form'));
580
+ }
581
+ }
582
+ options.paramName = this._getParamName(options);
583
+ if (!options.url) {
584
+ options.url = options.form.prop('action') || location.href;
585
+ }
586
+ // The HTTP request method must be "POST" or "PUT":
587
+ options.type = (options.type ||
588
+ ($.type(options.form.prop('method')) === 'string' &&
589
+ options.form.prop('method')) || ''
590
+ ).toUpperCase();
591
+ if (options.type !== 'POST' && options.type !== 'PUT' &&
592
+ options.type !== 'PATCH') {
593
+ options.type = 'POST';
594
+ }
595
+ if (!options.formAcceptCharset) {
596
+ options.formAcceptCharset = options.form.attr('accept-charset');
597
+ }
598
+ },
599
+
600
+ _getAJAXSettings: function (data) {
601
+ var options = $.extend({}, this.options, data);
602
+ this._initFormSettings(options);
603
+ this._initDataSettings(options);
604
+ return options;
605
+ },
606
+
607
+ // jQuery 1.6 doesn't provide .state(),
608
+ // while jQuery 1.8+ removed .isRejected() and .isResolved():
609
+ _getDeferredState: function (deferred) {
610
+ if (deferred.state) {
611
+ return deferred.state();
612
+ }
613
+ if (deferred.isResolved()) {
614
+ return 'resolved';
615
+ }
616
+ if (deferred.isRejected()) {
617
+ return 'rejected';
618
+ }
619
+ return 'pending';
620
+ },
621
+
622
+ // Maps jqXHR callbacks to the equivalent
623
+ // methods of the given Promise object:
624
+ _enhancePromise: function (promise) {
625
+ promise.success = promise.done;
626
+ promise.error = promise.fail;
627
+ promise.complete = promise.always;
628
+ return promise;
629
+ },
630
+
631
+ // Creates and returns a Promise object enhanced with
632
+ // the jqXHR methods abort, success, error and complete:
633
+ _getXHRPromise: function (resolveOrReject, context, args) {
634
+ var dfd = $.Deferred(),
635
+ promise = dfd.promise();
636
+ context = context || this.options.context || promise;
637
+ if (resolveOrReject === true) {
638
+ dfd.resolveWith(context, args);
639
+ } else if (resolveOrReject === false) {
640
+ dfd.rejectWith(context, args);
641
+ }
642
+ promise.abort = dfd.promise;
643
+ return this._enhancePromise(promise);
644
+ },
645
+
646
+ // Adds convenience methods to the data callback argument:
647
+ _addConvenienceMethods: function (e, data) {
648
+ var that = this,
649
+ getPromise = function (args) {
650
+ return $.Deferred().resolveWith(that, args).promise();
651
+ };
652
+ data.process = function (resolveFunc, rejectFunc) {
653
+ if (resolveFunc || rejectFunc) {
654
+ data._processQueue = this._processQueue =
655
+ (this._processQueue || getPromise([this])).then(
656
+ function () {
657
+ if (data.errorThrown) {
658
+ return $.Deferred()
659
+ .rejectWith(that, [data]).promise();
660
+ }
661
+ return getPromise(arguments);
662
+ }
663
+ ).then(resolveFunc, rejectFunc);
664
+ }
665
+ return this._processQueue || getPromise([this]);
666
+ };
667
+ data.submit = function () {
668
+ if (this.state() !== 'pending') {
669
+ data.jqXHR = this.jqXHR =
670
+ (that._trigger(
671
+ 'submit',
672
+ $.Event('submit', {delegatedEvent: e}),
673
+ this
674
+ ) !== false) && that._onSend(e, this);
675
+ }
676
+ return this.jqXHR || that._getXHRPromise();
677
+ };
678
+ data.abort = function () {
679
+ if (this.jqXHR) {
680
+ return this.jqXHR.abort();
681
+ }
682
+ this.errorThrown = 'abort';
683
+ that._trigger('fail', null, this);
684
+ return that._getXHRPromise(false);
685
+ };
686
+ data.state = function () {
687
+ if (this.jqXHR) {
688
+ return that._getDeferredState(this.jqXHR);
689
+ }
690
+ if (this._processQueue) {
691
+ return that._getDeferredState(this._processQueue);
692
+ }
693
+ };
694
+ data.processing = function () {
695
+ return !this.jqXHR && this._processQueue && that
696
+ ._getDeferredState(this._processQueue) === 'pending';
697
+ };
698
+ data.progress = function () {
699
+ return this._progress;
700
+ };
701
+ data.response = function () {
702
+ return this._response;
703
+ };
704
+ },
705
+
706
+ // Parses the Range header from the server response
707
+ // and returns the uploaded bytes:
708
+ _getUploadedBytes: function (jqXHR) {
709
+ var range = jqXHR.getResponseHeader('Range'),
710
+ parts = range && range.split('-'),
711
+ upperBytesPos = parts && parts.length > 1 &&
712
+ parseInt(parts[1], 10);
713
+ return upperBytesPos && upperBytesPos + 1;
714
+ },
715
+
716
+ // Uploads a file in multiple, sequential requests
717
+ // by splitting the file up in multiple blob chunks.
718
+ // If the second parameter is true, only tests if the file
719
+ // should be uploaded in chunks, but does not invoke any
720
+ // upload requests:
721
+ _chunkedUpload: function (options, testOnly) {
722
+ options.uploadedBytes = options.uploadedBytes || 0;
723
+ var that = this,
724
+ file = options.files[0],
725
+ fs = file.size,
726
+ ub = options.uploadedBytes,
727
+ mcs = options.maxChunkSize || fs,
728
+ slice = this._blobSlice,
729
+ dfd = $.Deferred(),
730
+ promise = dfd.promise(),
731
+ jqXHR,
732
+ upload;
733
+ if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
734
+ options.data) {
735
+ return false;
736
+ }
737
+ if (testOnly) {
738
+ return true;
739
+ }
740
+ if (ub >= fs) {
741
+ file.error = options.i18n('uploadedBytes');
742
+ return this._getXHRPromise(
743
+ false,
744
+ options.context,
745
+ [null, 'error', file.error]
746
+ );
747
+ }
748
+ // The chunk upload method:
749
+ upload = function () {
750
+ // Clone the options object for each chunk upload:
751
+ var o = $.extend({}, options),
752
+ currentLoaded = o._progress.loaded;
753
+ o.blob = slice.call(
754
+ file,
755
+ ub,
756
+ ub + mcs,
757
+ file.type
758
+ );
759
+ // Store the current chunk size, as the blob itself
760
+ // will be dereferenced after data processing:
761
+ o.chunkSize = o.blob.size;
762
+ // Expose the chunk bytes position range:
763
+ o.contentRange = 'bytes ' + ub + '-' +
764
+ (ub + o.chunkSize - 1) + '/' + fs;
765
+ // Process the upload data (the blob and potential form data):
766
+ that._initXHRData(o);
767
+ // Add progress listeners for this chunk upload:
768
+ that._initProgressListener(o);
769
+ jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
770
+ that._getXHRPromise(false, o.context))
771
+ .done(function (result, textStatus, jqXHR) {
772
+ ub = that._getUploadedBytes(jqXHR) ||
773
+ (ub + o.chunkSize);
774
+ // Create a progress event if no final progress event
775
+ // with loaded equaling total has been triggered
776
+ // for this chunk:
777
+ if (currentLoaded + o.chunkSize - o._progress.loaded) {
778
+ that._onProgress($.Event('progress', {
779
+ lengthComputable: true,
780
+ loaded: ub - o.uploadedBytes,
781
+ total: ub - o.uploadedBytes
782
+ }), o);
783
+ }
784
+ options.uploadedBytes = o.uploadedBytes = ub;
785
+ o.result = result;
786
+ o.textStatus = textStatus;
787
+ o.jqXHR = jqXHR;
788
+ that._trigger('chunkdone', null, o);
789
+ that._trigger('chunkalways', null, o);
790
+ if (ub < fs) {
791
+ // File upload not yet complete,
792
+ // continue with the next chunk:
793
+ upload();
794
+ } else {
795
+ dfd.resolveWith(
796
+ o.context,
797
+ [result, textStatus, jqXHR]
798
+ );
799
+ }
800
+ })
801
+ .fail(function (jqXHR, textStatus, errorThrown) {
802
+ o.jqXHR = jqXHR;
803
+ o.textStatus = textStatus;
804
+ o.errorThrown = errorThrown;
805
+ that._trigger('chunkfail', null, o);
806
+ that._trigger('chunkalways', null, o);
807
+ dfd.rejectWith(
808
+ o.context,
809
+ [jqXHR, textStatus, errorThrown]
810
+ );
811
+ });
812
+ };
813
+ this._enhancePromise(promise);
814
+ promise.abort = function () {
815
+ return jqXHR.abort();
816
+ };
817
+ upload();
818
+ return promise;
819
+ },
820
+
821
+ _beforeSend: function (e, data) {
822
+ if (this._active === 0) {
823
+ // the start callback is triggered when an upload starts
824
+ // and no other uploads are currently running,
825
+ // equivalent to the global ajaxStart event:
826
+ this._trigger('start');
827
+ // Set timer for global bitrate progress calculation:
828
+ this._bitrateTimer = new this._BitrateTimer();
829
+ // Reset the global progress values:
830
+ this._progress.loaded = this._progress.total = 0;
831
+ this._progress.bitrate = 0;
832
+ }
833
+ // Make sure the container objects for the .response() and
834
+ // .progress() methods on the data object are available
835
+ // and reset to their initial state:
836
+ this._initResponseObject(data);
837
+ this._initProgressObject(data);
838
+ data._progress.loaded = data.loaded = data.uploadedBytes || 0;
839
+ data._progress.total = data.total = this._getTotal(data.files) || 1;
840
+ data._progress.bitrate = data.bitrate = 0;
841
+ this._active += 1;
842
+ // Initialize the global progress values:
843
+ this._progress.loaded += data.loaded;
844
+ this._progress.total += data.total;
845
+ },
846
+
847
+ _onDone: function (result, textStatus, jqXHR, options) {
848
+ var total = options._progress.total,
849
+ response = options._response;
850
+ if (options._progress.loaded < total) {
851
+ // Create a progress event if no final progress event
852
+ // with loaded equaling total has been triggered:
853
+ this._onProgress($.Event('progress', {
854
+ lengthComputable: true,
855
+ loaded: total,
856
+ total: total
857
+ }), options);
858
+ }
859
+ response.result = options.result = result;
860
+ response.textStatus = options.textStatus = textStatus;
861
+ response.jqXHR = options.jqXHR = jqXHR;
862
+ this._trigger('done', null, options);
863
+ },
864
+
865
+ _onFail: function (jqXHR, textStatus, errorThrown, options) {
866
+ var response = options._response;
867
+ if (options.recalculateProgress) {
868
+ // Remove the failed (error or abort) file upload from
869
+ // the global progress calculation:
870
+ this._progress.loaded -= options._progress.loaded;
871
+ this._progress.total -= options._progress.total;
872
+ }
873
+ response.jqXHR = options.jqXHR = jqXHR;
874
+ response.textStatus = options.textStatus = textStatus;
875
+ response.errorThrown = options.errorThrown = errorThrown;
876
+ this._trigger('fail', null, options);
877
+ },
878
+
879
+ _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
880
+ // jqXHRorResult, textStatus and jqXHRorError are added to the
881
+ // options object via done and fail callbacks
882
+ this._trigger('always', null, options);
883
+ },
884
+
885
+ _onSend: function (e, data) {
886
+ if (!data.submit) {
887
+ this._addConvenienceMethods(e, data);
888
+ }
889
+ var that = this,
890
+ jqXHR,
891
+ aborted,
892
+ slot,
893
+ pipe,
894
+ options = that._getAJAXSettings(data),
895
+ send = function () {
896
+ that._sending += 1;
897
+ // Set timer for bitrate progress calculation:
898
+ options._bitrateTimer = new that._BitrateTimer();
899
+ jqXHR = jqXHR || (
900
+ ((aborted || that._trigger(
901
+ 'send',
902
+ $.Event('send', {delegatedEvent: e}),
903
+ options
904
+ ) === false) &&
905
+ that._getXHRPromise(false, options.context, aborted)) ||
906
+ that._chunkedUpload(options) || $.ajax(options)
907
+ ).done(function (result, textStatus, jqXHR) {
908
+ that._onDone(result, textStatus, jqXHR, options);
909
+ }).fail(function (jqXHR, textStatus, errorThrown) {
910
+ that._onFail(jqXHR, textStatus, errorThrown, options);
911
+ }).always(function (jqXHRorResult, textStatus, jqXHRorError) {
912
+ that._onAlways(
913
+ jqXHRorResult,
914
+ textStatus,
915
+ jqXHRorError,
916
+ options
917
+ );
918
+ that._sending -= 1;
919
+ that._active -= 1;
920
+ if (options.limitConcurrentUploads &&
921
+ options.limitConcurrentUploads > that._sending) {
922
+ // Start the next queued upload,
923
+ // that has not been aborted:
924
+ var nextSlot = that._slots.shift();
925
+ while (nextSlot) {
926
+ if (that._getDeferredState(nextSlot) === 'pending') {
927
+ nextSlot.resolve();
928
+ break;
929
+ }
930
+ nextSlot = that._slots.shift();
931
+ }
932
+ }
933
+ if (that._active === 0) {
934
+ // The stop callback is triggered when all uploads have
935
+ // been completed, equivalent to the global ajaxStop event:
936
+ that._trigger('stop');
937
+ }
938
+ });
939
+ return jqXHR;
940
+ };
941
+ this._beforeSend(e, options);
942
+ if (this.options.sequentialUploads ||
943
+ (this.options.limitConcurrentUploads &&
944
+ this.options.limitConcurrentUploads <= this._sending)) {
945
+ if (this.options.limitConcurrentUploads > 1) {
946
+ slot = $.Deferred();
947
+ this._slots.push(slot);
948
+ pipe = slot.then(send);
949
+ } else {
950
+ this._sequence = this._sequence.then(send, send);
951
+ pipe = this._sequence;
952
+ }
953
+ // Return the piped Promise object, enhanced with an abort method,
954
+ // which is delegated to the jqXHR object of the current upload,
955
+ // and jqXHR callbacks mapped to the equivalent Promise methods:
956
+ pipe.abort = function () {
957
+ aborted = [undefined, 'abort', 'abort'];
958
+ if (!jqXHR) {
959
+ if (slot) {
960
+ slot.rejectWith(options.context, aborted);
961
+ }
962
+ return send();
963
+ }
964
+ return jqXHR.abort();
965
+ };
966
+ return this._enhancePromise(pipe);
967
+ }
968
+ return send();
969
+ },
970
+
971
+ _onAdd: function (e, data) {
972
+ var that = this,
973
+ result = true,
974
+ options = $.extend({}, this.options, data),
975
+ files = data.files,
976
+ filesLength = files.length,
977
+ limit = options.limitMultiFileUploads,
978
+ limitSize = options.limitMultiFileUploadSize,
979
+ overhead = options.limitMultiFileUploadSizeOverhead,
980
+ batchSize = 0,
981
+ paramName = this._getParamName(options),
982
+ paramNameSet,
983
+ paramNameSlice,
984
+ fileSet,
985
+ i,
986
+ j = 0;
987
+ if (!filesLength) {
988
+ return false;
989
+ }
990
+ if (limitSize && files[0].size === undefined) {
991
+ limitSize = undefined;
992
+ }
993
+ if (!(options.singleFileUploads || limit || limitSize) ||
994
+ !this._isXHRUpload(options)) {
995
+ fileSet = [files];
996
+ paramNameSet = [paramName];
997
+ } else if (!(options.singleFileUploads || limitSize) && limit) {
998
+ fileSet = [];
999
+ paramNameSet = [];
1000
+ for (i = 0; i < filesLength; i += limit) {
1001
+ fileSet.push(files.slice(i, i + limit));
1002
+ paramNameSlice = paramName.slice(i, i + limit);
1003
+ if (!paramNameSlice.length) {
1004
+ paramNameSlice = paramName;
1005
+ }
1006
+ paramNameSet.push(paramNameSlice);
1007
+ }
1008
+ } else if (!options.singleFileUploads && limitSize) {
1009
+ fileSet = [];
1010
+ paramNameSet = [];
1011
+ for (i = 0; i < filesLength; i = i + 1) {
1012
+ batchSize += files[i].size + overhead;
1013
+ if (i + 1 === filesLength ||
1014
+ ((batchSize + files[i + 1].size + overhead) > limitSize) ||
1015
+ (limit && i + 1 - j >= limit)) {
1016
+ fileSet.push(files.slice(j, i + 1));
1017
+ paramNameSlice = paramName.slice(j, i + 1);
1018
+ if (!paramNameSlice.length) {
1019
+ paramNameSlice = paramName;
1020
+ }
1021
+ paramNameSet.push(paramNameSlice);
1022
+ j = i + 1;
1023
+ batchSize = 0;
1024
+ }
1025
+ }
1026
+ } else {
1027
+ paramNameSet = paramName;
1028
+ }
1029
+ data.originalFiles = files;
1030
+ $.each(fileSet || files, function (index, element) {
1031
+ var newData = $.extend({}, data);
1032
+ newData.files = fileSet ? element : [element];
1033
+ newData.paramName = paramNameSet[index];
1034
+ that._initResponseObject(newData);
1035
+ that._initProgressObject(newData);
1036
+ that._addConvenienceMethods(e, newData);
1037
+ result = that._trigger(
1038
+ 'add',
1039
+ $.Event('add', {delegatedEvent: e}),
1040
+ newData
1041
+ );
1042
+ return result;
1043
+ });
1044
+ return result;
1045
+ },
1046
+
1047
+ _replaceFileInput: function (data) {
1048
+ var input = data.fileInput,
1049
+ inputClone = input.clone(true),
1050
+ restoreFocus = input.is(document.activeElement);
1051
+ // Add a reference for the new cloned file input to the data argument:
1052
+ data.fileInputClone = inputClone;
1053
+ $('<form></form>').append(inputClone)[0].reset();
1054
+ // Detaching allows to insert the fileInput on another form
1055
+ // without loosing the file input value:
1056
+ input.after(inputClone).detach();
1057
+ // If the fileInput had focus before it was detached,
1058
+ // restore focus to the inputClone.
1059
+ if (restoreFocus) {
1060
+ inputClone.focus();
1061
+ }
1062
+ // Avoid memory leaks with the detached file input:
1063
+ $.cleanData(input.unbind('remove'));
1064
+ // Replace the original file input element in the fileInput
1065
+ // elements set with the clone, which has been copied including
1066
+ // event handlers:
1067
+ this.options.fileInput = this.options.fileInput.map(function (i, el) {
1068
+ if (el === input[0]) {
1069
+ return inputClone[0];
1070
+ }
1071
+ return el;
1072
+ });
1073
+ // If the widget has been initialized on the file input itself,
1074
+ // override this.element with the file input clone:
1075
+ if (input[0] === this.element[0]) {
1076
+ this.element = inputClone;
1077
+ }
1078
+ },
1079
+
1080
+ _handleFileTreeEntry: function (entry, path) {
1081
+ var that = this,
1082
+ dfd = $.Deferred(),
1083
+ entries = [],
1084
+ dirReader,
1085
+ errorHandler = function (e) {
1086
+ if (e && !e.entry) {
1087
+ e.entry = entry;
1088
+ }
1089
+ // Since $.when returns immediately if one
1090
+ // Deferred is rejected, we use resolve instead.
1091
+ // This allows valid files and invalid items
1092
+ // to be returned together in one set:
1093
+ dfd.resolve([e]);
1094
+ },
1095
+ successHandler = function (entries) {
1096
+ that._handleFileTreeEntries(
1097
+ entries,
1098
+ path + entry.name + '/'
1099
+ ).done(function (files) {
1100
+ dfd.resolve(files);
1101
+ }).fail(errorHandler);
1102
+ },
1103
+ readEntries = function () {
1104
+ dirReader.readEntries(function (results) {
1105
+ if (!results.length) {
1106
+ successHandler(entries);
1107
+ } else {
1108
+ entries = entries.concat(results);
1109
+ readEntries();
1110
+ }
1111
+ }, errorHandler);
1112
+ };
1113
+ path = path || '';
1114
+ if (entry.isFile) {
1115
+ if (entry._file) {
1116
+ // Workaround for Chrome bug #149735
1117
+ entry._file.relativePath = path;
1118
+ dfd.resolve(entry._file);
1119
+ } else {
1120
+ entry.file(function (file) {
1121
+ file.relativePath = path;
1122
+ dfd.resolve(file);
1123
+ }, errorHandler);
1124
+ }
1125
+ } else if (entry.isDirectory) {
1126
+ dirReader = entry.createReader();
1127
+ readEntries();
1128
+ } else {
1129
+ // Return an empy list for file system items
1130
+ // other than files or directories:
1131
+ dfd.resolve([]);
1132
+ }
1133
+ return dfd.promise();
1134
+ },
1135
+
1136
+ _handleFileTreeEntries: function (entries, path) {
1137
+ var that = this;
1138
+ return $.when.apply(
1139
+ $,
1140
+ $.map(entries, function (entry) {
1141
+ return that._handleFileTreeEntry(entry, path);
1142
+ })
1143
+ ).then(function () {
1144
+ return Array.prototype.concat.apply(
1145
+ [],
1146
+ arguments
1147
+ );
1148
+ });
1149
+ },
1150
+
1151
+ _getDroppedFiles: function (dataTransfer) {
1152
+ dataTransfer = dataTransfer || {};
1153
+ var items = dataTransfer.items;
1154
+ if (items && items.length && (items[0].webkitGetAsEntry ||
1155
+ items[0].getAsEntry)) {
1156
+ return this._handleFileTreeEntries(
1157
+ $.map(items, function (item) {
1158
+ var entry;
1159
+ if (item.webkitGetAsEntry) {
1160
+ entry = item.webkitGetAsEntry();
1161
+ if (entry) {
1162
+ // Workaround for Chrome bug #149735:
1163
+ entry._file = item.getAsFile();
1164
+ }
1165
+ return entry;
1166
+ }
1167
+ return item.getAsEntry();
1168
+ })
1169
+ );
1170
+ }
1171
+ return $.Deferred().resolve(
1172
+ $.makeArray(dataTransfer.files)
1173
+ ).promise();
1174
+ },
1175
+
1176
+ _getSingleFileInputFiles: function (fileInput) {
1177
+ fileInput = $(fileInput);
1178
+ var entries = fileInput.prop('webkitEntries') ||
1179
+ fileInput.prop('entries'),
1180
+ files,
1181
+ value;
1182
+ if (entries && entries.length) {
1183
+ return this._handleFileTreeEntries(entries);
1184
+ }
1185
+ files = $.makeArray(fileInput.prop('files'));
1186
+ if (!files.length) {
1187
+ value = fileInput.prop('value');
1188
+ if (!value) {
1189
+ return $.Deferred().resolve([]).promise();
1190
+ }
1191
+ // If the files property is not available, the browser does not
1192
+ // support the File API and we add a pseudo File object with
1193
+ // the input value as name with path information removed:
1194
+ files = [{name: value.replace(/^.*\\/, '')}];
1195
+ } else if (files[0].name === undefined && files[0].fileName) {
1196
+ // File normalization for Safari 4 and Firefox 3:
1197
+ $.each(files, function (index, file) {
1198
+ file.name = file.fileName;
1199
+ file.size = file.fileSize;
1200
+ });
1201
+ }
1202
+ return $.Deferred().resolve(files).promise();
1203
+ },
1204
+
1205
+ _getFileInputFiles: function (fileInput) {
1206
+ if (!(fileInput instanceof $) || fileInput.length === 1) {
1207
+ return this._getSingleFileInputFiles(fileInput);
1208
+ }
1209
+ return $.when.apply(
1210
+ $,
1211
+ $.map(fileInput, this._getSingleFileInputFiles)
1212
+ ).then(function () {
1213
+ return Array.prototype.concat.apply(
1214
+ [],
1215
+ arguments
1216
+ );
1217
+ });
1218
+ },
1219
+
1220
+ _onChange: function (e) {
1221
+ var that = this,
1222
+ data = {
1223
+ fileInput: $(e.target),
1224
+ form: $(e.target.form)
1225
+ };
1226
+ this._getFileInputFiles(data.fileInput).always(function (files) {
1227
+ data.files = files;
1228
+ if (that.options.replaceFileInput) {
1229
+ that._replaceFileInput(data);
1230
+ }
1231
+ if (that._trigger(
1232
+ 'change',
1233
+ $.Event('change', {delegatedEvent: e}),
1234
+ data
1235
+ ) !== false) {
1236
+ that._onAdd(e, data);
1237
+ }
1238
+ });
1239
+ },
1240
+
1241
+ _onPaste: function (e) {
1242
+ var items = e.originalEvent && e.originalEvent.clipboardData &&
1243
+ e.originalEvent.clipboardData.items,
1244
+ data = {files: []};
1245
+ if (items && items.length) {
1246
+ $.each(items, function (index, item) {
1247
+ var file = item.getAsFile && item.getAsFile();
1248
+ if (file) {
1249
+ data.files.push(file);
1250
+ }
1251
+ });
1252
+ if (this._trigger(
1253
+ 'paste',
1254
+ $.Event('paste', {delegatedEvent: e}),
1255
+ data
1256
+ ) !== false) {
1257
+ this._onAdd(e, data);
1258
+ }
1259
+ }
1260
+ },
1261
+
1262
+ _onDrop: function (e) {
1263
+ e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
1264
+ var that = this,
1265
+ dataTransfer = e.dataTransfer,
1266
+ data = {};
1267
+ if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
1268
+ e.preventDefault();
1269
+ this._getDroppedFiles(dataTransfer).always(function (files) {
1270
+ data.files = files;
1271
+ if (that._trigger(
1272
+ 'drop',
1273
+ $.Event('drop', {delegatedEvent: e}),
1274
+ data
1275
+ ) !== false) {
1276
+ that._onAdd(e, data);
1277
+ }
1278
+ });
1279
+ }
1280
+ },
1281
+
1282
+ _onDragOver: getDragHandler('dragover'),
1283
+
1284
+ _onDragEnter: getDragHandler('dragenter'),
1285
+
1286
+ _onDragLeave: getDragHandler('dragleave'),
1287
+
1288
+ _initEventHandlers: function () {
1289
+ if (this._isXHRUpload(this.options)) {
1290
+ this._on(this.options.dropZone, {
1291
+ dragover: this._onDragOver,
1292
+ drop: this._onDrop,
1293
+ // event.preventDefault() on dragenter is required for IE10+:
1294
+ dragenter: this._onDragEnter,
1295
+ // dragleave is not required, but added for completeness:
1296
+ dragleave: this._onDragLeave
1297
+ });
1298
+ this._on(this.options.pasteZone, {
1299
+ paste: this._onPaste
1300
+ });
1301
+ }
1302
+ if ($.support.fileInput) {
1303
+ this._on(this.options.fileInput, {
1304
+ change: this._onChange
1305
+ });
1306
+ }
1307
+ },
1308
+
1309
+ _destroyEventHandlers: function () {
1310
+ this._off(this.options.dropZone, 'dragenter dragleave dragover drop');
1311
+ this._off(this.options.pasteZone, 'paste');
1312
+ this._off(this.options.fileInput, 'change');
1313
+ },
1314
+
1315
+ _destroy: function () {
1316
+ this._destroyEventHandlers();
1317
+ },
1318
+
1319
+ _setOption: function (key, value) {
1320
+ var reinit = $.inArray(key, this._specialOptions) !== -1;
1321
+ if (reinit) {
1322
+ this._destroyEventHandlers();
1323
+ }
1324
+ this._super(key, value);
1325
+ if (reinit) {
1326
+ this._initSpecialOptions();
1327
+ this._initEventHandlers();
1328
+ }
1329
+ },
1330
+
1331
+ _initSpecialOptions: function () {
1332
+ var options = this.options;
1333
+ if (options.fileInput === undefined) {
1334
+ options.fileInput = this.element.is('input[type="file"]') ?
1335
+ this.element : this.element.find('input[type="file"]');
1336
+ } else if (!(options.fileInput instanceof $)) {
1337
+ options.fileInput = $(options.fileInput);
1338
+ }
1339
+ if (!(options.dropZone instanceof $)) {
1340
+ options.dropZone = $(options.dropZone);
1341
+ }
1342
+ if (!(options.pasteZone instanceof $)) {
1343
+ options.pasteZone = $(options.pasteZone);
1344
+ }
1345
+ },
1346
+
1347
+ _getRegExp: function (str) {
1348
+ var parts = str.split('/'),
1349
+ modifiers = parts.pop();
1350
+ parts.shift();
1351
+ return new RegExp(parts.join('/'), modifiers);
1352
+ },
1353
+
1354
+ _isRegExpOption: function (key, value) {
1355
+ return key !== 'url' && $.type(value) === 'string' &&
1356
+ /^\/.*\/[igm]{0,3}$/.test(value);
1357
+ },
1358
+
1359
+ _initDataAttributes: function () {
1360
+ var that = this,
1361
+ options = this.options,
1362
+ data = this.element.data();
1363
+ // Initialize options set via HTML5 data-attributes:
1364
+ $.each(
1365
+ this.element[0].attributes,
1366
+ function (index, attr) {
1367
+ var key = attr.name.toLowerCase(),
1368
+ value;
1369
+ if (/^data-/.test(key)) {
1370
+ // Convert hyphen-ated key to camelCase:
1371
+ key = key.slice(5).replace(/-[a-z]/g, function (str) {
1372
+ return str.charAt(1).toUpperCase();
1373
+ });
1374
+ value = data[key];
1375
+ if (that._isRegExpOption(key, value)) {
1376
+ value = that._getRegExp(value);
1377
+ }
1378
+ options[key] = value;
1379
+ }
1380
+ }
1381
+ );
1382
+ },
1383
+
1384
+ _create: function () {
1385
+ this._initDataAttributes();
1386
+ this._initSpecialOptions();
1387
+ this._slots = [];
1388
+ this._sequence = this._getXHRPromise(true);
1389
+ this._sending = this._active = 0;
1390
+ this._initProgressObject(this);
1391
+ this._initEventHandlers();
1392
+ },
1393
+
1394
+ // This method is exposed to the widget API and allows to query
1395
+ // the number of active uploads:
1396
+ active: function () {
1397
+ return this._active;
1398
+ },
1399
+
1400
+ // This method is exposed to the widget API and allows to query
1401
+ // the widget upload progress.
1402
+ // It returns an object with loaded, total and bitrate properties
1403
+ // for the running uploads:
1404
+ progress: function () {
1405
+ return this._progress;
1406
+ },
1407
+
1408
+ // This method is exposed to the widget API and allows adding files
1409
+ // using the fileupload API. The data parameter accepts an object which
1410
+ // must have a files property and can contain additional options:
1411
+ // .fileupload('add', {files: filesList});
1412
+ add: function (data) {
1413
+ var that = this;
1414
+ if (!data || this.options.disabled) {
1415
+ return;
1416
+ }
1417
+ if (data.fileInput && !data.files) {
1418
+ this._getFileInputFiles(data.fileInput).always(function (files) {
1419
+ data.files = files;
1420
+ that._onAdd(null, data);
1421
+ });
1422
+ } else {
1423
+ data.files = $.makeArray(data.files);
1424
+ this._onAdd(null, data);
1425
+ }
1426
+ },
1427
+
1428
+ // This method is exposed to the widget API and allows sending files
1429
+ // using the fileupload API. The data parameter accepts an object which
1430
+ // must have a files or fileInput property and can contain additional options:
1431
+ // .fileupload('send', {files: filesList});
1432
+ // The method returns a Promise object for the file upload call.
1433
+ send: function (data) {
1434
+ if (data && !this.options.disabled) {
1435
+ if (data.fileInput && !data.files) {
1436
+ var that = this,
1437
+ dfd = $.Deferred(),
1438
+ promise = dfd.promise(),
1439
+ jqXHR,
1440
+ aborted;
1441
+ promise.abort = function () {
1442
+ aborted = true;
1443
+ if (jqXHR) {
1444
+ return jqXHR.abort();
1445
+ }
1446
+ dfd.reject(null, 'abort', 'abort');
1447
+ return promise;
1448
+ };
1449
+ this._getFileInputFiles(data.fileInput).always(
1450
+ function (files) {
1451
+ if (aborted) {
1452
+ return;
1453
+ }
1454
+ if (!files.length) {
1455
+ dfd.reject();
1456
+ return;
1457
+ }
1458
+ data.files = files;
1459
+ jqXHR = that._onSend(null, data);
1460
+ jqXHR.then(
1461
+ function (result, textStatus, jqXHR) {
1462
+ dfd.resolve(result, textStatus, jqXHR);
1463
+ },
1464
+ function (jqXHR, textStatus, errorThrown) {
1465
+ dfd.reject(jqXHR, textStatus, errorThrown);
1466
+ }
1467
+ );
1468
+ }
1469
+ );
1470
+ return this._enhancePromise(promise);
1471
+ }
1472
+ data.files = $.makeArray(data.files);
1473
+ if (data.files.length) {
1474
+ return this._onSend(null, data);
1475
+ }
1476
+ }
1477
+ return this._getXHRPromise(false, data && data.context);
1478
+ }
1479
+
1480
+ });
1481
+
1482
+ }));