redditor 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +27 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +8 -0
  5. data/Gemfile +23 -0
  6. data/Guardfile +24 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +16 -0
  9. data/Rakefile +23 -0
  10. data/app/assets/images/redditor/.keep +0 -0
  11. data/app/assets/images/redditor/add_photo.png +0 -0
  12. data/app/assets/images/redditor/add_photo_big.png +0 -0
  13. data/app/assets/images/redditor/add_slider.png +0 -0
  14. data/app/assets/images/redditor/add_slider_big.png +0 -0
  15. data/app/assets/images/redditor/add_txt.png +0 -0
  16. data/app/assets/images/redditor/add_txt_big.png +0 -0
  17. data/app/assets/images/redditor/add_video.png +0 -0
  18. data/app/assets/images/redditor/add_video_big.png +0 -0
  19. data/app/assets/images/redditor/destroy_block_text.png +0 -0
  20. data/app/assets/images/redditor/move_handler.png +0 -0
  21. data/app/assets/images/redditor/no_format_text.png +0 -0
  22. data/app/assets/images/redditor/trash.png +0 -0
  23. data/app/assets/javascripts/fileapi/FileAPI.exif.js +59 -0
  24. data/app/assets/javascripts/fileapi/FileAPI.flash.image.swf +0 -0
  25. data/app/assets/javascripts/fileapi/FileAPI.flash.swf +0 -0
  26. data/app/assets/javascripts/fileapi/FileAPI.id3.js +67 -0
  27. data/app/assets/javascripts/fileapi/FileAPI.min.js +73 -0
  28. data/app/assets/javascripts/fileapi/fileapi.js.coffee.erb +12 -0
  29. data/app/assets/javascripts/fileapi/tmpl.js +35 -0
  30. data/app/assets/javascripts/fileapi/uploader.coffee +139 -0
  31. data/app/assets/javascripts/jquery-ui.min.js +12 -0
  32. data/app/assets/javascripts/redditor/application.js +14 -0
  33. data/app/assets/javascripts/redditor/fileapi/FileAPI.exif.js +59 -0
  34. data/app/assets/javascripts/redditor/fileapi/FileAPI.flash.image.swf +0 -0
  35. data/app/assets/javascripts/redditor/fileapi/FileAPI.flash.swf +0 -0
  36. data/app/assets/javascripts/redditor/fileapi/FileAPI.id3.js +67 -0
  37. data/app/assets/javascripts/redditor/fileapi/FileAPI.min.js +72 -0
  38. data/app/assets/javascripts/redditor/fileapi/README.md +724 -0
  39. data/app/assets/javascripts/redditor/fileapi/config.js.coffee.erb +5 -0
  40. data/app/assets/javascripts/redditor/fileapi/crossdomain.xml +19 -0
  41. data/app/assets/javascripts/redditor/fileapi/example.userpic.html +212 -0
  42. data/app/assets/javascripts/redditor/fileapi/index.html +548 -0
  43. data/app/assets/javascripts/redditor/fileapi/mailru.js +6 -0
  44. data/app/assets/javascripts/redditor/fileapi/mailru_front.js.coffee +143 -0
  45. data/app/assets/javascripts/redditor/fileapi/tmpl.js +35 -0
  46. data/app/assets/javascripts/redditor/fileapi/uploader.coffee +139 -0
  47. data/app/assets/javascripts/redditor/redditor.coffee +148 -0
  48. data/app/assets/stylesheets/redditor/application.css.scss +47 -0
  49. data/app/assets/stylesheets/redditor/fileapi/fileapi.css.scss +174 -0
  50. data/app/assets/stylesheets/redditor/fileapi/fileapi_front.css.scss +175 -0
  51. data/app/assets/stylesheets/redditor/redditor.css.scss +108 -0
  52. data/app/controllers/redditor/admin/base_controller.rb +18 -0
  53. data/app/controllers/redditor/admin/image_blocks_controller.rb +37 -0
  54. data/app/controllers/redditor/admin/images_controller.rb +33 -0
  55. data/app/controllers/redditor/admin/pages_controller.rb +15 -0
  56. data/app/controllers/redditor/admin/slider_blocks_controller.rb +32 -0
  57. data/app/controllers/redditor/admin/text_blocks_controller.rb +31 -0
  58. data/app/controllers/redditor/admin/video_blocks_controller.rb +31 -0
  59. data/app/controllers/redditor/application_controller.rb +4 -0
  60. data/app/helpers/redditor/application_helper.rb +4 -0
  61. data/app/helpers/redditor/fileapi_helper.rb +17 -0
  62. data/app/helpers/redditor/pages_helper.rb +24 -0
  63. data/app/models/redditor/content_block.rb +24 -0
  64. data/app/models/redditor/image.rb +29 -0
  65. data/app/models/redditor/page.rb +28 -0
  66. data/app/models/redditor/slider_block.rb +17 -0
  67. data/app/models/redditor/text_block.rb +20 -0
  68. data/app/models/redditor/video_block.rb +27 -0
  69. data/app/uploaders/redditor_uploader.rb +57 -0
  70. data/app/views/layouts/redditor/application.html.erb +15 -0
  71. data/app/views/redditor/admin/pages/_content_block.haml +16 -0
  72. data/app/views/redditor/admin/pages/_fileapi.erb +199 -0
  73. data/app/views/redditor/admin/pages/_image.haml +18 -0
  74. data/app/views/redditor/admin/pages/_page.haml +13 -0
  75. data/app/views/redditor/admin/pages/_slider_block.haml +16 -0
  76. data/app/views/redditor/admin/pages/_slider_block_image.haml +3 -0
  77. data/app/views/redditor/admin/pages/_text_block.haml +5 -0
  78. data/app/views/redditor/admin/pages/_validate.haml +4 -0
  79. data/app/views/redditor/admin/pages/_video_block.haml +19 -0
  80. data/app/views/redditor/admin/pages/_wrap_dd.haml +1 -0
  81. data/app/views/redditor/admin/pages/_wrapper.haml +3 -0
  82. data/app/views/redditor/admin/pages/new.js.coffee +7 -0
  83. data/app/views/redditor/admin/pages/new.js.erb +7 -0
  84. data/app/views/redditor/admin/pages/slider_block_image.js.coffee +2 -0
  85. data/app/views/redditor/admin/pages/wrapper.js.coffee +6 -0
  86. data/app/views/redditor/pages/_page.html.haml +1 -0
  87. data/app/views/redditor/slider_blocks/_slider_block.html.haml +2 -0
  88. data/app/views/redditor/slider_blocks/_slider_block_image.html.erb +3 -0
  89. data/app/views/redditor/text_blocks/_text_block.html.haml +1 -0
  90. data/app/views/redditor/video_blocks/_video_block.html.haml +2 -0
  91. data/bin/rails +8 -0
  92. data/config/locales/redditor.en.yml +20 -0
  93. data/config/locales/redditor.ru.yml +20 -0
  94. data/config/routes.rb +17 -0
  95. data/db/migrate/20130916155124_create_redditor_images.rb +15 -0
  96. data/db/migrate/20130916155156_create_redditor_pages.rb +12 -0
  97. data/db/migrate/20130916155219_create_redditor_slider_blocks.rb +11 -0
  98. data/db/migrate/20130916155239_create_redditor_text_blocks.rb +12 -0
  99. data/db/migrate/20130916155301_create_redditor_video_blocks.rb +14 -0
  100. data/lib/generators/redditor/views/views_generator.rb +17 -0
  101. data/lib/redditor/engine.rb +12 -0
  102. data/lib/redditor/has_redditor.rb +17 -0
  103. data/lib/redditor/version.rb +3 -0
  104. data/lib/redditor.rb +9 -0
  105. data/lib/tasks/redditor_tasks.rake +4 -0
  106. data/redditor.gemspec +38 -0
  107. data/spec/dummy/.rspec +1 -0
  108. data/spec/dummy/README.rdoc +28 -0
  109. data/spec/dummy/Rakefile +6 -0
  110. data/spec/dummy/app/assets/images/.keep +0 -0
  111. data/spec/dummy/app/assets/javascripts/application.js +17 -0
  112. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  113. data/spec/dummy/app/controllers/admin/articles_controller.rb +23 -0
  114. data/spec/dummy/app/controllers/admin/base_controller.rb +6 -0
  115. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  116. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  117. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  118. data/spec/dummy/app/mailers/.keep +0 -0
  119. data/spec/dummy/app/models/.keep +0 -0
  120. data/spec/dummy/app/models/article.rb +7 -0
  121. data/spec/dummy/app/models/concerns/.keep +0 -0
  122. data/spec/dummy/app/views/admin/articles/edit.html.haml +15 -0
  123. data/spec/dummy/app/views/articles/show.html.haml +2 -0
  124. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  125. data/spec/dummy/bin/bundle +3 -0
  126. data/spec/dummy/bin/rails +4 -0
  127. data/spec/dummy/bin/rake +4 -0
  128. data/spec/dummy/config/application.rb +31 -0
  129. data/spec/dummy/config/boot.rb +5 -0
  130. data/spec/dummy/config/database.yml +25 -0
  131. data/spec/dummy/config/environment.rb +5 -0
  132. data/spec/dummy/config/environments/development.rb +29 -0
  133. data/spec/dummy/config/environments/production.rb +80 -0
  134. data/spec/dummy/config/environments/test.rb +36 -0
  135. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  136. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  137. data/spec/dummy/config/initializers/inflections.rb +16 -0
  138. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  139. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  140. data/spec/dummy/config/initializers/session_store.rb +3 -0
  141. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  142. data/spec/dummy/config/locales/en.yml +23 -0
  143. data/spec/dummy/config/routes.rb +10 -0
  144. data/spec/dummy/config.ru +4 -0
  145. data/spec/dummy/db/migrate/20130908123351_create_articles.rb +9 -0
  146. data/spec/dummy/db/schema.rb +76 -0
  147. data/spec/dummy/lib/assets/.keep +0 -0
  148. data/spec/dummy/log/.keep +0 -0
  149. data/spec/dummy/public/404.html +58 -0
  150. data/spec/dummy/public/422.html +58 -0
  151. data/spec/dummy/public/500.html +57 -0
  152. data/spec/dummy/public/favicon.ico +0 -0
  153. data/spec/factories/articles_factory.rb +27 -0
  154. data/spec/factories/redditor/images_factory.rb +9 -0
  155. data/spec/factories/redditor/pages_factory.rb +37 -0
  156. data/spec/factories/redditor/sliders_factory.rb +9 -0
  157. data/spec/factories/redditor/texts_factory.rb +5 -0
  158. data/spec/factories/redditor/videos_factories.rb +7 -0
  159. data/spec/features/text_spec.rb +52 -0
  160. data/spec/features/video_spec.rb +52 -0
  161. data/spec/fixtures/test.jpg +0 -0
  162. data/spec/generators/views_generator_spec.rb +20 -0
  163. data/spec/models/article_spec.rb +40 -0
  164. data/spec/spec_helper.rb +67 -0
  165. data/spec/views/article/show_spec.rb +22 -0
  166. metadata +480 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a5cc6f227c8f5bf2200af8694fabe9fb7b002a6f
