refinerycms-6hoursdaily-photo-gallery 0.0.4.dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. data/Gemfile +27 -0
  2. data/LICENSE.md +8 -0
  3. data/README.md +224 -0
  4. data/app/assets/images/refinery/photo_gallery/admin/chosen-sprite.png +0 -0
  5. data/app/assets/images/refinery/photo_gallery/admin/icons/album.png +0 -0
  6. data/app/assets/images/refinery/photo_gallery/admin/icons/album_add.png +0 -0
  7. data/app/assets/images/refinery/photo_gallery/admin/icons/album_edit.png +0 -0
  8. data/app/assets/images/refinery/photo_gallery/admin/icons/cog.png +0 -0
  9. data/app/assets/images/refinery/photo_gallery/admin/icons/down.gif +0 -0
  10. data/app/assets/images/refinery/photo_gallery/admin/icons/folder.png +0 -0
  11. data/app/assets/images/refinery/photo_gallery/admin/icons/folder_add.png +0 -0
  12. data/app/assets/images/refinery/photo_gallery/admin/icons/folder_edit.png +0 -0
  13. data/app/assets/images/refinery/photo_gallery/admin/icons/loading.gif +0 -0
  14. data/app/assets/images/refinery/photo_gallery/admin/icons/page_copy.png +0 -0
  15. data/app/assets/images/refinery/photo_gallery/admin/icons/photo.png +0 -0
  16. data/app/assets/images/refinery/photo_gallery/admin/icons/photo_add.png +0 -0
  17. data/app/assets/images/refinery/photo_gallery/admin/icons/photo_edit.png +0 -0
  18. data/app/assets/images/refinery/photo_gallery/admin/icons/up.gif +0 -0
  19. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/backgrounds.gif +0 -0
  20. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/buttons-disabled.png +0 -0
  21. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/buttons.png +0 -0
  22. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/delete.gif +0 -0
  23. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/done.gif +0 -0
  24. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/error.gif +0 -0
  25. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/throbber.gif +0 -0
  26. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/transp50.png +0 -0
  27. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.ui.plupload/plupload-bw.png +0 -0
  28. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.ui.plupload/plupload.png +0 -0
  29. data/app/assets/images/refinery/photo_gallery/admin/rss-feed.png +0 -0
  30. data/app/assets/images/refinery/photo_gallery/fancybox/blank.gif +0 -0
  31. data/app/assets/images/refinery/photo_gallery/fancybox/fancybox_loading.gif +0 -0
  32. data/app/assets/images/refinery/photo_gallery/fancybox/fancybox_sprite.png +0 -0
  33. data/app/assets/images/refinery/photo_gallery/fancybox/helpers/fancybox_buttons.png +0 -0
  34. data/app/assets/javascripts/refinery/photo_gallery/admin/jquery.chosen.min.js +10 -0
  35. data/app/assets/javascripts/refinery/photo_gallery/admin/photo_gallery.js +28 -0
  36. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/changelog.txt +218 -0
  37. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/cs.js +14 -0
  38. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/da.js +12 -0
  39. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/de.js +24 -0
  40. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/el.js +14 -0
  41. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/es.js +25 -0
  42. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/et.js +33 -0
  43. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/fi.js +33 -0
  44. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/fr-ca.js +35 -0
  45. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/fr.js +25 -0
  46. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/hr.js +25 -0
  47. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/hu.js +33 -0
  48. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/it.js +24 -0
  49. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ja.js +37 -0
  50. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ko.js +36 -0
  51. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/lv.js +33 -0
  52. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/nl.js +21 -0
  53. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/pl.js +24 -0
  54. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/pt-br.js +35 -0
  55. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ro.js +24 -0
  56. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ru.js +21 -0
  57. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/sk.js +37 -0
  58. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/sr.js +14 -0
  59. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/sv.js +12 -0
  60. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/jquery.plupload.queue.js +195 -0
  61. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/jquery.ui.plupload.js +383 -0
  62. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/license.txt +339 -0
  63. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.browserplus.js +1 -0
  64. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.flash.js +226 -0
  65. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.flash.swf +0 -0
  66. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.full.js +2525 -0
  67. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.full.js.default +2525 -0
  68. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.gears.js +1 -0
  69. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.html4.js +1 -0
  70. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.html5.js +765 -0
  71. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.html5.js.default +765 -0
  72. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.js +618 -0
  73. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.silverlight.js +1 -0
  74. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.silverlight.xap +0 -0
  75. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/readme.md +46 -0
  76. data/app/assets/javascripts/refinery/photo_gallery/fancybox/CHANGELOG.md +68 -0
  77. data/app/assets/javascripts/refinery/photo_gallery/fancybox/README.md +212 -0
  78. data/app/assets/javascripts/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-buttons.js +115 -0
  79. data/app/assets/javascripts/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-media.js +85 -0
  80. data/app/assets/javascripts/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-thumbs.js +157 -0
  81. data/app/assets/javascripts/refinery/photo_gallery/fancybox/jquery.fancybox.js +1463 -0
  82. data/app/assets/javascripts/refinery/photo_gallery/fancybox/jquery.fancybox.pack.js +35 -0
  83. data/app/assets/javascripts/refinery/photo_gallery/fancybox/lib/jquery.mousewheel-3.0.6.pack.js +13 -0
  84. data/app/assets/stylesheets/refinery/photo_gallery/admin/chosen.css.scss +396 -0
  85. data/app/assets/stylesheets/refinery/photo_gallery/admin/photo_gallery.css.scss +109 -0
  86. data/app/assets/stylesheets/refinery/photo_gallery/admin/plupload/jquery.plupload.queue.css.scss +177 -0
  87. data/app/assets/stylesheets/refinery/photo_gallery/admin/plupload/jquery.ui.plupload.css.scss +147 -0
  88. data/app/assets/stylesheets/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-buttons.css.scss +85 -0
  89. data/app/assets/stylesheets/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-thumbs.css +54 -0
  90. data/app/assets/stylesheets/refinery/photo_gallery/fancybox/jquery.fancybox.css.scss +234 -0
  91. data/app/controllers/refinery/photo_gallery/admin/albums_controller.rb +23 -0
  92. data/app/controllers/refinery/photo_gallery/admin/collections_controller.rb +10 -0
  93. data/app/controllers/refinery/photo_gallery/admin/photos_controller.rb +67 -0
  94. data/app/controllers/refinery/photo_gallery/albums_controller.rb +23 -0
  95. data/app/controllers/refinery/photo_gallery/collections_controller.rb +28 -0
  96. data/app/helpers/refinery/photo_gallery/admin/photos_helper.rb +10 -0
  97. data/app/helpers/refinery/photo_gallery/albums_helper.rb +11 -0
  98. data/app/helpers/refinery/photo_gallery/photo_gallery_helper.rb +113 -0
  99. data/app/middleware/refinery/photo_gallery/admin/flash_session_cookie_middleware.rb +27 -0
  100. data/app/models/refinery/photo_gallery/album.rb +63 -0
  101. data/app/models/refinery/photo_gallery/collection.rb +29 -0
  102. data/app/models/refinery/photo_gallery/collection_album.rb +8 -0
  103. data/app/models/refinery/photo_gallery/photo.rb +63 -0
  104. data/app/uploaders/refinery/photo_gallery/admin/file_uploader.rb +122 -0
  105. data/app/views/refinery/photo_gallery/admin/_submenu.html.erb +44 -0
  106. data/app/views/refinery/photo_gallery/admin/albums/_album.html.erb +31 -0
  107. data/app/views/refinery/photo_gallery/admin/albums/_form.html.erb +78 -0
  108. data/app/views/refinery/photo_gallery/admin/albums/_sortable_list.html.erb +7 -0
  109. data/app/views/refinery/photo_gallery/admin/albums/edit.html.erb +2 -0
  110. data/app/views/refinery/photo_gallery/admin/albums/index.html.erb +28 -0
  111. data/app/views/refinery/photo_gallery/admin/albums/new.html.erb +2 -0
  112. data/app/views/refinery/photo_gallery/admin/collections/_collection.html.erb +23 -0
  113. data/app/views/refinery/photo_gallery/admin/collections/_form.html.erb +32 -0
  114. data/app/views/refinery/photo_gallery/admin/collections/_sortable_list.html.erb +7 -0
  115. data/app/views/refinery/photo_gallery/admin/collections/edit.html.erb +2 -0
  116. data/app/views/refinery/photo_gallery/admin/collections/index.html.erb +28 -0
  117. data/app/views/refinery/photo_gallery/admin/collections/new.html.erb +2 -0
  118. data/app/views/refinery/photo_gallery/admin/collections/test.html.erb +39 -0
  119. data/app/views/refinery/photo_gallery/admin/photos/_destroy.js.erb +15 -0
  120. data/app/views/refinery/photo_gallery/admin/photos/_form.html.erb +7 -0
  121. data/app/views/refinery/photo_gallery/admin/photos/_form_actions.html.erb +6 -0
  122. data/app/views/refinery/photo_gallery/admin/photos/_form_fields.html.erb +31 -0
  123. data/app/views/refinery/photo_gallery/admin/photos/_form_fields_actions.html.erb +15 -0
  124. data/app/views/refinery/photo_gallery/admin/photos/edit_multiple.html.erb +9 -0
  125. data/app/views/refinery/photo_gallery/admin/photos/upload.html.erb +87 -0
  126. data/app/views/refinery/photo_gallery/albums/show.html.erb +49 -0
  127. data/app/views/refinery/photo_gallery/collections/index.html.erb +13 -0
  128. data/app/views/refinery/photo_gallery/collections/show.html.erb +33 -0
  129. data/app/views/refinery/photo_gallery/shared/_layout.html.erb +22 -0
  130. data/app/views/refinery/photo_gallery/shared/_submenu.html.erb +5 -0
  131. data/config/initializers/carrierwave.rb +5 -0
  132. data/config/initializers/form_builder.rb +26 -0
  133. data/config/initializers/refinery/core.rb +10 -0
  134. data/config/initializers/s3.rb +11 -0
  135. data/config/initializers/session_store.rb +10 -0
  136. data/config/locales/en.yml +95 -0
  137. data/config/locales/sk.yml +94 -0
  138. data/config/routes.rb +37 -0
  139. data/db/migrate/20120804063842_create_albums.rb +18 -0
  140. data/db/migrate/20120805131321_create_collections.rb +14 -0
  141. data/db/migrate/20120805131547_create_collection_albums.rb +12 -0
  142. data/db/migrate/20120805165238_create_photos.rb +19 -0
  143. data/db/migrate/20120805222125_add_indexes.rb +24 -0
  144. data/db/seeds.rb +21 -0
  145. data/lib/generators/refinery/photo_gallery_generator.rb +25 -0
  146. data/lib/generators/refinery/templates/config/initializers/refinery/photo_gallery.rb.erb +40 -0
  147. data/lib/refinery/photo_gallery/configuration.rb +33 -0
  148. data/lib/refinery/photo_gallery/engine.rb +33 -0
  149. data/lib/refinery/photo_gallery/version.rb +17 -0
  150. data/lib/refinery/photo_gallery.rb +30 -0
  151. data/lib/refinerycms-photo-gallery.rb +1 -0
  152. data/refinerycms-6hoursdaily-photo-gallery.gemspec +38 -0
  153. data/screenshots/01_collections#index.png +0 -0
  154. data/screenshots/02_albums#create.png +0 -0
  155. data/screenshots/03_photos#upload.png +0 -0
  156. data/screenshots/04_photos#upload- chooser.png +0 -0
  157. data/screenshots/05_photo#upoad-queue.png +0 -0
  158. data/screenshots/06_photos#upload-uploading.png +0 -0
  159. data/screenshots/07_photos#upload-uploading_2.png +0 -0
  160. data/screenshots/08_photos#edit_multiple.png +0 -0
  161. data/screenshots/09_albums#index.png +0 -0
  162. data/screenshots/10_albums_EXIF_reading.png +0 -0
  163. data/screenshots/11_frontend_show.png +0 -0
  164. data/screenshots/12_show_photo_using_fancybox.png +0 -0
  165. metadata +353 -0
