webshims-rails 1.10.3 → 1.10.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +8 -8
  2. data/lib/webshims-rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/webshims/polyfiller.js +96 -73
  4. data/vendor/assets/javascripts/webshims/shims/color-picker.js +2415 -0
  5. data/vendor/assets/javascripts/webshims/shims/combos/1.js +248 -745
  6. data/vendor/assets/javascripts/webshims/shims/combos/10.js +771 -1206
  7. data/vendor/assets/javascripts/webshims/shims/combos/11.js +679 -1201
  8. data/vendor/assets/javascripts/webshims/shims/combos/12.js +46 -65
  9. data/vendor/assets/javascripts/webshims/shims/combos/13.js +45 -64
  10. data/vendor/assets/javascripts/webshims/shims/combos/14.js +94 -7
  11. data/vendor/assets/javascripts/webshims/shims/combos/15.js +557 -1189
  12. data/vendor/assets/javascripts/webshims/shims/combos/16.js +598 -1249
  13. data/vendor/assets/javascripts/webshims/shims/combos/17.js +697 -1208
  14. data/vendor/assets/javascripts/webshims/shims/combos/18.js +697 -1208
  15. data/vendor/assets/javascripts/webshims/shims/combos/19.js +145 -78
  16. data/vendor/assets/javascripts/webshims/shims/combos/2.js +472 -1280
  17. data/vendor/assets/javascripts/webshims/shims/combos/20.js +144 -77
  18. data/vendor/assets/javascripts/webshims/shims/combos/21.js +14 -15
  19. data/vendor/assets/javascripts/webshims/shims/combos/22.js +2 -2
  20. data/vendor/assets/javascripts/webshims/shims/combos/23.js +45 -64
  21. data/vendor/assets/javascripts/webshims/shims/combos/24.js +848 -0
  22. data/vendor/assets/javascripts/webshims/shims/combos/25.js +4373 -0
  23. data/vendor/assets/javascripts/webshims/shims/combos/26.js +1516 -0
  24. data/vendor/assets/javascripts/webshims/shims/combos/27.js +884 -0
  25. data/vendor/assets/javascripts/webshims/shims/combos/28.js +2067 -0
  26. data/vendor/assets/javascripts/webshims/shims/combos/29.js +1156 -0
  27. data/vendor/assets/javascripts/webshims/shims/combos/3.js +313 -700
  28. data/vendor/assets/javascripts/webshims/shims/combos/30.js +1868 -0
  29. data/vendor/assets/javascripts/webshims/shims/combos/31.js +1663 -0
  30. data/vendor/assets/javascripts/webshims/shims/combos/4.js +111 -20
  31. data/vendor/assets/javascripts/webshims/shims/combos/5.js +747 -1321
  32. data/vendor/assets/javascripts/webshims/shims/combos/6.js +837 -1809
  33. data/vendor/assets/javascripts/webshims/shims/combos/7.js +435 -1239
  34. data/vendor/assets/javascripts/webshims/shims/combos/8.js +360 -766
  35. data/vendor/assets/javascripts/webshims/shims/combos/9.js +843 -1676
  36. data/vendor/assets/javascripts/webshims/shims/details.js +1 -1
  37. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +90 -3
  38. data/vendor/assets/javascripts/webshims/shims/filereader.js +386 -0
  39. data/vendor/assets/javascripts/webshims/shims/form-core.js +201 -680
  40. data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +418 -0
  41. data/vendor/assets/javascripts/webshims/shims/form-datalist.js +69 -467
  42. data/vendor/assets/javascripts/webshims/shims/form-message.js +21 -17
  43. data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +19 -82
  44. data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +17 -6
  45. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +570 -1185
  46. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +181 -28
  47. data/vendor/assets/javascripts/webshims/shims/form-validation.js +599 -0
  48. data/vendor/assets/javascripts/webshims/{extras/custom-validity.js → shims/form-validators.js} +33 -38
  49. data/vendor/assets/javascripts/webshims/shims/forms-picker.js +865 -0
  50. data/vendor/assets/javascripts/webshims/shims/geolocation.js +2 -2
  51. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-de.txt +37 -34
  52. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-en.txt +88 -48
  53. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-lt.js +74 -0
  54. data/vendor/assets/javascripts/webshims/shims/jpicker/ChangeLog.txt +121 -0
  55. data/vendor/assets/javascripts/webshims/shims/jpicker/ReadMe.txt +47 -0
  56. data/vendor/assets/javascripts/webshims/shims/jpicker/images/AlphaBar.png +0 -0
  57. data/vendor/assets/javascripts/webshims/shims/jpicker/images/Bars.png +0 -0
  58. data/vendor/assets/javascripts/webshims/shims/jpicker/images/Maps.png +0 -0
  59. data/vendor/assets/javascripts/webshims/shims/jpicker/images/NoColor.png +0 -0
  60. data/vendor/assets/javascripts/webshims/shims/jpicker/images/Thumbs.db +0 -0
  61. data/vendor/assets/javascripts/webshims/shims/jpicker/images/bar-opacity.png +0 -0
  62. data/vendor/assets/javascripts/webshims/shims/jpicker/images/map-opacity.png +0 -0
  63. data/vendor/assets/javascripts/webshims/shims/jpicker/images/mappoint.gif +0 -0
  64. data/vendor/assets/javascripts/webshims/shims/jpicker/images/picker.gif +0 -0
  65. data/vendor/assets/javascripts/webshims/shims/jpicker/images/preview-opacity.png +0 -0
  66. data/vendor/assets/javascripts/webshims/shims/jpicker/images/rangearrows.gif +0 -0
  67. data/vendor/assets/javascripts/webshims/shims/jpicker/jpicker.css +257 -0
  68. data/vendor/assets/javascripts/webshims/shims/json-storage.js +4 -4
  69. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +44 -63
  70. data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +10 -11
  71. data/vendor/assets/javascripts/webshims/shims/mediaelement-native-fix.js +2 -1
  72. data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +5 -3
  73. data/vendor/assets/javascripts/webshims/shims/range-ui.js +110 -17
  74. data/vendor/assets/javascripts/webshims/shims/styles/forms.png +0 -0
  75. data/vendor/assets/javascripts/webshims/shims/styles/range-track.png +0 -0
  76. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +104 -21
  77. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +90 -16
  78. data/vendor/assets/javascripts/webshims/shims/styles/vertical-range.png +0 -0
  79. data/vendor/assets/javascripts/webshims/shims/swf/filereader.swf +0 -0
  80. data/vendor/assets/javascripts/webshims/shims/swfmini.js +1 -1
  81. data/vendor/assets/javascripts/webshims/shims/track-ui.js +35 -3
  82. data/vendor/assets/javascripts/webshims/shims/track.js +1 -1
  83. metadata +33 -3