4
+ data.tar.gz: 6bbaa3217f754c32c85c63cf94f2f8f4ad3a1175
5
+ SHA512:
6
+ metadata.gz: 2eff66ed2cd0c49aabc30623f6e6f03e9fbe249e17d87c35f16680d5375ffac5bb8a0b5f50471d028d6d75f40a8624b9600e7377d0f82c6a69dac9ec70f34f64
7
+ data.tar.gz: f9c0679bf8b2adeedd2e4649d3b8dd8b648967ead1111bcd2a2e9f78e12d4e5ad3d57d0a1c8fbb1bf6484eb8945a43ab97eddcdcb156b86cb5949382d6e2095a
data/.gitignore ADDED
@@ -0,0 +1,27 @@
1
+ *.DS_Store
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ /.rvmrc
20
+ /.ruby-version
21
+ /.ruby-gemset
22
+
23
+ /spec/dummy/public/uploads
24
+ /spec/dummy/log
25
+ /spec/dummy/db/*sqlite3
26
+
27
+ /spec/dummy/db/development.sqlite3
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ script: bundle exec rspec
2
+ language: ruby
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ before_script:
7
+ - "rake db:create RAILS_ENV=test"
8
+ - "rake db:migrate RAILS_ENV=test"
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ source "https://rubygems.org"
2
+
3
+
4
+ gem 'carrierwave'
5
+ gem 'rmagick'
6
+ gem 'haml-rails'
7
+ gem 'haml'
8
+ gem 'coffee-rails'
9
+ gem 'jquery-rails'
10
+ gem 'sass-rails'
11
+ gem 'compass-rails', github: 'milgner/compass-rails', ref: '1749c06f15dc4b058427e7969810457213647fb8'
12
+ # Declare your gem's dependencies in redditor.gemspec.
13
+ # Bundler will treat runtime dependencies like base dependencies, and
14
+ # development dependencies will be added by default to the :development group.
15
+ gemspec
16
+
17
+ # Declare any dependencies that are still in development here instead of in
18
+ # your gemspec. These might include edge Rails or gems from your path or
19
+ # Git. Remember to move these dependencies to your gemspec before releasing
20
+ # your gem to rubygems.org.
21
+
22
+ # To use debugger
23
+ # gem 'debugger'
data/Guardfile ADDED
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
+
17
+ # Capybara features specs
18
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
+
20
+ # Turnip features and steps
21
+ watch(%r{^spec/acceptance/(.+)\.feature$})
22
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
+ end
24
+
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 Redde
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,16 @@
1
+ = Redditor
2
+
3
+ This project rocks and uses MIT-LICENSE.
4
+
5
+ ## Badges
6
+ [![Build Status](https://secure.travis-ci.org/redde/redditor.png)](http://travis-ci.org/redde/redditor)
7
+ [![Code Climate](https://codeclimate.com/github/redde/redditor.png)](https://codeclimate.com/github/redde/redditor)
8
+
9
+ В рельсе для форм, созданных через form_for
10
+ enctype="multipart/form-data"
11
+ прописывается автоматически, если в форме присутствует input file_field, но учитывая, что у нас в форме блок с картинкой изначально может отсутствовать, данный отрибут нужно прописать принудительно для формы в которую вы добавляете redditor
12
+ html: {multipart: true}
13
+
14
+ Вероятно, на multipart можно забить, если все загрузки будут происходить через fileapi
15
+ todo: проверить вариант загрузки через fileapi c последующим сохранением всей формы через submit.
16
+ Как вариат добавлять атрибут с помощью js
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Redditor'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
File without changes
@@ -0,0 +1,59 @@
1
+ (function (){
2
+ /**!
3
+ * Binary Ajax 0.1.10
4
+ * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/
5
+ * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
6
+ *
7
+ *
8
+ * Javascript EXIF Reader 0.1.4
9
+ * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/
10
+ * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
11
+ */
12
+
13
+
14
+ var BinaryFile=function(j,k,l){var h=j,i=k||0,b=0;this.getRawData=function(){return h};"string"==typeof j&&(b=l||h.length,this.getByteAt=function(a){return h.charCodeAt(a+i)&255},this.getBytesAt=function(a,b){for(var c=[],f=0;f<b;f++)c[f]=h.charCodeAt(a+f+i)&255;return c});this.getLength=function(){return b};this.getSByteAt=function(a){a=this.getByteAt(a);return 127<a?a-256:a};this.getShortAt=function(a,b){var c=b?(this.getByteAt(a)<<8)+this.getByteAt(a+1):(this.getByteAt(a+1)<<8)+this.getByteAt(a);
15
+ 0>c&&(c+=65536);return c};this.getSShortAt=function(a,b){var c=this.getShortAt(a,b);return 32767<c?c-65536:c};this.getLongAt=function(a,b){var c=this.getByteAt(a),f=this.getByteAt(a+1),e=this.getByteAt(a+2),g=this.getByteAt(a+3),c=b?(((c<<8)+f<<8)+e<<8)+g:(((g<<8)+e<<8)+f<<8)+c;0>c&&(c+=4294967296);return c};this.getSLongAt=function(a,b){var c=this.getLongAt(a,b);return 2147483647<c?c-4294967296:c};this.getStringAt=function(a,b){for(var c=[],f=this.getBytesAt(a,b),e=0;e<b;e++)c[e]=String.fromCharCode(f[e]);
16
+ return c.join("")};this.getCharAt=function(a){return String.fromCharCode(this.getByteAt(a))};this.toBase64=function(){return window.btoa(h)};this.fromBase64=function(a){h=window.atob(a)}},EXIF={};
17
+ (function(){function j(b){if(255!=b.getByteAt(0)||216!=b.getByteAt(1))return!1;for(var a=2,d=b.getLength();a<d;){if(255!=b.getByteAt(a))return i&&console.log("Not a valid marker at offset "+a+", found: "+b.getByteAt(a)),!1;var c=b.getByteAt(a+1);if(22400==c||225==c)return i&&console.log("Found 0xFFE1 marker"),h(b,a+4,b.getShortAt(a+2,!0)-2);a+=2+b.getShortAt(a+2,!0)}}function k(b,a,d,c,f){for(var e=b.getShortAt(d,f),g={},h=0;h<e;h++){var j=d+12*h+2,k=c[b.getShortAt(j,f)];!k&&i&&console.log("Unknown tag: "+
18
+ b.getShortAt(j,f));g[k]=l(b,j,a,d,f)}return g}function l(b,a,d,c,f){var e=b.getShortAt(a+2,f),c=b.getLongAt(a+4,f),d=b.getLongAt(a+8,f)+d;switch(e){case 1:case 7:if(1==c)return b.getByteAt(a+8,f);d=4<c?d:a+8;a=[];for(e=0;e<c;e++)a[e]=b.getByteAt(d+e);return a;case 2:return b.getStringAt(4<c?d:a+8,c-1);case 3:if(1==c)return b.getShortAt(a+8,f);d=2<c?d:a+8;a=[];for(e=0;e<c;e++)a[e]=b.getShortAt(d+2*e,f);return a;case 4:if(1==c)return b.getLongAt(a+8,f);a=[];for(e=0;e<c;e++)a[e]=b.getLongAt(d+4*e,f);
19
+ return a;case 5:if(1==c)return b.getLongAt(d,f)/b.getLongAt(d+4,f);a=[];for(e=0;e<c;e++)a[e]=b.getLongAt(d+8*e,f)/b.getLongAt(d+4+8*e,f);return a;case 9:if(1==c)return b.getSLongAt(a+8,f);a=[];for(e=0;e<c;e++)a[e]=b.getSLongAt(d+4*e,f);return a;case 10:if(1==c)return b.getSLongAt(d,f)/b.getSLongAt(d+4,f);a=[];for(e=0;e<c;e++)a[e]=b.getSLongAt(d+8*e,f)/b.getSLongAt(d+4+8*e,f);return a}}function h(b,a){if("Exif"!=b.getStringAt(a,4))return i&&console.log("Not valid EXIF data! "+b.getStringAt(a,4)),!1;
20
+ var d,c=a+6;if(18761==b.getShortAt(c))d=!1;else if(19789==b.getShortAt(c))d=!0;else return i&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;if(42!=b.getShortAt(c+2,d))return i&&console.log("Not valid TIFF data! (no 0x002A)"),!1;if(8!=b.getLongAt(c+4,d))return i&&console.log("Not valid TIFF data! (First offset not 8)",b.getShortAt(c+4,d)),!1;var f=k(b,c,c+8,EXIF.TiffTags,d);if(f.ExifIFDPointer){var e=k(b,c,c+f.ExifIFDPointer,EXIF.Tags,d),g;for(g in e){switch(g){case "LightSource":case "Flash":case "MeteringMode":case "ExposureProgram":case "SensingMethod":case "SceneCaptureType":case "SceneType":case "CustomRendered":case "WhiteBalance":case "GainControl":case "Contrast":case "Saturation":case "Sharpness":case "SubjectDistanceRange":case "FileSource":e[g]=
21
+ EXIF.StringValues[g][e[g]];break;case "ExifVersion":case "FlashpixVersion":e[g]=String.fromCharCode(e[g][0],e[g][1],e[g][2],e[g][3]);break;case "ComponentsConfiguration":e[g]=EXIF.StringValues.Components[e[g][0]]+EXIF.StringValues.Components[e[g][1]]+EXIF.StringValues.Components[e[g][2]]+EXIF.StringValues.Components[e[g][3]]}f[g]=e[g]}}if(f.GPSInfoIFDPointer)for(g in d=k(b,c,c+f.GPSInfoIFDPointer,EXIF.GPSTags,d),d){switch(g){case "GPSVersionID":d[g]=d[g][0]+"."+d[g][1]+"."+d[g][2]+"."+d[g][3]}f[g]=
22
+ d[g]}return f}var i=!1;EXIF.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",
23
+ 34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",
24
+ 41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"};EXIF.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",
25
+ 259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",
26
+ 272:"Model",305:"Software",315:"Artist",33432:"Copyright"};EXIF.GPSTags={"0":"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",
27
+ 24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"};EXIF.StringValues={ExposureProgram:{"0":"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{"0":"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{"0":"Unknown",
28
+ 1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{"0":"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",
29
+ 7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",
30
+ 71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},
31
+ SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{"0":"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{"0":"Normal process",1:"Custom process"},WhiteBalance:{"0":"Auto white balance",1:"Manual white balance"},GainControl:{"0":"None",1:"Low gain up",2:"High gain up",
32
+ 3:"Low gain down",4:"High gain down"},Contrast:{"0":"Normal",1:"Soft",2:"Hard"},Saturation:{"0":"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{"0":"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{"0":"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{"0":"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};EXIF.getData=function(b,a){if(!b.complete)return!1;b.exifdata?a&&a():BinaryAjax(b.src,function(d){d=j(d.binaryResponse);b.exifdata=d||{};a&&a()});return!0};
33
+ EXIF.getTag=function(b,a){if(b.exifdata)return b.exifdata[a]};EXIF.getAllTags=function(b){if(!b.exifdata)return{};var b=b.exifdata,a={},d;for(d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);return a};EXIF.pretty=function(b){if(!b.exifdata)return"";var b=b.exifdata,a="",d;for(d in b)b.hasOwnProperty(d)&&(a="object"==typeof b[d]?a+(d+" : ["+b[d].length+" values]\r\n"):a+(d+" : "+b[d]+"\r\n"));return a};EXIF.readFromBinaryFile=function(b){return j(b)}})();
34
+
35
+
36
+ FileAPI.support.exif = true;
37
+
38
+
39
+ FileAPI.addInfoReader(/^image/, function (file/**File*/, callback/**Function*/){
40
+ if( !file.__exif ){
41
+ var defer = file.__exif = FileAPI.defer();
42
+
43
+ FileAPI.readAsBinaryString(file, function (evt){
44
+ if( evt.type == 'load' ){
45
+ var binaryString = evt.result;
46
+ var oFile = new BinaryFile(binaryString, 0, file.size);
47
+ var exif = EXIF.readFromBinaryFile(oFile);
48
+
49
+ defer.resolve(false, { 'exif': exif || {} });
50
+ }
51
+ else if( evt.type == 'error' ){
52
+ defer.resolve('read_as_binary_string_exif');
53
+ }
54
+ });
55
+ }
56
+
57
+ file.__exif.then(callback);
58
+ });
59
+ })();
@@ -0,0 +1,67 @@
1
+ (function (){
2
+ /**
3
+ * JavaScript ID3 Reader
4
+ * https://github.com/aadsm/JavaScript-ID3-Reader
5
+ *
6
+ * Authors
7
+ * Jacob Seidelin
8
+ * António Afonso
9
+ * Joshua Kifer
10
+ */
11
+
12
+ var x=!0,y=null;function z(a,b,d){function e(c){c=parseInt(c.getResponseHeader("Content-Length"),10)||-1;b(new h(a,c))}function f(){var c=y;window.XMLHttpRequest?c=new XMLHttpRequest:window.ActiveXObject&&(c=new ActiveXObject("Microsoft.XMLHTTP"));return c}function h(c,a){var b,g;function e(c){var a=~~(c[0]/b)-g,c=~~(c[1]/b)+1+g;0>a&&(a=0);c>=blockTotal&&(c=blockTotal-1);return[a,c]}function h(e,g){function m(c){parseInt(c.getResponseHeader("Content-Length"),10)==a&&(e[0]=0,e[1]=blockTotal-1,i[0]=0,i[1]=a-1);for(var c=
13
+ {data:c.U||c.responseText,offset:i[0]},b=e[0];b<=e[1];b++)A[b]=c;l+=i[1]-i[0]+1;g&&g()}for(;A[e[0]];)if(e[0]++,e[0]>e[1]){g&&g();return}for(;A[e[1]];)if(e[1]--,e[0]>e[1]){g&&g();return}var i=[e[0]*b,(e[1]+1)*b-1],w=c,r=d,L=q,I=!!g,n=f();n?("undefined"===typeof I&&(I=x),m&&("undefined"!=typeof n.onload?n.onload=function(){"200"==n.status||"206"==n.status?(n.fileSize=L||n.getResponseHeader("Content-Length"),m(n)):r&&r();n=y}:n.onreadystatechange=function(){4==n.readyState&&("200"==n.status||"206"==
14
+ n.status?(n.fileSize=L||n.getResponseHeader("Content-Length"),m(n)):r&&r(),n=y)}),n.open("GET",w,I),n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),i&&n.setRequestHeader("Range","bytes="+i[0]+"-"+i[1]),n.setRequestHeader("If-Modified-Since","Sat, 1 Jan 1970 00:00:00 GMT"),n.send(y)):r&&r()}var q,l=0,w=new B("",0,a),A=[];b=b||2048;g="undefined"===typeof g?0:g;blockTotal=~~((a-1)/b)+1;for(var r in w)w.hasOwnProperty(r)&&"function"===typeof w[r]&&(this[r]=w[r]);this.a=function(c){var a;
15
+ h(e([c,c]));a=A[~~(c/b)];if("string"==typeof a.data)return a.data.charCodeAt(c-a.offset)&255;if("unknown"==typeof a.data)return IEBinary_getByteAt(a.data,c-a.offset)};this.L=function(){return l};this.g=function(c,a){h(e(c),a)}}var c=f();c&&(e&&("undefined"!=typeof c.onload?c.onload=function(){"200"==c.status&&e(this);c=y}:c.onreadystatechange=function(){4==c.readyState&&("200"==c.status&&e(this),c=y)}),c.open("HEAD",a,x),c.send(y))}
16
+ function B(a,b,d){var e=a,f=b||0,h=0;this.N=function(){return e};"string"==typeof a?(h=d||e.length,this.a=function(c){return e.charCodeAt(c+f)&255}):"unknown"==typeof a&&(h=d||IEBinary_getLength(e),this.a=function(c){return IEBinary_getByteAt(e,c+f)});this.m=function(c,a){for(var b=Array(a),d=0;d<a;d++)b[d]=this.a(c+d);return b};this.o=function(){return h};this.c=function(c,a){return 0!=(this.a(c)&1<<a)};this.O=function(c){c=this.a(c);return 127<c?c-256:c};this.p=function(c,a){var b=a?(this.a(c)<<
17
+ 8)+this.a(c+1):(this.a(c+1)<<8)+this.a(c);0>b&&(b+=65536);return b};this.Q=function(c,a){var b=this.p(c,a);return 32767<b?b-65536:b};this.h=function(c,a){var b=this.a(c),d=this.a(c+1),e=this.a(c+2),f=this.a(c+3),b=a?(((b<<8)+d<<8)+e<<8)+f:(((f<<8)+e<<8)+d<<8)+b;0>b&&(b+=4294967296);return b};this.P=function(c,a){var b=this.h(c,a);return 2147483647<b?b-4294967296:b};this.n=function(c){var a=this.a(c),b=this.a(c+1),c=this.a(c+2),a=((a<<8)+b<<8)+c;0>a&&(a+=16777216);return a};this.d=function(a,b){for(var d=
18
+ [],e=a,g=0;e<a+b;e++,g++)d[g]=String.fromCharCode(this.a(e));return d.join("")};this.e=function(a,b,d){a=this.m(a,b);switch(d.toLowerCase()){case "utf-16":case "utf-16le":case "utf-16be":var b=d,e,g=0,f=1,d=0;e=Math.min(e||a.length,a.length);254==a[0]&&255==a[1]?(b=x,g=2):255==a[0]&&254==a[1]&&(b=!1,g=2);b&&(f=0,d=1);for(var b=[],h=0;g<e;h++){var q=a[g+f],l=(q<<8)+a[g+d],g=g+2;if(0==l)break;else 216>q||224<=q?b[h]=String.fromCharCode(l):(q=(a[g+f]<<8)+a[g+d],g+=2,b[h]=String.fromCharCode(l,q))}a=
19
+ new String(b.join(""));a.f=g;break;case "utf-8":e=0;g=Math.min(g||a.length,a.length);239==a[0]&&(187==a[1]&&191==a[2])&&(e=3);f=[];for(d=0;e<g&&!(b=a[e++],0==b);d++)128>b?f[d]=String.fromCharCode(b):194<=b&&224>b?(h=a[e++],f[d]=String.fromCharCode(((b&31)<<6)+(h&63))):224<=b&&240>b?(h=a[e++],l=a[e++],f[d]=String.fromCharCode(((b&255)<<12)+((h&63)<<6)+(l&63))):240<=b&&245>b&&(h=a[e++],l=a[e++],q=a[e++],b=((b&7)<<18)+((h&63)<<12)+((l&63)<<6)+(q&63)-65536,f[d]=String.fromCharCode((b>>10)+55296,(b&1023)+
20
+ 56320));a=new String(f.join(""));a.f=e;break;default:g=[];f=f||a.length;for(e=0;e<f;){d=a[e++];if(0==d)break;g[e-1]=String.fromCharCode(d)}a=new String(g.join(""));a.f=e}return a};this.K=function(a){return String.fromCharCode(this.a(a))};this.X=function(){return window.btoa(e)};this.J=function(a){e=window.atob(a)};this.g=function(a,b){b()}}document.write("<script type='text/vbscript'>\r\nFunction IEBinary_getByteAt(strBinary, iOffset)\r\n\tIEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\nEnd Function\r\nFunction IEBinary_getLength(strBinary)\r\n\tIEBinary_getLength = LenB(strBinary)\r\nEnd Function\r\n<\/script>\r\n");this.FileAPIReader=function(a){return function(b,d){var e=new FileReader;e.onload=function(a){d(new B(a.target.result))};e.readAsBinaryString(a)}};this.Base64=this.j={i:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",w:function(a){for(var b="",d,e,f,h,c,k,v=0;v<a.length;)d=a[v++],e=a[v++],f=a[v++],h=d>>2,d=(d&3)<<4|e>>4,c=(e&15)<<2|f>>6,k=f&63,isNaN(e)?c=k=64:isNaN(f)&&(k=64),b=b+Base64.i.charAt(h)+Base64.i.charAt(d)+Base64.i.charAt(c)+Base64.i.charAt(k);return b}};this.j.encodeBytes=this.j.w;var C=this.s={},E={},F=[0,7];C.B=function(a,b,d){d=d||{};(d.dataReader||z)(a,function(e){e.g(F,function(){var f="ftypM4A"==e.d(4,7)?ID4:"ID3"==e.d(0,3)?ID3v2:ID3v1;f.q(e,function(){var h=d.tags,c=f.r(e,h),h=E[a]||{},k;for(k in c)c.hasOwnProperty(k)&&(h[k]=c[k]);E[a]=h;b&&b()})})})};C.z=function(a){if(!E[a])return y;var b={},d;for(d in E[a])E[a].hasOwnProperty(d)&&(b[d]=E[a][d]);return b};C.A=function(a,b){return!E[a]?y:E[a][b]};this.ID3=this.s;C.loadTags=C.B;C.getAllTags=C.z;C.getTag=C.A;
21
+ C.BinaryFile=B;this.ID3v1=this.t={};function G(a,b){var d=b.a(a),e=b.a(a+1),f=b.a(a+2);return b.a(a+3)&127|(f&127)<<7|(e&127)<<14|(d&127)<<21}var H=this.D={};H.b={};
22
+ H.frames={BUF:"Recommended buffer size",CNT:"Play counter",COM:"Comments",CRA:"Audio encryption",CRM:"Encrypted meta frame",ETC:"Event timing codes",EQU:"Equalization",GEO:"General encapsulated object",IPL:"Involved people list",LNK:"Linked information",MCI:"Music CD Identifier",MLL:"MPEG location lookup table",PIC:"Attached picture",POP:"Popularimeter",REV:"Reverb",RVA:"Relative volume adjustment",SLT:"Synchronized lyric/text",STC:"Synced tempo codes",TAL:"Album/Movie/Show title",TBP:"BPM (Beats Per Minute)",
23
+ TCM:"Composer",TCO:"Content type",TCR:"Copyright message",TDA:"Date",TDY:"Playlist delay",TEN:"Encoded by",TFT:"File type",TIM:"Time",TKE:"Initial key",TLA:"Language(s)",TLE:"Length",TMT:"Media type",TOA:"Original artist(s)/performer(s)",TOF:"Original filename",TOL:"Original Lyricist(s)/text writer(s)",TOR:"Original release year",TOT:"Original album/Movie/Show title",TP1:"Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group",TP2:"Band/Orchestra/Accompaniment",TP3:"Conductor/Performer refinement",
24
+ TP4:"Interpreted, remixed, or otherwise modified by",TPA:"Part of a set",TPB:"Publisher",TRC:"ISRC (International Standard Recording Code)",TRD:"Recording dates",TRK:"Track number/Position in set",TSI:"Size",TSS:"Software/hardware and settings used for encoding",TT1:"Content group description",TT2:"Title/Songname/Content description",TT3:"Subtitle/Description refinement",TXT:"Lyricist/text writer",TXX:"User defined text information frame",TYE:"Year",UFI:"Unique file identifier",ULT:"Unsychronized lyric/text transcription",
25
+ WAF:"Official audio file webpage",WAR:"Official artist/performer webpage",WAS:"Official audio source webpage",WCM:"Commercial information",WCP:"Copyright/Legal information",WPB:"Publishers official webpage",WXX:"User defined URL link frame",AENC:"Audio encryption",APIC:"Attached picture",COMM:"Comments",COMR:"Commercial frame",ENCR:"Encryption method registration",EQUA:"Equalization",ETCO:"Event timing codes",GEOB:"General encapsulated object",GRID:"Group identification registration",IPLS:"Involved people list",
26
+ LINK:"Linked information",MCDI:"Music CD identifier",MLLT:"MPEG location lookup table",OWNE:"Ownership frame",PRIV:"Private frame",PCNT:"Play counter",POPM:"Popularimeter",POSS:"Position synchronisation frame",RBUF:"Recommended buffer size",RVAD:"Relative volume adjustment",RVRB:"Reverb",SYLT:"Synchronized lyric/text",SYTC:"Synchronized tempo codes",TALB:"Album/Movie/Show title",TBPM:"BPM (beats per minute)",TCOM:"Composer",TCON:"Content type",TCOP:"Copyright message",TDAT:"Date",TDLY:"Playlist delay",
27
+ TENC:"Encoded by",TEXT:"Lyricist/Text writer",TFLT:"File type",TIME:"Time",TIT1:"Content group description",TIT2:"Title/songname/content description",TIT3:"Subtitle/Description refinement",TKEY:"Initial key",TLAN:"Language(s)",TLEN:"Length",TMED:"Media type",TOAL:"Original album/movie/show title",TOFN:"Original filename",TOLY:"Original lyricist(s)/text writer(s)",TOPE:"Original artist(s)/performer(s)",TORY:"Original release year",TOWN:"File owner/licensee",TPE1:"Lead performer(s)/Soloist(s)",TPE2:"Band/orchestra/accompaniment",
28
+ TPE3:"Conductor/performer refinement",TPE4:"Interpreted, remixed, or otherwise modified by",TPOS:"Part of a set",TPUB:"Publisher",TRCK:"Track number/Position in set",TRDA:"Recording dates",TRSN:"Internet radio station name",TRSO:"Internet radio station owner",TSIZ:"Size",TSRC:"ISRC (international standard recording code)",TSSE:"Software/Hardware and settings used for encoding",TYER:"Year",TXXX:"User defined text information frame",UFID:"Unique file identifier",USER:"Terms of use",USLT:"Unsychronized lyric/text transcription",
29
+ WCOM:"Commercial information",WCOP:"Copyright/Legal information",WOAF:"Official audio file webpage",WOAR:"Official artist/performer webpage",WOAS:"Official audio source webpage",WORS:"Official internet radio station homepage",WPAY:"Payment",WPUB:"Publishers official webpage",WXXX:"User defined URL link frame"};
30
+ var J={title:["TIT2","TT2"],artist:["TPE1","TP1"],album:["TALB","TAL"],year:["TYER","TYE"],comment:["COMM","COM"],track:["TRCK","TRK"],genre:["TCON","TCO"],picture:["APIC","PIC"],lyrics:["USLT","ULT"]},K=["title","artist","album","track"];H.q=function(a,b){a.g([0,G(6,a)],b)};
31
+ H.r=function(a,b){var d=0,e=a.a(d+3);if(4<e)return{version:">2.4"};var f=a.a(d+4),h=a.c(d+5,7),c=a.c(d+5,6),k=a.c(d+5,5),v=G(d+6,a),d=d+10;if(c)var p=a.h(d,x),d=d+(p+4);var e={version:"2."+e+"."+f,major:e,revision:f,flags:{unsynchronisation:h,extended_header:c,experimental_indicator:k},size:v},g;if(h)g={};else{for(var v=v-10,h=a,f=b,c={},k=e.major,p=[],m=0,i;i=(f||K)[m];m++)p=p.concat(J[i]||[i]);for(f=p;d<v;){p=y;m=h;i=d;var q=y;switch(k){case 2:g=m.d(i,3);var l=m.n(i+3),w=6;break;case 3:g=m.d(i,
32
+ 4);l=m.h(i+4,x);w=10;break;case 4:g=m.d(i,4),l=G(i+4,m),w=10}if(""==g)break;d+=w+l;if(!(0>f.indexOf(g))&&(2<k&&(q={message:{W:m.c(i+8,6),I:m.c(i+8,5),T:m.c(i+8,4)},l:{R:m.c(i+8+1,7),F:m.c(i+8+1,3),H:m.c(i+8+1,2),C:m.c(i+8+1,1),v:m.c(i+8+1,0)}}),i+=w,q&&q.l.v&&(G(i,m),i+=4,l-=4),!q||!q.l.C))g in H.b?p=H.b[g]:"T"==g[0]&&(p=H.b["T*"]),p=p?p(i,l,m,q):void 0,p={id:g,size:l,description:g in H.frames?H.frames[g]:"Unknown",data:p},g in c?(c[g].id&&(c[g]=[c[g]]),c[g].push(p)):c[g]=p}g=c}for(var A in J)if(J.hasOwnProperty(A)){a:{l=
33
+ J[A];"string"==typeof l&&(l=[l]);w=0;for(d=void 0;d=l[w];w++)if(d in g){a=g[d].data;break a}a=void 0}a&&(e[A]=a)}for(var r in g)g.hasOwnProperty(r)&&(e[r]=g[r]);return e};this.ID3v2=H;function M(a){var b;switch(a){case 0:b="iso-8859-1";break;case 1:b="utf-16";break;case 2:b="utf-16be";break;case 3:b="utf-8"}return b}var N="32x32 pixels 'file icon' (PNG only);Other file icon;Cover (front);Cover (back);Leaflet page;Media (e.g. lable side of CD);Lead artist/lead performer/soloist;Artist/performer;Conductor;Band/Orchestra;Composer;Lyricist/text writer;Recording Location;During recording;During performance;Movie/video screen capture;A bright coloured fish;Illustration;Band/artist logotype;Publisher/Studio logotype".split(";");
34
+ ID3v2.b.APIC=function(a,b,d,e,f){var f=f||"3",e=a,h=M(d.a(a));switch(f){case "2":var c=d.d(a+1,3),a=a+4;break;case "3":case "4":c=d.e(a+1,b-(a-e),h),a+=1+c.f}f=d.a(a,1);f=N[f];h=d.e(a+1,b-(a-e),h);a+=1+h.f;return{format:c.toString(),type:f,description:h.toString(),data:d.m(a,e+b-a)}};ID3v2.b.COMM=function(a,b,d){var e=a,f=M(d.a(a)),h=d.d(a+1,3),c=d.e(a+4,b-4,f),a=a+(4+c.f),a=d.e(a,e+b-a,f);return{language:h,V:c.toString(),text:a.toString()}};ID3v2.b.COM=ID3v2.b.COMM;
35
+ ID3v2.b.PIC=function(a,b,d,e){return ID3v2.b.APIC(a,b,d,e,"2")};ID3v2.b.PCNT=function(a,b,d){return d.M(a)};ID3v2.b.CNT=ID3v2.b.PCNT;ID3v2.b["T*"]=function(a,b,d){var e=M(d.a(a));return d.e(a+1,b-1,e).toString()};ID3v2.b.TCON=function(a,b,d){return ID3v2.b["T*"].apply(this,arguments).replace(/^\(\d+\)/,"")};ID3v2.b.TCO=ID3v2.b.TCON;ID3v2.b.USLT=function(a,b,d){var e=a,f=M(d.a(a)),h=d.d(a+1,3),c=d.e(a+4,b-4,f),a=a+(4+c.f),a=d.e(a,e+b-a,f);return{language:h,G:c.toString(),S:a.toString()}};
36
+ ID3v2.b.ULT=ID3v2.b.USLT;function O(a,b,d,e){var f=a.h(b,x);if(0==f)e();else{var h=a.d(b+4,4);-1<["moov","udta","meta","ilst"].indexOf(h)?("meta"==h&&(b+=4),a.g([b+8,b+8+8],function(){O(a,b+8,f-8,e)})):a.g([b+(h in P.k?0:f),b+f+8],function(){O(a,b+f,d,e)})}}
37
+ function Q(a,b,d,e,f){for(var f=void 0===f?"":f+" ",h=d;h<d+e;){var c=b.h(h,x);if(0==c)break;var k=b.d(h+4,4);if(-1<["moov","udta","meta","ilst"].indexOf(k)){"meta"==k&&(h+=4);Q(a,b,h+8,c-8,f);break}if(P.k[k]){var v=b.n(h+16+1),p=P.k[k],v=P.types[v];if("trkn"==k)a[p[0]]=b.a(h+16+11),a.count=b.a(h+16+13);else{var k=h+16+4+4,g=c-16-4-4;switch(v){case "text":a[p[0]]=b.e(k,g,"UTF-8");break;case "uint8":a[p[0]]=b.p(k);break;case "jpeg":case "png":a[p[0]]={l:"image/"+v,data:b.m(k,g)}}}}h+=c}}
38
+ var P=this.u={};P.types={"0":"uint8",1:"text",13:"jpeg",14:"png",21:"uint8"};P.k={"\u00a9alb":["album"],"\u00a9art":["artist"],"\u00a9ART":["artist"],aART:["artist"],"\u00a9day":["year"],"\u00a9nam":["title"],"\u00a9gen":["genre"],trkn:["track"],"\u00a9wrt":["composer"],"\u00a9too":["encoder"],cprt:["copyright"],covr:["picture"],"\u00a9grp":["grouping"],keyw:["keyword"],"\u00a9lyr":["lyrics"],"\u00a9gen":["genre"]};P.q=function(a,b){a.g([0,7],function(){O(a,0,a.o(),b)})};
39
+ P.r=function(a){var b={};Q(b,a,0,a.o());return b};this.ID4=this.u;
40
+
41
+
42
+ FileAPI.support.id3 = true;
43
+
44
+
45
+ FileAPI.addInfoReader(/^audio/i, function (file, callback){
46
+ if( !file.__id3 ){
47
+ var defer = file.__id3 = FileAPI.defer();
48
+
49
+ FileAPI.readAsBinaryString(file, function (evt){
50
+ if( evt.type == 'load' ){
51
+ ID3.loadTags(file.name, function (){
52
+ defer.resolve(false, file.__id3 = ID3.getAllTags(file.name));
53
+ }, {
54
+ dataReader: function (url, fn){
55
+ var oFile = new ID3.BinaryFile(evt.result, 0, file.size);
56
+ fn(oFile)
57
+ }
58
+ });
59
+ } else if( evt.type == 'error' ){
60
+ callback('read_as_binary_string_id3');
61
+ }
62
+ });
63
+ }
64
+
65
+ file.__id3.then(callback);
66
+ });
67
+ })();
@@ -0,0 +1,73 @@
1
+ /**!
2
+ * FileAPI — a set of tools for working with files
3
+ *
4
+ * @author RubaXa <trash@rubaxa.org>
5
+ * @build lib/canvas-to-blob lib/FileAPI.core lib/FileAPI.Image lib/FileAPI.Form lib/FileAPI.XHR lib/FileAPI.Flash
6
+ */
7
+ (function(a){var m=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,g;if(g=a.Blob)try{g=Boolean(new Blob)}catch(s){g=!1}var p=g;if(g=p)if(g=a.Uint8Array)try{g=100===(new Blob([new Uint8Array(100)])).size}catch(f){g=!1}var c=g,e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,n=(p||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var r,f,g,n;r=0<=a.split(",")[0].indexOf("base64")?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]);f=new ArrayBuffer(r.length);g=new Uint8Array(f);
8
+ for(n=0;n<r.length;n+=1)g[n]=r.charCodeAt(n);a=a.split(",")[0].split(":")[1].split(";")[0];if(p)return new Blob([c?g:f],{type:a});g=new e;g.append(f);return g.getBlob(a)};a.HTMLCanvasElement&&!m.toBlob&&(m.mozGetAsFile?m.toBlob=function(a,c){a(this.mozGetAsFile("blob",c))}:m.toDataURL&&n&&(m.toBlob=function(a,c){a(n(this.toDataURL(c)))}));a.dataURLtoBlob=n})(this);
9
+ (function(a,m){function g(b,t,d){if(b)if(w(b))for(var a=0,c=b.length;a<c;a++)a in b&&t.call(d,b[a],a,b);else for(a in b)b.hasOwnProperty(a)&&t.call(d,b[a],a,b)}function s(b,t,d){if(b){var a=k.uid(b);B[a]||(B[a]={});g(t.split(/\s+/),function(t){x?x.event.add(b,t,d):(B[a][t]||(B[a][t]=[]),B[a][t].push(d),b.addEventListener?b.addEventListener(t,d,!1):b.attachEvent?b.attachEvent("on"+t,d):b["on"+t]=d)})}}function p(b,t,d){if(b){var a=k.uid(b),c=B[a]||{};g(t.split(/\s+/),function(t){if(x)x.event.remove(b,
10
+ t,d);else{for(var a=c[t]||[],h=a.length;h--;)if(a[h]===d){a.splice(h,1);break}b.addEventListener?b.removeEventListener(t,d,!1):b.detachEvent?b.detachEvent("on"+t,d):b["on"+t]=null}})}}function f(b,t,d){s(b,t,function R(a){p(b,t,R);d(a)})}function c(b,t,d,a,c){b={type:d.type||d,target:b,result:a};k.extend(b,c);t(b)}function e(b,t,d,a){if(k.isFile(b)&&v&&v.prototype["readAs"+d]){var h=new v;s(h,K,function S(d){var a=d.type;"progress"==a?c(b,t,d,d.target.result,{loaded:d.loaded,total:d.total}):"loadend"==
11
+ a?(p(h,K,S),h=null):c(b,t,d,d.target.result)});try{if(a)h["readAs"+d](a,b);else h["readAs"+d](b)}catch(e){c(b,t,"error",m,{error:e.toString()})}}else c(b,t,"error",m,{error:"filreader_not_support_"+d})}function n(b,d){if(!b.type&&0==b.size%4096&&102400>=b.size)if(v)try{var a=new v;f(a,K,function(b){b="error"!=b.type;d(b);b&&a.abort()});a.readAsDataURL(b)}catch(c){d(!1)}else d(null);else d(!0)}function q(b){var d;b.getAsEntry?d=b.getAsEntry():b.webkitGetAsEntry&&(d=b.webkitGetAsEntry());return d}function r(b,
12
+ d){if(b)if(b.isFile)b.file(function(a){a.fullPath=b.fullPath;d(!1,[a])},function(){d("entry_file")});else if(b.isDirectory){var a=[];b.createReader().readEntries(function(b){k.afor(b,function(b,c){r(c,function(c,h){c||(a=a.concat(h));b?b():d(!1,a)})})},function(){d("directory_reader")})}else r(q(b),d);else d("empty_entry")}function w(b){return"object"==typeof b&&b&&"length"in b}function A(b){var d={};g(b,function(b,a){b&&"object"===typeof b&&(b=k.extend({},b));d[a]=b});return d}function C(b){b.target||
13
+ (b.target=a.event&&a.event.srcElement||L);3===b.target.nodeType&&(b.target=event.target.parentNode);return b}var l=1,d=function(){},h=navigator.userAgent,u=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL&&webkitURL,D=a.Blob,E=a.File,v=a.FileReader,F=a.FormData,I=a.XMLHttpRequest,x=a.jQuery,y=!!(E&&v&&(a.Uint8Array||F||I.prototype.sendAsBinary))&&!(/safari\//i.test(h)&&!/chrome\//i.test(h)&&/windows/i.test(h)),h=y&&"withCredentials"in new I,D=y&&!!D&&!!(D.prototype.webkitSlice||
14
+ D.prototype.mozSlice||D.prototype.slice),L=a.document,N=a.dataURLtoBlob,V=/img/i,W=/canvas/i,X=/img|canvas/,M=/input/i,Y=/^data:[^,]+,/,G=Math.pow,Z=Math.round,J=Number,F=function(b){return Z(b*this)},H=new J(1024),O=new J(G(H,2)),P=new J(G(H,3)),G=new J(G(H,4)),B={},Q=[],K="abort progress error load loadend",$="status statusText readyState response responseXML responseText responseBody".split(" "),k={version:"1.2.6",cors:!1,html5:!0,debug:!1,pingUrl:!1,flashAbortTimeout:0,withCredentials:!0,staticPath:"./",
15
+ flashUrl:0,flashImageUrl:0,ext2mime:{jpg:"image/jpeg",tif:"image/tiff"},accept:{"image/*":"art bm bmp dwg dxf cbr cbz fif fpx gif ico iefs jfif jpe jpeg jpg jps jut mcf nap nif pbm pcx pgm pict pm png pnm qif qtif ras rast rf rp svf tga tif tiff xbm xbm xpm xwd","audio/*":"m4a flac aac rm mpa wav wma ogg mp3 mp2 m3u mod amf dmf dsm far gdm imf it m15 med okt s3m stm sfx ult uni xm sid ac3 dts cue aif aiff wpl ape mac mpc mpp shn wv nsf spc gym adplug adx dsp adp ymf ast afc hps xs","video/*":"m4v 3gp nsv ts ty strm rm rmvb m3u ifo mov qt divx xvid bivx vob nrg img iso pva wmv asf asx ogm m2v avi bin dat dvr-ms mpg mpeg mp4 mkv avc vp3 svq3 nuv viv dv fli flv wpl"},
16
+ chunkSize:0,chunkUploadRetry:0,chunkNetworkDownRetryTimeout:2E3,KB:(H.from=F,H),MB:(O.from=F,O),GB:(P.from=F,P),TB:(G.from=F,G),expando:"fileapi"+(new Date).getTime(),uid:function(b){return b?b[k.expando]=b[k.expando]||k.uid():(++l,k.expando+l)},log:function(){k.debug&&(a.console&&console.log)&&(console.log.apply?console.log.apply(console,arguments):console.log([].join.call(arguments," ")))},newImage:function(b,d){var a=L.createElement("img");if(d)k.event.one(a,"error load",function(b){d("error"==
17
+ b.type,a);a=null});a.src=b;return a},getXHR:function(){var b;if(I)b=new I;else if(a.ActiveXObject)try{b=new ActiveXObject("MSXML2.XMLHttp.3.0")}catch(d){b=new ActiveXObject("Microsoft.XMLHTTP")}return b},isArray:w,support:{dnd:h&&"ondrop"in L.createElement("div"),cors:h,html5:y,chunked:D,dataURI:!0},event:{on:s,off:p,one:f,fix:C},throttle:function(b,d){var c,h;return function(){h=arguments;c||(b.apply(a,h),c=setTimeout(function(){c=0;b.apply(a,h)},d))}},F:function(){},parseJSON:function(b){return a.JSON&&
18
+ JSON.parse?JSON.parse(b):(new Function("return ("+b.replace(/([\r\n])/g,"\\$1")+");"))()},trim:function(b){b=String(b);return b.trim?b.trim():b.replace(/^\s+|\s+$/g,"")},defer:function(){var b=[],a,c,h={resolve:function(e,f){h.resolve=d;c=e||!1;for(a=f;f=b.shift();)f(c,a)},then:function(d){c!==m?d(c,a):b.push(d)}};return h},queue:function(b){var d=0,a=0,c=!1,h=!1,e={inc:function(){a++},next:function(){d++;setTimeout(e.check,0)},check:function(){d>=a&&!c&&e.end()},isFail:function(){return c},fail:function(){!c&&
19
+ b(c=!0)},end:function(){h||(h=!0,b())}};return e},each:g,afor:function(b,d){var a=0,c=b.length;w(b)&&c--?function z(){d(c!=a&&z,b[a],a++)}():d(!1)},extend:function(b){g(arguments,function(d){g(d,function(d,a){b[a]=d})});return b},isFile:function(b){return y&&b&&b instanceof E},isCanvas:function(b){return b&&W.test(b.nodeName)},getFilesFilter:function(b){return(b="string"==typeof b?b:b.getAttribute&&b.getAttribute("accept")||"")?RegExp("("+b.replace(/\./g,"\\.").replace(/,/g,"|")+")$","i"):/./},readAsDataURL:function(b,
20
+ d){k.isCanvas(b)?c(b,d,"load",k.toDataURL(b)):e(b,d,"DataURL")},readAsBinaryString:function(b,d){v&&v.prototype.readAsBinaryString?e(b,d,"BinaryString"):e(b,function(b){if("load"==b.type)try{b.result=k.toBinaryString(b.result)}catch(a){b.type="error",b.message=a.toString()}d(b)},"DataURL")},readAsArrayBuffer:function(b,d){e(b,d,"ArrayBuffer")},readAsText:function(b,d,a){a||(a=d,d="utf-8");e(b,a,"Text",d)},toDataURL:function(b){if("string"==typeof b)return b;if(b.toDataURL)return b.toDataURL("image/png")},
21
+ toBinaryString:function(b){return a.atob(k.toDataURL(b).replace(Y,""))},readAsImage:function(b,d,a){if(k.isFile(b))if(u){var h=u.createObjectURL(b);h===m?c(b,d,"error"):k.readAsImage(h,d,a)}else k.readAsDataURL(b,function(h){"load"==h.type?k.readAsImage(h.result,d,a):(a||"error"==h.type)&&c(b,d,h,null,{loaded:h.loaded,total:h.total})});else k.isCanvas(b)?c(b,d,"load",b):V.test(b.nodeName)?b.complete?c(b,d,"load",b):f(b,"error abort load",function z(a){"load"==a.type&&u&&u.revokeObjectURL(b.src);p(b,
22
+ "error abort load",z);c(b,d,a,b)}):b.iframe?c(b,d,{type:"error"}):(h=k.newImage(b.dataURL||b),k.readAsImage(h,d,a))},checkFileObj:function(b){var d={},a=k.accept;"object"==typeof b?d=b:d.name=(b+"").split(/\\|\//g).pop();null==d.type&&(d.type=d.name.split(".").pop());g(a,function(b,a){b=RegExp(b.replace(/\s/g,"|"),"i");b.test(d.type)&&(d.type=k.ext2mime[d.type]||a.split("/")[0]+"/"+d.type)});return d},getDropFiles:function(b,d){var a=[],c=(b.originalEvent||b||"").dataTransfer||{},h=w(c.items)&&c.items[0]&&
23
+ q(c.items[0]),e=k.queue(function(){d(a)});g((h?c.items:c.files)||[],function(b){e.inc();try{h?r(b,function(b,d){!b&&a.push.apply(a,d);e.next()}):n(b,function(d){d&&a.push(b);e.next()})}catch(d){e.next(),k.log("getDropFiles.error:",d.toString())}});e.check()},getFiles:function(b,d,a){var c=[];if(a)return k.filterFiles(k.getFiles(b),d,a),null;b.jquery&&(b.each(function(){c=c.concat(k.getFiles(this))}),b=c,c=[]);"string"==typeof d&&(d=k.getFilesFilter(d));b.originalEvent?b=C(b.originalEvent):b.srcElement&&
24
+ (b=C(b));b.dataTransfer?b=b.dataTransfer:b.target&&(b=b.target);b.files?(c=b.files,y||(c[0].blob=b,c[0].iframe=!0)):!y&&M.test(b&&b.tagName)?k.trim(b.value)&&(c=[k.checkFileObj(b.value)],c[0].blob=b,c[0].iframe=!0):w(b)&&(c=b);return k.filter(c,function(b){return!d||d.test(b.name)})},getInfo:function(b,d){var a={},c=Q.concat();k.isFile(b)?function z(){var h=c.shift();h?h.test(b.type)?h(b,function(b,c){b?d(b):(k.extend(a,c),z())}):z():d(!1,a)}():d("not_support",a)},addInfoReader:function(b,d){d.test=
25
+ function(d){return b.test(d)};Q.push(d)},filter:function(b,d){for(var a=[],c=0,h=b.length,e;c<h;c++)c in b&&(e=b[c],d.call(e,e,c,b)&&a.push(e));return a},filterFiles:function(b,d,a){if(b.length){var c=b.concat(),h,e=[],f=[];(function T(){c.length?(h=c.shift(),k.getInfo(h,function(b,a){(d(h,b?!1:a)?e:f).push(h);T()})):a(e,f)})()}else a([],b)},upload:function(b){b=k.extend({prepare:k.F,beforeupload:k.F,upload:k.F,fileupload:k.F,fileprogress:k.F,filecomplete:k.F,progress:k.F,complete:k.F,pause:k.F,chunkSize:k.chunkSize,
26
+ chunkUpoloadRetry:k.chunkUploadRetry},b);b.imageAutoOrientation&&!b.imageTransform&&(b.imageTransform={rotate:"auto"});var a=new k.XHR(b),c=this._getFilesDataArray(b.files),h=0,e=0,f=this,u,r=!1;g(c,function(b){h+=b.size});a.files=[];g(c,function(b){a.files.push(b.file)});a.total=h;a.loaded=0;a.filesLeft=c.length;b.beforeupload(a,b);(u=function U(){var u=c.shift(),q=u&&u.file,l=!1,w=A(b);a.filesLeft=c.length;q&&q.name===k.expando&&(q=null,k.log("[warn] FileAPI.upload() \u2014 called without files"));
27
+ ("abort"!=a.statusText||a.current)&&u?(r=!1,(a.currentFile=q)&&b.prepare(q,w),this._getFormData(w,u,function(r){e||b.upload(a,b);var p=new k.XHR(k.extend({},w,{upload:q?function(){b.fileupload(q,p,w)}:d,progress:q?function(d){l||(b.fileprogress({type:"progress",total:u.total=d.total,loaded:u.loaded=d.loaded},q,p,w),b.progress({type:"progress",total:h,loaded:a.loaded=e+u.size*(d.loaded/d.total)|0},q,p,w))}:d,complete:function(d){l=!0;g($,function(b){a[b]=p[b]});q&&(u.loaded=u.total,this.progress(u),
28
+ e+=u.size,a.loaded=e,b.filecomplete(d,p,q,w));U.call(f)}}));a.abort=function(b){b||(c.length=0);this.current=b;p.abort()};p.send(r)})):(b.complete(200==a.status||201==a.status?!1:a.statusText||"error",a,b),r=!0)}).call(this);a.append=function(b,d){b=k._getFilesDataArray([].concat(b));g(b,function(b){h+=b.size;a.files.push(b.file);d?c.unshift(b):c.push(b)});a.statusText="";r&&u.call(f)};a.remove=function(b){var d=-1;g(c,function(a){d++;if(a.file==b)return c.splice(d,1)})};return a},_getFilesDataArray:function(b){var d=
29
+ [],a={};if(M.test(b&&b.tagName)){var c=k.getFiles(b);a[b.name||"file"]=null!==b.getAttribute("multiple")?c:c[0]}else w(b)&&M.test(b[0]&&b[0].tagName)?g(b,function(b){a[b.name||"file"]=k.getFiles(b)}):a=b;g(a,function z(b,a){w(b)?g(b,function(b,d){z(b,a)}):b&&b.name&&d.push({name:a,file:b,size:b.size,total:b.size,loaded:0})});d.length||d.push({file:{name:k.expando}});return d},_getFormData:function(b,d,a){var c=d.file,h=d.name,e=c.name,u=c.type;d=k.support.transform&&b.imageTransform;var f=new k.Form,
30
+ q=k.queue(function(){a(f)}),r=d&&(0<parseInt(d.maxWidth||d.minWidth||d.width,10)||d.rotate);k.Image&&d&&(/image/.test(c.type)||X.test(c.nodeType))?(q.inc(),r&&(d=[d]),k.Image.transform(c,d,b.imageAutoOrientation,function(d,a){r&&!d?(N||k.flashEngine||(a[0]=k.toBinaryString(a[0]),f.multipart=!0),f.append(h,a[0],e,u)):(d||(g(a,function(b,d){N||k.flashEngine||(b=k.toBinaryString(b),f.multipart=!0);f.append(h+"["+d+"]",b,e,u)}),h+="[original]"),(d||b.imageOriginal)&&f.append(h,c,e,u));q.next()})):e!==
31
+ k.expando&&f.append(h,c,e);g(b.data,function aa(b,d){"object"==typeof b?g(b,function(b,a){aa(b,d+"["+a+"]")}):f.append(d,b)});q.check()},reset:function(b,d){var a,c;x?(c=x(b).clone(!0).insertBefore(b).val("")[0],d||x(b).remove()):(a=b.parentNode,c=a.insertBefore(b.cloneNode(!0),b),c.value="",d||a.removeChild(b),g(B[k.uid(b)],function(d,a){g(d,function(d){p(b,a,d);s(c,a,d)})}));return c},load:function(b,d){var a=k.getXHR();a?(a.open("GET",b,!0),a.overrideMimeType&&a.overrideMimeType("text/plain; charset=x-user-defined"),
32
+ s(a,"progress",function(b){b.lengthComputable&&d({type:b.type,loaded:b.loaded,total:b.total},a)}),a.onreadystatechange=function(){if(4==a.readyState)if(a.onreadystatechange=null,200==a.status){b=b.split("/");var c={name:b[b.length-1],size:a.getResponseHeader("Content-Length"),type:a.getResponseHeader("Content-Type")};c.dataURL="data:"+c.type+";base64,"+k.encode64(a.responseBody||a.responseText);d({type:"load",result:c})}else d({type:"error"})},a.send(null)):d({type:"error"});return a},encode64:function(b){var d=
33
+ "",a=0;for("string"!==typeof b&&(b=String(b));a<b.length;){var c=b.charCodeAt(a++)&255,h=b.charCodeAt(a++)&255,e=b.charCodeAt(a++)&255,f=c>>2,c=(c&3)<<4|h>>4;isNaN(h)?h=e=64:(h=(h&15)<<2|e>>6,e=isNaN(e)?64:e&63);d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)}return d}};
34
+ k.addInfoReader(/^image/,function(b,d){if(!b.__dimensions){var a=b.__dimensions=k.defer();k.readAsImage(b,function(b){var d=b.target;a.resolve("load"==b.type?!1:"error",{width:d.width,height:d.height})})}b.__dimensions.then(d)});k.event.dnd=function(b,d,a){var c,h;a||(a=d,d=k.F);v?(s(b,"dragenter dragleave dragover",function(b){for(var a=((b.originalEvent||b||"").dataTransfer||{}).types,e=a&&a.length;e--;)~a[e].indexOf("File")&&(b.preventDefault(),h!==b.type&&(h=b.type,"dragleave"!=h&&d.call(b.currentTarget,
35
+ !0,b),clearTimeout(c),c=setTimeout(function(){d.call(b.currentTarget,"dragleave"!=h,b)},50)))}),s(b,"drop",function(b){b.preventDefault();h=0;d.call(b.currentTarget,!1,b);k.getDropFiles(b,function(d){a.call(b.currentTarget,d,b)})})):k.log("Drag'n'Drop -- not supported")};x&&!x.fn.dnd&&(x.fn.dnd=function(b,d){return this.each(function(){k.event.dnd(this,b,d)})});a.FileAPI=k.extend(k,a.FileAPI);k.flashUrl||(k.flashUrl=k.staticPath+"FileAPI.flash.swf");k.flashImageUrl||(k.flashImageUrl=k.staticPath+
36
+ "FileAPI.flash.image.swf")})(window);
37
+ (function(a,m,g){function s(a,c){if(!(this instanceof s))return new s(a);this.file=a;this.better=!c;this.matrix={sx:0,sy:0,sw:0,sh:0,dx:0,dy:0,dw:0,dh:0,resize:0,deg:0}}var p=Math.min,f=Math.round,c=!1,e={8:270,3:180,6:90};try{c=-1<m.createElement("canvas").toDataURL("image/png").indexOf("data:image/png")}catch(n){}s.prototype={constructor:s,set:function(c){a.extend(this.matrix,c);return this},crop:function(a,c,e,f){e===g&&(e=a,f=c,a=c=0);return this.set({sx:a,sy:c,sw:e,sh:f||e})},resize:function(a,
38
+ c,e){"string"==typeof c&&(e=c,c=a);return this.set({dw:a,dh:c,resize:e})},preview:function(a,c){return this.set({dw:a,dh:c||a,resize:"preview"})},rotate:function(a){return this.set({deg:a})},_load:function(c,e){var f=this;a.readAsImage(c,function(a){e.call(f,"load"!=a.type,a.result)})},_apply:function(a,c){var e=m.createElement("canvas"),f=this.getMatrix(a),g=e.getContext("2d"),l=f.deg,d=f.dw,h=f.dh,u=a.width,p=a.height,n,v=a;if(this.better)for(;2<Math.min(u/d,p/h);)u=~~(u/2+0.5),p=~~(p/2+0.5),n=
39
+ m.createElement("canvas"),n.width=u,n.height=p,v!==a?(n.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,u,p),v=n):(v=n,v.getContext("2d").drawImage(a,f.sx,f.sy,f.sw,f.sh,0,0,u,p),f.sx=f.sy=f.sw=f.sh=0);e.width=l%180?h:d;e.height=l%180?d:h;g.rotate(l*Math.PI/180);g.drawImage(v,f.sx,f.sy,f.sw||v.width,f.sh||v.height,180==l||270==l?-d:0,90==l||180==l?-h:0,d,h);c.call(this,!1,e)},getMatrix:function(c){var e=a.extend({},this.matrix),g=e.sw=e.sw||c.width;c=e.sh=e.sh||c.height;var n=e.dw=e.dw||e.sw,
40
+ m=e.dh=e.dh||e.sh,l=g/c,d=n/m,h=e.resize;if("preview"==h){if(n!=g||m!=c)if(d>=l?(l=g,h=l/d):(h=c,l=h*d),l!=g||h!=c)e.sx=~~((g-l)/2),e.sy=~~((c-h)/2),g=l,c=h}else h&&(g>n||c>m?"min"==h?(n=f(l<d?p(g,n):m*l),m=f(l<d?n/l:p(c,m))):(n=f(l>=d?p(g,n):m*l),m=f(l>=d?n/l:p(c,m))):(n=g,m=c));e.sw=g;e.sh=c;e.dw=n;e.dh=m;return e},_trans:function(a){this._load(this.file,function(c,e){c?a(c):this._apply(e,a)})},get:function(c){if(a.support.transform){var f=this;"auto"==f.matrix.deg?a.getInfo(this.file,function(a,
41
+ g){f.matrix.deg=e[g&&g.exif&&g.exif.Orientation]||0;f._trans(c)}):f._trans(c)}else c("not_support")},toData:function(a){this.get(a)}};s.exifOrientation=e;s.transform=function(c,e,f,n){a.getInfo(c,function(p,l){var d={},h=a.queue(function(a){n(a,d)});p?h.fail():a.each(e,function(a,e){if(!h.isFail()){var n=s(l.nodeType?l:c);if("function"==typeof a)a(l,n);else if(a.width)n[a.preview?"preview":"resize"](a.width,a.height,a.type);else a.maxWidth&&(l.width>a.maxWidth||l.height>a.maxHeight)&&n.resize(a.maxWidth,
42
+ a.maxHeight,"max");a.rotate===g&&f&&(a.rotate="auto");n.rotate(a.rotate);h.inc();n.toData(function(a,c){a?h.fail():(d[e]=c,h.next())})}})})};a.support.canvas=a.support.transform=c;a.Image=s})(FileAPI,document);
43
+ (function(a,m,g){var s=m.encodeURIComponent,p=m.FormData;m=function(){this.items=[]};m.prototype={append:function(a,c,e,g){this.items.push({name:a,blob:c&&c.blob||(void 0==c?"":c),file:c&&(e||c.name),type:c&&(g||c.type)})},each:function(a){for(var c=0,e=this.items.length;c<e;c++)a.call(this,this.items[c])},toData:function(f,c){c._chunked=a.support.chunked&&0<c.chunkSize&&1==a.filter(this.items,function(a){return a.file}).length;a.support.html5?this.multipart||!p?(a.log("FileAPI.Form.toMultipartData"),
44
+ this.toMultipartData(f)):c._chunked?(a.log("FileAPI.Form.toPlainData"),this.toPlainData(f)):(a.log("FileAPI.Form.toFormData"),this.toFormData(f)):(a.log("FileAPI.Form.toHtmlData"),this.toHtmlData(f))},_to:function(f,c,e,g){var p=a.queue(function(){c(f)});this.each(function(a){e(a,f,p,g)});p.check()},toHtmlData:function(f){this._to(g.createDocumentFragment(),f,function(c,e){var f=c.blob,p;c.file?(a.reset(f,!0),f.name=c.name,e.appendChild(f)):(p=g.createElement("input"),p.name=c.name,p.type="hidden",
45
+ p.value=f,e.appendChild(p))})},toPlainData:function(a){this._to({},a,function(a,e,f){a.file&&(e.type=a.file);a.blob.toBlob?(f.inc(),a.blob.toBlob(function(g){e.name=a.name;e.file=g;e.size=g.length;e.type=a.type;f.next()},"image/png")):a.file?(e.name=a.blob.name,e.file=a.blob,e.size=a.blob.size,e.type=a.type):(e.params||(e.params=[]),e.params.push(encodeURIComponent(a.name)+"="+encodeURIComponent(a.blob)));e.start=-1;e.end=e.file.FileAPIReadPosition||-1;e.retry=0})},toFormData:function(a){this._to(new p,
46
+ a,function(a,e,f){a.file&&e.append("_"+a.name,a.file);a.blob&&a.blob.toBlob?(f.inc(),a.blob.toBlob(function(g){e.append(a.name,g,a.file);f.next()},"image/png")):a.file?e.append(a.name,a.blob,a.file):e.append(a.name,a.blob)})},toMultipartData:function(f){this._to([],f,function(c,e,f,g){var p=!!c.file,m=c.blob,A=function(a){e.push("--_"+g+('\r\nContent-Disposition: form-data; name="'+c.name+'"'+(p?'; filename="'+s(c.file)+'"':"")+(p?"\r\nContent-Type: "+(c.type||"application/octet-stream"):"")+"\r\n\r\n"+
47
+ (p?a:s(a))+"\r\n"));f.next()};f.inc();a.isFile(m)?a.readAsBinaryString(m,function(a){"load"==a.type&&A(a.result)}):A(m)},a.expando)}};a.Form=m})(FileAPI,window,document);
48
+ (function(a,m){var g=function(){},s=function(a){this.uid=m.uid();this.xhr={abort:g,getResponseHeader:g,getAllResponseHeaders:g};this.options=a};s.prototype={status:0,statusText:"",getResponseHeader:function(a){return this.xhr.getResponseHeader(a)},getAllResponseHeaders:function(){return this.xhr.getAllResponseHeaders()||{}},end:function(p,f){var c=this,e=c.options;c.end=c.abort=g;c.status=p;f&&(c.statusText=f);m.log("xhr.end:",p,f);e.complete(200==p||201==p?!1:c.statusText||"unknown",c);c.xhr&&c.xhr.node&&
49
+ setTimeout(function(){var e=c.xhr.node;try{e.parentNode.removeChild(e)}catch(f){}try{delete a[c.uid]}catch(g){}a[c.uid]=c.xhr.node=null},9)},abort:function(){this.end(0,"abort");this.xhr&&(this.xhr.aborted=!0,this.xhr.abort())},send:function(a){var f=this,c=this.options;a.toData(function(a){c.upload(c,f);f._send.call(f,c,a)},c)},_send:function(g,f){var c=this,e,n=c.uid,q=g.url;m.log("XHR._send:",f);q+=(~q.indexOf("?")?"&":"?")+m.uid();f.nodeName?(g.upload(g,c),e=document.createElement("div"),e.innerHTML=
50
+ '<form target="'+n+'" action="'+q+'" method="POST" enctype="multipart/form-data" style="position: absolute; top: -1000px; overflow: hidden; width: 1px; height: 1px;"><iframe name="'+n+'" src="javascript:false;"></iframe><input value="'+n+'" name="callback" type="hidden"/></form>',c.xhr.abort=function(){var a=e.getElementsByName("iframe")[0];if(a)try{a.stop?a.stop():a.contentWindow.stop?a.contentWindow.stop():a.contentWindow.document.execCommand("Stop")}catch(c){}e=null},q=e.getElementsByTagName("form")[0],
51
+ q.appendChild(f),m.log(q.parentNode.innerHTML),document.body.appendChild(e),c.xhr.node=e,a[n]=function(a,f,g){c.readyState=4;c.responseText=g;c.end(a,f);e=null},c.readyState=2,q.submit(),q=null):this.xhr&&this.xhr.aborted?m.log("Error: already aborted"):(e=c.xhr=m.getXHR(),f.params&&(q+=(0>q.indexOf("?")?"?":"&")+f.params.join("&")),e.open("POST",q,!0),m.withCredentials&&(e.withCredentials="true"),g.headers&&g.headers["X-Requested-With"]||e.setRequestHeader("X-Requested-With","XMLHttpRequest"),m.each(g.headers,
52
+ function(a,c){e.setRequestHeader(c,a)}),g._chunked?(e.upload&&e.upload.addEventListener("progress",function(a){f.retry||g.progress({type:a.type,total:f.size,loaded:f.start+a.loaded,totalSize:f.size},c,g)},!1),e.onreadystatechange=function(){c.status=e.status;c.statusText=e.statusText;c.readyState=e.readyState;if(4==e.readyState){for(var a in{"":1,XML:1,Text:1,Body:1})c["response"+a]=e["response"+a];e.onreadystatechange=null;if(!e.status||0<e.status-201)if(m.log("Error: "+e.status),(!e.status&&!e.aborted||
53
+ 500==e.status||416==e.status)&&++f.retry<=g.chunkUploadRetry){a=e.status?0:m.chunkNetworkDownRetryTimeout;g.pause(f.file,g);var n=parseInt(e.getResponseHeader("X-Last-Known-Byte"),10);m.log("X-Last-Known-Byte: "+n);f.end=n?n:f.start-1;setTimeout(function(){c._send(g,f)},a)}else c.end(e.status);else f.retry=0,f.end==f.size-1?c.end(e.status):(n=parseInt(e.getResponseHeader("X-Last-Known-Byte"),10),m.log("X-Last-Known-Byte: "+n),n&&(f.end=n),f.file.FileAPIReadPosition=f.end,setTimeout(function(){c._send(g,
54
+ f)},0));e=null}},f.start=f.end+1,f.end=Math.max(Math.min(f.start+g.chunkSize,f.size)-1,f.start),(n="slice")in f.file||(n="mozSlice")in f.file||(n="webkitSlice"),e.setRequestHeader("Content-Range","bytes "+f.start+"-"+f.end+"/"+f.size),e.setRequestHeader("Content-Disposition","attachment; filename="+encodeURIComponent(f.name)),e.setRequestHeader("Content-Type",f.type||"application/octet-stream"),n=f.file[n](f.start,f.end+1),e.send(n),n=null):(e.upload&&e.upload.addEventListener("progress",m.throttle(function(a){g.progress(a,
55
+ c,g)},100),!1),e.onreadystatechange=function(){c.status=e.status;c.statusText=e.statusText;c.readyState=e.readyState;if(4==e.readyState){for(var a in{"":1,XML:1,Text:1,Body:1})c["response"+a]=e["response"+a];e.onreadystatechange=null;c.end(e.status);e=null}},m.isArray(f)?(e.setRequestHeader("Content-Type","multipart/form-data; boundary=_"+m.expando),f=f.join("")+"--_"+m.expando+"--",e.sendAsBinary?e.sendAsBinary(f):(n=Array.prototype.map.call(f,function(a){return a.charCodeAt(0)&255}),e.send((new Uint8Array(n)).buffer))):
56
+ e.send(f)))}};m.XHR=s})(window,FileAPI);
57
+ (function(a,m,g){a.support.flash=function(){var g=m.navigator,p=g.mimeTypes,f=!1;if(g.plugins&&"object"==typeof g.plugins["Shockwave Flash"])f=g.plugins["Shockwave Flash"].description&&!(p&&p["application/x-shockwave-flash"]&&!p["application/x-shockwave-flash"].enabledPlugin);else try{f=!(!m.ActiveXObject||!new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))}catch(c){a.log("ShockwaveFlash.ShockwaveFlash -- does not supported.")}return f}();!a.support.flash||a.html5&&a.support.html5&&(!a.cors||a.support.cors)||
58
+ function(){function s(a){return('<object id="#id#" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+(a.width||"100%")+'" height="'+(a.height||"100%")+'"><param name="movie" value="#src#" /><param name="flashvars" value="#flashvars#" /><param name="swliveconnect" value="true" /><param name="allowscriptaccess" value="always" /><param name="allownetworking" value="all" /><param name="menu" value="false" /><param name="wmode" value="#wmode#" /><embed flashvars="#flashvars#" swliveconnect="true" allownetworking="all" allowscriptaccess="always" name="#id#" src="#src#" width="'+
59
+ (a.width||"100%")+'" height="'+(a.height||"100%")+'" menu="false" wmode="transparent" type="application/x-shockwave-flash"></embed></object>').replace(/#(\w+)#/ig,function(c,e){return a[e]})}function p(a,c){if(a&&a.style){var e,f;for(e in c){f=c[e];"number"==typeof f&&(f+="px");try{a.style[e]=f}catch(g){}}}}function f(d,c){a.each(c,function(a,c){var e=d[c];d[c]=function(){this.parent=e;return a.apply(this,arguments)}})}function c(d){var c=d.wid=a.uid();l._fn[c]=d;return"FileAPI.Flash._fn."+c}function e(a){try{l._fn[a.wid]=
60
+ null,delete l._fn[a.wid]}catch(c){}}function n(a,c){if(!C.test(a)){if(/^\.\//.test(a)||"/"!=a.charAt(0)){var e=location.pathname,e=e.substr(0,e.lastIndexOf("/"));a=(e+"/"+a).replace("/./","/")}"//"!=a.substr(0,2)&&(a="//"+location.host+a);C.test(a)||(a=location.protocol+a)}c&&(a+=(/\?/.test(a)?"&":"?")+c);return a}function q(d,h,f){function m(){try{l.get(v).setImage(h)}catch(d){a.log('flash.setImage -- can not set "base64":',d)}}var q,v=a.uid(),r=g.createElement("div");for(q in d)r.setAttribute("data-img-"+
61
+ q,d[q]);p(r,d);r.innerHTML=s(a.extend({id:v,src:n(a.flashImageUrl,"r="+a.uid()),wmode:"opaque",flashvars:"scale="+d.scale+"&callback="+c(function x(){e(x);setTimeout(m,99);return!0})},d));f(!1,r);r=null}var r=a.uid(),w=0,A={},C=/^https?:/i,l={_fn:{},init:function(){var d=g.body&&g.body.firstChild;if(d){do if(1==d.nodeType){a.log("FlashAPI.Flash.init...");var c=g.createElement("div");p(c,{top:1,right:1,width:5,height:5,position:"absolute"});d.parentNode.insertBefore(c,d);l.publish(c,r);return}while(d=
62
+ d.nextSibling)}10>w&&setTimeout(l.init,50*++w)},publish:function(d,c){d.innerHTML=s({id:c,src:n(a.flashUrl,"r="+a.version),wmode:"transparent",flashvars:"callback=FileAPI.Flash.event&flashId="+c+"&storeKey="+navigator.userAgent.match(/\d/ig).join("")+"_"+a.version+(l.isReady||(a.pingUrl?"&ping="+a.pingUrl:""))+"&timeout="+a.flashAbortTimeout})},ready:function(){l.ready=a.F;l.isReady=!0;l.patch();a.event.on(g,"mouseover",l.mouseover);a.event.on(g,"click",function(a){l.mouseover(a)&&(a.preventDefault?
63
+ a.preventDefault():a.returnValue=!0)})},getWrapper:function(a){do if(/js-fileapi-wrapper/.test(a.className))return a;while((a=a.parentNode)&&a!==g.body)},mouseover:function(d){d=a.event.fix(d).target;if(/input/i.test(d.nodeName)&&"file"==d.type){var c=d.getAttribute(r);if("i"==c||"r"==c)return!1;if("p"!=c){d.setAttribute(r,"i");var c=g.createElement("div"),e=l.getWrapper(d);if(!e){a.log("flash.mouseover.error: js-fileapi-wrapper not found");return}p(c,{top:0,left:0,width:d.offsetWidth+100,height:d.offsetHeight+
64
+ 100,zIndex:"1000000",position:"absolute"});e.appendChild(c);l.publish(c,a.uid());d.setAttribute(r,"p")}return!0}},event:function(d){var c=d.type;if("ready"==c){try{l.getInput(d.flashId).setAttribute(r,"r")}catch(e){}l.ready();setTimeout(function(){l.mouseenter(d)},50);return!0}"ping"===c?a.log("(flash -> js).ping:",[d.status,d.savedStatus],d.error):"log"===c?a.log("(flash -> js).log:",d.target):c in l&&setTimeout(function(){a.log("Flash.event."+d.type+":",d);l[c](d)},1)},mouseenter:function(d){var c=
65
+ l.getInput(d.flashId);if(c){l.cmd(d,"multiple",null!=c.getAttribute("multiple"));var e=[],f={};a.each((c.getAttribute("accept")||"").split(/,\s*/),function(d){a.accept[d]&&a.each(a.accept[d].split(" "),function(a){f[a]=1})});a.each(f,function(a,d){e.push(d)});l.cmd(d,"accept",e.length?e.join(",")+","+e.join(",").toUpperCase():"*")}},get:function(a){return g[a]||m[a]||g.embeds[a]},getInput:function(d){try{var c=l.getWrapper(l.get(d));if(c)return c.getElementsByTagName("input")[0]}catch(e){a.log('Can not find "input" by flashId:',
66
+ d,e)}},select:function(d){var c=l.getInput(d.flashId),e=a.uid(c);d=d.target.files;a.each(d,function(d){a.checkFileObj(d)});A[e]=d;g.createEvent?(e=g.createEvent("Event"),e.initEvent("change",!0,!1),c.dispatchEvent(e)):g.createEventObject&&(e=g.createEventObject(),c.fireEvent("onchange",e))},cmd:function(d,c,e,f){try{return a.log("(js -> flash)."+c+":",e),l.get(d.flashId||d).cmd(c,e)}catch(g){a.log("(js -> flash).onError:",g),f||setTimeout(function(){l.cmd(d,c,e,!0)},50)}},patch:function(){a.flashEngine=
67
+ a.support.transform=!0;f(a,{getFiles:function(d,c,e){if(e)return a.filterFiles(a.getFiles(d),c,e),null;var f=a.isArray(d)?d:A[a.uid(d.target||d.srcElement||d)];if(!f)return this.parent.apply(this,arguments);c&&(c=a.getFilesFilter(c),f=a.filter(f,function(a){return c.test(a.name)}));return f},getInfo:function(d,f){if(d&&!d.flashId)this.parent.apply(this,arguments);else{if(!d.__info){var g=d.__info=a.defer();l.cmd(d,"getFileInfo",{id:d.id,callback:c(function E(a,c){e(E);g.resolve(a,d.info=c)})})}d.__info.then(f)}}});
68
+ a.support.transform=!0;a.Image&&f(a.Image.prototype,{get:function(a,c){this.set({scaleMode:c||"noScale"});this.parent(a)},_load:function(d,c){a.log("FileAPI.Image._load:",d);if(d&&!d.flashId)this.parent.apply(this,arguments);else{var e=this;a.getInfo(d,function(a,f){c.call(e,a,d)})}},_apply:function(d,f){a.log("FileAPI.Image._apply:",d);if(d&&!d.flashId)this.parent.apply(this,arguments);else{var g=this.getMatrix(d.info);l.cmd(d,"imageTransform",{id:d.id,matrix:g,callback:c(function E(c,l){a.log("FileAPI.Image._apply.callback:",
69
+ c);e(E);c?f(c):!a.support.dataURI||3E4<l.length?q({width:g.deg%180?g.dh:g.dw,height:g.deg%180?g.dw:g.dh,scale:g.scaleMode},l,f):a.newImage("data:"+d.type+";base64,"+l,f)})})}},toData:function(d){var c=this.file,e=c.info,f=this.getMatrix(e);c&&!c.flashId?this.parent.apply(this,arguments):("auto"==f.deg&&(f.deg=a.Image.exifOrientation[e&&e.exif&&e.exif.Orientation]||0),d.call(this,!c.info,{id:c.id,flashId:c.flashId,name:c.name,type:c.type,matrix:f}))}});f(a.Form.prototype,{toData:function(d){for(var c=
70
+ this.items,e=c.length;e--;)if(c[e].file&&c[e].blob&&!c[e].blob.flashId)return this.parent.apply(this,arguments);a.log("flash.Form.toData");d(c)}});f(a.XHR.prototype,{_send:function(d,f){if(f.nodeName||f.append&&a.support.html5||a.isArray(f)&&"string"===typeof f[0])return this.parent.apply(this,arguments);var g={},m={},p=this,q,r;a.each(f,function(a){a.file?(m[a.name]=a={id:a.blob.id,name:a.blob.name,matrix:a.blob.matrix,flashId:a.blob.flashId},r=a.id,q=a.flashId):g[a.name]=a.blob});if(r||q)a.log("flash.XHR._send:",
71
+ q,r,m);else return this.parent.apply(this,arguments);p.xhr={headers:{},abort:function(){l.cmd(q,"abort",{id:r})},getResponseHeader:function(a){return this.headers[a]},getAllResponseHeaders:function(){return this.headers}};var s=a.queue(function(){l.cmd(q,"upload",{url:n(d.url),data:g,files:m,headers:d.headers,callback:c(function y(c){var f=c.type,g=c.result;a.log("flash.upload."+f+":",c);if("progress"==f)c.loaded=Math.min(c.loaded,c.total),c.lengthComputable=!0,d.progress(c);else if("complete"==f)e(y),
72
+ "string"==typeof g&&(p.responseText=g.replace(/%22/g,'"').replace(/%5c/g,"\\").replace(/%26/g,"&").replace(/%25/g,"%")),p.end(c.status||200);else if("abort"==f||"error"==f)p.end(c.status||0,c.message),e(y)})})});a.each(m,function(c){s.inc();a.getInfo(c,s.next)});s.check()}})}};a.Flash=l;a.newImage("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",function(c,e){a.support.dataURI=!(1!=e.width||1!=e.height);l.init()})}()})(FileAPI,window,document);
73
+ "undefined"!==typeof ajs&&ajs.loaded&&ajs.loaded("{fileapi}FileAPI.min");"function"===typeof define&&define.amd&&define("FileAPI",[],function(){return window.FileAPI||{}});
@@ -0,0 +1,12 @@
1
+ //= require_self
2
+ //= require fileapi/FileAPI.min
3
+ //= require fileapi/FileAPI.id3.js
4
+ //= require fileapi/FileAPI.exif.js
5
+ //= require fileapi/tmpl
6
+ //= require fileapi/uploader
7
+
8
+ window.FileAPI =
9
+ debug: false
10
+ pingUrl: false
11
+ flashUrl: '<%= asset_path 'fileapi/FileAPI.flash.swf' %>'
12
+ flashImageUrl: '<%= asset_path 'fileapi/FileAPI.flash.image.swf' %>'
@@ -0,0 +1,35 @@
1
+ // Simple JavaScript Templating
2
+ // John Resig - http://ejohn.org/ - MIT Licensed
3
+ (function (){
4
+ var cache = {};
5
+
6
+ this.tmpl = function tmpl(str, data){
7
+ // Figure out if we're getting a template, or if we need to
8
+ // load the template - and be sure to cache the result.
9
+ var fn = !/\W/.test(str) ?
10
+ cache[str] = cache[str] ||
11
+ tmpl(document.getElementById(str).innerHTML) :
12
+
13
+ // Generate a reusable function that will serve as a template
14
+ // generator (and which will be cached).
15
+ new Function("obj",
16
+ "var p=[],print=function(){p.push.apply(p,arguments);};" +
17
+
18
+ // Introduce the data as local variables using with(){}
19
+ "with(obj){p.push('" +
20
+
21
+ // Convert the template into pure JavaScript
22
+ str
23
+ .replace(/[\r\t\n]/g, " ")
24
+ .split("<%").join("\t")
25
+ .replace(/((^|%>)[^\t]*)'/g, "$1\r")
26
+ .replace(/\t=(.*?)%>/g, "',$1,'")
27
+ .split("\t").join("');")
28
+ .split("%>").join("p.push('")
29
+ .split("\r").join("\\'")
30
+ + "');}return p.join('');");
31
+
32
+ // Provide some basic currying to the user
33
+ return data ? fn(data) : fn;
34
+ };
35
+ })();