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,4373 @@
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
+ // vim: ts=4 sts=4 sw=4 expandtab
500
+ // -- kriskowal Kris Kowal Copyright (C) 2009-2011 MIT License
501
+ // -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
502
+ // -- dantman Daniel Friesen Copyright (C) 2010 XXX TODO License or CLA
503
+ // -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
504
+ // -- Gozala Irakli Gozalishvili Copyright (C) 2010 MIT License
505
+ // -- kitcambridge Kit Cambridge Copyright (C) 2011 MIT License
506
+ // -- kossnocorp Sasha Koss XXX TODO License or CLA
507
+ // -- bryanforbes Bryan Forbes XXX TODO License or CLA
508
+ // -- killdream Quildreen Motta Copyright (C) 2011 MIT Licence
509
+ // -- michaelficarra Michael Ficarra Copyright (C) 2011 3-clause BSD License
510
+ // -- sharkbrainguy Gerard Paapu Copyright (C) 2011 MIT License
511
+ // -- bbqsrc Brendan Molloy XXX TODO License or CLA
512
+ // -- iwyg XXX TODO License or CLA
513
+ // -- DomenicDenicola Domenic Denicola XXX TODO License or CLA
514
+ // -- xavierm02 Montillet Xavier XXX TODO License or CLA
515
+ // -- Raynos Raynos XXX TODO License or CLA
516
+ // -- samsonjs Sami Samhuri XXX TODO License or CLA
517
+ // -- rwldrn Rick Waldron Copyright (C) 2011 MIT License
518
+ // -- lexer Alexey Zakharov XXX TODO License or CLA
519
+
520
+ /*!
521
+ Copyright (c) 2009, 280 North Inc. http://280north.com/
522
+ MIT License. http://github.com/280north/narwhal/blob/master/README.md
523
+ */
524
+
525
+ (function (undefined) {
526
+
527
+ /**
528
+ * Brings an environment as close to ECMAScript 5 compliance
529
+ * as is possible with the facilities of erstwhile engines.
530
+ *
531
+ * ES5 Draft
532
+ * http://www.ecma-international.org/publications/files/drafts/tc39-2009-050.pdf
533
+ *
534
+ * NOTE: this is a draft, and as such, the URL is subject to change. If the
535
+ * link is broken, check in the parent directory for the latest TC39 PDF.
536
+ * http://www.ecma-international.org/publications/files/drafts/
537
+ *
538
+ * Previous ES5 Draft
539
+ * http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
540
+ * This is a broken link to the previous draft of ES5 on which most of the
541
+ * numbered specification references and quotes herein were taken. Updating
542
+ * these references and quotes to reflect the new document would be a welcome
543
+ * volunteer project.
544
+ *
545
+ * @module
546
+ */
547
+
548
+ /*whatsupdoc*/
549
+
550
+ // Shortcut to an often accessed properties, in order to avoid multiple
551
+ // dereference that costs universally.
552
+ // _Please note: Shortcuts are defined after `Function.prototype.bind` as we
553
+ // us it in defining shortcuts.
554
+ var call = Function.prototype.call;
555
+ var prototypeOfArray = Array.prototype;
556
+ var prototypeOfObject = Object.prototype;
557
+ var slice = prototypeOfArray.slice;
558
+ var owns;
559
+ var toString;
560
+
561
+ // ES-5 15.3.4.5
562
+ // http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
563
+
564
+ if (!Function.prototype.bind) {
565
+ Function.prototype.bind = function (that) { // .length is 1
566
+ // 1. Let Target be the this value.
567
+ var target = this;
568
+ // 2. If IsCallable(Target) is false, throw a TypeError exception.
569
+ if (typeof target != "function")
570
+ throw new TypeError(); // TODO message
571
+ // 3. Let A be a new (possibly empty) internal list of all of the
572
+ // argument values provided after thisArg (arg1, arg2 etc), in order.
573
+ // XXX slicedArgs will stand in for "A" if used
574
+ var args = slice.call(arguments, 1); // for normal call
575
+ // 4. Let F be a new native ECMAScript object.
576
+ // 9. Set the [[Prototype]] internal property of F to the standard
577
+ // built-in Function prototype object as specified in 15.3.3.1.
578
+ // 10. Set the [[Call]] internal property of F as described in
579
+ // 15.3.4.5.1.
580
+ // 11. Set the [[Construct]] internal property of F as described in
581
+ // 15.3.4.5.2.
582
+ // 12. Set the [[HasInstance]] internal property of F as described in
583
+ // 15.3.4.5.3.
584
+ // 13. The [[Scope]] internal property of F is unused and need not
585
+ // exist.
586
+ var bound = function () {
587
+
588
+ if (this instanceof bound) {
589
+ // 15.3.4.5.2 [[Construct]]
590
+ // When the [[Construct]] internal method of a function object,
591
+ // F that was created using the bind function is called with a
592
+ // list of arguments ExtraArgs the following steps are taken:
593
+ // 1. Let target be the value of F's [[TargetFunction]]
594
+ // internal property.
595
+ // 2. If target has no [[Construct]] internal method, a
596
+ // TypeError exception is thrown.
597
+ // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
598
+ // property.
599
+ // 4. Let args be a new list containing the same values as the
600
+ // list boundArgs in the same order followed by the same
601
+ // values as the list ExtraArgs in the same order.
602
+
603
+ var F = function(){};
604
+ F.prototype = target.prototype;
605
+ var self = new F;
606
+
607
+ var result = target.apply(
608
+ self,
609
+ args.concat(slice.call(arguments))
610
+ );
611
+ if (result !== null && Object(result) === result)
612
+ return result;
613
+ return self;
614
+
615
+ } else {
616
+ // 15.3.4.5.1 [[Call]]
617
+ // When the [[Call]] internal method of a function object, F,
618
+ // which was created using the bind function is called with a
619
+ // this value and a list of arguments ExtraArgs the following
620
+ // steps are taken:
621
+ // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
622
+ // property.
623
+ // 2. Let boundThis be the value of F's [[BoundThis]] internal
624
+ // property.
625
+ // 3. Let target be the value of F's [[TargetFunction]] internal
626
+ // property.
627
+ // 4. Let args be a new list containing the same values as the list
628
+ // boundArgs in the same order followed by the same values as
629
+ // the list ExtraArgs in the same order. 5. Return the
630
+ // result of calling the [[Call]] internal method of target
631
+ // providing boundThis as the this value and providing args
632
+ // as the arguments.
633
+
634
+ // equiv: target.call(this, ...boundArgs, ...args)
635
+ return target.apply(
636
+ that,
637
+ args.concat(slice.call(arguments))
638
+ );
639
+
640
+ }
641
+
642
+ };
643
+ // XXX bound.length is never writable, so don't even try
644
+ //
645
+ // 16. The length own property of F is given attributes as specified in
646
+ // 15.3.5.1.
647
+ // TODO
648
+ // 17. Set the [[Extensible]] internal property of F to true.
649
+ // TODO
650
+ // 18. Call the [[DefineOwnProperty]] internal method of F with
651
+ // arguments "caller", PropertyDescriptor {[[Value]]: null,
652
+ // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
653
+ // false}, and false.
654
+ // TODO
655
+ // 19. Call the [[DefineOwnProperty]] internal method of F with
656
+ // arguments "arguments", PropertyDescriptor {[[Value]]: null,
657
+ // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
658
+ // false}, and false.
659
+ // TODO
660
+ // NOTE Function objects created using Function.prototype.bind do not
661
+ // have a prototype property.
662
+ // XXX can't delete it in pure-js.
663
+ return bound;
664
+ };
665
+ }
666
+
667
+ toString = call.bind(prototypeOfObject.toString);
668
+ owns = call.bind(prototypeOfObject.hasOwnProperty);
669
+
670
+
671
+ //
672
+ // Array
673
+ // =====
674
+ //
675
+
676
+ // ES5 15.4.3.2
677
+ if (!Array.isArray) {
678
+ Array.isArray = function (obj) {
679
+ return toString(obj) == "[object Array]";
680
+ };
681
+ }
682
+
683
+ // The IsCallable() check in the Array functions
684
+ // has been replaced with a strict check on the
685
+ // internal class of the object to trap cases where
686
+ // the provided function was actually a regular
687
+ // expression literal, which in V8 and
688
+ // JavaScriptCore is a typeof "function". Only in
689
+ // V8 are regular expression literals permitted as
690
+ // reduce parameters, so it is desirable in the
691
+ // general case for the shim to match the more
692
+ // strict and common behavior of rejecting regular
693
+ // expressions.
694
+
695
+ // ES5 15.4.4.18
696
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach
697
+ if (!Array.prototype.forEach) {
698
+ Array.prototype.forEach = function (fun /*, thisp*/) {
699
+ var self = toObject(this),
700
+ thisp = arguments[1],
701
+ i = 0,
702
+ length = self.length >>> 0;
703
+
704
+ // If no callback function or if callback is not a callable function
705
+ if (toString(fun) != "[object Function]") {
706
+ throw new TypeError(); // TODO message
707
+ }
708
+
709
+ while (i < length) {
710
+ if (i in self) {
711
+ // Invoke the callback function with call, passing arguments:
712
+ // context, property value, property key, thisArg object context
713
+ fun.call(thisp, self[i], i, self);
714
+ }
715
+ i++;
716
+ }
717
+ };
718
+ }
719
+
720
+ // ES5 15.4.4.19
721
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
722
+ if (!Array.prototype.map) {
723
+ Array.prototype.map = function (fun /*, thisp*/) {
724
+ var self = toObject(this),
725
+ length = self.length >>> 0,
726
+ result = Array(length),
727
+ thisp = arguments[1];
728
+
729
+ // If no callback function or if callback is not a callable function
730
+ if (toString(fun) != "[object Function]") {
731
+ throw new TypeError(); // TODO message
732
+ }
733
+
734
+ for (var i = 0; i < length; i++) {
735
+ if (i in self)
736
+ result[i] = fun.call(thisp, self[i], i, self);
737
+ }
738
+ return result;
739
+ };
740
+ }
741
+
742
+ // ES5 15.4.4.20
743
+ if (!Array.prototype.filter) {
744
+ Array.prototype.filter = function (fun /*, thisp */) {
745
+ var self = toObject(this),
746
+ length = self.length >>> 0,
747
+ result = [],
748
+ thisp = arguments[1];
749
+
750
+ // If no callback function or if callback is not a callable function
751
+ if (toString(fun) != "[object Function]") {
752
+ throw new TypeError(); // TODO message
753
+ }
754
+
755
+ for (var i = 0; i < length; i++) {
756
+ if (i in self && fun.call(thisp, self[i], i, self))
757
+ result.push(self[i]);
758
+ }
759
+ return result;
760
+ };
761
+ }
762
+
763
+ // ES5 15.4.4.16
764
+ if (!Array.prototype.every) {
765
+ Array.prototype.every = function (fun /*, thisp */) {
766
+ var self = toObject(this),
767
+ length = self.length >>> 0,
768
+ thisp = arguments[1];
769
+
770
+ // If no callback function or if callback is not a callable function
771
+ if (toString(fun) != "[object Function]") {
772
+ throw new TypeError(); // TODO message
773
+ }
774
+
775
+ for (var i = 0; i < length; i++) {
776
+ if (i in self && !fun.call(thisp, self[i], i, self))
777
+ return false;
778
+ }
779
+ return true;
780
+ };
781
+ }
782
+
783
+ // ES5 15.4.4.17
784
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
785
+ if (!Array.prototype.some) {
786
+ Array.prototype.some = function (fun /*, thisp */) {
787
+ var self = toObject(this),
788
+ length = self.length >>> 0,
789
+ thisp = arguments[1];
790
+
791
+ // If no callback function or if callback is not a callable function
792
+ if (toString(fun) != "[object Function]") {
793
+ throw new TypeError(); // TODO message
794
+ }
795
+
796
+ for (var i = 0; i < length; i++) {
797
+ if (i in self && fun.call(thisp, self[i], i, self))
798
+ return true;
799
+ }
800
+ return false;
801
+ };
802
+ }
803
+
804
+ // ES5 15.4.4.21
805
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
806
+ if (!Array.prototype.reduce) {
807
+ Array.prototype.reduce = function (fun /*, initial*/) {
808
+ var self = toObject(this),
809
+ length = self.length >>> 0;
810
+
811
+ // If no callback function or if callback is not a callable function
812
+ if (toString(fun) != "[object Function]") {
813
+ throw new TypeError(); // TODO message
814
+ }
815
+
816
+ // no value to return if no initial value and an empty array
817
+ if (!length && arguments.length == 1)
818
+ throw new TypeError(); // TODO message
819
+
820
+ var i = 0;
821
+ var result;
822
+ if (arguments.length >= 2) {
823
+ result = arguments[1];
824
+ } else {
825
+ do {
826
+ if (i in self) {
827
+ result = self[i++];
828
+ break;
829
+ }
830
+
831
+ // if array contains no values, no initial value to return
832
+ if (++i >= length)
833
+ throw new TypeError(); // TODO message
834
+ } while (true);
835
+ }
836
+
837
+ for (; i < length; i++) {
838
+ if (i in self)
839
+ result = fun.call(void 0, result, self[i], i, self);
840
+ }
841
+
842
+ return result;
843
+ };
844
+ }
845
+
846
+ // ES5 15.4.4.22
847
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
848
+ if (!Array.prototype.reduceRight) {
849
+ Array.prototype.reduceRight = function (fun /*, initial*/) {
850
+ var self = toObject(this),
851
+ length = self.length >>> 0;
852
+
853
+ // If no callback function or if callback is not a callable function
854
+ if (toString(fun) != "[object Function]") {
855
+ throw new TypeError(); // TODO message
856
+ }
857
+
858
+ // no value to return if no initial value, empty array
859
+ if (!length && arguments.length == 1)
860
+ throw new TypeError(); // TODO message
861
+
862
+ var result, i = length - 1;
863
+ if (arguments.length >= 2) {
864
+ result = arguments[1];
865
+ } else {
866
+ do {
867
+ if (i in self) {
868
+ result = self[i--];
869
+ break;
870
+ }
871
+
872
+ // if array contains no values, no initial value to return
873
+ if (--i < 0)
874
+ throw new TypeError(); // TODO message
875
+ } while (true);
876
+ }
877
+
878
+ do {
879
+ if (i in this)
880
+ result = fun.call(void 0, result, self[i], i, self);
881
+ } while (i--);
882
+
883
+ return result;
884
+ };
885
+ }
886
+
887
+ // ES5 15.4.4.14
888
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
889
+ if (!Array.prototype.indexOf) {
890
+ Array.prototype.indexOf = function (sought /*, fromIndex */ ) {
891
+ var self = toObject(this),
892
+ length = self.length >>> 0;
893
+
894
+ if (!length)
895
+ return -1;
896
+
897
+ var i = 0;
898
+ if (arguments.length > 1)
899
+ i = toInteger(arguments[1]);
900
+
901
+ // handle negative indices
902
+ i = i >= 0 ? i : length - Math.abs(i);
903
+ for (; i < length; i++) {
904
+ if (i in self && self[i] === sought) {
905
+ return i;
906
+ }
907
+ }
908
+ return -1;
909
+ };
910
+ }
911
+
912
+ // ES5 15.4.4.15
913
+ if (!Array.prototype.lastIndexOf) {
914
+ Array.prototype.lastIndexOf = function (sought /*, fromIndex */) {
915
+ var self = toObject(this),
916
+ length = self.length >>> 0;
917
+
918
+ if (!length)
919
+ return -1;
920
+ var i = length - 1;
921
+ if (arguments.length > 1)
922
+ i = toInteger(arguments[1]);
923
+ // handle negative indices
924
+ i = i >= 0 ? i : length - Math.abs(i);
925
+ for (; i >= 0; i--) {
926
+ if (i in self && sought === self[i])
927
+ return i;
928
+ }
929
+ return -1;
930
+ };
931
+ }
932
+
933
+ //
934
+ // Array
935
+ // =====
936
+ //
937
+
938
+ // ES5 15.4.4.12
939
+ // http://es5.github.com/#x15.4.4.12
940
+ // Default value for second param
941
+ // [bugfix, ielt9, old browsers]
942
+ // IE < 9 bug: [1,2].splice(0).join("") == "" but should be "12"
943
+ if([1,2].splice(0).length != 2) {
944
+ var _origArraySplice = Array.prototype.splice;
945
+
946
+ Array.prototype.splice = function(start, deleteCount) {
947
+ if(!arguments.length)return [];
948
+
949
+ return _origArraySplice.apply(this, [
950
+ start === void 0 ? 0 : start,
951
+ deleteCount === void 0 ? (this.length - start) : deleteCount
952
+ ].concat(slice.call(arguments, 2)))
953
+ };
954
+ }
955
+
956
+ //
957
+ // Object
958
+ // ======
959
+ //
960
+
961
+
962
+ // ES5 15.2.3.14
963
+ // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
964
+ if (!Object.keys) {
965
+
966
+ var hasDontEnumBug = true,
967
+ dontEnums = [
968
+ "toString",
969
+ "toLocaleString",
970
+ "valueOf",
971
+ "hasOwnProperty",
972
+ "isPrototypeOf",
973
+ "propertyIsEnumerable",
974
+ "constructor"
975
+ ],
976
+ dontEnumsLength = dontEnums.length;
977
+
978
+ for (var key in {"toString": null})
979
+ hasDontEnumBug = false;
980
+
981
+ Object.keys = function keys(object) {
982
+
983
+ if ((typeof object != "object" && typeof object != "function") || object === null)
984
+ throw new TypeError("Object.keys called on a non-object");
985
+
986
+ var keys = [];
987
+ for (var name in object) {
988
+ if (owns(object, name)) {
989
+ keys.push(name);
990
+ }
991
+ }
992
+
993
+ if (hasDontEnumBug) {
994
+ for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
995
+ var dontEnum = dontEnums[i];
996
+ if (owns(object, dontEnum)) {
997
+ keys.push(dontEnum);
998
+ }
999
+ }
1000
+ }
1001
+
1002
+ return keys;
1003
+ };
1004
+
1005
+ }
1006
+
1007
+ //
1008
+ // Date
1009
+ // ====
1010
+ //
1011
+
1012
+ // ES5 15.9.5.43
1013
+ // Format a Date object as a string according to a simplified subset of the ISO 8601
1014
+ // standard as defined in 15.9.1.15.
1015
+ if (!Date.prototype.toISOString) {
1016
+ Date.prototype.toISOString = function toISOString() {
1017
+ var result, length, value;
1018
+ if (!isFinite(this))
1019
+ throw new RangeError;
1020
+
1021
+ // the date time string format is specified in 15.9.1.15.
1022
+ result = [this.getUTCFullYear(), this.getUTCMonth() + 1, this.getUTCDate(),
1023
+ this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
1024
+
1025
+ length = result.length;
1026
+ while (length--) {
1027
+ value = result[length];
1028
+ // pad months, days, hours, minutes, and seconds to have two digits.
1029
+ if (value < 10)
1030
+ result[length] = "0" + value;
1031
+ }
1032
+ // pad milliseconds to have three digits.
1033
+ return result.slice(0, 3).join("-") + "T" + result.slice(3).join(":") + "." +
1034
+ ("000" + this.getUTCMilliseconds()).slice(-3) + "Z";
1035
+ }
1036
+ }
1037
+
1038
+ // ES5 15.9.4.4
1039
+ if (!Date.now) {
1040
+ Date.now = function now() {
1041
+ return new Date().getTime();
1042
+ };
1043
+ }
1044
+
1045
+ // ES5 15.9.5.44
1046
+ if (!Date.prototype.toJSON) {
1047
+ Date.prototype.toJSON = function toJSON(key) {
1048
+ // This function provides a String representation of a Date object for
1049
+ // use by JSON.stringify (15.12.3). When the toJSON method is called
1050
+ // with argument key, the following steps are taken:
1051
+
1052
+ // 1. Let O be the result of calling ToObject, giving it the this
1053
+ // value as its argument.
1054
+ // 2. Let tv be ToPrimitive(O, hint Number).
1055
+ // 3. If tv is a Number and is not finite, return null.
1056
+ // XXX
1057
+ // 4. Let toISO be the result of calling the [[Get]] internal method of
1058
+ // O with argument "toISOString".
1059
+ // 5. If IsCallable(toISO) is false, throw a TypeError exception.
1060
+ if (typeof this.toISOString != "function")
1061
+ throw new TypeError(); // TODO message
1062
+ // 6. Return the result of calling the [[Call]] internal method of
1063
+ // toISO with O as the this value and an empty argument list.
1064
+ return this.toISOString();
1065
+
1066
+ // NOTE 1 The argument is ignored.
1067
+
1068
+ // NOTE 2 The toJSON function is intentionally generic; it does not
1069
+ // require that its this value be a Date object. Therefore, it can be
1070
+ // transferred to other kinds of objects for use as a method. However,
1071
+ // it does require that any such object have a toISOString method. An
1072
+ // object is free to use the argument key to filter its
1073
+ // stringification.
1074
+ };
1075
+ }
1076
+
1077
+
1078
+ //
1079
+ // String
1080
+ // ======
1081
+ //
1082
+
1083
+ // ES5 15.5.4.20
1084
+ var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
1085
+ "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
1086
+ "\u2029\uFEFF";
1087
+ if (!String.prototype.trim || ws.trim()) {
1088
+ // http://blog.stevenlevithan.com/archives/faster-trim-javascript
1089
+ // http://perfectionkills.com/whitespace-deviations/
1090
+ ws = "[" + ws + "]";
1091
+ var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
1092
+ trimEndRegexp = new RegExp(ws + ws + "*$");
1093
+ String.prototype.trim = function trim() {
1094
+ return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
1095
+ };
1096
+ }
1097
+
1098
+ // ES5 15.5.4.14
1099
+ // http://es5.github.com/#x15.5.4.14
1100
+ // [bugfix, chrome]
1101
+ // If separator is undefined, then the result array contains just one String, which is the this value (converted to a String). If limit is not undefined, then the output array is truncated so that it contains no more than limit elements.
1102
+ // "0".split(undefined, 0) -> []
1103
+ if("0".split(void 0, 0).length) {
1104
+ var oldSplit = String.prototype.split;
1105
+ String.prototype.split = function(separator, limit) {
1106
+ if(separator === void 0 && limit === 0)return [];
1107
+ return oldSplit.apply(this, arguments);
1108
+ }
1109
+ }
1110
+
1111
+ // ECMA-262, 3rd B.2.3
1112
+ // Note an ECMAScript standart, although ECMAScript 3rd Edition has a non-normative section suggesting uniform semantics
1113
+ // and it should be normalized across all browsers
1114
+ // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
1115
+ if("".substr && "0b".substr(-1) !== "b") {
1116
+ var oldSubstr = String.prototype.substr;
1117
+ /**
1118
+ * Get the substring of a string
1119
+ * @param {integer} start where to start the substring
1120
+ * @param {integer} length how many characters to return
1121
+ * @return {string}
1122
+ */
1123
+ String.prototype.substr = function(start, length) {
1124
+ return oldSubstr.call(this, start < 0 ? (start = this.length + start) < 0 ? 0 : start : start, length);
1125
+ }
1126
+ }
1127
+
1128
+ //
1129
+ // Util
1130
+ // ======
1131
+ //
1132
+
1133
+ // http://jsperf.com/to-integer
1134
+ var toInteger = function (n) {
1135
+ n = +n;
1136
+ if (n !== n) // isNaN
1137
+ n = -1;
1138
+ else if (n !== 0 && n !== (1/0) && n !== -(1/0))
1139
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
1140
+ return n;
1141
+ };
1142
+
1143
+ var prepareString = "a"[0] != "a",
1144
+ // ES5 9.9
1145
+ toObject = function (o) {
1146
+ if (o == null) { // this matches both null and undefined
1147
+ throw new TypeError(); // TODO message
1148
+ }
1149
+ // If the implementation doesn't support by-index access of
1150
+ // string characters (ex. IE < 7), split the string
1151
+ if (prepareString && typeof o == "string" && o) {
1152
+ return o.split("");
1153
+ }
1154
+ return Object(o);
1155
+ };
1156
+
1157
+ })();
1158
+
1159
+
1160
+
1161
+ (function($, shims){
1162
+ var defineProperty = 'defineProperty';
1163
+ var advancedObjectProperties = !!(Object.create && Object.defineProperties && Object.getOwnPropertyDescriptor);
1164
+ //safari5 has defineProperty-interface, but it can't be used on dom-object
1165
+ //only do this test in non-IE browsers, because this hurts dhtml-behavior in some IE8 versions
1166
+ if (advancedObjectProperties && Object[defineProperty] && Object.prototype.__defineGetter__) {
1167
+ (function(){
1168
+ try {
1169
+ var foo = document.createElement('foo');
1170
+ Object[defineProperty](foo, 'bar', {
1171
+ get: function(){
1172
+ return true;
1173
+ }
1174
+ });
1175
+ advancedObjectProperties = !!foo.bar;
1176
+ }
1177
+ catch (e) {
1178
+ advancedObjectProperties = false;
1179
+ }
1180
+ foo = null;
1181
+ })();
1182
+ }
1183
+
1184
+ Modernizr.objectAccessor = !!((advancedObjectProperties || (Object.prototype.__defineGetter__ && Object.prototype.__lookupSetter__)));
1185
+ Modernizr.advancedObjectProperties = advancedObjectProperties;
1186
+
1187
+ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !Object.getOwnPropertyDescriptor || !Object.defineProperty)){
1188
+ var call = Function.prototype.call;
1189
+ var prototypeOfObject = Object.prototype;
1190
+ var owns = call.bind(prototypeOfObject.hasOwnProperty);
1191
+
1192
+ shims.objectCreate = function(proto, props, opts, no__proto__){
1193
+ var o;
1194
+ var f = function(){};
1195
+
1196
+ f.prototype = proto;
1197
+ o = new f();
1198
+
1199
+ if(!no__proto__ && !('__proto__' in o) && !Modernizr.objectAccessor){
1200
+ o.__proto__ = proto;
1201
+ }
1202
+
1203
+ if(props){
1204
+ shims.defineProperties(o, props);
1205
+ }
1206
+
1207
+ if(opts){
1208
+ o.options = jQuery.extend(true, {}, o.options || {}, opts);
1209
+ opts = o.options;
1210
+ }
1211
+
1212
+ if(o._create && jQuery.isFunction(o._create)){
1213
+ o._create(opts);
1214
+ }
1215
+ return o;
1216
+ };
1217
+
1218
+ shims.defineProperties = function(object, props){
1219
+ for (var name in props) {
1220
+ if (owns(props, name)) {
1221
+ shims.defineProperty(object, name, props[name]);
1222
+ }
1223
+ }
1224
+ return object;
1225
+ };
1226
+
1227
+ var descProps = ['configurable', 'enumerable', 'writable'];
1228
+ shims.defineProperty = function(proto, property, descriptor){
1229
+ if(typeof descriptor != "object" || descriptor === null){return proto;}
1230
+
1231
+ if(owns(descriptor, "value")){
1232
+ proto[property] = descriptor.value;
1233
+ return proto;
1234
+ }
1235
+
1236
+ if(proto.__defineGetter__){
1237
+ if (typeof descriptor.get == "function") {
1238
+ proto.__defineGetter__(property, descriptor.get);
1239
+ }
1240
+ if (typeof descriptor.set == "function"){
1241
+ proto.__defineSetter__(property, descriptor.set);
1242
+ }
1243
+ }
1244
+ return proto;
1245
+ };
1246
+
1247
+ shims.getPrototypeOf = function (object) {
1248
+ return Object.getPrototypeOf && Object.getPrototypeOf(object) || object.__proto__ || object.constructor && object.constructor.prototype;
1249
+ };
1250
+
1251
+ //based on http://www.refactory.org/s/object_getownpropertydescriptor/view/latest
1252
+ shims.getOwnPropertyDescriptor = function(obj, prop){
1253
+ if (typeof obj !== "object" && typeof obj !== "function" || obj === null){
1254
+ throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object");
1255
+ }
1256
+ var descriptor;
1257
+ if(Object.defineProperty && Object.getOwnPropertyDescriptor){
1258
+ try{
1259
+ descriptor = Object.getOwnPropertyDescriptor(obj, prop);
1260
+ return descriptor;
1261
+ } catch(e){}
1262
+ }
1263
+ descriptor = {
1264
+ configurable: true,
1265
+ enumerable: true,
1266
+ writable: true,
1267
+ value: undefined
1268
+ };
1269
+ var getter = obj.__lookupGetter__ && obj.__lookupGetter__(prop),
1270
+ setter = obj.__lookupSetter__ && obj.__lookupSetter__(prop)
1271
+ ;
1272
+
1273
+ if (!getter && !setter) { // not an accessor so return prop
1274
+ if(!owns(obj, prop)){
1275
+ return;
1276
+ }
1277
+ descriptor.value = obj[prop];
1278
+ return descriptor;
1279
+ }
1280
+
1281
+ // there is an accessor, remove descriptor.writable; populate descriptor.get and descriptor.set
1282
+ delete descriptor.writable;
1283
+ delete descriptor.value;
1284
+ descriptor.get = descriptor.set = undefined;
1285
+
1286
+ if(getter){
1287
+ descriptor.get = getter;
1288
+ }
1289
+
1290
+ if(setter){
1291
+ descriptor.set = setter;
1292
+ }
1293
+
1294
+ return descriptor;
1295
+ };
1296
+
1297
+ }
1298
+ })(jQuery, jQuery.webshims);
1299
+
1300
+
1301
+
1302
+ //DOM-Extension helper
1303
+ webshims.register('dom-extend', function($, webshims, window, document, undefined){
1304
+ "use strict";
1305
+
1306
+ webshims.assumeARIA = $.support.getSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing;
1307
+
1308
+ if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
1309
+ webshims.error("IE browser modes are busted in IE10. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
1310
+ }
1311
+
1312
+ if(!$.parseHTML){
1313
+ webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims.");
1314
+ }
1315
+ if (!webshims.cfg.no$Switch) {
1316
+ var switch$ = function(){
1317
+ if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
1318
+ webshims.error("jQuery was included more than once. Make sure to include it only once! Webshims and other Plugins might not work properly.");
1319
+ if (window.$) {
1320
+ window.$ = webshims.$;
1321
+ }
1322
+ window.jQuery = webshims.$;
1323
+ }
1324
+ if(webshims.M != Modernizr){
1325
+ webshims.error("Modernizr was included more than once. Make sure to include it only once! Webshims and other scripts might not work properly.");
1326
+ for(var i in Modernizr){
1327
+ if(!(i in webshims.M)){
1328
+ webshims.M[i] = Modernizr[i];
1329
+ }
1330
+ }
1331
+ Modernizr = webshims.M;
1332
+ }
1333
+ };
1334
+ switch$();
1335
+ setTimeout(switch$, 90);
1336
+ $(switch$);
1337
+ }
1338
+ // (function(){
1339
+ // var hostNames = {
1340
+ // 'afarkas.github.io': 1,
1341
+ // localhost: 1,
1342
+ // '127.0.0.1': 1
1343
+ // };
1344
+ //
1345
+ // if( webshims.debug && (hostNames[location.hostname] || location.protocol == 'file:') ){
1346
+ // var list = $('<ul class="webshims-debug-list" />');
1347
+ // webshims.errorLog.push = function(message){
1348
+ // list.appendTo('body');
1349
+ // $('<li style="display: none;">'+ message +'</li>')
1350
+ // .appendTo(list)
1351
+ // .slideDown()
1352
+ // .delay(3000)
1353
+ // .slideUp(function(){
1354
+ // $(this).remove();
1355
+ // if(!$('li', list).length){
1356
+ // list.detach();
1357
+ // }
1358
+ // })
1359
+ // ;
1360
+ // };
1361
+ // $.each(webshims.errorLog, function(i, message){
1362
+ // webshims.errorLog.push(message);
1363
+ // });
1364
+ // }
1365
+ // })();
1366
+
1367
+ //shortcus
1368
+ var modules = webshims.modules;
1369
+ var listReg = /\s*,\s*/;
1370
+
1371
+ //proxying attribute
1372
+ var olds = {};
1373
+ var havePolyfill = {};
1374
+ var extendedProps = {};
1375
+ var extendQ = {};
1376
+ var modifyProps = {};
1377
+
1378
+ var oldVal = $.fn.val;
1379
+ var singleVal = function(elem, name, val, pass, _argless){
1380
+ return (_argless) ? oldVal.call($(elem)) : oldVal.call($(elem), val);
1381
+ };
1382
+
1383
+ //jquery mobile and jquery ui
1384
+ if(!$.widget){
1385
+ (function(){
1386
+ var _cleanData = $.cleanData;
1387
+ $.cleanData = function( elems ) {
1388
+ if(!$.widget){
1389
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
1390
+ try {
1391
+ $( elem ).triggerHandler( "remove" );
1392
+ // http://bugs.jquery.com/ticket/8235
1393
+ } catch( e ) {}
1394
+ }
1395
+ }
1396
+ _cleanData( elems );
1397
+ };
1398
+ })();
1399
+ }
1400
+
1401
+
1402
+ $.fn.val = function(val){
1403
+ var elem = this[0];
1404
+ if(arguments.length && val == null){
1405
+ val = '';
1406
+ }
1407
+ if(!arguments.length){
1408
+ if(!elem || elem.nodeType !== 1){return oldVal.call(this);}
1409
+ return $.prop(elem, 'value', val, 'val', true);
1410
+ }
1411
+ if($.isArray(val)){
1412
+ return oldVal.apply(this, arguments);
1413
+ }
1414
+ var isFunction = $.isFunction(val);
1415
+ return this.each(function(i){
1416
+ elem = this;
1417
+ if(elem.nodeType === 1){
1418
+ if(isFunction){
1419
+ var genVal = val.call( elem, i, $.prop(elem, 'value', undefined, 'val', true));
1420
+ if(genVal == null){
1421
+ genVal = '';
1422
+ }
1423
+ $.prop(elem, 'value', genVal, 'val') ;
1424
+ } else {
1425
+ $.prop(elem, 'value', val, 'val');
1426
+ }
1427
+ }
1428
+ });
1429
+ };
1430
+ $.fn.onTrigger = function(evt, fn){
1431
+ return this.on(evt, fn).each(fn);
1432
+ };
1433
+
1434
+ $.fn.onWSOff = function(evt, fn, trigger, evtDel){
1435
+ if(!evtDel){
1436
+ evtDel = document;
1437
+ }
1438
+ $(evtDel)[trigger ? 'onTrigger' : 'on'](evt, fn);
1439
+ this.on('remove', function(e){
1440
+ if(!e.originalEvent){
1441
+ $(evtDel).off(evt, fn);
1442
+ }
1443
+ });
1444
+ };
1445
+
1446
+ var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
1447
+ var elementData = function(elem, key, val){
1448
+ elem = elem.jquery ? elem[0] : elem;
1449
+ if(!elem){return val || {};}
1450
+ var data = $.data(elem, dataID);
1451
+ if(val !== undefined){
1452
+ if(!data){
1453
+ data = $.data(elem, dataID, {});
1454
+ }
1455
+ if(key){
1456
+ data[key] = val;
1457
+ }
1458
+ }
1459
+
1460
+ return key ? data && data[key] : data;
1461
+ };
1462
+
1463
+
1464
+ [{name: 'getNativeElement', prop: 'nativeElement'}, {name: 'getShadowElement', prop: 'shadowElement'}, {name: 'getShadowFocusElement', prop: 'shadowFocusElement'}].forEach(function(data){
1465
+ $.fn[data.name] = function(){
1466
+ var elems = [];
1467
+ this.each(function(){
1468
+ var shadowData = elementData(this, 'shadowData');
1469
+ var elem = shadowData && shadowData[data.prop] || this;
1470
+ if($.inArray(elem, elems) == -1){
1471
+ elems.push(elem);
1472
+ }
1473
+ });
1474
+ return this.pushStack(elems);
1475
+ };
1476
+ });
1477
+
1478
+ if($.Tween.propHooks._default && $.css){
1479
+ (function(){
1480
+ var isjQ8 = false;
1481
+ try {
1482
+ isjQ8 = $.css($('<b style="width: 10px" />')[0], 'width', '') == '10px';
1483
+ } catch(er){
1484
+ webshims.error(er);
1485
+ }
1486
+ var css = isjQ8 ?
1487
+ function(elem, prop){
1488
+ return $.css( elem, prop, false, "" );
1489
+ } :
1490
+ function(elem, prop){
1491
+ return $.css( elem, prop, "" );
1492
+ }
1493
+ ;
1494
+
1495
+ $.extend($.Tween.propHooks._default, {
1496
+ get: function( tween ) {
1497
+ var result;
1498
+
1499
+ if ( (tween.elem[ tween.prop ] != null || havePolyfill[ tween.prop ]) &&
1500
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
1501
+ return havePolyfill[ tween.prop ] ? $.prop(tween.elem, tween.prop) : tween.elem[ tween.prop ];
1502
+ }
1503
+
1504
+ // passing an empty string as a 3rd parameter to .css will automatically
1505
+ // attempt a parseFloat and fallback to a string if the parse fails
1506
+ // so, simple values such as "10px" are parsed to Float.
1507
+ // complex values such as "rotate(1rad)" are returned as is.
1508
+ result = css( tween.elem, tween.prop );
1509
+ // Empty strings, null, undefined and "auto" are converted to 0.
1510
+ return !result || result === "auto" ? 0 : result;
1511
+ },
1512
+ set: function( tween ) {
1513
+ // use step hook for back compat - use cssHook if its there - use .style if its
1514
+ // available and use plain properties where available
1515
+ if ( jQuery.fx.step[ tween.prop ] ) {
1516
+ jQuery.fx.step[ tween.prop ]( tween );
1517
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
1518
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
1519
+ } else if( !havePolyfill[ tween.prop ] ) {
1520
+ tween.elem[ tween.prop ] = tween.now;
1521
+ } else {
1522
+ $.prop(tween.elem, tween.prop, tween.now);
1523
+ }
1524
+ }
1525
+ });
1526
+ })();
1527
+ }
1528
+
1529
+
1530
+ ['removeAttr', 'prop', 'attr'].forEach(function(type){
1531
+ olds[type] = $[type];
1532
+ $[type] = function(elem, name, value, pass, _argless){
1533
+ var isVal = (pass == 'val');
1534
+ var oldMethod = !isVal ? olds[type] : singleVal;
1535
+ if( !elem || !havePolyfill[name] || elem.nodeType !== 1 || (!isVal && pass && type == 'attr' && $.attrFn[name]) ){
1536
+ return oldMethod(elem, name, value, pass, _argless);
1537
+ }
1538
+
1539
+ var nodeName = (elem.nodeName || '').toLowerCase();
1540
+ var desc = extendedProps[nodeName];
1541
+ var curType = (type == 'attr' && (value === false || value === null)) ? 'removeAttr' : type;
1542
+ var propMethod;
1543
+ var oldValMethod;
1544
+ var ret;
1545
+
1546
+
1547
+ if(!desc){
1548
+ desc = extendedProps['*'];
1549
+ }
1550
+ if(desc){
1551
+ desc = desc[name];
1552
+ }
1553
+
1554
+ if(desc){
1555
+ propMethod = desc[curType];
1556
+ }
1557
+
1558
+ if(propMethod){
1559
+ if(name == 'value'){
1560
+ oldValMethod = propMethod.isVal;
1561
+ propMethod.isVal = isVal;
1562
+ }
1563
+ if(curType === 'removeAttr'){
1564
+ return propMethod.value.call(elem);
1565
+ } else if(value === undefined){
1566
+ return (propMethod.get) ?
1567
+ propMethod.get.call(elem) :
1568
+ propMethod.value
1569
+ ;
1570
+ } else if(propMethod.set) {
1571
+ if(type == 'attr' && value === true){
1572
+ value = name;
1573
+ }
1574
+
1575
+ ret = propMethod.set.call(elem, value);
1576
+ }
1577
+ if(name == 'value'){
1578
+ propMethod.isVal = oldValMethod;
1579
+ }
1580
+ } else {
1581
+ ret = oldMethod(elem, name, value, pass, _argless);
1582
+ }
1583
+ if((value !== undefined || curType === 'removeAttr') && modifyProps[nodeName] && modifyProps[nodeName][name]){
1584
+
1585
+ var boolValue;
1586
+ if(curType == 'removeAttr'){
1587
+ boolValue = false;
1588
+ } else if(curType == 'prop'){
1589
+ boolValue = !!(value);
1590
+ } else {
1591
+ boolValue = true;
1592
+ }
1593
+
1594
+ modifyProps[nodeName][name].forEach(function(fn){
1595
+ if(!fn.only || (fn.only = 'prop' && type == 'prop') || (fn.only == 'attr' && type != 'prop')){
1596
+ fn.call(elem, value, boolValue, (isVal) ? 'val' : curType, type);
1597
+ }
1598
+ });
1599
+ }
1600
+ return ret;
1601
+ };
1602
+
1603
+ extendQ[type] = function(nodeName, prop, desc){
1604
+
1605
+ if(!extendedProps[nodeName]){
1606
+ extendedProps[nodeName] = {};
1607
+ }
1608
+ if(!extendedProps[nodeName][prop]){
1609
+ extendedProps[nodeName][prop] = {};
1610
+ }
1611
+ var oldDesc = extendedProps[nodeName][prop][type];
1612
+ var getSup = function(propType, descriptor, oDesc){
1613
+ if(descriptor && descriptor[propType]){
1614
+ return descriptor[propType];
1615
+ }
1616
+ if(oDesc && oDesc[propType]){
1617
+ return oDesc[propType];
1618
+ }
1619
+ if(type == 'prop' && prop == 'value'){
1620
+ return function(value){
1621
+ var elem = this;
1622
+ return (desc.isVal) ?
1623
+ singleVal(elem, prop, value, false, (arguments.length === 0)) :
1624
+ olds[type](elem, prop, value)
1625
+ ;
1626
+ };
1627
+ }
1628
+ if(type == 'prop' && propType == 'value' && desc.value.apply){
1629
+ return function(value){
1630
+ var sup = olds[type](this, prop);
1631
+ if(sup && sup.apply){
1632
+ sup = sup.apply(this, arguments);
1633
+ }
1634
+ return sup;
1635
+ };
1636
+ }
1637
+ return function(value){
1638
+ return olds[type](this, prop, value);
1639
+ };
1640
+ };
1641
+ extendedProps[nodeName][prop][type] = desc;
1642
+ if(desc.value === undefined){
1643
+ if(!desc.set){
1644
+ desc.set = desc.writeable ?
1645
+ getSup('set', desc, oldDesc) :
1646
+ (webshims.cfg.useStrict && prop == 'prop') ?
1647
+ function(){throw(prop +' is readonly on '+ nodeName);} :
1648
+ function(){webshims.info(prop +' is readonly on '+ nodeName);}
1649
+ ;
1650
+ }
1651
+ if(!desc.get){
1652
+ desc.get = getSup('get', desc, oldDesc);
1653
+ }
1654
+
1655
+ }
1656
+
1657
+ ['value', 'get', 'set'].forEach(function(descProp){
1658
+ if(desc[descProp]){
1659
+ desc['_sup'+descProp] = getSup(descProp, oldDesc);
1660
+ }
1661
+ });
1662
+ };
1663
+
1664
+ });
1665
+
1666
+ var extendNativeValue = (function(){
1667
+ var UNKNOWN = webshims.getPrototypeOf(document.createElement('foobar'));
1668
+ var has = Object.prototype.hasOwnProperty;
1669
+ //see also: https://github.com/lojjic/PIE/issues/40 | https://prototype.lighthouseapp.com/projects/8886/tickets/1107-ie8-fatal-crash-when-prototypejs-is-loaded-with-rounded-cornershtc
1670
+ var isExtendNativeSave = Modernizr.advancedObjectProperties && Modernizr.objectAccessor;
1671
+ return function(nodeName, prop, desc){
1672
+ var elem , elemProto;
1673
+ if( isExtendNativeSave && (elem = document.createElement(nodeName)) && (elemProto = webshims.getPrototypeOf(elem)) && UNKNOWN !== elemProto && ( !elem[prop] || !has.call(elem, prop) ) ){
1674
+ var sup = elem[prop];
1675
+ desc._supvalue = function(){
1676
+ if(sup && sup.apply){
1677
+ return sup.apply(this, arguments);
1678
+ }
1679
+ return sup;
1680
+ };
1681
+ elemProto[prop] = desc.value;
1682
+ } else {
1683
+ desc._supvalue = function(){
1684
+ var data = elementData(this, 'propValue');
1685
+ if(data && data[prop] && data[prop].apply){
1686
+ return data[prop].apply(this, arguments);
1687
+ }
1688
+ return data && data[prop];
1689
+ };
1690
+ initProp.extendValue(nodeName, prop, desc.value);
1691
+ }
1692
+ desc.value._supvalue = desc._supvalue;
1693
+ };
1694
+ })();
1695
+
1696
+ var initProp = (function(){
1697
+
1698
+ var initProps = {};
1699
+
1700
+ webshims.addReady(function(context, contextElem){
1701
+ var nodeNameCache = {};
1702
+ var getElementsByName = function(name){
1703
+ if(!nodeNameCache[name]){
1704
+ nodeNameCache[name] = $(context.getElementsByTagName(name));
1705
+ if(contextElem[0] && $.nodeName(contextElem[0], name)){
1706
+ nodeNameCache[name] = nodeNameCache[name].add(contextElem);
1707
+ }
1708
+ }
1709
+ };
1710
+
1711
+
1712
+ $.each(initProps, function(name, fns){
1713
+ getElementsByName(name);
1714
+ if(!fns || !fns.forEach){
1715
+ webshims.warn('Error: with '+ name +'-property. methods: '+ fns);
1716
+ return;
1717
+ }
1718
+ fns.forEach(function(fn){
1719
+ nodeNameCache[name].each(fn);
1720
+ });
1721
+ });
1722
+ nodeNameCache = null;
1723
+ });
1724
+
1725
+ var tempCache;
1726
+ var emptyQ = $([]);
1727
+ var createNodeNameInit = function(nodeName, fn){
1728
+ if(!initProps[nodeName]){
1729
+ initProps[nodeName] = [fn];
1730
+ } else {
1731
+ initProps[nodeName].push(fn);
1732
+ }
1733
+ if($.isDOMReady){
1734
+ (tempCache || $( document.getElementsByTagName(nodeName) )).each(fn);
1735
+ }
1736
+ };
1737
+
1738
+ var elementExtends = {};
1739
+ return {
1740
+ createTmpCache: function(nodeName){
1741
+ if($.isDOMReady){
1742
+ tempCache = tempCache || $( document.getElementsByTagName(nodeName) );
1743
+ }
1744
+ return tempCache || emptyQ;
1745
+ },
1746
+ flushTmpCache: function(){
1747
+ tempCache = null;
1748
+ },
1749
+ content: function(nodeName, prop){
1750
+ createNodeNameInit(nodeName, function(){
1751
+ var val = $.attr(this, prop);
1752
+ if(val != null){
1753
+ $.attr(this, prop, val);
1754
+ }
1755
+ });
1756
+ },
1757
+ createElement: function(nodeName, fn){
1758
+ createNodeNameInit(nodeName, fn);
1759
+ },
1760
+ extendValue: function(nodeName, prop, value){
1761
+ createNodeNameInit(nodeName, function(){
1762
+ $(this).each(function(){
1763
+ var data = elementData(this, 'propValue', {});
1764
+ data[prop] = this[prop];
1765
+ this[prop] = value;
1766
+ });
1767
+ });
1768
+ }
1769
+ };
1770
+ })();
1771
+
1772
+ var createPropDefault = function(descs, removeType){
1773
+ if(descs.defaultValue === undefined){
1774
+ descs.defaultValue = '';
1775
+ }
1776
+ if(!descs.removeAttr){
1777
+ descs.removeAttr = {
1778
+ value: function(){
1779
+ descs[removeType || 'prop'].set.call(this, descs.defaultValue);
1780
+ descs.removeAttr._supvalue.call(this);
1781
+ }
1782
+ };
1783
+ }
1784
+ if(!descs.attr){
1785
+ descs.attr = {};
1786
+ }
1787
+ };
1788
+
1789
+ $.extend(webshims, {
1790
+
1791
+ getID: (function(){
1792
+ var ID = new Date().getTime();
1793
+ return function(elem){
1794
+ elem = $(elem);
1795
+ var id = elem.prop('id');
1796
+ if(!id){
1797
+ ID++;
1798
+ id = 'ID-'+ ID;
1799
+ elem.eq(0).prop('id', id);
1800
+ }
1801
+ return id;
1802
+ };
1803
+ })(),
1804
+ implement: function(elem, type){
1805
+ var data = elementData(elem, 'implemented') || elementData(elem, 'implemented', {});
1806
+ if(data[type]){
1807
+ webshims.warn(type +' already implemented for element #'+elem.id);
1808
+ return false;
1809
+ }
1810
+ data[type] = true;
1811
+ return true;
1812
+ },
1813
+ extendUNDEFProp: function(obj, props){
1814
+ $.each(props, function(name, prop){
1815
+ if( !(name in obj) ){
1816
+ obj[name] = prop;
1817
+ }
1818
+ });
1819
+ },
1820
+ //http://www.w3.org/TR/html5/common-dom-interfaces.html#reflect
1821
+ createPropDefault: createPropDefault,
1822
+ data: elementData,
1823
+ moveToFirstEvent: function(elem, eventType, bindType){
1824
+ var events = ($._data(elem, 'events') || {})[eventType];
1825
+ var fn;
1826
+
1827
+ if(events && events.length > 1){
1828
+ fn = events.pop();
1829
+ if(!bindType){
1830
+ bindType = 'bind';
1831
+ }
1832
+ if(bindType == 'bind' && events.delegateCount){
1833
+ events.splice( events.delegateCount, 0, fn);
1834
+ } else {
1835
+ events.unshift( fn );
1836
+ }
1837
+
1838
+
1839
+ }
1840
+ elem = null;
1841
+ },
1842
+ addShadowDom: (function(){
1843
+ var resizeTimer;
1844
+ var lastHeight;
1845
+ var lastWidth;
1846
+
1847
+ var docObserve = {
1848
+ init: false,
1849
+ runs: 0,
1850
+ test: function(){
1851
+ var height = docObserve.getHeight();
1852
+ var width = docObserve.getWidth();
1853
+
1854
+ if(height != docObserve.height || width != docObserve.width){
1855
+ docObserve.height = height;
1856
+ docObserve.width = width;
1857
+ docObserve.handler({type: 'docresize'});
1858
+ docObserve.runs++;
1859
+ if(docObserve.runs < 9){
1860
+ setTimeout(docObserve.test, 90);
1861
+ }
1862
+ } else {
1863
+ docObserve.runs = 0;
1864
+ }
1865
+ },
1866
+ handler: function(e){
1867
+ clearTimeout(resizeTimer);
1868
+ resizeTimer = setTimeout(function(){
1869
+ if(e.type == 'resize'){
1870
+ var width = $(window).width();
1871
+ var height = $(window).width();
1872
+ if(height == lastHeight && width == lastWidth){
1873
+ return;
1874
+ }
1875
+ lastHeight = height;
1876
+ lastWidth = width;
1877
+
1878
+ docObserve.height = docObserve.getHeight();
1879
+ docObserve.width = docObserve.getWidth();
1880
+
1881
+ }
1882
+ $(document).triggerHandler('updateshadowdom');
1883
+ }, (e.type == 'resize') ? 50 : 9);
1884
+ },
1885
+ _create: function(){
1886
+ $.each({ Height: "getHeight", Width: "getWidth" }, function(name, type){
1887
+ var body = document.body;
1888
+ var doc = document.documentElement;
1889
+ docObserve[type] = function(){
1890
+ return Math.max(
1891
+ body[ "scroll" + name ], doc[ "scroll" + name ],
1892
+ body[ "offset" + name ], doc[ "offset" + name ],
1893
+ doc[ "client" + name ]
1894
+ );
1895
+ };
1896
+ });
1897
+ },
1898
+ start: function(){
1899
+ if(!this.init && document.body){
1900
+ this.init = true;
1901
+ this._create();
1902
+ this.height = docObserve.getHeight();
1903
+ this.width = docObserve.getWidth();
1904
+ setInterval(this.test, 600);
1905
+ $(this.test);
1906
+ webshims.ready('WINDOWLOAD', this.test);
1907
+ $(window).bind('resize', this.handler);
1908
+ (function(){
1909
+ var oldAnimate = $.fn.animate;
1910
+ var animationTimer;
1911
+
1912
+ $.fn.animate = function(){
1913
+ clearTimeout(animationTimer);
1914
+ animationTimer = setTimeout(function(){
1915
+ docObserve.test();
1916
+ }, 99);
1917
+
1918
+ return oldAnimate.apply(this, arguments);
1919
+ };
1920
+ })();
1921
+ }
1922
+ }
1923
+ };
1924
+
1925
+
1926
+ webshims.docObserve = function(){
1927
+ webshims.ready('DOM', function(){
1928
+ docObserve.start();
1929
+ });
1930
+ };
1931
+ return function(nativeElem, shadowElem, opts){
1932
+ opts = opts || {};
1933
+ if(nativeElem.jquery){
1934
+ nativeElem = nativeElem[0];
1935
+ }
1936
+ if(shadowElem.jquery){
1937
+ shadowElem = shadowElem[0];
1938
+ }
1939
+ var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1940
+ var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1941
+ var shadowFocusElementData = {};
1942
+ if(!opts.shadowFocusElement){
1943
+ opts.shadowFocusElement = shadowElem;
1944
+ } else if(opts.shadowFocusElement){
1945
+ if(opts.shadowFocusElement.jquery){
1946
+ opts.shadowFocusElement = opts.shadowFocusElement[0];
1947
+ }
1948
+ shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1949
+ }
1950
+
1951
+ $(nativeElem).on('remove', function(e){
1952
+ if (!e.originalEvent) {
1953
+ $(shadowElem).remove();
1954
+ }
1955
+ });
1956
+
1957
+ nativeData.hasShadow = shadowElem;
1958
+ shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1959
+ shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1960
+ nativeElement: nativeElem,
1961
+ shadowElement: shadowElem,
1962
+ shadowFocusElement: opts.shadowFocusElement
1963
+ };
1964
+ if(opts.shadowChilds){
1965
+ opts.shadowChilds.each(function(){
1966
+ elementData(this, 'shadowData', shadowData.shadowData);
1967
+ });
1968
+ }
1969
+
1970
+ if(opts.data){
1971
+ shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1972
+ }
1973
+ opts = null;
1974
+ webshims.docObserve();
1975
+ };
1976
+ })(),
1977
+ propTypes: {
1978
+ standard: function(descs, name){
1979
+ createPropDefault(descs);
1980
+ if(descs.prop){return;}
1981
+ descs.prop = {
1982
+ set: function(val){
1983
+ descs.attr.set.call(this, ''+val);
1984
+ },
1985
+ get: function(){
1986
+ return descs.attr.get.call(this) || descs.defaultValue;
1987
+ }
1988
+ };
1989
+
1990
+ },
1991
+ "boolean": function(descs, name){
1992
+
1993
+ createPropDefault(descs);
1994
+ if(descs.prop){return;}
1995
+ descs.prop = {
1996
+ set: function(val){
1997
+ if(val){
1998
+ descs.attr.set.call(this, "");
1999
+ } else {
2000
+ descs.removeAttr.value.call(this);
2001
+ }
2002
+ },
2003
+ get: function(){
2004
+ return descs.attr.get.call(this) != null;
2005
+ }
2006
+ };
2007
+ },
2008
+ "src": (function(){
2009
+ var anchor = document.createElement('a');
2010
+ anchor.style.display = "none";
2011
+ return function(descs, name){
2012
+
2013
+ createPropDefault(descs);
2014
+ if(descs.prop){return;}
2015
+ descs.prop = {
2016
+ set: function(val){
2017
+ descs.attr.set.call(this, val);
2018
+ },
2019
+ get: function(){
2020
+ var href = this.getAttribute(name);
2021
+ var ret;
2022
+ if(href == null){return '';}
2023
+
2024
+ anchor.setAttribute('href', href+'' );
2025
+
2026
+ if(!$.support.hrefNormalized){
2027
+ try {
2028
+ $(anchor).insertAfter(this);
2029
+ ret = anchor.getAttribute('href', 4);
2030
+ } catch(er){
2031
+ ret = anchor.getAttribute('href', 4);
2032
+ }
2033
+ $(anchor).detach();
2034
+ }
2035
+ return ret || anchor.href;
2036
+ }
2037
+ };
2038
+ };
2039
+ })(),
2040
+ enumarated: function(descs, name){
2041
+
2042
+ createPropDefault(descs);
2043
+ if(descs.prop){return;}
2044
+ descs.prop = {
2045
+ set: function(val){
2046
+ descs.attr.set.call(this, val);
2047
+ },
2048
+ get: function(){
2049
+ var val = (descs.attr.get.call(this) || '').toLowerCase();
2050
+ if(!val || descs.limitedTo.indexOf(val) == -1){
2051
+ val = descs.defaultValue;
2052
+ }
2053
+ return val;
2054
+ }
2055
+ };
2056
+ }
2057
+
2058
+ // ,unsignedLong: $.noop
2059
+ // ,"doubble": $.noop
2060
+ // ,"long": $.noop
2061
+ // ,tokenlist: $.noop
2062
+ // ,settableTokenlist: $.noop
2063
+ },
2064
+ reflectProperties: function(nodeNames, props){
2065
+ if(typeof props == 'string'){
2066
+ props = props.split(listReg);
2067
+ }
2068
+ props.forEach(function(prop){
2069
+ webshims.defineNodeNamesProperty(nodeNames, prop, {
2070
+ prop: {
2071
+ set: function(val){
2072
+ $.attr(this, prop, val);
2073
+ },
2074
+ get: function(){
2075
+ return $.attr(this, prop) || '';
2076
+ }
2077
+ }
2078
+ });
2079
+ });
2080
+ },
2081
+ defineNodeNameProperty: function(nodeName, prop, descs){
2082
+ havePolyfill[prop] = true;
2083
+
2084
+ if(descs.reflect){
2085
+ webshims.propTypes[descs.propType || 'standard'](descs, prop);
2086
+ }
2087
+
2088
+ ['prop', 'attr', 'removeAttr'].forEach(function(type){
2089
+ var desc = descs[type];
2090
+ if(desc){
2091
+ if(type === 'prop'){
2092
+ desc = $.extend({writeable: true}, desc);
2093
+ } else {
2094
+ desc = $.extend({}, desc, {writeable: true});
2095
+ }
2096
+
2097
+ extendQ[type](nodeName, prop, desc);
2098
+ if(nodeName != '*' && webshims.cfg.extendNative && type == 'prop' && desc.value && $.isFunction(desc.value)){
2099
+ extendNativeValue(nodeName, prop, desc);
2100
+ }
2101
+ descs[type] = desc;
2102
+ }
2103
+ });
2104
+ if(descs.initAttr){
2105
+ initProp.content(nodeName, prop);
2106
+ }
2107
+ return descs;
2108
+ },
2109
+
2110
+ defineNodeNameProperties: function(name, descs, propType, _noTmpCache){
2111
+ var olddesc;
2112
+ for(var prop in descs){
2113
+ if(!_noTmpCache && descs[prop].initAttr){
2114
+ initProp.createTmpCache(name);
2115
+ }
2116
+ if(propType){
2117
+ if(descs[prop][propType]){
2118
+ //webshims.log('override: '+ name +'['+prop +'] for '+ propType);
2119
+ } else {
2120
+ descs[prop][propType] = {};
2121
+ ['value', 'set', 'get'].forEach(function(copyProp){
2122
+ if(copyProp in descs[prop]){
2123
+ descs[prop][propType][copyProp] = descs[prop][copyProp];
2124
+ delete descs[prop][copyProp];
2125
+ }
2126
+ });
2127
+ }
2128
+ }
2129
+ descs[prop] = webshims.defineNodeNameProperty(name, prop, descs[prop]);
2130
+ }
2131
+ if(!_noTmpCache){
2132
+ initProp.flushTmpCache();
2133
+ }
2134
+ return descs;
2135
+ },
2136
+
2137
+ createElement: function(nodeName, create, descs){
2138
+ var ret;
2139
+ if($.isFunction(create)){
2140
+ create = {
2141
+ after: create
2142
+ };
2143
+ }
2144
+ initProp.createTmpCache(nodeName);
2145
+ if(create.before){
2146
+ initProp.createElement(nodeName, create.before);
2147
+ }
2148
+ if(descs){
2149
+ ret = webshims.defineNodeNameProperties(nodeName, descs, false, true);
2150
+ }
2151
+ if(create.after){
2152
+ initProp.createElement(nodeName, create.after);
2153
+ }
2154
+ initProp.flushTmpCache();
2155
+ return ret;
2156
+ },
2157
+ onNodeNamesPropertyModify: function(nodeNames, props, desc, only){
2158
+ if(typeof nodeNames == 'string'){
2159
+ nodeNames = nodeNames.split(listReg);
2160
+ }
2161
+ if($.isFunction(desc)){
2162
+ desc = {set: desc};
2163
+ }
2164
+
2165
+ nodeNames.forEach(function(name){
2166
+ if(!modifyProps[name]){
2167
+ modifyProps[name] = {};
2168
+ }
2169
+ if(typeof props == 'string'){
2170
+ props = props.split(listReg);
2171
+ }
2172
+ if(desc.initAttr){
2173
+ initProp.createTmpCache(name);
2174
+ }
2175
+ props.forEach(function(prop){
2176
+ if(!modifyProps[name][prop]){
2177
+ modifyProps[name][prop] = [];
2178
+ havePolyfill[prop] = true;
2179
+ }
2180
+ if(desc.set){
2181
+ if(only){
2182
+ desc.set.only = only;
2183
+ }
2184
+ modifyProps[name][prop].push(desc.set);
2185
+ }
2186
+
2187
+ if(desc.initAttr){
2188
+ initProp.content(name, prop);
2189
+ }
2190
+ });
2191
+ initProp.flushTmpCache();
2192
+
2193
+ });
2194
+ },
2195
+ defineNodeNamesBooleanProperty: function(elementNames, prop, descs){
2196
+ if(!descs){
2197
+ descs = {};
2198
+ }
2199
+ if($.isFunction(descs)){
2200
+ descs.set = descs;
2201
+ }
2202
+ webshims.defineNodeNamesProperty(elementNames, prop, {
2203
+ attr: {
2204
+ set: function(val){
2205
+ this.setAttribute(prop, val);
2206
+ if(descs.set){
2207
+ descs.set.call(this, true);
2208
+ }
2209
+ },
2210
+ get: function(){
2211
+ var ret = this.getAttribute(prop);
2212
+ return (ret == null) ? undefined : prop;
2213
+ }
2214
+ },
2215
+ removeAttr: {
2216
+ value: function(){
2217
+ this.removeAttribute(prop);
2218
+ if(descs.set){
2219
+ descs.set.call(this, false);
2220
+ }
2221
+ }
2222
+ },
2223
+ reflect: true,
2224
+ propType: 'boolean',
2225
+ initAttr: descs.initAttr || false
2226
+ });
2227
+ },
2228
+ contentAttr: function(elem, name, val){
2229
+ if(!elem.nodeName){return;}
2230
+ var attr;
2231
+ if(val === undefined){
2232
+ attr = (elem.attributes[name] || {});
2233
+ val = attr.specified ? attr.value : null;
2234
+ return (val == null) ? undefined : val;
2235
+ }
2236
+
2237
+ if(typeof val == 'boolean'){
2238
+ if(!val){
2239
+ elem.removeAttribute(name);
2240
+ } else {
2241
+ elem.setAttribute(name, name);
2242
+ }
2243
+ } else {
2244
+ elem.setAttribute(name, val);
2245
+ }
2246
+ },
2247
+
2248
+ // set current Lang:
2249
+ // - webshims.activeLang(lang:string);
2250
+ // get current lang
2251
+ // - webshims.activeLang();
2252
+ // get current lang
2253
+ // webshims.activeLang({
2254
+ // register: moduleName:string,
2255
+ // callback: callback:function
2256
+ // });
2257
+ // get/set including removeLang
2258
+ // - webshims.activeLang({
2259
+ // module: moduleName:string,
2260
+ // callback: callback:function,
2261
+ // langObj: languageObj:array/object
2262
+ // });
2263
+ activeLang: (function(){
2264
+ var callbacks = [];
2265
+ var registeredCallbacks = {};
2266
+ var currentLang;
2267
+ var shortLang;
2268
+ var notLocal = /:\/\/|^\.*\//;
2269
+ var loadRemoteLang = function(data, lang, options){
2270
+ var langSrc;
2271
+ if(lang && options && $.inArray(lang, options.availabeLangs || []) !== -1){
2272
+ data.loading = true;
2273
+ langSrc = options.langSrc;
2274
+ if(!notLocal.test(langSrc)){
2275
+ langSrc = webshims.cfg.basePath+langSrc;
2276
+ }
2277
+ webshims.loader.loadScript(langSrc+lang+'.js', function(){
2278
+ if(data.langObj[lang]){
2279
+ data.loading = false;
2280
+ callLang(data, true);
2281
+ } else {
2282
+ $(function(){
2283
+ if(data.langObj[lang]){
2284
+ callLang(data, true);
2285
+ }
2286
+ data.loading = false;
2287
+ });
2288
+ }
2289
+ });
2290
+ return true;
2291
+ }
2292
+ return false;
2293
+ };
2294
+ var callRegister = function(module){
2295
+ if(registeredCallbacks[module]){
2296
+ registeredCallbacks[module].forEach(function(data){
2297
+ data.callback(currentLang, shortLang, '');
2298
+ });
2299
+ }
2300
+ };
2301
+ var callLang = function(data, _noLoop){
2302
+ if(data.activeLang != currentLang && data.activeLang !== shortLang){
2303
+ var options = modules[data.module].options;
2304
+ if( data.langObj[currentLang] || (shortLang && data.langObj[shortLang]) ){
2305
+ data.activeLang = currentLang;
2306
+ data.callback(data.langObj[currentLang] || data.langObj[shortLang], currentLang);
2307
+ callRegister(data.module);
2308
+ } else if( !_noLoop &&
2309
+ !loadRemoteLang(data, currentLang, options) &&
2310
+ !loadRemoteLang(data, shortLang, options) &&
2311
+ data.langObj[''] && data.activeLang !== '' ) {
2312
+ data.activeLang = '';
2313
+ data.callback(data.langObj[''], currentLang);
2314
+ callRegister(data.module);
2315
+ }
2316
+ }
2317
+ };
2318
+
2319
+
2320
+ var activeLang = function(lang){
2321
+
2322
+ if(typeof lang == 'string' && lang !== currentLang){
2323
+ currentLang = lang;
2324
+ shortLang = currentLang.split('-')[0];
2325
+ if(currentLang == shortLang){
2326
+ shortLang = false;
2327
+ }
2328
+ $.each(callbacks, function(i, data){
2329
+ callLang(data);
2330
+ });
2331
+ } else if(typeof lang == 'object'){
2332
+
2333
+ if(lang.register){
2334
+ if(!registeredCallbacks[lang.register]){
2335
+ registeredCallbacks[lang.register] = [];
2336
+ }
2337
+ registeredCallbacks[lang.register].push(lang);
2338
+ lang.callback(currentLang, shortLang, '');
2339
+ } else {
2340
+ if(!lang.activeLang){
2341
+ lang.activeLang = '';
2342
+ }
2343
+ callbacks.push(lang);
2344
+ callLang(lang);
2345
+ }
2346
+ }
2347
+ return currentLang;
2348
+ };
2349
+
2350
+ return activeLang;
2351
+ })()
2352
+ });
2353
+
2354
+ $.each({
2355
+ defineNodeNamesProperty: 'defineNodeNameProperty',
2356
+ defineNodeNamesProperties: 'defineNodeNameProperties',
2357
+ createElements: 'createElement'
2358
+ }, function(name, baseMethod){
2359
+ webshims[name] = function(names, a, b, c){
2360
+ if(typeof names == 'string'){
2361
+ names = names.split(listReg);
2362
+ }
2363
+ var retDesc = {};
2364
+ names.forEach(function(nodeName){
2365
+ retDesc[nodeName] = webshims[baseMethod](nodeName, a, b, c);
2366
+ });
2367
+ return retDesc;
2368
+ };
2369
+ });
2370
+
2371
+ webshims.isReady('webshimLocalization', true);
2372
+ });
2373
+ //html5a11y
2374
+ (function($, document){
2375
+ if(!$.webshims.assumeARIA || ('content' in document.createElement('template'))){return;}
2376
+
2377
+ $(function(){
2378
+ var main = $('main').attr({role: 'main'});
2379
+ if(main.length > 1){
2380
+ webshims.error('only one main element allowed in document');
2381
+ } else if(main.is('article *, section *')) {
2382
+ webshims.error('main not allowed inside of article/section elements');
2383
+ }
2384
+ });
2385
+
2386
+ if(('hidden' in document.createElement('a'))){
2387
+ return;
2388
+ }
2389
+
2390
+ var elemMappings = {
2391
+ article: "article",
2392
+ aside: "complementary",
2393
+ section: "region",
2394
+ nav: "navigation",
2395
+ address: "contentinfo"
2396
+ };
2397
+ var addRole = function(elem, role){
2398
+ var hasRole = elem.getAttribute('role');
2399
+ if (!hasRole) {
2400
+ elem.setAttribute('role', role);
2401
+ }
2402
+ };
2403
+
2404
+
2405
+ $.webshims.addReady(function(context, contextElem){
2406
+ $.each(elemMappings, function(name, role){
2407
+ var elems = $(name, context).add(contextElem.filter(name));
2408
+ for (var i = 0, len = elems.length; i < len; i++) {
2409
+ addRole(elems[i], role);
2410
+ }
2411
+ });
2412
+ if (context === document) {
2413
+ var header = document.getElementsByTagName('header')[0];
2414
+ var footers = document.getElementsByTagName('footer');
2415
+ var footerLen = footers.length;
2416
+
2417
+ if (header && !$(header).closest('section, article')[0]) {
2418
+ addRole(header, 'banner');
2419
+ }
2420
+ if (!footerLen) {
2421
+ return;
2422
+ }
2423
+ var footer = footers[footerLen - 1];
2424
+ if (!$(footer).closest('section, article')[0]) {
2425
+ addRole(footer, 'contentinfo');
2426
+ }
2427
+ }
2428
+ });
2429
+
2430
+ })(jQuery, document);
2431
+
2432
+ webshims.register('filereader', function( $, webshims ){
2433
+ "use strict";
2434
+
2435
+ (function(){
2436
+ var swfobject = swfmini;
2437
+
2438
+ var readyCallbacks = $.Callbacks('once unique memory'),
2439
+ inputsCount = 0,
2440
+ currentTarget = null;
2441
+
2442
+ // if native FileReader support, then dont add the polyfill and make the plugin do nothing
2443
+ if (window.FileReader) {
2444
+ $.fn.fileReader = function () { return this; }
2445
+ return ;
2446
+ }
2447
+
2448
+ /**
2449
+ * JQuery Plugin
2450
+ */
2451
+ $.fn.fileReader = function( options ) {
2452
+ if(this.length){
2453
+ options = $.extend($.fn.fileReader.defaults, options);
2454
+
2455
+ var self = this;
2456
+ readyCallbacks.add(function() {
2457
+ return main(self, options);
2458
+ });
2459
+ if ($.isFunction(options.callback)) readyCallbacks.add(options.callback);
2460
+
2461
+ if (!FileAPIProxy.ready) {
2462
+ FileAPIProxy.init(options);
2463
+ }
2464
+ }
2465
+ return this;
2466
+ };
2467
+
2468
+ /**
2469
+ * Default options
2470
+ * allows user set default options
2471
+ */
2472
+ $.fn.fileReader.defaults = {
2473
+ id : 'fileReaderSWFObject', // ID for the created swf object container,
2474
+ multiple : null,
2475
+ accept : null,
2476
+ label : null,
2477
+ extensions : null,
2478
+ filereader : 'files/filereader.swf', // The path to the filereader swf file
2479
+ expressInstall : null, // The path to the express install swf file
2480
+ debugMode : false,
2481
+ callback : false // Callback function when Filereader is ready
2482
+ };
2483
+
2484
+ /**
2485
+ * Plugin callback
2486
+ * adds an input to registry
2487
+ */
2488
+ var main = function(el, options) {
2489
+ return el.each(function(i, input) {
2490
+ input = $(input);
2491
+ var id = input.attr('id');
2492
+ var multiple, accept, label;
2493
+ if (!id) {
2494
+ id = 'flashFileInput' + inputsCount;
2495
+ input.attr('id', id);
2496
+ inputsCount++;
2497
+ }
2498
+ multiple = input.prop('multiple');
2499
+ accept = input.data('swfaccept') || input.prop('accept') || options.accept;
2500
+ label = input.jProp('labels')
2501
+ .map(function(){
2502
+ return $(this).text();
2503
+ }).get().join(' ') ||
2504
+ input.data('swflabel') ||
2505
+ options.label;
2506
+
2507
+ FileAPIProxy.inputs[id] = input;
2508
+ FileAPIProxy.swfObject.add(id, multiple, accept, label, options.extensions);
2509
+
2510
+ input.css('z-index', 0)
2511
+ .mouseover(function (e) {
2512
+ if (id !== currentTarget) {
2513
+ e = e || window.event;
2514
+ currentTarget = id;
2515
+ FileAPIProxy.swfObject.mouseover(id);
2516
+ FileAPIProxy.container
2517
+ .height(input.outerHeight())
2518
+ .width(input.outerWidth())
2519
+ .css(input.offset());
2520
+ }
2521
+ })
2522
+ .click(function(e) {
2523
+ e.preventDefault();
2524
+ e.stopPropagation();
2525
+ e.stopImmediatePropagation();
2526
+ return false;
2527
+ });
2528
+ });
2529
+ };
2530
+
2531
+ /**
2532
+ * Flash FileReader Proxy
2533
+ */
2534
+ window.FileAPIProxy = {
2535
+ ready: false,
2536
+ _inititalized: false,
2537
+ init: function(o) {
2538
+ var self = this;
2539
+ this.debugMode = o.debugMode;
2540
+
2541
+ if(!this.container){
2542
+ this.container = $('<div>').attr('id', o.id)
2543
+ .wrap('<div>')
2544
+ .parent()
2545
+ .css({
2546
+ position:'fixed',
2547
+ // top:'0px',
2548
+ width:'1px',
2549
+ height:'1px',
2550
+ display:'inline-block',
2551
+ background:'transparent',
2552
+ 'z-index':99999
2553
+ })
2554
+ // Hands over mouse events to original input for css styles
2555
+ .on('mouseover mouseout mousedown mouseup', function(evt) {
2556
+ if(currentTarget){
2557
+ $('#' + currentTarget).trigger(evt.type);
2558
+ }
2559
+ })
2560
+ .appendTo('body');
2561
+
2562
+ swfobject.embedSWF(o.filereader, o.id, '100%', '100%', '10', o.expressInstall, {debugMode: o.debugMode ? true : ''}, {'wmode':'transparent','allowScriptAccess':'sameDomain'}, {}, function(e) {
2563
+ self.swfObject = e.ref;
2564
+ $(self.swfObject)
2565
+ .css({
2566
+ display: 'block',
2567
+ outline: 0
2568
+ })
2569
+ .attr('tabindex', 0);
2570
+
2571
+ self.ready = e.success && typeof e.ref.add === "function";
2572
+
2573
+ if (self.ready) {
2574
+ readyCallbacks.fire();
2575
+ }
2576
+ });
2577
+ }
2578
+ },
2579
+ swfObject: null,
2580
+ container: null,
2581
+ // Inputs Registry
2582
+ inputs: {},
2583
+ // Readers Registry
2584
+ readers: {},
2585
+ // Receives FileInput events
2586
+ onFileInputEvent: function(evt) {
2587
+ if (this.debugMode) console.info('FileInput Event ', evt.type, evt);
2588
+ if (evt.target in this.inputs) {
2589
+ var el = this.inputs[evt.target];
2590
+ evt.target = el[0];
2591
+ if( evt.type === 'change') {
2592
+ webshims.data(evt.target, 'fileList', new FileList(evt.files));
2593
+ }
2594
+ el.trigger(evt);
2595
+ }
2596
+ window.focus();
2597
+ },
2598
+ // Receives FileReader ProgressEvents
2599
+ onFileReaderEvent: function(evt) {
2600
+ if (this.debugMode) console.info('FileReader Event ', evt.type, evt, evt.target in this.readers);
2601
+ if (evt.target in this.readers) {
2602
+ var reader = this.readers[evt.target];
2603
+ evt.target = reader;
2604
+ reader._handleFlashEvent.call(reader, evt);
2605
+ }
2606
+ },
2607
+ // Receives flash FileReader Error Events
2608
+ onFileReaderError: function(error) {
2609
+ if (this.debugMode) console.log(error);
2610
+ },
2611
+ onSWFReady: function() {
2612
+ this.container.css({position: 'absolute'});
2613
+ this.ready = typeof this.swfObject.add === "function";
2614
+ if (this.ready) {
2615
+ readyCallbacks.fire();
2616
+ }
2617
+
2618
+ return true;
2619
+ }
2620
+ };
2621
+
2622
+
2623
+ /**
2624
+ * Add FileReader to the window object
2625
+ */
2626
+ window.FileReader = function () {
2627
+ // states
2628
+ this.EMPTY = 0;
2629
+ this.LOADING = 1;
2630
+ this.DONE = 2;
2631
+
2632
+ this.readyState = 0;
2633
+
2634
+ // File or Blob data
2635
+ this.result = null;
2636
+
2637
+ this.error = null;
2638
+
2639
+ // event handler attributes
2640
+ this.onloadstart = null;
2641
+ this.onprogress = null;
2642
+ this.onload = null;
2643
+ this.onabort = null;
2644
+ this.onerror = null;
2645
+ this.onloadend = null;
2646
+
2647
+ // Event Listeners handling using JQuery Callbacks
2648
+ this._callbacks = {
2649
+ loadstart : $.Callbacks( "unique" ),
2650
+ progress : $.Callbacks( "unique" ),
2651
+ abort : $.Callbacks( "unique" ),
2652
+ error : $.Callbacks( "unique" ),
2653
+ load : $.Callbacks( "unique" ),
2654
+ loadend : $.Callbacks( "unique" )
2655
+ };
2656
+
2657
+ // Custom properties
2658
+ this._id = null;
2659
+ };
2660
+
2661
+ window.FileReader.prototype = {
2662
+ // async read methods
2663
+ readAsBinaryString: function (file) {
2664
+ this._start(file);
2665
+ FileAPIProxy.swfObject.read(file.input, file.name, 'readAsBinaryString');
2666
+ },
2667
+ readAsText: function (file, encoding) {
2668
+ this._start(file);
2669
+ FileAPIProxy.swfObject.read(file.input, file.name, 'readAsText');
2670
+ },
2671
+ readAsDataURL: function (file) {
2672
+ this._start(file);
2673
+ FileAPIProxy.swfObject.read(file.input, file.name, 'readAsDataURL');
2674
+ },
2675
+ readAsArrayBuffer: function(file){
2676
+ throw("Whoops FileReader.readAsArrayBuffer is unimplemented");
2677
+ },
2678
+
2679
+ abort: function () {
2680
+ this.result = null;
2681
+ if (this.readyState === this.EMPTY || this.readyState === this.DONE) return;
2682
+ FileAPIProxy.swfObject.abort(this._id);
2683
+ },
2684
+
2685
+ // Event Target interface
2686
+ addEventListener: function (type, listener) {
2687
+ if (type in this._callbacks) this._callbacks[type].add(listener);
2688
+ },
2689
+ removeEventListener: function (type, listener) {
2690
+ if (type in this._callbacks) this._callbacks[type].remove(listener);
2691
+ },
2692
+ dispatchEvent: function (event) {
2693
+ event.target = this;
2694
+ if (event.type in this._callbacks) {
2695
+ var fn = this['on' + event.type];
2696
+ if ($.isFunction(fn)) fn(event);
2697
+ this._callbacks[event.type].fire(event);
2698
+ }
2699
+ return true;
2700
+ },
2701
+
2702
+ // Custom private methods
2703
+
2704
+ // Registers FileReader instance for flash callbacks
2705
+ _register: function(file) {
2706
+ this._id = file.input + '.' + file.name;
2707
+ FileAPIProxy.readers[this._id] = this;
2708
+ },
2709
+ _start: function(file) {
2710
+ this._register(file);
2711
+ if (this.readyState === this.LOADING) throw {type: 'InvalidStateError', code: 11, message: 'The object is in an invalid state.'};
2712
+ },
2713
+ _handleFlashEvent: function(evt) {
2714
+ switch (evt.type) {
2715
+ case 'loadstart':
2716
+ this.readyState = this.LOADING;
2717
+ break;
2718
+ case 'loadend':
2719
+ this.readyState = this.DONE;
2720
+ break;
2721
+ case 'load':
2722
+ this.readyState = this.DONE;
2723
+ this.result = FileAPIProxy.swfObject.result(this._id);
2724
+ break;
2725
+ case 'error':
2726
+ this.result = null;
2727
+ this.error = {
2728
+ name: 'NotReadableError',
2729
+ message: 'The File cannot be read!'
2730
+ };
2731
+ }
2732
+ this.dispatchEvent(new FileReaderEvent(evt));
2733
+ }
2734
+ };
2735
+
2736
+ /**
2737
+ * FileReader ProgressEvent implenting Event interface
2738
+ */
2739
+ window.FileReaderEvent = function (e) {
2740
+ this.initEvent(e);
2741
+ };
2742
+
2743
+ window.FileReaderEvent.prototype = {
2744
+ initEvent: function (event) {
2745
+ $.extend(this, {
2746
+ type: null,
2747
+ target: null,
2748
+ currentTarget: null,
2749
+
2750
+ eventPhase: 2,
2751
+
2752
+ bubbles: false,
2753
+ cancelable: false,
2754
+
2755
+ defaultPrevented: false,
2756
+
2757
+ isTrusted: false,
2758
+ timeStamp: new Date().getTime()
2759
+ }, event);
2760
+ },
2761
+ stopPropagation: function (){
2762
+ },
2763
+ stopImmediatePropagation: function (){
2764
+ },
2765
+ preventDefault: function (){
2766
+ }
2767
+ };
2768
+
2769
+ /**
2770
+ * FileList interface (Object with item function)
2771
+ */
2772
+ window.FileList = function(array) {
2773
+ if (array) {
2774
+ for (var i = 0; i < array.length; i++) {
2775
+ this[i] = array[i];
2776
+ }
2777
+ this.length = array.length;
2778
+ } else {
2779
+ this.length = 0;
2780
+ }
2781
+ };
2782
+
2783
+ window.FileList.prototype = {
2784
+ item: function(index) {
2785
+ return (index in this) ? this[index] : null;
2786
+ }
2787
+ };
2788
+ })();
2789
+
2790
+ webshims.defineNodeNameProperty('input', 'files', {
2791
+ prop: {
2792
+ writeable: false,
2793
+ get: function(){
2794
+ if(this.type != 'file'){return null;}
2795
+ if(!$(this).is('.ws-filereader')){
2796
+ webshims.error("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
2797
+ }
2798
+ return webshims.data(this, 'fileList') || webshims.data(this, 'fileList', new FileList());
2799
+ }
2800
+ }
2801
+ }
2802
+ );
2803
+
2804
+ webshims.defineNodeNamesBooleanProperty('input', 'multiple');
2805
+
2806
+ //webshims
2807
+ $.fn.fileReader.defaults.filereader = webshims.cfg.basePath +'swf/filereader.swf';
2808
+ var wait = ['DOM'];
2809
+ if(webshims.modules["form-core"].loaded){
2810
+ wait.push('forms');
2811
+ }
2812
+ webshims.ready(wait, function(){
2813
+ webshims.addReady(function(context, contextElem){
2814
+ $('input[type="file"].ws-filereader', context).fileReader();
2815
+ });
2816
+ });
2817
+ });
2818
+
2819
+ (function($, Modernizr, webshims){
2820
+ "use strict";
2821
+ var hasNative = Modernizr.audio && Modernizr.video;
2822
+ var supportsLoop = false;
2823
+ var bugs = webshims.bugs;
2824
+ var swfType = 'mediaelement-jaris';
2825
+ var loadSwf = function(){
2826
+ webshims.ready(swfType, function(){
2827
+ if(!webshims.mediaelement.createSWF){
2828
+ webshims.mediaelement.loadSwf = true;
2829
+ webshims.reTest([swfType], hasNative);
2830
+ }
2831
+ });
2832
+ };
2833
+ var options = webshims.cfg.mediaelement;
2834
+ var hasFullTrackSupport;
2835
+ var hasSwf;
2836
+ if(!options){
2837
+ webshims.error("mediaelement wasn't implemented but loaded");
2838
+ return;
2839
+ }
2840
+ if(hasNative){
2841
+ var videoElem = document.createElement('video');
2842
+ Modernizr.videoBuffered = ('buffered' in videoElem);
2843
+ supportsLoop = ('loop' in videoElem);
2844
+
2845
+ webshims.capturingEvents(['play', 'playing', 'waiting', 'paused', 'ended', 'durationchange', 'loadedmetadata', 'canplay', 'volumechange']);
2846
+
2847
+ if(!Modernizr.videoBuffered ){
2848
+ webshims.addPolyfill('mediaelement-native-fix', {
2849
+ d: ['dom-support']
2850
+ });
2851
+ webshims.loader.loadList(['mediaelement-native-fix']);
2852
+ }
2853
+ }
2854
+
2855
+ if(hasNative && !options.preferFlash){
2856
+ var noSwitch = {
2857
+ 1: 1,
2858
+ 2: 1
2859
+ };
2860
+ var switchOptions = function(e){
2861
+ var media;
2862
+ var parent;
2863
+ if(!options.preferFlash &&
2864
+ ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
2865
+ (media = $(e.target).closest('audio, video')) && !noSwitch[media.prop('error')]
2866
+ ){
2867
+ $(function(){
2868
+ if(hasSwf && !options.preferFlash){
2869
+ loadSwf();
2870
+ webshims.ready('WINDOWLOAD '+swfType, function(){
2871
+ setTimeout(function(){
2872
+ if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2873
+ options.preferFlash = true;
2874
+ document.removeEventListener('error', switchOptions, true);
2875
+ $('audio, video').each(function(){
2876
+ webshims.mediaelement.selectSource(this);
2877
+ });
2878
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2879
+ }
2880
+ }, 9);
2881
+ });
2882
+ } else{
2883
+ document.removeEventListener('error', switchOptions, true);
2884
+ }
2885
+ });
2886
+ }
2887
+ };
2888
+ document.addEventListener('error', switchOptions, true);
2889
+ $('audio, video').each(function(){
2890
+ var error = $.prop(this, 'error');
2891
+ if(error && !noSwitch[error]){
2892
+ switchOptions({target: this});
2893
+ return false;
2894
+ }
2895
+ });
2896
+ }
2897
+
2898
+
2899
+ if(Modernizr.track && !bugs.track){
2900
+ (function(){
2901
+
2902
+ if(!bugs.track){
2903
+ bugs.track = typeof $('<track />')[0].readyState != 'number';
2904
+ }
2905
+
2906
+ if(!bugs.track){
2907
+ try {
2908
+ new TextTrackCue(2, 3, '');
2909
+ } catch(e){
2910
+ bugs.track = true;
2911
+ }
2912
+ }
2913
+ })();
2914
+ }
2915
+ hasFullTrackSupport = Modernizr.track && !bugs.track;
2916
+
2917
+ webshims.register('mediaelement-core', function($, webshims, window, document, undefined){
2918
+ hasSwf = swfmini.hasFlashPlayerVersion('9.0.115');
2919
+ $('html').addClass(hasSwf ? 'swf' : 'no-swf');
2920
+ var mediaelement = webshims.mediaelement;
2921
+ mediaelement.parseRtmp = function(data){
2922
+ var src = data.src.split('://');
2923
+ var paths = src[1].split('/');
2924
+ var i, len, found;
2925
+ data.server = src[0]+'://'+paths[0]+'/';
2926
+ data.streamId = [];
2927
+ for(i = 1, len = paths.length; i < len; i++){
2928
+ if(!found && paths[i].indexOf(':') !== -1){
2929
+ paths[i] = paths[i].split(':')[1];
2930
+ found = true;
2931
+ }
2932
+ if(!found){
2933
+ data.server += paths[i]+'/';
2934
+ } else {
2935
+ data.streamId.push(paths[i]);
2936
+ }
2937
+ }
2938
+ if(!data.streamId.length){
2939
+ webshims.error('Could not parse rtmp url');
2940
+ }
2941
+ data.streamId = data.streamId.join('/');
2942
+ };
2943
+ var getSrcObj = function(elem, nodeName){
2944
+ elem = $(elem);
2945
+ var src = {src: elem.attr('src') || '', elem: elem, srcProp: elem.prop('src')};
2946
+ var tmp;
2947
+
2948
+ if(!src.src){return src;}
2949
+
2950
+ tmp = elem.attr('data-server');
2951
+ if(tmp != null){
2952
+ src.server = tmp;
2953
+ }
2954
+
2955
+ tmp = elem.attr('type');
2956
+ if(tmp){
2957
+ src.type = tmp;
2958
+ src.container = $.trim(tmp.split(';')[0]);
2959
+ } else {
2960
+ if(!nodeName){
2961
+ nodeName = elem[0].nodeName.toLowerCase();
2962
+ if(nodeName == 'source'){
2963
+ nodeName = (elem.closest('video, audio')[0] || {nodeName: 'video'}).nodeName.toLowerCase();
2964
+ }
2965
+ }
2966
+ if(src.server){
2967
+ src.type = nodeName+'/rtmp';
2968
+ src.container = nodeName+'/rtmp';
2969
+ } else {
2970
+
2971
+ tmp = mediaelement.getTypeForSrc( src.src, nodeName, src );
2972
+
2973
+ if(tmp){
2974
+ src.type = tmp;
2975
+ src.container = tmp;
2976
+ }
2977
+ }
2978
+ }
2979
+ tmp = elem.attr('media');
2980
+ if(tmp){
2981
+ src.media = tmp;
2982
+ }
2983
+ if(src.type == 'audio/rtmp' || src.type == 'video/rtmp'){
2984
+ if(src.server){
2985
+ src.streamId = src.src;
2986
+ } else {
2987
+ mediaelement.parseRtmp(src);
2988
+ }
2989
+ }
2990
+ return src;
2991
+ };
2992
+
2993
+
2994
+
2995
+ var hasYt = !hasSwf && ('postMessage' in window) && hasNative;
2996
+
2997
+ var loadTrackUi = function(){
2998
+ if(loadTrackUi.loaded){return;}
2999
+ loadTrackUi.loaded = true;
3000
+ webshims.ready('WINDOWLOAD', function(){
3001
+ loadThird();
3002
+ webshims.loader.loadList(['track-ui']);
3003
+ });
3004
+ };
3005
+ var loadYt = (function(){
3006
+ var loaded;
3007
+ return function(){
3008
+ if(loaded || !hasYt){return;}
3009
+ loaded = true;
3010
+ webshims.loader.loadScript("https://www.youtube.com/player_api");
3011
+ $(function(){
3012
+ webshims._polyfill(["mediaelement-yt"]);
3013
+ });
3014
+ };
3015
+ })();
3016
+ var loadThird = function(){
3017
+ if(hasSwf){
3018
+ loadSwf();
3019
+ } else {
3020
+ loadYt();
3021
+ }
3022
+ };
3023
+
3024
+ webshims.addPolyfill('mediaelement-yt', {
3025
+ test: !hasYt,
3026
+ d: ['dom-support']
3027
+ });
3028
+
3029
+ mediaelement.mimeTypes = {
3030
+ audio: {
3031
+ //ogm shouldn´t be used!
3032
+ 'audio/ogg': ['ogg','oga', 'ogm'],
3033
+ 'audio/ogg;codecs="opus"': 'opus',
3034
+ 'audio/mpeg': ['mp2','mp3','mpga','mpega'],
3035
+ 'audio/mp4': ['mp4','mpg4', 'm4r', 'm4a', 'm4p', 'm4b', 'aac'],
3036
+ 'audio/wav': ['wav'],
3037
+ 'audio/3gpp': ['3gp','3gpp'],
3038
+ 'audio/webm': ['webm'],
3039
+ 'audio/fla': ['flv', 'f4a', 'fla'],
3040
+ 'application/x-mpegURL': ['m3u8', 'm3u']
3041
+ },
3042
+ video: {
3043
+ //ogm shouldn´t be used!
3044
+ 'video/ogg': ['ogg','ogv', 'ogm'],
3045
+ 'video/mpeg': ['mpg','mpeg','mpe'],
3046
+ 'video/mp4': ['mp4','mpg4', 'm4v'],
3047
+ 'video/quicktime': ['mov','qt'],
3048
+ 'video/x-msvideo': ['avi'],
3049
+ 'video/x-ms-asf': ['asf', 'asx'],
3050
+ 'video/flv': ['flv', 'f4v'],
3051
+ 'video/3gpp': ['3gp','3gpp'],
3052
+ 'video/webm': ['webm'],
3053
+ 'application/x-mpegURL': ['m3u8', 'm3u'],
3054
+ 'video/MP2T': ['ts']
3055
+ }
3056
+ }
3057
+ ;
3058
+
3059
+ mediaelement.mimeTypes.source = $.extend({}, mediaelement.mimeTypes.audio, mediaelement.mimeTypes.video);
3060
+
3061
+ mediaelement.getTypeForSrc = function(src, nodeName, data){
3062
+ if(src.indexOf('youtube.com/watch?') != -1 || src.indexOf('youtube.com/v/') != -1){
3063
+ return 'video/youtube';
3064
+ }
3065
+ if(src.indexOf('rtmp') === 0){
3066
+ return nodeName+'/rtmp';
3067
+ }
3068
+ src = src.split('?')[0].split('.');
3069
+ src = src[src.length - 1];
3070
+ var mt;
3071
+
3072
+ $.each(mediaelement.mimeTypes[nodeName], function(mimeType, exts){
3073
+ if(exts.indexOf(src) !== -1){
3074
+ mt = mimeType;
3075
+ return false;
3076
+ }
3077
+ });
3078
+ return mt;
3079
+ };
3080
+
3081
+
3082
+ mediaelement.srces = function(mediaElem, srces){
3083
+ mediaElem = $(mediaElem);
3084
+ if(!srces){
3085
+ srces = [];
3086
+ var nodeName = mediaElem[0].nodeName.toLowerCase();
3087
+ var src = getSrcObj(mediaElem, nodeName);
3088
+
3089
+ if(!src.src){
3090
+
3091
+ $('source', mediaElem).each(function(){
3092
+ src = getSrcObj(this, nodeName);
3093
+ if(src.src){srces.push(src);}
3094
+ });
3095
+ } else {
3096
+ srces.push(src);
3097
+ }
3098
+ return srces;
3099
+ } else {
3100
+ mediaElem.removeAttr('src').removeAttr('type').find('source').remove();
3101
+ if(!$.isArray(srces)){
3102
+ srces = [srces];
3103
+ }
3104
+ srces.forEach(function(src){
3105
+ var source = document.createElement('source');
3106
+ if(typeof src == 'string'){
3107
+ src = {src: src};
3108
+ }
3109
+ source.setAttribute('src', src.src);
3110
+ if(src.type){
3111
+ source.setAttribute('type', src.type);
3112
+ }
3113
+ if(src.media){
3114
+ source.setAttribute('media', src.media);
3115
+ }
3116
+ mediaElem.append(source);
3117
+ });
3118
+
3119
+ }
3120
+ };
3121
+
3122
+
3123
+ $.fn.loadMediaSrc = function(srces, poster){
3124
+ return this.each(function(){
3125
+ if(poster !== undefined){
3126
+ $(this).removeAttr('poster');
3127
+ if(poster){
3128
+ $.attr(this, 'poster', poster);
3129
+ }
3130
+ }
3131
+ mediaelement.srces(this, srces);
3132
+ $(this).mediaLoad();
3133
+ });
3134
+ };
3135
+
3136
+ mediaelement.swfMimeTypes = ['video/3gpp', 'video/x-msvideo', 'video/quicktime', 'video/x-m4v', 'video/mp4', 'video/m4p', 'video/x-flv', 'video/flv', 'audio/mpeg', 'audio/aac', 'audio/mp4', 'audio/x-m4a', 'audio/m4a', 'audio/mp3', 'audio/x-fla', 'audio/fla', 'youtube/flv', 'video/jarisplayer', 'jarisplayer/jarisplayer', 'video/youtube', 'video/rtmp', 'audio/rtmp'];
3137
+
3138
+ mediaelement.canThirdPlaySrces = function(mediaElem, srces){
3139
+ var ret = '';
3140
+ if(hasSwf || hasYt){
3141
+ mediaElem = $(mediaElem);
3142
+ srces = srces || mediaelement.srces(mediaElem);
3143
+ $.each(srces, function(i, src){
3144
+ if(src.container && src.src && ((hasSwf && mediaelement.swfMimeTypes.indexOf(src.container) != -1) || (hasYt && src.container == 'video/youtube'))){
3145
+ ret = src;
3146
+ return false;
3147
+ }
3148
+ });
3149
+
3150
+ }
3151
+
3152
+ return ret;
3153
+ };
3154
+
3155
+ var nativeCanPlayType = {};
3156
+ mediaelement.canNativePlaySrces = function(mediaElem, srces){
3157
+ var ret = '';
3158
+ if(hasNative){
3159
+ mediaElem = $(mediaElem);
3160
+ var nodeName = (mediaElem[0].nodeName || '').toLowerCase();
3161
+ var nativeCanPlay = (nativeCanPlayType[nodeName] || {prop: {_supvalue: false}}).prop._supvalue || mediaElem[0].canPlayType;
3162
+ if(!nativeCanPlay){return ret;}
3163
+ srces = srces || mediaelement.srces(mediaElem);
3164
+
3165
+ $.each(srces, function(i, src){
3166
+ if(src.type && nativeCanPlay.call(mediaElem[0], src.type) ){
3167
+ ret = src;
3168
+ return false;
3169
+ }
3170
+ });
3171
+ }
3172
+ return ret;
3173
+ };
3174
+ var emptyType = (/^\s*application\/octet\-stream\s*$/i);
3175
+ var getRemoveEmptyType = function(){
3176
+ var ret = emptyType.test($.attr(this, 'type') || '');
3177
+ if(ret){
3178
+ $(this).removeAttr('type');
3179
+ }
3180
+ return ret;
3181
+ };
3182
+ mediaelement.setError = function(elem, message){
3183
+ if($('source', elem).filter(getRemoveEmptyType).length){
3184
+ webshims.error('"application/octet-stream" is a useless mimetype for audio/video. Please change this attribute.');
3185
+ try {
3186
+ $(elem).mediaLoad();
3187
+ } catch(er){}
3188
+ } else {
3189
+ if(!message){
3190
+ message = "can't play sources";
3191
+ }
3192
+ $(elem).pause().data('mediaerror', message);
3193
+ webshims.error('mediaelementError: '+ message);
3194
+ setTimeout(function(){
3195
+ if($(elem).data('mediaerror')){
3196
+ $(elem).trigger('mediaerror');
3197
+ }
3198
+ }, 1);
3199
+ }
3200
+
3201
+
3202
+ };
3203
+
3204
+ var handleThird = (function(){
3205
+ var requested;
3206
+ return function( mediaElem, ret, data ){
3207
+
3208
+ webshims.ready(hasSwf ? swfType : 'mediaelement-yt', function(){
3209
+ if(mediaelement.createSWF){
3210
+ mediaelement.createSWF( mediaElem, ret, data );
3211
+ } else if(!requested) {
3212
+ requested = true;
3213
+ loadThird();
3214
+ //readd to ready
3215
+ handleThird( mediaElem, ret, data );
3216
+ }
3217
+ });
3218
+ if(!requested && hasYt && !mediaelement.createSWF){
3219
+ loadYt();
3220
+ }
3221
+ };
3222
+ })();
3223
+
3224
+ var stepSources = function(elem, data, useSwf, _srces, _noLoop){
3225
+ var ret;
3226
+ if(useSwf || (useSwf !== false && data && data.isActive == 'third')){
3227
+ ret = mediaelement.canThirdPlaySrces(elem, _srces);
3228
+ if(!ret){
3229
+ if(_noLoop){
3230
+ mediaelement.setError(elem, false);
3231
+ } else {
3232
+ stepSources(elem, data, false, _srces, true);
3233
+ }
3234
+ } else {
3235
+ handleThird(elem, ret, data);
3236
+ }
3237
+ } else {
3238
+ ret = mediaelement.canNativePlaySrces(elem, _srces);
3239
+ if(!ret){
3240
+ if(_noLoop){
3241
+ mediaelement.setError(elem, false);
3242
+ if(data && data.isActive == 'third') {
3243
+ mediaelement.setActive(elem, 'html5', data);
3244
+ }
3245
+ } else {
3246
+ stepSources(elem, data, true, _srces, true);
3247
+ }
3248
+ } else if(data && data.isActive == 'third') {
3249
+ mediaelement.setActive(elem, 'html5', data);
3250
+ }
3251
+ }
3252
+ };
3253
+ var stopParent = /^(?:embed|object|datalist)$/i;
3254
+ var selectSource = function(elem, data){
3255
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
3256
+ var _srces = mediaelement.srces(elem);
3257
+ var parent = elem.parentNode;
3258
+
3259
+ clearTimeout(baseData.loadTimer);
3260
+ $.data(elem, 'mediaerror', false);
3261
+
3262
+ if(!_srces.length || !parent || parent.nodeType != 1 || stopParent.test(parent.nodeName || '')){return;}
3263
+ data = data || webshims.data(elem, 'mediaelement');
3264
+ stepSources(elem, data, options.preferFlash || undefined, _srces);
3265
+ };
3266
+ mediaelement.selectSource = selectSource;
3267
+
3268
+
3269
+ $(document).on('ended', function(e){
3270
+ var data = webshims.data(e.target, 'mediaelement');
3271
+ if( supportsLoop && (!data || data.isActive == 'html5') && !$.prop(e.target, 'loop')){return;}
3272
+ setTimeout(function(){
3273
+ if( $.prop(e.target, 'paused') || !$.prop(e.target, 'loop') ){return;}
3274
+ $(e.target).prop('currentTime', 0).play();
3275
+ }, 1);
3276
+
3277
+ });
3278
+
3279
+ webshims.ready('dom-support', function(){
3280
+ if(!supportsLoop){
3281
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
3282
+ }
3283
+
3284
+ ['audio', 'video'].forEach(function(nodeName){
3285
+ var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
3286
+ prop: {
3287
+ value: function(){
3288
+ var data = webshims.data(this, 'mediaelement');
3289
+ selectSource(this, data);
3290
+ if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
3291
+ supLoad.prop._supvalue.apply(this, arguments);
3292
+ }
3293
+ }
3294
+ }
3295
+ });
3296
+ nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
3297
+ prop: {
3298
+ value: function(type){
3299
+ var ret = '';
3300
+ if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
3301
+ ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
3302
+ if(ret == 'no'){
3303
+ ret = '';
3304
+ }
3305
+ }
3306
+ if(!ret && hasSwf){
3307
+ type = $.trim((type || '').split(';')[0]);
3308
+ if(mediaelement.swfMimeTypes.indexOf(type) != -1){
3309
+ ret = 'maybe';
3310
+ }
3311
+ }
3312
+ return ret;
3313
+ }
3314
+ }
3315
+ });
3316
+ });
3317
+ webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
3318
+ set: function(){
3319
+ var elem = this;
3320
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
3321
+ clearTimeout(baseData.loadTimer);
3322
+ baseData.loadTimer = setTimeout(function(){
3323
+ selectSource(elem);
3324
+ elem = null;
3325
+ }, 9);
3326
+ }
3327
+ });
3328
+ });
3329
+
3330
+ var initMediaElements = function(){
3331
+ var testFixMedia = function(){
3332
+ if(webshims.implement(this, 'mediaelement')){
3333
+ selectSource(this);
3334
+
3335
+ if(hasNative){
3336
+ var bufferTimer;
3337
+ var lastBuffered;
3338
+ var elem = this;
3339
+ var getBufferedString = function(){
3340
+ var buffered = $.prop(elem, 'buffered');
3341
+ if(!buffered){return;}
3342
+ var bufferString = "";
3343
+ for(var i = 0, len = buffered.length; i < len;i++){
3344
+ bufferString += buffered.end(i);
3345
+ }
3346
+ return bufferString;
3347
+ };
3348
+ var testBuffer = function(){
3349
+ var buffered = getBufferedString();
3350
+ if(buffered != lastBuffered){
3351
+ lastBuffered = buffered;
3352
+ webshims.info('needed to trigger progress manually');
3353
+ $(elem).triggerHandler('progress');
3354
+ }
3355
+ };
3356
+
3357
+ $(this)
3358
+ .on({
3359
+ 'play loadstart progress': function(e){
3360
+ if(e.type == 'progress'){
3361
+ lastBuffered = getBufferedString();
3362
+ }
3363
+ clearTimeout(bufferTimer);
3364
+ bufferTimer = setTimeout(testBuffer, 999);
3365
+ },
3366
+ 'emptied stalled mediaerror abort suspend': function(e){
3367
+ if(e.type == 'emptied'){
3368
+ lastBuffered = false;
3369
+ }
3370
+ clearTimeout(bufferTimer);
3371
+ }
3372
+ })
3373
+ ;
3374
+ if('ActiveXObject' in window && $.prop(this, 'paused') && !$.prop(this, 'readyState') && $(this).is('audio[preload="none"][controls]:not([autoplay],.nonnative-api-active)')){
3375
+ $(this).prop('preload', 'metadata').mediaLoad();
3376
+ }
3377
+ }
3378
+ }
3379
+
3380
+ };
3381
+ var handleMedia = false;
3382
+
3383
+
3384
+ webshims.ready('dom-support', function(){
3385
+ handleMedia = true;
3386
+ webshims.addReady(function(context, insertedElement){
3387
+ var media = $('video, audio', context)
3388
+ .add(insertedElement.filter('video, audio'))
3389
+ .each(testFixMedia)
3390
+ ;
3391
+ if(!loadTrackUi.loaded && $('track', media).length){
3392
+ loadTrackUi();
3393
+ }
3394
+ media = null;
3395
+ });
3396
+ });
3397
+
3398
+ if(hasNative && !handleMedia){
3399
+ webshims.addReady(function(context, insertedElement){
3400
+ if(!handleMedia){
3401
+ $('video, audio', context)
3402
+ .add(insertedElement.filter('video, audio'))
3403
+ .each(function(){
3404
+ if(!mediaelement.canNativePlaySrces(this)){
3405
+ loadThird();
3406
+ handleMedia = true;
3407
+ return false;
3408
+ }
3409
+ if((!hasFullTrackSupport || webshims.modules.track.options.override) && !loadTrackUi.loaded && $('track', this).length){
3410
+ loadTrackUi();
3411
+ }
3412
+ })
3413
+ ;
3414
+ }
3415
+ });
3416
+ }
3417
+ };
3418
+
3419
+ if(hasFullTrackSupport){
3420
+ webshims.defineProperty(TextTrack.prototype, 'shimActiveCues', {
3421
+ get: function(){
3422
+ return this._shimActiveCues || this.activeCues;
3423
+ }
3424
+ });
3425
+ }
3426
+ //set native implementation ready, before swf api is retested
3427
+ if(hasNative){
3428
+ webshims.isReady('mediaelement-core', true);
3429
+ initMediaElements();
3430
+ webshims.ready('WINDOWLOAD mediaelement', loadThird);
3431
+ } else {
3432
+ webshims.ready(swfType, initMediaElements);
3433
+ }
3434
+ webshims.ready('track', loadTrackUi);
3435
+ });
3436
+ })(jQuery, Modernizr, webshims);
3437
+ webshims.register('mediaelement-jaris', function($, webshims, window, document, undefined, options){
3438
+ "use strict";
3439
+
3440
+ var mediaelement = webshims.mediaelement;
3441
+ var swfmini = window.swfmini;
3442
+ var hasNative = Modernizr.audio && Modernizr.video;
3443
+ var hasFlash = swfmini.hasFlashPlayerVersion('9.0.115');
3444
+ var loadedSwf = 0;
3445
+ var getProps = {
3446
+ paused: true,
3447
+ ended: false,
3448
+ currentSrc: '',
3449
+ duration: window.NaN,
3450
+ readyState: 0,
3451
+ networkState: 0,
3452
+ videoHeight: 0,
3453
+ videoWidth: 0,
3454
+ error: null,
3455
+ buffered: {
3456
+ start: function(index){
3457
+ if(index){
3458
+ webshims.error('buffered index size error');
3459
+ return;
3460
+ }
3461
+ return 0;
3462
+ },
3463
+ end: function(index){
3464
+ if(index){
3465
+ webshims.error('buffered index size error');
3466
+ return;
3467
+ }
3468
+ return 0;
3469
+ },
3470
+ length: 0
3471
+ }
3472
+ };
3473
+ var getPropKeys = Object.keys(getProps);
3474
+
3475
+ var getSetProps = {
3476
+ currentTime: 0,
3477
+ volume: 1,
3478
+ muted: false
3479
+ };
3480
+ var getSetPropKeys = Object.keys(getSetProps);
3481
+
3482
+ var playerStateObj = $.extend({
3483
+ isActive: 'html5',
3484
+ activating: 'html5',
3485
+ wasSwfReady: false,
3486
+ _bufferedEnd: 0,
3487
+ _bufferedStart: 0,
3488
+ currentTime: 0,
3489
+ _ppFlag: undefined,
3490
+ _calledMeta: false,
3491
+ lastDuration: 0
3492
+ }, getProps, getSetProps);
3493
+
3494
+ var idRep = /^jarisplayer-/;
3495
+ var getSwfDataFromID = function(id){
3496
+
3497
+ var elem = document.getElementById(id.replace(idRep, ''));
3498
+ if(!elem){return;}
3499
+ var data = webshims.data(elem, 'mediaelement');
3500
+ return data.isActive == 'third' ? data : null;
3501
+ };
3502
+
3503
+
3504
+ var getSwfDataFromElem = function(elem){
3505
+ try {
3506
+ (elem.nodeName);
3507
+ } catch(er){
3508
+ return null;
3509
+ }
3510
+ var data = webshims.data(elem, 'mediaelement');
3511
+ return (data && data.isActive== 'third') ? data : null;
3512
+ };
3513
+
3514
+ var trigger = function(elem, evt){
3515
+ evt = $.Event(evt);
3516
+ evt.preventDefault();
3517
+ $.event.trigger(evt, undefined, elem);
3518
+ };
3519
+
3520
+ var playerSwfPath = options.playerPath || webshims.cfg.basePath + "swf/" + (options.playerName || 'JarisFLVPlayer.swf');
3521
+
3522
+ webshims.extendUNDEFProp(options.params, {
3523
+ allowscriptaccess: 'always',
3524
+ allowfullscreen: 'true',
3525
+ wmode: 'transparent',
3526
+ allowNetworking: 'all'
3527
+ });
3528
+ webshims.extendUNDEFProp(options.vars, {
3529
+ controltype: '1',
3530
+ jsapi: '1'
3531
+ });
3532
+ webshims.extendUNDEFProp(options.attrs, {
3533
+ bgcolor: '#000000'
3534
+ });
3535
+
3536
+ var setReadyState = function(readyState, data){
3537
+ if(readyState < 3){
3538
+ clearTimeout(data._canplaythroughTimer);
3539
+ }
3540
+ if(readyState >= 3 && data.readyState < 3){
3541
+ data.readyState = readyState;
3542
+ trigger(data._elem, 'canplay');
3543
+ if(!data.paused){
3544
+ trigger(data._elem, 'playing');
3545
+ }
3546
+ clearTimeout(data._canplaythroughTimer);
3547
+ data._canplaythroughTimer = setTimeout(function(){
3548
+ setReadyState(4, data);
3549
+ }, 4000);
3550
+ }
3551
+ if(readyState >= 4 && data.readyState < 4){
3552
+ data.readyState = readyState;
3553
+ trigger(data._elem, 'canplaythrough');
3554
+ }
3555
+ data.readyState = readyState;
3556
+ };
3557
+
3558
+ $.extend($.event.customEvent, {
3559
+ updatemediaelementdimensions: true,
3560
+ flashblocker: true,
3561
+ swfstageresize: true,
3562
+ mediaelementapichange: true
3563
+ });
3564
+
3565
+ mediaelement.jarisEvent = {};
3566
+ var localConnectionTimer;
3567
+ var onEvent = {
3568
+ onPlayPause: function(jaris, data, override){
3569
+ var playing, type;
3570
+ if(override == null){
3571
+ try {
3572
+ playing = data.api.api_get("isPlaying");
3573
+ } catch(e){}
3574
+ } else {
3575
+ playing = override;
3576
+ }
3577
+ if(playing == data.paused){
3578
+
3579
+ data.paused = !playing;
3580
+ type = data.paused ? 'pause' : 'play';
3581
+ data._ppFlag = true;
3582
+ trigger(data._elem, type);
3583
+ if(data.readyState < 3){
3584
+ setReadyState(3, data);
3585
+ }
3586
+ if(!data.paused){
3587
+ trigger(data._elem, 'playing');
3588
+ }
3589
+ }
3590
+ },
3591
+ onNotBuffering: function(jaris, data){
3592
+ setReadyState(3, data);
3593
+ },
3594
+ onDataInitialized: function(jaris, data){
3595
+
3596
+ var oldDur = data.duration;
3597
+ var durDelta;
3598
+ data.duration = jaris.duration;
3599
+ if(oldDur == data.duration || isNaN(data.duration)){return;}
3600
+
3601
+ if(data._calledMeta && ((durDelta = Math.abs(data.lastDuration - data.duration)) < 2)){return;}
3602
+
3603
+
3604
+
3605
+ data.videoHeight = jaris.height;
3606
+ data.videoWidth = jaris.width;
3607
+
3608
+ if(!data.networkState){
3609
+ data.networkState = 2;
3610
+ }
3611
+ if(data.readyState < 1){
3612
+ setReadyState(1, data);
3613
+ }
3614
+ clearTimeout(data._durationChangeTimer);
3615
+ if(data._calledMeta && data.duration){
3616
+ data._durationChangeTimer = setTimeout(function(){
3617
+ data.lastDuration = data.duration;
3618
+ trigger(data._elem, 'durationchange');
3619
+ }, durDelta > 50 ? 0 : durDelta > 9 ? 9 : 99);
3620
+ } else {
3621
+ data.lastDuration = data.duration;
3622
+ if(data.duration){
3623
+ trigger(data._elem, 'durationchange');
3624
+ }
3625
+ if(!data._calledMeta){
3626
+ trigger(data._elem, 'loadedmetadata');
3627
+ }
3628
+ }
3629
+ data._calledMeta = true;
3630
+ },
3631
+ onBuffering: function(jaris, data){
3632
+ if(data.ended){
3633
+ data.ended = false;
3634
+ }
3635
+ setReadyState(1, data);
3636
+ trigger(data._elem, 'waiting');
3637
+ },
3638
+ onTimeUpdate: function(jaris, data){
3639
+ if(data.ended){
3640
+ data.ended = false;
3641
+ }
3642
+ if(data.readyState < 3){
3643
+ setReadyState(3, data);
3644
+ trigger(data._elem, 'playing');
3645
+ }
3646
+
3647
+ trigger(data._elem, 'timeupdate');
3648
+ },
3649
+ onProgress: function(jaris, data){
3650
+ if(data.ended){
3651
+ data.ended = false;
3652
+ }
3653
+ if(!data.duration || isNaN(data.duration)){
3654
+ return;
3655
+ }
3656
+ var percentage = jaris.loaded / jaris.total;
3657
+ if(percentage > 0.02 && percentage < 0.2){
3658
+ setReadyState(3, data);
3659
+ } else if(percentage > 0.2){
3660
+ if(percentage > 0.99){
3661
+ data.networkState = 1;
3662
+ }
3663
+ setReadyState(4, data);
3664
+ }
3665
+ if(data._bufferedEnd && (data._bufferedEnd > percentage)){
3666
+ data._bufferedStart = data.currentTime || 0;
3667
+ }
3668
+
3669
+ data._bufferedEnd = percentage;
3670
+ data.buffered.length = 1;
3671
+
3672
+ $.event.trigger('progress', undefined, data._elem, true);
3673
+ },
3674
+ onPlaybackFinished: function(jaris, data){
3675
+ if(data.readyState < 4){
3676
+ setReadyState(4, data);
3677
+ }
3678
+ data.ended = true;
3679
+ trigger(data._elem, 'ended');
3680
+ },
3681
+ onVolumeChange: function(jaris, data){
3682
+ if(data.volume != jaris.volume || data.muted != jaris.mute){
3683
+ data.volume = jaris.volume;
3684
+ data.muted = jaris.mute;
3685
+ trigger(data._elem, 'volumechange');
3686
+ }
3687
+ },
3688
+ ready: (function(){
3689
+ var testAPI = function(data){
3690
+ var passed = true;
3691
+
3692
+ try {
3693
+ data.api.api_get('volume');
3694
+ } catch(er){
3695
+ passed = false;
3696
+ }
3697
+ return passed;
3698
+ };
3699
+
3700
+ return function(jaris, data){
3701
+ var i = 0;
3702
+ var doneFn = function(){
3703
+ if(i > 9){
3704
+ data.tryedReframeing = 0;
3705
+ return;
3706
+ }
3707
+ i++;
3708
+
3709
+ data.tryedReframeing++;
3710
+ if(testAPI(data)){
3711
+ data.wasSwfReady = true;
3712
+ data.tryedReframeing = 0;
3713
+ startAutoPlay(data);
3714
+ workActionQueue(data);
3715
+ } else if(data.tryedReframeing < 6) {
3716
+ if(data.tryedReframeing < 3){
3717
+ data.reframeTimer = setTimeout(doneFn, 9);
3718
+ data.shadowElem.css({overflow: 'visible'});
3719
+ setTimeout(function(){
3720
+ data.shadowElem.css({overflow: 'hidden'});
3721
+ }, 1);
3722
+ } else {
3723
+ data.shadowElem.css({overflow: 'hidden'});
3724
+ $(data._elem).mediaLoad();
3725
+ }
3726
+ } else {
3727
+ clearTimeout(data.reframeTimer);
3728
+ webshims.error("reframing error");
3729
+ }
3730
+ };
3731
+ if(!data || !data.api){return;}
3732
+ if(!data.tryedReframeing){
3733
+ data.tryedReframeing = 0;
3734
+ }
3735
+ clearTimeout(localConnectionTimer);
3736
+ clearTimeout(data.reframeTimer);
3737
+ data.shadowElem.removeClass('flashblocker-assumed');
3738
+
3739
+ if(!i){
3740
+ doneFn();
3741
+ } else {
3742
+ data.reframeTimer = setTimeout(doneFn, 9);
3743
+ }
3744
+
3745
+ };
3746
+ })()
3747
+ };
3748
+
3749
+ onEvent.onMute = onEvent.onVolumeChange;
3750
+
3751
+
3752
+ var workActionQueue = function(data){
3753
+ var actionLen = data.actionQueue.length;
3754
+ var i = 0;
3755
+ var operation;
3756
+
3757
+ if(actionLen && data.isActive == 'third'){
3758
+ while(data.actionQueue.length && actionLen > i){
3759
+ i++;
3760
+ operation = data.actionQueue.shift();
3761
+ try{
3762
+ data.api[operation.fn].apply(data.api, operation.args);
3763
+ } catch(er){
3764
+ webshims.warn(er);
3765
+ }
3766
+ }
3767
+ }
3768
+ if(data.actionQueue.length){
3769
+ data.actionQueue = [];
3770
+ }
3771
+ };
3772
+ var startAutoPlay = function(data){
3773
+ if(!data){return;}
3774
+ if( (data._ppFlag === undefined && ($.prop(data._elem, 'autoplay')) || !data.paused)){
3775
+ setTimeout(function(){
3776
+ if(data.isActive == 'third' && (data._ppFlag === undefined || !data.paused)){
3777
+
3778
+ try {
3779
+ $(data._elem).play();
3780
+ data._ppFlag = true;
3781
+ } catch(er){}
3782
+ }
3783
+ }, 1);
3784
+ }
3785
+
3786
+ if(data.muted){
3787
+ $.prop(data._elem, 'muted', true);
3788
+ }
3789
+ if(data.volume != 1){
3790
+ $.prop(data._elem, 'volume', data.volume);
3791
+ }
3792
+ };
3793
+
3794
+
3795
+ var addMediaToStopEvents = $.noop;
3796
+ if(hasNative){
3797
+ var stopEvents = {
3798
+ play: 1,
3799
+ playing: 1
3800
+ };
3801
+ var hideEvtArray = ['play', 'pause', 'playing', 'canplay', 'progress', 'waiting', 'ended', 'loadedmetadata', 'durationchange', 'emptied'];
3802
+ var hidevents = hideEvtArray.map(function(evt){
3803
+ return evt +'.webshimspolyfill';
3804
+ }).join(' ');
3805
+
3806
+ var hidePlayerEvents = function(event){
3807
+ var data = webshims.data(event.target, 'mediaelement');
3808
+ if(!data){return;}
3809
+ var isNativeHTML5 = ( event.originalEvent && event.originalEvent.type === event.type );
3810
+ if( isNativeHTML5 == (data.activating == 'third') ){
3811
+ event.stopImmediatePropagation();
3812
+ if(stopEvents[event.type] && data.isActive != data.activating){
3813
+ $(event.target).pause();
3814
+ }
3815
+ }
3816
+ };
3817
+
3818
+ addMediaToStopEvents = function(elem){
3819
+ $(elem)
3820
+ .off(hidevents)
3821
+ .on(hidevents, hidePlayerEvents)
3822
+ ;
3823
+ hideEvtArray.forEach(function(evt){
3824
+ webshims.moveToFirstEvent(elem, evt);
3825
+ });
3826
+ };
3827
+ addMediaToStopEvents(document);
3828
+ }
3829
+
3830
+
3831
+ mediaelement.setActive = function(elem, type, data){
3832
+ if(!data){
3833
+ data = webshims.data(elem, 'mediaelement');
3834
+ }
3835
+ if(!data || data.isActive == type){return;}
3836
+ if(type != 'html5' && type != 'third'){
3837
+ webshims.warn('wrong type for mediaelement activating: '+ type);
3838
+ }
3839
+ var shadowData = webshims.data(elem, 'shadowData');
3840
+ data.activating = type;
3841
+ $(elem).pause();
3842
+ data.isActive = type;
3843
+ if(type == 'third'){
3844
+ shadowData.shadowElement = shadowData.shadowFocusElement = data.shadowElem[0];
3845
+ $(elem).addClass('swf-api-active nonnative-api-active').hide().getShadowElement().show();
3846
+ } else {
3847
+ $(elem).removeClass('swf-api-active nonnative-api-active').show().getShadowElement().hide();
3848
+ shadowData.shadowElement = shadowData.shadowFocusElement = false;
3849
+ }
3850
+ $(elem).trigger('mediaelementapichange');
3851
+ };
3852
+
3853
+
3854
+
3855
+ var resetSwfProps = (function(){
3856
+ var resetProtoProps = ['_calledMeta', 'lastDuration', '_bufferedEnd', '_bufferedStart', '_ppFlag', 'currentSrc', 'currentTime', 'duration', 'ended', 'networkState', 'paused', 'videoHeight', 'videoWidth'];
3857
+ var len = resetProtoProps.length;
3858
+ return function(data){
3859
+
3860
+ if(!data){return;}
3861
+ var lenI = len;
3862
+ var networkState = data.networkState;
3863
+ setReadyState(0, data);
3864
+ clearTimeout(data._durationChangeTimer);
3865
+ while(--lenI > -1){
3866
+ delete data[resetProtoProps[lenI]];
3867
+ }
3868
+ data.actionQueue = [];
3869
+ data.buffered.length = 0;
3870
+ if(networkState){
3871
+ trigger(data._elem, 'emptied');
3872
+ }
3873
+ };
3874
+ })();
3875
+
3876
+ var setElementDimension = function(data, hasControls){
3877
+ var elem = data._elem;
3878
+ var box = data.shadowElem;
3879
+ $(elem)[hasControls ? 'addClass' : 'removeClass']('webshims-controls');
3880
+ if(data._elemNodeName == 'audio' && !hasControls){
3881
+ box.css({width: 0, height: 0});
3882
+ } else {
3883
+ box.css({
3884
+ width: elem.style.width || $(elem).width(),
3885
+ height: elem.style.height || $(elem).height()
3886
+ });
3887
+ }
3888
+ };
3889
+
3890
+ var bufferSrc = (function(){
3891
+ var preloads = {
3892
+ '': 1,
3893
+ 'auto': 1
3894
+ };
3895
+ return function(elem){
3896
+ var preload = $.attr(elem, 'preload');
3897
+ if(preload == null || preload == 'none' || $.prop(elem, 'autoplay')){
3898
+ return false;
3899
+ }
3900
+ preload = $.prop(elem, 'preload');
3901
+ return !!(preloads[preload] || (preload == 'metadata' && $(elem).is('.preload-in-doubt, video:not([poster])')));
3902
+ };
3903
+ })();
3904
+
3905
+ var regs = {
3906
+ A: /&amp;/g,
3907
+ a: /&/g,
3908
+ e: /\=/g,
3909
+ q: /\?/g
3910
+ },
3911
+ replaceVar = function(val){
3912
+ return (val.replace) ? val.replace(regs.A, '%26').replace(regs.a, '%26').replace(regs.e, '%3D').replace(regs.q, '%3F') : val;
3913
+ };
3914
+
3915
+ mediaelement.createSWF = function( elem, canPlaySrc, data ){
3916
+ if(!hasFlash){
3917
+ setTimeout(function(){
3918
+ $(elem).mediaLoad(); //<- this should produce a mediaerror
3919
+ }, 1);
3920
+ return;
3921
+ }
3922
+
3923
+ if(loadedSwf < 1){
3924
+ loadedSwf = 1;
3925
+ } else {
3926
+ loadedSwf++;
3927
+ }
3928
+ if(!data){
3929
+ data = webshims.data(elem, 'mediaelement');
3930
+ }
3931
+
3932
+ if($.attr(elem, 'height') || $.attr(elem, 'width')){
3933
+ webshims.warn("width or height content attributes used. Webshims only uses CSS (computed styles or inline styles) to detect size of a video/audio");
3934
+ }
3935
+
3936
+ var isRtmp = canPlaySrc.type == 'audio/rtmp' || canPlaySrc.type == 'video/rtmp';
3937
+ var vars = $.extend({}, options.vars, {
3938
+ poster: replaceVar($.attr(elem, 'poster') && $.prop(elem, 'poster') || ''),
3939
+ source: replaceVar(canPlaySrc.streamId || canPlaySrc.srcProp),
3940
+ server: replaceVar(canPlaySrc.server || '')
3941
+ });
3942
+ var elemVars = $(elem).data('vars') || {};
3943
+
3944
+
3945
+
3946
+ var hasControls = $.prop(elem, 'controls');
3947
+ var elemId = 'jarisplayer-'+ webshims.getID(elem);
3948
+
3949
+ var params = $.extend(
3950
+ {},
3951
+ options.params,
3952
+ $(elem).data('params')
3953
+ );
3954
+ var elemNodeName = elem.nodeName.toLowerCase();
3955
+ var attrs = $.extend(
3956
+ {},
3957
+ options.attrs,
3958
+ {
3959
+ name: elemId,
3960
+ id: elemId
3961
+ },
3962
+ $(elem).data('attrs')
3963
+ );
3964
+ var setDimension = function(){
3965
+ setElementDimension(data, $.prop(elem, 'controls'));
3966
+ };
3967
+
3968
+ var box;
3969
+
3970
+ if(data && data.swfCreated){
3971
+ mediaelement.setActive(elem, 'third', data);
3972
+
3973
+ data.currentSrc = canPlaySrc.srcProp;
3974
+
3975
+ data.shadowElem.html('<div id="'+ elemId +'">');
3976
+
3977
+ data.api = false;
3978
+ data.actionQueue = [];
3979
+ box = data.shadowElem;
3980
+ resetSwfProps(data);
3981
+ } else {
3982
+ box = $('<div class="polyfill-'+ (elemNodeName) +' polyfill-mediaelement" id="wrapper-'+ elemId +'"><div id="'+ elemId +'"></div>')
3983
+ .css({
3984
+ position: 'relative',
3985
+ overflow: 'hidden'
3986
+ })
3987
+ ;
3988
+ data = webshims.data(elem, 'mediaelement', webshims.objectCreate(playerStateObj, {
3989
+ actionQueue: {
3990
+ value: []
3991
+ },
3992
+ shadowElem: {
3993
+ value: box
3994
+ },
3995
+ _elemNodeName: {
3996
+ value: elemNodeName
3997
+ },
3998
+ _elem: {
3999
+ value: elem
4000
+ },
4001
+ currentSrc: {
4002
+ value: canPlaySrc.srcProp
4003
+ },
4004
+ swfCreated: {
4005
+ value: true
4006
+ },
4007
+ id: {
4008
+ value: elemId.replace(/-/g, '')
4009
+ },
4010
+ buffered: {
4011
+ value: {
4012
+ start: function(index){
4013
+ if(index >= data.buffered.length){
4014
+ webshims.error('buffered index size error');
4015
+ return;
4016
+ }
4017
+ return 0;
4018
+ },
4019
+ end: function(index){
4020
+ if(index >= data.buffered.length){
4021
+ webshims.error('buffered index size error');
4022
+ return;
4023
+ }
4024
+ return ( (data.duration - data._bufferedStart) * data._bufferedEnd) + data._bufferedStart;
4025
+ },
4026
+ length: 0
4027
+ }
4028
+ }
4029
+ }));
4030
+ setElementDimension(data, hasControls);
4031
+
4032
+ box.insertBefore(elem);
4033
+
4034
+ if(hasNative){
4035
+ $.extend(data, {volume: $.prop(elem, 'volume'), muted: $.prop(elem, 'muted'), paused: $.prop(elem, 'paused')});
4036
+ }
4037
+
4038
+ webshims.addShadowDom(elem, box);
4039
+ addMediaToStopEvents(elem);
4040
+ mediaelement.setActive(elem, 'third', data);
4041
+ $(elem)
4042
+ .on({'updatemediaelementdimensions': setDimension})
4043
+ .onWSOff('updateshadowdom', setDimension)
4044
+ ;
4045
+ }
4046
+
4047
+ if(!mediaelement.jarisEvent[data.id]){
4048
+ mediaelement.jarisEvent[data.id] = function(jaris){
4049
+ if(jaris.type == 'ready'){
4050
+ var onReady = function(){
4051
+ if(data.api){
4052
+ if(bufferSrc(elem)){
4053
+ data.api.api_preload();
4054
+ }
4055
+ onEvent.ready(jaris, data);
4056
+ }
4057
+ };
4058
+ if(data.api){
4059
+ onReady();
4060
+ } else {
4061
+ setTimeout(onReady, 9);
4062
+ }
4063
+ } else {
4064
+ data.currentTime = jaris.position;
4065
+
4066
+ if(data.api){
4067
+ if(!data._calledMeta && isNaN(jaris.duration) && data.duration != jaris.duration && isNaN(data.duration)){
4068
+ onEvent.onDataInitialized(jaris, data);
4069
+ }
4070
+
4071
+ if(!data._ppFlag && jaris.type != 'onPlayPause'){
4072
+ onEvent.onPlayPause(jaris, data);
4073
+ }
4074
+
4075
+ if(onEvent[jaris.type]){
4076
+ onEvent[jaris.type](jaris, data);
4077
+ }
4078
+ }
4079
+ data.duration = jaris.duration;
4080
+ }
4081
+
4082
+ };
4083
+ }
4084
+
4085
+ $.extend(vars,
4086
+ {
4087
+ id: elemId,
4088
+ evtId: data.id,
4089
+ controls: ''+hasControls,
4090
+ autostart: 'false',
4091
+ nodename: elemNodeName
4092
+ },
4093
+ elemVars
4094
+ );
4095
+
4096
+ if(isRtmp){
4097
+ vars.streamtype = 'rtmp';
4098
+ } else if(canPlaySrc.type == 'audio/mpeg' || canPlaySrc.type == 'audio/mp3'){
4099
+ vars.type = 'audio';
4100
+ vars.streamtype = 'file';
4101
+ } else if(canPlaySrc.type == 'video/youtube'){
4102
+ vars.streamtype = 'youtube';
4103
+ }
4104
+ options.changeSWF(vars, elem, canPlaySrc, data, 'embed');
4105
+ clearTimeout(data.flashBlock);
4106
+
4107
+ swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.115", false, vars, params, attrs, function(swfData){
4108
+
4109
+ if(swfData.success){
4110
+
4111
+ data.api = swfData.ref;
4112
+
4113
+ if(!hasControls){
4114
+ $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
4115
+ }
4116
+
4117
+ data.flashBlock = setTimeout(function(){
4118
+ if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
4119
+ box.addClass('flashblocker-assumed');
4120
+ $(elem).trigger('flashblocker');
4121
+ webshims.warn("flashblocker assumed");
4122
+ }
4123
+ $(swfData.ref).css({'minHeight': '2px', 'minWidth': '2px', display: 'block'});
4124
+ }, 9);
4125
+
4126
+ if(!localConnectionTimer){
4127
+ clearTimeout(localConnectionTimer);
4128
+ localConnectionTimer = setTimeout(function(){
4129
+ var flash = $(swfData.ref);
4130
+ if(flash[0].offsetWidth > 1 && flash[0].offsetHeight > 1 && location.protocol.indexOf('file:') === 0){
4131
+ webshims.error("Add your local development-directory to the local-trusted security sandbox: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html");
4132
+ } else if(flash[0].offsetWidth < 2 || flash[0].offsetHeight < 2) {
4133
+ webshims.warn("JS-SWF connection can't be established on hidden or unconnected flash objects");
4134
+ }
4135
+ flash = null;
4136
+ }, 8000);
4137
+ }
4138
+ }
4139
+ });
4140
+
4141
+ };
4142
+
4143
+
4144
+ var queueSwfMethod = function(elem, fn, args, data){
4145
+ data = data || getSwfDataFromElem(elem);
4146
+
4147
+ if(data){
4148
+ if(data.api && data.api[fn]){
4149
+ data.api[fn].apply(data.api, args || []);
4150
+ } else {
4151
+ //todo add to queue
4152
+ data.actionQueue.push({fn: fn, args: args});
4153
+
4154
+ if(data.actionQueue.length > 10){
4155
+ setTimeout(function(){
4156
+ if(data.actionQueue.length > 5){
4157
+ data.actionQueue.shift();
4158
+ }
4159
+ }, 99);
4160
+ }
4161
+ }
4162
+ return data;
4163
+ }
4164
+ return false;
4165
+ };
4166
+
4167
+ ['audio', 'video'].forEach(function(nodeName){
4168
+ var descs = {};
4169
+ var mediaSup;
4170
+ var createGetProp = function(key){
4171
+ if(nodeName == 'audio' && (key == 'videoHeight' || key == 'videoWidth')){return;}
4172
+
4173
+ descs[key] = {
4174
+ get: function(){
4175
+ var data = getSwfDataFromElem(this);
4176
+ if(data){
4177
+ return data[key];
4178
+ } else if(hasNative && mediaSup[key].prop._supget) {
4179
+ return mediaSup[key].prop._supget.apply(this);
4180
+ } else {
4181
+ return playerStateObj[key];
4182
+ }
4183
+ },
4184
+ writeable: false
4185
+ };
4186
+ };
4187
+ var createGetSetProp = function(key, setFn){
4188
+ createGetProp(key);
4189
+ delete descs[key].writeable;
4190
+ descs[key].set = setFn;
4191
+ };
4192
+
4193
+ createGetSetProp('volume', function(v){
4194
+ var data = getSwfDataFromElem(this);
4195
+ if(data){
4196
+ v *= 1;
4197
+ if(!isNaN(v)){
4198
+
4199
+ if(v < 0 || v > 1){
4200
+ webshims.error('volume greater or less than allowed '+ (v / 100));
4201
+ }
4202
+
4203
+ queueSwfMethod(this, 'api_volume', [v], data);
4204
+
4205
+
4206
+ if(data.volume != v){
4207
+ data.volume = v;
4208
+ trigger(data._elem, 'volumechange');
4209
+ }
4210
+ data = null;
4211
+ }
4212
+ } else if(mediaSup.volume.prop._supset) {
4213
+ return mediaSup.volume.prop._supset.apply(this, arguments);
4214
+ }
4215
+ });
4216
+
4217
+ createGetSetProp('muted', function(m){
4218
+ var data = getSwfDataFromElem(this);
4219
+ if(data){
4220
+ m = !!m;
4221
+ queueSwfMethod(this, 'api_muted', [m], data);
4222
+ if(data.muted != m){
4223
+ data.muted = m;
4224
+ trigger(data._elem, 'volumechange');
4225
+ }
4226
+ data = null;
4227
+ } else if(mediaSup.muted.prop._supset) {
4228
+ return mediaSup.muted.prop._supset.apply(this, arguments);
4229
+ }
4230
+ });
4231
+
4232
+
4233
+ createGetSetProp('currentTime', function(t){
4234
+ var data = getSwfDataFromElem(this);
4235
+ if(data){
4236
+ t *= 1;
4237
+ if (!isNaN(t)) {
4238
+ queueSwfMethod(this, 'api_seek', [t], data);
4239
+ }
4240
+
4241
+ } else if(mediaSup.currentTime.prop._supset) {
4242
+ return mediaSup.currentTime.prop._supset.apply(this, arguments);
4243
+ }
4244
+ });
4245
+
4246
+ ['play', 'pause'].forEach(function(fn){
4247
+ descs[fn] = {
4248
+ value: function(){
4249
+ var data = getSwfDataFromElem(this);
4250
+ if(data){
4251
+ if(data.stopPlayPause){
4252
+ clearTimeout(data.stopPlayPause);
4253
+ }
4254
+ queueSwfMethod(this, fn == 'play' ? 'api_play' : 'api_pause', [], data);
4255
+
4256
+ data._ppFlag = true;
4257
+ if(data.paused != (fn != 'play')){
4258
+ data.paused = fn != 'play';
4259
+ trigger(data._elem, fn);
4260
+ }
4261
+ } else if(mediaSup[fn].prop._supvalue) {
4262
+ return mediaSup[fn].prop._supvalue.apply(this, arguments);
4263
+ }
4264
+ }
4265
+ };
4266
+ });
4267
+
4268
+ getPropKeys.forEach(createGetProp);
4269
+
4270
+ webshims.onNodeNamesPropertyModify(nodeName, 'controls', function(val, boolProp){
4271
+ var data = getSwfDataFromElem(this);
4272
+ $(this)[boolProp ? 'addClass' : 'removeClass']('webshims-controls');
4273
+
4274
+ if(data){
4275
+ if(nodeName == 'audio'){
4276
+ setElementDimension(data, boolProp);
4277
+ }
4278
+ queueSwfMethod(this, 'api_controls', [boolProp], data);
4279
+ }
4280
+ });
4281
+
4282
+ webshims.onNodeNamesPropertyModify(nodeName, 'preload', function(val){
4283
+ var data = getSwfDataFromElem(this);
4284
+
4285
+
4286
+ if(data && bufferSrc(this)){
4287
+ queueSwfMethod(this, 'api_preload', [], data);
4288
+ }
4289
+ });
4290
+
4291
+ mediaSup = webshims.defineNodeNameProperties(nodeName, descs, 'prop');
4292
+ });
4293
+
4294
+ if(hasFlash && $.cleanData){
4295
+ var oldClean = $.cleanData;
4296
+ var flashNames = {
4297
+ object: 1,
4298
+ OBJECT: 1
4299
+ };
4300
+
4301
+ $.cleanData = function(elems){
4302
+ var i, len, prop;
4303
+ if(elems && (len = elems.length) && loadedSwf){
4304
+
4305
+ for(i = 0; i < len; i++){
4306
+ if(flashNames[elems[i].nodeName] && 'api_pause' in elems[i]){
4307
+ loadedSwf--;
4308
+ try {
4309
+ elems[i].api_pause();
4310
+ } catch(er){}
4311
+ }
4312
+ }
4313
+
4314
+ }
4315
+ return oldClean.apply(this, arguments);
4316
+ };
4317
+ }
4318
+
4319
+ if(!hasNative){
4320
+
4321
+ ['poster', 'src'].forEach(function(prop){
4322
+ webshims.defineNodeNamesProperty(prop == 'src' ? ['audio', 'video', 'source'] : ['video'], prop, {
4323
+ //attr: {},
4324
+ reflect: true,
4325
+ propType: 'src'
4326
+ });
4327
+ });
4328
+
4329
+ webshims.defineNodeNamesProperty(['audio', 'video'], 'preload', {
4330
+ reflect: true,
4331
+ propType: 'enumarated',
4332
+ defaultValue: '',
4333
+ limitedTo: ['', 'auto', 'metadata', 'none']
4334
+ });
4335
+
4336
+
4337
+ ['autoplay', 'controls'].forEach(function(name){
4338
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], name);
4339
+ });
4340
+
4341
+ webshims.defineNodeNamesProperties(['audio', 'video'], {
4342
+ HAVE_CURRENT_DATA: {
4343
+ value: 2
4344
+ },
4345
+ HAVE_ENOUGH_DATA: {
4346
+ value: 4
4347
+ },
4348
+ HAVE_FUTURE_DATA: {
4349
+ value: 3
4350
+ },
4351
+ HAVE_METADATA: {
4352
+ value: 1
4353
+ },
4354
+ HAVE_NOTHING: {
4355
+ value: 0
4356
+ },
4357
+ NETWORK_EMPTY: {
4358
+ value: 0
4359
+ },
4360
+ NETWORK_IDLE: {
4361
+ value: 1
4362
+ },
4363
+ NETWORK_LOADING: {
4364
+ value: 2
4365
+ },
4366
+ NETWORK_NO_SOURCE: {
4367
+ value: 3
4368
+ }
4369
+
4370
+ }, 'prop');
4371
+ }
4372
+
4373
+ });