@@ -0,0 +1,884 @@
1
+ /*! SWFMini - a SWFObject 2.2 cut down version for webshims
2
+ *
3
+ * based on SWFObject v2.2 <http://code.google.com/p/swfobject/>
4
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
5
+ */
6
+
7
+ var swfmini = function() {
8
+
9
+ var UNDEF = "undefined",
10
+ OBJECT = "object",
11
+ webshims = jQuery.webshims || window.webshims,
12
+ SHOCKWAVE_FLASH = "Shockwave Flash",
13
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
14
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
15
+
16
+ win = window,
17
+ doc = document,
18
+ nav = navigator,
19
+
20
+ plugin = false,
21
+ domLoadFnArr = [main],
22
+ objIdArr = [],
23
+ listenersArr = [],
24
+ storedAltContent,
25
+ storedAltContentId,
26
+ storedCallbackFn,
27
+ storedCallbackObj,
28
+ isDomLoaded = false,
29
+ dynamicStylesheet,
30
+ dynamicStylesheetMedia,
31
+ autoHideShow = true,
32
+
33
+ /* Centralized function for browser feature detection
34
+ - User agent string detection is only used when no good alternative is possible
35
+ - Is executed directly for optimal performance
36
+ */
37
+ ua = function() {
38
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
39
+ u = nav.userAgent.toLowerCase(),
40
+ p = nav.platform.toLowerCase(),
41
+ windows = p ? /win/.test(p) : /win/.test(u),
42
+ mac = p ? /mac/.test(p) : /mac/.test(u),
43
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
44
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
45
+ playerVersion = [0,0,0],
46
+ d = null;
47
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
48
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
49
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
50
+ plugin = true;
51
+ ie = false; // cascaded feature detection for Internet Explorer
52
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
53
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
54
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
55
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
56
+ }
57
+ }
58
+ else if (typeof win.ActiveXObject != UNDEF) {
59
+ try {
60
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
61
+ if (a) { // a will return null when ActiveX is disabled
62
+ d = a.GetVariable("$version");
63
+ if (d) {
64
+ ie = true; // cascaded feature detection for Internet Explorer
65
+ d = d.split(" ")[1].split(",");
66
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
67
+ }
68
+ }
69
+ }
70
+ catch(e) {}
71
+ }
72
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
73
+ }();
74
+
75
+
76
+ function callDomLoadFunctions() {
77
+ if (isDomLoaded) { return; }
78
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
79
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
80
+ t.parentNode.removeChild(t);
81
+ }
82
+ catch (e) { return; }
83
+ isDomLoaded = true;
84
+ var dl = domLoadFnArr.length;
85
+ for (var i = 0; i < dl; i++) {
86
+ domLoadFnArr[i]();
87
+ }
88
+ }
89
+
90
+ function addDomLoadEvent(fn) {
91
+ if (isDomLoaded) {
92
+ fn();
93
+ }
94
+ else {
95
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
96
+ }
97
+ }
98
+
99
+ /* Cross-browser onload
100
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
101
+ - Will fire an event as soon as a web page including all of its assets are loaded
102
+ */
103
+ function addLoadEvent(fn) {
104
+
105
+ }
106
+
107
+ /* Main function
108
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
109
+ */
110
+ function main() {
111
+ if (plugin) {
112
+ testPlayerVersion();
113
+ }
114
+ }
115
+
116
+ /* Detect the Flash Player version for non-Internet Explorer browsers
117
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
118
+ a. Both release and build numbers can be detected
119
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
120
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
121
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
122
+ */
123
+ function testPlayerVersion() {
124
+ var b = doc.getElementsByTagName("body")[0];
125
+ var o = createElement(OBJECT);
126
+ o.setAttribute("type", FLASH_MIME_TYPE);
127
+ var t = b.appendChild(o);
128
+ if (t) {
129
+ var counter = 0;
130
+ (function(){
131
+ if (typeof t.GetVariable != UNDEF) {
132
+ var d = t.GetVariable("$version");
133
+ if (d) {
134
+ d = d.split(" ")[1].split(",");
135
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
136
+ }
137
+ }
138
+ else if (counter < 10) {
139
+ counter++;
140
+ setTimeout(arguments.callee, 10);
141
+ return;
142
+ }
143
+ b.removeChild(o);
144
+ t = null;
145
+ })();
146
+ }
147
+ }
148
+
149
+
150
+ function getObjectById(objectIdStr) {
151
+ var r = null;
152
+ var o = getElementById(objectIdStr);
153
+ if (o && o.nodeName == "OBJECT") {
154
+ if (typeof o.SetVariable != UNDEF) {
155
+ r = o;
156
+ }
157
+ else {
158
+ var n = o.getElementsByTagName(OBJECT)[0];
159
+ if (n) {
160
+ r = n;
161
+ }
162
+ }
163
+ }
164
+ return r;
165
+ }
166
+
167
+
168
+ /* Functions to abstract and display alternative content
169
+ */
170
+ function displayAltContent(obj) {
171
+ if (ua.ie && ua.win && obj.readyState != 4) {
172
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
173
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
174
+ var el = createElement("div");
175
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
176
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
177
+ obj.style.display = "none";
178
+ (function(){
179
+ if (obj.readyState == 4) {
180
+ obj.parentNode.removeChild(obj);
181
+ }
182
+ else {
183
+ setTimeout(arguments.callee, 10);
184
+ }
185
+ })();
186
+ }
187
+ else {
188
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
189
+ }
190
+ }
191
+
192
+ function abstractAltContent(obj) {
193
+ var ac = createElement("div");
194
+ if (ua.win && ua.ie) {
195
+ ac.innerHTML = obj.innerHTML;
196
+ }
197
+ else {
198
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
199
+ if (nestedObj) {
200
+ var c = nestedObj.childNodes;
201
+ if (c) {
202
+ var cl = c.length;
203
+ for (var i = 0; i < cl; i++) {
204
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
205
+ ac.appendChild(c[i].cloneNode(true));
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
211
+ return ac;
212
+ }
213
+
214
+ /* Cross-browser dynamic SWF creation
215
+ */
216
+ function createSWF(attObj, parObj, id) {
217
+ var r, el = getElementById(id);
218
+ if (ua.wk && ua.wk < 312) { return r; }
219
+ if (el) {
220
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
221
+ attObj.id = id;
222
+ }
223
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
224
+ var att = "";
225
+ for (var i in attObj) {
226
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
227
+ if (i.toLowerCase() == "data") {
228
+ parObj.movie = attObj[i];
229
+ }
230
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
231
+ att += ' class="' + attObj[i] + '"';
232
+ }
233
+ else if (i.toLowerCase() != "classid") {
234
+ att += ' ' + i + '="' + attObj[i] + '"';
235
+ }
236
+ }
237
+ }
238
+ var par = "";
239
+ for (var j in parObj) {
240
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
241
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
242
+ }
243
+ }
244
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
245
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
246
+ r = getElementById(attObj.id);
247
+ }
248
+ else { // well-behaving browsers
249
+ var o = createElement(OBJECT);
250
+ o.setAttribute("type", FLASH_MIME_TYPE);
251
+ for (var m in attObj) {
252
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
253
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
254
+ o.setAttribute("class", attObj[m]);
255
+ }
256
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
257
+ o.setAttribute(m, attObj[m]);
258
+ }
259
+ }
260
+ }
261
+ for (var n in parObj) {
262
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
263
+ createObjParam(o, n, parObj[n]);
264
+ }
265
+ }
266
+ el.parentNode.replaceChild(o, el);
267
+ r = o;
268
+ }
269
+ }
270
+ return r;
271
+ }
272
+
273
+ function createObjParam(el, pName, pValue) {
274
+ var p = createElement("param");
275
+ p.setAttribute("name", pName);
276
+ p.setAttribute("value", pValue);
277
+ el.appendChild(p);
278
+ }
279
+
280
+ /* Cross-browser SWF removal
281
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
282
+ */
283
+ function removeSWF(id) {
284
+ var obj = getElementById(id);
285
+ if (obj && obj.nodeName == "OBJECT") {
286
+ if (ua.ie && ua.win) {
287
+ obj.style.display = "none";
288
+ (function(){
289
+ if (obj.readyState == 4) {
290
+ removeObjectInIE(id);
291
+ }
292
+ else {
293
+ setTimeout(arguments.callee, 10);
294
+ }
295
+ })();
296
+ }
297
+ else {
298
+ obj.parentNode.removeChild(obj);
299
+ }
300
+ }
301
+ }
302
+
303
+ function removeObjectInIE(id) {
304
+ var obj = getElementById(id);
305
+ if (obj) {
306
+ for (var i in obj) {
307
+ if (typeof obj[i] == "function") {
308
+ obj[i] = null;
309
+ }
310
+ }
311
+ obj.parentNode.removeChild(obj);
312
+ }
313
+ }
314
+
315
+ /* Functions to optimize JavaScript compression
316
+ */
317
+ function getElementById(id) {
318
+ var el = null;
319
+ try {
320
+ el = doc.getElementById(id);
321
+ }
322
+ catch (e) {}
323
+ return el;
324
+ }
325
+
326
+ function createElement(el) {
327
+ return doc.createElement(el);
328
+ }
329
+
330
+ /* Updated attachEvent function for Internet Explorer
331
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
332
+ */
333
+ function addListener(target, eventType, fn) {
334
+ target.attachEvent(eventType, fn);
335
+ listenersArr[listenersArr.length] = [target, eventType, fn];
336
+ }
337
+
338
+ /* Flash Player and SWF content version matching
339
+ */
340
+ function hasPlayerVersion(rv) {
341
+ var pv = ua.pv, v = rv.split(".");
342
+ v[0] = parseInt(v[0], 10);
343
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
344
+ v[2] = parseInt(v[2], 10) || 0;
345
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
346
+ }
347
+
348
+
349
+
350
+ function setVisibility(id, isVisible) {
351
+ if (!autoHideShow) { return; }
352
+ var elem;
353
+ var v = isVisible ? "visible" : "hidden";
354
+ if (isDomLoaded && (elem && getElementById(id))) {
355
+ getElementById(id).style.visibility = v;
356
+ }
357
+ }
358
+
359
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
360
+ */
361
+ var cleanup = function() {
362
+ if (ua.ie && ua.win && window.attachEvent) {
363
+ window.attachEvent("onunload", function() {
364
+ // remove listeners to avoid memory leaks
365
+ var ll = listenersArr.length;
366
+ for (var i = 0; i < ll; i++) {
367
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
368
+ }
369
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
370
+ var il = objIdArr.length;
371
+ for (var j = 0; j < il; j++) {
372
+ removeSWF(objIdArr[j]);
373
+ }
374
+ // cleanup library's main closures to avoid memory leaks
375
+ for (var k in ua) {
376
+ ua[k] = null;
377
+ }
378
+ ua = null;
379
+ for (var l in swfmini) {
380
+ swfmini[l] = null;
381
+ }
382
+ swfmini = null;
383
+ });
384
+ }
385
+ }();
386
+
387
+ webshims.ready('DOM', callDomLoadFunctions);
388
+
389
+ return {
390
+ /* Public API
391
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
392
+ */
393
+ registerObject: function() {
394
+
395
+ },
396
+
397
+ getObjectById: function(objectIdStr) {
398
+ if (ua.w3) {
399
+ return getObjectById(objectIdStr);
400
+ }
401
+ },
402
+
403
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
404
+ var callbackObj = {success:false, id:replaceElemIdStr};
405
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
406
+ setVisibility(replaceElemIdStr, false);
407
+ addDomLoadEvent(function() {
408
+ widthStr += ""; // auto-convert to string
409
+ heightStr += "";
410
+ var att = {};
411
+ if (attObj && typeof attObj === OBJECT) {
412
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
413
+ att[i] = attObj[i];
414
+ }
415
+ }
416
+ att.data = swfUrlStr;
417
+ att.width = widthStr;
418
+ att.height = heightStr;
419
+ var par = {};
420
+ if (parObj && typeof parObj === OBJECT) {
421
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
422
+ par[j] = parObj[j];
423
+ }
424
+ }
425
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
426
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
427
+ if (typeof par.flashvars != UNDEF) {
428
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
429
+ }
430
+ else {
431
+ par.flashvars = k + "=" + flashvarsObj[k];
432
+ }
433
+ }
434
+ }
435
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
436
+ var obj = createSWF(att, par, replaceElemIdStr);
437
+ if (att.id == replaceElemIdStr) {
438
+ setVisibility(replaceElemIdStr, true);
439
+ }
440
+ callbackObj.success = true;
441
+ callbackObj.ref = obj;
442
+ }
443
+ else { // show alternative content
444
+ setVisibility(replaceElemIdStr, true);
445
+ }
446
+ if (callbackFn) { callbackFn(callbackObj); }
447
+ });
448
+ }
449
+ else if (callbackFn) { callbackFn(callbackObj); }
450
+ },
451
+
452
+ switchOffAutoHideShow: function() {
453
+ autoHideShow = false;
454
+ },
455
+
456
+ ua: ua,
457
+
458
+ getFlashPlayerVersion: function() {
459
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
460
+ },
461
+
462
+ hasFlashPlayerVersion: hasPlayerVersion,
463
+
464
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
465
+ if (ua.w3) {
466
+ return createSWF(attObj, parObj, replaceElemIdStr);
467
+ }
468
+ else {
469
+ return undefined;
470
+ }
471
+ },
472
+
473
+ showExpressInstall: function() {
474
+
475
+ },
476
+
477
+ removeSWF: function(objElemIdStr) {
478
+ if (ua.w3) {
479
+ removeSWF(objElemIdStr);
480
+ }
481
+ },
482
+
483
+ createCSS: function() {
484
+
485
+ },
486
+
487
+ addDomLoadEvent: addDomLoadEvent,
488
+
489
+ addLoadEvent: addLoadEvent,
490
+
491
+
492
+ // For internal usage only
493
+ expressInstallCallback: function() {
494
+
495
+ }
496
+ };
497
+ }();
498
+
499
+ webshims.register('filereader', function( $, webshims ){
500
+ "use strict";
501
+
502
+ (function(){
503
+ var swfobject = swfmini;
504
+
505
+ var readyCallbacks = $.Callbacks('once unique memory'),
506
+ inputsCount = 0,
507
+ currentTarget = null;
508
+
509
+ // if native FileReader support, then dont add the polyfill and make the plugin do nothing
510
+ if (window.FileReader) {
511
+ $.fn.fileReader = function () { return this; }
512
+ return ;
513
+ }
514
+
515
+ /**
516
+ * JQuery Plugin
517
+ */
518
+ $.fn.fileReader = function( options ) {
519
+ if(this.length){
520
+ options = $.extend($.fn.fileReader.defaults, options);
521
+
522
+ var self = this;
523
+ readyCallbacks.add(function() {
524
+ return main(self, options);
525
+ });
526
+ if ($.isFunction(options.callback)) readyCallbacks.add(options.callback);
527
+
528
+ if (!FileAPIProxy.ready) {
529
+ FileAPIProxy.init(options);
530
+ }
531
+ }
532
+ return this;
533
+ };
534
+
535
+ /**
536
+ * Default options
537
+ * allows user set default options
538
+ */
539
+ $.fn.fileReader.defaults = {
540
+ id : 'fileReaderSWFObject', // ID for the created swf object container,
541
+ multiple : null,
542
+ accept : null,
543
+ label : null,
544
+ extensions : null,
545
+ filereader : 'files/filereader.swf', // The path to the filereader swf file
546
+ expressInstall : null, // The path to the express install swf file
547
+ debugMode : false,
548
+ callback : false // Callback function when Filereader is ready
549
+ };
550
+
551
+ /**
552
+ * Plugin callback
553
+ * adds an input to registry
554
+ */
555
+ var main = function(el, options) {
556
+ return el.each(function(i, input) {
557
+ input = $(input);
558
+ var id = input.attr('id');
559
+ var multiple, accept, label;
560
+ if (!id) {
561
+ id = 'flashFileInput' + inputsCount;
562
+ input.attr('id', id);
563
+ inputsCount++;
564
+ }
565
+ multiple = input.prop('multiple');
566
+ accept = input.data('swfaccept') || input.prop('accept') || options.accept;
567
+ label = input.jProp('labels')
568
+ .map(function(){
569
+ return $(this).text();
570
+ }).get().join(' ') ||
571
+ input.data('swflabel') ||
572
+ options.label;
573
+
574
+ FileAPIProxy.inputs[id] = input;
575
+ FileAPIProxy.swfObject.add(id, multiple, accept, label, options.extensions);
576
+
577
+ input.css('z-index', 0)
578
+ .mouseover(function (e) {
579
+ if (id !== currentTarget) {
580
+ e = e || window.event;
581
+ currentTarget = id;
582
+ FileAPIProxy.swfObject.mouseover(id);
583
+ FileAPIProxy.container
584
+ .height(input.outerHeight())
585
+ .width(input.outerWidth())
586
+ .css(input.offset());
587
+ }
588
+ })
589
+ .click(function(e) {
590
+ e.preventDefault();
591
+ e.stopPropagation();
592
+ e.stopImmediatePropagation();
593
+ return false;
594
+ });
595
+ });
596
+ };
597
+
598
+ /**
599
+ * Flash FileReader Proxy
600
+ */
601
+ window.FileAPIProxy = {
602
+ ready: false,
603
+ _inititalized: false,
604
+ init: function(o) {
605
+ var self = this;
606
+ this.debugMode = o.debugMode;
607
+
608
+ if(!this.container){
609
+ this.container = $('<div>').attr('id', o.id)
610
+ .wrap('<div>')
611
+ .parent()
612
+ .css({
613
+ position:'fixed',
614
+ // top:'0px',
615
+ width:'1px',
616
+ height:'1px',
617
+ display:'inline-block',
618
+ background:'transparent',
619
+ 'z-index':99999
620
+ })
621
+ // Hands over mouse events to original input for css styles
622
+ .on('mouseover mouseout mousedown mouseup', function(evt) {
623
+ if(currentTarget){
624
+ $('#' + currentTarget).trigger(evt.type);
625
+ }
626
+ })
627
+ .appendTo('body');
628
+
629
+ swfobject.embedSWF(o.filereader, o.id, '100%', '100%', '10', o.expressInstall, {debugMode: o.debugMode ? true : ''}, {'wmode':'transparent','allowScriptAccess':'sameDomain'}, {}, function(e) {
630
+ self.swfObject = e.ref;
631
+ $(self.swfObject)
632
+ .css({
633
+ display: 'block',
634
+ outline: 0
635
+ })
636
+ .attr('tabindex', 0);
637
+
638
+ self.ready = e.success && typeof e.ref.add === "function";
639
+
640
+ if (self.ready) {
641
+ readyCallbacks.fire();
642
+ }
643
+ });
644
+ }
645
+ },
646
+ swfObject: null,
647
+ container: null,
648
+ // Inputs Registry
649
+ inputs: {},
650
+ // Readers Registry
651
+ readers: {},
652
+ // Receives FileInput events
653
+ onFileInputEvent: function(evt) {
654
+ if (this.debugMode) console.info('FileInput Event ', evt.type, evt);
655
+ if (evt.target in this.inputs) {
656
+ var el = this.inputs[evt.target];
657
+ evt.target = el[0];
658
+ if( evt.type === 'change') {
659
+ webshims.data(evt.target, 'fileList', new FileList(evt.files));
660
+ }
661
+ el.trigger(evt);
662
+ }
663
+ window.focus();
664
+ },
665
+ // Receives FileReader ProgressEvents
666
+ onFileReaderEvent: function(evt) {
667
+ if (this.debugMode) console.info('FileReader Event ', evt.type, evt, evt.target in this.readers);
668
+ if (evt.target in this.readers) {
669
+ var reader = this.readers[evt.target];
670
+ evt.target = reader;
671
+ reader._handleFlashEvent.call(reader, evt);
672
+ }
673
+ },
674
+ // Receives flash FileReader Error Events
675
+ onFileReaderError: function(error) {
676
+ if (this.debugMode) console.log(error);
677
+ },
678
+ onSWFReady: function() {
679
+ this.container.css({position: 'absolute'});
680
+ this.ready = typeof this.swfObject.add === "function";
681
+ if (this.ready) {
682
+ readyCallbacks.fire();
683
+ }
684
+
685
+ return true;
686
+ }
687
+ };
688
+
689
+
690
+ /**
691
+ * Add FileReader to the window object
692
+ */
693
+ window.FileReader = function () {
694
+ // states
695
+ this.EMPTY = 0;
696
+ this.LOADING = 1;
697
+ this.DONE = 2;
698
+
699
+ this.readyState = 0;
700
+
701
+ // File or Blob data
702
+ this.result = null;
703
+
704
+ this.error = null;
705
+
706
+ // event handler attributes
707
+ this.onloadstart = null;
708
+ this.onprogress = null;
709
+ this.onload = null;
710
+ this.onabort = null;
711
+ this.onerror = null;
712
+ this.onloadend = null;
713
+
714
+ // Event Listeners handling using JQuery Callbacks
715
+ this._callbacks = {
716
+ loadstart : $.Callbacks( "unique" ),
717
+ progress : $.Callbacks( "unique" ),
718
+ abort : $.Callbacks( "unique" ),
719
+ error : $.Callbacks( "unique" ),
720
+ load : $.Callbacks( "unique" ),
721
+ loadend : $.Callbacks( "unique" )
722
+ };
723
+
724
+ // Custom properties
725
+ this._id = null;
726
+ };
727
+
728
+ window.FileReader.prototype = {
729
+ // async read methods
730
+ readAsBinaryString: function (file) {
731
+ this._start(file);
732
+ FileAPIProxy.swfObject.read(file.input, file.name, 'readAsBinaryString');
733
+ },
734
+ readAsText: function (file, encoding) {
735
+ this._start(file);
736
+ FileAPIProxy.swfObject.read(file.input, file.name, 'readAsText');
737
+ },
738
+ readAsDataURL: function (file) {
739
+ this._start(file);
740
+ FileAPIProxy.swfObject.read(file.input, file.name, 'readAsDataURL');
741
+ },
742
+ readAsArrayBuffer: function(file){
743
+ throw("Whoops FileReader.readAsArrayBuffer is unimplemented");
744
+ },
745
+
746
+ abort: function () {
747
+ this.result = null;
748
+ if (this.readyState === this.EMPTY || this.readyState === this.DONE) return;
749
+ FileAPIProxy.swfObject.abort(this._id);
750
+ },
751
+
752
+ // Event Target interface
753
+ addEventListener: function (type, listener) {
754
+ if (type in this._callbacks) this._callbacks[type].add(listener);
755
+ },
756
+ removeEventListener: function (type, listener) {
757
+ if (type in this._callbacks) this._callbacks[type].remove(listener);
758
+ },
759
+ dispatchEvent: function (event) {
760
+ event.target = this;
761
+ if (event.type in this._callbacks) {
762
+ var fn = this['on' + event.type];
763
+ if ($.isFunction(fn)) fn(event);
764
+ this._callbacks[event.type].fire(event);
765
+ }
766
+ return true;
767
+ },
768
+
769
+ // Custom private methods
770
+
771
+ // Registers FileReader instance for flash callbacks
772
+ _register: function(file) {
773
+ this._id = file.input + '.' + file.name;
774
+ FileAPIProxy.readers[this._id] = this;
775
+ },
776
+ _start: function(file) {
777
+ this._register(file);
778
+ if (this.readyState === this.LOADING) throw {type: 'InvalidStateError', code: 11, message: 'The object is in an invalid state.'};
779
+ },
780
+ _handleFlashEvent: function(evt) {
781
+ switch (evt.type) {
782
+ case 'loadstart':
783
+ this.readyState = this.LOADING;
784
+ break;
785
+ case 'loadend':
786
+ this.readyState = this.DONE;
787
+ break;
788
+ case 'load':
789
+ this.readyState = this.DONE;
790
+ this.result = FileAPIProxy.swfObject.result(this._id);
791
+ break;
792
+ case 'error':
793
+ this.result = null;
794
+ this.error = {
795
+ name: 'NotReadableError',
796
+ message: 'The File cannot be read!'
797
+ };
798
+ }
799
+ this.dispatchEvent(new FileReaderEvent(evt));
800
+ }
801
+ };
802
+
803
+ /**
804
+ * FileReader ProgressEvent implenting Event interface
805
+ */
806
+ window.FileReaderEvent = function (e) {
807
+ this.initEvent(e);
808
+ };
809
+
810
+ window.FileReaderEvent.prototype = {
811
+ initEvent: function (event) {
812
+ $.extend(this, {
813
+ type: null,
814
+ target: null,
815
+ currentTarget: null,
816
+
817
+ eventPhase: 2,
818
+
819
+ bubbles: false,
820
+ cancelable: false,
821
+
822
+ defaultPrevented: false,
823
+
824
+ isTrusted: false,
825
+ timeStamp: new Date().getTime()
826
+ }, event);
827
+ },
828
+ stopPropagation: function (){
829
+ },
830
+ stopImmediatePropagation: function (){
831
+ },
832
+ preventDefault: function (){
833
+ }
834
+ };
835
+
836
+ /**
837
+ * FileList interface (Object with item function)
838
+ */
839
+ window.FileList = function(array) {
840
+ if (array) {
841
+ for (var i = 0; i < array.length; i++) {
842
+ this[i] = array[i];
843
+ }
844
+ this.length = array.length;
845
+ } else {
846
+ this.length = 0;
847
+ }
848
+ };
849
+
850
+ window.FileList.prototype = {
851
+ item: function(index) {
852
+ return (index in this) ? this[index] : null;
853
+ }
854
+ };
855
+ })();
856
+
857
+ webshims.defineNodeNameProperty('input', 'files', {
858
+ prop: {
859
+ writeable: false,
860
+ get: function(){
861
+ if(this.type != 'file'){return null;}
862
+ if(!$(this).is('.ws-filereader')){
863
+ webshims.error("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
864
+ }
865
+ return webshims.data(this, 'fileList') || webshims.data(this, 'fileList', new FileList());
866
+ }
867
+ }
868
+ }
869
+ );
870
+
871
+ webshims.defineNodeNamesBooleanProperty('input', 'multiple');
872
+
873
+ //webshims
874
+ $.fn.fileReader.defaults.filereader = webshims.cfg.basePath +'swf/filereader.swf';
875
+ var wait = ['DOM'];
876
+ if(webshims.modules["form-core"].loaded){
877
+ wait.push('forms');
878
+ }
879
+ webshims.ready(wait, function(){
880
+ webshims.addReady(function(context, contextElem){
881
+ $('input[type="file"].ws-filereader', context).fileReader();
882
+ });
883
+ });
884
+ });