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,2525 @@
1
+ /*1.5.4*/
2
+ (function () {
3
+ var f = 0, l = [], n = {}, j = {}, a = {"<":"lt", ">":"gt", "&":"amp", '"':"quot", "'":"#39"}, m = /[<>&\"\']/g, b, c = window.setTimeout, d = {}, e;
4
+
5
+ function h() {
6
+ this.returnValue = false
7
+ }
8
+
9
+ function k() {
10
+ this.cancelBubble = true
11
+ }
12
+
13
+ (function (o) {
14
+ var p = o.split(/,/), q, s, r;
15
+ for (q = 0; q < p.length; q += 2) {
16
+ r = p[q + 1].split(/ /);
17
+ for (s = 0; s < r.length; s++) {
18
+ j[r[s]] = p[q]
19
+ }
20
+ }
21
+ })("application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/vnd.rn-realvideo,rv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe");
22
+ var g = {VERSION:"1.5.4", STOPPED:1, STARTED:2, QUEUED:1, UPLOADING:2, FAILED:4, DONE:5, GENERIC_ERROR:-100, HTTP_ERROR:-200, IO_ERROR:-300, SECURITY_ERROR:-400, INIT_ERROR:-500, FILE_SIZE_ERROR:-600, FILE_EXTENSION_ERROR:-601, IMAGE_FORMAT_ERROR:-700, IMAGE_MEMORY_ERROR:-701, IMAGE_DIMENSIONS_ERROR:-702, mimeTypes:j, ua:(function () {
23
+ var s = navigator, r = s.userAgent, t = s.vendor, p, o, q;
24
+ p = /WebKit/.test(r);
25
+ q = p && t.indexOf("Apple") !== -1;
26
+ o = window.opera && window.opera.buildNumber;
27
+ return{windows:navigator.platform.indexOf("Win") !== -1, ie:!p && !o && (/MSIE/gi).test(r) && (/Explorer/gi).test(s.appName), webkit:p, gecko:!p && /Gecko/.test(r), safari:q, opera:!!o}
28
+ }()), typeOf:function (p) {
29
+ return({}).toString.call(p).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()
30
+ }, extend:function (o) {
31
+ g.each(arguments, function (p, q) {
32
+ if (q > 0) {
33
+ g.each(p, function (s, r) {
34
+ o[r] = s
35
+ })
36
+ }
37
+ });
38
+ return o
39
+ }, cleanName:function (o) {
40
+ var p, q;
41
+ q = [/[\300-\306]/g, "A", /[\340-\346]/g, "a", /\307/g, "C", /\347/g, "c", /[\310-\313]/g, "E", /[\350-\353]/g, "e", /[\314-\317]/g, "I", /[\354-\357]/g, "i", /\321/g, "N", /\361/g, "n", /[\322-\330]/g, "O", /[\362-\370]/g, "o", /[\331-\334]/g, "U", /[\371-\374]/g, "u"];
42
+ for (p = 0; p < q.length; p += 2) {
43
+ o = o.replace(q[p], q[p + 1])
44
+ }
45
+ o = o.replace(/\s+/g, "_");
46
+ o = o.replace(/[^a-z0-9_\-\.]+/gi, "");
47
+ return o
48
+ }, addRuntime:function (o, p) {
49
+ p.name = o;
50
+ l[o] = p;
51
+ l.push(p);
52
+ return p
53
+ }, guid:function () {
54
+ var o = new Date().getTime().toString(32), p;
55
+ for (p = 0; p < 5; p++) {
56
+ o += Math.floor(Math.random() * 65535).toString(32)
57
+ }
58
+ return(g.guidPrefix || "p") + o + (f++).toString(32)
59
+ }, buildUrl:function (p, o) {
60
+ var q = "";
61
+ g.each(o, function (s, r) {
62
+ q += (q ? "&" : "") + encodeURIComponent(r) + "=" + encodeURIComponent(s)
63
+ });
64
+ if (q) {
65
+ p += (p.indexOf("?") > 0 ? "&" : "?") + q
66
+ }
67
+ return p
68
+ }, each:function (r, s) {
69
+ var q, p, o;
70
+ if (r) {
71
+ q = r.length;
72
+ if (q === b) {
73
+ for (p in r) {
74
+ if (r.hasOwnProperty(p)) {
75
+ if (s(r[p], p) === false) {
76
+ return
77
+ }
78
+ }
79
+ }
80
+ } else {
81
+ for (o = 0; o < q; o++) {
82
+ if (s(r[o], o) === false) {
83
+ return
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }, formatSize:function (o) {
89
+ if (o === b || /\D/.test(o)) {
90
+ return g.translate("N/A")
91
+ }
92
+ if (o > 1073741824) {
93
+ return Math.round(o / 1073741824, 1) + " GB"
94
+ }
95
+ if (o > 1048576) {
96
+ return Math.round(o / 1048576, 1) + " MB"
97
+ }
98
+ if (o > 1024) {
99
+ return Math.round(o / 1024, 1) + " KB"
100
+ }
101
+ return o + " b"
102
+ }, getPos:function (p, t) {
103
+ var u = 0, s = 0, w, v = document, q, r;
104
+ p = p;
105
+ t = t || v.body;
106
+ function o(C) {
107
+ var A, B, z = 0, D = 0;
108
+ if (C) {
109
+ B = C.getBoundingClientRect();
110
+ A = v.compatMode === "CSS1Compat" ? v.documentElement : v.body;
111
+ z = B.left + A.scrollLeft;
112
+ D = B.top + A.scrollTop
113
+ }
114
+ return{x:z, y:D}
115
+ }
116
+
117
+ if (p && p.getBoundingClientRect && ((navigator.userAgent.indexOf("MSIE") > 0) && (v.documentMode < 8))) {
118
+ q = o(p);
119
+ r = o(t);
120
+ return{x:q.x - r.x, y:q.y - r.y}
121
+ }
122
+ w = p;
123
+ while (w && w != t && w.nodeType) {
124
+ u += w.offsetLeft || 0;
125
+ s += w.offsetTop || 0;
126
+ w = w.offsetParent
127
+ }
128
+ w = p.parentNode;
129
+ while (w && w != t && w.nodeType) {
130
+ u -= w.scrollLeft || 0;
131
+ s -= w.scrollTop || 0;
132
+ w = w.parentNode
133
+ }
134
+ return{x:u, y:s}
135
+ }, getSize:function (o) {
136
+ return{w:o.offsetWidth || o.clientWidth, h:o.offsetHeight || o.clientHeight}
137
+ }, parseSize:function (o) {
138
+ var p;
139
+ if (typeof(o) == "string") {
140
+ o = /^([0-9]+)([mgk]?)$/.exec(o.toLowerCase().replace(/[^0-9mkg]/g, ""));
141
+ p = o[2];
142
+ o = +o[1];
143
+ if (p == "g") {
144
+ o *= 1073741824
145
+ }
146
+ if (p == "m") {
147
+ o *= 1048576
148
+ }
149
+ if (p == "k") {
150
+ o *= 1024
151
+ }
152
+ }
153
+ return o
154
+ }, xmlEncode:function (o) {
155
+ return o ? ("" + o).replace(m, function (p) {
156
+ return a[p] ? "&" + a[p] + ";" : p
157
+ }) : o
158
+ }, toArray:function (q) {
159
+ var p, o = [];
160
+ for (p = 0; p < q.length; p++) {
161
+ o[p] = q[p]
162
+ }
163
+ return o
164
+ }, inArray:function (q, r) {
165
+ if (r) {
166
+ if (Array.prototype.indexOf) {
167
+ return Array.prototype.indexOf.call(r, q)
168
+ }
169
+ for (var o = 0, p = r.length; o < p; o++) {
170
+ if (r[o] === q) {
171
+ return o
172
+ }
173
+ }
174
+ }
175
+ return -1
176
+ }, addI18n:function (o) {
177
+ return g.extend(n, o)
178
+ }, translate:function (o) {
179
+ return n[o] || o
180
+ }, isEmptyObj:function (o) {
181
+ if (o === b) {
182
+ return true
183
+ }
184
+ for (var p in o) {
185
+ return false
186
+ }
187
+ return true
188
+ }, hasClass:function (q, p) {
189
+ var o;
190
+ if (q.className == "") {
191
+ return false
192
+ }
193
+ o = new RegExp("(^|\\s+)" + p + "(\\s+|$)");
194
+ return o.test(q.className)
195
+ }, addClass:function (p, o) {
196
+ if (!g.hasClass(p, o)) {
197
+ p.className = p.className == "" ? o : p.className.replace(/\s+$/, "") + " " + o
198
+ }
199
+ }, removeClass:function (q, p) {
200
+ var o = new RegExp("(^|\\s+)" + p + "(\\s+|$)");
201
+ q.className = q.className.replace(o, function (s, r, t) {
202
+ return r === " " && t === " " ? " " : ""
203
+ })
204
+ }, getStyle:function (p, o) {
205
+ if (p.currentStyle) {
206
+ return p.currentStyle[o]
207
+ } else {
208
+ if (window.getComputedStyle) {
209
+ return window.getComputedStyle(p, null)[o]
210
+ }
211
+ }
212
+ }, addEvent:function (t, o, u) {
213
+ var s, r, q, p;
214
+ p = arguments[3];
215
+ o = o.toLowerCase();
216
+ if (e === b) {
217
+ e = "Plupload_" + g.guid()
218
+ }
219
+ if (t.addEventListener) {
220
+ s = u;
221
+ t.addEventListener(o, s, false)
222
+ } else {
223
+ if (t.attachEvent) {
224
+ s = function () {
225
+ var v = window.event;
226
+ if (!v.target) {
227
+ v.target = v.srcElement
228
+ }
229
+ v.preventDefault = h;
230
+ v.stopPropagation = k;
231
+ u(v)
232
+ };
233
+ t.attachEvent("on" + o, s)
234
+ }
235
+ }
236
+ if (t[e] === b) {
237
+ t[e] = g.guid()
238
+ }
239
+ if (!d.hasOwnProperty(t[e])) {
240
+ d[t[e]] = {}
241
+ }
242
+ r = d[t[e]];
243
+ if (!r.hasOwnProperty(o)) {
244
+ r[o] = []
245
+ }
246
+ r[o].push({func:s, orig:u, key:p})
247
+ }, removeEvent:function (t, o) {
248
+ var r, u, q;
249
+ if (typeof(arguments[2]) == "function") {
250
+ u = arguments[2]
251
+ } else {
252
+ q = arguments[2]
253
+ }
254
+ o = o.toLowerCase();
255
+ if (t[e] && d[t[e]] && d[t[e]][o]) {
256
+ r = d[t[e]][o]
257
+ } else {
258
+ return
259
+ }
260
+ for (var p = r.length - 1; p >= 0; p--) {
261
+ if (r[p].key === q || r[p].orig === u) {
262
+ if (t.removeEventListener) {
263
+ t.removeEventListener(o, r[p].func, false)
264
+ } else {
265
+ if (t.detachEvent) {
266
+ t.detachEvent("on" + o, r[p].func)
267
+ }
268
+ }
269
+ r[p].orig = null;
270
+ r[p].func = null;
271
+ r.splice(p, 1);
272
+ if (u !== b) {
273
+ break
274
+ }
275
+ }
276
+ }
277
+ if (!r.length) {
278
+ delete d[t[e]][o]
279
+ }
280
+ if (g.isEmptyObj(d[t[e]])) {
281
+ delete d[t[e]];
282
+ try {
283
+ delete t[e]
284
+ } catch (s) {
285
+ t[e] = b
286
+ }
287
+ }
288
+ }, removeAllEvents:function (p) {
289
+ var o = arguments[1];
290
+ if (p[e] === b || !p[e]) {
291
+ return
292
+ }
293
+ g.each(d[p[e]], function (r, q) {
294
+ g.removeEvent(p, q, o)
295
+ })
296
+ }};
297
+ g.Uploader = function (s) {
298
+ var p = {}, v, u = [], r, q = false;
299
+ v = new g.QueueProgress();
300
+ s = g.extend({chunk_size:0, multipart:true, multi_selection:true, file_data_name:"file", filters:[]}, s);
301
+ function t() {
302
+ var x, y = 0, w;
303
+ if (this.state == g.STARTED) {
304
+ for (w = 0; w < u.length; w++) {
305
+ if (!x && u[w].status == g.QUEUED) {
306
+ x = u[w];
307
+ x.status = g.UPLOADING;
308
+ if (this.trigger("BeforeUpload", x)) {
309
+ this.trigger("UploadFile", x)
310
+ }
311
+ } else {
312
+ y++
313
+ }
314
+ }
315
+ if (y == u.length) {
316
+ this.stop();
317
+ this.trigger("UploadComplete", u)
318
+ }
319
+ }
320
+ }
321
+
322
+ function o() {
323
+ var x, w;
324
+ v.reset();
325
+ for (x = 0; x < u.length; x++) {
326
+ w = u[x];
327
+ if (w.size !== b) {
328
+ v.size += w.size;
329
+ v.loaded += w.loaded
330
+ } else {
331
+ v.size = b
332
+ }
333
+ if (w.status == g.DONE) {
334
+ v.uploaded++
335
+ } else {
336
+ if (w.status == g.FAILED) {
337
+ v.failed++
338
+ } else {
339
+ v.queued++
340
+ }
341
+ }
342
+ }
343
+ if (v.size === b) {
344
+ v.percent = u.length > 0 ? Math.ceil(v.uploaded / u.length * 100) : 0
345
+ } else {
346
+ v.bytesPerSec = Math.ceil(v.loaded / ((+new Date() - r || 1) / 1000));
347
+ v.percent = v.size > 0 ? Math.ceil(v.loaded / v.size * 100) : 0
348
+ }
349
+ }
350
+
351
+ g.extend(this, {state:g.STOPPED, runtime:"", features:{}, files:u, settings:s, total:v, id:g.guid(), init:function () {
352
+ var B = this, C, y, x, A = 0, z;
353
+ if (typeof(s.preinit) == "function") {
354
+ s.preinit(B)
355
+ } else {
356
+ g.each(s.preinit, function (E, D) {
357
+ B.bind(D, E)
358
+ })
359
+ }
360
+ s.page_url = s.page_url || document.location.pathname.replace(/\/[^\/]+$/g, "/");
361
+ if (!/^(\w+:\/\/|\/)/.test(s.url)) {
362
+ s.url = s.page_url + s.url
363
+ }
364
+ s.chunk_size = g.parseSize(s.chunk_size);
365
+ s.max_file_size = g.parseSize(s.max_file_size);
366
+ B.bind("FilesAdded", function (D, G) {
367
+ var F, E, I = 0, J, H = s.filters;
368
+ if (H && H.length) {
369
+ J = [];
370
+ g.each(H, function (K) {
371
+ g.each(K.extensions.split(/,/), function (L) {
372
+ if (/^\s*\*\s*$/.test(L)) {
373
+ J.push("\\.*")
374
+ } else {
375
+ J.push("\\." + L.replace(new RegExp("[" + ("/^$.*+?|()[]{}\\".replace(/./g, "\\$&")) + "]", "g"), "\\$&"))
376
+ }
377
+ })
378
+ });
379
+ J = new RegExp(J.join("|") + "$", "i")
380
+ }
381
+ for (F = 0; F < G.length; F++) {
382
+ E = G[F];
383
+ E.loaded = 0;
384
+ E.percent = 0;
385
+ E.status = g.QUEUED;
386
+ if (J && !J.test(E.name)) {
387
+ D.trigger("Error", {code:g.FILE_EXTENSION_ERROR, message:g.translate("File extension error."), file:E});
388
+ continue
389
+ }
390
+ if (E.size !== b && E.size > s.max_file_size) {
391
+ D.trigger("Error", {code:g.FILE_SIZE_ERROR, message:g.translate("File size error."), file:E});
392
+ continue
393
+ }
394
+ u.push(E);
395
+ I++
396
+ }
397
+ if (I) {
398
+ c(function () {
399
+ B.trigger("QueueChanged");
400
+ B.refresh()
401
+ }, 1)
402
+ } else {
403
+ return false
404
+ }
405
+ });
406
+ if (s.unique_names) {
407
+ B.bind("UploadFile", function (D, E) {
408
+ var G = E.name.match(/\.([^.]+)$/), F = "tmp";
409
+ if (G) {
410
+ F = G[1]
411
+ }
412
+ E.target_name = E.id + "." + F
413
+ })
414
+ }
415
+ B.bind("UploadProgress", function (D, E) {
416
+ E.percent = E.size > 0 ? Math.ceil(E.loaded / E.size * 100) : 100;
417
+ o()
418
+ });
419
+ B.bind("StateChanged", function (D) {
420
+ if (D.state == g.STARTED) {
421
+ r = (+new Date())
422
+ } else {
423
+ if (D.state == g.STOPPED) {
424
+ for (C = D.files.length - 1; C >= 0; C--) {
425
+ if (D.files[C].status == g.UPLOADING) {
426
+ D.files[C].status = g.QUEUED;
427
+ o()
428
+ }
429
+ }
430
+ }
431
+ }
432
+ });
433
+ B.bind("QueueChanged", o);
434
+ B.bind("Error", function (D, E) {
435
+ if (E.file) {
436
+ E.file.status = g.FAILED;
437
+ o();
438
+ if (D.state == g.STARTED) {
439
+ c(function () {
440
+ t.call(B)
441
+ }, 1)
442
+ }
443
+ }
444
+ });
445
+ B.bind("FileUploaded", function (D, E) {
446
+ E.status = g.DONE;
447
+ E.loaded = E.size;
448
+ D.trigger("UploadProgress", E);
449
+ c(function () {
450
+ t.call(B)
451
+ }, 1)
452
+ });
453
+ if (s.runtimes) {
454
+ y = [];
455
+ z = s.runtimes.split(/\s?,\s?/);
456
+ for (C = 0; C < z.length; C++) {
457
+ if (l[z[C]]) {
458
+ y.push(l[z[C]])
459
+ }
460
+ }
461
+ } else {
462
+ y = l
463
+ }
464
+ function w() {
465
+ var G = y[A++], F, D, E;
466
+ if (G) {
467
+ F = G.getFeatures();
468
+ D = B.settings.required_features;
469
+ if (D) {
470
+ D = D.split(",");
471
+ for (E = 0; E < D.length; E++) {
472
+ if (!F[D[E]]) {
473
+ w();
474
+ return
475
+ }
476
+ }
477
+ }
478
+ G.init(B, function (H) {
479
+ if (H && H.success) {
480
+ B.features = F;
481
+ B.runtime = G.name;
482
+ B.trigger("Init", {runtime:G.name});
483
+ B.trigger("PostInit");
484
+ B.refresh()
485
+ } else {
486
+ w()
487
+ }
488
+ })
489
+ } else {
490
+ B.trigger("Error", {code:g.INIT_ERROR, message:g.translate("Init error.")})
491
+ }
492
+ }
493
+
494
+ w();
495
+ if (typeof(s.init) == "function") {
496
+ s.init(B)
497
+ } else {
498
+ g.each(s.init, function (E, D) {
499
+ B.bind(D, E)
500
+ })
501
+ }
502
+ }, refresh:function () {
503
+ this.trigger("Refresh")
504
+ }, start:function () {
505
+ if (u.length && this.state != g.STARTED) {
506
+ this.state = g.STARTED;
507
+ this.trigger("StateChanged");
508
+ t.call(this)
509
+ }
510
+ }, stop:function () {
511
+ if (this.state != g.STOPPED) {
512
+ this.state = g.STOPPED;
513
+ this.trigger("CancelUpload");
514
+ this.trigger("StateChanged")
515
+ }
516
+ }, disableBrowse:function () {
517
+ q = arguments[0] !== b ? arguments[0] : true;
518
+ this.trigger("DisableBrowse", q)
519
+ }, getFile:function (x) {
520
+ var w;
521
+ for (w = u.length - 1; w >= 0; w--) {
522
+ if (u[w].id === x) {
523
+ return u[w]
524
+ }
525
+ }
526
+ }, removeFile:function (x) {
527
+ var w;
528
+ for (w = u.length - 1; w >= 0; w--) {
529
+ if (u[w].id === x.id) {
530
+ return this.splice(w, 1)[0]
531
+ }
532
+ }
533
+ }, splice:function (y, w) {
534
+ var x;
535
+ x = u.splice(y === b ? 0 : y, w === b ? u.length : w);
536
+ this.trigger("FilesRemoved", x);
537
+ this.trigger("QueueChanged");
538
+ return x
539
+ }, trigger:function (x) {
540
+ var z = p[x.toLowerCase()], y, w;
541
+ if (z) {
542
+ w = Array.prototype.slice.call(arguments);
543
+ w[0] = this;
544
+ for (y = 0; y < z.length; y++) {
545
+ if (z[y].func.apply(z[y].scope, w) === false) {
546
+ return false
547
+ }
548
+ }
549
+ }
550
+ return true
551
+ }, hasEventListener:function (w) {
552
+ return !!p[w.toLowerCase()]
553
+ }, bind:function (w, y, x) {
554
+ var z;
555
+ w = w.toLowerCase();
556
+ z = p[w] || [];
557
+ z.push({func:y, scope:x || this});
558
+ p[w] = z
559
+ }, unbind:function (w) {
560
+ w = w.toLowerCase();
561
+ var z = p[w], x, y = arguments[1];
562
+ if (z) {
563
+ if (y !== b) {
564
+ for (x = z.length - 1; x >= 0; x--) {
565
+ if (z[x].func === y) {
566
+ z.splice(x, 1);
567
+ break
568
+ }
569
+ }
570
+ } else {
571
+ z = []
572
+ }
573
+ if (!z.length) {
574
+ delete p[w]
575
+ }
576
+ }
577
+ }, unbindAll:function () {
578
+ var w = this;
579
+ g.each(p, function (y, x) {
580
+ w.unbind(x)
581
+ })
582
+ }, destroy:function () {
583
+ this.stop();
584
+ this.trigger("Destroy");
585
+ this.unbindAll()
586
+ }})
587
+ };
588
+ g.File = function (r, p, q) {
589
+ var o = this;
590
+ o.id = r;
591
+ o.name = p;
592
+ o.size = q;
593
+ o.loaded = 0;
594
+ o.percent = 0;
595
+ o.status = 0
596
+ };
597
+ g.Runtime = function () {
598
+ this.getFeatures = function () {
599
+ };
600
+ this.init = function (o, p) {
601
+ }
602
+ };
603
+ g.QueueProgress = function () {
604
+ var o = this;
605
+ o.size = 0;
606
+ o.loaded = 0;
607
+ o.uploaded = 0;
608
+ o.failed = 0;
609
+ o.queued = 0;
610
+ o.percent = 0;
611
+ o.bytesPerSec = 0;
612
+ o.reset = function () {
613
+ o.size = o.loaded = o.uploaded = o.failed = o.queued = o.percent = o.bytesPerSec = 0
614
+ }
615
+ };
616
+ g.runtimes = {};
617
+ window.plupload = g
618
+ })();
619
+ (function () {
620
+ if (window.google && google.gears) {
621
+ return
622
+ }
623
+ var a = null;
624
+ if (typeof GearsFactory != "undefined") {
625
+ a = new GearsFactory()
626
+ } else {
627
+ try {
628
+ a = new ActiveXObject("Gears.Factory");
629
+ if (a.getBuildInfo().indexOf("ie_mobile") != -1) {
630
+ a.privateSetGlobalObject(this)
631
+ }
632
+ } catch (b) {
633
+ if ((typeof navigator.mimeTypes != "undefined") && navigator.mimeTypes["application/x-googlegears"]) {
634
+ a = document.createElement("object");
635
+ a.style.display = "none";
636
+ a.width = 0;
637
+ a.height = 0;
638
+ a.type = "application/x-googlegears";
639
+ document.documentElement.appendChild(a)
640
+ }
641
+ }
642
+ }
643
+ if (!a) {
644
+ return
645
+ }
646
+ if (!window.google) {
647
+ window.google = {}
648
+ }
649
+ if (!google.gears) {
650
+ google.gears = {factory:a}
651
+ }
652
+ })();
653
+ (function (e, b, c, d) {
654
+ var f = {};
655
+
656
+ function a(h, k, m) {
657
+ var g, j, l, o;
658
+ j = google.gears.factory.create("beta.canvas");
659
+ try {
660
+ j.decode(h);
661
+ if (!k.width) {
662
+ k.width = j.width
663
+ }
664
+ if (!k.height) {
665
+ k.height = j.height
666
+ }
667
+ o = Math.min(width / j.width, height / j.height);
668
+ if (o < 1 || (o === 1 && m === "image/jpeg")) {
669
+ j.resize(Math.round(j.width * o), Math.round(j.height * o));
670
+ if (k.quality) {
671
+ return j.encode(m, {quality:k.quality / 100})
672
+ }
673
+ return j.encode(m)
674
+ }
675
+ } catch (n) {
676
+ }
677
+ return h
678
+ }
679
+
680
+ c.runtimes.Gears = c.addRuntime("gears", {getFeatures:function () {
681
+ return{dragdrop:true, jpgresize:true, pngresize:true, chunks:true, progress:true, multipart:true, multi_selection:true}
682
+ }, init:function (l, n) {
683
+ var m, h, g = false;
684
+ if (!e.google || !google.gears) {
685
+ return n({success:false})
686
+ }
687
+ try {
688
+ m = google.gears.factory.create("beta.desktop")
689
+ } catch (k) {
690
+ return n({success:false})
691
+ }
692
+ function j(q) {
693
+ var p, o, r = [], s;
694
+ for (o = 0; o < q.length; o++) {
695
+ p = q[o];
696
+ s = c.guid();
697
+ f[s] = p.blob;
698
+ r.push(new c.File(s, p.name, p.blob.length))
699
+ }
700
+ l.trigger("FilesAdded", r)
701
+ }
702
+
703
+ l.bind("PostInit", function () {
704
+ var p = l.settings, o = b.getElementById(p.drop_element);
705
+ if (o) {
706
+ c.addEvent(o, "dragover", function (q) {
707
+ m.setDropEffect(q, "copy");
708
+ q.preventDefault()
709
+ }, l.id);
710
+ c.addEvent(o, "drop", function (r) {
711
+ var q = m.getDragData(r, "application/x-gears-files");
712
+ if (q) {
713
+ j(q.files)
714
+ }
715
+ r.preventDefault()
716
+ }, l.id);
717
+ o = 0
718
+ }
719
+ c.addEvent(b.getElementById(p.browse_button), "click", function (u) {
720
+ var t = [], r, q, s;
721
+ u.preventDefault();
722
+ if (g) {
723
+ return
724
+ }
725
+ no_type_restriction:for (r = 0; r < p.filters.length; r++) {
726
+ s = p.filters[r].extensions.split(",");
727
+ for (q = 0; q < s.length; q++) {
728
+ if (s[q] === "*") {
729
+ t = [];
730
+ break no_type_restriction
731
+ }
732
+ t.push("." + s[q])
733
+ }
734
+ }
735
+ m.openFiles(j, {singleFile:!p.multi_selection, filter:t})
736
+ }, l.id)
737
+ });
738
+ l.bind("CancelUpload", function () {
739
+ if (h.abort) {
740
+ h.abort()
741
+ }
742
+ });
743
+ l.bind("UploadFile", function (u, r) {
744
+ var w = 0, v, s, t = 0, q = u.settings.resize, o;
745
+ if (q && /\.(png|jpg|jpeg)$/i.test(r.name)) {
746
+ f[r.id] = a(f[r.id], q, /\.png$/i.test(r.name) ? "image/png" : "image/jpeg")
747
+ }
748
+ r.size = f[r.id].length;
749
+ s = u.settings.chunk_size;
750
+ o = s > 0;
751
+ v = Math.ceil(r.size / s);
752
+ if (!o) {
753
+ s = r.size;
754
+ v = 1
755
+ }
756
+ function p() {
757
+ var C, y = u.settings.multipart, x = 0, B = {name:r.target_name || r.name}, z = u.settings.url;
758
+
759
+ function A(E) {
760
+ var D, J = "----pluploadboundary" + c.guid(), G = "--", I = "\r\n", F, H;
761
+ if (y) {
762
+ h.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + J);
763
+ D = google.gears.factory.create("beta.blobbuilder");
764
+ c.each(c.extend(B, u.settings.multipart_params), function (L, K) {
765
+ D.append(G + J + I + 'Content-Disposition: form-data; name="' + K + '"' + I + I);
766
+ D.append(L + I)
767
+ });
768
+ H = c.mimeTypes[r.name.replace(/^.+\.([^.]+)/, "$1").toLowerCase()] || "application/octet-stream";
769
+ D.append(G + J + I + 'Content-Disposition: form-data; name="' + u.settings.file_data_name + '"; filename="' + r.name + '"' + I + "Content-Type: " + H + I + I);
770
+ D.append(E);
771
+ D.append(I + G + J + G + I);
772
+ F = D.getAsBlob();
773
+ x = F.length - E.length;
774
+ E = F
775
+ }
776
+ h.send(E)
777
+ }
778
+
779
+ if (r.status == c.DONE || r.status == c.FAILED || u.state == c.STOPPED) {
780
+ return
781
+ }
782
+ if (o) {
783
+ B.chunk = w;
784
+ B.chunks = v
785
+ }
786
+ C = Math.min(s, r.size - (w * s));
787
+ if (!y) {
788
+ z = c.buildUrl(u.settings.url, B)
789
+ }
790
+ h = google.gears.factory.create("beta.httprequest");
791
+ h.open("POST", z);
792
+ if (!y) {
793
+ h.setRequestHeader("Content-Disposition", 'attachment; filename="' + r.name + '"');
794
+ h.setRequestHeader("Content-Type", "application/octet-stream")
795
+ }
796
+ c.each(u.settings.headers, function (E, D) {
797
+ h.setRequestHeader(D, E)
798
+ });
799
+ h.upload.onprogress = function (D) {
800
+ r.loaded = t + D.loaded - x;
801
+ u.trigger("UploadProgress", r)
802
+ };
803
+ h.onreadystatechange = function () {
804
+ var D;
805
+ if (h.readyState == 4 && u.state !== c.STOPPED) {
806
+ if (h.status == 200) {
807
+ D = {chunk:w, chunks:v, response:h.responseText, status:h.status};
808
+ u.trigger("ChunkUploaded", r, D);
809
+ if (D.cancelled) {
810
+ r.status = c.FAILED;
811
+ return
812
+ }
813
+ t += C;
814
+ if (++w >= v) {
815
+ r.status = c.DONE;
816
+ u.trigger("FileUploaded", r, {response:h.responseText, status:h.status})
817
+ } else {
818
+ p()
819
+ }
820
+ } else {
821
+ u.trigger("Error", {code:c.HTTP_ERROR, message:c.translate("HTTP Error."), file:r, chunk:w, chunks:v, status:h.status})
822
+ }
823
+ }
824
+ };
825
+ if (w < v) {
826
+ A(f[r.id].slice(w * s, C))
827
+ }
828
+ }
829
+
830
+ p()
831
+ });
832
+ l.bind("DisableBrowse", function (o, p) {
833
+ g = p
834
+ });
835
+ l.bind("Destroy", function (o) {
836
+ var p, q, r = {browseButton:o.settings.browse_button, dropElm:o.settings.drop_element};
837
+ for (p in r) {
838
+ q = b.getElementById(r[p]);
839
+ if (q) {
840
+ c.removeAllEvents(q, o.id)
841
+ }
842
+ }
843
+ });
844
+ n({success:true})
845
+ }})
846
+ })(window, document, plupload);
847
+ (function (g, b, d, e) {
848
+ var a = {}, h = {};
849
+
850
+ function c(o) {
851
+ var n, m = typeof o, j, l, k;
852
+ if (o === e || o === null) {
853
+ return"null"
854
+ }
855
+ if (m === "string") {
856
+ n = "\bb\tt\nn\ff\rr\"\"''\\\\";
857
+ return'"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function (r, q) {
858
+ var p = n.indexOf(q);
859
+ if (p + 1) {
860
+ return"\\" + n.charAt(p + 1)
861
+ }
862
+ r = q.charCodeAt().toString(16);
863
+ return"\\u" + "0000".substring(r.length) + r
864
+ }) + '"'
865
+ }
866
+ if (m == "object") {
867
+ j = o.length !== e;
868
+ n = "";
869
+ if (j) {
870
+ for (l = 0; l < o.length; l++) {
871
+ if (n) {
872
+ n += ","
873
+ }
874
+ n += c(o[l])
875
+ }
876
+ n = "[" + n + "]"
877
+ } else {
878
+ for (k in o) {
879
+ if (o.hasOwnProperty(k)) {
880
+ if (n) {
881
+ n += ","
882
+ }
883
+ n += c(k) + ":" + c(o[k])
884
+ }
885
+ }
886
+ n = "{" + n + "}"
887
+ }
888
+ return n
889
+ }
890
+ return"" + o
891
+ }
892
+
893
+ function f(s) {
894
+ var v = false, j = null, o = null, k, l, m, u, n, q = 0;
895
+ try {
896
+ try {
897
+ o = new ActiveXObject("AgControl.AgControl");
898
+ if (o.IsVersionSupported(s)) {
899
+ v = true
900
+ }
901
+ o = null
902
+ } catch (r) {
903
+ var p = navigator.plugins["Silverlight Plug-In"];
904
+ if (p) {
905
+ k = p.description;
906
+ if (k === "1.0.30226.2") {
907
+ k = "2.0.30226.2"
908
+ }
909
+ l = k.split(".");
910
+ while (l.length > 3) {
911
+ l.pop()
912
+ }
913
+ while (l.length < 4) {
914
+ l.push(0)
915
+ }
916
+ m = s.split(".");
917
+ while (m.length > 4) {
918
+ m.pop()
919
+ }
920
+ do {
921
+ u = parseInt(m[q], 10);
922
+ n = parseInt(l[q], 10);
923
+ q++
924
+ } while (q < m.length && u === n);
925
+ if (u <= n && !isNaN(u)) {
926
+ v = true
927
+ }
928
+ }
929
+ }
930
+ } catch (t) {
931
+ v = false
932
+ }
933
+ return v
934
+ }
935
+
936
+ d.silverlight = {trigger:function (n, k) {
937
+ var m = a[n], l, j;
938
+ if (m) {
939
+ j = d.toArray(arguments).slice(1);
940
+ j[0] = "Silverlight:" + k;
941
+ setTimeout(function () {
942
+ m.trigger.apply(m, j)
943
+ }, 0)
944
+ }
945
+ }};
946
+ d.runtimes.Silverlight = d.addRuntime("silverlight", {getFeatures:function () {
947
+ return{jpgresize:true, pngresize:true, chunks:true, progress:true, multipart:true, multi_selection:true}
948
+ }, init:function (p, q) {
949
+ var o, m = "", n = p.settings.filters, l, k = b.body;
950
+ if (!f("2.0.31005.0") || (g.opera && g.opera.buildNumber)) {
951
+ q({success:false});
952
+ return
953
+ }
954
+ h[p.id] = false;
955
+ a[p.id] = p;
956
+ o = b.createElement("div");
957
+ o.id = p.id + "_silverlight_container";
958
+ d.extend(o.style, {position:"absolute", top:"0px", background:p.settings.shim_bgcolor || "transparent", zIndex:99999, width:"100px", height:"100px", overflow:"hidden", opacity:p.settings.shim_bgcolor || b.documentMode > 8 ? "" : 0.01});
959
+ o.className = "plupload silverlight";
960
+ if (p.settings.container) {
961
+ k = b.getElementById(p.settings.container);
962
+ if (d.getStyle(k, "position") === "static") {
963
+ k.style.position = "relative"
964
+ }
965
+ }
966
+ k.appendChild(o);
967
+ for (l = 0; l < n.length; l++) {
968
+ m += (m != "" ? "|" : "") + n[l].title + " | *." + n[l].extensions.replace(/,/g, ";*.")
969
+ }
970
+ o.innerHTML = '<object id="' + p.id + '_silverlight" data="data:application/x-silverlight," type="application/x-silverlight-2" style="outline:none;" width="1024" height="1024"><param name="source" value="' + p.settings.silverlight_xap_url + '"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="enablehtmlaccess" value="true"/><param name="initParams" value="id=' + p.id + ",filter=" + m + ",multiselect=" + p.settings.multi_selection + '"/></object>';
971
+ function j() {
972
+ return b.getElementById(p.id + "_silverlight").content.Upload
973
+ }
974
+
975
+ p.bind("Silverlight:Init", function () {
976
+ var r, s = {};
977
+ if (h[p.id]) {
978
+ return
979
+ }
980
+ h[p.id] = true;
981
+ p.bind("Silverlight:StartSelectFiles", function (t) {
982
+ r = []
983
+ });
984
+ p.bind("Silverlight:SelectFile", function (t, w, u, v) {
985
+ var x;
986
+ x = d.guid();
987
+ s[x] = w;
988
+ s[w] = x;
989
+ r.push(new d.File(x, u, v))
990
+ });
991
+ p.bind("Silverlight:SelectSuccessful", function () {
992
+ if (r.length) {
993
+ p.trigger("FilesAdded", r)
994
+ }
995
+ });
996
+ p.bind("Silverlight:UploadChunkError", function (t, w, u, x, v) {
997
+ p.trigger("Error", {code:d.IO_ERROR, message:"IO Error.", details:v, file:t.getFile(s[w])})
998
+ });
999
+ p.bind("Silverlight:UploadFileProgress", function (t, x, u, w) {
1000
+ var v = t.getFile(s[x]);
1001
+ if (v.status != d.FAILED) {
1002
+ v.size = w;
1003
+ v.loaded = u;
1004
+ t.trigger("UploadProgress", v)
1005
+ }
1006
+ });
1007
+ p.bind("Refresh", function (t) {
1008
+ var u, v, w;
1009
+ u = b.getElementById(t.settings.browse_button);
1010
+ if (u) {
1011
+ v = d.getPos(u, b.getElementById(t.settings.container));
1012
+ w = d.getSize(u);
1013
+ d.extend(b.getElementById(t.id + "_silverlight_container").style, {top:v.y + "px", left:v.x + "px", width:w.w + "px", height:w.h + "px"})
1014
+ }
1015
+ });
1016
+ p.bind("Silverlight:UploadChunkSuccessful", function (t, w, u, z, y) {
1017
+ var x, v = t.getFile(s[w]);
1018
+ x = {chunk:u, chunks:z, response:y};
1019
+ t.trigger("ChunkUploaded", v, x);
1020
+ if (v.status != d.FAILED && t.state !== d.STOPPED) {
1021
+ j().UploadNextChunk()
1022
+ }
1023
+ if (u == z - 1) {
1024
+ v.status = d.DONE;
1025
+ t.trigger("FileUploaded", v, {response:y})
1026
+ }
1027
+ });
1028
+ p.bind("Silverlight:UploadSuccessful", function (t, w, u) {
1029
+ var v = t.getFile(s[w]);
1030
+ v.status = d.DONE;
1031
+ t.trigger("FileUploaded", v, {response:u})
1032
+ });
1033
+ p.bind("FilesRemoved", function (t, v) {
1034
+ var u;
1035
+ for (u = 0; u < v.length; u++) {
1036
+ j().RemoveFile(s[v[u].id])
1037
+ }
1038
+ });
1039
+ p.bind("UploadFile", function (t, v) {
1040
+ var w = t.settings, u = w.resize || {};
1041
+ j().UploadFile(s[v.id], t.settings.url, c({name:v.target_name || v.name, mime:d.mimeTypes[v.name.replace(/^.+\.([^.]+)/, "$1").toLowerCase()] || "application/octet-stream", chunk_size:w.chunk_size, image_width:u.width, image_height:u.height, image_quality:u.quality || 90, multipart:!!w.multipart, multipart_params:w.multipart_params || {}, file_data_name:w.file_data_name, headers:w.headers}))
1042
+ });
1043
+ p.bind("CancelUpload", function () {
1044
+ j().CancelUpload()
1045
+ });
1046
+ p.bind("Silverlight:MouseEnter", function (t) {
1047
+ var u, v;
1048
+ u = b.getElementById(p.settings.browse_button);
1049
+ v = t.settings.browse_button_hover;
1050
+ if (u && v) {
1051
+ d.addClass(u, v)
1052
+ }
1053
+ });
1054
+ p.bind("Silverlight:MouseLeave", function (t) {
1055
+ var u, v;
1056
+ u = b.getElementById(p.settings.browse_button);
1057
+ v = t.settings.browse_button_hover;
1058
+ if (u && v) {
1059
+ d.removeClass(u, v)
1060
+ }
1061
+ });
1062
+ p.bind("Silverlight:MouseLeftButtonDown", function (t) {
1063
+ var u, v;
1064
+ u = b.getElementById(p.settings.browse_button);
1065
+ v = t.settings.browse_button_active;
1066
+ if (u && v) {
1067
+ d.addClass(u, v);
1068
+ d.addEvent(b.body, "mouseup", function () {
1069
+ d.removeClass(u, v)
1070
+ })
1071
+ }
1072
+ });
1073
+ p.bind("Sliverlight:StartSelectFiles", function (t) {
1074
+ var u, v;
1075
+ u = b.getElementById(p.settings.browse_button);
1076
+ v = t.settings.browse_button_active;
1077
+ if (u && v) {
1078
+ d.removeClass(u, v)
1079
+ }
1080
+ });
1081
+ p.bind("DisableBrowse", function (t, u) {
1082
+ j().DisableBrowse(u)
1083
+ });
1084
+ p.bind("Destroy", function (t) {
1085
+ var u;
1086
+ d.removeAllEvents(b.body, t.id);
1087
+ delete h[t.id];
1088
+ delete a[t.id];
1089
+ u = b.getElementById(t.id + "_silverlight_container");
1090
+ if (u) {
1091
+ k.removeChild(u)
1092
+ }
1093
+ });
1094
+ q({success:true})
1095
+ })
1096
+ }})
1097
+ })(window, document, plupload);
1098
+ (function (f, b, d, e) {
1099
+ var a = {}, g = {};
1100
+
1101
+ function c() {
1102
+ var h;
1103
+ try {
1104
+ h = navigator.plugins["Shockwave Flash"];
1105
+ h = h.description
1106
+ } catch (k) {
1107
+ try {
1108
+ h = new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")
1109
+ } catch (j) {
1110
+ h = "0.0"
1111
+ }
1112
+ }
1113
+ h = h.match(/\d+/g);
1114
+ return parseFloat(h[0] + "." + h[1])
1115
+ }
1116
+
1117
+ d.flash = {trigger:function (k, h, j) {
1118
+ setTimeout(function () {
1119
+ var n = a[k], m, l;
1120
+ if (n) {
1121
+ n.trigger("Flash:" + h, j)
1122
+ }
1123
+ }, 0)
1124
+ }};
1125
+ d.runtimes.Flash = d.addRuntime("flash", {getFeatures:function () {
1126
+ return{jpgresize:true, pngresize:true, maxWidth:8091, maxHeight:8091, chunks:true, progress:true, multipart:true, multi_selection:true}
1127
+ }, init:function (n, p) {
1128
+ var l, m, h = 0, j = b.body;
1129
+ if (c() < 10) {
1130
+ p({success:false});
1131
+ return
1132
+ }
1133
+ g[n.id] = false;
1134
+ a[n.id] = n;
1135
+ l = b.getElementById(n.settings.browse_button);
1136
+ m = b.createElement("div");
1137
+ m.id = n.id + "_flash_container";
1138
+ d.extend(m.style, {position:"absolute", top:"0px", background:n.settings.shim_bgcolor || "transparent", zIndex:99999, width:"100%", height:"100%"});
1139
+ m.className = "plupload flash";
1140
+ if (n.settings.container) {
1141
+ j = b.getElementById(n.settings.container);
1142
+ if (d.getStyle(j, "position") === "static") {
1143
+ j.style.position = "relative"
1144
+ }
1145
+ }
1146
+ j.appendChild(m);
1147
+ (function () {
1148
+ var q, r;
1149
+ q = '<object id="' + n.id + '_flash" type="application/x-shockwave-flash" data="' + n.settings.flash_swf_url + '" ';
1150
+ if (d.ua.ie) {
1151
+ q += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '
1152
+ }
1153
+ q += 'width="100%" height="100%" style="outline:0"><param name="movie" value="' + n.settings.flash_swf_url + '" /><param name="flashvars" value="id=' + escape(n.id) + '" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>';
1154
+ if (d.ua.ie) {
1155
+ r = b.createElement("div");
1156
+ m.appendChild(r);
1157
+ r.outerHTML = q;
1158
+ r = null
1159
+ } else {
1160
+ m.innerHTML = q
1161
+ }
1162
+ }());
1163
+ function o() {
1164
+ return b.getElementById(n.id + "_flash")
1165
+ }
1166
+
1167
+ function k() {
1168
+ if (h++ > 5000) {
1169
+ p({success:false});
1170
+ return
1171
+ }
1172
+ if (g[n.id] === false) {
1173
+ setTimeout(k, 1)
1174
+ }
1175
+ }
1176
+
1177
+ k();
1178
+ l = m = null;
1179
+ n.bind("Destroy", function (q) {
1180
+ var r;
1181
+ d.removeAllEvents(b.body, q.id);
1182
+ delete g[q.id];
1183
+ delete a[q.id];
1184
+ r = b.getElementById(q.id + "_flash_container");
1185
+ if (r) {
1186
+ j.removeChild(r)
1187
+ }
1188
+ });
1189
+ n.bind("Flash:Init", function () {
1190
+ var s = {}, r;
1191
+ try {
1192
+ o().setFileFilters(n.settings.filters, n.settings.multi_selection)
1193
+ } catch (q) {
1194
+ p({success:false});
1195
+ return
1196
+ }
1197
+ if (g[n.id]) {
1198
+ return
1199
+ }
1200
+ g[n.id] = true;
1201
+ n.bind("UploadFile", function (t, v) {
1202
+ var w = t.settings, u = n.settings.resize || {};
1203
+ o().uploadFile(s[v.id], w.url, {name:v.target_name || v.name, mime:d.mimeTypes[v.name.replace(/^.+\.([^.]+)/, "$1").toLowerCase()] || "application/octet-stream", chunk_size:w.chunk_size, width:u.width, height:u.height, quality:u.quality, multipart:w.multipart, multipart_params:w.multipart_params || {}, file_data_name:w.file_data_name, format:/\.(jpg|jpeg)$/i.test(v.name) ? "jpg" : "png", headers:w.headers, urlstream_upload:w.urlstream_upload})
1204
+ });
1205
+ n.bind("CancelUpload", function () {
1206
+ o().cancelUpload()
1207
+ });
1208
+ n.bind("Flash:UploadProcess", function (u, t) {
1209
+ var v = u.getFile(s[t.id]);
1210
+ if (v.status != d.FAILED) {
1211
+ v.loaded = t.loaded;
1212
+ v.size = t.size;
1213
+ u.trigger("UploadProgress", v)
1214
+ }
1215
+ });
1216
+ n.bind("Flash:UploadChunkComplete", function (t, v) {
1217
+ var w, u = t.getFile(s[v.id]);
1218
+ w = {chunk:v.chunk, chunks:v.chunks, response:v.text};
1219
+ t.trigger("ChunkUploaded", u, w);
1220
+ if (u.status !== d.FAILED && t.state !== d.STOPPED) {
1221
+ o().uploadNextChunk()
1222
+ }
1223
+ if (v.chunk == v.chunks - 1) {
1224
+ u.status = d.DONE;
1225
+ t.trigger("FileUploaded", u, {response:v.text})
1226
+ }
1227
+ });
1228
+ n.bind("Flash:SelectFiles", function (t, w) {
1229
+ var v, u, x = [], y;
1230
+ for (u = 0; u < w.length; u++) {
1231
+ v = w[u];
1232
+ y = d.guid();
1233
+ s[y] = v.id;
1234
+ s[v.id] = y;
1235
+ x.push(new d.File(y, v.name, v.size))
1236
+ }
1237
+ if (x.length) {
1238
+ n.trigger("FilesAdded", x)
1239
+ }
1240
+ });
1241
+ n.bind("Flash:SecurityError", function (t, u) {
1242
+ n.trigger("Error", {code:d.SECURITY_ERROR, message:d.translate("Security error."), details:u.message, file:n.getFile(s[u.id])})
1243
+ });
1244
+ n.bind("Flash:GenericError", function (t, u) {
1245
+ n.trigger("Error", {code:d.GENERIC_ERROR, message:d.translate("Generic error."), details:u.message, file:n.getFile(s[u.id])})
1246
+ });
1247
+ n.bind("Flash:IOError", function (t, u) {
1248
+ n.trigger("Error", {code:d.IO_ERROR, message:d.translate("IO error."), details:u.message, file:n.getFile(s[u.id])})
1249
+ });
1250
+ n.bind("Flash:ImageError", function (t, u) {
1251
+ n.trigger("Error", {code:parseInt(u.code, 10), message:d.translate("Image error."), file:n.getFile(s[u.id])})
1252
+ });
1253
+ n.bind("Flash:StageEvent:rollOver", function (t) {
1254
+ var u, v;
1255
+ u = b.getElementById(n.settings.browse_button);
1256
+ v = t.settings.browse_button_hover;
1257
+ if (u && v) {
1258
+ d.addClass(u, v)
1259
+ }
1260
+ });
1261
+ n.bind("Flash:StageEvent:rollOut", function (t) {
1262
+ var u, v;
1263
+ u = b.getElementById(n.settings.browse_button);
1264
+ v = t.settings.browse_button_hover;
1265
+ if (u && v) {
1266
+ d.removeClass(u, v)
1267
+ }
1268
+ });
1269
+ n.bind("Flash:StageEvent:mouseDown", function (t) {
1270
+ var u, v;
1271
+ u = b.getElementById(n.settings.browse_button);
1272
+ v = t.settings.browse_button_active;
1273
+ if (u && v) {
1274
+ d.addClass(u, v);
1275
+ d.addEvent(b.body, "mouseup", function () {
1276
+ d.removeClass(u, v)
1277
+ }, t.id)
1278
+ }
1279
+ });
1280
+ n.bind("Flash:StageEvent:mouseUp", function (t) {
1281
+ var u, v;
1282
+ u = b.getElementById(n.settings.browse_button);
1283
+ v = t.settings.browse_button_active;
1284
+ if (u && v) {
1285
+ d.removeClass(u, v)
1286
+ }
1287
+ });
1288
+ n.bind("Flash:ExifData", function (t, u) {
1289
+ n.trigger("ExifData", n.getFile(s[u.id]), u.data)
1290
+ });
1291
+ n.bind("Flash:GpsData", function (t, u) {
1292
+ n.trigger("GpsData", n.getFile(s[u.id]), u.data)
1293
+ });
1294
+ n.bind("QueueChanged", function (t) {
1295
+ n.refresh()
1296
+ });
1297
+ n.bind("FilesRemoved", function (t, v) {
1298
+ var u;
1299
+ for (u = 0; u < v.length; u++) {
1300
+ o().removeFile(s[v[u].id])
1301
+ }
1302
+ });
1303
+ n.bind("StateChanged", function (t) {
1304
+ n.refresh()
1305
+ });
1306
+ n.bind("Refresh", function (t) {
1307
+ var u, v, w;
1308
+ o().setFileFilters(n.settings.filters, n.settings.multi_selection);
1309
+ u = b.getElementById(t.settings.browse_button);
1310
+ if (u) {
1311
+ v = d.getPos(u, b.getElementById(t.settings.container));
1312
+ w = d.getSize(u);
1313
+ d.extend(b.getElementById(t.id + "_flash_container").style, {top:v.y + "px", left:v.x + "px", width:w.w + "px", height:w.h + "px"})
1314
+ }
1315
+ });
1316
+ n.bind("DisableBrowse", function (t, u) {
1317
+ o().disableBrowse(u)
1318
+ });
1319
+ p({success:true})
1320
+ })
1321
+ }})
1322
+ })(window, document, plupload);
1323
+ (function (a) {
1324
+ a.runtimes.BrowserPlus = a.addRuntime("browserplus", {getFeatures:function () {
1325
+ return{dragdrop:true, jpgresize:true, pngresize:true, chunks:true, progress:true, multipart:true, multi_selection:true}
1326
+ }, init:function (g, j) {
1327
+ var e = window.BrowserPlus, h = {}, d = g.settings, c = d.resize;
1328
+
1329
+ function f(o) {
1330
+ var n, m, k = [], l, p;
1331
+ for (m = 0; m < o.length; m++) {
1332
+ l = o[m];
1333
+ p = a.guid();
1334
+ h[p] = l;
1335
+ k.push(new a.File(p, l.name, l.size))
1336
+ }
1337
+ if (m) {
1338
+ g.trigger("FilesAdded", k)
1339
+ }
1340
+ }
1341
+
1342
+ function b() {
1343
+ var k = false;
1344
+ g.bind("PostInit", function () {
1345
+ var o, m = d.drop_element, q = g.id + "_droptarget", l = document.getElementById(m), n;
1346
+
1347
+ function r(t, s) {
1348
+ e.DragAndDrop.AddDropTarget({id:t}, function (u) {
1349
+ e.DragAndDrop.AttachCallbacks({id:t, hover:function (v) {
1350
+ if (!v && s) {
1351
+ s()
1352
+ }
1353
+ }, drop:function (v) {
1354
+ if (s) {
1355
+ s()
1356
+ }
1357
+ f(v)
1358
+ }}, function () {
1359
+ })
1360
+ })
1361
+ }
1362
+
1363
+ function p() {
1364
+ document.getElementById(q).style.top = "-1000px"
1365
+ }
1366
+
1367
+ if (l) {
1368
+ if (document.attachEvent && (/MSIE/gi).test(navigator.userAgent)) {
1369
+ o = document.createElement("div");
1370
+ o.setAttribute("id", q);
1371
+ a.extend(o.style, {position:"absolute", top:"-1000px", background:"red", filter:"alpha(opacity=0)", opacity:0});
1372
+ document.body.appendChild(o);
1373
+ a.addEvent(l, "dragenter", function (t) {
1374
+ var s, u;
1375
+ s = document.getElementById(m);
1376
+ u = a.getPos(s);
1377
+ a.extend(document.getElementById(q).style, {top:u.y + "px", left:u.x + "px", width:s.offsetWidth + "px", height:s.offsetHeight + "px"})
1378
+ });
1379
+ r(q, p)
1380
+ } else {
1381
+ r(m)
1382
+ }
1383
+ }
1384
+ a.addEvent(document.getElementById(d.browse_button), "click", function (y) {
1385
+ var s = [], u, t, x = d.filters, w, v;
1386
+ y.preventDefault();
1387
+ if (k) {
1388
+ return
1389
+ }
1390
+ no_type_restriction:for (u = 0; u < x.length; u++) {
1391
+ w = x[u].extensions.split(",");
1392
+ for (t = 0; t < w.length; t++) {
1393
+ if (w[t] === "*") {
1394
+ s = [];
1395
+ break no_type_restriction
1396
+ }
1397
+ v = a.mimeTypes[w[t]];
1398
+ if (v && a.inArray(v, s) === -1) {
1399
+ s.push(a.mimeTypes[w[t]])
1400
+ }
1401
+ }
1402
+ }
1403
+ e.FileBrowse.OpenBrowseDialog({mimeTypes:s}, function (z) {
1404
+ if (z.success) {
1405
+ f(z.value)
1406
+ }
1407
+ })
1408
+ });
1409
+ l = o = null
1410
+ });
1411
+ g.bind("CancelUpload", function () {
1412
+ e.Uploader.cancel({}, function () {
1413
+ })
1414
+ });
1415
+ g.bind("DisableBrowse", function (l, m) {
1416
+ k = m
1417
+ });
1418
+ g.bind("UploadFile", function (o, l) {
1419
+ var n = h[l.id], t = {}, m = o.settings.chunk_size, p, q = [];
1420
+
1421
+ function s(u, w) {
1422
+ var v;
1423
+ if (l.status == a.FAILED) {
1424
+ return
1425
+ }
1426
+ t.name = l.target_name || l.name;
1427
+ if (m) {
1428
+ t.chunk = "" + u;
1429
+ t.chunks = "" + w
1430
+ }
1431
+ v = q.shift();
1432
+ e.Uploader.upload({url:o.settings.url, files:{file:v}, cookies:document.cookies, postvars:a.extend(t, o.settings.multipart_params), progressCallback:function (z) {
1433
+ var y, x = 0;
1434
+ p[u] = parseInt(z.filePercent * v.size / 100, 10);
1435
+ for (y = 0; y < p.length; y++) {
1436
+ x += p[y]
1437
+ }
1438
+ l.loaded = x;
1439
+ o.trigger("UploadProgress", l)
1440
+ }}, function (y) {
1441
+ var x, z;
1442
+ if (y.success) {
1443
+ x = y.value.statusCode;
1444
+ if (m) {
1445
+ o.trigger("ChunkUploaded", l, {chunk:u, chunks:w, response:y.value.body, status:x})
1446
+ }
1447
+ if (q.length > 0) {
1448
+ s(++u, w)
1449
+ } else {
1450
+ l.status = a.DONE;
1451
+ o.trigger("FileUploaded", l, {response:y.value.body, status:x});
1452
+ if (x >= 400) {
1453
+ o.trigger("Error", {code:a.HTTP_ERROR, message:a.translate("HTTP Error."), file:l, status:x})
1454
+ }
1455
+ }
1456
+ } else {
1457
+ o.trigger("Error", {code:a.GENERIC_ERROR, message:a.translate("Generic Error."), file:l, details:y.error})
1458
+ }
1459
+ })
1460
+ }
1461
+
1462
+ function r(u) {
1463
+ l.size = u.size;
1464
+ if (m) {
1465
+ e.FileAccess.chunk({file:u, chunkSize:m}, function (x) {
1466
+ if (x.success) {
1467
+ var y = x.value, v = y.length;
1468
+ p = Array(v);
1469
+ for (var w = 0; w < v; w++) {
1470
+ p[w] = 0;
1471
+ q.push(y[w])
1472
+ }
1473
+ s(0, v)
1474
+ }
1475
+ })
1476
+ } else {
1477
+ p = Array(1);
1478
+ q.push(u);
1479
+ s(0, 1)
1480
+ }
1481
+ }
1482
+
1483
+ if (c && /\.(png|jpg|jpeg)$/i.test(l.name)) {
1484
+ BrowserPlus.ImageAlter.transform({file:n, quality:c.quality || 90, actions:[
1485
+ {scale:{maxwidth:c.width, maxheight:c.height}}
1486
+ ]}, function (u) {
1487
+ if (u.success) {
1488
+ r(u.value.file)
1489
+ }
1490
+ })
1491
+ } else {
1492
+ r(n)
1493
+ }
1494
+ });
1495
+ j({success:true})
1496
+ }
1497
+
1498
+ if (e) {
1499
+ e.init(function (l) {
1500
+ var k = [
1501
+ {service:"Uploader", version:"3"},
1502
+ {service:"DragAndDrop", version:"1"},
1503
+ {service:"FileBrowse", version:"1"},
1504
+ {service:"FileAccess", version:"2"}
1505
+ ];
1506
+ if (c) {
1507
+ k.push({service:"ImageAlter", version:"4"})
1508
+ }
1509
+ if (l.success) {
1510
+ e.require({services:k}, function (m) {
1511
+ if (m.success) {
1512
+ b()
1513
+ } else {
1514
+ j()
1515
+ }
1516
+ })
1517
+ } else {
1518
+ j()
1519
+ }
1520
+ })
1521
+ } else {
1522
+ j()
1523
+ }
1524
+ }})
1525
+ })(plupload);
1526
+ (function (h, k, j, e) {
1527
+ var c = {}, g;
1528
+
1529
+ function m(o, p) {
1530
+ var n;
1531
+ if ("FileReader" in h) {
1532
+ n = new FileReader();
1533
+ n.readAsDataURL(o);
1534
+ n.onload = function () {
1535
+ p(n.result)
1536
+ }
1537
+ } else {
1538
+ return p(o.getAsDataURL())
1539
+ }
1540
+ }
1541
+
1542
+ function l(o, p) {
1543
+ var n;
1544
+ if ("FileReader" in h) {
1545
+ n = new FileReader();
1546
+ n.readAsBinaryString(o);
1547
+ n.onload = function () {
1548
+ p(n.result)
1549
+ }
1550
+ } else {
1551
+ return p(o.getAsBinary())
1552
+ }
1553
+ }
1554
+
1555
+ function d(r, p, n, v) {
1556
+ var q, o, u, s, t = this;
1557
+ m(c[r.id], function (w) {
1558
+ q = k.createElement("canvas");
1559
+ q.style.display = "none";
1560
+ k.body.appendChild(q);
1561
+ o = q.getContext("2d");
1562
+ u = new Image();
1563
+ u.onerror = u.onabort = function () {
1564
+ v({success:false})
1565
+ };
1566
+ u.onload = function () {
1567
+ var B, x, z, y, A;
1568
+ if (!p.width) {
1569
+ p.width = u.width
1570
+ }
1571
+ if (!p.height) {
1572
+ p.height = u.height
1573
+ }
1574
+ s = Math.min(p.width / u.width, p.height / u.height);
1575
+ if (s < 1 || (s === 1 && n === "image/jpeg")) {
1576
+ B = Math.round(u.width * s);
1577
+ x = Math.round(u.height * s);
1578
+ q.width = B;
1579
+ q.height = x;
1580
+ o.drawImage(u, 0, 0, B, x);
1581
+ if (n === "image/jpeg") {
1582
+ y = new f(atob(w.substring(w.indexOf("base64,") + 7)));
1583
+ if (y.headers && y.headers.length) {
1584
+ A = new a();
1585
+ if (A.init(y.get("exif")[0])) {
1586
+ A.setExif("PixelXDimension", B);
1587
+ A.setExif("PixelYDimension", x);
1588
+ y.set("exif", A.getBinary());
1589
+ if (t.hasEventListener("ExifData")) {
1590
+ t.trigger("ExifData", r, A.EXIF())
1591
+ }
1592
+ if (t.hasEventListener("GpsData")) {
1593
+ t.trigger("GpsData", r, A.GPS())
1594
+ }
1595
+ }
1596
+ }
1597
+ if (p.quality) {
1598
+ try {
1599
+ w = q.toDataURL(n, p.quality / 100)
1600
+ } catch (C) {
1601
+ w = q.toDataURL(n)
1602
+ }
1603
+ }
1604
+ } else {
1605
+ w = q.toDataURL(n)
1606
+ }
1607
+ w = w.substring(w.indexOf("base64,") + 7);
1608
+ w = atob(w);
1609
+ if (y && y.headers && y.headers.length) {
1610
+ w = y.restore(w);
1611
+ y.purge()
1612
+ }
1613
+ q.parentNode.removeChild(q);
1614
+ v({success:true, data:w})
1615
+ } else {
1616
+ v({success:false})
1617
+ }
1618
+ };
1619
+ u.src = w
1620
+ })
1621
+ }
1622
+
1623
+ j.runtimes.Html5 = j.addRuntime("html5", {getFeatures:function () {
1624
+ var s, o, r, q, p, n;
1625
+ o = r = p = n = false;
1626
+ if (h.XMLHttpRequest) {
1627
+ s = new XMLHttpRequest();
1628
+ r = !!s.upload;
1629
+ o = !!(s.sendAsBinary || s.upload)
1630
+ }
1631
+ if (o) {
1632
+ q = !!(s.sendAsBinary || (h.Uint8Array && h.ArrayBuffer));
1633
+ p = !!(File && (File.prototype.getAsDataURL || h.FileReader) && q);
1634
+ n = !!(File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice))
1635
+ }
1636
+ g = j.ua.safari && j.ua.windows;
1637
+ return{html5:o, dragdrop:(function () {
1638
+ var t = k.createElement("div");
1639
+ return("draggable" in t) || ("ondragstart" in t && "ondrop" in t)
1640
+ }()), 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)}
1641
+ }, init:function (p, r) {
1642
+ var n, q;
1643
+
1644
+ function o(w) {
1645
+ var u, t, v = [], x, s = {};
1646
+ for (t = 0; t < w.length; t++) {
1647
+ u = w[t];
1648
+ if (s[u.name]) {
1649
+ continue
1650
+ }
1651
+ s[u.name] = true;
1652
+ x = j.guid();
1653
+ c[x] = u;
1654
+ v.push(new j.File(x, u.fileName || u.name, u.fileSize || u.size))
1655
+ }
1656
+ if (v.length) {
1657
+ p.trigger("FilesAdded", v)
1658
+ }
1659
+ }
1660
+
1661
+ n = this.getFeatures();
1662
+ if (!n.html5) {
1663
+ r({success:false});
1664
+ return
1665
+ }
1666
+ p.bind("Init", function (w) {
1667
+ var G, F, C = [], v, D, t = w.settings.filters, u, B, s = k.body, E;
1668
+ G = k.createElement("div");
1669
+ G.id = w.id + "_html5_container";
1670
+ 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});
1671
+ G.className = "plupload html5";
1672
+ if (p.settings.container) {
1673
+ s = k.getElementById(p.settings.container);
1674
+ if (j.getStyle(s, "position") === "static") {
1675
+ s.style.position = "relative"
1676
+ }
1677
+ }
1678
+ s.appendChild(G);
1679
+ no_type_restriction:for (v = 0; v < t.length; v++) {
1680
+ u = t[v].extensions.split(/,/);
1681
+ for (D = 0; D < u.length; D++) {
1682
+ if (u[D] === "*") {
1683
+ C = [];
1684
+ break no_type_restriction
1685
+ }
1686
+ B = j.mimeTypes[u[D]];
1687
+ if (B && j.inArray(B, C) === -1) {
1688
+ C.push(B)
1689
+ }
1690
+ }
1691
+ }
1692
+ G.innerHTML = '<input id="' + p.id + '_html5" style="font-size:999px" type="file" ' + (p.settings.multi_selection && p.features.multi_selection ? 'multiple="multiple"' : "") + " />";
1693
+ G.scrollTop = 100;
1694
+ E = k.getElementById(p.id + "_html5");
1695
+ if (w.features.triggerDialog) {
1696
+ j.extend(E.style, {position:"absolute", width:"100%", height:"100%"})
1697
+ } else {
1698
+ j.extend(E.style, {cssFloat:"right", styleFloat:"right"})
1699
+ }
1700
+ E.onchange = function () {
1701
+ o(this.files);
1702
+ this.value = ""
1703
+ };
1704
+ F = k.getElementById(w.settings.browse_button);
1705
+ if (F) {
1706
+ var z = w.settings.browse_button_hover, A = w.settings.browse_button_active, x = w.features.triggerDialog ? F : G;
1707
+ if (z) {
1708
+ j.addEvent(x, "mouseover", function () {
1709
+ j.addClass(F, z)
1710
+ }, w.id);
1711
+ j.addEvent(x, "mouseout", function () {
1712
+ j.removeClass(F, z)
1713
+ }, w.id)
1714
+ }
1715
+ if (A) {
1716
+ j.addEvent(x, "mousedown", function () {
1717
+ j.addClass(F, A)
1718
+ }, w.id);
1719
+ j.addEvent(k.body, "mouseup", function () {
1720
+ j.removeClass(F, A)
1721
+ }, w.id)
1722
+ }
1723
+ if (w.features.triggerDialog) {
1724
+ j.addEvent(F, "click", function (H) {
1725
+ var y = k.getElementById(w.id + "_html5");
1726
+ if (y && !y.disabled) {
1727
+ y.click()
1728
+ }
1729
+ H.preventDefault()
1730
+ }, w.id)
1731
+ }
1732
+ }
1733
+ });
1734
+ p.bind("PostInit", function () {
1735
+ var s = k.getElementById(p.settings.drop_element);
1736
+ if (s) {
1737
+ if (g) {
1738
+ j.addEvent(s, "dragenter", function (w) {
1739
+ var v, t, u;
1740
+ v = k.getElementById(p.id + "_drop");
1741
+ if (!v) {
1742
+ v = k.createElement("input");
1743
+ v.setAttribute("type", "file");
1744
+ v.setAttribute("id", p.id + "_drop");
1745
+ v.setAttribute("multiple", "multiple");
1746
+ j.addEvent(v, "change", function () {
1747
+ o(this.files);
1748
+ j.removeEvent(v, "change", p.id);
1749
+ v.parentNode.removeChild(v)
1750
+ }, p.id);
1751
+ s.appendChild(v)
1752
+ }
1753
+ t = j.getPos(s, k.getElementById(p.settings.container));
1754
+ u = j.getSize(s);
1755
+ if (j.getStyle(s, "position") === "static") {
1756
+ j.extend(s.style, {position:"relative"})
1757
+ }
1758
+ j.extend(v.style, {position:"absolute", display:"block", top:0, left:0, width:u.w + "px", height:u.h + "px", opacity:0})
1759
+ }, p.id);
1760
+ return
1761
+ }
1762
+ j.addEvent(s, "dragover", function (t) {
1763
+ t.preventDefault()
1764
+ }, p.id);
1765
+ j.addEvent(s, "drop", function (u) {
1766
+ var t = u.dataTransfer;
1767
+ if (t && t.files) {
1768
+ o(t.files)
1769
+ }
1770
+ u.preventDefault()
1771
+ }, p.id)
1772
+ }
1773
+ });
1774
+ p.bind("Refresh", function (s) {
1775
+ var t, u, v, x, w;
1776
+ t = k.getElementById(p.settings.browse_button);
1777
+ if (t) {
1778
+ u = j.getPos(t, k.getElementById(s.settings.container));
1779
+ v = j.getSize(t);
1780
+ x = k.getElementById(p.id + "_html5_container");
1781
+ j.extend(x.style, {top:u.y + "px", left:u.x + "px", width:v.w + "px", height:v.h + "px"});
1782
+ if (p.features.triggerDialog) {
1783
+ if (j.getStyle(t, "position") === "static") {
1784
+ j.extend(t.style, {position:"relative"})
1785
+ }
1786
+ w = parseInt(j.getStyle(t, "z-index"), 10);
1787
+ if (isNaN(w)) {
1788
+ w = 0
1789
+ }
1790
+ j.extend(t.style, {zIndex:w});
1791
+ j.extend(x.style, {zIndex:w - 1})
1792
+ }
1793
+ }
1794
+ });
1795
+ p.bind("DisableBrowse", function (s, u) {
1796
+ var t = k.getElementById(s.id + "_html5");
1797
+ if (t) {
1798
+ t.disabled = u
1799
+ }
1800
+ });
1801
+ p.bind("CancelUpload", function () {
1802
+ if (q && q.abort) {
1803
+ q.abort()
1804
+ }
1805
+ });
1806
+ p.bind("UploadFile", function (s, u) {
1807
+ var v = s.settings, y, t;
1808
+
1809
+ function x(A, D, z) {
1810
+ var B;
1811
+ if (File.prototype.slice) {
1812
+ try {
1813
+ A.slice();
1814
+ return A.slice(D, z)
1815
+ } catch (C) {
1816
+ return A.slice(D, z - D)
1817
+ }
1818
+ } else {
1819
+ if (B = File.prototype.webkitSlice || File.prototype.mozSlice) {
1820
+ return B.call(A, D, z)
1821
+ } else {
1822
+ return null
1823
+ }
1824
+ }
1825
+ }
1826
+
1827
+ function w(A) {
1828
+ var D = 0, C = 0, z = ("FileReader" in h) ? new FileReader : null;
1829
+
1830
+ function B() {
1831
+ var I, M, K, L, H, J, F, E = s.settings.url;
1832
+
1833
+ function G(V) {
1834
+ var T = 0, N = "----pluploadboundary" + j.guid(), O, P = "--", U = "\r\n", R = "";
1835
+ q = new XMLHttpRequest;
1836
+ if (q.upload) {
1837
+ q.upload.onprogress = function (W) {
1838
+ u.loaded = Math.min(u.size, C + W.loaded - T);
1839
+ s.trigger("UploadProgress", u)
1840
+ }
1841
+ }
1842
+ q.onreadystatechange = function () {
1843
+ var W, Y;
1844
+ if (q.readyState == 4 && s.state !== j.STOPPED) {
1845
+ try {
1846
+ W = q.status
1847
+ } catch (X) {
1848
+ W = 0
1849
+ }
1850
+ if (W >= 400) {
1851
+ s.trigger("Error", {code:j.HTTP_ERROR, message:j.translate("HTTP Error."), file:u, status:W})
1852
+ } else {
1853
+ if (K) {
1854
+ Y = {chunk:D, chunks:K, response:q.responseText, status:W};
1855
+ s.trigger("ChunkUploaded", u, Y);
1856
+ C += J;
1857
+ if (Y.cancelled) {
1858
+ u.status = j.FAILED;
1859
+ return
1860
+ }
1861
+ u.loaded = Math.min(u.size, (D + 1) * H)
1862
+ } else {
1863
+ u.loaded = u.size
1864
+ }
1865
+ s.trigger("UploadProgress", u);
1866
+ V = I = O = R = null;
1867
+ if (!K || ++D >= K) {
1868
+ u.status = j.DONE;
1869
+ s.trigger("FileUploaded", u, {response:q.responseText, status:W})
1870
+ } else {
1871
+ B()
1872
+ }
1873
+ }
1874
+ }
1875
+ };
1876
+ if (s.settings.multipart && n.multipart) {
1877
+ L.name = u.target_name || u.name;
1878
+ q.open("post", E, true);
1879
+ j.each(s.settings.headers, function (X, W) {
1880
+ q.setRequestHeader(W, X)
1881
+ });
1882
+ if (typeof(V) !== "string" && !!h.FormData) {
1883
+ O = new FormData();
1884
+ j.each(j.extend(L, s.settings.multipart_params), function (X, W) {
1885
+ O.append(W, X)
1886
+ });
1887
+ O.append(s.settings.file_data_name, V);
1888
+ q.send(O);
1889
+ return
1890
+ }
1891
+ if (typeof(V) === "string") {
1892
+ q.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + N);
1893
+ j.each(j.extend(L, s.settings.multipart_params), function (X, W) {
1894
+ R += P + N + U + 'Content-Disposition: form-data; name="' + W + '"' + U + U;
1895
+ R += unescape(encodeURIComponent(X)) + U
1896
+ });
1897
+ F = j.mimeTypes[u.name.replace(/^.+\.([^.]+)/, "$1").toLowerCase()] || "application/octet-stream";
1898
+ 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;
1899
+ T = R.length - V.length;
1900
+ V = R;
1901
+ if (q.sendAsBinary) {
1902
+ q.sendAsBinary(V)
1903
+ } else {
1904
+ if (n.canSendBinary) {
1905
+ var S = new Uint8Array(V.length);
1906
+ for (var Q = 0; Q < V.length; Q++) {
1907
+ S[Q] = (V.charCodeAt(Q) & 255)
1908
+ }
1909
+ q.send(S.buffer)
1910
+ }
1911
+ }
1912
+ return
1913
+ }
1914
+ }
1915
+ E = j.buildUrl(s.settings.url, j.extend(L, s.settings.multipart_params));
1916
+ q.open("post", E, true);
1917
+ q.setRequestHeader("Content-Type", "application/octet-stream");
1918
+ j.each(s.settings.headers, function (X, W) {
1919
+ q.setRequestHeader(W, X)
1920
+ });
1921
+ q.send(V)
1922
+ }
1923
+
1924
+ if (u.status == j.DONE || u.status == j.FAILED || s.state == j.STOPPED) {
1925
+ return
1926
+ }
1927
+ L = {name:u.target_name || u.name};
1928
+ if (v.chunk_size && u.size > v.chunk_size && (n.chunks || typeof(A) == "string")) {
1929
+ H = v.chunk_size;
1930
+ K = Math.ceil(u.size / H);
1931
+ J = Math.min(H, u.size - (D * H));
1932
+ if (typeof(A) == "string") {
1933
+ I = A.substring(D * H, D * H + J)
1934
+ } else {
1935
+ I = x(A, D * H, D * H + J)
1936
+ }
1937
+ L.chunk = D;
1938
+ L.chunks = K
1939
+ } else {
1940
+ J = u.size;
1941
+ I = A
1942
+ }
1943
+ if (s.settings.multipart && n.multipart && typeof(I) !== "string" && z && n.cantSendBlobInFormData && n.chunks && s.settings.chunk_size) {
1944
+ z.onload = function () {
1945
+ G(z.result)
1946
+ };
1947
+ z.readAsBinaryString(I)
1948
+ } else {
1949
+ G(I)
1950
+ }
1951
+ }
1952
+
1953
+ B()
1954
+ }
1955
+
1956
+ y = c[u.id];
1957
+ if (n.jpgresize && s.settings.resize && /\.(png|jpg|jpeg)$/i.test(u.name)) {
1958
+ d.call(s, u, s.settings.resize, /\.png$/i.test(u.name) ? "image/png" : "image/jpeg", function (z) {
1959
+ if (z.success) {
1960
+ u.size = z.data.length;
1961
+ w(z.data)
1962
+ } else {
1963
+ if (n.chunks) {
1964
+ w(y)
1965
+ } else {
1966
+ l(y, w)
1967
+ }
1968
+ }
1969
+ })
1970
+ } else {
1971
+ if (!n.chunks && n.jpgresize) {
1972
+ l(y, w)
1973
+ } else {
1974
+ w(y)
1975
+ }
1976
+ }
1977
+ });
1978
+ p.bind("Destroy", function (s) {
1979
+ 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};
1980
+ for (u in w) {
1981
+ v = k.getElementById(w[u]);
1982
+ if (v) {
1983
+ j.removeAllEvents(v, s.id)
1984
+ }
1985
+ }
1986
+ j.removeAllEvents(k.body, s.id);
1987
+ if (s.settings.container) {
1988
+ t = k.getElementById(s.settings.container)
1989
+ }
1990
+ t.removeChild(k.getElementById(w.inputContainer))
1991
+ });
1992
+ r({success:true})
1993
+ }});
1994
+ function b() {
1995
+ var q = false, o;
1996
+
1997
+ function r(t, v) {
1998
+ var s = q ? 0 : -8 * (v - 1), w = 0, u;
1999
+ for (u = 0; u < v; u++) {
2000
+ w |= (o.charCodeAt(t + u) << Math.abs(s + u * 8))
2001
+ }
2002
+ return w
2003
+ }
2004
+
2005
+ function n(u, s, t) {
2006
+ var t = arguments.length === 3 ? t : o.length - s - 1;
2007
+ o = o.substr(0, s) + u + o.substr(t + s)
2008
+ }
2009
+
2010
+ function p(t, u, w) {
2011
+ var x = "", s = q ? 0 : -8 * (w - 1), v;
2012
+ for (v = 0; v < w; v++) {
2013
+ x += String.fromCharCode((u >> Math.abs(s + v * 8)) & 255)
2014
+ }
2015
+ n(x, t, w)
2016
+ }
2017
+
2018
+ return{II:function (s) {
2019
+ if (s === e) {
2020
+ return q
2021
+ } else {
2022
+ q = s
2023
+ }
2024
+ }, init:function (s) {
2025
+ q = false;
2026
+ o = s
2027
+ }, SEGMENT:function (s, u, t) {
2028
+ switch (arguments.length) {
2029
+ case 1:
2030
+ return o.substr(s, o.length - s - 1);
2031
+ case 2:
2032
+ return o.substr(s, u);
2033
+ case 3:
2034
+ n(t, s, u);
2035
+ break;
2036
+ default:
2037
+ return o
2038
+ }
2039
+ }, BYTE:function (s) {
2040
+ return r(s, 1)
2041
+ }, SHORT:function (s) {
2042
+ return r(s, 2)
2043
+ }, LONG:function (s, t) {
2044
+ if (t === e) {
2045
+ return r(s, 4)
2046
+ } else {
2047
+ p(s, t, 4)
2048
+ }
2049
+ }, SLONG:function (s) {
2050
+ var t = r(s, 4);
2051
+ return(t > 2147483647 ? t - 4294967296 : t)
2052
+ }, STRING:function (s, t) {
2053
+ var u = "";
2054
+ for (t += s; s < t; s++) {
2055
+ u += String.fromCharCode(r(s, 1))
2056
+ }
2057
+ return u
2058
+ }}
2059
+ }
2060
+
2061
+ function f(s) {
2062
+ 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;
2063
+ r = new b();
2064
+ r.init(s);
2065
+ if (r.SHORT(0) !== 65496) {
2066
+ return
2067
+ }
2068
+ n = 2;
2069
+ o = Math.min(1048576, s.length);
2070
+ while (n <= o) {
2071
+ p = r.SHORT(n);
2072
+ if (p >= 65488 && p <= 65495) {
2073
+ n += 2;
2074
+ continue
2075
+ }
2076
+ if (p === 65498 || p === 65497) {
2077
+ break
2078
+ }
2079
+ q = r.SHORT(n + 2) + 2;
2080
+ if (u[p] && r.STRING(n + 4, u[p].signature.length) === u[p].signature) {
2081
+ t.push({hex:p, app:u[p].app.toUpperCase(), name:u[p].name.toUpperCase(), start:n, length:q, segment:r.SEGMENT(n, q)})
2082
+ }
2083
+ n += q
2084
+ }
2085
+ r.init(null);
2086
+ return{headers:t, restore:function (y) {
2087
+ r.init(y);
2088
+ var w = new f(y);
2089
+ if (!w.headers) {
2090
+ return false
2091
+ }
2092
+ for (var x = w.headers.length; x > 0; x--) {
2093
+ var z = w.headers[x - 1];
2094
+ r.SEGMENT(z.start, z.length, "")
2095
+ }
2096
+ w.purge();
2097
+ n = r.SHORT(2) == 65504 ? 4 + r.SHORT(4) : 2;
2098
+ for (var x = 0, v = t.length; x < v; x++) {
2099
+ r.SEGMENT(n, 0, t[x].segment);
2100
+ n += t[x].length
2101
+ }
2102
+ return r.SEGMENT()
2103
+ }, get:function (x) {
2104
+ var y = [];
2105
+ for (var w = 0, v = t.length; w < v; w++) {
2106
+ if (t[w].app === x.toUpperCase()) {
2107
+ y.push(t[w].segment)
2108
+ }
2109
+ }
2110
+ return y
2111
+ }, set:function (y, x) {
2112
+ var z = [];
2113
+ if (typeof(x) === "string") {
2114
+ z.push(x)
2115
+ } else {
2116
+ z = x
2117
+ }
2118
+ for (var w = ii = 0, v = t.length; w < v; w++) {
2119
+ if (t[w].app === y.toUpperCase()) {
2120
+ t[w].segment = z[ii];
2121
+ t[w].length = z[ii].length;
2122
+ ii++
2123
+ }
2124
+ if (ii >= z.length) {
2125
+ break
2126
+ }
2127
+ }
2128
+ }, purge:function () {
2129
+ t = [];
2130
+ r.init(null)
2131
+ }}
2132
+ }
2133
+
2134
+ function a() {
2135
+ var q, n, o = {}, t;
2136
+ q = new b();
2137
+ 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"}};
2138
+ 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"}};
2139
+ function p(u, C) {
2140
+ var w = q.SHORT(u), z, F, G, B, A, v, x, D, E = [], y = {};
2141
+ for (z = 0; z < w; z++) {
2142
+ x = v = u + 12 * z + 2;
2143
+ G = C[q.SHORT(x)];
2144
+ if (G === e) {
2145
+ continue
2146
+ }
2147
+ B = q.SHORT(x += 2);
2148
+ A = q.LONG(x += 2);
2149
+ x += 4;
2150
+ E = [];
2151
+ switch (B) {
2152
+ case 1:
2153
+ case 7:
2154
+ if (A > 4) {
2155
+ x = q.LONG(x) + o.tiffHeader
2156
+ }
2157
+ for (F = 0; F < A; F++) {
2158
+ E[F] = q.BYTE(x + F)
2159
+ }
2160
+ break;
2161
+ case 2:
2162
+ if (A > 4) {
2163
+ x = q.LONG(x) + o.tiffHeader
2164
+ }
2165
+ y[G] = q.STRING(x, A - 1);
2166
+ continue;
2167
+ case 3:
2168
+ if (A > 2) {
2169
+ x = q.LONG(x) + o.tiffHeader
2170
+ }
2171
+ for (F = 0; F < A; F++) {
2172
+ E[F] = q.SHORT(x + F * 2)
2173
+ }
2174
+ break;
2175
+ case 4:
2176
+ if (A > 1) {
2177
+ x = q.LONG(x) + o.tiffHeader
2178
+ }
2179
+ for (F = 0; F < A; F++) {
2180
+ E[F] = q.LONG(x + F * 4)
2181
+ }
2182
+ break;
2183
+ case 5:
2184
+ x = q.LONG(x) + o.tiffHeader;
2185
+ for (F = 0; F < A; F++) {
2186
+ E[F] = q.LONG(x + F * 4) / q.LONG(x + F * 4 + 4)
2187
+ }
2188
+ break;
2189
+ case 9:
2190
+ x = q.LONG(x) + o.tiffHeader;
2191
+ for (F = 0; F < A; F++) {
2192
+ E[F] = q.SLONG(x + F * 4)
2193
+ }
2194
+ break;
2195
+ case 10:
2196
+ x = q.LONG(x) + o.tiffHeader;
2197
+ for (F = 0; F < A; F++) {
2198
+ E[F] = q.SLONG(x + F * 4) / q.SLONG(x + F * 4 + 4)
2199
+ }
2200
+ break;
2201
+ default:
2202
+ continue
2203
+ }
2204
+ D = (A == 1 ? E[0] : E);
2205
+ if (t.hasOwnProperty(G) && typeof D != "object") {
2206
+ y[G] = t[G][D]
2207
+ } else {
2208
+ y[G] = D
2209
+ }
2210
+ }
2211
+ return y
2212
+ }
2213
+
2214
+ function s() {
2215
+ var v = e, u = o.tiffHeader;
2216
+ q.II(q.SHORT(u) == 18761);
2217
+ if (q.SHORT(u += 2) !== 42) {
2218
+ return false
2219
+ }
2220
+ o.IFD0 = o.tiffHeader + q.LONG(u += 2);
2221
+ v = p(o.IFD0, n.tiff);
2222
+ o.exifIFD = ("ExifIFDPointer" in v ? o.tiffHeader + v.ExifIFDPointer : e);
2223
+ o.gpsIFD = ("GPSInfoIFDPointer" in v ? o.tiffHeader + v.GPSInfoIFDPointer : e);
2224
+ return true
2225
+ }
2226
+
2227
+ function r(w, u, z) {
2228
+ var B, y, x, A = 0;
2229
+ if (typeof(u) === "string") {
2230
+ var v = n[w.toLowerCase()];
2231
+ for (hex in v) {
2232
+ if (v[hex] === u) {
2233
+ u = hex;
2234
+ break
2235
+ }
2236
+ }
2237
+ }
2238
+ B = o[w.toLowerCase() + "IFD"];
2239
+ y = q.SHORT(B);
2240
+ for (i = 0; i < y; i++) {
2241
+ x = B + 12 * i + 2;
2242
+ if (q.SHORT(x) == u) {
2243
+ A = x + 8;
2244
+ break
2245
+ }
2246
+ }
2247
+ if (!A) {
2248
+ return false
2249
+ }
2250
+ q.LONG(A, z);
2251
+ return true
2252
+ }
2253
+
2254
+ return{init:function (u) {
2255
+ o = {tiffHeader:10};
2256
+ if (u === e || !u.length) {
2257
+ return false
2258
+ }
2259
+ q.init(u);
2260
+ if (q.SHORT(0) === 65505 && q.STRING(4, 5).toUpperCase() === "EXIF\0") {
2261
+ return s()
2262
+ }
2263
+ return false
2264
+ }, EXIF:function () {
2265
+ var v;
2266
+ v = p(o.exifIFD, n.exif);
2267
+ if (v.ExifVersion && j.typeOf(v.ExifVersion) === "array") {
2268
+ for (var w = 0, u = ""; w < v.ExifVersion.length; w++) {
2269
+ u += String.fromCharCode(v.ExifVersion[w])
2270
+ }
2271
+ v.ExifVersion = u
2272
+ }
2273
+ return v
2274
+ }, GPS:function () {
2275
+ var u;
2276
+ u = p(o.gpsIFD, n.gps);
2277
+ if (u.GPSVersionID) {
2278
+ u.GPSVersionID = u.GPSVersionID.join(".")
2279
+ }
2280
+ return u
2281
+ }, setExif:function (u, v) {
2282
+ if (u !== "PixelXDimension" && u !== "PixelYDimension") {
2283
+ return false
2284
+ }
2285
+ return r("exif", u, v)
2286
+ }, getBinary:function () {
2287
+ return q.SEGMENT()
2288
+ }}
2289
+ }
2290
+ })(window, document, plupload);
2291
+ (function (d, a, b, c) {
2292
+ function e(f) {
2293
+ return a.getElementById(f)
2294
+ }
2295
+
2296
+ b.runtimes.Html4 = b.addRuntime("html4", {getFeatures:function () {
2297
+ return{multipart:true, triggerDialog:(b.ua.gecko && d.FormData || b.ua.webkit)}
2298
+ }, init:function (f, g) {
2299
+ f.bind("Init", function (p) {
2300
+ var j = a.body, n, h = "javascript", k, x, q, z = [], r = /MSIE/.test(navigator.userAgent), t = [], m = p.settings.filters, o, l, s, w;
2301
+ no_type_restriction:for (o = 0; o < m.length; o++) {
2302
+ l = m[o].extensions.split(/,/);
2303
+ for (w = 0; w < l.length; w++) {
2304
+ if (l[w] === "*") {
2305
+ t = [];
2306
+ break no_type_restriction
2307
+ }
2308
+ s = b.mimeTypes[l[w]];
2309
+ if (s && b.inArray(s, t) === -1) {
2310
+ t.push(s)
2311
+ }
2312
+ }
2313
+ }
2314
+ t = t.join(",");
2315
+ function v() {
2316
+ var C, A, y, B;
2317
+ q = b.guid();
2318
+ z.push(q);
2319
+ C = a.createElement("form");
2320
+ C.setAttribute("id", "form_" + q);
2321
+ C.setAttribute("method", "post");
2322
+ C.setAttribute("enctype", "multipart/form-data");
2323
+ C.setAttribute("encoding", "multipart/form-data");
2324
+ C.setAttribute("target", p.id + "_iframe");
2325
+ C.style.position = "absolute";
2326
+ A = a.createElement("input");
2327
+ A.setAttribute("id", "input_" + q);
2328
+ A.setAttribute("type", "file");
2329
+ A.setAttribute("accept", t);
2330
+ A.setAttribute("size", 1);
2331
+ B = e(p.settings.browse_button);
2332
+ if (p.features.triggerDialog && B) {
2333
+ b.addEvent(e(p.settings.browse_button), "click", function (D) {
2334
+ if (!A.disabled) {
2335
+ A.click()
2336
+ }
2337
+ D.preventDefault()
2338
+ }, p.id)
2339
+ }
2340
+ b.extend(A.style, {width:"100%", height:"100%", opacity:0, fontSize:"99px", cursor:"pointer"});
2341
+ b.extend(C.style, {overflow:"hidden"});
2342
+ y = p.settings.shim_bgcolor;
2343
+ if (y) {
2344
+ C.style.background = y
2345
+ }
2346
+ if (r) {
2347
+ b.extend(A.style, {filter:"alpha(opacity=0)"})
2348
+ }
2349
+ b.addEvent(A, "change", function (G) {
2350
+ var E = G.target, D, F = [], H;
2351
+ if (E.value) {
2352
+ e("form_" + q).style.top = -1048575 + "px";
2353
+ D = E.value.replace(/\\/g, "/");
2354
+ D = D.substring(D.length, D.lastIndexOf("/") + 1);
2355
+ F.push(new b.File(q, D));
2356
+ if (!p.features.triggerDialog) {
2357
+ b.removeAllEvents(C, p.id)
2358
+ } else {
2359
+ b.removeEvent(B, "click", p.id)
2360
+ }
2361
+ b.removeEvent(A, "change", p.id);
2362
+ v();
2363
+ if (F.length) {
2364
+ f.trigger("FilesAdded", F)
2365
+ }
2366
+ }
2367
+ }, p.id);
2368
+ C.appendChild(A);
2369
+ j.appendChild(C);
2370
+ p.refresh()
2371
+ }
2372
+
2373
+ function u() {
2374
+ var y = a.createElement("div");
2375
+ y.innerHTML = '<iframe id="' + p.id + '_iframe" name="' + p.id + '_iframe" src="' + h + ':&quot;&quot;" style="display:none"></iframe>';
2376
+ n = y.firstChild;
2377
+ j.appendChild(n);
2378
+ b.addEvent(n, "load", function (D) {
2379
+ var E = D.target, C, A;
2380
+ if (!k) {
2381
+ return
2382
+ }
2383
+ try {
2384
+ C = E.contentWindow.document || E.contentDocument || d.frames[E.id].document
2385
+ } catch (B) {
2386
+ p.trigger("Error", {code:b.SECURITY_ERROR, message:b.translate("Security error."), file:k});
2387
+ return
2388
+ }
2389
+ A = C.body.innerHTML;
2390
+ if (A) {
2391
+ k.status = b.DONE;
2392
+ k.loaded = 1025;
2393
+ k.percent = 100;
2394
+ p.trigger("UploadProgress", k);
2395
+ p.trigger("FileUploaded", k, {response:A})
2396
+ }
2397
+ }, p.id)
2398
+ }
2399
+
2400
+ if (p.settings.container) {
2401
+ j = e(p.settings.container);
2402
+ if (b.getStyle(j, "position") === "static") {
2403
+ j.style.position = "relative"
2404
+ }
2405
+ }
2406
+ p.bind("UploadFile", function (y, B) {
2407
+ var C, A;
2408
+ if (B.status == b.DONE || B.status == b.FAILED || y.state == b.STOPPED) {
2409
+ return
2410
+ }
2411
+ C = e("form_" + B.id);
2412
+ A = e("input_" + B.id);
2413
+ A.setAttribute("name", y.settings.file_data_name);
2414
+ C.setAttribute("action", y.settings.url);
2415
+ b.each(b.extend({name:B.target_name || B.name}, y.settings.multipart_params), function (F, D) {
2416
+ var E = a.createElement("input");
2417
+ b.extend(E, {type:"hidden", name:D, value:F});
2418
+ C.insertBefore(E, C.firstChild)
2419
+ });
2420
+ k = B;
2421
+ e("form_" + q).style.top = -1048575 + "px";
2422
+ C.submit()
2423
+ });
2424
+ p.bind("FileUploaded", function (y) {
2425
+ y.refresh()
2426
+ });
2427
+ p.bind("StateChanged", function (y) {
2428
+ if (y.state == b.STARTED) {
2429
+ u()
2430
+ } else {
2431
+ if (y.state == b.STOPPED) {
2432
+ d.setTimeout(function () {
2433
+ b.removeEvent(n, "load", y.id);
2434
+ if (n.parentNode) {
2435
+ n.parentNode.removeChild(n)
2436
+ }
2437
+ }, 0)
2438
+ }
2439
+ }
2440
+ b.each(y.files, function (B, A) {
2441
+ if (B.status === b.DONE || B.status === b.FAILED) {
2442
+ var C = e("form_" + B.id);
2443
+ if (C) {
2444
+ C.parentNode.removeChild(C)
2445
+ }
2446
+ }
2447
+ })
2448
+ });
2449
+ p.bind("Refresh", function (A) {
2450
+ var G, B, C, D, y, H, I, F, E;
2451
+ G = e(A.settings.browse_button);
2452
+ if (G) {
2453
+ y = b.getPos(G, e(A.settings.container));
2454
+ H = b.getSize(G);
2455
+ I = e("form_" + q);
2456
+ F = e("input_" + q);
2457
+ b.extend(I.style, {top:y.y + "px", left:y.x + "px", width:H.w + "px", height:H.h + "px"});
2458
+ if (A.features.triggerDialog) {
2459
+ if (b.getStyle(G, "position") === "static") {
2460
+ b.extend(G.style, {position:"relative"})
2461
+ }
2462
+ E = parseInt(G.style.zIndex, 10);
2463
+ if (isNaN(E)) {
2464
+ E = 0
2465
+ }
2466
+ b.extend(G.style, {zIndex:E});
2467
+ b.extend(I.style, {zIndex:E - 1})
2468
+ }
2469
+ C = A.settings.browse_button_hover;
2470
+ D = A.settings.browse_button_active;
2471
+ B = A.features.triggerDialog ? G : I;
2472
+ if (C) {
2473
+ b.addEvent(B, "mouseover", function () {
2474
+ b.addClass(G, C)
2475
+ }, A.id);
2476
+ b.addEvent(B, "mouseout", function () {
2477
+ b.removeClass(G, C)
2478
+ }, A.id)
2479
+ }
2480
+ if (D) {
2481
+ b.addEvent(B, "mousedown", function () {
2482
+ b.addClass(G, D)
2483
+ }, A.id);
2484
+ b.addEvent(a.body, "mouseup", function () {
2485
+ b.removeClass(G, D)
2486
+ }, A.id)
2487
+ }
2488
+ }
2489
+ });
2490
+ f.bind("FilesRemoved", function (y, B) {
2491
+ var A, C;
2492
+ for (A = 0; A < B.length; A++) {
2493
+ C = e("form_" + B[A].id);
2494
+ if (C) {
2495
+ C.parentNode.removeChild(C)
2496
+ }
2497
+ }
2498
+ });
2499
+ f.bind("DisableBrowse", function (y, B) {
2500
+ var A = a.getElementById("input_" + q);
2501
+ if (A) {
2502
+ A.disabled = B
2503
+ }
2504
+ });
2505
+ f.bind("Destroy", function (y) {
2506
+ var A, B, C, D = {inputContainer:"form_" + q, inputFile:"input_" + q, browseButton:y.settings.browse_button};
2507
+ for (A in D) {
2508
+ B = e(D[A]);
2509
+ if (B) {
2510
+ b.removeAllEvents(B, y.id)
2511
+ }
2512
+ }
2513
+ b.removeAllEvents(a.body, y.id);
2514
+ b.each(z, function (F, E) {
2515
+ C = e("form_" + F);
2516
+ if (C) {
2517
+ j.removeChild(C)
2518
+ }
2519
+ })
2520
+ });
2521
+ v()
2522
+ });
2523
+ g({success:true})
2524
+ }})
2525
+ })(window, document, plupload);