From 6624bddab4b535086ad4eb39e8e94613db763eb3 Mon Sep 17 00:00:00 2001 From: macintosh Date: Mon, 14 Oct 2013 16:11:20 +0400 Subject: [PATCH 01/20] scripts update --- Gemfile | 0 README.md | 0 Rakefile | 0 jquery-fileupload-rails.gemspec | 4 +- lib/jquery-fileupload-rails.rb | 0 lib/jquery/fileupload/rails/engine.rb | 0 lib/jquery/fileupload/rails/middleware.rb | 0 lib/jquery/fileupload/rails/upload.rb | 0 lib/jquery/fileupload/rails/version.rb | 2 +- public/.DS_Store | Bin 0 -> 6148 bytes public/cors/postmessage.html | 75 + public/cors/result.html | 24 + vendor/.DS_Store | Bin 0 -> 6148 bytes vendor/assets/.DS_Store | Bin 0 -> 6148 bytes vendor/assets/images/.DS_Store | Bin 0 -> 6148 bytes vendor/assets/javascripts/.DS_Store | Bin 0 -> 6148 bytes .../javascripts/jquery-fileupload/.DS_Store | Bin 0 -> 15364 bytes .../javascripts/jquery-fileupload/basic.js | 0 .../cors/jquery.postmessage-transport.js | 5 +- .../javascripts/jquery-fileupload/index.js | 13 +- .../jquery.fileupload-angular.js | 179 +- .../jquery.fileupload-audio.js | 106 ++ .../jquery-fileupload/jquery.fileupload-fp.js | 227 --- ...d-resize.js => jquery.fileupload-image.js} | 154 +- .../jquery.fileupload-jquery-ui.js | 138 ++ .../jquery.fileupload-process.js | 14 +- .../jquery-fileupload/jquery.fileupload-ui.js | 61 +- .../jquery.fileupload-validate.js | 21 +- .../jquery.fileupload-video.js | 106 ++ .../jquery-fileupload/jquery.fileupload.js | 97 +- .../jquery.iframe-transport.js | 18 +- .../javascripts/jquery-fileupload/locale.js | 0 .../jquery-fileupload/vendor/.DS_Store | Bin 0 -> 6148 bytes .../vendor/canvas-to-blob.js | 0 .../jquery-fileupload/vendor/jquery.Jcrop.js | 1694 +++++++++++++++++ .../jquery-fileupload/vendor/jquery.color.js | 661 +++++++ .../vendor/jquery.ui.widget.js | 2 +- .../vendor/load-image-exif-map.js | 385 ++++ .../vendor/load-image-exif.js | 299 +++ .../vendor/load-image-ios.js | 181 ++ .../vendor/load-image-meta.js | 137 ++ .../vendor/load-image-orientation.js | 159 ++ .../jquery-fileupload/vendor/load-image.js | 318 ++-- .../jquery-fileupload/vendor/tmpl.js | 16 +- vendor/assets/stylesheets/.DS_Store | Bin 0 -> 6148 bytes ...pload-ui.scss => jquery.fileupload-ui.css} | 31 +- vendor/assets/stylesheets/vendor/Jcrop.gif | Bin 0 -> 329 bytes .../stylesheets/vendor/jquery.Jcrop.css | 165 ++ 48 files changed, 4727 insertions(+), 565 deletions(-) mode change 100644 => 100755 Gemfile mode change 100644 => 100755 README.md mode change 100644 => 100755 Rakefile mode change 100644 => 100755 jquery-fileupload-rails.gemspec mode change 100644 => 100755 lib/jquery-fileupload-rails.rb mode change 100644 => 100755 lib/jquery/fileupload/rails/engine.rb mode change 100644 => 100755 lib/jquery/fileupload/rails/middleware.rb mode change 100644 => 100755 lib/jquery/fileupload/rails/upload.rb mode change 100644 => 100755 lib/jquery/fileupload/rails/version.rb create mode 100644 public/.DS_Store create mode 100755 public/cors/postmessage.html create mode 100755 public/cors/result.html create mode 100644 vendor/.DS_Store create mode 100644 vendor/assets/.DS_Store create mode 100644 vendor/assets/images/.DS_Store create mode 100644 vendor/assets/javascripts/.DS_Store create mode 100644 vendor/assets/javascripts/jquery-fileupload/.DS_Store mode change 100644 => 100755 vendor/assets/javascripts/jquery-fileupload/basic.js mode change 100644 => 100755 vendor/assets/javascripts/jquery-fileupload/index.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-audio.js delete mode 100644 vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js rename vendor/assets/javascripts/jquery-fileupload/{jquery.fileupload-resize.js => jquery.fileupload-image.js} (56%) create mode 100755 vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-jquery-ui.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-video.js mode change 100644 => 100755 vendor/assets/javascripts/jquery-fileupload/locale.js create mode 100644 vendor/assets/javascripts/jquery-fileupload/vendor/.DS_Store mode change 100644 => 100755 vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/jquery.Jcrop.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/jquery.color.js mode change 100644 => 100755 vendor/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/load-image-exif-map.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/load-image-exif.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/load-image-ios.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/load-image-meta.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/load-image-orientation.js mode change 100644 => 100755 vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js mode change 100644 => 100755 vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js create mode 100644 vendor/assets/stylesheets/.DS_Store rename vendor/assets/stylesheets/{jquery.fileupload-ui.scss => jquery.fileupload-ui.css} (62%) create mode 100755 vendor/assets/stylesheets/vendor/Jcrop.gif create mode 100755 vendor/assets/stylesheets/vendor/jquery.Jcrop.css diff --git a/Gemfile b/Gemfile old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 diff --git a/jquery-fileupload-rails.gemspec b/jquery-fileupload-rails.gemspec old mode 100644 new mode 100755 index 78b5549..264a35e --- a/jquery-fileupload-rails.gemspec +++ b/jquery-fileupload-rails.gemspec @@ -8,8 +8,8 @@ Gem::Specification.new do |s| s.authors = ["Tors Dalid"] s.email = ["cletedalid@gmail.com"] s.homepage = "https://github.com/tors/jquery-fileupload-rails" - s.summary = %q{jQuery File Upload for Rails 3.1 Asset Pipeline} - s.description = %q{jQuery File Upload by Sebastian Tschan integrated for Rails 3.1 Asset Pipeline} + s.summary = %q{jQuery File Upload for Rails Asset Pipeline} + s.description = %q{jQuery File Upload by Sebastian Tschan integrated for Rails Asset Pipeline} s.rubyforge_project = "jquery-fileupload-rails" diff --git a/lib/jquery-fileupload-rails.rb b/lib/jquery-fileupload-rails.rb old mode 100644 new mode 100755 diff --git a/lib/jquery/fileupload/rails/engine.rb b/lib/jquery/fileupload/rails/engine.rb old mode 100644 new mode 100755 diff --git a/lib/jquery/fileupload/rails/middleware.rb b/lib/jquery/fileupload/rails/middleware.rb old mode 100644 new mode 100755 diff --git a/lib/jquery/fileupload/rails/upload.rb b/lib/jquery/fileupload/rails/upload.rb old mode 100644 new mode 100755 diff --git a/lib/jquery/fileupload/rails/version.rb b/lib/jquery/fileupload/rails/version.rb old mode 100644 new mode 100755 index 10fbdc9..83e8d80 --- a/lib/jquery/fileupload/rails/version.rb +++ b/lib/jquery/fileupload/rails/version.rb @@ -1,7 +1,7 @@ module JQuery module FileUpload module Rails - VERSION = "0.4.1" + VERSION = "1.0.0" end end end diff --git a/public/.DS_Store b/public/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5eb0d47d49a17dc0af30b53332529853c93c19e1 GIT binary patch literal 6148 zcmeHK%}T>S5Z<*>Q-2^Ap~uB@k=hDX@DM@;k3tGPSka^r8wlCbr1nswL3|(I#^-Tn zcUvqLyouNu*!?E+vzz%KyBWq9_a@OXV-91?hJnaYSs`d%>Dn;C6+n(_gwt#kCNhNQ zcjNo(fbVXx0h4UZvajzSj*>Xb8;uXXQL#3+wrzXI-s|_`G?G(KPSPm5_J?xn$I*Ql zjBk{l2l*uPg0b>k1^Ey>O7BXUfZjLJy*SE;w@z&~J8L)UqSb5`bunwBe$qNEifYxa zI&b#D;nDeJH+U+ZUrNm*2bz`a8=S){D2pj1JN~DYE(xDOsWL{w7{$cbnGQCM;LSsmKwnW z!gVU3PUWV>;5r@b!o;}-ON~06akVq7V|Jc5FI?>ocA>%<|rE|CIr5b^MM8)tS5XTb+2<3K(}VP%y4U1qAe^p8$BkbEKx6+AmOt ZIM-mQ5m!OGN(ZDL0YwN+#K12w@Ckn8Os@a{ literal 0 HcmV?d00001 diff --git a/public/cors/postmessage.html b/public/cors/postmessage.html new file mode 100755 index 0000000..3d1448f --- /dev/null +++ b/public/cors/postmessage.html @@ -0,0 +1,75 @@ + + + + + +jQuery File Upload Plugin postMessage API + + + + + + \ No newline at end of file diff --git a/public/cors/result.html b/public/cors/result.html new file mode 100755 index 0000000..2251314 --- /dev/null +++ b/public/cors/result.html @@ -0,0 +1,24 @@ + + + + + +jQuery Iframe Transport Plugin Redirect Page + + + + + diff --git a/vendor/.DS_Store b/vendor/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c32883842752acf742ff9e4a68f0123bb24f31f0 GIT binary patch literal 6148 zcmeHKISv9b4733uBpOP}e1RWC2wuPkI6EYYg?=mE#nTuc1!$pz0yJJZlQ^ENc8Yi{ zB09h9XCf038Nm(ZYD3p--@IeJj3^L}GtScNo857HIvqRNuLH&%%0?PIhey6`(5L_v zpaN8Y3Q&QME0862H2(O>Jdg@dfnQg^?uP<5tch))UmX~{1pp2ZcEj9z31G1RuqL*F zh`==`Eo-SGgIZ^>C@T@>TmJ_T0OZc1q z|Cz)U6`%rtrGO3=tHm6jl(n_*!P3;Q3EO;C|m!(x(D|iS+!J|;YgD!4jijBmkG^u5&)ga#dWBhOY zd;H$a2%Bwt5O&>lnFnvam-i#n_c5925RqsNgBnqph#V+mVFkks;W+D*EErD_DAYST zl=!2h??P5!&!@*> zFNjC2c-RY)lXf>AwZov}dxLMvPQ7%Pw7h|e9C~RN5oI66aRmF+WFLn?+C3|;jmH~} zjf&jbs!b|#yuDq8z1f^hibbbbesI35f89Me@@^)#cbVo+V5?EGYVZ~AVdPo~lJm&N ztXz-_T(<|kDDGXr&#@9+qWf!TLgzF98+}T1JJ~xiQETp?`^L`iU}8>FKXWoCWs02y zZ2X{zR|j=5cK!}K^=6|Y>(%-Ub{^llPD*HHMpJoqW~ThY4wlb{74soEr4QSI{o$4Y z%fO#vfcFOpWpoW@8r9Z;L0tiW1-O;K=DP&fNQ17yOd}!?p-X|fRG2G<(B<$;ljj=D zH0p8^YG%C0%q+|eMX1@~mnxlvtI>{@0n0$1fkpjT=JS7l{{25+WS=YpmVy6@0a4g% z@3qj9Ia{Zi<>Fqq?58GID4L6smT*#No*GmY>->>mL|gB>gb@5;an D8@}E9 literal 0 HcmV?d00001 diff --git a/vendor/assets/images/.DS_Store b/vendor/assets/images/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T09Mg*~hnGH$z0i?FQRKWg@bm5(_0XzliLYIwA$*nE?tlMnaFYNjDTy zG!o5@X=Fg2-3r~&J$0!`-_NfJPY351lShHyOFMoP`-pz`J5iWsmCA=G%oJzm<}GW% zS~_op?I7;Cakm|$XSG(`tA#<+_mT@`XI|D#T`y5Rr(V`VkFx7=9Kk*}(Ty<3T9@Uu zet&0wXT#px+a7G#{ey!F?A^n`pj5I-^gx781?p5`N(`aX;kQkkV=&jK(@ChAF^-v8 zmq`$5X`{XhP@{#QZVFaylM|71WEtF@|&y_vUlWS8=- twV_u~DKakC_>}@fJ;jKXPw^U53H-J+fR4djBRmlP5l}R6!wgK6flrU(TF?Lh literal 0 HcmV?d00001 diff --git a/vendor/assets/javascripts/jquery-fileupload/.DS_Store b/vendor/assets/javascripts/jquery-fileupload/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8d319e4e318738af5c3766b4e10f9fa4ec06d08b GIT binary patch literal 15364 zcmeI1du$X%9LMMPYbm?1Yo`eEy28<_lv3a*l$M8beeftydT?#8Esyr@cA+cV+j@J~ zqNUIviGL7`h$beYiHR8H5Bvv&_>X@O6B0~(Z8Z3dCdPz+Bt|1@FwQ=%X|L{orXgk~ z+4;@R{C+c?&&_wPGe-!4hODxhkRTyMV2^F7#Ik=$cDwydO6b)TF$*l7C}vVm7=}K{ zlUHy8oB$`l32*|O!2LpieP`QAnCV)ca{`qW zwUbzx+688Vo(+3;)U~XIC2&KTbwj~BVt^aY>VuwN*t4Uqb;AjGhY#>Z2JeId&giWF zpyN&;>{_040-V5P0`}RxkR*vg(!?BpelH?}L?tPr*iDHcb0DD`3FiDxVnEl-Oepj@ zU_s%uqUnM#Ly-2zw3K2DH5l2HV(yFf8ADM`Q4{g>0jHdaXR>BPJnghZ;+a0y;*{Ii zZ2>Fq_q=18lIiQA^M;3O>ef{SYeF?6Rl(uf+E7(+?V7rg5m6LGdRmxMwsO<<0nSlDS@{w5ZQen%TKb>gsJ4_Xa`Ja(9OY!JI8|axjBBBo1-{mrX)Xb;9$?}Ua5!9 z8r0OG)`5&>q|6RAZ8F;Y=6qM zy_0D}*CU3h+1+$?X4In@+h>q%zteO-;8C*?ha=W>QTlTIz6YP&2iJuC}G({b~tR ziJ~=s!9psP%8PSN`5_{`BJ5Y#crAuv_o-M*%F3x+DnIHMAqe|y|Hib+a>c4xR!OBQ zd8MDbNaI4A$v{}4)zws5E3NbQG{v?fY~5LP>o-t&lk~Wsr$804U5_VJ-3r$?P`OFk z>hHQ!j19Vf1{O~|bg*_UW3sU}UNlk_q{50f+GW%4?? zOx`6|$u)AFd`P|^-;kfk&*WF~JGo2#0E8JpVF4_JQdk7bVJ&Qe2G|8Hup7D|2}j^b z7=~kT98SO~I0G-iD{ukcgty>rxCB?>efR)Af{)=-_zZ5r4{#gqz@P9J+=IWd2#awp zmf}*Zz-3sC8?h0aF^X;2fiXOU24?XDK8t7Z1w4o6@d94LtL{`VCun=m8JF-Hd&$?W zw>K4>^3m@w=mLtyb5^~hxE@x-?=ay^U>YAuh zrt5&bNDAhbR{oM}XF5`k3ic*Ir(1!t@`oQ;BuV*RxoAq*RCI}2>9 zplGeGUK5aNZx?B`}{m`=0m8yW-B7HONGn@CNO7Fx|ab_V1Y zsnyR-pgTocWbN4-4an_s%-`*XKn1I-dtX3WAeMSdi=$sO_=xd#%= zhcc*y5Nv=j)I$?&fo%|h4(NqGc!DWYhb)Z1Gfb7w!Siqy&cS(j11`d4xWbfq4c>$6 za1%a(ui$I=7QTb;nL2-gyNFnT)0jF1EW!D>m}#>Tt8fLb!a5A&R*c{tPo+J082fPu zkK$8!5>Mlc_^K<$F?}Y-iIWxawS0XJM$;+XNF8SNIZaOt;cuJ(C%_4C0-OLRFogsP z+_8f8{r?vK-~XrZFXBUS0-V596M({|Xj20l)$jjvWNktA^s>iJw%@30oe-AUE_S_h z9nW6u>v-p$g4KDq6Ha^B^BZ-o6VBqCaAv3I$AJ6o-j1LD`T3tr?fKu9a$W!c literal 0 HcmV?d00001 diff --git a/vendor/assets/javascripts/jquery-fileupload/basic.js b/vendor/assets/javascripts/jquery-fileupload/basic.js old mode 100644 new mode 100755 diff --git a/vendor/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js b/vendor/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js index 931b635..2b4cbc5 100755 --- a/vendor/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js +++ b/vendor/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js @@ -1,5 +1,5 @@ /* - * jQuery postMessage Transport Plugin 1.1 + * jQuery postMessage Transport Plugin 1.1.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2011, Sebastian Tschan @@ -64,8 +64,9 @@ xhrUpload = options.xhr().upload; return { send: function (_, completeCallback) { + counter += 1; var message = { - id: 'postmessage-transport-' + (counter += 1) + id: 'postmessage-transport-' + counter }, eventName = 'message.' + message.id; iframe = $( diff --git a/vendor/assets/javascripts/jquery-fileupload/index.js b/vendor/assets/javascripts/jquery-fileupload/index.js old mode 100644 new mode 100755 index 0cda385..5ff2a9d --- a/vendor/assets/javascripts/jquery-fileupload/index.js +++ b/vendor/assets/javascripts/jquery-fileupload/index.js @@ -1,9 +1,18 @@ //=require jquery-fileupload/vendor/jquery.ui.widget +//=require jquery-fileupload/vendor/tmpl //=require jquery-fileupload/vendor/load-image +//=require jquery-fileupload/vendor/load-image-ios +//=require jquery-fileupload/vendor/load-image-orientation +//=require jquery-fileupload/vendor/load-image-meta +//=require jquery-fileupload/vendor/load-image-exif +//=require jquery-fileupload/vendor/load-image-exif-map //=require jquery-fileupload/vendor/canvas-to-blob -//=require jquery-fileupload/vendor/tmpl //=require jquery-fileupload/jquery.iframe-transport //=require jquery-fileupload/jquery.fileupload -//=require jquery-fileupload/jquery.fileupload-fp +//=require jquery-fileupload/jquery.fileupload-image +//=require jquery-fileupload/jquery.fileupload-process +//=require jquery-fileupload/jquery.fileupload-audio +//=require jquery-fileupload/jquery.fileupload-video +//=require jquery-fileupload/jquery.fileupload-validate //=require jquery-fileupload/jquery.fileupload-ui //=require jquery-fileupload/locale diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-angular.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-angular.js index e7ba784..572be29 100755 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-angular.js +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-angular.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload AngularJS Plugin 1.0.1 + * jQuery File Upload AngularJS Plugin 1.4.5 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -10,20 +10,42 @@ */ /*jslint nomen: true, unparam: true */ -/*global angular */ +/*global define, angular */ -(function () { +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'angular', + './jquery.fileupload-image', + './jquery.fileupload-audio', + './jquery.fileupload-video', + './jquery.fileupload-validate' + ], factory); + } else { + factory(); + } +}(function () { 'use strict'; angular.module('blueimp.fileupload', []) + // The fileUpload service provides configuration options + // for the fileUpload directive and default handlers for + // File Upload events: .provider('fileUpload', function () { var scopeApply = function () { var scope = angular.element(this) - .fileupload('option', 'scope')(); - if (!scope.$$phase) { + .fileupload('option', 'scope')(), + $timeout = angular.injector(['ng']) + .get('$timeout'); + // Safe apply, makes sure $apply is called + // asynchronously outside of the $digest cycle: + $timeout(function () { scope.$apply(); - } + }); }, $config; $config = this.defaults = { @@ -47,19 +69,22 @@ submit = function () { return data.submit(); }; + angular.forEach(data.files, function (file, index) { + file._index = index; + file.$state = function () { + return data.state(); + }; + file.$progress = function () { + return data.progress(); + }; + file.$response = function () { + return data.response(); + }; + }); file.$cancel = function () { scope.clear(data.files); return data.abort(); }; - file.$state = function () { - return data.state(); - }; - file.$progress = function () { - return data.progress(); - }; - file.$response = function () { - return data.response(); - }; if (file.$state() === 'rejected') { file._$submit = submit; } else { @@ -96,10 +121,11 @@ if (data.errorThrown === 'abort') { return; } - if (data.dataType.indexOf('json') === data.dataType.length - 4) { + if (data.dataType && + data.dataType.indexOf('json') === data.dataType.length - 4) { try { data.result = angular.fromJson(data.jqXHR.responseText); - } catch (err) {} + } catch (ignore) {} } data.scope().$apply(function () { data.handleResponse.call(that, e, data); @@ -112,7 +138,6 @@ return this.scope().queue.length; }, dataType: 'json', - prependFiles: true, autoUpload: false }; this.$get = [ @@ -124,8 +149,9 @@ ]; }) + // Format byte numbers to readable presentations: .provider('formatFileSizeFilter', function () { - var $config = this.defaults = { + var $config = { // Byte units following the IEC format // http://en.wikipedia.org/wiki/Kilobyte units: [ @@ -134,28 +160,58 @@ {size: 1000, suffix: ' KB'} ] }; + this.defaults = $config; this.$get = function () { return function (bytes) { if (!angular.isNumber(bytes)) { return ''; } var unit = true, - i = -1; + i = 0, + prefix, + suffix; while (unit) { - unit = $config.units[i += 1]; + unit = $config.units[i]; + prefix = unit.prefix || ''; + suffix = unit.suffix || ''; if (i === $config.units.length - 1 || bytes >= unit.size) { - return (bytes / unit.size).toFixed(2) + unit.suffix; + return prefix + (bytes / unit.size).toFixed(2) + suffix; } + i += 1; } }; }; }) + // The FileUploadController initializes the fileupload widget and + // provides scope methods to control the File Upload functionality: .controller('FileUploadController', [ - '$scope', '$element', '$attrs', 'fileUpload', - function ($scope, $element, $attrs, fileUpload) { - $scope.disabled = angular.element('') - .prop('disabled'); + '$scope', '$element', '$attrs', '$window', 'fileUpload', + function ($scope, $element, $attrs, $window, fileUpload) { + var uploadMethods = { + progress: function () { + return $element.fileupload('progress'); + }, + active: function () { + return $element.fileupload('active'); + }, + option: function (option, data) { + return $element.fileupload('option', option, data); + }, + add: function (data) { + return $element.fileupload('add', data); + }, + send: function (data) { + return $element.fileupload('send', data); + }, + process: function (data) { + return $element.fileupload('process', data); + }, + processing: function (data) { + return $element.fileupload('processing', data); + } + }; + $scope.disabled = !$window.jQuery.support.fileInput; $scope.queue = $scope.queue || []; $scope.clear = function (files) { var queue = this.queue, @@ -167,7 +223,8 @@ length = files.length; } while (i) { - if (queue[i -= 1] === file) { + i -= 1; + if (queue[i] === file) { return queue.splice(i, length); } } @@ -186,27 +243,6 @@ } } }; - $scope.progress = function () { - return $element.fileupload('progress'); - }; - $scope.active = function () { - return $element.fileupload('active'); - }; - $scope.option = function (option, data) { - return $element.fileupload('option', option, data); - }; - $scope.add = function (data) { - return $element.fileupload('add', data); - }; - $scope.send = function (data) { - return $element.fileupload('send', data); - }; - $scope.process = function (data) { - return $element.fileupload('process', data); - }; - $scope.processing = function (data) { - return $element.fileupload('processing', data); - }; $scope.applyOnQueue = function (method) { var list = this.queue.slice(0), i, @@ -224,6 +260,8 @@ $scope.cancel = function () { this.applyOnQueue('$cancel'); }; + // Add upload methods to the scope: + angular.extend($scope, uploadMethods); // The fileupload widget will initialize with // the options provided via "data-"-parameters, // as well as those given via options object: @@ -260,12 +298,23 @@ 'fileuploadprocessalways', 'fileuploadprocessstop' ].join(' '), function (e, data) { - $scope.$emit(e.type, data); + if ($scope.$emit(e.type, data).defaultPrevented) { + e.preventDefault(); + } + }).on('remove', function () { + // Remove upload methods from the scope, + // when the widget is removed: + var method; + for (method in uploadMethods) { + if (uploadMethods.hasOwnProperty(method)) { + delete $scope[method]; + } + } }); // Observe option changes: $scope.$watch( - $attrs.fileupload, - function (newOptions, oldOptions) { + $attrs.fileUpload, + function (newOptions) { if (newOptions) { $element.fileupload('option', newOptions); } @@ -274,10 +323,11 @@ } ]) + // Provide File Upload progress feedback: .controller('FileUploadProgressController', [ '$scope', '$attrs', '$parse', function ($scope, $attrs, $parse) { - var fn = $parse($attrs.progress), + var fn = $parse($attrs.fileUploadProgress), update = function () { var progress = fn($scope); if (!progress || !progress.total) { @@ -289,7 +339,7 @@ }; update(); $scope.$watch( - $attrs.progress + '.loaded', + $attrs.fileUploadProgress + '.loaded', function (newValue, oldValue) { if (newValue !== oldValue) { update(); @@ -299,10 +349,11 @@ } ]) + // Display File Upload previews: .controller('FileUploadPreviewController', [ '$scope', '$element', '$attrs', '$parse', function ($scope, $element, $attrs, $parse) { - var fn = $parse($attrs.preview), + var fn = $parse($attrs.fileUploadPreview), file = fn($scope); if (file.preview) { $element.append(file.preview); @@ -310,26 +361,30 @@ } ]) - .directive('fileupload', function () { + .directive('fileUpload', function () { return { - controller: 'FileUploadController' + controller: 'FileUploadController', + scope: true }; }) - .directive('progress', function () { + .directive('fileUploadProgress', function () { return { - controller: 'FileUploadProgressController' + controller: 'FileUploadProgressController', + scope: true }; }) - .directive('preview', function () { + .directive('fileUploadPreview', function () { return { controller: 'FileUploadPreviewController' }; }) + // Enhance the HTML5 download attribute to + // allow drag&drop of files to the desktop: .directive('download', function () { - return function (scope, elm, attrs) { + return function (scope, elm) { elm.on('dragstart', function (e) { try { e.originalEvent.dataTransfer.setData( @@ -340,9 +395,9 @@ elm.prop('href') ].join(':') ); - } catch (err) {} + } catch (ignore) {} }); }; }); -}()); +})); diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-audio.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-audio.js new file mode 100755 index 0000000..f59c2fa --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-audio.js @@ -0,0 +1,106 @@ +/* + * jQuery File Upload Audio Preview Plugin 1.0.3 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true, regexp: true */ +/*global define, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + './jquery.fileupload-process' + ], factory); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadAudio', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + disabled: '@disableAudioPreview' + }, + { + action: 'setAudio', + name: '@audioPreviewName', + disabled: '@disableAudioPreview' + } + ); + + // The File Upload Audio Preview plugin extends the fileupload widget + // with audio preview functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of audio files to load, + // matched against the file type: + loadAudioFileTypes: /^audio\/.*$/ + }, + + _audioElement: document.createElement('audio'), + + processActions: { + + // Loads the audio file given via data.files and data.index + // as audio element if the browser supports playing it. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadAudio: function (data, options) { + if (options.disabled) { + return data; + } + var file = data.files[data.index], + url, + audio; + if (this._audioElement.canPlayType && + this._audioElement.canPlayType(file.type) && + ($.type(options.maxFileSize) !== 'number' || + file.size <= options.maxFileSize) && + (!options.fileTypes || + options.fileTypes.test(file.type))) { + url = loadImage.createObjectURL(file); + if (url) { + audio = this._audioElement.cloneNode(false); + audio.src = url; + audio.controls = true; + data.audio = audio; + return data; + } + } + return data; + }, + + // Sets the audio element as a property of the file object: + setAudio: function (data, options) { + if (data.audio && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.audio; + } + return data; + } + + } + + }); + +})); diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js deleted file mode 100644 index c782f1e..0000000 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js +++ /dev/null @@ -1,227 +0,0 @@ -/* - * jQuery File Upload File Processing Plugin 1.2.3 - * https://github.com/blueimp/jQuery-File-Upload - * - * Copyright 2012, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - */ - -/*jslint nomen: true, unparam: true, regexp: true */ -/*global define, window, document */ - -(function (factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { - // Register as an anonymous AMD module: - define([ - 'jquery', - 'load-image', - 'canvas-to-blob', - './jquery.fileupload' - ], factory); - } else { - // Browser globals: - factory( - window.jQuery, - window.loadImage - ); - } -}(function ($, loadImage) { - 'use strict'; - - // The File Upload FP version extends the fileupload widget - // with file processing functionality: - $.widget('blueimp.fileupload', $.blueimp.fileupload, { - - options: { - // The list of file processing actions: - process: [ - /* - { - action: 'load', - fileTypes: /^image\/(gif|jpeg|png)$/, - maxFileSize: 20000000 // 20MB - }, - { - action: 'resize', - maxWidth: 1920, - maxHeight: 1200, - minWidth: 800, - minHeight: 600 - }, - { - action: 'save' - } - */ - ], - - // The add callback is invoked as soon as files are added to the - // fileupload widget (via file input selection, drag & drop or add - // API call). See the basic file upload widget for more information: - add: function (e, data) { - if (data.autoUpload || (data.autoUpload !== false && - ($(this).data('blueimp-fileupload') || - $(this).data('fileupload')).options.autoUpload)) { - $(this).fileupload('process', data).done(function () { - data.submit(); - }); - } - } - }, - - processActions: { - // Loads the image given via data.files and data.index - // as img element if the browser supports canvas. - // Accepts the options fileTypes (regular expression) - // and maxFileSize (integer) to limit the files to load: - load: function (data, options) { - var that = this, - file = data.files[data.index], - dfd = $.Deferred(); - if (window.HTMLCanvasElement && - window.HTMLCanvasElement.prototype.toBlob && - ($.type(options.maxFileSize) !== 'number' || - file.size < options.maxFileSize) && - (!options.fileTypes || - options.fileTypes.test(file.type))) { - loadImage( - file, - function (img) { - if (!img.src) { - return dfd.rejectWith(that, [data]); - } - data.img = img; - dfd.resolveWith(that, [data]); - } - ); - } else { - dfd.rejectWith(that, [data]); - } - return dfd.promise(); - }, - // Resizes the image given as data.img and updates - // data.canvas with the resized image as canvas element. - // Accepts the options maxWidth, maxHeight, minWidth and - // minHeight to scale the given image: - resize: function (data, options) { - var img = data.img, - canvas; - options = $.extend({canvas: true}, options); - if (img) { - canvas = loadImage.scale(img, options); - if (canvas.width !== img.width || - canvas.height !== img.height) { - data.canvas = canvas; - } - } - return data; - }, - // Saves the processed image given as data.canvas - // inplace at data.index of data.files: - save: function (data, options) { - // Do nothing if no processing has happened: - if (!data.canvas) { - return data; - } - var that = this, - file = data.files[data.index], - name = file.name, - dfd = $.Deferred(), - callback = function (blob) { - if (!blob.name) { - if (file.type === blob.type) { - blob.name = file.name; - } else if (file.name) { - blob.name = file.name.replace( - /\..+$/, - '.' + blob.type.substr(6) - ); - } - } - // Store the created blob at the position - // of the original file in the files list: - data.files[data.index] = blob; - dfd.resolveWith(that, [data]); - }; - // Use canvas.mozGetAsFile directly, to retain the filename, as - // Gecko doesn't support the filename option for FormData.append: - if (data.canvas.mozGetAsFile) { - callback(data.canvas.mozGetAsFile( - (/^image\/(jpeg|png)$/.test(file.type) && name) || - ((name && name.replace(/\..+$/, '')) || - 'blob') + '.png', - file.type - )); - } else { - data.canvas.toBlob(callback, file.type); - } - return dfd.promise(); - } - }, - - // Resizes the file at the given index and stores the created blob at - // the original position of the files list, returns a Promise object: - _processFile: function (files, index, options) { - var that = this, - dfd = $.Deferred().resolveWith(that, [{ - files: files, - index: index - }]), - chain = dfd.promise(); - that._processing += 1; - $.each(options.process, function (i, settings) { - chain = chain.pipe(function (data) { - return that.processActions[settings.action] - .call(this, data, settings); - }); - }); - chain.always(function () { - that._processing -= 1; - if (that._processing === 0) { - that.element - .removeClass('fileupload-processing'); - } - }); - if (that._processing === 1) { - that.element.addClass('fileupload-processing'); - } - return chain; - }, - - // Processes the files given as files property of the data parameter, - // returns a Promise object that allows to bind a done handler, which - // will be invoked after processing all files (inplace) is done: - process: function (data) { - var that = this, - options = $.extend({}, this.options, data); - if (options.process && options.process.length && - this._isXHRUpload(options)) { - $.each(data.files, function (index, file) { - that._processingQueue = that._processingQueue.pipe( - function () { - var dfd = $.Deferred(); - that._processFile(data.files, index, options) - .always(function () { - dfd.resolveWith(that); - }); - return dfd.promise(); - } - ); - }); - } - return this._processingQueue; - }, - - _create: function () { - this._super(); - this._processing = 0; - this._processingQueue = $.Deferred().resolveWith(this) - .promise(); - } - - }); - -})); diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-resize.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-image.js similarity index 56% rename from vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-resize.js rename to vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-image.js index ae5c5be..9e6d699 100755 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-resize.js +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-image.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Image Resize Plugin 1.1.2 + * jQuery File Upload Image Preview & Resize Plugin 1.3.0 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -10,7 +10,7 @@ */ /*jslint nomen: true, unparam: true, regexp: true */ -/*global define, window */ +/*global define, window, document, DataView, Blob, Uint8Array */ (function (factory) { 'use strict'; @@ -19,6 +19,9 @@ define([ 'jquery', 'load-image', + 'load-image-meta', + 'load-image-exif', + 'load-image-ios', 'canvas-to-blob', './jquery.fileupload-process' ], factory); @@ -34,41 +37,61 @@ // Prepend to the default processQueue: $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadImageMetaData', + disableImageHead: '@', + disableExif: '@', + disableExifThumbnail: '@', + disableExifSub: '@', + disableExifGps: '@', + disabled: '@disableImageMetaDataLoad' + }, { action: 'loadImage', - fileTypes: '@loadImageFileTypes', - maxFileSize: '@loadImageMaxFileSize', - noRevoke: '@loadImageNoRevoke', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + noRevoke: '@', disabled: '@disableImageLoad' }, { action: 'resizeImage', - maxWidth: '@imageMaxWidth', - maxHeight: '@imageMaxHeight', - minWidth: '@imageMinWidth', - minHeight: '@imageMinHeight', - crop: '@imageCrop', + // Use "image" as prefix for the "@" options: + prefix: 'image', + maxWidth: '@', + maxHeight: '@', + minWidth: '@', + minHeight: '@', + crop: '@', + orientation: '@', disabled: '@disableImageResize' }, { action: 'saveImage', disabled: '@disableImageResize' }, + { + action: 'saveImageMetaData', + disabled: '@disableImageMetaDataSave' + }, { action: 'resizeImage', - maxWidth: '@previewMaxWidth', - maxHeight: '@previewMaxHeight', - minWidth: '@previewMinWidth', - minHeight: '@previewMinHeight', - crop: '@previewCrop', - canvas: '@previewAsCanvas', + // Use "preview" as prefix for the "@" options: + prefix: 'preview', + maxWidth: '@', + maxHeight: '@', + minWidth: '@', + minHeight: '@', + crop: '@', + orientation: '@', + thumbnail: '@', + canvas: '@', disabled: '@disableImagePreview' }, { action: 'setImage', - // The name of the property the resized image - // is saved as on the associated file object: - name: 'preview', + name: '@imagePreviewName', disabled: '@disableImagePreview' } ); @@ -82,11 +105,14 @@ // matched against the file type: loadImageFileTypes: /^image\/(gif|jpeg|png)$/, // The maximum file size of images to load: - loadImageMaxFileSize: 5000000, // 5MB + loadImageMaxFileSize: 10000000, // 10MB // The maximum width of resized images: imageMaxWidth: 1920, // The maximum height of resized images: imageMaxHeight: 1080, + // Defines the image orientation (1-8) or takes the orientation + // value from Exif data if set to true: + imageOrientation: false, // Define if resized images should be cropped or only scaled: imageCrop: false, // Disable the resize image functionality by default: @@ -95,16 +121,21 @@ previewMaxWidth: 80, // The maximum height of the preview images: previewMaxHeight: 80, + // Defines the preview orientation (1-8) or takes the orientation + // value from Exif data if set to true: + previewOrientation: true, + // Create the preview using the Exif data thumbnail: + previewThumbnail: true, // Define if preview images should be cropped or only scaled: previewCrop: false, // Define if preview images should be resized as canvas elements: - previewAsCanvas: true + previewCanvas: true }, processActions: { // Loads the image given via data.files and data.index - // as img element if the browser supports canvas. + // as img element, if the browser supports the File API. // Accepts the options fileTypes (regular expression) // and maxFileSize (integer) to limit the files to load: loadImage: function (data, options) { @@ -121,34 +152,56 @@ !loadImage( file, function (img) { - if (!img.src) { - return dfd.rejectWith(that, [data]); + if (img.src) { + data.img = img; } - data.img = img; dfd.resolveWith(that, [data]); }, options )) { - dfd.rejectWith(that, [data]); + return data; } return dfd.promise(); }, // Resizes the image given as data.canvas or data.img // and updates data.canvas or data.img with the resized image. + // Also stores the resized image as preview property. // Accepts the options maxWidth, maxHeight, minWidth, // minHeight, canvas and crop: resizeImage: function (data, options) { + if (options.disabled) { + return data; + } options = $.extend({canvas: true}, options); - var img = (options.canvas && data.canvas) || data.img, - canvas; - if (img && !options.disabled) { - canvas = loadImage.scale(img, options); - if (canvas && (canvas.width !== img.width || - canvas.height !== img.height)) { - data[canvas.getContext ? 'canvas' : 'img'] = canvas; + var that = this, + dfd = $.Deferred(), + img = (options.canvas && data.canvas) || data.img, + resolve = function (newImg) { + if (newImg && (newImg.width !== img.width || + newImg.height !== img.height)) { + data[newImg.getContext ? 'canvas' : 'img'] = newImg; + } + data.preview = newImg; + dfd.resolveWith(that, [data]); + }, + thumbnail; + if (data.exif) { + if (options.orientation === true) { + options.orientation = data.exif.get('Orientation'); + } + if (options.thumbnail) { + thumbnail = data.exif.get('Thumbnail'); + if (thumbnail) { + loadImage(thumbnail, resolve, options); + return dfd.promise(); + } } } + if (img) { + resolve(loadImage.scale(img, options)); + return dfd.promise(); + } return data; }, @@ -195,12 +248,41 @@ return dfd.promise(); }, + loadImageMetaData: function (data, options) { + if (options.disabled) { + return data; + } + var that = this, + dfd = $.Deferred(); + loadImage.parseMetaData(data.files[data.index], function (result) { + $.extend(data, result); + dfd.resolveWith(that, [data]); + }, options); + return dfd.promise(); + }, + + saveImageMetaData: function (data, options) { + if (!(data.imageHead && data.canvas && + data.canvas.toBlob && !options.disabled)) { + return data; + } + var file = data.files[data.index], + blob = new Blob([ + data.imageHead, + // Resized images always have a head size of 20 bytes, + // including the JPEG marker and a minimal JFIF header: + this._blobSlice.call(file, 20) + ], {type: file.type}); + blob.name = file.name; + data.files[data.index] = blob; + return data; + }, + // Sets the resized version of the image as a property of the // file object, must be called after "saveImage": setImage: function (data, options) { - var img = data.canvas || data.img; - if (img && !options.disabled) { - data.files[data.index][options.name] = img; + if (data.preview && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.preview; } return data; } diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-jquery-ui.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-jquery-ui.js new file mode 100755 index 0000000..05dd7a6 --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-jquery-ui.js @@ -0,0 +1,138 @@ +/* + * jQuery File Upload jQuery UI Plugin 8.7.0 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true */ +/*global define, window */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery', './jquery.fileupload-ui'], factory); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + progress: function (e, data) { + if (data.context) { + data.context.find('.progress').progressbar( + 'option', + 'value', + parseInt(data.loaded / data.total * 100, 10) + ); + } + }, + progressall: function (e, data) { + var $this = $(this); + $this.find('.fileupload-progress') + .find('.progress').progressbar( + 'option', + 'value', + parseInt(data.loaded / data.total * 100, 10) + ).end() + .find('.progress-extended').each(function () { + $(this).html( + ($this.data('blueimp-fileupload') || + $this.data('fileupload')) + ._renderExtendedProgress(data) + ); + }); + } + }, + + _renderUpload: function (func, files) { + var node = this._super(func, files), + showIconText = $(window).width() > 480; + node.find('.progress').empty().progressbar(); + node.find('.start').button({ + icons: {primary: 'ui-icon-circle-arrow-e'}, + text: showIconText + }); + node.find('.cancel').button({ + icons: {primary: 'ui-icon-cancel'}, + text: showIconText + }); + return node; + }, + + _renderDownload: function (func, files) { + var node = this._super(func, files), + showIconText = $(window).width() > 480; + node.find('.delete').button({ + icons: {primary: 'ui-icon-trash'}, + text: showIconText + }); + return node; + }, + + _transition: function (node) { + var deferred = $.Deferred(); + if (node.hasClass('fade')) { + node.fadeToggle( + this.options.transitionDuration, + this.options.transitionEasing, + function () { + deferred.resolveWith(node); + } + ); + } else { + deferred.resolveWith(node); + } + return deferred; + }, + + _create: function () { + this._super(); + this.element + .find('.fileupload-buttonbar') + .find('.fileinput-button').each(function () { + var input = $(this).find('input:file').detach(); + $(this) + .button({icons: {primary: 'ui-icon-plusthick'}}) + .append(input); + }) + .end().find('.start') + .button({icons: {primary: 'ui-icon-circle-arrow-e'}}) + .end().find('.cancel') + .button({icons: {primary: 'ui-icon-cancel'}}) + .end().find('.delete') + .button({icons: {primary: 'ui-icon-trash'}}) + .end().find('.progress').progressbar(); + }, + + _destroy: function () { + this.element + .find('.fileupload-buttonbar') + .find('.fileinput-button').each(function () { + var input = $(this).find('input:file').detach(); + $(this) + .button('destroy') + .append(input); + }) + .end().find('.start') + .button('destroy') + .end().find('.cancel') + .button('destroy') + .end().find('.delete') + .button('destroy') + .end().find('.progress').progressbar('destroy'); + this._super(); + } + + }); + +})); diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-process.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-process.js index 2f9eeed..87042c3 100755 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-process.js +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-process.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Processing Plugin 1.1 + * jQuery File Upload Processing Plugin 1.2.2 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2012, Sebastian Tschan @@ -98,14 +98,20 @@ _transformProcessQueue: function (options) { var processQueue = []; $.each(options.processQueue, function () { - var settings = {}; + var settings = {}, + action = this.action, + prefix = this.prefix === true ? action : this.prefix; $.each(this, function (key, value) { if ($.type(value) === 'string' && value.charAt(0) === '@') { - settings[key] = options[value.slice(1)]; + settings[key] = options[ + value.slice(1) || (prefix ? prefix + + key.charAt(0).toUpperCase() + key.slice(1) : key) + ]; } else { settings[key] = value; } + }); processQueue.push(settings); }); @@ -127,7 +133,7 @@ if (this._processing === 0) { this._trigger('processstart'); } - $.each(data.files, function (index, file) { + $.each(data.files, function (index) { var opts = index ? $.extend({}, options) : options, func = function () { return that._processFile(opts); diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js index 5d22346..2df88f9 100755 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload User Interface Plugin 8.2.1 + * jQuery File Upload User Interface Plugin 8.8.6 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan @@ -19,7 +19,9 @@ define([ 'jquery', 'tmpl', - './jquery.fileupload-resize', + './jquery.fileupload-image', + './jquery.fileupload-audio', + './jquery.fileupload-video', './jquery.fileupload-validate' ], factory); } else { @@ -118,7 +120,7 @@ !$.support.transition && 'progress-animated' ) .attr('aria-valuenow', 100) - .find('.bar').css( + .children().first().css( 'width', '100%' ); @@ -137,8 +139,8 @@ if (data.context) { data.context.each(function (index) { var file = files[index] || - {error: 'Empty file upload result'}, - deferred = that._addFinishedDeferreds(); + {error: 'Empty file upload result'}; + deferred = that._addFinishedDeferreds(); that._transition($(this)).done( function () { var node = $(this); @@ -157,8 +159,9 @@ ); }); } else { - template = that._renderDownload(files) - .appendTo(that.options.filesContainer); + template = that._renderDownload(files)[ + that.options.prependFiles ? 'prependTo' : 'appendTo' + ](that.options.filesContainer); that._forceReflow(template); deferred = that._addFinishedDeferreds(); that._transition(template).done( @@ -213,8 +216,9 @@ } }); } else if (data.errorThrown !== 'abort') { - data.context = that._renderUpload(data.files) - .appendTo(that.options.filesContainer) + data.context = that._renderUpload(data.files)[ + that.options.prependFiles ? 'prependTo' : 'appendTo' + ](that.options.filesContainer) .data('data', data); that._forceReflow(data.context); deferred = that._addFinishedDeferreds(); @@ -234,14 +238,16 @@ }, // Callback for upload progress events: progress: function (e, data) { + var progress = Math.floor(data.loaded / data.total * 100); if (data.context) { - var progress = Math.floor(data.loaded / data.total * 100); - data.context.find('.progress') - .attr('aria-valuenow', progress) - .find('.bar').css( - 'width', - progress + '%' - ); + data.context.each(function () { + $(this).find('.progress') + .attr('aria-valuenow', progress) + .children().first().css( + 'width', + progress + '%' + ); + }); } }, // Callback for global upload progress events: @@ -260,7 +266,7 @@ globalProgressNode .find('.progress') .attr('aria-valuenow', progress) - .find('.bar').css( + .children().first().css( 'width', progress + '%' ); @@ -289,7 +295,7 @@ function () { $(this).find('.progress') .attr('aria-valuenow', '0') - .find('.bar').css('width', '0%'); + .children().first().css('width', '0%'); $(this).find('.progress-extended').html(' '); deferred.resolve(); } @@ -304,16 +310,20 @@ // Callback for file deletion: destroy: function (e, data) { var that = $(this).data('blueimp-fileupload') || - $(this).data('fileupload'); - if (data.url) { - $.ajax(data).done(function () { + $(this).data('fileupload'), + removeNode = function () { that._transition(data.context).done( function () { $(this).remove(); that._trigger('destroyed', e, data); } ); - }); + }; + if (data.url) { + data.dataType = data.dataType || that.options.dataType; + $.ajax(data).done(removeNode); + } else { + removeNode(); } } }, @@ -453,9 +463,11 @@ _cancelHandler: function (e) { e.preventDefault(); - var template = $(e.currentTarget).closest('.template-upload'), + var template = $(e.currentTarget) + .closest('.template-upload,.template-download'), data = template.data('data') || {}; if (!data.jqXHR) { + data.context = data.context || template; data.errorThrown = 'abort'; this._trigger('fail', e, data); } else { @@ -606,6 +618,9 @@ _create: function () { this._super(); this._resetFinishedDeferreds(); + if (!$.support.fileInput) { + this._disableFileInputButton(); + } }, enable: function () { diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-validate.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-validate.js index 2599da8..ee1c2f2 100755 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-validate.js +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-validate.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Validation Plugin 1.0.2 + * jQuery File Upload Validation Plugin 1.1.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013, Sebastian Tschan @@ -37,10 +37,10 @@ // even if the previous action was rejected: always: true, // Options taken from the global options map: - acceptFileTypes: '@acceptFileTypes', - maxFileSize: '@maxFileSize', - minFileSize: '@minFileSize', - maxNumberOfFiles: '@maxNumberOfFiles', + acceptFileTypes: '@', + maxFileSize: '@', + minFileSize: '@', + maxNumberOfFiles: '@', disabled: '@disableValidation' } ); @@ -83,16 +83,17 @@ } var dfd = $.Deferred(), settings = this.options, - file = data.files[data.index], - numberOfFiles = settings.getNumberOfFiles(); - if (numberOfFiles && $.type(options.maxNumberOfFiles) === 'number' && - numberOfFiles + data.files.length > options.maxNumberOfFiles) { + file = data.files[data.index]; + if ($.type(options.maxNumberOfFiles) === 'number' && + (settings.getNumberOfFiles() || 0) + data.files.length > + options.maxNumberOfFiles) { file.error = settings.i18n('maxNumberOfFiles'); } else if (options.acceptFileTypes && !(options.acceptFileTypes.test(file.type) || options.acceptFileTypes.test(file.name))) { file.error = settings.i18n('acceptFileTypes'); - } else if (options.maxFileSize && file.size > options.maxFileSize) { + } else if (options.maxFileSize && file.size > + options.maxFileSize) { file.error = settings.i18n('maxFileSize'); } else if ($.type(file.size) === 'number' && file.size < options.minFileSize) { diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-video.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-video.js new file mode 100755 index 0000000..c8b1019 --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-video.js @@ -0,0 +1,106 @@ +/* + * jQuery File Upload Video Preview Plugin 1.0.3 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, unparam: true, regexp: true */ +/*global define, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + './jquery.fileupload-process' + ], factory); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadVideo', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + disabled: '@disableVideoPreview' + }, + { + action: 'setVideo', + name: '@videoPreviewName', + disabled: '@disableVideoPreview' + } + ); + + // The File Upload Video Preview plugin extends the fileupload widget + // with video preview functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of video files to load, + // matched against the file type: + loadVideoFileTypes: /^video\/.*$/ + }, + + _videoElement: document.createElement('video'), + + processActions: { + + // Loads the video file given via data.files and data.index + // as video element if the browser supports playing it. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadVideo: function (data, options) { + if (options.disabled) { + return data; + } + var file = data.files[data.index], + url, + video; + if (this._videoElement.canPlayType && + this._videoElement.canPlayType(file.type) && + ($.type(options.maxFileSize) !== 'number' || + file.size <= options.maxFileSize) && + (!options.fileTypes || + options.fileTypes.test(file.type))) { + url = loadImage.createObjectURL(file); + if (url) { + video = this._videoElement.cloneNode(false); + video.src = url; + video.controls = true; + data.video = video; + return data; + } + } + return data; + }, + + // Sets the video element as a property of the file object: + setVideo: function (data, options) { + if (data.video && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.video; + } + return data; + } + + } + + }); + +})); diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload.js b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload.js index 03678f3..faa71a6 100755 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload.js +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload Plugin 5.31.1 + * jQuery File Upload Plugin 5.32.6 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan @@ -10,7 +10,7 @@ */ /*jslint nomen: true, unparam: true, regexp: true */ -/*global define, window, document, File, Blob, FormData, location */ +/*global define, window, document, location, File, Blob, FormData */ (function (factory) { 'use strict'; @@ -27,12 +27,28 @@ }(function ($) { 'use strict'; + // Detect file input support, based on + // http://viljamis.com/blog/2012/file-upload-support-on-mobile/ + $.support.fileInput = !(new RegExp( + // Handle devices which give false positives for the feature detection: + '(Android (1\\.[0156]|2\\.[01]))' + + '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' + + '|(w(eb)?OSBrowser)|(webOS)' + + '|(Kindle/(1\\.0|2\\.[05]|3\\.0))' + ).test(window.navigator.userAgent) || + // Feature detection for all other devices: + $('').prop('disabled')); + // The FileReader API is not actually used, but works as feature detection, // as e.g. Safari supports XHR file uploads via the FormData API, // but not non-multipart XHR file uploads: $.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader); $.support.xhrFormDataFileUpload = !!window.FormData; + // Detect support for Blob slicing (required for chunked uploads): + $.support.blobSlice = window.Blob && (Blob.prototype.slice || + Blob.prototype.webkitSlice || Blob.prototype.mozSlice); + // The fileupload widget listens for change events on file input fields defined // via fileInput setting and paste or drop events of the given dropZone. // In addition to the default jQuery Widget methods, the fileupload widget @@ -144,13 +160,16 @@ // The add callback is invoked as soon as files are added to the fileupload // widget (via file input selection, drag & drop, paste or add API call). // If the singleFileUploads option is enabled, this callback will be - // called once for each file in the selection for XHR file uplaods, else + // called once for each file in the selection for XHR file uploads, else // once for each file selection. + // // The upload starts when the submit method is invoked on the data parameter. // The data object contains a files property holding the added files - // and allows to override plugin options as well as define ajax settings. + // and allows you to override plugin options as well as define ajax settings. + // // Listeners for this callback can also be bound the following way: // .bind('fileuploadadd', func); + // // data.submit() returns a Promise object and allows to attach additional // handlers using jQuery's Deferred callbacks: // data.submit().done(func).fail(func).always(func); @@ -233,6 +252,11 @@ 'forceIframeTransport' ], + _blobSlice: $.support.blobSlice && function () { + var slice = this.slice || this.webkitSlice || this.mozSlice; + return slice.apply(this, arguments); + }, + _BitrateTimer: function () { this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime()); this.loaded = 0; @@ -375,13 +399,15 @@ // Ignore non-multipart setting if not supported: multipart = options.multipart || !$.support.xhrFileUpload, paramName = options.paramName[0]; - options.headers = options.headers || {}; + options.headers = $.extend({}, options.headers); if (options.contentRange) { options.headers['Content-Range'] = options.contentRange; } - if (!multipart) { + if (!multipart || options.blob || !this._isInstanceOf('File', file)) { options.headers['Content-Disposition'] = 'attachment; filename="' + encodeURI(file.name) + '"'; + } + if (!multipart) { options.contentType = file.type; options.data = options.blob || file; } else if ($.support.xhrFormDataFileUpload) { @@ -414,8 +440,6 @@ }); } if (options.blob) { - options.headers['Content-Disposition'] = 'attachment; filename="' + - encodeURI(file.name) + '"'; formData.append(paramName, options.blob, file.name); } else { $.each(options.files, function (index, file) { @@ -439,13 +463,13 @@ }, _initIframeSettings: function (options) { + var targetHost = $('').prop('href', options.url).prop('host'); // Setting the dataType to iframe enables the iframe transport: options.dataType = 'iframe ' + (options.dataType || ''); // The iframe transport accepts a serialized array as form data: options.formData = this._getFormData(options); // Add redirect url to form data on cross-domain uploads: - if (options.redirect && $('').prop('href', options.url) - .prop('host') !== location.host) { + if (options.redirect && targetHost && targetHost !== location.host) { options.formData.push({ name: options.redirectParamName || 'redirect', value: options.redirect @@ -510,8 +534,10 @@ options.url = options.form.prop('action') || location.href; } // The HTTP request method must be "POST" or "PUT": - options.type = (options.type || options.form.prop('method') || '') - .toUpperCase(); + options.type = (options.type || + ($.type(options.form.prop('method')) === 'string' && + options.form.prop('method')) || '' + ).toUpperCase(); if (options.type !== 'POST' && options.type !== 'PUT' && options.type !== 'PATCH') { options.type = 'POST'; @@ -627,12 +653,13 @@ // should be uploaded in chunks, but does not invoke any // upload requests: _chunkedUpload: function (options, testOnly) { + options.uploadedBytes = options.uploadedBytes || 0; var that = this, file = options.files[0], fs = file.size, - ub = options.uploadedBytes = options.uploadedBytes || 0, + ub = options.uploadedBytes, mcs = options.maxChunkSize || fs, - slice = file.slice || file.webkitSlice || file.mozSlice, + slice = this._blobSlice, dfd = $.Deferred(), promise = dfd.promise(), jqXHR, @@ -850,7 +877,8 @@ this._slots.push(slot); pipe = slot.pipe(send); } else { - pipe = (this._sequence = this._sequence.pipe(send, send)); + this._sequence = this._sequence.pipe(send, send); + pipe = this._sequence; } // Return the piped Promise object, enhanced with an abort method, // which is delegated to the jqXHR object of the current upload, @@ -1092,17 +1120,16 @@ data.files.push(file); } }); - if (this._trigger('paste', e, data) === false || - this._onAdd(e, data) === false) { - return false; + if (this._trigger('paste', e, data) !== false) { + this._onAdd(e, data); } } }, _onDrop: function (e) { + e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; var that = this, - dataTransfer = e.dataTransfer = e.originalEvent && - e.originalEvent.dataTransfer, + dataTransfer = e.dataTransfer, data = {}; if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { e.preventDefault(); @@ -1116,14 +1143,16 @@ }, _onDragOver: function (e) { - var dataTransfer = e.dataTransfer = e.originalEvent && - e.originalEvent.dataTransfer; - if (dataTransfer) { - if (this._trigger('dragover', e) === false) { - return false; - } - if ($.inArray('Files', dataTransfer.types) !== -1) { - dataTransfer.dropEffect = 'copy'; + e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; + var dataTransfer = e.dataTransfer, + data = { + dropEffect: 'copy', + preventDefault: true + }; + if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 && + this._trigger('dragover', e, data) !== false) { + dataTransfer.dropEffect = data.dropEffect; + if (data.preventDefault) { e.preventDefault(); } } @@ -1139,9 +1168,11 @@ paste: this._onPaste }); } - this._on(this.options.fileInput, { - change: this._onChange - }); + if ($.support.fileInput) { + this._on(this.options.fileInput, { + change: this._onChange + }); + } }, _destroyEventHandlers: function () { @@ -1275,6 +1306,10 @@ if (aborted) { return; } + if (!files.length) { + dfd.reject(); + return; + } data.files = files; jqXHR = that._onSend(null, data).then( function (result, textStatus, jqXHR) { diff --git a/vendor/assets/javascripts/jquery-fileupload/jquery.iframe-transport.js b/vendor/assets/javascripts/jquery-fileupload/jquery.iframe-transport.js index e04e7a0..073c5fb 100755 --- a/vendor/assets/javascripts/jquery-fileupload/jquery.iframe-transport.js +++ b/vendor/assets/javascripts/jquery-fileupload/jquery.iframe-transport.js @@ -1,5 +1,5 @@ /* - * jQuery Iframe Transport Plugin 1.6.2 + * jQuery Iframe Transport Plugin 1.7 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2011, Sebastian Tschan @@ -170,7 +170,15 @@ }); // The iframe transport returns the iframe content document as response. - // The following adds converters from iframe to text, json, html, and script: + // The following adds converters from iframe to text, json, html, xml + // and script. + // Please note that the Content-Type for JSON responses has to be text/plain + // or text/html, if the browser doesn't include application/json in the + // Accept header, else IE will show a download dialog. + // The Content-Type for XML responses on the other hand has to be always + // application/xml or text/xml, so IE properly parses the XML response. + // See also + // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation $.ajaxSetup({ converters: { 'iframe text': function (iframe) { @@ -182,6 +190,12 @@ 'iframe html': function (iframe) { return iframe && $(iframe[0].body).html(); }, + 'iframe xml': function (iframe) { + var xmlDoc = iframe && iframe[0]; + return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc : + $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) || + $(xmlDoc.body).html()); + }, 'iframe script': function (iframe) { return iframe && $.globalEval($(iframe[0].body).text()); } diff --git a/vendor/assets/javascripts/jquery-fileupload/locale.js b/vendor/assets/javascripts/jquery-fileupload/locale.js old mode 100644 new mode 100755 diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/.DS_Store b/vendor/assets/javascripts/jquery-fileupload/vendor/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 + * http://github.com/tapmodo/Jcrop + * Copyright (c) 2008-2013 Tapmodo Interactive LLC {{{ + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * }}} + */ + +(function ($) { + + $.Jcrop = function (obj, opt) { + var options = $.extend({}, $.Jcrop.defaults), + docOffset, + _ua = navigator.userAgent.toLowerCase(), + is_msie = /msie/.test(_ua), + ie6mode = /msie [1-6]\./.test(_ua); + + // Internal Methods {{{ + function px(n) { + return Math.round(n) + 'px'; + } + function cssClass(cl) { + return options.baseClass + '-' + cl; + } + function supportsColorFade() { + return $.fx.step.hasOwnProperty('backgroundColor'); + } + function getPos(obj) //{{{ + { + var pos = $(obj).offset(); + return [pos.left, pos.top]; + } + //}}} + function mouseAbs(e) //{{{ + { + return [(e.pageX - docOffset[0]), (e.pageY - docOffset[1])]; + } + //}}} + function setOptions(opt) //{{{ + { + if (typeof(opt) !== 'object') opt = {}; + options = $.extend(options, opt); + + $.each(['onChange','onSelect','onRelease','onDblClick'],function(i,e) { + if (typeof(options[e]) !== 'function') options[e] = function () {}; + }); + } + //}}} + function startDragMode(mode, pos, touch) //{{{ + { + docOffset = getPos($img); + Tracker.setCursor(mode === 'move' ? mode : mode + '-resize'); + + if (mode === 'move') { + return Tracker.activateHandlers(createMover(pos), doneSelect, touch); + } + + var fc = Coords.getFixed(); + var opp = oppLockCorner(mode); + var opc = Coords.getCorner(oppLockCorner(opp)); + + Coords.setPressed(Coords.getCorner(opp)); + Coords.setCurrent(opc); + + Tracker.activateHandlers(dragmodeHandler(mode, fc), doneSelect, touch); + } + //}}} + function dragmodeHandler(mode, f) //{{{ + { + return function (pos) { + if (!options.aspectRatio) { + switch (mode) { + case 'e': + pos[1] = f.y2; + break; + case 'w': + pos[1] = f.y2; + break; + case 'n': + pos[0] = f.x2; + break; + case 's': + pos[0] = f.x2; + break; + } + } else { + switch (mode) { + case 'e': + pos[1] = f.y + 1; + break; + case 'w': + pos[1] = f.y + 1; + break; + case 'n': + pos[0] = f.x + 1; + break; + case 's': + pos[0] = f.x + 1; + break; + } + } + Coords.setCurrent(pos); + Selection.update(); + }; + } + //}}} + function createMover(pos) //{{{ + { + var lloc = pos; + KeyManager.watchKeys(); + + return function (pos) { + Coords.moveOffset([pos[0] - lloc[0], pos[1] - lloc[1]]); + lloc = pos; + + Selection.update(); + }; + } + //}}} + function oppLockCorner(ord) //{{{ + { + switch (ord) { + case 'n': + return 'sw'; + case 's': + return 'nw'; + case 'e': + return 'nw'; + case 'w': + return 'ne'; + case 'ne': + return 'sw'; + case 'nw': + return 'se'; + case 'se': + return 'nw'; + case 'sw': + return 'ne'; + } + } + //}}} + function createDragger(ord) //{{{ + { + return function (e) { + if (options.disabled) { + return false; + } + if ((ord === 'move') && !options.allowMove) { + return false; + } + + // Fix position of crop area when dragged the very first time. + // Necessary when crop image is in a hidden element when page is loaded. + docOffset = getPos($img); + + btndown = true; + startDragMode(ord, mouseAbs(e)); + e.stopPropagation(); + e.preventDefault(); + return false; + }; + } + //}}} + function presize($obj, w, h) //{{{ + { + var nw = $obj.width(), + nh = $obj.height(); + if ((nw > w) && w > 0) { + nw = w; + nh = (w / $obj.width()) * $obj.height(); + } + if ((nh > h) && h > 0) { + nh = h; + nw = (h / $obj.height()) * $obj.width(); + } + xscale = $obj.width() / nw; + yscale = $obj.height() / nh; + $obj.width(nw).height(nh); + } + //}}} + function unscale(c) //{{{ + { + return { + x: c.x * xscale, + y: c.y * yscale, + x2: c.x2 * xscale, + y2: c.y2 * yscale, + w: c.w * xscale, + h: c.h * yscale + }; + } + //}}} + function doneSelect(pos) //{{{ + { + var c = Coords.getFixed(); + if ((c.w > options.minSelect[0]) && (c.h > options.minSelect[1])) { + Selection.enableHandles(); + Selection.done(); + } else { + Selection.release(); + } + Tracker.setCursor(options.allowSelect ? 'crosshair' : 'default'); + } + //}}} + function newSelection(e) //{{{ + { + if (options.disabled) { + return false; + } + if (!options.allowSelect) { + return false; + } + btndown = true; + docOffset = getPos($img); + Selection.disableHandles(); + Tracker.setCursor('crosshair'); + var pos = mouseAbs(e); + Coords.setPressed(pos); + Selection.update(); + Tracker.activateHandlers(selectDrag, doneSelect, e.type.substring(0,5)==='touch'); + KeyManager.watchKeys(); + + e.stopPropagation(); + e.preventDefault(); + return false; + } + //}}} + function selectDrag(pos) //{{{ + { + Coords.setCurrent(pos); + Selection.update(); + } + //}}} + function newTracker() //{{{ + { + var trk = $('
').addClass(cssClass('tracker')); + if (is_msie) { + trk.css({ + opacity: 0, + backgroundColor: 'white' + }); + } + return trk; + } + //}}} + + // }}} + // Initialization {{{ + // Sanitize some options {{{ + if (typeof(obj) !== 'object') { + obj = $(obj)[0]; + } + if (typeof(opt) !== 'object') { + opt = {}; + } + // }}} + setOptions(opt); + // Initialize some jQuery objects {{{ + // The values are SET on the image(s) for the interface + // If the original image has any of these set, they will be reset + // However, if you destroy() the Jcrop instance the original image's + // character in the DOM will be as you left it. + var img_css = { + border: 'none', + visibility: 'visible', + margin: 0, + padding: 0, + position: 'absolute', + top: 0, + left: 0 + }; + + var $origimg = $(obj), + img_mode = true; + + if (obj.tagName == 'IMG') { + // Fix size of crop image. + // Necessary when crop image is within a hidden element when page is loaded. + if ($origimg[0].width != 0 && $origimg[0].height != 0) { + // Obtain dimensions from contained img element. + $origimg.width($origimg[0].width); + $origimg.height($origimg[0].height); + } else { + // Obtain dimensions from temporary image in case the original is not loaded yet (e.g. IE 7.0). + var tempImage = new Image(); + tempImage.src = $origimg[0].src; + $origimg.width(tempImage.width); + $origimg.height(tempImage.height); + } + + var $img = $origimg.clone().removeAttr('id').css(img_css).show(); + + $img.width($origimg.width()); + $img.height($origimg.height()); + $origimg.after($img).hide(); + + } else { + $img = $origimg.css(img_css).show(); + img_mode = false; + if (options.shade === null) { options.shade = true; } + } + + presize($img, options.boxWidth, options.boxHeight); + + var boundx = $img.width(), + boundy = $img.height(), + + + $div = $('
').width(boundx).height(boundy).addClass(cssClass('holder')).css({ + position: 'relative', + backgroundColor: options.bgColor + }).insertAfter($origimg).append($img); + + if (options.addClass) { + $div.addClass(options.addClass); + } + + var $img2 = $('
'), + + $img_holder = $('
') + .width('100%').height('100%').css({ + zIndex: 310, + position: 'absolute', + overflow: 'hidden' + }), + + $hdl_holder = $('
') + .width('100%').height('100%').css('zIndex', 320), + + $sel = $('
') + .css({ + position: 'absolute', + zIndex: 600 + }).dblclick(function(){ + var c = Coords.getFixed(); + options.onDblClick.call(api,c); + }).insertBefore($img).append($img_holder, $hdl_holder); + + if (img_mode) { + + $img2 = $('') + .attr('src', $img.attr('src')).css(img_css).width(boundx).height(boundy), + + $img_holder.append($img2); + + } + + if (ie6mode) { + $sel.css({ + overflowY: 'hidden' + }); + } + + var bound = options.boundary; + var $trk = newTracker().width(boundx + (bound * 2)).height(boundy + (bound * 2)).css({ + position: 'absolute', + top: px(-bound), + left: px(-bound), + zIndex: 290 + }).mousedown(newSelection); + + /* }}} */ + // Set more variables {{{ + var bgcolor = options.bgColor, + bgopacity = options.bgOpacity, + xlimit, ylimit, xmin, ymin, xscale, yscale, enabled = true, + btndown, animating, shift_down; + + docOffset = getPos($img); + // }}} + // }}} + // Internal Modules {{{ + // Touch Module {{{ + var Touch = (function () { + // Touch support detection function adapted (under MIT License) + // from code by Jeffrey Sambells - http://github.com/iamamused/ + function hasTouchSupport() { + var support = {}, events = ['touchstart', 'touchmove', 'touchend'], + el = document.createElement('div'), i; + + try { + for(i=0; i x1 + ox) { + ox -= ox + x1; + } + if (0 > y1 + oy) { + oy -= oy + y1; + } + + if (boundy < y2 + oy) { + oy += boundy - (y2 + oy); + } + if (boundx < x2 + ox) { + ox += boundx - (x2 + ox); + } + + x1 += ox; + x2 += ox; + y1 += oy; + y2 += oy; + } + //}}} + function getCorner(ord) //{{{ + { + var c = getFixed(); + switch (ord) { + case 'ne': + return [c.x2, c.y]; + case 'nw': + return [c.x, c.y]; + case 'se': + return [c.x2, c.y2]; + case 'sw': + return [c.x, c.y2]; + } + } + //}}} + function getFixed() //{{{ + { + if (!options.aspectRatio) { + return getRect(); + } + // This function could use some optimization I think... + var aspect = options.aspectRatio, + min_x = options.minSize[0] / xscale, + + + //min_y = options.minSize[1]/yscale, + max_x = options.maxSize[0] / xscale, + max_y = options.maxSize[1] / yscale, + rw = x2 - x1, + rh = y2 - y1, + rwa = Math.abs(rw), + rha = Math.abs(rh), + real_ratio = rwa / rha, + xx, yy, w, h; + + if (max_x === 0) { + max_x = boundx * 10; + } + if (max_y === 0) { + max_y = boundy * 10; + } + if (real_ratio < aspect) { + yy = y2; + w = rha * aspect; + xx = rw < 0 ? x1 - w : w + x1; + + if (xx < 0) { + xx = 0; + h = Math.abs((xx - x1) / aspect); + yy = rh < 0 ? y1 - h : h + y1; + } else if (xx > boundx) { + xx = boundx; + h = Math.abs((xx - x1) / aspect); + yy = rh < 0 ? y1 - h : h + y1; + } + } else { + xx = x2; + h = rwa / aspect; + yy = rh < 0 ? y1 - h : y1 + h; + if (yy < 0) { + yy = 0; + w = Math.abs((yy - y1) * aspect); + xx = rw < 0 ? x1 - w : w + x1; + } else if (yy > boundy) { + yy = boundy; + w = Math.abs(yy - y1) * aspect; + xx = rw < 0 ? x1 - w : w + x1; + } + } + + // Magic %-) + if (xx > x1) { // right side + if (xx - x1 < min_x) { + xx = x1 + min_x; + } else if (xx - x1 > max_x) { + xx = x1 + max_x; + } + if (yy > y1) { + yy = y1 + (xx - x1) / aspect; + } else { + yy = y1 - (xx - x1) / aspect; + } + } else if (xx < x1) { // left side + if (x1 - xx < min_x) { + xx = x1 - min_x; + } else if (x1 - xx > max_x) { + xx = x1 - max_x; + } + if (yy > y1) { + yy = y1 + (x1 - xx) / aspect; + } else { + yy = y1 - (x1 - xx) / aspect; + } + } + + if (xx < 0) { + x1 -= xx; + xx = 0; + } else if (xx > boundx) { + x1 -= xx - boundx; + xx = boundx; + } + + if (yy < 0) { + y1 -= yy; + yy = 0; + } else if (yy > boundy) { + y1 -= yy - boundy; + yy = boundy; + } + + return makeObj(flipCoords(x1, y1, xx, yy)); + } + //}}} + function rebound(p) //{{{ + { + if (p[0] < 0) p[0] = 0; + if (p[1] < 0) p[1] = 0; + + if (p[0] > boundx) p[0] = boundx; + if (p[1] > boundy) p[1] = boundy; + + return [Math.round(p[0]), Math.round(p[1])]; + } + //}}} + function flipCoords(x1, y1, x2, y2) //{{{ + { + var xa = x1, + xb = x2, + ya = y1, + yb = y2; + if (x2 < x1) { + xa = x2; + xb = x1; + } + if (y2 < y1) { + ya = y2; + yb = y1; + } + return [xa, ya, xb, yb]; + } + //}}} + function getRect() //{{{ + { + var xsize = x2 - x1, + ysize = y2 - y1, + delta; + + if (xlimit && (Math.abs(xsize) > xlimit)) { + x2 = (xsize > 0) ? (x1 + xlimit) : (x1 - xlimit); + } + if (ylimit && (Math.abs(ysize) > ylimit)) { + y2 = (ysize > 0) ? (y1 + ylimit) : (y1 - ylimit); + } + + if (ymin / yscale && (Math.abs(ysize) < ymin / yscale)) { + y2 = (ysize > 0) ? (y1 + ymin / yscale) : (y1 - ymin / yscale); + } + if (xmin / xscale && (Math.abs(xsize) < xmin / xscale)) { + x2 = (xsize > 0) ? (x1 + xmin / xscale) : (x1 - xmin / xscale); + } + + if (x1 < 0) { + x2 -= x1; + x1 -= x1; + } + if (y1 < 0) { + y2 -= y1; + y1 -= y1; + } + if (x2 < 0) { + x1 -= x2; + x2 -= x2; + } + if (y2 < 0) { + y1 -= y2; + y2 -= y2; + } + if (x2 > boundx) { + delta = x2 - boundx; + x1 -= delta; + x2 -= delta; + } + if (y2 > boundy) { + delta = y2 - boundy; + y1 -= delta; + y2 -= delta; + } + if (x1 > boundx) { + delta = x1 - boundy; + y2 -= delta; + y1 -= delta; + } + if (y1 > boundy) { + delta = y1 - boundy; + y2 -= delta; + y1 -= delta; + } + + return makeObj(flipCoords(x1, y1, x2, y2)); + } + //}}} + function makeObj(a) //{{{ + { + return { + x: a[0], + y: a[1], + x2: a[2], + y2: a[3], + w: a[2] - a[0], + h: a[3] - a[1] + }; + } + //}}} + + return { + flipCoords: flipCoords, + setPressed: setPressed, + setCurrent: setCurrent, + getOffset: getOffset, + moveOffset: moveOffset, + getCorner: getCorner, + getFixed: getFixed + }; + }()); + + //}}} + // Shade Module {{{ + var Shade = (function() { + var enabled = false, + holder = $('
').css({ + position: 'absolute', + zIndex: 240, + opacity: 0 + }), + shades = { + top: createShade(), + left: createShade().height(boundy), + right: createShade().height(boundy), + bottom: createShade() + }; + + function resizeShades(w,h) { + shades.left.css({ height: px(h) }); + shades.right.css({ height: px(h) }); + } + function updateAuto() + { + return updateShade(Coords.getFixed()); + } + function updateShade(c) + { + shades.top.css({ + left: px(c.x), + width: px(c.w), + height: px(c.y) + }); + shades.bottom.css({ + top: px(c.y2), + left: px(c.x), + width: px(c.w), + height: px(boundy-c.y2) + }); + shades.right.css({ + left: px(c.x2), + width: px(boundx-c.x2) + }); + shades.left.css({ + width: px(c.x) + }); + } + function createShade() { + return $('
').css({ + position: 'absolute', + backgroundColor: options.shadeColor||options.bgColor + }).appendTo(holder); + } + function enableShade() { + if (!enabled) { + enabled = true; + holder.insertBefore($img); + updateAuto(); + Selection.setBgOpacity(1,0,1); + $img2.hide(); + + setBgColor(options.shadeColor||options.bgColor,1); + if (Selection.isAwake()) + { + setOpacity(options.bgOpacity,1); + } + else setOpacity(1,1); + } + } + function setBgColor(color,now) { + colorChangeMacro(getShades(),color,now); + } + function disableShade() { + if (enabled) { + holder.remove(); + $img2.show(); + enabled = false; + if (Selection.isAwake()) { + Selection.setBgOpacity(options.bgOpacity,1,1); + } else { + Selection.setBgOpacity(1,1,1); + Selection.disableHandles(); + } + colorChangeMacro($div,0,1); + } + } + function setOpacity(opacity,now) { + if (enabled) { + if (options.bgFade && !now) { + holder.animate({ + opacity: 1-opacity + },{ + queue: false, + duration: options.fadeTime + }); + } + else holder.css({opacity:1-opacity}); + } + } + function refreshAll() { + options.shade ? enableShade() : disableShade(); + if (Selection.isAwake()) setOpacity(options.bgOpacity); + } + function getShades() { + return holder.children(); + } + + return { + update: updateAuto, + updateRaw: updateShade, + getShades: getShades, + setBgColor: setBgColor, + enable: enableShade, + disable: disableShade, + resize: resizeShades, + refresh: refreshAll, + opacity: setOpacity + }; + }()); + // }}} + // Selection Module {{{ + var Selection = (function () { + var awake, + hdep = 370, + borders = {}, + handle = {}, + dragbar = {}, + seehandles = false; + + // Private Methods + function insertBorder(type) //{{{ + { + var jq = $('
').css({ + position: 'absolute', + opacity: options.borderOpacity + }).addClass(cssClass(type)); + $img_holder.append(jq); + return jq; + } + //}}} + function dragDiv(ord, zi) //{{{ + { + var jq = $('
').mousedown(createDragger(ord)).css({ + cursor: ord + '-resize', + position: 'absolute', + zIndex: zi + }).addClass('ord-'+ord); + + if (Touch.support) { + jq.bind('touchstart.jcrop', Touch.createDragger(ord)); + } + + $hdl_holder.append(jq); + return jq; + } + //}}} + function insertHandle(ord) //{{{ + { + var hs = options.handleSize, + + div = dragDiv(ord, hdep++).css({ + opacity: options.handleOpacity + }).addClass(cssClass('handle')); + + if (hs) { div.width(hs).height(hs); } + + return div; + } + //}}} + function insertDragbar(ord) //{{{ + { + return dragDiv(ord, hdep++).addClass('jcrop-dragbar'); + } + //}}} + function createDragbars(li) //{{{ + { + var i; + for (i = 0; i < li.length; i++) { + dragbar[li[i]] = insertDragbar(li[i]); + } + } + //}}} + function createBorders(li) //{{{ + { + var cl,i; + for (i = 0; i < li.length; i++) { + switch(li[i]){ + case'n': cl='hline'; break; + case's': cl='hline bottom'; break; + case'e': cl='vline right'; break; + case'w': cl='vline'; break; + } + borders[li[i]] = insertBorder(cl); + } + } + //}}} + function createHandles(li) //{{{ + { + var i; + for (i = 0; i < li.length; i++) { + handle[li[i]] = insertHandle(li[i]); + } + } + //}}} + function moveto(x, y) //{{{ + { + if (!options.shade) { + $img2.css({ + top: px(-y), + left: px(-x) + }); + } + $sel.css({ + top: px(y), + left: px(x) + }); + } + //}}} + function resize(w, h) //{{{ + { + $sel.width(Math.round(w)).height(Math.round(h)); + } + //}}} + function refresh() //{{{ + { + var c = Coords.getFixed(); + + Coords.setPressed([c.x, c.y]); + Coords.setCurrent([c.x2, c.y2]); + + updateVisible(); + } + //}}} + + // Internal Methods + function updateVisible(select) //{{{ + { + if (awake) { + return update(select); + } + } + //}}} + function update(select) //{{{ + { + var c = Coords.getFixed(); + + resize(c.w, c.h); + moveto(c.x, c.y); + if (options.shade) Shade.updateRaw(c); + + awake || show(); + + if (select) { + options.onSelect.call(api, unscale(c)); + } else { + options.onChange.call(api, unscale(c)); + } + } + //}}} + function setBgOpacity(opacity,force,now) //{{{ + { + if (!awake && !force) return; + if (options.bgFade && !now) { + $img.animate({ + opacity: opacity + },{ + queue: false, + duration: options.fadeTime + }); + } else { + $img.css('opacity', opacity); + } + } + //}}} + function show() //{{{ + { + $sel.show(); + + if (options.shade) Shade.opacity(bgopacity); + else setBgOpacity(bgopacity,true); + + awake = true; + } + //}}} + function release() //{{{ + { + disableHandles(); + $sel.hide(); + + if (options.shade) Shade.opacity(1); + else setBgOpacity(1); + + awake = false; + options.onRelease.call(api); + } + //}}} + function showHandles() //{{{ + { + if (seehandles) { + $hdl_holder.show(); + } + } + //}}} + function enableHandles() //{{{ + { + seehandles = true; + if (options.allowResize) { + $hdl_holder.show(); + return true; + } + } + //}}} + function disableHandles() //{{{ + { + seehandles = false; + $hdl_holder.hide(); + } + //}}} + function animMode(v) //{{{ + { + if (v) { + animating = true; + disableHandles(); + } else { + animating = false; + enableHandles(); + } + } + //}}} + function done() //{{{ + { + animMode(false); + refresh(); + } + //}}} + // Insert draggable elements {{{ + // Insert border divs for outline + + if (options.dragEdges && $.isArray(options.createDragbars)) + createDragbars(options.createDragbars); + + if ($.isArray(options.createHandles)) + createHandles(options.createHandles); + + if (options.drawBorders && $.isArray(options.createBorders)) + createBorders(options.createBorders); + + //}}} + + // This is a hack for iOS5 to support drag/move touch functionality + $(document).bind('touchstart.jcrop-ios',function(e) { + if ($(e.currentTarget).hasClass('jcrop-tracker')) e.stopPropagation(); + }); + + var $track = newTracker().mousedown(createDragger('move')).css({ + cursor: 'move', + position: 'absolute', + zIndex: 360 + }); + + if (Touch.support) { + $track.bind('touchstart.jcrop', Touch.createDragger('move')); + } + + $img_holder.append($track); + disableHandles(); + + return { + updateVisible: updateVisible, + update: update, + release: release, + refresh: refresh, + isAwake: function () { + return awake; + }, + setCursor: function (cursor) { + $track.css('cursor', cursor); + }, + enableHandles: enableHandles, + enableOnly: function () { + seehandles = true; + }, + showHandles: showHandles, + disableHandles: disableHandles, + animMode: animMode, + setBgOpacity: setBgOpacity, + done: done + }; + }()); + + //}}} + // Tracker Module {{{ + var Tracker = (function () { + var onMove = function () {}, + onDone = function () {}, + trackDoc = options.trackDocument; + + function toFront(touch) //{{{ + { + $trk.css({ + zIndex: 450 + }); + + if (touch) + $(document) + .bind('touchmove.jcrop', trackTouchMove) + .bind('touchend.jcrop', trackTouchEnd); + + else if (trackDoc) + $(document) + .bind('mousemove.jcrop',trackMove) + .bind('mouseup.jcrop',trackUp); + } + //}}} + function toBack() //{{{ + { + $trk.css({ + zIndex: 290 + }); + $(document).unbind('.jcrop'); + } + //}}} + function trackMove(e) //{{{ + { + onMove(mouseAbs(e)); + return false; + } + //}}} + function trackUp(e) //{{{ + { + e.preventDefault(); + e.stopPropagation(); + + if (btndown) { + btndown = false; + + onDone(mouseAbs(e)); + + if (Selection.isAwake()) { + options.onSelect.call(api, unscale(Coords.getFixed())); + } + + toBack(); + onMove = function () {}; + onDone = function () {}; + } + + return false; + } + //}}} + function activateHandlers(move, done, touch) //{{{ + { + btndown = true; + onMove = move; + onDone = done; + toFront(touch); + return false; + } + //}}} + function trackTouchMove(e) //{{{ + { + onMove(mouseAbs(Touch.cfilter(e))); + return false; + } + //}}} + function trackTouchEnd(e) //{{{ + { + return trackUp(Touch.cfilter(e)); + } + //}}} + function setCursor(t) //{{{ + { + $trk.css('cursor', t); + } + //}}} + + if (!trackDoc) { + $trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp); + } + + $img.before($trk); + return { + activateHandlers: activateHandlers, + setCursor: setCursor + }; + }()); + //}}} + // KeyManager Module {{{ + var KeyManager = (function () { + var $keymgr = $('').css({ + position: 'fixed', + left: '-120px', + width: '12px' + }).addClass('jcrop-keymgr'), + + $keywrap = $('
').css({ + position: 'absolute', + overflow: 'hidden' + }).append($keymgr); + + function watchKeys() //{{{ + { + if (options.keySupport) { + $keymgr.show(); + $keymgr.focus(); + } + } + //}}} + function onBlur(e) //{{{ + { + $keymgr.hide(); + } + //}}} + function doNudge(e, x, y) //{{{ + { + if (options.allowMove) { + Coords.moveOffset([x, y]); + Selection.updateVisible(true); + } + e.preventDefault(); + e.stopPropagation(); + } + //}}} + function parseKey(e) //{{{ + { + if (e.ctrlKey || e.metaKey) { + return true; + } + shift_down = e.shiftKey ? true : false; + var nudge = shift_down ? 10 : 1; + + switch (e.keyCode) { + case 37: + doNudge(e, -nudge, 0); + break; + case 39: + doNudge(e, nudge, 0); + break; + case 38: + doNudge(e, 0, -nudge); + break; + case 40: + doNudge(e, 0, nudge); + break; + case 27: + if (options.allowSelect) Selection.release(); + break; + case 9: + return true; + } + + return false; + } + //}}} + + if (options.keySupport) { + $keymgr.keydown(parseKey).blur(onBlur); + if (ie6mode || !options.fixedSupport) { + $keymgr.css({ + position: 'absolute', + left: '-20px' + }); + $keywrap.append($keymgr).insertBefore($img); + } else { + $keymgr.insertBefore($img); + } + } + + + return { + watchKeys: watchKeys + }; + }()); + //}}} + // }}} + // API methods {{{ + function setClass(cname) //{{{ + { + $div.removeClass().addClass(cssClass('holder')).addClass(cname); + } + //}}} + function animateTo(a, callback) //{{{ + { + var x1 = a[0] / xscale, + y1 = a[1] / yscale, + x2 = a[2] / xscale, + y2 = a[3] / yscale; + + if (animating) { + return; + } + + var animto = Coords.flipCoords(x1, y1, x2, y2), + c = Coords.getFixed(), + initcr = [c.x, c.y, c.x2, c.y2], + animat = initcr, + interv = options.animationDelay, + ix1 = animto[0] - initcr[0], + iy1 = animto[1] - initcr[1], + ix2 = animto[2] - initcr[2], + iy2 = animto[3] - initcr[3], + pcent = 0, + velocity = options.swingSpeed; + + x1 = animat[0]; + y1 = animat[1]; + x2 = animat[2]; + y2 = animat[3]; + + Selection.animMode(true); + var anim_timer; + + function queueAnimator() { + window.setTimeout(animator, interv); + } + var animator = (function () { + return function () { + pcent += (100 - pcent) / velocity; + + animat[0] = Math.round(x1 + ((pcent / 100) * ix1)); + animat[1] = Math.round(y1 + ((pcent / 100) * iy1)); + animat[2] = Math.round(x2 + ((pcent / 100) * ix2)); + animat[3] = Math.round(y2 + ((pcent / 100) * iy2)); + + if (pcent >= 99.8) { + pcent = 100; + } + if (pcent < 100) { + setSelectRaw(animat); + queueAnimator(); + } else { + Selection.done(); + Selection.animMode(false); + if (typeof(callback) === 'function') { + callback.call(api); + } + } + }; + }()); + queueAnimator(); + } + //}}} + function setSelect(rect) //{{{ + { + setSelectRaw([rect[0] / xscale, rect[1] / yscale, rect[2] / xscale, rect[3] / yscale]); + options.onSelect.call(api, unscale(Coords.getFixed())); + Selection.enableHandles(); + } + //}}} + function setSelectRaw(l) //{{{ + { + Coords.setPressed([l[0], l[1]]); + Coords.setCurrent([l[2], l[3]]); + Selection.update(); + } + //}}} + function tellSelect() //{{{ + { + return unscale(Coords.getFixed()); + } + //}}} + function tellScaled() //{{{ + { + return Coords.getFixed(); + } + //}}} + function setOptionsNew(opt) //{{{ + { + setOptions(opt); + interfaceUpdate(); + } + //}}} + function disableCrop() //{{{ + { + options.disabled = true; + Selection.disableHandles(); + Selection.setCursor('default'); + Tracker.setCursor('default'); + } + //}}} + function enableCrop() //{{{ + { + options.disabled = false; + interfaceUpdate(); + } + //}}} + function cancelCrop() //{{{ + { + Selection.done(); + Tracker.activateHandlers(null, null); + } + //}}} + function destroy() //{{{ + { + $div.remove(); + $origimg.show(); + $origimg.css('visibility','visible'); + $(obj).removeData('Jcrop'); + } + //}}} + function setImage(src, callback) //{{{ + { + Selection.release(); + disableCrop(); + var img = new Image(); + img.onload = function () { + var iw = img.width; + var ih = img.height; + var bw = options.boxWidth; + var bh = options.boxHeight; + $img.width(iw).height(ih); + $img.attr('src', src); + $img2.attr('src', src); + presize($img, bw, bh); + boundx = $img.width(); + boundy = $img.height(); + $img2.width(boundx).height(boundy); + $trk.width(boundx + (bound * 2)).height(boundy + (bound * 2)); + $div.width(boundx).height(boundy); + Shade.resize(boundx,boundy); + enableCrop(); + + if (typeof(callback) === 'function') { + callback.call(api); + } + }; + img.src = src; + } + //}}} + function colorChangeMacro($obj,color,now) { + var mycolor = color || options.bgColor; + if (options.bgFade && supportsColorFade() && options.fadeTime && !now) { + $obj.animate({ + backgroundColor: mycolor + }, { + queue: false, + duration: options.fadeTime + }); + } else { + $obj.css('backgroundColor', mycolor); + } + } + function interfaceUpdate(alt) //{{{ + // This method tweaks the interface based on options object. + // Called when options are changed and at end of initialization. + { + if (options.allowResize) { + if (alt) { + Selection.enableOnly(); + } else { + Selection.enableHandles(); + } + } else { + Selection.disableHandles(); + } + + Tracker.setCursor(options.allowSelect ? 'crosshair' : 'default'); + Selection.setCursor(options.allowMove ? 'move' : 'default'); + + if (options.hasOwnProperty('trueSize')) { + xscale = options.trueSize[0] / boundx; + yscale = options.trueSize[1] / boundy; + } + + if (options.hasOwnProperty('setSelect')) { + setSelect(options.setSelect); + Selection.done(); + delete(options.setSelect); + } + + Shade.refresh(); + + if (options.bgColor != bgcolor) { + colorChangeMacro( + options.shade? Shade.getShades(): $div, + options.shade? + (options.shadeColor || options.bgColor): + options.bgColor + ); + bgcolor = options.bgColor; + } + + if (bgopacity != options.bgOpacity) { + bgopacity = options.bgOpacity; + if (options.shade) Shade.refresh(); + else Selection.setBgOpacity(bgopacity); + } + + xlimit = options.maxSize[0] || 0; + ylimit = options.maxSize[1] || 0; + xmin = options.minSize[0] || 0; + ymin = options.minSize[1] || 0; + + if (options.hasOwnProperty('outerImage')) { + $img.attr('src', options.outerImage); + delete(options.outerImage); + } + + Selection.refresh(); + } + //}}} + //}}} + + if (Touch.support) $trk.bind('touchstart.jcrop', Touch.newSelection); + + $hdl_holder.hide(); + interfaceUpdate(true); + + var api = { + setImage: setImage, + animateTo: animateTo, + setSelect: setSelect, + setOptions: setOptionsNew, + tellSelect: tellSelect, + tellScaled: tellScaled, + setClass: setClass, + + disable: disableCrop, + enable: enableCrop, + cancel: cancelCrop, + release: Selection.release, + destroy: destroy, + + focus: KeyManager.watchKeys, + + getBounds: function () { + return [boundx * xscale, boundy * yscale]; + }, + getWidgetSize: function () { + return [boundx, boundy]; + }, + getScaleFactor: function () { + return [xscale, yscale]; + }, + getOptions: function() { + // careful: internal values are returned + return options; + }, + + ui: { + holder: $div, + selection: $sel + } + }; + + if (is_msie) $div.bind('selectstart', function () { return false; }); + + $origimg.data('Jcrop', api); + return api; + }; + $.fn.Jcrop = function (options, callback) //{{{ + { + var api; + // Iterate over each object, attach Jcrop + this.each(function () { + // If we've already attached to this object + if ($(this).data('Jcrop')) { + // The API can be requested this way (undocumented) + if (options === 'api') return $(this).data('Jcrop'); + // Otherwise, we just reset the options... + else $(this).data('Jcrop').setOptions(options); + } + // If we haven't been attached, preload and attach + else { + if (this.tagName == 'IMG') + $.Jcrop.Loader(this,function(){ + $(this).css({display:'block',visibility:'hidden'}); + api = $.Jcrop(this, options); + if ($.isFunction(callback)) callback.call(api); + }); + else { + $(this).css({display:'block',visibility:'hidden'}); + api = $.Jcrop(this, options); + if ($.isFunction(callback)) callback.call(api); + } + } + }); + + // Return "this" so the object is chainable (jQuery-style) + return this; + }; + //}}} + // $.Jcrop.Loader - basic image loader {{{ + + $.Jcrop.Loader = function(imgobj,success,error){ + var $img = $(imgobj), img = $img[0]; + + function completeCheck(){ + if (img.complete) { + $img.unbind('.jcloader'); + if ($.isFunction(success)) success.call(img); + } + else window.setTimeout(completeCheck,50); + } + + $img + .bind('load.jcloader',completeCheck) + .bind('error.jcloader',function(e){ + $img.unbind('.jcloader'); + if ($.isFunction(error)) error.call(img); + }); + + if (img.complete && $.isFunction(success)){ + $img.unbind('.jcloader'); + success.call(img); + } + }; + + //}}} + // Global Defaults {{{ + $.Jcrop.defaults = { + + // Basic Settings + allowSelect: true, + allowMove: true, + allowResize: true, + + trackDocument: true, + + // Styling Options + baseClass: 'jcrop', + addClass: null, + bgColor: 'black', + bgOpacity: 0.6, + bgFade: false, + borderOpacity: 0.4, + handleOpacity: 0.5, + handleSize: null, + + aspectRatio: 0, + keySupport: true, + createHandles: ['n','s','e','w','nw','ne','se','sw'], + createDragbars: ['n','s','e','w'], + createBorders: ['n','s','e','w'], + drawBorders: true, + dragEdges: true, + fixedSupport: true, + touchSupport: null, + + shade: null, + + boxWidth: 0, + boxHeight: 0, + boundary: 2, + fadeTime: 400, + animationDelay: 20, + swingSpeed: 3, + + minSelect: [0, 0], + maxSize: [0, 0], + minSize: [0, 0], + + // Callbacks / Event Handlers + onChange: function () {}, + onSelect: function () {}, + onDblClick: function () {}, + onRelease: function () {} + }; + + // }}} +}(jQuery)); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.color.js b/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.color.js new file mode 100755 index 0000000..3ca61fb --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.color.js @@ -0,0 +1,661 @@ +/*! + * jQuery Color Animations v2.0pre + * http://jquery.org/ + * + * Copyright 2011 John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + */ + +(function( jQuery, undefined ){ + var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color outlineColor".split(" "), + + // plusequals test for += 100 -= 100 + rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, + // a set of RE's that can match strings and generate color tuples. + stringParsers = [{ + re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function( execResult ) { + return [ + execResult[ 1 ], + execResult[ 2 ], + execResult[ 3 ], + execResult[ 4 ] + ]; + } + }, { + re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function( execResult ) { + return [ + 2.55 * execResult[1], + 2.55 * execResult[2], + 2.55 * execResult[3], + execResult[ 4 ] + ]; + } + }, { + re: /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/, + parse: function( execResult ) { + return [ + parseInt( execResult[ 1 ], 16 ), + parseInt( execResult[ 2 ], 16 ), + parseInt( execResult[ 3 ], 16 ) + ]; + } + }, { + re: /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/, + parse: function( execResult ) { + return [ + parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), + parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), + parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) + ]; + } + }, { + re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + space: "hsla", + parse: function( execResult ) { + return [ + execResult[1], + execResult[2] / 100, + execResult[3] / 100, + execResult[4] + ]; + } + }], + + // jQuery.Color( ) + color = jQuery.Color = function( color, green, blue, alpha ) { + return new jQuery.Color.fn.parse( color, green, blue, alpha ); + }, + spaces = { + rgba: { + cache: "_rgba", + props: { + red: { + idx: 0, + type: "byte", + empty: true + }, + green: { + idx: 1, + type: "byte", + empty: true + }, + blue: { + idx: 2, + type: "byte", + empty: true + }, + alpha: { + idx: 3, + type: "percent", + def: 1 + } + } + }, + hsla: { + cache: "_hsla", + props: { + hue: { + idx: 0, + type: "degrees", + empty: true + }, + saturation: { + idx: 1, + type: "percent", + empty: true + }, + lightness: { + idx: 2, + type: "percent", + empty: true + } + } + } + }, + propTypes = { + "byte": { + floor: true, + min: 0, + max: 255 + }, + "percent": { + min: 0, + max: 1 + }, + "degrees": { + mod: 360, + floor: true + } + }, + rgbaspace = spaces.rgba.props, + support = color.support = {}, + + // colors = jQuery.Color.names + colors, + + // local aliases of functions called often + each = jQuery.each; + + spaces.hsla.props.alpha = rgbaspace.alpha; + + function clamp( value, prop, alwaysAllowEmpty ) { + var type = propTypes[ prop.type ] || {}, + allowEmpty = prop.empty || alwaysAllowEmpty; + + if ( allowEmpty && value == null ) { + return null; + } + if ( prop.def && value == null ) { + return prop.def; + } + if ( type.floor ) { + value = ~~value; + } else { + value = parseFloat( value ); + } + if ( value == null || isNaN( value ) ) { + return prop.def; + } + if ( type.mod ) { + value = value % type.mod; + // -10 -> 350 + return value < 0 ? type.mod + value : value; + } + + // for now all property types without mod have min and max + return type.min > value ? type.min : type.max < value ? type.max : value; + } + + function stringParse( string ) { + var inst = color(), + rgba = inst._rgba = []; + + string = string.toLowerCase(); + + each( stringParsers, function( i, parser ) { + var match = parser.re.exec( string ), + values = match && parser.parse( match ), + parsed, + spaceName = parser.space || "rgba", + cache = spaces[ spaceName ].cache; + + + if ( values ) { + parsed = inst[ spaceName ]( values ); + + // if this was an rgba parse the assignment might happen twice + // oh well.... + inst[ cache ] = parsed[ cache ]; + rgba = inst._rgba = parsed._rgba; + + // exit each( stringParsers ) here because we matched + return false; + } + }); + + // Found a stringParser that handled it + if ( rgba.length !== 0 ) { + + // if this came from a parsed string, force "transparent" when alpha is 0 + // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) + if ( Math.max.apply( Math, rgba ) === 0 ) { + jQuery.extend( rgba, colors.transparent ); + } + return inst; + } + + // named colors / default - filter back through parse function + if ( string = colors[ string ] ) { + return string; + } + } + + color.fn = color.prototype = { + constructor: color, + parse: function( red, green, blue, alpha ) { + if ( red === undefined ) { + this._rgba = [ null, null, null, null ]; + return this; + } + if ( red instanceof jQuery || red.nodeType ) { + red = red instanceof jQuery ? red.css( green ) : jQuery( red ).css( green ); + green = undefined; + } + + var inst = this, + type = jQuery.type( red ), + rgba = this._rgba = [], + source; + + // more than 1 argument specified - assume ( red, green, blue, alpha ) + if ( green !== undefined ) { + red = [ red, green, blue, alpha ]; + type = "array"; + } + + if ( type === "string" ) { + return this.parse( stringParse( red ) || colors._default ); + } + + if ( type === "array" ) { + each( rgbaspace, function( key, prop ) { + rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); + }); + return this; + } + + if ( type === "object" ) { + if ( red instanceof color ) { + each( spaces, function( spaceName, space ) { + if ( red[ space.cache ] ) { + inst[ space.cache ] = red[ space.cache ].slice(); + } + }); + } else { + each( spaces, function( spaceName, space ) { + each( space.props, function( key, prop ) { + var cache = space.cache; + + // if the cache doesn't exist, and we know how to convert + if ( !inst[ cache ] && space.to ) { + + // if the value was null, we don't need to copy it + // if the key was alpha, we don't need to copy it either + if ( red[ key ] == null || key === "alpha") { + return; + } + inst[ cache ] = space.to( inst._rgba ); + } + + // this is the only case where we allow nulls for ALL properties. + // call clamp with alwaysAllowEmpty + inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); + }); + }); + } + return this; + } + }, + is: function( compare ) { + var is = color( compare ), + same = true, + myself = this; + + each( spaces, function( _, space ) { + var isCache = is[ space.cache ], + localCache; + if (isCache) { + localCache = myself[ space.cache ] || space.to && space.to( myself._rgba ) || []; + each( space.props, function( _, prop ) { + if ( isCache[ prop.idx ] != null ) { + same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); + return same; + } + }); + } + return same; + }); + return same; + }, + _space: function() { + var used = [], + inst = this; + each( spaces, function( spaceName, space ) { + if ( inst[ space.cache ] ) { + used.push( spaceName ); + } + }); + return used.pop(); + }, + transition: function( other, distance ) { + var end = color( other ), + spaceName = end._space(), + space = spaces[ spaceName ], + start = this[ space.cache ] || space.to( this._rgba ), + result = start.slice(); + + end = end[ space.cache ]; + each( space.props, function( key, prop ) { + var index = prop.idx, + startValue = start[ index ], + endValue = end[ index ], + type = propTypes[ prop.type ] || {}; + + // if null, don't override start value + if ( endValue === null ) { + return; + } + // if null - use end + if ( startValue === null ) { + result[ index ] = endValue; + } else { + if ( type.mod ) { + if ( endValue - startValue > type.mod / 2 ) { + startValue += type.mod; + } else if ( startValue - endValue > type.mod / 2 ) { + startValue -= type.mod; + } + } + result[ prop.idx ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); + } + }); + return this[ spaceName ]( result ); + }, + blend: function( opaque ) { + // if we are already opaque - return ourself + if ( this._rgba[ 3 ] === 1 ) { + return this; + } + + var rgb = this._rgba.slice(), + a = rgb.pop(), + blend = color( opaque )._rgba; + + return color( jQuery.map( rgb, function( v, i ) { + return ( 1 - a ) * blend[ i ] + a * v; + })); + }, + toRgbaString: function() { + var prefix = "rgba(", + rgba = jQuery.map( this._rgba, function( v, i ) { + return v == null ? ( i > 2 ? 1 : 0 ) : v; + }); + + if ( rgba[ 3 ] === 1 ) { + rgba.pop(); + prefix = "rgb("; + } + + return prefix + rgba.join(",") + ")"; + }, + toHslaString: function() { + var prefix = "hsla(", + hsla = jQuery.map( this.hsla(), function( v, i ) { + if ( v == null ) { + v = i > 2 ? 1 : 0; + } + + // catch 1 and 2 + if ( i && i < 3 ) { + v = Math.round( v * 100 ) + "%"; + } + return v; + }); + + if ( hsla[ 3 ] === 1 ) { + hsla.pop(); + prefix = "hsl("; + } + return prefix + hsla.join(",") + ")"; + }, + toHexString: function( includeAlpha ) { + var rgba = this._rgba.slice(), + alpha = rgba.pop(); + + if ( includeAlpha ) { + rgba.push( ~~( alpha * 255 ) ); + } + + return "#" + jQuery.map( rgba, function( v, i ) { + + // default to 0 when nulls exist + v = ( v || 0 ).toString( 16 ); + return v.length === 1 ? "0" + v : v; + }).join(""); + }, + toString: function() { + return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); + } + }; + color.fn.parse.prototype = color.fn; + + // hsla conversions adapted from: + // http://www.google.com/codesearch/p#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/inspector/front-end/Color.js&d=7&l=193 + + function hue2rgb( p, q, h ) { + h = ( h + 1 ) % 1; + if ( h * 6 < 1 ) { + return p + (q - p) * 6 * h; + } + if ( h * 2 < 1) { + return q; + } + if ( h * 3 < 2 ) { + return p + (q - p) * ((2/3) - h) * 6; + } + return p; + } + + spaces.hsla.to = function ( rgba ) { + if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { + return [ null, null, null, rgba[ 3 ] ]; + } + var r = rgba[ 0 ] / 255, + g = rgba[ 1 ] / 255, + b = rgba[ 2 ] / 255, + a = rgba[ 3 ], + max = Math.max( r, g, b ), + min = Math.min( r, g, b ), + diff = max - min, + add = max + min, + l = add * 0.5, + h, s; + + if ( min === max ) { + h = 0; + } else if ( r === max ) { + h = ( 60 * ( g - b ) / diff ) + 360; + } else if ( g === max ) { + h = ( 60 * ( b - r ) / diff ) + 120; + } else { + h = ( 60 * ( r - g ) / diff ) + 240; + } + + if ( l === 0 || l === 1 ) { + s = l; + } else if ( l <= 0.5 ) { + s = diff / add; + } else { + s = diff / ( 2 - add ); + } + return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; + }; + + spaces.hsla.from = function ( hsla ) { + if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { + return [ null, null, null, hsla[ 3 ] ]; + } + var h = hsla[ 0 ] / 360, + s = hsla[ 1 ], + l = hsla[ 2 ], + a = hsla[ 3 ], + q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, + p = 2 * l - q, + r, g, b; + + return [ + Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), + Math.round( hue2rgb( p, q, h ) * 255 ), + Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), + a + ]; + }; + + + each( spaces, function( spaceName, space ) { + var props = space.props, + cache = space.cache, + to = space.to, + from = space.from; + + // makes rgba() and hsla() + color.fn[ spaceName ] = function( value ) { + + // generate a cache for this space if it doesn't exist + if ( to && !this[ cache ] ) { + this[ cache ] = to( this._rgba ); + } + if ( value === undefined ) { + return this[ cache ].slice(); + } + + var type = jQuery.type( value ), + arr = ( type === "array" || type === "object" ) ? value : arguments, + local = this[ cache ].slice(), + ret; + + each( props, function( key, prop ) { + var val = arr[ type === "object" ? key : prop.idx ]; + if ( val == null ) { + val = local[ prop.idx ]; + } + local[ prop.idx ] = clamp( val, prop ); + }); + + if ( from ) { + ret = color( from( local ) ); + ret[ cache ] = local; + return ret; + } else { + return color( local ); + } + }; + + // makes red() green() blue() alpha() hue() saturation() lightness() + each( props, function( key, prop ) { + // alpha is included in more than one space + if ( color.fn[ key ] ) { + return; + } + color.fn[ key ] = function( value ) { + var vtype = jQuery.type( value ), + fn = ( key === 'alpha' ? ( this._hsla ? 'hsla' : 'rgba' ) : spaceName ), + local = this[ fn ](), + cur = local[ prop.idx ], + match; + + if ( vtype === "undefined" ) { + return cur; + } + + if ( vtype === "function" ) { + value = value.call( this, cur ); + vtype = jQuery.type( value ); + } + if ( value == null && prop.empty ) { + return this; + } + if ( vtype === "string" ) { + match = rplusequals.exec( value ); + if ( match ) { + value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); + } + } + local[ prop.idx ] = value; + return this[ fn ]( local ); + }; + }); + }); + + // add .fx.step functions + each( stepHooks, function( i, hook ) { + jQuery.cssHooks[ hook ] = { + set: function( elem, value ) { + var parsed, backgroundColor, curElem; + + if ( jQuery.type( value ) !== 'string' || ( parsed = stringParse( value ) ) ) + { + value = color( parsed || value ); + if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { + curElem = hook === "backgroundColor" ? elem.parentNode : elem; + do { + backgroundColor = jQuery.curCSS( curElem, "backgroundColor" ); + } while ( + ( backgroundColor === "" || backgroundColor === "transparent" ) && + ( curElem = curElem.parentNode ) && + curElem.style + ); + + value = value.blend( backgroundColor && backgroundColor !== "transparent" ? + backgroundColor : + "_default" ); + } + + value = value.toRgbaString(); + } + elem.style[ hook ] = value; + } + }; + jQuery.fx.step[ hook ] = function( fx ) { + if ( !fx.colorInit ) { + fx.start = color( fx.elem, hook ); + fx.end = color( fx.end ); + fx.colorInit = true; + } + jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); + }; + }); + + // detect rgba support + jQuery(function() { + var div = document.createElement( "div" ), + div_style = div.style; + + div_style.cssText = "background-color:rgba(1,1,1,.5)"; + support.rgba = div_style.backgroundColor.indexOf( "rgba" ) > -1; + }); + + // Some named colors to work with + // From Interface by Stefan Petre + // http://interface.eyecon.ro/ + colors = jQuery.Color.names = { + aqua: "#00ffff", + azure: "#f0ffff", + beige: "#f5f5dc", + black: "#000000", + blue: "#0000ff", + brown: "#a52a2a", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgrey: "#a9a9a9", + darkgreen: "#006400", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkviolet: "#9400d3", + fuchsia: "#ff00ff", + gold: "#ffd700", + green: "#008000", + indigo: "#4b0082", + khaki: "#f0e68c", + lightblue: "#add8e6", + lightcyan: "#e0ffff", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightyellow: "#ffffe0", + lime: "#00ff00", + magenta: "#ff00ff", + maroon: "#800000", + navy: "#000080", + olive: "#808000", + orange: "#ffa500", + pink: "#ffc0cb", + purple: "#800080", + violet: "#800080", + red: "#ff0000", + silver: "#c0c0c0", + white: "#ffffff", + yellow: "#ffff00", + transparent: [ null, null, null, 0 ], + _default: "#ffffff" + }; +})( jQuery ); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js b/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js old mode 100644 new mode 100755 index fd2948f..2d37089 --- a/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js @@ -1,5 +1,5 @@ /* - * jQuery UI Widget 1.10.1+amd + * jQuery UI Widget 1.10.3+amd * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2013 jQuery Foundation and other contributors diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-exif-map.js b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-exif-map.js new file mode 100755 index 0000000..ef8c6c7 --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-exif-map.js @@ -0,0 +1,385 @@ +/* + * JavaScript Load Image Exif Map 1.0.1 + * https://github.com/blueimp/JavaScript-Load-Image + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Exif tags mapping based on + * https://github.com/jseidelin/exif-js + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*global define, window */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['load-image', 'load-image-exif'], factory); + } else { + // Browser globals: + factory(window.loadImage); + } +}(function (loadImage) { + 'use strict'; + + var tags, + map, + prop; + + loadImage.ExifMap.prototype.tags = { + // ================= + // TIFF tags (IFD0): + // ================= + 0x0100: 'ImageWidth', + 0x0101: 'ImageHeight', + 0x8769: 'ExifIFDPointer', + 0x8825: 'GPSInfoIFDPointer', + 0xA005: 'InteroperabilityIFDPointer', + 0x0102: 'BitsPerSample', + 0x0103: 'Compression', + 0x0106: 'PhotometricInterpretation', + 0x0112: 'Orientation', + 0x0115: 'SamplesPerPixel', + 0x011C: 'PlanarConfiguration', + 0x0212: 'YCbCrSubSampling', + 0x0213: 'YCbCrPositioning', + 0x011A: 'XResolution', + 0x011B: 'YResolution', + 0x0128: 'ResolutionUnit', + 0x0111: 'StripOffsets', + 0x0116: 'RowsPerStrip', + 0x0117: 'StripByteCounts', + 0x0201: 'JPEGInterchangeFormat', + 0x0202: 'JPEGInterchangeFormatLength', + 0x012D: 'TransferFunction', + 0x013E: 'WhitePoint', + 0x013F: 'PrimaryChromaticities', + 0x0211: 'YCbCrCoefficients', + 0x0214: 'ReferenceBlackWhite', + 0x0132: 'DateTime', + 0x010E: 'ImageDescription', + 0x010F: 'Make', + 0x0110: 'Model', + 0x0131: 'Software', + 0x013B: 'Artist', + 0x8298: 'Copyright', + // ================== + // Exif Sub IFD tags: + // ================== + 0x9000: 'ExifVersion', // EXIF version + 0xA000: 'FlashpixVersion', // Flashpix format version + 0xA001: 'ColorSpace', // Color space information tag + 0xA002: 'PixelXDimension', // Valid width of meaningful image + 0xA003: 'PixelYDimension', // Valid height of meaningful image + 0xA500: 'Gamma', + 0x9101: 'ComponentsConfiguration', // Information about channels + 0x9102: 'CompressedBitsPerPixel', // Compressed bits per pixel + 0x927C: 'MakerNote', // Any desired information written by the manufacturer + 0x9286: 'UserComment', // Comments by user + 0xA004: 'RelatedSoundFile', // Name of related sound file + 0x9003: 'DateTimeOriginal', // Date and time when the original image was generated + 0x9004: 'DateTimeDigitized', // Date and time when the image was stored digitally + 0x9290: 'SubSecTime', // Fractions of seconds for DateTime + 0x9291: 'SubSecTimeOriginal', // Fractions of seconds for DateTimeOriginal + 0x9292: 'SubSecTimeDigitized', // Fractions of seconds for DateTimeDigitized + 0x829A: 'ExposureTime', // Exposure time (in seconds) + 0x829D: 'FNumber', + 0x8822: 'ExposureProgram', // Exposure program + 0x8824: 'SpectralSensitivity', // Spectral sensitivity + 0x8827: 'PhotographicSensitivity', // EXIF 2.3, ISOSpeedRatings in EXIF 2.2 + 0x8828: 'OECF', // Optoelectric conversion factor + 0x8830: 'SensitivityType', + 0x8831: 'StandardOutputSensitivity', + 0x8832: 'RecommendedExposureIndex', + 0x8833: 'ISOSpeed', + 0x8834: 'ISOSpeedLatitudeyyy', + 0x8835: 'ISOSpeedLatitudezzz', + 0x9201: 'ShutterSpeedValue', // Shutter speed + 0x9202: 'ApertureValue', // Lens aperture + 0x9203: 'BrightnessValue', // Value of brightness + 0x9204: 'ExposureBias', // Exposure bias + 0x9205: 'MaxApertureValue', // Smallest F number of lens + 0x9206: 'SubjectDistance', // Distance to subject in meters + 0x9207: 'MeteringMode', // Metering mode + 0x9208: 'LightSource', // Kind of light source + 0x9209: 'Flash', // Flash status + 0x9214: 'SubjectArea', // Location and area of main subject + 0x920A: 'FocalLength', // Focal length of the lens in mm + 0xA20B: 'FlashEnergy', // Strobe energy in BCPS + 0xA20C: 'SpatialFrequencyResponse', + 0xA20E: 'FocalPlaneXResolution', // Number of pixels in width direction per FPRUnit + 0xA20F: 'FocalPlaneYResolution', // Number of pixels in height direction per FPRUnit + 0xA210: 'FocalPlaneResolutionUnit', // Unit for measuring the focal plane resolution + 0xA214: 'SubjectLocation', // Location of subject in image + 0xA215: 'ExposureIndex', // Exposure index selected on camera + 0xA217: 'SensingMethod', // Image sensor type + 0xA300: 'FileSource', // Image source (3 == DSC) + 0xA301: 'SceneType', // Scene type (1 == directly photographed) + 0xA302: 'CFAPattern', // Color filter array geometric pattern + 0xA401: 'CustomRendered', // Special processing + 0xA402: 'ExposureMode', // Exposure mode + 0xA403: 'WhiteBalance', // 1 = auto white balance, 2 = manual + 0xA404: 'DigitalZoomRatio', // Digital zoom ratio + 0xA405: 'FocalLengthIn35mmFilm', + 0xA406: 'SceneCaptureType', // Type of scene + 0xA407: 'GainControl', // Degree of overall image gain adjustment + 0xA408: 'Contrast', // Direction of contrast processing applied by camera + 0xA409: 'Saturation', // Direction of saturation processing applied by camera + 0xA40A: 'Sharpness', // Direction of sharpness processing applied by camera + 0xA40B: 'DeviceSettingDescription', + 0xA40C: 'SubjectDistanceRange', // Distance to subject + 0xA420: 'ImageUniqueID', // Identifier assigned uniquely to each image + 0xA430: 'CameraOwnerName', + 0xA431: 'BodySerialNumber', + 0xA432: 'LensSpecification', + 0xA433: 'LensMake', + 0xA434: 'LensModel', + 0xA435: 'LensSerialNumber', + // ============== + // GPS Info tags: + // ============== + 0x0000: 'GPSVersionID', + 0x0001: 'GPSLatitudeRef', + 0x0002: 'GPSLatitude', + 0x0003: 'GPSLongitudeRef', + 0x0004: 'GPSLongitude', + 0x0005: 'GPSAltitudeRef', + 0x0006: 'GPSAltitude', + 0x0007: 'GPSTimeStamp', + 0x0008: 'GPSSatellites', + 0x0009: 'GPSStatus', + 0x000A: 'GPSMeasureMode', + 0x000B: 'GPSDOP', + 0x000C: 'GPSSpeedRef', + 0x000D: 'GPSSpeed', + 0x000E: 'GPSTrackRef', + 0x000F: 'GPSTrack', + 0x0010: 'GPSImgDirectionRef', + 0x0011: 'GPSImgDirection', + 0x0012: 'GPSMapDatum', + 0x0013: 'GPSDestLatitudeRef', + 0x0014: 'GPSDestLatitude', + 0x0015: 'GPSDestLongitudeRef', + 0x0016: 'GPSDestLongitude', + 0x0017: 'GPSDestBearingRef', + 0x0018: 'GPSDestBearing', + 0x0019: 'GPSDestDistanceRef', + 0x001A: 'GPSDestDistance', + 0x001B: 'GPSProcessingMethod', + 0x001C: 'GPSAreaInformation', + 0x001D: 'GPSDateStamp', + 0x001E: 'GPSDifferential', + 0x001F: 'GPSHPositioningError' + }; + + loadImage.ExifMap.prototype.stringValues = { + ExposureProgram: { + 0: 'Undefined', + 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', + 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: { + 0x0000: 'Flash did not fire', + 0x0001: 'Flash fired', + 0x0005: 'Strobe return light not detected', + 0x0007: 'Strobe return light detected', + 0x0009: 'Flash fired, compulsory flash mode', + 0x000D: 'Flash fired, compulsory flash mode, return light not detected', + 0x000F: 'Flash fired, compulsory flash mode, return light detected', + 0x0010: 'Flash did not fire, compulsory flash mode', + 0x0018: 'Flash did not fire, auto mode', + 0x0019: 'Flash fired, auto mode', + 0x001D: 'Flash fired, auto mode, return light not detected', + 0x001F: 'Flash fired, auto mode, return light detected', + 0x0020: 'No flash function', + 0x0041: 'Flash fired, red-eye reduction mode', + 0x0045: 'Flash fired, red-eye reduction mode, return light not detected', + 0x0047: 'Flash fired, red-eye reduction mode, return light detected', + 0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode', + 0x004D: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected', + 0x004F: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected', + 0x0059: 'Flash fired, auto mode, red-eye reduction mode', + 0x005D: 'Flash fired, auto mode, return light not detected, red-eye reduction mode', + 0x005F: 'Flash fired, auto mode, return light detected, red-eye reduction mode' + }, + SensingMethod: { + 1: 'Undefined', + 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', + 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' + }, + ComponentsConfiguration: { + 0: '', + 1: 'Y', + 2: 'Cb', + 3: 'Cr', + 4: 'R', + 5: 'G', + 6: 'B' + }, + Orientation: { + 1: 'top-left', + 2: 'top-right', + 3: 'bottom-right', + 4: 'bottom-left', + 5: 'left-top', + 6: 'right-top', + 7: 'right-bottom', + 8: 'left-bottom' + } + }; + + loadImage.ExifMap.prototype.getText = function (id) { + var value = this.get(id); + switch (id) { + 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': + case 'Orientation': + return this.stringValues[id][value]; + case 'ExifVersion': + case 'FlashpixVersion': + return String.fromCharCode(value[0], value[1], value[2], value[3]); + case 'ComponentsConfiguration': + return this.stringValues[id][value[0]] + + this.stringValues[id][value[1]] + + this.stringValues[id][value[2]] + + this.stringValues[id][value[3]]; + case 'GPSVersionID': + return value[0] + '.' + value[1] + '.' + value[2] + '.' + value[3]; + } + return String(value); + }; + + tags = loadImage.ExifMap.prototype.tags; + map = loadImage.ExifMap.prototype.map; + + // Map the tag names to tags: + for (prop in tags) { + if (tags.hasOwnProperty(prop)) { + map[tags[prop]] = prop; + } + } + + loadImage.ExifMap.prototype.getAll = function () { + var map = {}, + prop, + id; + for (prop in this) { + if (this.hasOwnProperty(prop)) { + id = tags[prop]; + if (id) { + map[id] = this.getText(id); + } + } + } + return map; + }; + +})); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-exif.js b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-exif.js new file mode 100755 index 0000000..347369b --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-exif.js @@ -0,0 +1,299 @@ +/* + * JavaScript Load Image Exif Parser 1.0.0 + * https://github.com/blueimp/JavaScript-Load-Image + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint unparam: true */ +/*global define, window, console */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['load-image', 'load-image-meta'], factory); + } else { + // Browser globals: + factory(window.loadImage); + } +}(function (loadImage) { + 'use strict'; + + loadImage.ExifMap = function () { + return this; + }; + + loadImage.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + loadImage.ExifMap.prototype.get = function (id) { + return this[id] || this[this.map[id]]; + }; + + loadImage.getExifThumbnail = function (dataView, offset, length) { + var hexData, + i, + b; + if (!length || offset + length > dataView.byteLength) { + console.log('Invalid Exif data: Invalid thumbnail data.'); + return; + } + hexData = []; + for (i = 0; i < length; i += 1) { + b = dataView.getUint8(offset + i); + hexData.push((b < 16 ? '0' : '') + b.toString(16)); + } + return 'data:image/jpeg,%' + hexData.join('%'); + }; + + loadImage.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function (dataView, dataOffset) { + return dataView.getUint8(dataOffset); + }, + size: 1 + }, + // ascii, 8-bit byte: + 2: { + getValue: function (dataView, dataOffset) { + return String.fromCharCode(dataView.getUint8(dataOffset)); + }, + size: 1, + ascii: true + }, + // short, 16 bit int: + 3: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getUint16(dataOffset, littleEndian); + }, + size: 2 + }, + // long, 32 bit int: + 4: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getUint32(dataOffset, littleEndian); + }, + size: 4 + }, + // rational = two long values, first is numerator, second is denominator: + 5: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getUint32(dataOffset, littleEndian) / + dataView.getUint32(dataOffset + 4, littleEndian); + }, + size: 8 + }, + // slong, 32 bit signed int: + 9: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getInt32(dataOffset, littleEndian); + }, + size: 4 + }, + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getInt32(dataOffset, littleEndian) / + dataView.getInt32(dataOffset + 4, littleEndian); + }, + size: 8 + } + }; + // undefined, 8-bit byte, value depending on field: + loadImage.exifTagTypes[7] = loadImage.exifTagTypes[1]; + + loadImage.getExifValue = function (dataView, tiffOffset, offset, type, length, littleEndian) { + var tagType = loadImage.exifTagTypes[type], + tagSize, + dataOffset, + values, + i, + str, + c; + if (!tagType) { + console.log('Invalid Exif data: Invalid tag type.'); + return; + } + tagSize = tagType.size * length; + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? + tiffOffset + dataView.getUint32(offset + 8, littleEndian) : (offset + 8); + if (dataOffset + tagSize > dataView.byteLength) { + console.log('Invalid Exif data: Invalid data offset.'); + return; + } + if (length === 1) { + return tagType.getValue(dataView, dataOffset, littleEndian); + } + values = []; + for (i = 0; i < length; i += 1) { + values[i] = tagType.getValue(dataView, dataOffset + i * tagType.size, littleEndian); + } + if (tagType.ascii) { + str = ''; + // Concatenate the chars: + for (i = 0; i < values.length; i += 1) { + c = values[i]; + // Ignore the terminating NULL byte(s): + if (c === '\u0000') { + break; + } + str += c; + } + return str; + } + return values; + }; + + loadImage.parseExifTag = function (dataView, tiffOffset, offset, littleEndian, data) { + var tag = dataView.getUint16(offset, littleEndian); + data.exif[tag] = loadImage.getExifValue( + dataView, + tiffOffset, + offset, + dataView.getUint16(offset + 2, littleEndian), // tag type + dataView.getUint32(offset + 4, littleEndian), // tag length + littleEndian + ); + }; + + loadImage.parseExifTags = function (dataView, tiffOffset, dirOffset, littleEndian, data) { + var tagsNumber, + dirEndOffset, + i; + if (dirOffset + 6 > dataView.byteLength) { + console.log('Invalid Exif data: Invalid directory offset.'); + return; + } + tagsNumber = dataView.getUint16(dirOffset, littleEndian); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + if (dirEndOffset + 4 > dataView.byteLength) { + console.log('Invalid Exif data: Invalid directory size.'); + return; + } + for (i = 0; i < tagsNumber; i += 1) { + this.parseExifTag( + dataView, + tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, + data + ); + } + // Return the offset to the next directory: + return dataView.getUint32(dirEndOffset, littleEndian); + }; + + loadImage.parseExifData = function (dataView, offset, length, data, options) { + if (options.disableExif) { + return; + } + var tiffOffset = offset + 10, + littleEndian, + dirOffset, + thumbnailData; + // Check for the ASCII code for "Exif" (0x45786966): + if (dataView.getUint32(offset + 4) !== 0x45786966) { + // No Exif data, might be XMP data instead + return; + } + if (tiffOffset + 8 > dataView.byteLength) { + console.log('Invalid Exif data: Invalid segment size.'); + return; + } + // Check for the two null bytes: + if (dataView.getUint16(offset + 8) !== 0x0000) { + console.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + // Check the byte alignment: + switch (dataView.getUint16(tiffOffset)) { + case 0x4949: + littleEndian = true; + break; + case 0x4D4D: + littleEndian = false; + break; + default: + console.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + // Check for the TIFF tag marker (0x002A): + if (dataView.getUint16(tiffOffset + 2, littleEndian) !== 0x002A) { + console.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32(tiffOffset + 4, littleEndian); + // Create the exif object to store the tags: + data.exif = new loadImage.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = loadImage.parseExifTags( + dataView, + tiffOffset, + tiffOffset + dirOffset, + littleEndian, + data + ); + if (dirOffset && !options.disableExifThumbnail) { + thumbnailData = {exif: {}}; + dirOffset = loadImage.parseExifTags( + dataView, + tiffOffset, + tiffOffset + dirOffset, + littleEndian, + thumbnailData + ); + // Check for JPEG Thumbnail offset: + if (thumbnailData.exif[0x0201]) { + data.exif.Thumbnail = loadImage.getExifThumbnail( + dataView, + tiffOffset + thumbnailData.exif[0x0201], + thumbnailData.exif[0x0202] // Thumbnail data length + ); + } + } + // Check for Exif Sub IFD Pointer: + if (data.exif[0x8769] && !options.disableExifSub) { + loadImage.parseExifTags( + dataView, + tiffOffset, + tiffOffset + data.exif[0x8769], // directory offset + littleEndian, + data + ); + } + // Check for GPS Info IFD Pointer: + if (data.exif[0x8825] && !options.disableExifGps) { + loadImage.parseExifTags( + dataView, + tiffOffset, + tiffOffset + data.exif[0x8825], // directory offset + littleEndian, + data + ); + } + }; + + // Registers the Exif parser for the APP1 JPEG meta data segment: + loadImage.metaDataParsers.jpeg[0xffe1].push(loadImage.parseExifData); + + // Adds the following properties to the parseMetaData callback data: + // * exif: The exif tags, parsed by the parseExifData method + + // Adds the following options to the parseMetaData method: + // * disableExif: Disables Exif parsing. + // * disableExifThumbnail: Disables parsing of the Exif Thumbnail. + // * disableExifSub: Disables parsing of the Exif Sub IFD. + // * disableExifGps: Disables parsing of the Exif GPS Info IFD. + +})); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-ios.js b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-ios.js new file mode 100755 index 0000000..6f8e4fd --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-ios.js @@ -0,0 +1,181 @@ +/* + * JavaScript Load Image iOS scaling fixes 1.0.3 + * https://github.com/blueimp/JavaScript-Load-Image + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * iOS image scaling fixes based on + * https://github.com/stomita/ios-imagefile-megapixel + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint nomen: true, bitwise: true */ +/*global define, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['load-image'], factory); + } else { + // Browser globals: + factory(window.loadImage); + } +}(function (loadImage) { + 'use strict'; + + // Only apply fixes on the iOS platform: + if (!window.navigator || !window.navigator.platform || + !(/iP(hone|od|ad)/).test(window.navigator.platform)) { + return; + } + + var originalRenderMethod = loadImage.renderImageToCanvas; + + // Detects subsampling in JPEG images: + loadImage.detectSubsampling = function (img) { + var canvas, + context; + if (img.width * img.height > 1024 * 1024) { // only consider mexapixel images + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + context = canvas.getContext('2d'); + context.drawImage(img, -img.width + 1, 0); + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering edge pixel or not. + // if alpha value is 0 image is not covering, hence subsampled. + return context.getImageData(0, 0, 1, 1).data[3] === 0; + } + return false; + }; + + // Detects vertical squash in JPEG images: + loadImage.detectVerticalSquash = function (img, subsampled) { + var naturalHeight = img.naturalHeight || img.height, + canvas = document.createElement('canvas'), + context = canvas.getContext('2d'), + data, + sy, + ey, + py, + alpha; + if (subsampled) { + naturalHeight /= 2; + } + canvas.width = 1; + canvas.height = naturalHeight; + context.drawImage(img, 0, 0); + data = context.getImageData(0, 0, 1, naturalHeight).data; + // search image edge pixel position in case it is squashed vertically: + sy = 0; + ey = naturalHeight; + py = naturalHeight; + while (py > sy) { + alpha = data[(py - 1) * 4 + 3]; + if (alpha === 0) { + ey = py; + } else { + sy = py; + } + py = (ey + sy) >> 1; + } + return (py / naturalHeight) || 1; + }; + + // Renders image to canvas while working around iOS image scaling bugs: + // https://github.com/blueimp/JavaScript-Load-Image/issues/13 + loadImage.renderImageToCanvas = function ( + canvas, + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + destX, + destY, + destWidth, + destHeight + ) { + if (img._type === 'image/jpeg') { + var context = canvas.getContext('2d'), + tmpCanvas = document.createElement('canvas'), + tileSize = 1024, + tmpContext = tmpCanvas.getContext('2d'), + subsampled, + vertSquashRatio, + tileX, + tileY; + tmpCanvas.width = tileSize; + tmpCanvas.height = tileSize; + context.save(); + subsampled = loadImage.detectSubsampling(img); + if (subsampled) { + sourceX /= 2; + sourceY /= 2; + sourceWidth /= 2; + sourceHeight /= 2; + } + vertSquashRatio = loadImage.detectVerticalSquash(img, subsampled); + if (subsampled || vertSquashRatio !== 1) { + sourceY *= vertSquashRatio; + destWidth = Math.ceil(tileSize * destWidth / sourceWidth); + destHeight = Math.ceil( + tileSize * destHeight / sourceHeight / vertSquashRatio + ); + destY = 0; + tileY = 0; + while (tileY < sourceHeight) { + destX = 0; + tileX = 0; + while (tileX < sourceWidth) { + tmpContext.clearRect(0, 0, tileSize, tileSize); + tmpContext.drawImage( + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + -tileX, + -tileY, + sourceWidth, + sourceHeight + ); + context.drawImage( + tmpCanvas, + 0, + 0, + tileSize, + tileSize, + destX, + destY, + destWidth, + destHeight + ); + tileX += tileSize; + destX += destWidth; + } + tileY += tileSize; + destY += destHeight; + } + context.restore(); + return canvas; + } + } + return originalRenderMethod( + canvas, + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + destX, + destY, + destWidth, + destHeight + ); + }; + +})); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-meta.js b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-meta.js new file mode 100755 index 0000000..ab45210 --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-meta.js @@ -0,0 +1,137 @@ +/* + * JavaScript Load Image Meta 1.0.1 + * https://github.com/blueimp/JavaScript-Load-Image + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Image meta data handling implementation + * based on the help and contribution of + * Achim Stöhr. + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*jslint continue:true */ +/*global define, window, DataView, Blob, Uint8Array, console */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['load-image'], factory); + } else { + // Browser globals: + factory(window.loadImage); + } +}(function (loadImage) { + 'use strict'; + + var hasblobSlice = window.Blob && (Blob.prototype.slice || + Blob.prototype.webkitSlice || Blob.prototype.mozSlice); + + loadImage.blobSlice = hasblobSlice && function () { + var slice = this.slice || this.webkitSlice || this.mozSlice; + return slice.apply(this, arguments); + }; + + loadImage.metaDataParsers = { + jpeg: { + 0xffe1: [] // APP1 marker + } + }; + + // Parses image meta data and calls the callback with an object argument + // with the following properties: + // * imageHead: The complete image head as ArrayBuffer (Uint8Array for IE10) + // The options arguments accepts an object and supports the following properties: + // * maxMetaDataSize: Defines the maximum number of bytes to parse. + // * disableImageHead: Disables creating the imageHead property. + loadImage.parseMetaData = function (file, callback, options) { + options = options || {}; + var that = this, + // 256 KiB should contain all EXIF/ICC/IPTC segments: + maxMetaDataSize = options.maxMetaDataSize || 262144, + data = {}, + noMetaData = !(window.DataView && file && file.size >= 12 && + file.type === 'image/jpeg' && loadImage.blobSlice); + if (noMetaData || !loadImage.readFile( + loadImage.blobSlice.call(file, 0, maxMetaDataSize), + function (e) { + // Note on endianness: + // Since the marker and length bytes in JPEG files are always + // stored in big endian order, we can leave the endian parameter + // of the DataView methods undefined, defaulting to big endian. + var buffer = e.target.result, + dataView = new DataView(buffer), + offset = 2, + maxOffset = dataView.byteLength - 4, + headLength = offset, + markerBytes, + markerLength, + parsers, + i; + // Check for the JPEG marker (0xffd8): + if (dataView.getUint16(0) === 0xffd8) { + while (offset < maxOffset) { + markerBytes = dataView.getUint16(offset); + // Search for APPn (0xffeN) and COM (0xfffe) markers, + // which contain application-specific meta-data like + // Exif, ICC and IPTC data and text comments: + if ((markerBytes >= 0xffe0 && markerBytes <= 0xffef) || + markerBytes === 0xfffe) { + // The marker bytes (2) are always followed by + // the length bytes (2), indicating the length of the + // marker segment, which includes the length bytes, + // but not the marker bytes, so we add 2: + markerLength = dataView.getUint16(offset + 2) + 2; + if (offset + markerLength > dataView.byteLength) { + console.log('Invalid meta data: Invalid segment size.'); + break; + } + parsers = loadImage.metaDataParsers.jpeg[markerBytes]; + if (parsers) { + for (i = 0; i < parsers.length; i += 1) { + parsers[i].call( + that, + dataView, + offset, + markerLength, + data, + options + ); + } + } + offset += markerLength; + headLength = offset; + } else { + // Not an APPn or COM marker, probably safe to + // assume that this is the end of the meta data + break; + } + } + // Meta length must be longer than JPEG marker (2) + // plus APPn marker (2), followed by length bytes (2): + if (!options.disableImageHead && headLength > 6) { + if (buffer.slice) { + data.imageHead = buffer.slice(0, headLength); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + data.imageHead = new Uint8Array(buffer) + .subarray(0, headLength); + } + } + } else { + console.log('Invalid JPEG file: Missing JPEG marker.'); + } + callback(data); + }, + 'readAsArrayBuffer' + )) { + callback(data); + } + }; + +})); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-orientation.js b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-orientation.js new file mode 100755 index 0000000..61a0da7 --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image-orientation.js @@ -0,0 +1,159 @@ +/* + * JavaScript Load Image Orientation 1.0.0 + * https://github.com/blueimp/JavaScript-Load-Image + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*global define, window */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['load-image'], factory); + } else { + // Browser globals: + factory(window.loadImage); + } +}(function (loadImage) { + 'use strict'; + + var originalHasCanvasOptionMethod = loadImage.hasCanvasOption; + + // This method is used to determine if the target image + // should be a canvas element: + loadImage.hasCanvasOption = function (options) { + return originalHasCanvasOptionMethod(options) || options.orientation; + }; + + // Transform image orientation based on + // the given EXIF orientation option: + loadImage.transformCoordinates = function (canvas, options) { + var ctx = canvas.getContext('2d'), + width = canvas.width, + height = canvas.height, + orientation = options.orientation; + if (!orientation) { + return; + } + if (orientation > 4) { + canvas.width = height; + canvas.height = width; + } + switch (orientation) { + case 2: + // horizontal flip + ctx.translate(width, 0); + ctx.scale(-1, 1); + break; + case 3: + // 180° rotate left + ctx.translate(width, height); + ctx.rotate(Math.PI); + break; + case 4: + // vertical flip + ctx.translate(0, height); + ctx.scale(1, -1); + break; + case 5: + // vertical flip + 90 rotate right + ctx.rotate(0.5 * Math.PI); + ctx.scale(1, -1); + break; + case 6: + // 90° rotate right + ctx.rotate(0.5 * Math.PI); + ctx.translate(0, -height); + break; + case 7: + // horizontal flip + 90 rotate right + ctx.rotate(0.5 * Math.PI); + ctx.translate(width, -height); + ctx.scale(-1, 1); + break; + case 8: + // 90° rotate left + ctx.rotate(-0.5 * Math.PI); + ctx.translate(-width, 0); + break; + } + }; + + // Transforms coordinate and dimension options + // based on the given orientation option: + loadImage.getTransformedOptions = function (options) { + if (!options.orientation || options.orientation === 1) { + return options; + } + var newOptions = {}, + i; + for (i in options) { + if (options.hasOwnProperty(i)) { + newOptions[i] = options[i]; + } + } + switch (options.orientation) { + case 2: + // horizontal flip + newOptions.left = options.right; + newOptions.right = options.left; + break; + case 3: + // 180° rotate left + newOptions.left = options.right; + newOptions.top = options.bottom; + newOptions.right = options.left; + newOptions.bottom = options.top; + break; + case 4: + // vertical flip + newOptions.top = options.bottom; + newOptions.bottom = options.top; + break; + case 5: + // vertical flip + 90 rotate right + newOptions.left = options.top; + newOptions.top = options.left; + newOptions.right = options.bottom; + newOptions.bottom = options.right; + break; + case 6: + // 90° rotate right + newOptions.left = options.top; + newOptions.top = options.right; + newOptions.right = options.bottom; + newOptions.bottom = options.left; + break; + case 7: + // horizontal flip + 90 rotate right + newOptions.left = options.bottom; + newOptions.top = options.right; + newOptions.right = options.top; + newOptions.bottom = options.left; + break; + case 8: + // 90° rotate left + newOptions.left = options.bottom; + newOptions.top = options.left; + newOptions.right = options.top; + newOptions.bottom = options.right; + break; + } + if (options.orientation > 4) { + newOptions.maxWidth = options.maxHeight; + newOptions.maxHeight = options.maxWidth; + newOptions.minWidth = options.minHeight; + newOptions.minHeight = options.minWidth; + newOptions.sourceWidth = options.sourceHeight; + newOptions.sourceHeight = options.sourceWidth; + } + return newOptions; + }; + +})); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js old mode 100644 new mode 100755 index 0155d38..c7fd674 --- a/vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js @@ -1,19 +1,16 @@ /* - * JavaScript Load Image 1.3.1 + * JavaScript Load Image 1.9.0 * https://github.com/blueimp/JavaScript-Load-Image * * Copyright 2011, Sebastian Tschan * https://blueimp.net * - * iOS image scaling fixes based on - * https://github.com/stomita/ios-imagefile-megapixel - * * Licensed under the MIT license: * http://www.opensource.org/licenses/MIT */ -/*jslint nomen: true, bitwise: true */ -/*global window, document, URL, webkitURL, Blob, File, FileReader, define */ +/*jslint nomen: true */ +/*global define, window, document, URL, webkitURL, Blob, File, FileReader */ (function ($) { 'use strict'; @@ -30,17 +27,24 @@ if (oUrl && !(options && options.noRevoke)) { loadImage.revokeObjectURL(oUrl); } - callback(loadImage.scale(img, options)); + if (callback) { + callback(loadImage.scale(img, options)); + } }; - if ((window.Blob && file instanceof Blob) || - // Files are also Blob instances, but some browsers - // (Firefox 3.6) support the File API but not Blobs: - (window.File && file instanceof File)) { + if (loadImage.isInstanceOf('Blob', file) || + // Files are also Blob instances, but some browsers + // (Firefox 3.6) support the File API but not Blobs: + loadImage.isInstanceOf('File', file)) { url = oUrl = loadImage.createObjectURL(file); // Store the file type for resize processing: img._type = file.type; - } else { + } else if (typeof file === 'string') { url = file; + if (options && options.crossOrigin) { + img.crossOrigin = options.crossOrigin; + } + } else { + return false; } if (url) { img.src = url; @@ -51,7 +55,9 @@ if (target && target.result) { img.src = target.result; } else { - callback(e); + if (callback) { + callback(e); + } } }); }, @@ -61,139 +67,178 @@ (window.URL && URL.revokeObjectURL && URL) || (window.webkitURL && webkitURL); - // Detects subsampling in JPEG images: - loadImage.detectSubsampling = function (img) { - var iw = img.width, - ih = img.height, - canvas, - ctx; - if (iw * ih > 1024 * 1024) { // only consider mexapixel images - canvas = document.createElement('canvas'); - canvas.width = canvas.height = 1; - ctx = canvas.getContext('2d'); - ctx.drawImage(img, -iw + 1, 0); - // subsampled image becomes half smaller in rendering size. - // check alpha channel value to confirm image is covering edge pixel or not. - // if alpha value is 0 image is not covering, hence subsampled. - return ctx.getImageData(0, 0, 1, 1).data[3] === 0; - } - return false; + loadImage.isInstanceOf = function (type, obj) { + // Cross-frame instanceof check + return Object.prototype.toString.call(obj) === '[object ' + type + ']'; }; - // Detects vertical squash in JPEG images: - loadImage.detectVerticalSquash = function (img, ih) { - var canvas = document.createElement('canvas'), - ctx = canvas.getContext('2d'), - data, - sy, - ey, - py, - alpha; - canvas.width = 1; - canvas.height = ih; - ctx.drawImage(img, 0, 0); - data = ctx.getImageData(0, 0, 1, ih).data; - // search image edge pixel position in case it is squashed vertically: - sy = 0; - ey = ih; - py = ih; - while (py > sy) { - alpha = data[(py - 1) * 4 + 3]; - if (alpha === 0) { - ey = py; - } else { - sy = py; - } - py = (ey + sy) >> 1; - } - return (py / ih) || 1; + // Transform image coordinates, allows to override e.g. + // the canvas orientation based on the orientation option, + // gets canvas, options passed as arguments: + loadImage.transformCoordinates = function () { + return; }; - // Renders image to canvas while working around iOS image scaling bugs: - // https://github.com/blueimp/JavaScript-Load-Image/issues/13 - loadImage.renderImageToCanvas = function (img, canvas, width, height) { - var iw = img.width, - ih = img.height, - ctx = canvas.getContext('2d'), - vertSquashRatio, - d = 1024, // size of tiling canvas - tmpCanvas = document.createElement('canvas'), - tmpCtx, - dw, - dh, - dx, - dy, - sx, - sy; - ctx.save(); - if (loadImage.detectSubsampling(img)) { - iw /= 2; - ih /= 2; - } - vertSquashRatio = loadImage.detectVerticalSquash(img, ih); - tmpCanvas.width = tmpCanvas.height = d; - tmpCtx = tmpCanvas.getContext('2d'); - dw = Math.ceil(d * width / iw); - dh = Math.ceil(d * height / ih / vertSquashRatio); - dy = 0; - sy = 0; - while (sy < ih) { - dx = 0; - sx = 0; - while (sx < iw) { - tmpCtx.clearRect(0, 0, d, d); - tmpCtx.drawImage(img, -sx, -sy); - ctx.drawImage(tmpCanvas, 0, 0, d, d, dx, dy, dw, dh); - sx += d; - dx += dw; - } - sy += d; - dy += dh; - } - ctx.restore(); - tmpCanvas = tmpCtx = null; + // Returns transformed options, allows to override e.g. + // coordinate and dimension options based on the orientation: + loadImage.getTransformedOptions = function (options) { + return options; + }; + + // Canvas render method, allows to override the + // rendering e.g. to work around issues on iOS: + loadImage.renderImageToCanvas = function ( + canvas, + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + destX, + destY, + destWidth, + destHeight + ) { + canvas.getContext('2d').drawImage( + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + destX, + destY, + destWidth, + destHeight + ); + return canvas; }; - // Scales the given image (img or canvas HTML element) + // This method is used to determine if the target image + // should be a canvas element: + loadImage.hasCanvasOption = function (options) { + return options.canvas || options.crop; + }; + + // Scales and/or crops the given image (img or canvas HTML element) // using the given options. // Returns a canvas object if the browser supports canvas - // and the canvas option is true or a canvas object is passed - // as image, else the scaled image: + // and the hasCanvasOption method returns true or a canvas + // object is passed as image, else the scaled image: loadImage.scale = function (img, options) { options = options || {}; var canvas = document.createElement('canvas'), - width = img.width, - height = img.height, - scale = Math.max( - (options.minWidth || width) / width, - (options.minHeight || height) / height - ); - if (scale > 1) { - width = Math.ceil(width * scale); - height = Math.ceil(height * scale); - } - scale = Math.min( - (options.maxWidth || width) / width, - (options.maxHeight || height) / height - ); - if (scale < 1) { - width = Math.ceil(width * scale); - height = Math.ceil(height * scale); + useCanvas = img.getContext || + (loadImage.hasCanvasOption(options) && canvas.getContext), + width = img.naturalWidth || img.width, + height = img.naturalHeight || img.height, + destWidth = width, + destHeight = height, + maxWidth, + maxHeight, + minWidth, + minHeight, + sourceWidth, + sourceHeight, + sourceX, + sourceY, + tmp, + scaleUp = function () { + var scale = Math.max( + (minWidth || destWidth) / destWidth, + (minHeight || destHeight) / destHeight + ); + if (scale > 1) { + destWidth = Math.ceil(destWidth * scale); + destHeight = Math.ceil(destHeight * scale); + } + }, + scaleDown = function () { + var scale = Math.min( + (maxWidth || destWidth) / destWidth, + (maxHeight || destHeight) / destHeight + ); + if (scale < 1) { + destWidth = Math.ceil(destWidth * scale); + destHeight = Math.ceil(destHeight * scale); + } + }; + if (useCanvas) { + options = loadImage.getTransformedOptions(options); + sourceX = options.left || 0; + sourceY = options.top || 0; + if (options.sourceWidth) { + sourceWidth = options.sourceWidth; + if (options.right !== undefined && options.left === undefined) { + sourceX = width - sourceWidth - options.right; + } + } else { + sourceWidth = width - sourceX - (options.right || 0); + } + if (options.sourceHeight) { + sourceHeight = options.sourceHeight; + if (options.bottom !== undefined && options.top === undefined) { + sourceY = height - sourceHeight - options.bottom; + } + } else { + sourceHeight = height - sourceY - (options.bottom || 0); + } + destWidth = sourceWidth; + destHeight = sourceHeight; } - if (img.getContext || (options.canvas && canvas.getContext)) { - canvas.width = width; - canvas.height = height; - if (img._type === 'image/jpeg') { - loadImage - .renderImageToCanvas(img, canvas, width, height); + maxWidth = options.maxWidth; + maxHeight = options.maxHeight; + minWidth = options.minWidth; + minHeight = options.minHeight; + if (useCanvas && maxWidth && maxHeight && options.crop) { + destWidth = maxWidth; + destHeight = maxHeight; + tmp = sourceWidth / sourceHeight - maxWidth / maxHeight; + if (tmp < 0) { + sourceHeight = maxHeight * sourceWidth / maxWidth; + if (options.top === undefined && options.bottom === undefined) { + sourceY = (height - sourceHeight) / 2; + } + } else if (tmp > 0) { + sourceWidth = maxWidth * sourceHeight / maxHeight; + if (options.left === undefined && options.right === undefined) { + sourceX = (width - sourceWidth) / 2; + } + } + } else { + if (options.contain || options.cover) { + minWidth = maxWidth = maxWidth || minWidth; + minHeight = maxHeight = maxHeight || minHeight; + } + if (options.cover) { + scaleDown(); + scaleUp(); } else { - canvas.getContext('2d') - .drawImage(img, 0, 0, width, height); + scaleUp(); + scaleDown(); } - return canvas; } - img.width = width; - img.height = height; + if (useCanvas) { + canvas.width = destWidth; + canvas.height = destHeight; + loadImage.transformCoordinates( + canvas, + options + ); + return loadImage.renderImageToCanvas( + canvas, + img, + sourceX, + sourceY, + sourceWidth, + sourceHeight, + 0, + 0, + destWidth, + destHeight + ); + } + img.width = destWidth; + img.height = destHeight; return img; }; @@ -208,12 +253,15 @@ // Loads a given File object via FileReader interface, // invokes the callback with the event object (load or error). // The result can be read via event.target.result: - loadImage.readFile = function (file, callback) { - if (window.FileReader && FileReader.prototype.readAsDataURL) { + loadImage.readFile = function (file, callback, method) { + if (window.FileReader) { var fileReader = new FileReader(); fileReader.onload = fileReader.onerror = callback; - fileReader.readAsDataURL(file); - return fileReader; + method = method || 'readAsDataURL'; + if (fileReader[method]) { + fileReader[method](file); + return fileReader; + } } return false; }; diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js b/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js old mode 100644 new mode 100755 index c8b4b86..bb3d4cd --- a/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates 2.1.0 + * JavaScript Templates 2.4.0 * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -12,7 +12,7 @@ * http://ejohn.org/blog/javascript-micro-templating/ */ -/*jslint evil: true, regexp: true */ +/*jslint evil: true, regexp: true, unparam: true */ /*global document, define */ (function ($) { @@ -34,21 +34,21 @@ tmpl.load = function (id) { return document.getElementById(id).innerHTML; }; - tmpl.regexp = /([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g; + tmpl.regexp = /([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g; tmpl.func = function (s, p1, p2, p3, p4, p5) { - if (p1) { // whitespace, quote and backspace in interpolation context + if (p1) { // whitespace, quote and backspace in HTML context return { "\n": "\\n", "\r": "\\r", "\t": "\\t", " " : " " - }[s] || "\\" + s; + }[p1] || "\\" + p1; } if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%} if (p2 === "=") { return "'+_e(" + p3 + ")+'"; } - return "'+(" + p3 + "||'')+'"; + return "'+(" + p3 + "==null?'':" + p3 + ")+'"; } if (p4) { // evaluation start tag: {% return "';"; @@ -66,7 +66,7 @@ "'" : "'" }; tmpl.encode = function (s) { - return String(s || "").replace( + return (s == null ? "" : "" + s).replace( tmpl.encReg, function (c) { return tmpl.encMap[c] || ""; @@ -74,7 +74,7 @@ ); }; tmpl.arg = "o"; - tmpl.helper = ",print=function(s,e){_s+=e&&(s||'')||_e(s);}" + + tmpl.helper = ",print=function(s,e){_s+=e?(s==null?'':s):_e(s);}" + ",include=function(s,d){_s+=tmpl(s,d);}"; if (typeof define === "function" && define.amd) { define(function () { diff --git a/vendor/assets/stylesheets/.DS_Store b/vendor/assets/stylesheets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b863c08b476644ec9c92190a261fd8a28046ae11 GIT binary patch literal 6148 zcmeHKOH0E*5Z-NTO?^NwLXV5*A`z|a!9xfYJPIlFU_}#BY#<~hN!vq>2Cx1Y|Bb)L zncdAHn6rqTf!S|%9=q8OvJb`>w^#l-V_n9W0gA}cs1bD6h8j84mXZ zGtggj;kUQhn$20nd{+JbPj49pX=a*VywPm!wf7C<)fWSEkoU!QI5hj>@?wGx*DzGMA7TAO?s5Vqk|E z(1(I?xWgRK(uo0Lpq>HT9|S0(rLj;bw+?9V`i$`wA_~~}mOvC5Escdjh=6ca3aCoC zeqwM{4t}BYERBUiRnEAa8OG5wmyZ`NX9vHK>5N+nsU-%8fhq${)$QW>e*?cv?IXWh zLOo)D82D!l@YdKF+ps8ow*FWip0xt>2^0nM3N%2#u3Q43gZoHN231_34SANvLLrWV SepwDk7Xe8KHN?O#Fz^lEj7gCI literal 0 HcmV?d00001 diff --git a/vendor/assets/stylesheets/jquery.fileupload-ui.scss b/vendor/assets/stylesheets/jquery.fileupload-ui.css similarity index 62% rename from vendor/assets/stylesheets/jquery.fileupload-ui.scss rename to vendor/assets/stylesheets/jquery.fileupload-ui.css index 72bfcb6..2f8f121 100755 --- a/vendor/assets/stylesheets/jquery.fileupload-ui.scss +++ b/vendor/assets/stylesheets/jquery.fileupload-ui.css @@ -1,6 +1,6 @@ @charset "UTF-8"; /* - * jQuery File Upload UI Plugin CSS 8.0 + * jQuery File Upload UI Plugin CSS 8.8.5 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan @@ -10,41 +10,30 @@ * http://www.opensource.org/licenses/MIT */ -.fileinput-button { - position: relative; - overflow: hidden; -} -.fileinput-button input { - position: absolute; - top: 0; - right: 0; - margin: 0; - opacity: 0; - filter: alpha(opacity=0); - transform: translate(-300px, 0) scale(4); - font-size: 23px; - direction: ltr; - cursor: pointer; -} .fileupload-buttonbar .btn, .fileupload-buttonbar .toggle { margin-bottom: 5px; } +.progress-animated .progress-bar, .progress-animated .bar { - background: url(../img/progressbar.gif) !important; + background: url("progressbar.gif") !important; filter: none; } .fileupload-loading { float: right; width: 32px; height: 32px; - background: url(../img/loading.gif) center no-repeat; + background: url("loading.gif") center no-repeat; background-size: contain; display: none; } .fileupload-processing .fileupload-loading { display: block; } +.files audio, +.files video { + max-width: 300px; +} @media (max-width: 767px) { .fileupload-buttonbar .toggle, @@ -56,4 +45,8 @@ width: 80px; word-wrap: break-word; } + .files audio, + .files video { + max-width: 80px; + } } diff --git a/vendor/assets/stylesheets/vendor/Jcrop.gif b/vendor/assets/stylesheets/vendor/Jcrop.gif new file mode 100755 index 0000000000000000000000000000000000000000..72ea7ccb5321d5384d70437cfaac73011237901e GIT binary patch literal 329 zcmZ?wbhEHb9b#5NV>2k zBC~b@b~P=nNfWAe-b%_i6tS^-1y(h@EsB~1TqDA_h@fkxG$bHgvj}VxE1JLgr!*!^ ILUxTc0Q$^Q5C8xG literal 0 HcmV?d00001 diff --git a/vendor/assets/stylesheets/vendor/jquery.Jcrop.css b/vendor/assets/stylesheets/vendor/jquery.Jcrop.css new file mode 100755 index 0000000..95f8b9c --- /dev/null +++ b/vendor/assets/stylesheets/vendor/jquery.Jcrop.css @@ -0,0 +1,165 @@ +/* jquery.Jcrop.css v0.9.12 - MIT License */ +/* + The outer-most container in a typical Jcrop instance + If you are having difficulty with formatting related to styles + on a parent element, place any fixes here or in a like selector + + You can also style this element if you want to add a border, etc + A better method for styling can be seen below with .jcrop-light + (Add a class to the holder and style elements for that extended class) +*/ +.jcrop-holder { + direction: ltr; + text-align: left; +} +/* Selection Border */ +.jcrop-vline, +.jcrop-hline { + background: #ffffff url("Jcrop.gif"); + font-size: 0; + position: absolute; +} +.jcrop-vline { + height: 100%; + width: 1px !important; +} +.jcrop-vline.right { + right: 0; +} +.jcrop-hline { + height: 1px !important; + width: 100%; +} +.jcrop-hline.bottom { + bottom: 0; +} +/* Invisible click targets */ +.jcrop-tracker { + height: 100%; + width: 100%; + /* "turn off" link highlight */ + -webkit-tap-highlight-color: transparent; + /* disable callout, image save panel */ + -webkit-touch-callout: none; + /* disable cut copy paste */ + -webkit-user-select: none; +} +/* Selection Handles */ +.jcrop-handle { + background-color: #333333; + border: 1px #eeeeee solid; + width: 7px; + height: 7px; + font-size: 1px; +} +.jcrop-handle.ord-n { + left: 50%; + margin-left: -4px; + margin-top: -4px; + top: 0; +} +.jcrop-handle.ord-s { + bottom: 0; + left: 50%; + margin-bottom: -4px; + margin-left: -4px; +} +.jcrop-handle.ord-e { + margin-right: -4px; + margin-top: -4px; + right: 0; + top: 50%; +} +.jcrop-handle.ord-w { + left: 0; + margin-left: -4px; + margin-top: -4px; + top: 50%; +} +.jcrop-handle.ord-nw { + left: 0; + margin-left: -4px; + margin-top: -4px; + top: 0; +} +.jcrop-handle.ord-ne { + margin-right: -4px; + margin-top: -4px; + right: 0; + top: 0; +} +.jcrop-handle.ord-se { + bottom: 0; + margin-bottom: -4px; + margin-right: -4px; + right: 0; +} +.jcrop-handle.ord-sw { + bottom: 0; + left: 0; + margin-bottom: -4px; + margin-left: -4px; +} +/* Dragbars */ +.jcrop-dragbar.ord-n, +.jcrop-dragbar.ord-s { + height: 7px; + width: 100%; +} +.jcrop-dragbar.ord-e, +.jcrop-dragbar.ord-w { + height: 100%; + width: 7px; +} +.jcrop-dragbar.ord-n { + margin-top: -4px; +} +.jcrop-dragbar.ord-s { + bottom: 0; + margin-bottom: -4px; +} +.jcrop-dragbar.ord-e { + margin-right: -4px; + right: 0; +} +.jcrop-dragbar.ord-w { + margin-left: -4px; +} +/* The "jcrop-light" class/extension */ +.jcrop-light .jcrop-vline, +.jcrop-light .jcrop-hline { + background: #ffffff; + filter: alpha(opacity=70) !important; + opacity: .70!important; +} +.jcrop-light .jcrop-handle { + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + background-color: #000000; + border-color: #ffffff; + border-radius: 3px; +} +/* The "jcrop-dark" class/extension */ +.jcrop-dark .jcrop-vline, +.jcrop-dark .jcrop-hline { + background: #000000; + filter: alpha(opacity=70) !important; + opacity: 0.7 !important; +} +.jcrop-dark .jcrop-handle { + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + background-color: #ffffff; + border-color: #000000; + border-radius: 3px; +} +/* Simple macro to turn off the antlines */ +.solid-line .jcrop-vline, +.solid-line .jcrop-hline { + background: #ffffff; +} +/* Fix for twitter bootstrap et al. */ +.jcrop-holder img, +img.jcrop-preview { + max-width: none; +} From a51955f4d5ea79fa46678b9a4644362d3eac57a5 Mon Sep 17 00:00:00 2001 From: macintosh Date: Mon, 14 Oct 2013 16:13:59 +0400 Subject: [PATCH 02/20] scripts update --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4040c6c..0bdef21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store *.gem .bundle Gemfile.lock From a385beb20f118fefb7ebe722ef9347e1bd7e4671 Mon Sep 17 00:00:00 2001 From: macintosh Date: Mon, 14 Oct 2013 16:23:24 +0400 Subject: [PATCH 03/20] .DS_Store banished! --- public/.DS_Store | Bin 6148 -> 0 bytes vendor/.DS_Store | Bin 6148 -> 0 bytes vendor/assets/.DS_Store | Bin 6148 -> 0 bytes vendor/assets/images/.DS_Store | Bin 6148 -> 0 bytes vendor/assets/javascripts/.DS_Store | Bin 6148 -> 0 bytes .../javascripts/jquery-fileupload/.DS_Store | Bin 15364 -> 0 bytes .../jquery-fileupload/vendor/.DS_Store | Bin 6148 -> 0 bytes vendor/assets/stylesheets/.DS_Store | Bin 6148 -> 0 bytes 8 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 public/.DS_Store delete mode 100644 vendor/.DS_Store delete mode 100644 vendor/assets/.DS_Store delete mode 100644 vendor/assets/images/.DS_Store delete mode 100644 vendor/assets/javascripts/.DS_Store delete mode 100644 vendor/assets/javascripts/jquery-fileupload/.DS_Store delete mode 100644 vendor/assets/javascripts/jquery-fileupload/vendor/.DS_Store delete mode 100644 vendor/assets/stylesheets/.DS_Store diff --git a/public/.DS_Store b/public/.DS_Store deleted file mode 100644 index 5eb0d47d49a17dc0af30b53332529853c93c19e1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z<*>Q-2^Ap~uB@k=hDX@DM@;k3tGPSka^r8wlCbr1nswL3|(I#^-Tn zcUvqLyouNu*!?E+vzz%KyBWq9_a@OXV-91?hJnaYSs`d%>Dn;C6+n(_gwt#kCNhNQ zcjNo(fbVXx0h4UZvajzSj*>Xb8;uXXQL#3+wrzXI-s|_`G?G(KPSPm5_J?xn$I*Ql zjBk{l2l*uPg0b>k1^Ey>O7BXUfZjLJy*SE;w@z&~J8L)UqSb5`bunwBe$qNEifYxa zI&b#D;nDeJH+U+ZUrNm*2bz`a8=S){D2pj1JN~DYE(xDOsWL{w7{$cbnGQCM;LSsmKwnW z!gVU3PUWV>;5r@b!o;}-ON~06akVq7V|Jc5FI?>ocA>%<|rE|CIr5b^MM8)tS5XTb+2<3K(}VP%y4U1qAe^p8$BkbEKx6+AmOt ZIM-mQ5m!OGN(ZDL0YwN+#K12w@Ckn8Os@a{ diff --git a/vendor/.DS_Store b/vendor/.DS_Store deleted file mode 100644 index c32883842752acf742ff9e4a68f0123bb24f31f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKISv9b4733uBpOP}e1RWC2wuPkI6EYYg?=mE#nTuc1!$pz0yJJZlQ^ENc8Yi{ zB09h9XCf038Nm(ZYD3p--@IeJj3^L}GtScNo857HIvqRNuLH&%%0?PIhey6`(5L_v zpaN8Y3Q&QME0862H2(O>Jdg@dfnQg^?uP<5tch))UmX~{1pp2ZcEj9z31G1RuqL*F zh`==`Eo-SGgIZ^>C@T@>TmJ_T0OZc1q z|Cz)U6`%rtrGO3=tHm6jl(n_*!P3;Q3EO;C|m!(x(D|iS+!J|;YgD!4jijBmkG^u5&)ga#dWBhOY zd;H$a2%Bwt5O&>lnFnvam-i#n_c5925RqsNgBnqph#V+mVFkks;W+D*EErD_DAYST zl=!2h??P5!&!@*> zFNjC2c-RY)lXf>AwZov}dxLMvPQ7%Pw7h|e9C~RN5oI66aRmF+WFLn?+C3|;jmH~} zjf&jbs!b|#yuDq8z1f^hibbbbesI35f89Me@@^)#cbVo+V5?EGYVZ~AVdPo~lJm&N ztXz-_T(<|kDDGXr&#@9+qWf!TLgzF98+}T1JJ~xiQETp?`^L`iU}8>FKXWoCWs02y zZ2X{zR|j=5cK!}K^=6|Y>(%-Ub{^llPD*HHMpJoqW~ThY4wlb{74soEr4QSI{o$4Y z%fO#vfcFOpWpoW@8r9Z;L0tiW1-O;K=DP&fNQ17yOd}!?p-X|fRG2G<(B<$;ljj=D zH0p8^YG%C0%q+|eMX1@~mnxlvtI>{@0n0$1fkpjT=JS7l{{25+WS=YpmVy6@0a4g% z@3qj9Ia{Zi<>Fqq?58GID4L6smT*#No*GmY>->>mL|gB>gb@5;an D8@}E9 diff --git a/vendor/assets/images/.DS_Store b/vendor/assets/images/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T09Mg*~hnGH$z0i?FQRKWg@bm5(_0XzliLYIwA$*nE?tlMnaFYNjDTy zG!o5@X=Fg2-3r~&J$0!`-_NfJPY351lShHyOFMoP`-pz`J5iWsmCA=G%oJzm<}GW% zS~_op?I7;Cakm|$XSG(`tA#<+_mT@`XI|D#T`y5Rr(V`VkFx7=9Kk*}(Ty<3T9@Uu zet&0wXT#px+a7G#{ey!F?A^n`pj5I-^gx781?p5`N(`aX;kQkkV=&jK(@ChAF^-v8 zmq`$5X`{XhP@{#QZVFaylM|71WEtF@|&y_vUlWS8=- twV_u~DKakC_>}@fJ;jKXPw^U53H-J+fR4djBRmlP5l}R6!wgK6flrU(TF?Lh diff --git a/vendor/assets/javascripts/jquery-fileupload/.DS_Store b/vendor/assets/javascripts/jquery-fileupload/.DS_Store deleted file mode 100644 index 8d319e4e318738af5c3766b4e10f9fa4ec06d08b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15364 zcmeI1du$X%9LMMPYbm?1Yo`eEy28<_lv3a*l$M8beeftydT?#8Esyr@cA+cV+j@J~ zqNUIviGL7`h$beYiHR8H5Bvv&_>X@O6B0~(Z8Z3dCdPz+Bt|1@FwQ=%X|L{orXgk~ z+4;@R{C+c?&&_wPGe-!4hODxhkRTyMV2^F7#Ik=$cDwydO6b)TF$*l7C}vVm7=}K{ zlUHy8oB$`l32*|O!2LpieP`QAnCV)ca{`qW zwUbzx+688Vo(+3;)U~XIC2&KTbwj~BVt^aY>VuwN*t4Uqb;AjGhY#>Z2JeId&giWF zpyN&;>{_040-V5P0`}RxkR*vg(!?BpelH?}L?tPr*iDHcb0DD`3FiDxVnEl-Oepj@ zU_s%uqUnM#Ly-2zw3K2DH5l2HV(yFf8ADM`Q4{g>0jHdaXR>BPJnghZ;+a0y;*{Ii zZ2>Fq_q=18lIiQA^M;3O>ef{SYeF?6Rl(uf+E7(+?V7rg5m6LGdRmxMwsO<<0nSlDS@{w5ZQen%TKb>gsJ4_Xa`Ja(9OY!JI8|axjBBBo1-{mrX)Xb;9$?}Ua5!9 z8r0OG)`5&>q|6RAZ8F;Y=6qM zy_0D}*CU3h+1+$?X4In@+h>q%zteO-;8C*?ha=W>QTlTIz6YP&2iJuC}G({b~tR ziJ~=s!9psP%8PSN`5_{`BJ5Y#crAuv_o-M*%F3x+DnIHMAqe|y|Hib+a>c4xR!OBQ zd8MDbNaI4A$v{}4)zws5E3NbQG{v?fY~5LP>o-t&lk~Wsr$804U5_VJ-3r$?P`OFk z>hHQ!j19Vf1{O~|bg*_UW3sU}UNlk_q{50f+GW%4?? zOx`6|$u)AFd`P|^-;kfk&*WF~JGo2#0E8JpVF4_JQdk7bVJ&Qe2G|8Hup7D|2}j^b z7=~kT98SO~I0G-iD{ukcgty>rxCB?>efR)Af{)=-_zZ5r4{#gqz@P9J+=IWd2#awp zmf}*Zz-3sC8?h0aF^X;2fiXOU24?XDK8t7Z1w4o6@d94LtL{`VCun=m8JF-Hd&$?W zw>K4>^3m@w=mLtyb5^~hxE@x-?=ay^U>YAuh zrt5&bNDAhbR{oM}XF5`k3ic*Ir(1!t@`oQ;BuV*RxoAq*RCI}2>9 zplGeGUK5aNZx?B`}{m`=0m8yW-B7HONGn@CNO7Fx|ab_V1Y zsnyR-pgTocWbN4-4an_s%-`*XKn1I-dtX3WAeMSdi=$sO_=xd#%= zhcc*y5Nv=j)I$?&fo%|h4(NqGc!DWYhb)Z1Gfb7w!Siqy&cS(j11`d4xWbfq4c>$6 za1%a(ui$I=7QTb;nL2-gyNFnT)0jF1EW!D>m}#>Tt8fLb!a5A&R*c{tPo+J082fPu zkK$8!5>Mlc_^K<$F?}Y-iIWxawS0XJM$;+XNF8SNIZaOt;cuJ(C%_4C0-OLRFogsP z+_8f8{r?vK-~XrZFXBUS0-V596M({|Xj20l)$jjvWNktA^s>iJw%@30oe-AUE_S_h z9nW6u>v-p$g4KDq6Ha^B^BZ-o6VBqCaAv3I$AJ6o-j1LD`T3tr?fKu9a$W!c diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/.DS_Store b/vendor/assets/javascripts/jquery-fileupload/vendor/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0<~hN!vq>2Cx1Y|Bb)L zncdAHn6rqTf!S|%9=q8OvJb`>w^#l-V_n9W0gA}cs1bD6h8j84mXZ zGtggj;kUQhn$20nd{+JbPj49pX=a*VywPm!wf7C<)fWSEkoU!QI5hj>@?wGx*DzGMA7TAO?s5Vqk|E z(1(I?xWgRK(uo0Lpq>HT9|S0(rLj;bw+?9V`i$`wA_~~}mOvC5Escdjh=6ca3aCoC zeqwM{4t}BYERBUiRnEAa8OG5wmyZ`NX9vHK>5N+nsU-%8fhq${)$QW>e*?cv?IXWh zLOo)D82D!l@YdKF+ps8ow*FWip0xt>2^0nM3N%2#u3Q43gZoHN231_34SANvLLrWV SepwDk7Xe8KHN?O#Fz^lEj7gCI From 807461bccf24c2a6b5b629bc9f13d09fe1cc3c3c Mon Sep 17 00:00:00 2001 From: macintosh Date: Mon, 14 Oct 2013 16:27:35 +0400 Subject: [PATCH 04/20] doc updated --- README.md | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 4207f35..f6470a2 100755 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ [jQuery-File-Plugin](https://github.com/blueimp/jQuery-File-Upload) is a file upload plugin written by [Sebastian Tschan](https://github.com/blueimp). jQuery File Upload features multiple file selection, drag&drop support, progress bars and preview images for jQuery. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. -jquery-fileupload-rails is a library that integrates jQuery File Upload for Rails 3.1 Asset Pipeline (Rails 3.2 supported). +jquery-fileupload-rails is a library that integrates jQuery File Upload for Rails 3.1> Asset Pipeline (Rails 3.2 and 4.0 supported). ## Plugin versions -* jQuery File Upload User Interface Plugin 6.11 -* jQuery File Upload Plugin 5.19.3 -* jQuery UI Widget 1.9.1+amd +* jQuery File Upload User Interface Plugin 8.8.6 +* jQuery File Upload Plugin 5.32.6 +* jQuery UI Widget 1.10.3+amd ## Installing Gem @@ -22,15 +22,24 @@ Require jquery-fileupload in your app/assets/application.js file. The snippet above will add the following js files to the mainfest file. - //= require jquery-fileupload/vendor/jquery.ui.widget - //= require jquery-fileupload/vendor/load-image - //= require jquery-fileupload/vendor/canvas-to-blob - //= require jquery-fileupload/vendor/tmpl - //= require jquery-fileupload/jquery.iframe-transport - //= require jquery-fileupload/jquery.fileupload - //= require jquery-fileupload/jquery.fileupload-fp - //= require jquery-fileupload/jquery.fileupload-ui - //= require jquery-fileupload/locale + //=require jquery-fileupload/vendor/jquery.ui.widget + //=require jquery-fileupload/vendor/tmpl + //=require jquery-fileupload/vendor/load-image + //=require jquery-fileupload/vendor/load-image-ios + //=require jquery-fileupload/vendor/load-image-orientation + //=require jquery-fileupload/vendor/load-image-meta + //=require jquery-fileupload/vendor/load-image-exif + //=require jquery-fileupload/vendor/load-image-exif-map + //=require jquery-fileupload/vendor/canvas-to-blob + //=require jquery-fileupload/jquery.iframe-transport + //=require jquery-fileupload/jquery.fileupload + //=require jquery-fileupload/jquery.fileupload-image + //=require jquery-fileupload/jquery.fileupload-process + //=require jquery-fileupload/jquery.fileupload-audio + //=require jquery-fileupload/jquery.fileupload-video + //=require jquery-fileupload/jquery.fileupload-validate + //=require jquery-fileupload/jquery.fileupload-ui + //=require jquery-fileupload/locale If you only need the basic files, just add the code below to your application.js file. [Basic setup guide](https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin) From 2ddc92743bad74f72dccb71b5e5d536a3585ce82 Mon Sep 17 00:00:00 2001 From: macintosh Date: Mon, 14 Oct 2013 16:29:08 +0400 Subject: [PATCH 05/20] doc updated --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f6470a2..07729ca 100755 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ jquery-fileupload-rails is a library that integrates jQuery File Upload for Rail * jQuery File Upload User Interface Plugin 8.8.6 * jQuery File Upload Plugin 5.32.6 * jQuery UI Widget 1.10.3+amd +* JavaScript Load Image 1.9.0 ## Installing Gem From 1a0203c367af556b77a5ea1ea04c6dffb6b221cc Mon Sep 17 00:00:00 2001 From: Valery Kvon Date: Mon, 14 Oct 2013 16:38:11 +0400 Subject: [PATCH 06/20] scripts updated --- .../javascripts/jquery-fileupload/basic.js | 6 +- .../javascripts/jquery-fileupload/index.js | 36 +- .../vendor/canvas-to-blob.js | 95 - .../vendor/canvas-to-blob.min.js | 1 + .../jquery-fileupload/vendor/jquery.Jcrop.js | 1694 ----------------- .../vendor/jquery.Jcrop.min.js | 22 + .../vendor/load-image.min.js | 1 + .../jquery-fileupload/vendor/tmpl.js | 86 - .../jquery-fileupload/vendor/tmpl.min.js | 1 + .../stylesheets/vendor/jquery.Jcrop.css | 165 -- .../stylesheets/vendor/jquery.Jcrop.min.css | 29 + 11 files changed, 75 insertions(+), 2061 deletions(-) delete mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.min.js delete mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/jquery.Jcrop.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/jquery.Jcrop.min.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/load-image.min.js delete mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js create mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.min.js delete mode 100755 vendor/assets/stylesheets/vendor/jquery.Jcrop.css create mode 100755 vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css diff --git a/vendor/assets/javascripts/jquery-fileupload/basic.js b/vendor/assets/javascripts/jquery-fileupload/basic.js index fa302cc..8ae59d2 100755 --- a/vendor/assets/javascripts/jquery-fileupload/basic.js +++ b/vendor/assets/javascripts/jquery-fileupload/basic.js @@ -1,4 +1,4 @@ -//=require jquery-fileupload/vendor/jquery.ui.widget -//=require jquery-fileupload/jquery.iframe-transport -//=require jquery-fileupload/jquery.fileupload +//= require jquery-fileupload/vendor/jquery.ui.widget +//= require jquery-fileupload/jquery.iframe-transport +//= require jquery-fileupload/jquery.fileupload diff --git a/vendor/assets/javascripts/jquery-fileupload/index.js b/vendor/assets/javascripts/jquery-fileupload/index.js index 5ff2a9d..946209f 100755 --- a/vendor/assets/javascripts/jquery-fileupload/index.js +++ b/vendor/assets/javascripts/jquery-fileupload/index.js @@ -1,18 +1,18 @@ -//=require jquery-fileupload/vendor/jquery.ui.widget -//=require jquery-fileupload/vendor/tmpl -//=require jquery-fileupload/vendor/load-image -//=require jquery-fileupload/vendor/load-image-ios -//=require jquery-fileupload/vendor/load-image-orientation -//=require jquery-fileupload/vendor/load-image-meta -//=require jquery-fileupload/vendor/load-image-exif -//=require jquery-fileupload/vendor/load-image-exif-map -//=require jquery-fileupload/vendor/canvas-to-blob -//=require jquery-fileupload/jquery.iframe-transport -//=require jquery-fileupload/jquery.fileupload -//=require jquery-fileupload/jquery.fileupload-image -//=require jquery-fileupload/jquery.fileupload-process -//=require jquery-fileupload/jquery.fileupload-audio -//=require jquery-fileupload/jquery.fileupload-video -//=require jquery-fileupload/jquery.fileupload-validate -//=require jquery-fileupload/jquery.fileupload-ui -//=require jquery-fileupload/locale +//= require jquery-fileupload/vendor/jquery.ui.widget +//= require jquery-fileupload/vendor/tmpl.min +//= require jquery-fileupload/vendor/load-image.min +//= require jquery-fileupload/vendor/load-image-ios +//= require jquery-fileupload/vendor/load-image-orientation +//= require jquery-fileupload/vendor/load-image-meta +//= require jquery-fileupload/vendor/load-image-exif +//= require jquery-fileupload/vendor/load-image-exif-map +//= require jquery-fileupload/vendor/canvas-to-blob.min +//= require jquery-fileupload/jquery.iframe-transport +//= require jquery-fileupload/jquery.fileupload +//= require jquery-fileupload/jquery.fileupload-process +//= require jquery-fileupload/jquery.fileupload-image +//= require jquery-fileupload/jquery.fileupload-audio +//= require jquery-fileupload/jquery.fileupload-video +//= require jquery-fileupload/jquery.fileupload-validate +//= require jquery-fileupload/jquery.fileupload-ui +//= require jquery-fileupload/locale diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js b/vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js deleted file mode 100755 index fcef339..0000000 --- a/vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * JavaScript Canvas to Blob 2.0.5 - * https://github.com/blueimp/JavaScript-Canvas-to-Blob - * - * Copyright 2012, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - * - * Based on stackoverflow user Stoive's code snippet: - * http://stackoverflow.com/q/4998908 - */ - -/*jslint nomen: true, regexp: true */ -/*global window, atob, Blob, ArrayBuffer, Uint8Array, define */ - -(function (window) { - 'use strict'; - var CanvasPrototype = window.HTMLCanvasElement && - window.HTMLCanvasElement.prototype, - hasBlobConstructor = window.Blob && (function () { - try { - return Boolean(new Blob()); - } catch (e) { - return false; - } - }()), - hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array && - (function () { - try { - return new Blob([new Uint8Array(100)]).size === 100; - } catch (e) { - return false; - } - }()), - BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || - window.MozBlobBuilder || window.MSBlobBuilder, - dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob && - window.ArrayBuffer && window.Uint8Array && function (dataURI) { - var byteString, - arrayBuffer, - intArray, - i, - mimeString, - bb; - if (dataURI.split(',')[0].indexOf('base64') >= 0) { - // Convert base64 to raw binary data held in a string: - byteString = atob(dataURI.split(',')[1]); - } else { - // Convert base64/URLEncoded data component to raw binary data: - byteString = decodeURIComponent(dataURI.split(',')[1]); - } - // Write the bytes of the string to an ArrayBuffer: - arrayBuffer = new ArrayBuffer(byteString.length); - intArray = new Uint8Array(arrayBuffer); - for (i = 0; i < byteString.length; i += 1) { - intArray[i] = byteString.charCodeAt(i); - } - // Separate out the mime component: - mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; - // Write the ArrayBuffer (or ArrayBufferView) to a blob: - if (hasBlobConstructor) { - return new Blob( - [hasArrayBufferViewSupport ? intArray : arrayBuffer], - {type: mimeString} - ); - } - bb = new BlobBuilder(); - bb.append(arrayBuffer); - return bb.getBlob(mimeString); - }; - if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) { - if (CanvasPrototype.mozGetAsFile) { - CanvasPrototype.toBlob = function (callback, type, quality) { - if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) { - callback(dataURLtoBlob(this.toDataURL(type, quality))); - } else { - callback(this.mozGetAsFile('blob', type)); - } - }; - } else if (CanvasPrototype.toDataURL && dataURLtoBlob) { - CanvasPrototype.toBlob = function (callback, type, quality) { - callback(dataURLtoBlob(this.toDataURL(type, quality))); - }; - } - } - if (typeof define === 'function' && define.amd) { - define(function () { - return dataURLtoBlob; - }); - } else { - window.dataURLtoBlob = dataURLtoBlob; - } -}(this)); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.min.js b/vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.min.js new file mode 100755 index 0000000..7ee3553 --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.min.js @@ -0,0 +1 @@ +!function(t){"use strict";var e=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,n=t.Blob&&function(){try{return Boolean(new Blob)}catch(t){return!1}}(),o=n&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(t){return!1}}(),r=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,i=(n||r)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(t){var e,i,a,l,u,B;for(e=t.split(",")[0].indexOf("base64")>=0?atob(t.split(",")[1]):decodeURIComponent(t.split(",")[1]),i=new ArrayBuffer(e.length),a=new Uint8Array(i),l=0;l - * http://github.com/tapmodo/Jcrop - * Copyright (c) 2008-2013 Tapmodo Interactive LLC {{{ - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * }}} - */ - -(function ($) { - - $.Jcrop = function (obj, opt) { - var options = $.extend({}, $.Jcrop.defaults), - docOffset, - _ua = navigator.userAgent.toLowerCase(), - is_msie = /msie/.test(_ua), - ie6mode = /msie [1-6]\./.test(_ua); - - // Internal Methods {{{ - function px(n) { - return Math.round(n) + 'px'; - } - function cssClass(cl) { - return options.baseClass + '-' + cl; - } - function supportsColorFade() { - return $.fx.step.hasOwnProperty('backgroundColor'); - } - function getPos(obj) //{{{ - { - var pos = $(obj).offset(); - return [pos.left, pos.top]; - } - //}}} - function mouseAbs(e) //{{{ - { - return [(e.pageX - docOffset[0]), (e.pageY - docOffset[1])]; - } - //}}} - function setOptions(opt) //{{{ - { - if (typeof(opt) !== 'object') opt = {}; - options = $.extend(options, opt); - - $.each(['onChange','onSelect','onRelease','onDblClick'],function(i,e) { - if (typeof(options[e]) !== 'function') options[e] = function () {}; - }); - } - //}}} - function startDragMode(mode, pos, touch) //{{{ - { - docOffset = getPos($img); - Tracker.setCursor(mode === 'move' ? mode : mode + '-resize'); - - if (mode === 'move') { - return Tracker.activateHandlers(createMover(pos), doneSelect, touch); - } - - var fc = Coords.getFixed(); - var opp = oppLockCorner(mode); - var opc = Coords.getCorner(oppLockCorner(opp)); - - Coords.setPressed(Coords.getCorner(opp)); - Coords.setCurrent(opc); - - Tracker.activateHandlers(dragmodeHandler(mode, fc), doneSelect, touch); - } - //}}} - function dragmodeHandler(mode, f) //{{{ - { - return function (pos) { - if (!options.aspectRatio) { - switch (mode) { - case 'e': - pos[1] = f.y2; - break; - case 'w': - pos[1] = f.y2; - break; - case 'n': - pos[0] = f.x2; - break; - case 's': - pos[0] = f.x2; - break; - } - } else { - switch (mode) { - case 'e': - pos[1] = f.y + 1; - break; - case 'w': - pos[1] = f.y + 1; - break; - case 'n': - pos[0] = f.x + 1; - break; - case 's': - pos[0] = f.x + 1; - break; - } - } - Coords.setCurrent(pos); - Selection.update(); - }; - } - //}}} - function createMover(pos) //{{{ - { - var lloc = pos; - KeyManager.watchKeys(); - - return function (pos) { - Coords.moveOffset([pos[0] - lloc[0], pos[1] - lloc[1]]); - lloc = pos; - - Selection.update(); - }; - } - //}}} - function oppLockCorner(ord) //{{{ - { - switch (ord) { - case 'n': - return 'sw'; - case 's': - return 'nw'; - case 'e': - return 'nw'; - case 'w': - return 'ne'; - case 'ne': - return 'sw'; - case 'nw': - return 'se'; - case 'se': - return 'nw'; - case 'sw': - return 'ne'; - } - } - //}}} - function createDragger(ord) //{{{ - { - return function (e) { - if (options.disabled) { - return false; - } - if ((ord === 'move') && !options.allowMove) { - return false; - } - - // Fix position of crop area when dragged the very first time. - // Necessary when crop image is in a hidden element when page is loaded. - docOffset = getPos($img); - - btndown = true; - startDragMode(ord, mouseAbs(e)); - e.stopPropagation(); - e.preventDefault(); - return false; - }; - } - //}}} - function presize($obj, w, h) //{{{ - { - var nw = $obj.width(), - nh = $obj.height(); - if ((nw > w) && w > 0) { - nw = w; - nh = (w / $obj.width()) * $obj.height(); - } - if ((nh > h) && h > 0) { - nh = h; - nw = (h / $obj.height()) * $obj.width(); - } - xscale = $obj.width() / nw; - yscale = $obj.height() / nh; - $obj.width(nw).height(nh); - } - //}}} - function unscale(c) //{{{ - { - return { - x: c.x * xscale, - y: c.y * yscale, - x2: c.x2 * xscale, - y2: c.y2 * yscale, - w: c.w * xscale, - h: c.h * yscale - }; - } - //}}} - function doneSelect(pos) //{{{ - { - var c = Coords.getFixed(); - if ((c.w > options.minSelect[0]) && (c.h > options.minSelect[1])) { - Selection.enableHandles(); - Selection.done(); - } else { - Selection.release(); - } - Tracker.setCursor(options.allowSelect ? 'crosshair' : 'default'); - } - //}}} - function newSelection(e) //{{{ - { - if (options.disabled) { - return false; - } - if (!options.allowSelect) { - return false; - } - btndown = true; - docOffset = getPos($img); - Selection.disableHandles(); - Tracker.setCursor('crosshair'); - var pos = mouseAbs(e); - Coords.setPressed(pos); - Selection.update(); - Tracker.activateHandlers(selectDrag, doneSelect, e.type.substring(0,5)==='touch'); - KeyManager.watchKeys(); - - e.stopPropagation(); - e.preventDefault(); - return false; - } - //}}} - function selectDrag(pos) //{{{ - { - Coords.setCurrent(pos); - Selection.update(); - } - //}}} - function newTracker() //{{{ - { - var trk = $('
').addClass(cssClass('tracker')); - if (is_msie) { - trk.css({ - opacity: 0, - backgroundColor: 'white' - }); - } - return trk; - } - //}}} - - // }}} - // Initialization {{{ - // Sanitize some options {{{ - if (typeof(obj) !== 'object') { - obj = $(obj)[0]; - } - if (typeof(opt) !== 'object') { - opt = {}; - } - // }}} - setOptions(opt); - // Initialize some jQuery objects {{{ - // The values are SET on the image(s) for the interface - // If the original image has any of these set, they will be reset - // However, if you destroy() the Jcrop instance the original image's - // character in the DOM will be as you left it. - var img_css = { - border: 'none', - visibility: 'visible', - margin: 0, - padding: 0, - position: 'absolute', - top: 0, - left: 0 - }; - - var $origimg = $(obj), - img_mode = true; - - if (obj.tagName == 'IMG') { - // Fix size of crop image. - // Necessary when crop image is within a hidden element when page is loaded. - if ($origimg[0].width != 0 && $origimg[0].height != 0) { - // Obtain dimensions from contained img element. - $origimg.width($origimg[0].width); - $origimg.height($origimg[0].height); - } else { - // Obtain dimensions from temporary image in case the original is not loaded yet (e.g. IE 7.0). - var tempImage = new Image(); - tempImage.src = $origimg[0].src; - $origimg.width(tempImage.width); - $origimg.height(tempImage.height); - } - - var $img = $origimg.clone().removeAttr('id').css(img_css).show(); - - $img.width($origimg.width()); - $img.height($origimg.height()); - $origimg.after($img).hide(); - - } else { - $img = $origimg.css(img_css).show(); - img_mode = false; - if (options.shade === null) { options.shade = true; } - } - - presize($img, options.boxWidth, options.boxHeight); - - var boundx = $img.width(), - boundy = $img.height(), - - - $div = $('
').width(boundx).height(boundy).addClass(cssClass('holder')).css({ - position: 'relative', - backgroundColor: options.bgColor - }).insertAfter($origimg).append($img); - - if (options.addClass) { - $div.addClass(options.addClass); - } - - var $img2 = $('
'), - - $img_holder = $('
') - .width('100%').height('100%').css({ - zIndex: 310, - position: 'absolute', - overflow: 'hidden' - }), - - $hdl_holder = $('
') - .width('100%').height('100%').css('zIndex', 320), - - $sel = $('
') - .css({ - position: 'absolute', - zIndex: 600 - }).dblclick(function(){ - var c = Coords.getFixed(); - options.onDblClick.call(api,c); - }).insertBefore($img).append($img_holder, $hdl_holder); - - if (img_mode) { - - $img2 = $('') - .attr('src', $img.attr('src')).css(img_css).width(boundx).height(boundy), - - $img_holder.append($img2); - - } - - if (ie6mode) { - $sel.css({ - overflowY: 'hidden' - }); - } - - var bound = options.boundary; - var $trk = newTracker().width(boundx + (bound * 2)).height(boundy + (bound * 2)).css({ - position: 'absolute', - top: px(-bound), - left: px(-bound), - zIndex: 290 - }).mousedown(newSelection); - - /* }}} */ - // Set more variables {{{ - var bgcolor = options.bgColor, - bgopacity = options.bgOpacity, - xlimit, ylimit, xmin, ymin, xscale, yscale, enabled = true, - btndown, animating, shift_down; - - docOffset = getPos($img); - // }}} - // }}} - // Internal Modules {{{ - // Touch Module {{{ - var Touch = (function () { - // Touch support detection function adapted (under MIT License) - // from code by Jeffrey Sambells - http://github.com/iamamused/ - function hasTouchSupport() { - var support = {}, events = ['touchstart', 'touchmove', 'touchend'], - el = document.createElement('div'), i; - - try { - for(i=0; i x1 + ox) { - ox -= ox + x1; - } - if (0 > y1 + oy) { - oy -= oy + y1; - } - - if (boundy < y2 + oy) { - oy += boundy - (y2 + oy); - } - if (boundx < x2 + ox) { - ox += boundx - (x2 + ox); - } - - x1 += ox; - x2 += ox; - y1 += oy; - y2 += oy; - } - //}}} - function getCorner(ord) //{{{ - { - var c = getFixed(); - switch (ord) { - case 'ne': - return [c.x2, c.y]; - case 'nw': - return [c.x, c.y]; - case 'se': - return [c.x2, c.y2]; - case 'sw': - return [c.x, c.y2]; - } - } - //}}} - function getFixed() //{{{ - { - if (!options.aspectRatio) { - return getRect(); - } - // This function could use some optimization I think... - var aspect = options.aspectRatio, - min_x = options.minSize[0] / xscale, - - - //min_y = options.minSize[1]/yscale, - max_x = options.maxSize[0] / xscale, - max_y = options.maxSize[1] / yscale, - rw = x2 - x1, - rh = y2 - y1, - rwa = Math.abs(rw), - rha = Math.abs(rh), - real_ratio = rwa / rha, - xx, yy, w, h; - - if (max_x === 0) { - max_x = boundx * 10; - } - if (max_y === 0) { - max_y = boundy * 10; - } - if (real_ratio < aspect) { - yy = y2; - w = rha * aspect; - xx = rw < 0 ? x1 - w : w + x1; - - if (xx < 0) { - xx = 0; - h = Math.abs((xx - x1) / aspect); - yy = rh < 0 ? y1 - h : h + y1; - } else if (xx > boundx) { - xx = boundx; - h = Math.abs((xx - x1) / aspect); - yy = rh < 0 ? y1 - h : h + y1; - } - } else { - xx = x2; - h = rwa / aspect; - yy = rh < 0 ? y1 - h : y1 + h; - if (yy < 0) { - yy = 0; - w = Math.abs((yy - y1) * aspect); - xx = rw < 0 ? x1 - w : w + x1; - } else if (yy > boundy) { - yy = boundy; - w = Math.abs(yy - y1) * aspect; - xx = rw < 0 ? x1 - w : w + x1; - } - } - - // Magic %-) - if (xx > x1) { // right side - if (xx - x1 < min_x) { - xx = x1 + min_x; - } else if (xx - x1 > max_x) { - xx = x1 + max_x; - } - if (yy > y1) { - yy = y1 + (xx - x1) / aspect; - } else { - yy = y1 - (xx - x1) / aspect; - } - } else if (xx < x1) { // left side - if (x1 - xx < min_x) { - xx = x1 - min_x; - } else if (x1 - xx > max_x) { - xx = x1 - max_x; - } - if (yy > y1) { - yy = y1 + (x1 - xx) / aspect; - } else { - yy = y1 - (x1 - xx) / aspect; - } - } - - if (xx < 0) { - x1 -= xx; - xx = 0; - } else if (xx > boundx) { - x1 -= xx - boundx; - xx = boundx; - } - - if (yy < 0) { - y1 -= yy; - yy = 0; - } else if (yy > boundy) { - y1 -= yy - boundy; - yy = boundy; - } - - return makeObj(flipCoords(x1, y1, xx, yy)); - } - //}}} - function rebound(p) //{{{ - { - if (p[0] < 0) p[0] = 0; - if (p[1] < 0) p[1] = 0; - - if (p[0] > boundx) p[0] = boundx; - if (p[1] > boundy) p[1] = boundy; - - return [Math.round(p[0]), Math.round(p[1])]; - } - //}}} - function flipCoords(x1, y1, x2, y2) //{{{ - { - var xa = x1, - xb = x2, - ya = y1, - yb = y2; - if (x2 < x1) { - xa = x2; - xb = x1; - } - if (y2 < y1) { - ya = y2; - yb = y1; - } - return [xa, ya, xb, yb]; - } - //}}} - function getRect() //{{{ - { - var xsize = x2 - x1, - ysize = y2 - y1, - delta; - - if (xlimit && (Math.abs(xsize) > xlimit)) { - x2 = (xsize > 0) ? (x1 + xlimit) : (x1 - xlimit); - } - if (ylimit && (Math.abs(ysize) > ylimit)) { - y2 = (ysize > 0) ? (y1 + ylimit) : (y1 - ylimit); - } - - if (ymin / yscale && (Math.abs(ysize) < ymin / yscale)) { - y2 = (ysize > 0) ? (y1 + ymin / yscale) : (y1 - ymin / yscale); - } - if (xmin / xscale && (Math.abs(xsize) < xmin / xscale)) { - x2 = (xsize > 0) ? (x1 + xmin / xscale) : (x1 - xmin / xscale); - } - - if (x1 < 0) { - x2 -= x1; - x1 -= x1; - } - if (y1 < 0) { - y2 -= y1; - y1 -= y1; - } - if (x2 < 0) { - x1 -= x2; - x2 -= x2; - } - if (y2 < 0) { - y1 -= y2; - y2 -= y2; - } - if (x2 > boundx) { - delta = x2 - boundx; - x1 -= delta; - x2 -= delta; - } - if (y2 > boundy) { - delta = y2 - boundy; - y1 -= delta; - y2 -= delta; - } - if (x1 > boundx) { - delta = x1 - boundy; - y2 -= delta; - y1 -= delta; - } - if (y1 > boundy) { - delta = y1 - boundy; - y2 -= delta; - y1 -= delta; - } - - return makeObj(flipCoords(x1, y1, x2, y2)); - } - //}}} - function makeObj(a) //{{{ - { - return { - x: a[0], - y: a[1], - x2: a[2], - y2: a[3], - w: a[2] - a[0], - h: a[3] - a[1] - }; - } - //}}} - - return { - flipCoords: flipCoords, - setPressed: setPressed, - setCurrent: setCurrent, - getOffset: getOffset, - moveOffset: moveOffset, - getCorner: getCorner, - getFixed: getFixed - }; - }()); - - //}}} - // Shade Module {{{ - var Shade = (function() { - var enabled = false, - holder = $('
').css({ - position: 'absolute', - zIndex: 240, - opacity: 0 - }), - shades = { - top: createShade(), - left: createShade().height(boundy), - right: createShade().height(boundy), - bottom: createShade() - }; - - function resizeShades(w,h) { - shades.left.css({ height: px(h) }); - shades.right.css({ height: px(h) }); - } - function updateAuto() - { - return updateShade(Coords.getFixed()); - } - function updateShade(c) - { - shades.top.css({ - left: px(c.x), - width: px(c.w), - height: px(c.y) - }); - shades.bottom.css({ - top: px(c.y2), - left: px(c.x), - width: px(c.w), - height: px(boundy-c.y2) - }); - shades.right.css({ - left: px(c.x2), - width: px(boundx-c.x2) - }); - shades.left.css({ - width: px(c.x) - }); - } - function createShade() { - return $('
').css({ - position: 'absolute', - backgroundColor: options.shadeColor||options.bgColor - }).appendTo(holder); - } - function enableShade() { - if (!enabled) { - enabled = true; - holder.insertBefore($img); - updateAuto(); - Selection.setBgOpacity(1,0,1); - $img2.hide(); - - setBgColor(options.shadeColor||options.bgColor,1); - if (Selection.isAwake()) - { - setOpacity(options.bgOpacity,1); - } - else setOpacity(1,1); - } - } - function setBgColor(color,now) { - colorChangeMacro(getShades(),color,now); - } - function disableShade() { - if (enabled) { - holder.remove(); - $img2.show(); - enabled = false; - if (Selection.isAwake()) { - Selection.setBgOpacity(options.bgOpacity,1,1); - } else { - Selection.setBgOpacity(1,1,1); - Selection.disableHandles(); - } - colorChangeMacro($div,0,1); - } - } - function setOpacity(opacity,now) { - if (enabled) { - if (options.bgFade && !now) { - holder.animate({ - opacity: 1-opacity - },{ - queue: false, - duration: options.fadeTime - }); - } - else holder.css({opacity:1-opacity}); - } - } - function refreshAll() { - options.shade ? enableShade() : disableShade(); - if (Selection.isAwake()) setOpacity(options.bgOpacity); - } - function getShades() { - return holder.children(); - } - - return { - update: updateAuto, - updateRaw: updateShade, - getShades: getShades, - setBgColor: setBgColor, - enable: enableShade, - disable: disableShade, - resize: resizeShades, - refresh: refreshAll, - opacity: setOpacity - }; - }()); - // }}} - // Selection Module {{{ - var Selection = (function () { - var awake, - hdep = 370, - borders = {}, - handle = {}, - dragbar = {}, - seehandles = false; - - // Private Methods - function insertBorder(type) //{{{ - { - var jq = $('
').css({ - position: 'absolute', - opacity: options.borderOpacity - }).addClass(cssClass(type)); - $img_holder.append(jq); - return jq; - } - //}}} - function dragDiv(ord, zi) //{{{ - { - var jq = $('
').mousedown(createDragger(ord)).css({ - cursor: ord + '-resize', - position: 'absolute', - zIndex: zi - }).addClass('ord-'+ord); - - if (Touch.support) { - jq.bind('touchstart.jcrop', Touch.createDragger(ord)); - } - - $hdl_holder.append(jq); - return jq; - } - //}}} - function insertHandle(ord) //{{{ - { - var hs = options.handleSize, - - div = dragDiv(ord, hdep++).css({ - opacity: options.handleOpacity - }).addClass(cssClass('handle')); - - if (hs) { div.width(hs).height(hs); } - - return div; - } - //}}} - function insertDragbar(ord) //{{{ - { - return dragDiv(ord, hdep++).addClass('jcrop-dragbar'); - } - //}}} - function createDragbars(li) //{{{ - { - var i; - for (i = 0; i < li.length; i++) { - dragbar[li[i]] = insertDragbar(li[i]); - } - } - //}}} - function createBorders(li) //{{{ - { - var cl,i; - for (i = 0; i < li.length; i++) { - switch(li[i]){ - case'n': cl='hline'; break; - case's': cl='hline bottom'; break; - case'e': cl='vline right'; break; - case'w': cl='vline'; break; - } - borders[li[i]] = insertBorder(cl); - } - } - //}}} - function createHandles(li) //{{{ - { - var i; - for (i = 0; i < li.length; i++) { - handle[li[i]] = insertHandle(li[i]); - } - } - //}}} - function moveto(x, y) //{{{ - { - if (!options.shade) { - $img2.css({ - top: px(-y), - left: px(-x) - }); - } - $sel.css({ - top: px(y), - left: px(x) - }); - } - //}}} - function resize(w, h) //{{{ - { - $sel.width(Math.round(w)).height(Math.round(h)); - } - //}}} - function refresh() //{{{ - { - var c = Coords.getFixed(); - - Coords.setPressed([c.x, c.y]); - Coords.setCurrent([c.x2, c.y2]); - - updateVisible(); - } - //}}} - - // Internal Methods - function updateVisible(select) //{{{ - { - if (awake) { - return update(select); - } - } - //}}} - function update(select) //{{{ - { - var c = Coords.getFixed(); - - resize(c.w, c.h); - moveto(c.x, c.y); - if (options.shade) Shade.updateRaw(c); - - awake || show(); - - if (select) { - options.onSelect.call(api, unscale(c)); - } else { - options.onChange.call(api, unscale(c)); - } - } - //}}} - function setBgOpacity(opacity,force,now) //{{{ - { - if (!awake && !force) return; - if (options.bgFade && !now) { - $img.animate({ - opacity: opacity - },{ - queue: false, - duration: options.fadeTime - }); - } else { - $img.css('opacity', opacity); - } - } - //}}} - function show() //{{{ - { - $sel.show(); - - if (options.shade) Shade.opacity(bgopacity); - else setBgOpacity(bgopacity,true); - - awake = true; - } - //}}} - function release() //{{{ - { - disableHandles(); - $sel.hide(); - - if (options.shade) Shade.opacity(1); - else setBgOpacity(1); - - awake = false; - options.onRelease.call(api); - } - //}}} - function showHandles() //{{{ - { - if (seehandles) { - $hdl_holder.show(); - } - } - //}}} - function enableHandles() //{{{ - { - seehandles = true; - if (options.allowResize) { - $hdl_holder.show(); - return true; - } - } - //}}} - function disableHandles() //{{{ - { - seehandles = false; - $hdl_holder.hide(); - } - //}}} - function animMode(v) //{{{ - { - if (v) { - animating = true; - disableHandles(); - } else { - animating = false; - enableHandles(); - } - } - //}}} - function done() //{{{ - { - animMode(false); - refresh(); - } - //}}} - // Insert draggable elements {{{ - // Insert border divs for outline - - if (options.dragEdges && $.isArray(options.createDragbars)) - createDragbars(options.createDragbars); - - if ($.isArray(options.createHandles)) - createHandles(options.createHandles); - - if (options.drawBorders && $.isArray(options.createBorders)) - createBorders(options.createBorders); - - //}}} - - // This is a hack for iOS5 to support drag/move touch functionality - $(document).bind('touchstart.jcrop-ios',function(e) { - if ($(e.currentTarget).hasClass('jcrop-tracker')) e.stopPropagation(); - }); - - var $track = newTracker().mousedown(createDragger('move')).css({ - cursor: 'move', - position: 'absolute', - zIndex: 360 - }); - - if (Touch.support) { - $track.bind('touchstart.jcrop', Touch.createDragger('move')); - } - - $img_holder.append($track); - disableHandles(); - - return { - updateVisible: updateVisible, - update: update, - release: release, - refresh: refresh, - isAwake: function () { - return awake; - }, - setCursor: function (cursor) { - $track.css('cursor', cursor); - }, - enableHandles: enableHandles, - enableOnly: function () { - seehandles = true; - }, - showHandles: showHandles, - disableHandles: disableHandles, - animMode: animMode, - setBgOpacity: setBgOpacity, - done: done - }; - }()); - - //}}} - // Tracker Module {{{ - var Tracker = (function () { - var onMove = function () {}, - onDone = function () {}, - trackDoc = options.trackDocument; - - function toFront(touch) //{{{ - { - $trk.css({ - zIndex: 450 - }); - - if (touch) - $(document) - .bind('touchmove.jcrop', trackTouchMove) - .bind('touchend.jcrop', trackTouchEnd); - - else if (trackDoc) - $(document) - .bind('mousemove.jcrop',trackMove) - .bind('mouseup.jcrop',trackUp); - } - //}}} - function toBack() //{{{ - { - $trk.css({ - zIndex: 290 - }); - $(document).unbind('.jcrop'); - } - //}}} - function trackMove(e) //{{{ - { - onMove(mouseAbs(e)); - return false; - } - //}}} - function trackUp(e) //{{{ - { - e.preventDefault(); - e.stopPropagation(); - - if (btndown) { - btndown = false; - - onDone(mouseAbs(e)); - - if (Selection.isAwake()) { - options.onSelect.call(api, unscale(Coords.getFixed())); - } - - toBack(); - onMove = function () {}; - onDone = function () {}; - } - - return false; - } - //}}} - function activateHandlers(move, done, touch) //{{{ - { - btndown = true; - onMove = move; - onDone = done; - toFront(touch); - return false; - } - //}}} - function trackTouchMove(e) //{{{ - { - onMove(mouseAbs(Touch.cfilter(e))); - return false; - } - //}}} - function trackTouchEnd(e) //{{{ - { - return trackUp(Touch.cfilter(e)); - } - //}}} - function setCursor(t) //{{{ - { - $trk.css('cursor', t); - } - //}}} - - if (!trackDoc) { - $trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp); - } - - $img.before($trk); - return { - activateHandlers: activateHandlers, - setCursor: setCursor - }; - }()); - //}}} - // KeyManager Module {{{ - var KeyManager = (function () { - var $keymgr = $('').css({ - position: 'fixed', - left: '-120px', - width: '12px' - }).addClass('jcrop-keymgr'), - - $keywrap = $('
').css({ - position: 'absolute', - overflow: 'hidden' - }).append($keymgr); - - function watchKeys() //{{{ - { - if (options.keySupport) { - $keymgr.show(); - $keymgr.focus(); - } - } - //}}} - function onBlur(e) //{{{ - { - $keymgr.hide(); - } - //}}} - function doNudge(e, x, y) //{{{ - { - if (options.allowMove) { - Coords.moveOffset([x, y]); - Selection.updateVisible(true); - } - e.preventDefault(); - e.stopPropagation(); - } - //}}} - function parseKey(e) //{{{ - { - if (e.ctrlKey || e.metaKey) { - return true; - } - shift_down = e.shiftKey ? true : false; - var nudge = shift_down ? 10 : 1; - - switch (e.keyCode) { - case 37: - doNudge(e, -nudge, 0); - break; - case 39: - doNudge(e, nudge, 0); - break; - case 38: - doNudge(e, 0, -nudge); - break; - case 40: - doNudge(e, 0, nudge); - break; - case 27: - if (options.allowSelect) Selection.release(); - break; - case 9: - return true; - } - - return false; - } - //}}} - - if (options.keySupport) { - $keymgr.keydown(parseKey).blur(onBlur); - if (ie6mode || !options.fixedSupport) { - $keymgr.css({ - position: 'absolute', - left: '-20px' - }); - $keywrap.append($keymgr).insertBefore($img); - } else { - $keymgr.insertBefore($img); - } - } - - - return { - watchKeys: watchKeys - }; - }()); - //}}} - // }}} - // API methods {{{ - function setClass(cname) //{{{ - { - $div.removeClass().addClass(cssClass('holder')).addClass(cname); - } - //}}} - function animateTo(a, callback) //{{{ - { - var x1 = a[0] / xscale, - y1 = a[1] / yscale, - x2 = a[2] / xscale, - y2 = a[3] / yscale; - - if (animating) { - return; - } - - var animto = Coords.flipCoords(x1, y1, x2, y2), - c = Coords.getFixed(), - initcr = [c.x, c.y, c.x2, c.y2], - animat = initcr, - interv = options.animationDelay, - ix1 = animto[0] - initcr[0], - iy1 = animto[1] - initcr[1], - ix2 = animto[2] - initcr[2], - iy2 = animto[3] - initcr[3], - pcent = 0, - velocity = options.swingSpeed; - - x1 = animat[0]; - y1 = animat[1]; - x2 = animat[2]; - y2 = animat[3]; - - Selection.animMode(true); - var anim_timer; - - function queueAnimator() { - window.setTimeout(animator, interv); - } - var animator = (function () { - return function () { - pcent += (100 - pcent) / velocity; - - animat[0] = Math.round(x1 + ((pcent / 100) * ix1)); - animat[1] = Math.round(y1 + ((pcent / 100) * iy1)); - animat[2] = Math.round(x2 + ((pcent / 100) * ix2)); - animat[3] = Math.round(y2 + ((pcent / 100) * iy2)); - - if (pcent >= 99.8) { - pcent = 100; - } - if (pcent < 100) { - setSelectRaw(animat); - queueAnimator(); - } else { - Selection.done(); - Selection.animMode(false); - if (typeof(callback) === 'function') { - callback.call(api); - } - } - }; - }()); - queueAnimator(); - } - //}}} - function setSelect(rect) //{{{ - { - setSelectRaw([rect[0] / xscale, rect[1] / yscale, rect[2] / xscale, rect[3] / yscale]); - options.onSelect.call(api, unscale(Coords.getFixed())); - Selection.enableHandles(); - } - //}}} - function setSelectRaw(l) //{{{ - { - Coords.setPressed([l[0], l[1]]); - Coords.setCurrent([l[2], l[3]]); - Selection.update(); - } - //}}} - function tellSelect() //{{{ - { - return unscale(Coords.getFixed()); - } - //}}} - function tellScaled() //{{{ - { - return Coords.getFixed(); - } - //}}} - function setOptionsNew(opt) //{{{ - { - setOptions(opt); - interfaceUpdate(); - } - //}}} - function disableCrop() //{{{ - { - options.disabled = true; - Selection.disableHandles(); - Selection.setCursor('default'); - Tracker.setCursor('default'); - } - //}}} - function enableCrop() //{{{ - { - options.disabled = false; - interfaceUpdate(); - } - //}}} - function cancelCrop() //{{{ - { - Selection.done(); - Tracker.activateHandlers(null, null); - } - //}}} - function destroy() //{{{ - { - $div.remove(); - $origimg.show(); - $origimg.css('visibility','visible'); - $(obj).removeData('Jcrop'); - } - //}}} - function setImage(src, callback) //{{{ - { - Selection.release(); - disableCrop(); - var img = new Image(); - img.onload = function () { - var iw = img.width; - var ih = img.height; - var bw = options.boxWidth; - var bh = options.boxHeight; - $img.width(iw).height(ih); - $img.attr('src', src); - $img2.attr('src', src); - presize($img, bw, bh); - boundx = $img.width(); - boundy = $img.height(); - $img2.width(boundx).height(boundy); - $trk.width(boundx + (bound * 2)).height(boundy + (bound * 2)); - $div.width(boundx).height(boundy); - Shade.resize(boundx,boundy); - enableCrop(); - - if (typeof(callback) === 'function') { - callback.call(api); - } - }; - img.src = src; - } - //}}} - function colorChangeMacro($obj,color,now) { - var mycolor = color || options.bgColor; - if (options.bgFade && supportsColorFade() && options.fadeTime && !now) { - $obj.animate({ - backgroundColor: mycolor - }, { - queue: false, - duration: options.fadeTime - }); - } else { - $obj.css('backgroundColor', mycolor); - } - } - function interfaceUpdate(alt) //{{{ - // This method tweaks the interface based on options object. - // Called when options are changed and at end of initialization. - { - if (options.allowResize) { - if (alt) { - Selection.enableOnly(); - } else { - Selection.enableHandles(); - } - } else { - Selection.disableHandles(); - } - - Tracker.setCursor(options.allowSelect ? 'crosshair' : 'default'); - Selection.setCursor(options.allowMove ? 'move' : 'default'); - - if (options.hasOwnProperty('trueSize')) { - xscale = options.trueSize[0] / boundx; - yscale = options.trueSize[1] / boundy; - } - - if (options.hasOwnProperty('setSelect')) { - setSelect(options.setSelect); - Selection.done(); - delete(options.setSelect); - } - - Shade.refresh(); - - if (options.bgColor != bgcolor) { - colorChangeMacro( - options.shade? Shade.getShades(): $div, - options.shade? - (options.shadeColor || options.bgColor): - options.bgColor - ); - bgcolor = options.bgColor; - } - - if (bgopacity != options.bgOpacity) { - bgopacity = options.bgOpacity; - if (options.shade) Shade.refresh(); - else Selection.setBgOpacity(bgopacity); - } - - xlimit = options.maxSize[0] || 0; - ylimit = options.maxSize[1] || 0; - xmin = options.minSize[0] || 0; - ymin = options.minSize[1] || 0; - - if (options.hasOwnProperty('outerImage')) { - $img.attr('src', options.outerImage); - delete(options.outerImage); - } - - Selection.refresh(); - } - //}}} - //}}} - - if (Touch.support) $trk.bind('touchstart.jcrop', Touch.newSelection); - - $hdl_holder.hide(); - interfaceUpdate(true); - - var api = { - setImage: setImage, - animateTo: animateTo, - setSelect: setSelect, - setOptions: setOptionsNew, - tellSelect: tellSelect, - tellScaled: tellScaled, - setClass: setClass, - - disable: disableCrop, - enable: enableCrop, - cancel: cancelCrop, - release: Selection.release, - destroy: destroy, - - focus: KeyManager.watchKeys, - - getBounds: function () { - return [boundx * xscale, boundy * yscale]; - }, - getWidgetSize: function () { - return [boundx, boundy]; - }, - getScaleFactor: function () { - return [xscale, yscale]; - }, - getOptions: function() { - // careful: internal values are returned - return options; - }, - - ui: { - holder: $div, - selection: $sel - } - }; - - if (is_msie) $div.bind('selectstart', function () { return false; }); - - $origimg.data('Jcrop', api); - return api; - }; - $.fn.Jcrop = function (options, callback) //{{{ - { - var api; - // Iterate over each object, attach Jcrop - this.each(function () { - // If we've already attached to this object - if ($(this).data('Jcrop')) { - // The API can be requested this way (undocumented) - if (options === 'api') return $(this).data('Jcrop'); - // Otherwise, we just reset the options... - else $(this).data('Jcrop').setOptions(options); - } - // If we haven't been attached, preload and attach - else { - if (this.tagName == 'IMG') - $.Jcrop.Loader(this,function(){ - $(this).css({display:'block',visibility:'hidden'}); - api = $.Jcrop(this, options); - if ($.isFunction(callback)) callback.call(api); - }); - else { - $(this).css({display:'block',visibility:'hidden'}); - api = $.Jcrop(this, options); - if ($.isFunction(callback)) callback.call(api); - } - } - }); - - // Return "this" so the object is chainable (jQuery-style) - return this; - }; - //}}} - // $.Jcrop.Loader - basic image loader {{{ - - $.Jcrop.Loader = function(imgobj,success,error){ - var $img = $(imgobj), img = $img[0]; - - function completeCheck(){ - if (img.complete) { - $img.unbind('.jcloader'); - if ($.isFunction(success)) success.call(img); - } - else window.setTimeout(completeCheck,50); - } - - $img - .bind('load.jcloader',completeCheck) - .bind('error.jcloader',function(e){ - $img.unbind('.jcloader'); - if ($.isFunction(error)) error.call(img); - }); - - if (img.complete && $.isFunction(success)){ - $img.unbind('.jcloader'); - success.call(img); - } - }; - - //}}} - // Global Defaults {{{ - $.Jcrop.defaults = { - - // Basic Settings - allowSelect: true, - allowMove: true, - allowResize: true, - - trackDocument: true, - - // Styling Options - baseClass: 'jcrop', - addClass: null, - bgColor: 'black', - bgOpacity: 0.6, - bgFade: false, - borderOpacity: 0.4, - handleOpacity: 0.5, - handleSize: null, - - aspectRatio: 0, - keySupport: true, - createHandles: ['n','s','e','w','nw','ne','se','sw'], - createDragbars: ['n','s','e','w'], - createBorders: ['n','s','e','w'], - drawBorders: true, - dragEdges: true, - fixedSupport: true, - touchSupport: null, - - shade: null, - - boxWidth: 0, - boxHeight: 0, - boundary: 2, - fadeTime: 400, - animationDelay: 20, - swingSpeed: 3, - - minSelect: [0, 0], - maxSize: [0, 0], - minSize: [0, 0], - - // Callbacks / Event Handlers - onChange: function () {}, - onSelect: function () {}, - onDblClick: function () {}, - onRelease: function () {} - }; - - // }}} -}(jQuery)); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.Jcrop.min.js b/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.Jcrop.min.js new file mode 100755 index 0000000..4c9c7ad --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.Jcrop.min.js @@ -0,0 +1,22 @@ +/** + * jquery.Jcrop.min.js v0.9.12 (build:20130202) + * jQuery Image Cropping Plugin - released under MIT License + * Copyright (c) 2008-2013 Tapmodo Interactive LLC + * https://github.com/tapmodo/Jcrop + */ +(function(a){a.Jcrop=function(b,c){function i(a){return Math.round(a)+"px"}function j(a){return d.baseClass+"-"+a}function k(){return a.fx.step.hasOwnProperty("backgroundColor")}function l(b){var c=a(b).offset();return[c.left,c.top]}function m(a){return[a.pageX-e[0],a.pageY-e[1]]}function n(b){typeof b!="object"&&(b={}),d=a.extend(d,b),a.each(["onChange","onSelect","onRelease","onDblClick"],function(a,b){typeof d[b]!="function"&&(d[b]=function(){})})}function o(a,b,c){e=l(D),bc.setCursor(a==="move"?a:a+"-resize");if(a==="move")return bc.activateHandlers(q(b),v,c);var d=_.getFixed(),f=r(a),g=_.getCorner(r(f));_.setPressed(_.getCorner(f)),_.setCurrent(g),bc.activateHandlers(p(a,d),v,c)}function p(a,b){return function(c){if(!d.aspectRatio)switch(a){case"e":c[1]=b.y2;break;case"w":c[1]=b.y2;break;case"n":c[0]=b.x2;break;case"s":c[0]=b.x2}else switch(a){case"e":c[1]=b.y+1;break;case"w":c[1]=b.y+1;break;case"n":c[0]=b.x+1;break;case"s":c[0]=b.x+1}_.setCurrent(c),bb.update()}}function q(a){var b=a;return bd.watchKeys +(),function(a){_.moveOffset([a[0]-b[0],a[1]-b[1]]),b=a,bb.update()}}function r(a){switch(a){case"n":return"sw";case"s":return"nw";case"e":return"nw";case"w":return"ne";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne"}}function s(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(b)),b.stopPropagation(),b.preventDefault(),!1)}}function t(a,b,c){var d=a.width(),e=a.height();d>b&&b>0&&(d=b,e=b/a.width()*a.height()),e>c&&c>0&&(e=c,d=c/a.height()*a.width()),T=a.width()/d,U=a.height()/e,a.width(d).height(e)}function u(a){return{x:a.x*T,y:a.y*U,x2:a.x2*T,y2:a.y2*U,w:a.w*T,h:a.h*U}}function v(a){var b=_.getFixed();b.w>d.minSelect[0]&&b.h>d.minSelect[1]?(bb.enableHandles(),bb.done()):bb.release(),bc.setCursor(d.allowSelect?"crosshair":"default")}function w(a){if(d.disabled)return!1;if(!d.allowSelect)return!1;W=!0,e=l(D),bb.disableHandles(),bc.setCursor("crosshair");var b=m(a);return _.setPressed(b),bb.update(),bc.activateHandlers(x,v,a.type.substring +(0,5)==="touch"),bd.watchKeys(),a.stopPropagation(),a.preventDefault(),!1}function x(a){_.setCurrent(a),bb.update()}function y(){var b=a("
").addClass(j("tracker"));return g&&b.css({opacity:0,backgroundColor:"white"}),b}function be(a){G.removeClass().addClass(j("holder")).addClass(a)}function bf(a,b){function t(){window.setTimeout(u,l)}var c=a[0]/T,e=a[1]/U,f=a[2]/T,g=a[3]/U;if(X)return;var h=_.flipCoords(c,e,f,g),i=_.getFixed(),j=[i.x,i.y,i.x2,i.y2],k=j,l=d.animationDelay,m=h[0]-j[0],n=h[1]-j[1],o=h[2]-j[2],p=h[3]-j[3],q=0,r=d.swingSpeed;c=k[0],e=k[1],f=k[2],g=k[3],bb.animMode(!0);var s,u=function(){return function(){q+=(100-q)/r,k[0]=Math.round(c+q/100*m),k[1]=Math.round(e+q/100*n),k[2]=Math.round(f+q/100*o),k[3]=Math.round(g+q/100*p),q>=99.8&&(q=100),q<100?(bh(k),t()):(bb.done(),bb.animMode(!1),typeof b=="function"&&b.call(bs))}}();t()}function bg(a){bh([a[0]/T,a[1]/U,a[2]/T,a[3]/U]),d.onSelect.call(bs,u(_.getFixed())),bb.enableHandles()}function bh(a){_.setPressed([a[0],a[1]]),_.setCurrent([a[2], +a[3]]),bb.update()}function bi(){return u(_.getFixed())}function bj(){return _.getFixed()}function bk(a){n(a),br()}function bl(){d.disabled=!0,bb.disableHandles(),bb.setCursor("default"),bc.setCursor("default")}function bm(){d.disabled=!1,br()}function bn(){bb.done(),bc.activateHandlers(null,null)}function bo(){G.remove(),A.show(),A.css("visibility","visible"),a(b).removeData("Jcrop")}function bp(a,b){bb.release(),bl();var c=new Image;c.onload=function(){var e=c.width,f=c.height,g=d.boxWidth,h=d.boxHeight;D.width(e).height(f),D.attr("src",a),H.attr("src",a),t(D,g,h),E=D.width(),F=D.height(),H.width(E).height(F),M.width(E+L*2).height(F+L*2),G.width(E).height(F),ba.resize(E,F),bm(),typeof b=="function"&&b.call(bs)},c.src=a}function bq(a,b,c){var e=b||d.bgColor;d.bgFade&&k()&&d.fadeTime&&!c?a.animate({backgroundColor:e},{queue:!1,duration:d.fadeTime}):a.css("backgroundColor",e)}function br(a){d.allowResize?a?bb.enableOnly():bb.enableHandles():bb.disableHandles(),bc.setCursor(d.allowSelect?"crosshair":"default"),bb +.setCursor(d.allowMove?"move":"default"),d.hasOwnProperty("trueSize")&&(T=d.trueSize[0]/E,U=d.trueSize[1]/F),d.hasOwnProperty("setSelect")&&(bg(d.setSelect),bb.done(),delete d.setSelect),ba.refresh(),d.bgColor!=N&&(bq(d.shade?ba.getShades():G,d.shade?d.shadeColor||d.bgColor:d.bgColor),N=d.bgColor),O!=d.bgOpacity&&(O=d.bgOpacity,d.shade?ba.refresh():bb.setBgOpacity(O)),P=d.maxSize[0]||0,Q=d.maxSize[1]||0,R=d.minSize[0]||0,S=d.minSize[1]||0,d.hasOwnProperty("outerImage")&&(D.attr("src",d.outerImage),delete d.outerImage),bb.refresh()}var d=a.extend({},a.Jcrop.defaults),e,f=navigator.userAgent.toLowerCase(),g=/msie/.test(f),h=/msie [1-6]\./.test(f);typeof b!="object"&&(b=a(b)[0]),typeof c!="object"&&(c={}),n(c);var z={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0},A=a(b),B=!0;if(b.tagName=="IMG"){if(A[0].width!=0&&A[0].height!=0)A.width(A[0].width),A.height(A[0].height);else{var C=new Image;C.src=A[0].src,A.width(C.width),A.height(C.height)}var D=A.clone().removeAttr("id"). +css(z).show();D.width(A.width()),D.height(A.height()),A.after(D).hide()}else D=A.css(z).show(),B=!1,d.shade===null&&(d.shade=!0);t(D,d.boxWidth,d.boxHeight);var E=D.width(),F=D.height(),G=a("
").width(E).height(F).addClass(j("holder")).css({position:"relative",backgroundColor:d.bgColor}).insertAfter(A).append(D);d.addClass&&G.addClass(d.addClass);var H=a("
"),I=a("
").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}),J=a("
").width("100%").height("100%").css("zIndex",320),K=a("
").css({position:"absolute",zIndex:600}).dblclick(function(){var a=_.getFixed();d.onDblClick.call(bs,a)}).insertBefore(D).append(I,J);B&&(H=a("").attr("src",D.attr("src")).css(z).width(E).height(F),I.append(H)),h&&K.css({overflowY:"hidden"});var L=d.boundary,M=y().width(E+L*2).height(F+L*2).css({position:"absolute",top:i(-L),left:i(-L),zIndex:290}).mousedown(w),N=d.bgColor,O=d.bgOpacity,P,Q,R,S,T,U,V=!0,W,X,Y;e=l(D);var Z=function(){function a(){var a={},b=["touchstart" +,"touchmove","touchend"],c=document.createElement("div"),d;try{for(d=0;da+f&&(f-=f+a),0>b+g&&(g-=g+b),FE&&(r=E,u=Math.abs((r-a)/f),s=k<0?b-u:u+b)):(r=c,u=l/f,s=k<0?b-u:b+u,s<0?(s=0,t=Math.abs((s-b)*f),r=j<0?a-t:t+a):s>F&&(s=F,t=Math.abs(s-b)*f,r=j<0?a-t:t+a)),r>a?(r-ah&&(r=a+h),s>b?s=b+(r-a)/f:s=b-(r-a)/f):rh&&(r=a-h),s>b?s=b+(a-r)/f:s=b-(a-r)/f),r<0?(a-=r,r=0):r>E&&(a-=r-E,r=E),s<0?(b-=s,s=0):s>F&&(b-=s-F,s=F),q(o(a,b,r,s))}function n(a){return a[0]<0&&(a[0]=0),a[1]<0&&(a[1]=0),a[0]>E&&(a[0]=E),a[1]>F&&(a[1]=F),[Math.round(a[0]),Math.round(a[1])]}function o(a,b,c,d){var e=a,f=c,g=b,h=d;return cP&&(c=d>0?a+P:a-P),Q&&Math.abs +(f)>Q&&(e=f>0?b+Q:b-Q),S/U&&Math.abs(f)0?b+S/U:b-S/U),R/T&&Math.abs(d)0?a+R/T:a-R/T),a<0&&(c-=a,a-=a),b<0&&(e-=b,b-=b),c<0&&(a-=c,c-=c),e<0&&(b-=e,e-=e),c>E&&(g=c-E,a-=g,c-=g),e>F&&(g=e-F,b-=g,e-=g),a>E&&(g=a-F,e-=g,b-=g),b>F&&(g=b-F,e-=g,b-=g),q(o(a,b,c,e))}function q(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]}}var a=0,b=0,c=0,e=0,f,g;return{flipCoords:o,setPressed:h,setCurrent:i,getOffset:j,moveOffset:k,getCorner:l,getFixed:m}}(),ba=function(){function f(a,b){e.left.css({height:i(b)}),e.right.css({height:i(b)})}function g(){return h(_.getFixed())}function h(a){e.top.css({left:i(a.x),width:i(a.w),height:i(a.y)}),e.bottom.css({top:i(a.y2),left:i(a.x),width:i(a.w),height:i(F-a.y2)}),e.right.css({left:i(a.x2),width:i(E-a.x2)}),e.left.css({width:i(a.x)})}function j(){return a("
").css({position:"absolute",backgroundColor:d.shadeColor||d.bgColor}).appendTo(c)}function k(){b||(b=!0,c.insertBefore(D),g(),bb.setBgOpacity(1,0,1),H.hide(),l(d.shadeColor||d.bgColor,1),bb. +isAwake()?n(d.bgOpacity,1):n(1,1))}function l(a,b){bq(p(),a,b)}function m(){b&&(c.remove(),H.show(),b=!1,bb.isAwake()?bb.setBgOpacity(d.bgOpacity,1,1):(bb.setBgOpacity(1,1,1),bb.disableHandles()),bq(G,0,1))}function n(a,e){b&&(d.bgFade&&!e?c.animate({opacity:1-a},{queue:!1,duration:d.fadeTime}):c.css({opacity:1-a}))}function o(){d.shade?k():m(),bb.isAwake()&&n(d.bgOpacity)}function p(){return c.children()}var b=!1,c=a("
").css({position:"absolute",zIndex:240,opacity:0}),e={top:j(),left:j().height(F),right:j().height(F),bottom:j()};return{update:g,updateRaw:h,getShades:p,setBgColor:l,enable:k,disable:m,resize:f,refresh:o,opacity:n}}(),bb=function(){function k(b){var c=a("
").css({position:"absolute",opacity:d.borderOpacity}).addClass(j(b));return I.append(c),c}function l(b,c){var d=a("
").mousedown(s(b)).css({cursor:b+"-resize",position:"absolute",zIndex:c}).addClass("ord-"+b);return Z.support&&d.bind("touchstart.jcrop",Z.createDragger(b)),J.append(d),d}function m(a){var b=d.handleSize,e=l(a,c++ +).css({opacity:d.handleOpacity}).addClass(j("handle"));return b&&e.width(b).height(b),e}function n(a){return l(a,c++).addClass("jcrop-dragbar")}function o(a){var b;for(b=0;b').css({position:"fixed",left:"-120px",width:"12px"}).addClass("jcrop-keymgr"),c=a("
").css({position:"absolute",overflow:"hidden"}).append(b);return d.keySupport&&(b.keydown(i).blur(f),h||!d.fixedSupport?(b.css({position:"absolute",left:"-20px"}),c.append(b).insertBefore(D)):b.insertBefore(D)),{watchKeys:e}}();Z.support&&M.bind("touchstart.jcrop",Z.newSelection),J.hide(),br(!0);var bs={setImage:bp,animateTo:bf,setSelect:bg,setOptions:bk,tellSelect:bi,tellScaled:bj,setClass:be,disable:bl,enable:bm,cancel:bn,release:bb.release,destroy:bo,focus:bd.watchKeys,getBounds:function(){return[E*T,F*U]},getWidgetSize:function(){return[E,F]},getScaleFactor:function(){return[T,U]},getOptions:function(){return d},ui:{holder:G,selection:K}};return g&&G.bind("selectstart",function(){return!1}),A.data("Jcrop",bs),bs},a.fn.Jcrop=function(b,c){var d;return this.each(function(){if(a(this).data("Jcrop")){if( +b==="api")return a(this).data("Jcrop");a(this).data("Jcrop").setOptions(b)}else this.tagName=="IMG"?a.Jcrop.Loader(this,function(){a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d)}):(a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d))}),this},a.Jcrop.Loader=function(b,c,d){function g(){f.complete?(e.unbind(".jcloader"),a.isFunction(c)&&c.call(f)):window.setTimeout(g,50)}var e=a(b),f=e[0];e.bind("load.jcloader",g).bind("error.jcloader",function(b){e.unbind(".jcloader"),a.isFunction(d)&&d.call(f)}),f.complete&&a.isFunction(c)&&(e.unbind(".jcloader"),c.call(f))},a.Jcrop.defaults={allowSelect:!0,allowMove:!0,allowResize:!0,trackDocument:!0,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:.6,bgFade:!1,borderOpacity:.4,handleOpacity:.5,handleSize:null,aspectRatio:0,keySupport:!0,createHandles:["n","s","e","w","nw","ne","se","sw"],createDragbars:["n","s","e","w"],createBorders:["n","s","e","w"],drawBorders:!0,dragEdges +:!0,fixedSupport:!0,touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}}})(jQuery); \ No newline at end of file diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/load-image.min.js b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image.min.js new file mode 100755 index 0000000..8f04e85 --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/load-image.min.js @@ -0,0 +1 @@ +(function(e){"use strict";var t=function(e,i,a){var n,r,o=document.createElement("img");if(o.onerror=i,o.onload=function(){!r||a&&a.noRevoke||t.revokeObjectURL(r),i&&i(t.scale(o,a))},t.isInstanceOf("Blob",e)||t.isInstanceOf("File",e))n=r=t.createObjectURL(e),o._type=e.type;else{if("string"!=typeof e)return!1;n=e,a&&a.crossOrigin&&(o.crossOrigin=a.crossOrigin)}return n?(o.src=n,o):t.readFile(e,function(e){var t=e.target;t&&t.result?o.src=t.result:i&&i(e)})},i=window.createObjectURL&&window||window.URL&&URL.revokeObjectURL&&URL||window.webkitURL&&webkitURL;t.isInstanceOf=function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},t.transformCoordinates=function(){},t.getTransformedOptions=function(e){return e},t.renderImageToCanvas=function(e,t,i,a,n,r,o,s,d,l){return e.getContext("2d").drawImage(t,i,a,n,r,o,s,d,l),e},t.hasCanvasOption=function(e){return e.canvas||e.crop},t.scale=function(e,i){i=i||{};var a,n,r,o,s,d,l,c,u,g=document.createElement("canvas"),f=e.getContext||t.hasCanvasOption(i)&&g.getContext,h=e.naturalWidth||e.width,m=e.naturalHeight||e.height,p=h,S=m,b=function(){var e=Math.max((r||p)/p,(o||S)/S);e>1&&(p=Math.ceil(p*e),S=Math.ceil(S*e))},v=function(){var e=Math.min((a||p)/p,(n||S)/S);1>e&&(p=Math.ceil(p*e),S=Math.ceil(S*e))};return f&&(i=t.getTransformedOptions(i),l=i.left||0,c=i.top||0,i.sourceWidth?(s=i.sourceWidth,void 0!==i.right&&void 0===i.left&&(l=h-s-i.right)):s=h-l-(i.right||0),i.sourceHeight?(d=i.sourceHeight,void 0!==i.bottom&&void 0===i.top&&(c=m-d-i.bottom)):d=m-c-(i.bottom||0),p=s,S=d),a=i.maxWidth,n=i.maxHeight,r=i.minWidth,o=i.minHeight,f&&a&&n&&i.crop?(p=a,S=n,u=s/d-a/n,0>u?(d=n*s/a,void 0===i.top&&void 0===i.bottom&&(c=(m-d)/2)):u>0&&(s=a*d/n,void 0===i.left&&void 0===i.right&&(l=(h-s)/2))):((i.contain||i.cover)&&(r=a=a||r,o=n=n||o),i.cover?(v(),b()):(b(),v())),f?(g.width=p,g.height=S,t.transformCoordinates(g,i),t.renderImageToCanvas(g,e,l,c,s,d,0,0,p,S)):(e.width=p,e.height=S,e)},t.createObjectURL=function(e){return i?i.createObjectURL(e):!1},t.revokeObjectURL=function(e){return i?i.revokeObjectURL(e):!1},t.readFile=function(e,t,i){if(window.FileReader){var a=new FileReader;if(a.onload=a.onerror=t,i=i||"readAsDataURL",a[i])return a[i](e),a}return!1},"function"==typeof define&&define.amd?define(function(){return t}):e.loadImage=t})(this),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image"],e):e(window.loadImage)}(function(e){"use strict";if(window.navigator&&window.navigator.platform&&/iP(hone|od|ad)/.test(window.navigator.platform)){var t=e.renderImageToCanvas;e.detectSubsampling=function(e){var t,i;return e.width*e.height>1048576?(t=document.createElement("canvas"),t.width=t.height=1,i=t.getContext("2d"),i.drawImage(e,-e.width+1,0),0===i.getImageData(0,0,1,1).data[3]):!1},e.detectVerticalSquash=function(e,t){var i,a,n,r,o,s=e.naturalHeight||e.height,d=document.createElement("canvas"),l=d.getContext("2d");for(t&&(s/=2),d.width=1,d.height=s,l.drawImage(e,0,0),i=l.getImageData(0,0,1,s).data,a=0,n=s,r=s;r>a;)o=i[4*(r-1)+3],0===o?n=r:a=r,r=n+a>>1;return r/s||1},e.renderImageToCanvas=function(i,a,n,r,o,s,d,l,c,u){if("image/jpeg"===a._type){var g,f,h,m,p=i.getContext("2d"),S=document.createElement("canvas"),b=1024,v=S.getContext("2d");if(S.width=b,S.height=b,p.save(),g=e.detectSubsampling(a),g&&(n/=2,r/=2,o/=2,s/=2),f=e.detectVerticalSquash(a,g),g||1!==f){for(r*=f,c=Math.ceil(b*c/o),u=Math.ceil(b*u/s/f),l=0,m=0;s>m;){for(d=0,h=0;o>h;)v.clearRect(0,0,b,b),v.drawImage(a,n,r,o,s,-h,-m,o,s),p.drawImage(S,0,0,b,b,d,l,c,u),h+=b,d+=c;m+=b,l+=u}return p.restore(),i}}return t(i,a,n,r,o,s,d,l,c,u)}}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image"],e):e(window.loadImage)}(function(e){"use strict";var t=e.hasCanvasOption;e.hasCanvasOption=function(e){return t(e)||e.orientation},e.transformCoordinates=function(e,t){var i=e.getContext("2d"),a=e.width,n=e.height,r=t.orientation;if(r)switch(r>4&&(e.width=n,e.height=a),r){case 2:i.translate(a,0),i.scale(-1,1);break;case 3:i.translate(a,n),i.rotate(Math.PI);break;case 4:i.translate(0,n),i.scale(1,-1);break;case 5:i.rotate(.5*Math.PI),i.scale(1,-1);break;case 6:i.rotate(.5*Math.PI),i.translate(0,-n);break;case 7:i.rotate(.5*Math.PI),i.translate(a,-n),i.scale(-1,1);break;case 8:i.rotate(-.5*Math.PI),i.translate(-a,0)}},e.getTransformedOptions=function(e){if(!e.orientation||1===e.orientation)return e;var t,i={};for(t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);switch(e.orientation){case 2:i.left=e.right,i.right=e.left;break;case 3:i.left=e.right,i.top=e.bottom,i.right=e.left,i.bottom=e.top;break;case 4:i.top=e.bottom,i.bottom=e.top;break;case 5:i.left=e.top,i.top=e.left,i.right=e.bottom,i.bottom=e.right;break;case 6:i.left=e.top,i.top=e.right,i.right=e.bottom,i.bottom=e.left;break;case 7:i.left=e.bottom,i.top=e.right,i.right=e.top,i.bottom=e.left;break;case 8:i.left=e.bottom,i.top=e.left,i.right=e.top,i.bottom=e.right}return e.orientation>4&&(i.maxWidth=e.maxHeight,i.maxHeight=e.maxWidth,i.minWidth=e.minHeight,i.minHeight=e.minWidth,i.sourceWidth=e.sourceHeight,i.sourceHeight=e.sourceWidth),i}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image"],e):e(window.loadImage)}(function(e){"use strict";var t=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);e.blobSlice=t&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},e.metaDataParsers={jpeg:{65505:[]}},e.parseMetaData=function(t,i,a){a=a||{};var n=this,r=a.maxMetaDataSize||262144,o={},s=!(window.DataView&&t&&t.size>=12&&"image/jpeg"===t.type&&e.blobSlice);(s||!e.readFile(e.blobSlice.call(t,0,r),function(t){var r,s,d,l,c=t.target.result,u=new DataView(c),g=2,f=u.byteLength-4,h=g;if(65496===u.getUint16(0)){for(;f>g&&(r=u.getUint16(g),r>=65504&&65519>=r||65534===r);){if(s=u.getUint16(g+2)+2,g+s>u.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(d=e.metaDataParsers.jpeg[r])for(l=0;d.length>l;l+=1)d[l].call(n,u,g,s,o,a);g+=s,h=g}!a.disableImageHead&&h>6&&(o.imageHead=c.slice?c.slice(0,h):new Uint8Array(c).subarray(0,h))}else console.log("Invalid JPEG file: Missing JPEG marker.");i(o)},"readAsArrayBuffer"))&&i(o)}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-meta"],e):e(window.loadImage)}(function(e){"use strict";e.ExifMap=function(){return this},e.ExifMap.prototype.map={Orientation:274},e.ExifMap.prototype.get=function(e){return this[e]||this[this.map[e]]},e.getExifThumbnail=function(e,t,i){var a,n,r;if(!i||t+i>e.byteLength)return console.log("Invalid Exif data: Invalid thumbnail data."),void 0;for(a=[],n=0;i>n;n+=1)r=e.getUint8(t+n),a.push((16>r?"0":"")+r.toString(16));return"data:image/jpeg,%"+a.join("%")},e.exifTagTypes={1:{getValue:function(e,t){return e.getUint8(t)},size:1},2:{getValue:function(e,t){return String.fromCharCode(e.getUint8(t))},size:1,ascii:!0},3:{getValue:function(e,t,i){return e.getUint16(t,i)},size:2},4:{getValue:function(e,t,i){return e.getUint32(t,i)},size:4},5:{getValue:function(e,t,i){return e.getUint32(t,i)/e.getUint32(t+4,i)},size:8},9:{getValue:function(e,t,i){return e.getInt32(t,i)},size:4},10:{getValue:function(e,t,i){return e.getInt32(t,i)/e.getInt32(t+4,i)},size:8}},e.exifTagTypes[7]=e.exifTagTypes[1],e.getExifValue=function(t,i,a,n,r,o){var s,d,l,c,u,g,f=e.exifTagTypes[n];if(!f)return console.log("Invalid Exif data: Invalid tag type."),void 0;if(s=f.size*r,d=s>4?i+t.getUint32(a+8,o):a+8,d+s>t.byteLength)return console.log("Invalid Exif data: Invalid data offset."),void 0;if(1===r)return f.getValue(t,d,o);for(l=[],c=0;r>c;c+=1)l[c]=f.getValue(t,d+c*f.size,o);if(f.ascii){for(u="",c=0;l.length>c&&(g=l[c],"\0"!==g);c+=1)u+=g;return u}return l},e.parseExifTag=function(t,i,a,n,r){var o=t.getUint16(a,n);r.exif[o]=e.getExifValue(t,i,a,t.getUint16(a+2,n),t.getUint32(a+4,n),n)},e.parseExifTags=function(e,t,i,a,n){var r,o,s;if(i+6>e.byteLength)return console.log("Invalid Exif data: Invalid directory offset."),void 0;if(r=e.getUint16(i,a),o=i+2+12*r,o+4>e.byteLength)return console.log("Invalid Exif data: Invalid directory size."),void 0;for(s=0;r>s;s+=1)this.parseExifTag(e,t,i+2+12*s,a,n);return e.getUint32(o,a)},e.parseExifData=function(t,i,a,n,r){if(!r.disableExif){var o,s,d,l=i+10;if(1165519206===t.getUint32(i+4)){if(l+8>t.byteLength)return console.log("Invalid Exif data: Invalid segment size."),void 0;if(0!==t.getUint16(i+8))return console.log("Invalid Exif data: Missing byte alignment offset."),void 0;switch(t.getUint16(l)){case 18761:o=!0;break;case 19789:o=!1;break;default:return console.log("Invalid Exif data: Invalid byte alignment marker."),void 0}if(42!==t.getUint16(l+2,o))return console.log("Invalid Exif data: Missing TIFF marker."),void 0;s=t.getUint32(l+4,o),n.exif=new e.ExifMap,s=e.parseExifTags(t,l,l+s,o,n),s&&!r.disableExifThumbnail&&(d={exif:{}},s=e.parseExifTags(t,l,l+s,o,d),d.exif[513]&&(n.exif.Thumbnail=e.getExifThumbnail(t,l+d.exif[513],d.exif[514]))),n.exif[34665]&&!r.disableExifSub&&e.parseExifTags(t,l,l+n.exif[34665],o,n),n.exif[34853]&&!r.disableExifGps&&e.parseExifTags(t,l,l+n.exif[34853],o,n)}}},e.metaDataParsers.jpeg[65505].push(e.parseExifData)}),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-exif"],e):e(window.loadImage)}(function(e){"use strict";var t,i,a;e.ExifMap.prototype.tags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",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",272:"Model",305:"Software",315:"Artist",33432:"Copyright",36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",42240:"Gamma",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:"PhotographicSensitivity",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",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",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",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",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},e.ExifMap.prototype.stringValues={ExposureProgram:{0:"Undefined",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",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",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",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"},SensingMethod:{1:"Undefined",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",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"},ComponentsConfiguration:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"},Orientation:{1:"top-left",2:"top-right",3:"bottom-right",4:"bottom-left",5:"left-top",6:"right-top",7:"right-bottom",8:"left-bottom"}},e.ExifMap.prototype.getText=function(e){var t=this.get(e);switch(e){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":case"Orientation":return this.stringValues[e][t];case"ExifVersion":case"FlashpixVersion":return String.fromCharCode(t[0],t[1],t[2],t[3]);case"ComponentsConfiguration":return this.stringValues[e][t[0]]+this.stringValues[e][t[1]]+this.stringValues[e][t[2]]+this.stringValues[e][t[3]];case"GPSVersionID":return t[0]+"."+t[1]+"."+t[2]+"."+t[3]}return t+""},t=e.ExifMap.prototype.tags,i=e.ExifMap.prototype.map;for(a in t)t.hasOwnProperty(a)&&(i[t[a]]=a);e.ExifMap.prototype.getAll=function(){var e,i,a={};for(e in this)this.hasOwnProperty(e)&&(i=t[e],i&&(a[i]=this.getText(i)));return a}}); \ No newline at end of file diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js b/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js deleted file mode 100755 index bb3d4cd..0000000 --- a/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * JavaScript Templates 2.4.0 - * https://github.com/blueimp/JavaScript-Templates - * - * Copyright 2011, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - * - * Inspired by John Resig's JavaScript Micro-Templating: - * http://ejohn.org/blog/javascript-micro-templating/ - */ - -/*jslint evil: true, regexp: true, unparam: true */ -/*global document, define */ - -(function ($) { - "use strict"; - var tmpl = function (str, data) { - var f = !/[^\w\-\.:]/.test(str) ? tmpl.cache[str] = tmpl.cache[str] || - tmpl(tmpl.load(str)) : - new Function( - tmpl.arg + ',tmpl', - "var _e=tmpl.encode" + tmpl.helper + ",_s='" + - str.replace(tmpl.regexp, tmpl.func) + - "';return _s;" - ); - return data ? f(data, tmpl) : function (data) { - return f(data, tmpl); - }; - }; - tmpl.cache = {}; - tmpl.load = function (id) { - return document.getElementById(id).innerHTML; - }; - tmpl.regexp = /([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g; - tmpl.func = function (s, p1, p2, p3, p4, p5) { - if (p1) { // whitespace, quote and backspace in HTML context - return { - "\n": "\\n", - "\r": "\\r", - "\t": "\\t", - " " : " " - }[p1] || "\\" + p1; - } - if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%} - if (p2 === "=") { - return "'+_e(" + p3 + ")+'"; - } - return "'+(" + p3 + "==null?'':" + p3 + ")+'"; - } - if (p4) { // evaluation start tag: {% - return "';"; - } - if (p5) { // evaluation end tag: %} - return "_s+='"; - } - }; - tmpl.encReg = /[<>&"'\x00]/g; - tmpl.encMap = { - "<" : "<", - ">" : ">", - "&" : "&", - "\"" : """, - "'" : "'" - }; - tmpl.encode = function (s) { - return (s == null ? "" : "" + s).replace( - tmpl.encReg, - function (c) { - return tmpl.encMap[c] || ""; - } - ); - }; - tmpl.arg = "o"; - tmpl.helper = ",print=function(s,e){_s+=e?(s==null?'':s):_e(s);}" + - ",include=function(s,d){_s+=tmpl(s,d);}"; - if (typeof define === "function" && define.amd) { - define(function () { - return tmpl; - }); - } else { - $.tmpl = tmpl; - } -}(this)); diff --git a/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.min.js b/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.min.js new file mode 100755 index 0000000..bd82354 --- /dev/null +++ b/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.min.js @@ -0,0 +1 @@ +!function(e){"use strict";var n=function(e,t){var c=/[^\w\-\.:]/.test(e)?new Function(n.arg+",tmpl","var _e=tmpl.encode"+n.helper+",_s='"+e.replace(n.regexp,n.func)+"';return _s;"):n.cache[e]=n.cache[e]||n(n.load(e));return t?c(t,n):function(e){return c(e,n)}};n.cache={},n.load=function(e){return document.getElementById(e).innerHTML},n.regexp=/([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,n.func=function(e,n,t,c,r,u){return n?{"\n":"\\n","\r":"\\r"," ":"\\t"," ":" "}[n]||"\\"+n:t?"="===t?"'+_e("+c+")+'":"'+("+c+"==null?'':"+c+")+'":r?"';":u?"_s+='":void 0},n.encReg=/[<>&"'\x00]/g,n.encMap={"<":"<",">":">","&":"&",'"':""","'":"'"},n.encode=function(e){return(null==e?"":""+e).replace(n.encReg,function(e){return n.encMap[e]||""})},n.arg="o",n.helper=",print=function(s,e){_s+=e?(s==null?'':s):_e(s);},include=function(s,d){_s+=tmpl(s,d);}","function"==typeof define&&define.amd?define(function(){return n}):e.tmpl=n}(this); \ No newline at end of file diff --git a/vendor/assets/stylesheets/vendor/jquery.Jcrop.css b/vendor/assets/stylesheets/vendor/jquery.Jcrop.css deleted file mode 100755 index 95f8b9c..0000000 --- a/vendor/assets/stylesheets/vendor/jquery.Jcrop.css +++ /dev/null @@ -1,165 +0,0 @@ -/* jquery.Jcrop.css v0.9.12 - MIT License */ -/* - The outer-most container in a typical Jcrop instance - If you are having difficulty with formatting related to styles - on a parent element, place any fixes here or in a like selector - - You can also style this element if you want to add a border, etc - A better method for styling can be seen below with .jcrop-light - (Add a class to the holder and style elements for that extended class) -*/ -.jcrop-holder { - direction: ltr; - text-align: left; -} -/* Selection Border */ -.jcrop-vline, -.jcrop-hline { - background: #ffffff url("Jcrop.gif"); - font-size: 0; - position: absolute; -} -.jcrop-vline { - height: 100%; - width: 1px !important; -} -.jcrop-vline.right { - right: 0; -} -.jcrop-hline { - height: 1px !important; - width: 100%; -} -.jcrop-hline.bottom { - bottom: 0; -} -/* Invisible click targets */ -.jcrop-tracker { - height: 100%; - width: 100%; - /* "turn off" link highlight */ - -webkit-tap-highlight-color: transparent; - /* disable callout, image save panel */ - -webkit-touch-callout: none; - /* disable cut copy paste */ - -webkit-user-select: none; -} -/* Selection Handles */ -.jcrop-handle { - background-color: #333333; - border: 1px #eeeeee solid; - width: 7px; - height: 7px; - font-size: 1px; -} -.jcrop-handle.ord-n { - left: 50%; - margin-left: -4px; - margin-top: -4px; - top: 0; -} -.jcrop-handle.ord-s { - bottom: 0; - left: 50%; - margin-bottom: -4px; - margin-left: -4px; -} -.jcrop-handle.ord-e { - margin-right: -4px; - margin-top: -4px; - right: 0; - top: 50%; -} -.jcrop-handle.ord-w { - left: 0; - margin-left: -4px; - margin-top: -4px; - top: 50%; -} -.jcrop-handle.ord-nw { - left: 0; - margin-left: -4px; - margin-top: -4px; - top: 0; -} -.jcrop-handle.ord-ne { - margin-right: -4px; - margin-top: -4px; - right: 0; - top: 0; -} -.jcrop-handle.ord-se { - bottom: 0; - margin-bottom: -4px; - margin-right: -4px; - right: 0; -} -.jcrop-handle.ord-sw { - bottom: 0; - left: 0; - margin-bottom: -4px; - margin-left: -4px; -} -/* Dragbars */ -.jcrop-dragbar.ord-n, -.jcrop-dragbar.ord-s { - height: 7px; - width: 100%; -} -.jcrop-dragbar.ord-e, -.jcrop-dragbar.ord-w { - height: 100%; - width: 7px; -} -.jcrop-dragbar.ord-n { - margin-top: -4px; -} -.jcrop-dragbar.ord-s { - bottom: 0; - margin-bottom: -4px; -} -.jcrop-dragbar.ord-e { - margin-right: -4px; - right: 0; -} -.jcrop-dragbar.ord-w { - margin-left: -4px; -} -/* The "jcrop-light" class/extension */ -.jcrop-light .jcrop-vline, -.jcrop-light .jcrop-hline { - background: #ffffff; - filter: alpha(opacity=70) !important; - opacity: .70!important; -} -.jcrop-light .jcrop-handle { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - background-color: #000000; - border-color: #ffffff; - border-radius: 3px; -} -/* The "jcrop-dark" class/extension */ -.jcrop-dark .jcrop-vline, -.jcrop-dark .jcrop-hline { - background: #000000; - filter: alpha(opacity=70) !important; - opacity: 0.7 !important; -} -.jcrop-dark .jcrop-handle { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - background-color: #ffffff; - border-color: #000000; - border-radius: 3px; -} -/* Simple macro to turn off the antlines */ -.solid-line .jcrop-vline, -.solid-line .jcrop-hline { - background: #ffffff; -} -/* Fix for twitter bootstrap et al. */ -.jcrop-holder img, -img.jcrop-preview { - max-width: none; -} diff --git a/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css b/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css new file mode 100755 index 0000000..edc76b2 --- /dev/null +++ b/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css @@ -0,0 +1,29 @@ +/* jquery.Jcrop.min.css v0.9.12 (build:20130126) */ +.jcrop-holder{direction:ltr;text-align:left;} +.jcrop-vline,.jcrop-hline{background:#FFF url(Jcrop.gif);font-size:0;position:absolute;} +.jcrop-vline{height:100%;width:1px!important;} +.jcrop-vline.right{right:0;} +.jcrop-hline{height:1px!important;width:100%;} +.jcrop-hline.bottom{bottom:0;} +.jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%;} +.jcrop-handle{background-color:#333;border:1px #EEE solid;font-size:1px;height:7px;width:7px;} +.jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;} +.jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;} +.jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;} +.jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;} +.jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;} +.jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;} +.jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;} +.jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;} +.jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;} +.jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;} +.jcrop-dragbar.ord-n{margin-top:-4px;} +.jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;} +.jcrop-dragbar.ord-e{margin-right:-4px;right:0;} +.jcrop-dragbar.ord-w{margin-left:-4px;} +.jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline{background:#FFF;filter:alpha(opacity=70)!important;opacity:.70!important;} +.jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#FFF;border-radius:3px;} +.jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline{background:#000;filter:alpha(opacity=70)!important;opacity:.7!important;} +.jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#FFF;border-color:#000;border-radius:3px;} +.solid-line .jcrop-vline,.solid-line .jcrop-hline{background:#FFF;} +.jcrop-holder img,img.jcrop-preview{max-width:none;} From 4dec778619b7d80dcc0bfb26d4686188a7d0b12b Mon Sep 17 00:00:00 2001 From: Valery Kvon Date: Mon, 14 Oct 2013 16:40:42 +0400 Subject: [PATCH 07/20] scripts updated --- README.md | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 07729ca..79fdb7e 100755 --- a/README.md +++ b/README.md @@ -23,24 +23,28 @@ Require jquery-fileupload in your app/assets/application.js file. The snippet above will add the following js files to the mainfest file. - //=require jquery-fileupload/vendor/jquery.ui.widget - //=require jquery-fileupload/vendor/tmpl - //=require jquery-fileupload/vendor/load-image - //=require jquery-fileupload/vendor/load-image-ios - //=require jquery-fileupload/vendor/load-image-orientation - //=require jquery-fileupload/vendor/load-image-meta - //=require jquery-fileupload/vendor/load-image-exif - //=require jquery-fileupload/vendor/load-image-exif-map - //=require jquery-fileupload/vendor/canvas-to-blob - //=require jquery-fileupload/jquery.iframe-transport - //=require jquery-fileupload/jquery.fileupload - //=require jquery-fileupload/jquery.fileupload-image - //=require jquery-fileupload/jquery.fileupload-process - //=require jquery-fileupload/jquery.fileupload-audio - //=require jquery-fileupload/jquery.fileupload-video - //=require jquery-fileupload/jquery.fileupload-validate - //=require jquery-fileupload/jquery.fileupload-ui - //=require jquery-fileupload/locale + //= require jquery-fileupload/vendor/jquery.ui.widget + //= require jquery-fileupload/vendor/tmpl.min + //= require jquery-fileupload/vendor/load-image.min + //= require jquery-fileupload/vendor/load-image-ios + //= require jquery-fileupload/vendor/load-image-orientation + //= require jquery-fileupload/vendor/load-image-meta + //= require jquery-fileupload/vendor/load-image-exif + //= require jquery-fileupload/vendor/load-image-exif-map + //= require jquery-fileupload/vendor/canvas-to-blob.min + //= require jquery-fileupload/jquery.iframe-transport + //= require jquery-fileupload/jquery.fileupload + //= require jquery-fileupload/jquery.fileupload-process + //= require jquery-fileupload/jquery.fileupload-image + //= require jquery-fileupload/jquery.fileupload-audio + //= require jquery-fileupload/jquery.fileupload-video + //= require jquery-fileupload/jquery.fileupload-validate + //= require jquery-fileupload/jquery.fileupload-ui + //= require jquery-fileupload/locale + +To add [Jcrop](https://github.com/tapmodo/Jcrop) scripts: + + //= require jquery-fileupload/vendor/jquery.Jcrop.min If you only need the basic files, just add the code below to your application.js file. [Basic setup guide](https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin) From b94973b04cdadd1eb5f59069f9b1cd063e08445e Mon Sep 17 00:00:00 2001 From: Valery Kvon Date: Mon, 14 Oct 2013 16:41:42 +0400 Subject: [PATCH 08/20] Jcrop added --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 79fdb7e..948e4ff 100755 --- a/README.md +++ b/README.md @@ -23,24 +23,24 @@ Require jquery-fileupload in your app/assets/application.js file. The snippet above will add the following js files to the mainfest file. - //= require jquery-fileupload/vendor/jquery.ui.widget - //= require jquery-fileupload/vendor/tmpl.min - //= require jquery-fileupload/vendor/load-image.min - //= require jquery-fileupload/vendor/load-image-ios - //= require jquery-fileupload/vendor/load-image-orientation - //= require jquery-fileupload/vendor/load-image-meta - //= require jquery-fileupload/vendor/load-image-exif - //= require jquery-fileupload/vendor/load-image-exif-map - //= require jquery-fileupload/vendor/canvas-to-blob.min - //= require jquery-fileupload/jquery.iframe-transport - //= require jquery-fileupload/jquery.fileupload - //= require jquery-fileupload/jquery.fileupload-process - //= require jquery-fileupload/jquery.fileupload-image - //= require jquery-fileupload/jquery.fileupload-audio - //= require jquery-fileupload/jquery.fileupload-video - //= require jquery-fileupload/jquery.fileupload-validate - //= require jquery-fileupload/jquery.fileupload-ui - //= require jquery-fileupload/locale + //= require jquery-fileupload/vendor/jquery.ui.widget + //= require jquery-fileupload/vendor/tmpl.min + //= require jquery-fileupload/vendor/load-image.min + //= require jquery-fileupload/vendor/load-image-ios + //= require jquery-fileupload/vendor/load-image-orientation + //= require jquery-fileupload/vendor/load-image-meta + //= require jquery-fileupload/vendor/load-image-exif + //= require jquery-fileupload/vendor/load-image-exif-map + //= require jquery-fileupload/vendor/canvas-to-blob.min + //= require jquery-fileupload/jquery.iframe-transport + //= require jquery-fileupload/jquery.fileupload + //= require jquery-fileupload/jquery.fileupload-process + //= require jquery-fileupload/jquery.fileupload-image + //= require jquery-fileupload/jquery.fileupload-audio + //= require jquery-fileupload/jquery.fileupload-video + //= require jquery-fileupload/jquery.fileupload-validate + //= require jquery-fileupload/jquery.fileupload-ui + //= require jquery-fileupload/locale To add [Jcrop](https://github.com/tapmodo/Jcrop) scripts: From cbd4929dfc1e3f6681d7adf79d86be16fc9355e7 Mon Sep 17 00:00:00 2001 From: Valery Kvon Date: Mon, 14 Oct 2013 16:43:44 +0400 Subject: [PATCH 09/20] Jcrop added --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 948e4ff..fcd261c 100755 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ jquery-fileupload-rails is a library that integrates jQuery File Upload for Rail * jQuery File Upload Plugin 5.32.6 * jQuery UI Widget 1.10.3+amd * JavaScript Load Image 1.9.0 +* Jcrop v0.9.12 (build:20130202) (optional) ## Installing Gem @@ -62,6 +63,10 @@ Require the stylesheet file to app/assets/stylesheets/application.css *= require jquery.fileupload-ui +[Jcrop](https://github.com/tapmodo/Jcrop) stylesheet + + *= require vendor/jquery.Jcrop.min + ## Using the middleware The `jquery.iframe-transport` fallback transport has some special caveats regarding the response data type, http status, and character encodings. `jquery-fileupload-rails` includes a middleware that handles these inconsistencies seamlessly. If you decide to use it, create an initializer that adds the middleware to your application's middleware stack. From 745b9489020815fdf2275f2696fadac13295e104 Mon Sep 17 00:00:00 2001 From: Valery Kvon Date: Mon, 14 Oct 2013 17:29:25 +0400 Subject: [PATCH 10/20] example added --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fcd261c..cc7054b 100755 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ jquery-fileupload-rails is a library that integrates jQuery File Upload for Rail ## Installing Gem - gem "jquery-fileupload-rails" + gem "jquery-fileupload-rails", :github => 'addagger/jquery-fileupload-rails' ## Using the javascripts @@ -73,8 +73,8 @@ The `jquery.iframe-transport` fallback transport has some special caveats regard Rails.application.config.middleware.use JQuery::FileUpload::Rails::Middleware -## [Example app](https://github.com/tors/jquery-fileupload-rails-paperclip-example) -This app uses paperclip and twitter-bootstrap-rails +## [Example app](https://github.com/addagger/jquery-fileupload-rails-example) +This app uses paperclip and [anjlab-bootstrap-rails](https://github.com/anjlab/bootstrap-rails) You can also check out Ryan Bate's RailsCast [jQuery File Upload episode](http://railscasts.com/episodes/381-jquery-file-upload). You will need a pro account to watch it though. From 42c4ba6066bb783bd33fdb9d3cb078c1562ba432 Mon Sep 17 00:00:00 2001 From: macintosh Date: Wed, 3 Sep 2014 19:50:07 +0400 Subject: [PATCH 11/20] jquery-fileupload-rails pipelined --- .../stylesheets/jquery.fileupload-ui.css | 52 ------------------- .../stylesheets/vendor/jquery.Jcrop.min.css | 29 ----------- 2 files changed, 81 deletions(-) delete mode 100755 vendor/assets/stylesheets/jquery.fileupload-ui.css delete mode 100755 vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css diff --git a/vendor/assets/stylesheets/jquery.fileupload-ui.css b/vendor/assets/stylesheets/jquery.fileupload-ui.css deleted file mode 100755 index 2f8f121..0000000 --- a/vendor/assets/stylesheets/jquery.fileupload-ui.css +++ /dev/null @@ -1,52 +0,0 @@ -@charset "UTF-8"; -/* - * jQuery File Upload UI Plugin CSS 8.8.5 - * https://github.com/blueimp/jQuery-File-Upload - * - * Copyright 2010, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - */ - -.fileupload-buttonbar .btn, -.fileupload-buttonbar .toggle { - margin-bottom: 5px; -} -.progress-animated .progress-bar, -.progress-animated .bar { - background: url("progressbar.gif") !important; - filter: none; -} -.fileupload-loading { - float: right; - width: 32px; - height: 32px; - background: url("loading.gif") center no-repeat; - background-size: contain; - display: none; -} -.fileupload-processing .fileupload-loading { - display: block; -} -.files audio, -.files video { - max-width: 300px; -} - -@media (max-width: 767px) { - .fileupload-buttonbar .toggle, - .files .toggle, - .files .btn span { - display: none; - } - .files .name { - width: 80px; - word-wrap: break-word; - } - .files audio, - .files video { - max-width: 80px; - } -} diff --git a/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css b/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css deleted file mode 100755 index edc76b2..0000000 --- a/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css +++ /dev/null @@ -1,29 +0,0 @@ -/* jquery.Jcrop.min.css v0.9.12 (build:20130126) */ -.jcrop-holder{direction:ltr;text-align:left;} -.jcrop-vline,.jcrop-hline{background:#FFF url(Jcrop.gif);font-size:0;position:absolute;} -.jcrop-vline{height:100%;width:1px!important;} -.jcrop-vline.right{right:0;} -.jcrop-hline{height:1px!important;width:100%;} -.jcrop-hline.bottom{bottom:0;} -.jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%;} -.jcrop-handle{background-color:#333;border:1px #EEE solid;font-size:1px;height:7px;width:7px;} -.jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;} -.jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;} -.jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;} -.jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;} -.jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;} -.jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;} -.jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;} -.jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;} -.jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;} -.jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;} -.jcrop-dragbar.ord-n{margin-top:-4px;} -.jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;} -.jcrop-dragbar.ord-e{margin-right:-4px;right:0;} -.jcrop-dragbar.ord-w{margin-left:-4px;} -.jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline{background:#FFF;filter:alpha(opacity=70)!important;opacity:.70!important;} -.jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#FFF;border-radius:3px;} -.jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline{background:#000;filter:alpha(opacity=70)!important;opacity:.7!important;} -.jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#FFF;border-color:#000;border-radius:3px;} -.solid-line .jcrop-vline,.solid-line .jcrop-hline{background:#FFF;} -.jcrop-holder img,img.jcrop-preview{max-width:none;} From 445f53d44fb3304233a3f2a9648adbf54192a42b Mon Sep 17 00:00:00 2001 From: macintosh Date: Wed, 3 Sep 2014 20:07:53 +0400 Subject: [PATCH 12/20] jquery-fileupload-rails pipelined --- .../stylesheets/jquery.fileupload-ui.css.erb | 52 +++++++++++++++++++ .../vendor/jquery.Jcrop.min.css.erb | 29 +++++++++++ 2 files changed, 81 insertions(+) create mode 100755 vendor/assets/stylesheets/jquery.fileupload-ui.css.erb create mode 100755 vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.erb diff --git a/vendor/assets/stylesheets/jquery.fileupload-ui.css.erb b/vendor/assets/stylesheets/jquery.fileupload-ui.css.erb new file mode 100755 index 0000000..26d84c9 --- /dev/null +++ b/vendor/assets/stylesheets/jquery.fileupload-ui.css.erb @@ -0,0 +1,52 @@ +@charset "UTF-8"; +/* + * jQuery File Upload UI Plugin CSS 8.8.5 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +.fileupload-buttonbar .btn, +.fileupload-buttonbar .toggle { + margin-bottom: 5px; +} +.progress-animated .progress-bar, +.progress-animated .bar { + background: url(<%= asset_path 'progressbar.gif' %>) !important; + filter: none; +} +.fileupload-loading { + float: right; + width: 32px; + height: 32px; + background: url(<%= asset_path 'loading.gif' %>) center no-repeat; + background-size: contain; + display: none; +} +.fileupload-processing .fileupload-loading { + display: block; +} +.files audio, +.files video { + max-width: 300px; +} + +@media (max-width: 767px) { + .fileupload-buttonbar .toggle, + .files .toggle, + .files .btn span { + display: none; + } + .files .name { + width: 80px; + word-wrap: break-word; + } + .files audio, + .files video { + max-width: 80px; + } +} diff --git a/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.erb b/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.erb new file mode 100755 index 0000000..8f6dbe4 --- /dev/null +++ b/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.erb @@ -0,0 +1,29 @@ +/* jquery.Jcrop.min.css v0.9.12 (build:20130126) */ +.jcrop-holder{direction:ltr;text-align:left;} +.jcrop-vline,.jcrop-hline{background:#FFF url(<%= asset_path 'Jcrop.gif' %>);font-size:0;position:absolute;} +.jcrop-vline{height:100%;width:1px!important;} +.jcrop-vline.right{right:0;} +.jcrop-hline{height:1px!important;width:100%;} +.jcrop-hline.bottom{bottom:0;} +.jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%;} +.jcrop-handle{background-color:#333;border:1px #EEE solid;font-size:1px;height:7px;width:7px;} +.jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;} +.jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;} +.jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;} +.jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;} +.jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;} +.jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;} +.jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;} +.jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;} +.jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;} +.jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;} +.jcrop-dragbar.ord-n{margin-top:-4px;} +.jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;} +.jcrop-dragbar.ord-e{margin-right:-4px;right:0;} +.jcrop-dragbar.ord-w{margin-left:-4px;} +.jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline{background:#FFF;filter:alpha(opacity=70)!important;opacity:.70!important;} +.jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#FFF;border-radius:3px;} +.jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline{background:#000;filter:alpha(opacity=70)!important;opacity:.7!important;} +.jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#FFF;border-color:#000;border-radius:3px;} +.solid-line .jcrop-vline,.solid-line .jcrop-hline{background:#FFF;} +.jcrop-holder img,img.jcrop-preview{max-width:none;} From 3dff9bc33bbe33ad0a615c6371fc5571d089d1ec Mon Sep 17 00:00:00 2001 From: macintosh Date: Wed, 3 Sep 2014 20:11:38 +0400 Subject: [PATCH 13/20] jquery-fileupload-rails pipelined --- lib/jquery/fileupload/rails/engine.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/jquery/fileupload/rails/engine.rb b/lib/jquery/fileupload/rails/engine.rb index b7791d9..760b03b 100755 --- a/lib/jquery/fileupload/rails/engine.rb +++ b/lib/jquery/fileupload/rails/engine.rb @@ -2,6 +2,7 @@ module JQuery module FileUpload module Rails class Engine < ::Rails::Engine + Rails.application.config.assets.precompile += %w( progressbar.gif loading.gif Jcrop.gif ) end end end From a155f3135b86b5c39946e301df491f0b11749a38 Mon Sep 17 00:00:00 2001 From: macintosh Date: Wed, 3 Sep 2014 20:13:13 +0400 Subject: [PATCH 14/20] jquery-fileupload-rails pipelined --- lib/jquery/fileupload/rails/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jquery/fileupload/rails/engine.rb b/lib/jquery/fileupload/rails/engine.rb index 760b03b..2a5395d 100755 --- a/lib/jquery/fileupload/rails/engine.rb +++ b/lib/jquery/fileupload/rails/engine.rb @@ -2,7 +2,7 @@ module JQuery module FileUpload module Rails class Engine < ::Rails::Engine - Rails.application.config.assets.precompile += %w( progressbar.gif loading.gif Jcrop.gif ) + config.assets.precompile += %w( progressbar.gif loading.gif Jcrop.gif ) end end end From b5c1923a60e4547d55498604b42848936ed7673d Mon Sep 17 00:00:00 2001 From: macintosh Date: Wed, 3 Sep 2014 20:17:34 +0400 Subject: [PATCH 15/20] jquery-fileupload-rails pipelined --- vendor/assets/stylesheets/vendor/Jcrop.gif | Bin 329 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 vendor/assets/stylesheets/vendor/Jcrop.gif diff --git a/vendor/assets/stylesheets/vendor/Jcrop.gif b/vendor/assets/stylesheets/vendor/Jcrop.gif deleted file mode 100755 index 72ea7ccb5321d5384d70437cfaac73011237901e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 329 zcmZ?wbhEHb9b#5NV>2k zBC~b@b~P=nNfWAe-b%_i6tS^-1y(h@EsB~1TqDA_h@fkxG$bHgvj}VxE1JLgr!*!^ ILUxTc0Q$^Q5C8xG From 213c6c0ecee2cac51d60f195240e145b3cec02dd Mon Sep 17 00:00:00 2001 From: macintosh Date: Wed, 3 Sep 2014 20:17:43 +0400 Subject: [PATCH 16/20] jquery-fileupload-rails pipelined --- vendor/assets/images/Jcrop.gif | Bin 0 -> 329 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 vendor/assets/images/Jcrop.gif diff --git a/vendor/assets/images/Jcrop.gif b/vendor/assets/images/Jcrop.gif new file mode 100755 index 0000000000000000000000000000000000000000..72ea7ccb5321d5384d70437cfaac73011237901e GIT binary patch literal 329 zcmZ?wbhEHb9b#5NV>2k zBC~b@b~P=nNfWAe-b%_i6tS^-1y(h@EsB~1TqDA_h@fkxG$bHgvj}VxE1JLgr!*!^ ILUxTc0Q$^Q5C8xG literal 0 HcmV?d00001 From 096553f58bec3ebf1ac8ebfd546d05d3925b37d5 Mon Sep 17 00:00:00 2001 From: macintosh Date: Wed, 3 Sep 2014 21:05:08 +0400 Subject: [PATCH 17/20] jquery-fileupload-rails pipelined --- ...ry.fileupload-ui.css.erb => jquery.fileupload-ui.css.scss} | 4 ++-- .../{jquery.Jcrop.min.css.erb => jquery.Jcrop.min.css.scss} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename vendor/assets/stylesheets/{jquery.fileupload-ui.css.erb => jquery.fileupload-ui.css.scss} (86%) rename vendor/assets/stylesheets/vendor/{jquery.Jcrop.min.css.erb => jquery.Jcrop.min.css.scss} (94%) diff --git a/vendor/assets/stylesheets/jquery.fileupload-ui.css.erb b/vendor/assets/stylesheets/jquery.fileupload-ui.css.scss similarity index 86% rename from vendor/assets/stylesheets/jquery.fileupload-ui.css.erb rename to vendor/assets/stylesheets/jquery.fileupload-ui.css.scss index 26d84c9..98b69e2 100755 --- a/vendor/assets/stylesheets/jquery.fileupload-ui.css.erb +++ b/vendor/assets/stylesheets/jquery.fileupload-ui.css.scss @@ -16,14 +16,14 @@ } .progress-animated .progress-bar, .progress-animated .bar { - background: url(<%= asset_path 'progressbar.gif' %>) !important; + background: image-url("progressbar.gif") !important; filter: none; } .fileupload-loading { float: right; width: 32px; height: 32px; - background: url(<%= asset_path 'loading.gif' %>) center no-repeat; + background: image-url("loading.gif") center no-repeat; background-size: contain; display: none; } diff --git a/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.erb b/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.scss similarity index 94% rename from vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.erb rename to vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.scss index 8f6dbe4..cda0deb 100755 --- a/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.erb +++ b/vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.scss @@ -1,6 +1,6 @@ /* jquery.Jcrop.min.css v0.9.12 (build:20130126) */ .jcrop-holder{direction:ltr;text-align:left;} -.jcrop-vline,.jcrop-hline{background:#FFF url(<%= asset_path 'Jcrop.gif' %>);font-size:0;position:absolute;} +.jcrop-vline,.jcrop-hline{background:#FFF image-url("Jcrop.gif");font-size:0;position:absolute;} .jcrop-vline{height:100%;width:1px!important;} .jcrop-vline.right{right:0;} .jcrop-hline{height:1px!important;width:100%;} From 4ee380eb989c09f6e523d502ee3776eacca0ab77 Mon Sep 17 00:00:00 2001 From: macintosh Date: Sat, 26 Mar 2016 05:41:01 +0300 Subject: [PATCH 18/20] updated to 9.12.1 && Jcrop 2.0.4 --- README.md | 13 +- lib/jquery/fileupload/rails/version.rb | 2 +- public/cors/postmessage.html | 4 +- public/cors/result.html | 2 +- .../javascripts/jquery-fileupload/basic.js | 1 + .../cors/jquery.postmessage-transport.js | 8 +- .../cors/jquery.xdr-transport.js | 8 +- .../javascripts/jquery-fileupload/index.js | 9 +- .../jquery.fileupload-angular.js | 196 ++--- .../jquery.fileupload-audio.js | 12 +- .../jquery.fileupload-image.js | 100 ++- .../jquery.fileupload-jquery-ui.js | 23 +- .../jquery.fileupload-process.js | 21 +- .../jquery-fileupload/jquery.fileupload-ui.js | 122 ++- .../jquery.fileupload-validate.js | 23 +- .../jquery.fileupload-video.js | 12 +- .../jquery-fileupload/jquery.fileupload.js | 291 +++++-- .../jquery.iframe-transport.js | 36 +- .../vendor/canvas-to-blob.min.js | 3 +- .../vendor/jquery.Jcrop.min.js | 22 - .../vendor/jquery.ui.widget.js | 150 ++-- .../vendor/load-image-exif-map.js | 721 +++++++++--------- .../vendor/load-image-exif.js | 549 ++++++------- .../vendor/load-image-ios.js | 181 ----- .../vendor/load-image-meta.js | 240 +++--- .../vendor/load-image-orientation.js | 298 ++++---- .../jquery-fileupload/vendor/load-image.js | 568 ++++++++------ .../vendor/load-image.min.js | 1 - .../jquery-fileupload/vendor/tmpl.min.js | 3 +- .../stylesheets/jquery.fileupload-ui.css.scss | 17 +- .../vendor/jquery.Jcrop.min.css.scss | 29 - 31 files changed, 1940 insertions(+), 1725 deletions(-) delete mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/jquery.Jcrop.min.js delete mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/load-image-ios.js delete mode 100755 vendor/assets/javascripts/jquery-fileupload/vendor/load-image.min.js delete mode 100755 vendor/assets/stylesheets/vendor/jquery.Jcrop.min.css.scss diff --git a/README.md b/README.md index cc7054b..b25fee2 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# jQuery File Upload for Rails +# jQuery File Upload for Rails (updated at Feb'2016) [jQuery-File-Plugin](https://github.com/blueimp/jQuery-File-Upload) is a file upload plugin written by [Sebastian Tschan](https://github.com/blueimp). jQuery File Upload features multiple file selection, drag&drop support, progress bars and preview images for jQuery. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. @@ -6,11 +6,8 @@ jquery-fileupload-rails is a library that integrates jQuery File Upload for Rail ## Plugin versions -* jQuery File Upload User Interface Plugin 8.8.6 -* jQuery File Upload Plugin 5.32.6 -* jQuery UI Widget 1.10.3+amd -* JavaScript Load Image 1.9.0 -* Jcrop v0.9.12 (build:20130202) (optional) +* jQuery File Upload 9.12.1 +* Jcrop v2.0.4 (build:20151117) (optional) ## Installing Gem @@ -45,7 +42,7 @@ The snippet above will add the following js files to the mainfest file. To add [Jcrop](https://github.com/tapmodo/Jcrop) scripts: - //= require jquery-fileupload/vendor/jquery.Jcrop.min + //= require jquery-fileupload/vendor/Jcrop.min If you only need the basic files, just add the code below to your application.js file. [Basic setup guide](https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin) @@ -65,7 +62,7 @@ Require the stylesheet file to app/assets/stylesheets/application.css [Jcrop](https://github.com/tapmodo/Jcrop) stylesheet - *= require vendor/jquery.Jcrop.min + *= require vendor/Jcrop.min ## Using the middleware diff --git a/lib/jquery/fileupload/rails/version.rb b/lib/jquery/fileupload/rails/version.rb index 83e8d80..ef101d0 100755 --- a/lib/jquery/fileupload/rails/version.rb +++ b/lib/jquery/fileupload/rails/version.rb @@ -1,7 +1,7 @@ module JQuery module FileUpload module Rails - VERSION = "1.0.0" + VERSION = "2.0.0" end end end diff --git a/public/cors/postmessage.html b/public/cors/postmessage.html index 3d1448f..fab9d60 100755 --- a/public/cors/postmessage.html +++ b/public/cors/postmessage.html @@ -1,7 +1,7 @@