@@ -0,0 +1,765 @@
1
+ (function (h, k, j, e) {
2
+ var c = {}, g;
3
+
4
+ function m(o, p) {
5
+ var n;
6
+ if ("FileReader" in h) {
7
+ n = new FileReader();
8
+ n.readAsDataURL(o);
9
+ n.onload = function () {
10
+ p(n.result)
11
+ }
12
+ } else {
13
+ return p(o.getAsDataURL())
14
+ }
15
+ }
16
+
17
+ function l(o, p) {
18
+ var n;
19
+ if ("FileReader" in h) {
20
+ n = new FileReader();
21
+ n.readAsBinaryString(o);
22
+ n.onload = function () {
23
+ p(n.result)
24
+ }
25
+ } else {
26
+ return p(o.getAsBinary())
27
+ }
28
+ }
29
+
30
+ function d(r, p, n, v) {
31
+ var q, o, u, s, t = this;
32
+ m(c[r.id], function (w) {
33
+ q = k.createElement("canvas");
34
+ q.style.display = "none";
35
+ k.body.appendChild(q);
36
+ o = q.getContext("2d");
37
+ u = new Image();
38
+ u.onerror = u.onabort = function () {
39
+ v({success:false})
40
+ };
41
+ u.onload = function () {
42
+ var B, x, z, y, A;
43
+ if (!p.width) {
44
+ p.width = u.width
45
+ }
46
+ if (!p.height) {
47
+ p.height = u.height
48
+ }
49
+ s = Math.min(p.width / u.width, p.height / u.height);
50
+ if (s < 1 || (s === 1 && n === "image/jpeg")) {
51
+ B = Math.round(u.width * s);
52
+ x = Math.round(u.height * s);
53
+ q.width = B;
54
+ q.height = x;
55
+ o.drawImage(u, 0, 0, B, x);
56
+ if (n === "image/jpeg") {
57
+ y = new f(atob(w.substring(w.indexOf("base64,") + 7)));
58
+ if (y.headers && y.headers.length) {
59
+ A = new a();
60
+ if (A.init(y.get("exif")[0])) {
61
+ A.setExif("PixelXDimension", B);
62
+ A.setExif("PixelYDimension", x);
63
+ y.set("exif", A.getBinary());
64
+ if (t.hasEventListener("ExifData")) {
65
+ t.trigger("ExifData", r, A.EXIF())
66
+ }
67
+ if (t.hasEventListener("GpsData")) {
68
+ t.trigger("GpsData", r, A.GPS())
69
+ }
70
+ }
71
+ }
72
+ if (p.quality) {
73
+ try {
74
+ w = q.toDataURL(n, p.quality / 100)
75
+ } catch (C) {
76
+ w = q.toDataURL(n)
77
+ }
78
+ }
79
+ } else {
80
+ w = q.toDataURL(n)
81
+ }
82
+ w = w.substring(w.indexOf("base64,") + 7);
83
+ w = atob(w);
84
+ if (y && y.headers && y.headers.length) {
85
+ w = y.restore(w);
86
+ y.purge()
87
+ }
88
+ q.parentNode.removeChild(q);
89
+ v({success:true, data:w})
90
+ } else {
91
+ v({success:false})
92
+ }
93
+ };
94
+ u.src = w
95
+ })
96
+ }
97
+
98
+ j.runtimes.Html5 = j.addRuntime("html5", {getFeatures:function () {
99
+ var s, o, r, q, p, n;
100
+ o = r = p = n = false;
101
+ if (h.XMLHttpRequest) {
102
+ s = new XMLHttpRequest();
103
+ r = !!s.upload;
104
+ o = !!(s.sendAsBinary || s.upload)
105
+ }
106
+ if (o) {
107
+ q = !!(s.sendAsBinary || (h.Uint8Array && h.ArrayBuffer));
108
+ p = !!(File && (File.prototype.getAsDataURL || h.FileReader) && q);
109
+ n = !!(File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice))
110
+ }
111
+ g = j.ua.safari && j.ua.windows;
112
+ return{html5:o, dragdrop:(function () {
113
+ var t = k.createElement("div");
114
+ return("draggable" in t) || ("ondragstart" in t && "ondrop" in t)
115
+ }()), jpgresize:p, pngresize:p, multipart:p || !!h.FileReader || !!h.FormData, canSendBinary:q, cantSendBlobInFormData:!!(j.ua.gecko && h.FormData && h.FileReader && !FileReader.prototype.readAsArrayBuffer), progress:r, chunks:n, multi_selection:!(j.ua.safari && j.ua.windows), triggerDialog:(j.ua.gecko && h.FormData || j.ua.webkit)}
116
+ }, init:function (p, r) {
117
+ var n, q;
118
+
119
+ function o(w) {
120
+ var u, t, v = [], x, s = {};
121
+ for (t = 0; t < w.length; t++) {
122
+ u = w[t];
123
+ if (s[u.name]) {
124
+ continue
125
+ }
126
+ s[u.name] = true;
127
+ x = j.guid();
128
+ c[x] = u;
129
+ v.push(new j.File(x, u.fileName || u.name, u.fileSize || u.size))
130
+ }
131
+ if (v.length) {
132
+ p.trigger("FilesAdded", v)
133
+ }
134
+ }
135
+
136
+ n = this.getFeatures();
137
+ if (!n.html5) {
138
+ r({success:false});
139
+ return
140
+ }
141
+ p.bind("Init", function (w) {
142
+ var G, F, C = [], v, D, t = w.settings.filters, u, B, s = k.body, E;
143
+ G = k.createElement("div");
144
+ G.id = w.id + "_html5_container";
145
+ j.extend(G.style, {position:"absolute", background:p.settings.shim_bgcolor || "transparent", width:"100px", height:"100px", overflow:"hidden", zIndex:99999, opacity:p.settings.shim_bgcolor ? "" : 0});
146
+ G.className = "plupload html5";
147
+ if (p.settings.container) {
148
+ s = k.getElementById(p.settings.container);
149
+ if (j.getStyle(s, "position") === "static") {
150
+ s.style.position = "relative"
151
+ }
152
+ }
153
+ s.appendChild(G);
154
+ no_type_restriction:for (v = 0; v < t.length; v++) {
155
+ u = t[v].extensions.split(/,/);
156
+ for (D = 0; D < u.length; D++) {
157
+ if (u[D] === "*") {
158
+ C = [];
159
+ break no_type_restriction
160
+ }
161
+ B = j.mimeTypes[u[D]];
162
+ if (B && j.inArray(B, C) === -1) {
163
+ C.push(B)
164
+ }
165
+ }
166
+ }
167
+ G.innerHTML = '<input id="' + p.id + '_html5" style="font-size:999px" type="file" accept="' + C.join(",") + '" ' + (p.settings.multi_selection && p.features.multi_selection ? 'multiple="multiple"' : "") + " />";
168
+ G.scrollTop = 100;
169
+ E = k.getElementById(p.id + "_html5");
170
+ if (w.features.triggerDialog) {
171
+ j.extend(E.style, {position:"absolute", width:"100%", height:"100%"})
172
+ } else {
173
+ j.extend(E.style, {cssFloat:"right", styleFloat:"right"})
174
+ }
175
+ E.onchange = function () {
176
+ o(this.files);
177
+ this.value = ""
178
+ };
179
+ F = k.getElementById(w.settings.browse_button);
180
+ if (F) {
181
+ var z = w.settings.browse_button_hover, A = w.settings.browse_button_active, x = w.features.triggerDialog ? F : G;
182
+ if (z) {
183
+ j.addEvent(x, "mouseover", function () {
184
+ j.addClass(F, z)
185
+ }, w.id);
186
+ j.addEvent(x, "mouseout", function () {
187
+ j.removeClass(F, z)
188
+ }, w.id)
189
+ }
190
+ if (A) {
191
+ j.addEvent(x, "mousedown", function () {
192
+ j.addClass(F, A)
193
+ }, w.id);
194
+ j.addEvent(k.body, "mouseup", function () {
195
+ j.removeClass(F, A)
196
+ }, w.id)
197
+ }
198
+ if (w.features.triggerDialog) {
199
+ j.addEvent(F, "click", function (H) {
200
+ var y = k.getElementById(w.id + "_html5");
201
+ if (y && !y.disabled) {
202
+ y.click()
203
+ }
204
+ H.preventDefault()
205
+ }, w.id)
206
+ }
207
+ }
208
+ });
209
+ p.bind("PostInit", function () {
210
+ var s = k.getElementById(p.settings.drop_element);
211
+ if (s) {
212
+ if (g) {
213
+ j.addEvent(s, "dragenter", function (w) {
214
+ var v, t, u;
215
+ v = k.getElementById(p.id + "_drop");
216
+ if (!v) {
217
+ v = k.createElement("input");
218
+ v.setAttribute("type", "file");
219
+ v.setAttribute("id", p.id + "_drop");
220
+ v.setAttribute("multiple", "multiple");
221
+ j.addEvent(v, "change", function () {
222
+ o(this.files);
223
+ j.removeEvent(v, "change", p.id);
224
+ v.parentNode.removeChild(v)
225
+ }, p.id);
226
+ s.appendChild(v)
227
+ }
228
+ t = j.getPos(s, k.getElementById(p.settings.container));
229
+ u = j.getSize(s);
230
+ if (j.getStyle(s, "position") === "static") {
231
+ j.extend(s.style, {position:"relative"})
232
+ }
233
+ j.extend(v.style, {position:"absolute", display:"block", top:0, left:0, width:u.w + "px", height:u.h + "px", opacity:0})
234
+ }, p.id);
235
+ return
236
+ }
237
+ j.addEvent(s, "dragover", function (t) {
238
+ t.preventDefault()
239
+ }, p.id);
240
+ j.addEvent(s, "drop", function (u) {
241
+ var t = u.dataTransfer;
242
+ if (t && t.files) {
243
+ o(t.files)
244
+ }
245
+ u.preventDefault()
246
+ }, p.id)
247
+ }
248
+ });
249
+ p.bind("Refresh", function (s) {
250
+ var t, u, v, x, w;
251
+ t = k.getElementById(p.settings.browse_button);
252
+ if (t) {
253
+ u = j.getPos(t, k.getElementById(s.settings.container));
254
+ v = j.getSize(t);
255
+ x = k.getElementById(p.id + "_html5_container");
256
+ j.extend(x.style, {top:u.y + "px", left:u.x + "px", width:v.w + "px", height:v.h + "px"});
257
+ if (p.features.triggerDialog) {
258
+ if (j.getStyle(t, "position") === "static") {
259
+ j.extend(t.style, {position:"relative"})
260
+ }
261
+ w = parseInt(j.getStyle(t, "z-index"), 10);
262
+ if (isNaN(w)) {
263
+ w = 0
264
+ }
265
+ j.extend(t.style, {zIndex:w});
266
+ j.extend(x.style, {zIndex:w - 1})
267
+ }
268
+ }
269
+ });
270
+ p.bind("DisableBrowse", function (s, u) {
271
+ var t = k.getElementById(s.id + "_html5");
272
+ if (t) {
273
+ t.disabled = u
274
+ }
275
+ });
276
+ p.bind("CancelUpload", function () {
277
+ if (q && q.abort) {
278
+ q.abort()
279
+ }
280
+ });
281
+ p.bind("UploadFile", function (s, u) {
282
+ var v = s.settings, y, t;
283
+
284
+ function x(A, D, z) {
285
+ var B;
286
+ if (File.prototype.slice) {
287
+ try {
288
+ A.slice();
289
+ return A.slice(D, z)
290
+ } catch (C) {
291
+ return A.slice(D, z - D)
292
+ }
293
+ } else {
294
+ if (B = File.prototype.webkitSlice || File.prototype.mozSlice) {
295
+ return B.call(A, D, z)
296
+ } else {
297
+ return null
298
+ }
299
+ }
300
+ }
301
+
302
+ function w(A) {
303
+ var D = 0, C = 0, z = ("FileReader" in h) ? new FileReader : null;
304
+
305
+ function B() {
306
+ var I, M, K, L, H, J, F, E = s.settings.url;
307
+
308
+ function G(V) {
309
+ var T = 0, N = "----pluploadboundary" + j.guid(), O, P = "--", U = "\r\n", R = "";
310
+ q = new XMLHttpRequest;
311
+ if (q.upload) {
312
+ q.upload.onprogress = function (W) {
313
+ u.loaded = Math.min(u.size, C + W.loaded - T);
314
+ s.trigger("UploadProgress", u)
315
+ }
316
+ }
317
+ q.onreadystatechange = function () {
318
+ var W, Y;
319
+ if (q.readyState == 4 && s.state !== j.STOPPED) {
320
+ try {
321
+ W = q.status
322
+ } catch (X) {
323
+ W = 0
324
+ }
325
+ if (W >= 400) {
326
+ s.trigger("Error", {code:j.HTTP_ERROR, message:j.translate("HTTP Error."), file:u, status:W})
327
+ } else {
328
+ if (K) {
329
+ Y = {chunk:D, chunks:K, response:q.responseText, status:W};
330
+ s.trigger("ChunkUploaded", u, Y);
331
+ C += J;
332
+ if (Y.cancelled) {
333
+ u.status = j.FAILED;
334
+ return
335
+ }
336
+ u.loaded = Math.min(u.size, (D + 1) * H)
337
+ } else {
338
+ u.loaded = u.size
339
+ }
340
+ s.trigger("UploadProgress", u);
341
+ V = I = O = R = null;
342
+ if (!K || ++D >= K) {
343
+ u.status = j.DONE;
344
+ s.trigger("FileUploaded", u, {response:q.responseText, status:W})
345
+ } else {
346
+ B()
347
+ }
348
+ }
349
+ }
350
+ };
351
+ if (s.settings.multipart && n.multipart) {
352
+ L.name = u.target_name || u.name;
353
+ q.open("post", E, true);
354
+ j.each(s.settings.headers, function (X, W) {
355
+ q.setRequestHeader(W, X)
356
+ });
357
+ if (typeof(V) !== "string" && !!h.FormData) {
358
+ O = new FormData();
359
+ j.each(j.extend(L, s.settings.multipart_params), function (X, W) {
360
+ O.append(W, X)
361
+ });
362
+ O.append(s.settings.file_data_name, V);
363
+ q.send(O);
364
+ return
365
+ }
366
+ if (typeof(V) === "string") {
367
+ q.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + N);
368
+ j.each(j.extend(L, s.settings.multipart_params), function (X, W) {
369
+ R += P + N + U + 'Content-Disposition: form-data; name="' + W + '"' + U + U;
370
+ R += unescape(encodeURIComponent(X)) + U
371
+ });
372
+ F = j.mimeTypes[u.name.replace(/^.+\.([^.]+)/, "$1").toLowerCase()] || "application/octet-stream";
373
+ R += P + N + U + 'Content-Disposition: form-data; name="' + s.settings.file_data_name + '"; filename="' + unescape(encodeURIComponent(u.name)) + '"' + U + "Content-Type: " + F + U + U + V + U + P + N + P + U;
374
+ T = R.length - V.length;
375
+ V = R;
376
+ if (q.sendAsBinary) {
377
+ q.sendAsBinary(V)
378
+ } else {
379
+ if (n.canSendBinary) {
380
+ var S = new Uint8Array(V.length);
381
+ for (var Q = 0; Q < V.length; Q++) {
382
+ S[Q] = (V.charCodeAt(Q) & 255)
383
+ }
384
+ q.send(S.buffer)
385
+ }
386
+ }
387
+ return
388
+ }
389
+ }
390
+ E = j.buildUrl(s.settings.url, j.extend(L, s.settings.multipart_params));
391
+ q.open("post", E, true);
392
+ q.setRequestHeader("Content-Type", "application/octet-stream");
393
+ j.each(s.settings.headers, function (X, W) {
394
+ q.setRequestHeader(W, X)
395
+ });
396
+ q.send(V)
397
+ }
398
+
399
+ if (u.status == j.DONE || u.status == j.FAILED || s.state == j.STOPPED) {
400
+ return
401
+ }
402
+ L = {name:u.target_name || u.name};
403
+ if (v.chunk_size && u.size > v.chunk_size && (n.chunks || typeof(A) == "string")) {
404
+ H = v.chunk_size;
405
+ K = Math.ceil(u.size / H);
406
+ J = Math.min(H, u.size - (D * H));
407
+ if (typeof(A) == "string") {
408
+ I = A.substring(D * H, D * H + J)
409
+ } else {
410
+ I = x(A, D * H, D * H + J)
411
+ }
412
+ L.chunk = D;
413
+ L.chunks = K
414
+ } else {
415
+ J = u.size;
416
+ I = A
417
+ }
418
+ if (s.settings.multipart && n.multipart && typeof(I) !== "string" && z && n.cantSendBlobInFormData && n.chunks && s.settings.chunk_size) {
419
+ z.onload = function () {
420
+ G(z.result)
421
+ };
422
+ z.readAsBinaryString(I)
423
+ } else {
424
+ G(I)
425
+ }
426
+ }
427
+
428
+ B()
429
+ }
430
+
431
+ y = c[u.id];
432
+ if (n.jpgresize && s.settings.resize && /\.(png|jpg|jpeg)$/i.test(u.name)) {
433
+ d.call(s, u, s.settings.resize, /\.png$/i.test(u.name) ? "image/png" : "image/jpeg", function (z) {
434
+ if (z.success) {
435
+ u.size = z.data.length;
436
+ w(z.data)
437
+ } else {
438
+ if (n.chunks) {
439
+ w(y)
440
+ } else {
441
+ l(y, w)
442
+ }
443
+ }
444
+ })
445
+ } else {
446
+ if (!n.chunks && n.jpgresize) {
447
+ l(y, w)
448
+ } else {
449
+ w(y)
450
+ }
451
+ }
452
+ });
453
+ p.bind("Destroy", function (s) {
454
+ var u, v, t = k.body, w = {inputContainer:s.id + "_html5_container", inputFile:s.id + "_html5", browseButton:s.settings.browse_button, dropElm:s.settings.drop_element};
455
+ for (u in w) {
456
+ v = k.getElementById(w[u]);
457
+ if (v) {
458
+ j.removeAllEvents(v, s.id)
459
+ }
460
+ }
461
+ j.removeAllEvents(k.body, s.id);
462
+ if (s.settings.container) {
463
+ t = k.getElementById(s.settings.container)
464
+ }
465
+ t.removeChild(k.getElementById(w.inputContainer))
466
+ });
467
+ r({success:true})
468
+ }});
469
+ function b() {
470
+ var q = false, o;
471
+
472
+ function r(t, v) {
473
+ var s = q ? 0 : -8 * (v - 1), w = 0, u;
474
+ for (u = 0; u < v; u++) {
475
+ w |= (o.charCodeAt(t + u) << Math.abs(s + u * 8))
476
+ }
477
+ return w
478
+ }
479
+
480
+ function n(u, s, t) {
481
+ var t = arguments.length === 3 ? t : o.length - s - 1;
482
+ o = o.substr(0, s) + u + o.substr(t + s)
483
+ }
484
+
485
+ function p(t, u, w) {
486
+ var x = "", s = q ? 0 : -8 * (w - 1), v;
487
+ for (v = 0; v < w; v++) {
488
+ x += String.fromCharCode((u >> Math.abs(s + v * 8)) & 255)
489
+ }
490
+ n(x, t, w)
491
+ }
492
+
493
+ return{II:function (s) {
494
+ if (s === e) {
495
+ return q
496
+ } else {
497
+ q = s
498
+ }
499
+ }, init:function (s) {
500
+ q = false;
501
+ o = s
502
+ }, SEGMENT:function (s, u, t) {
503
+ switch (arguments.length) {
504
+ case 1:
505
+ return o.substr(s, o.length - s - 1);
506
+ case 2:
507
+ return o.substr(s, u);
508
+ case 3:
509
+ n(t, s, u);
510
+ break;
511
+ default:
512
+ return o
513
+ }
514
+ }, BYTE:function (s) {
515
+ return r(s, 1)
516
+ }, SHORT:function (s) {
517
+ return r(s, 2)
518
+ }, LONG:function (s, t) {
519
+ if (t === e) {
520
+ return r(s, 4)
521
+ } else {
522
+ p(s, t, 4)
523
+ }
524
+ }, SLONG:function (s) {
525
+ var t = r(s, 4);
526
+ return(t > 2147483647 ? t - 4294967296 : t)
527
+ }, STRING:function (s, t) {
528
+ var u = "";
529
+ for (t += s; s < t; s++) {
530
+ u += String.fromCharCode(r(s, 1))
531
+ }
532
+ return u
533
+ }}
534
+ }
535
+
536
+ function f(s) {
537
+ var u = {65505:{app:"EXIF", name:"APP1", signature:"Exif\0"}, 65506:{app:"ICC", name:"APP2", signature:"ICC_PROFILE\0"}, 65517:{app:"IPTC", name:"APP13", signature:"Photoshop 3.0\0"}}, t = [], r, n, p = e, q = 0, o;
538
+ r = new b();
539
+ r.init(s);
540
+ if (r.SHORT(0) !== 65496) {
541
+ return
542
+ }
543
+ n = 2;
544
+ o = Math.min(1048576, s.length);
545
+ while (n <= o) {
546
+ p = r.SHORT(n);
547
+ if (p >= 65488 && p <= 65495) {
548
+ n += 2;
549
+ continue
550
+ }
551
+ if (p === 65498 || p === 65497) {
552
+ break
553
+ }
554
+ q = r.SHORT(n + 2) + 2;
555
+ if (u[p] && r.STRING(n + 4, u[p].signature.length) === u[p].signature) {
556
+ t.push({hex:p, app:u[p].app.toUpperCase(), name:u[p].name.toUpperCase(), start:n, length:q, segment:r.SEGMENT(n, q)})
557
+ }
558
+ n += q
559
+ }
560
+ r.init(null);
561
+ return{headers:t, restore:function (y) {
562
+ r.init(y);
563
+ var w = new f(y);
564
+ if (!w.headers) {
565
+ return false
566
+ }
567
+ for (var x = w.headers.length; x > 0; x--) {
568
+ var z = w.headers[x - 1];
569
+ r.SEGMENT(z.start, z.length, "")
570
+ }
571
+ w.purge();
572
+ n = r.SHORT(2) == 65504 ? 4 + r.SHORT(4) : 2;
573
+ for (var x = 0, v = t.length; x < v; x++) {
574
+ r.SEGMENT(n, 0, t[x].segment);
575
+ n += t[x].length
576
+ }
577
+ return r.SEGMENT()
578
+ }, get:function (x) {
579
+ var y = [];
580
+ for (var w = 0, v = t.length; w < v; w++) {
581
+ if (t[w].app === x.toUpperCase()) {
582
+ y.push(t[w].segment)
583
+ }
584
+ }
585
+ return y
586
+ }, set:function (y, x) {
587
+ var z = [];
588
+ if (typeof(x) === "string") {
589
+ z.push(x)
590
+ } else {
591
+ z = x
592
+ }
593
+ for (var w = ii = 0, v = t.length; w < v; w++) {
594
+ if (t[w].app === y.toUpperCase()) {
595
+ t[w].segment = z[ii];
596
+ t[w].length = z[ii].length;
597
+ ii++
598
+ }
599
+ if (ii >= z.length) {
600
+ break
601
+ }
602
+ }
603
+ }, purge:function () {
604
+ t = [];
605
+ r.init(null)
606
+ }}
607
+ }
608
+
609
+ function a() {
610
+ var q, n, o = {}, t;
611
+ q = new b();
612
+ n = {tiff:{274:"Orientation", 34665:"ExifIFDPointer", 34853:"GPSInfoIFDPointer"}, exif:{36864:"ExifVersion", 40961:"ColorSpace", 40962:"PixelXDimension", 40963:"PixelYDimension", 36867:"DateTimeOriginal", 33434:"ExposureTime", 33437:"FNumber", 34855:"ISOSpeedRatings", 37377:"ShutterSpeedValue", 37378:"ApertureValue", 37383:"MeteringMode", 37384:"LightSource", 37385:"Flash", 41986:"ExposureMode", 41987:"WhiteBalance", 41990:"SceneCaptureType", 41988:"DigitalZoomRatio", 41992:"Contrast", 41993:"Saturation", 41994:"Sharpness"}, gps:{0:"GPSVersionID", 1:"GPSLatitudeRef", 2:"GPSLatitude", 3:"GPSLongitudeRef", 4:"GPSLongitude"}};
613
+ t = {ColorSpace:{1:"sRGB", 0:"Uncalibrated"}, MeteringMode:{0:"Unknown", 1:"Average", 2:"CenterWeightedAverage", 3:"Spot", 4:"MultiSpot", 5:"Pattern", 6:"Partial", 255:"Other"}, LightSource:{1:"Daylight", 2:"Fliorescent", 3:"Tungsten", 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"}, ExposureMode:{0:"Auto exposure", 1:"Manual exposure", 2:"Auto bracket"}, WhiteBalance:{0:"Auto white balance", 1:"Manual white balance"}, SceneCaptureType:{0:"Standard", 1:"Landscape", 2:"Portrait", 3:"Night scene"}, Contrast:{0:"Normal", 1:"Soft", 2:"Hard"}, Saturation:{0:"Normal", 1:"Low saturation", 2:"High saturation"}, Sharpness:{0:"Normal", 1:"Soft", 2:"Hard"}, GPSLatitudeRef:{N:"North latitude", S:"South latitude"}, GPSLongitudeRef:{E:"East longitude", W:"West longitude"}};
614
+ function p(u, C) {
615
+ var w = q.SHORT(u), z, F, G, B, A, v, x, D, E = [], y = {};
616
+ for (z = 0; z < w; z++) {
617
+ x = v = u + 12 * z + 2;
618
+ G = C[q.SHORT(x)];
619
+ if (G === e) {
620
+ continue
621
+ }
622
+ B = q.SHORT(x += 2);
623
+ A = q.LONG(x += 2);
624
+ x += 4;
625
+ E = [];
626
+ switch (B) {
627
+ case 1:
628
+ case 7:
629
+ if (A > 4) {
630
+ x = q.LONG(x) + o.tiffHeader
631
+ }
632
+ for (F = 0; F < A; F++) {
633
+ E[F] = q.BYTE(x + F)
634
+ }
635
+ break;
636
+ case 2:
637
+ if (A > 4) {
638
+ x = q.LONG(x) + o.tiffHeader
639
+ }
640
+ y[G] = q.STRING(x, A - 1);
641
+ continue;
642
+ case 3:
643
+ if (A > 2) {
644
+ x = q.LONG(x) + o.tiffHeader
645
+ }
646
+ for (F = 0; F < A; F++) {
647
+ E[F] = q.SHORT(x + F * 2)
648
+ }
649
+ break;
650
+ case 4:
651
+ if (A > 1) {
652
+ x = q.LONG(x) + o.tiffHeader
653
+ }
654
+ for (F = 0; F < A; F++) {
655
+ E[F] = q.LONG(x + F * 4)
656
+ }
657
+ break;
658
+ case 5:
659
+ x = q.LONG(x) + o.tiffHeader;
660
+ for (F = 0; F < A; F++) {
661
+ E[F] = q.LONG(x + F * 4) / q.LONG(x + F * 4 + 4)
662
+ }
663
+ break;
664
+ case 9:
665
+ x = q.LONG(x) + o.tiffHeader;
666
+ for (F = 0; F < A; F++) {
667
+ E[F] = q.SLONG(x + F * 4)
668
+ }
669
+ break;
670
+ case 10:
671
+ x = q.LONG(x) + o.tiffHeader;
672
+ for (F = 0; F < A; F++) {
673
+ E[F] = q.SLONG(x + F * 4) / q.SLONG(x + F * 4 + 4)
674
+ }
675
+ break;
676
+ default:
677
+ continue
678
+ }
679
+ D = (A == 1 ? E[0] : E);
680
+ if (t.hasOwnProperty(G) && typeof D != "object") {
681
+ y[G] = t[G][D]
682
+ } else {
683
+ y[G] = D
684
+ }
685
+ }
686
+ return y
687
+ }
688
+
689
+ function s() {
690
+ var v = e, u = o.tiffHeader;
691
+ q.II(q.SHORT(u) == 18761);
692
+ if (q.SHORT(u += 2) !== 42) {
693
+ return false
694
+ }
695
+ o.IFD0 = o.tiffHeader + q.LONG(u += 2);
696
+ v = p(o.IFD0, n.tiff);
697
+ o.exifIFD = ("ExifIFDPointer" in v ? o.tiffHeader + v.ExifIFDPointer : e);
698
+ o.gpsIFD = ("GPSInfoIFDPointer" in v ? o.tiffHeader + v.GPSInfoIFDPointer : e);
699
+ return true
700
+ }
701
+
702
+ function r(w, u, z) {
703
+ var B, y, x, A = 0;
704
+ if (typeof(u) === "string") {
705
+ var v = n[w.toLowerCase()];
706
+ for (hex in v) {
707
+ if (v[hex] === u) {
708
+ u = hex;
709
+ break
710
+ }
711
+ }
712
+ }
713
+ B = o[w.toLowerCase() + "IFD"];
714
+ y = q.SHORT(B);
715
+ for (i = 0; i < y; i++) {
716
+ x = B + 12 * i + 2;
717
+ if (q.SHORT(x) == u) {
718
+ A = x + 8;
719
+ break
720
+ }
721
+ }
722
+ if (!A) {
723
+ return false
724
+ }
725
+ q.LONG(A, z);
726
+ return true
727
+ }
728
+
729
+ return{init:function (u) {
730
+ o = {tiffHeader:10};
731
+ if (u === e || !u.length) {
732
+ return false
733
+ }
734
+ q.init(u);
735
+ if (q.SHORT(0) === 65505 && q.STRING(4, 5).toUpperCase() === "EXIF\0") {
736
+ return s()
737
+ }
738
+ return false
739
+ }, EXIF:function () {
740
+ var v;
741
+ v = p(o.exifIFD, n.exif);
742
+ if (v.ExifVersion && j.typeOf(v.ExifVersion) === "array") {
743
+ for (var w = 0, u = ""; w < v.ExifVersion.length; w++) {
744
+ u += String.fromCharCode(v.ExifVersion[w])
745
+ }
746
+ v.ExifVersion = u
747
+ }
748
+ return v
749
+ }, GPS:function () {
750
+ var u;
751
+ u = p(o.gpsIFD, n.gps);
752
+ if (u.GPSVersionID) {
753
+ u.GPSVersionID = u.GPSVersionID.join(".")
754
+ }
755
+ return u
756
+ }, setExif:function (u, v) {
757
+ if (u !== "PixelXDimension" && u !== "PixelYDimension") {
758
+ return false
759
+ }
760
+ return r("exif", u, v)
761
+ }, getBinary:function () {
762
+ return q.SEGMENT()
763
+ }}
764
+ }
765
+ })(window, document, plupload);