webshims-rails 1.14.3 → 1.14.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webshims-rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/webshims/extras/modernizr-custom.js +4 -0
  4. data/vendor/assets/javascripts/webshims/polyfiller.js +141 -139
  5. data/vendor/assets/javascripts/webshims/shims/color-picker.js +1 -3
  6. data/vendor/assets/javascripts/webshims/shims/combos/1.js +22 -33
  7. data/vendor/assets/javascripts/webshims/shims/combos/10.js +76 -73
  8. data/vendor/assets/javascripts/webshims/shims/combos/11.js +73 -61
  9. data/vendor/assets/javascripts/webshims/shims/combos/12.js +37 -41
  10. data/vendor/assets/javascripts/webshims/shims/combos/13.js +36 -40
  11. data/vendor/assets/javascripts/webshims/shims/combos/14.js +7 -7
  12. data/vendor/assets/javascripts/webshims/shims/combos/15.js +23 -32
  13. data/vendor/assets/javascripts/webshims/shims/combos/16.js +36 -57
  14. data/vendor/assets/javascripts/webshims/shims/combos/17.js +73 -61
  15. data/vendor/assets/javascripts/webshims/shims/combos/18.js +611 -4604
  16. data/vendor/assets/javascripts/webshims/shims/combos/2.js +27 -47
  17. data/vendor/assets/javascripts/webshims/shims/combos/21.js +61 -31
  18. data/vendor/assets/javascripts/webshims/shims/combos/22.js +24 -16
  19. data/vendor/assets/javascripts/webshims/shims/combos/23.js +13 -25
  20. data/vendor/assets/javascripts/webshims/shims/combos/25.js +40 -27
  21. data/vendor/assets/javascripts/webshims/shims/combos/27.js +167 -166
  22. data/vendor/assets/javascripts/webshims/shims/combos/28.js +11 -12
  23. data/vendor/assets/javascripts/webshims/shims/combos/29.js +5 -5
  24. data/vendor/assets/javascripts/webshims/shims/combos/3.js +14 -22
  25. data/vendor/assets/javascripts/webshims/shims/combos/30.js +16 -24
  26. data/vendor/assets/javascripts/webshims/shims/combos/31.js +14 -22
  27. data/vendor/assets/javascripts/webshims/shims/combos/33.js +2 -2
  28. data/vendor/assets/javascripts/webshims/shims/combos/34.js +27 -28
  29. data/vendor/assets/javascripts/webshims/shims/combos/4.js +5 -14
  30. data/vendor/assets/javascripts/webshims/shims/combos/5.js +78 -66
  31. data/vendor/assets/javascripts/webshims/shims/combos/6.js +80 -68
  32. data/vendor/assets/javascripts/webshims/shims/combos/7.js +29 -49
  33. data/vendor/assets/javascripts/webshims/shims/combos/8.js +27 -47
  34. data/vendor/assets/javascripts/webshims/shims/combos/9.js +78 -75
  35. data/vendor/assets/javascripts/webshims/shims/combos/97.js +42 -29
  36. data/vendor/assets/javascripts/webshims/shims/combos/98.js +116 -40
  37. data/vendor/assets/javascripts/webshims/shims/combos/99.js +112 -38
  38. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +3 -12
  39. data/vendor/assets/javascripts/webshims/shims/es5.js +4 -4
  40. data/vendor/assets/javascripts/webshims/shims/es6.js +1887 -0
  41. data/vendor/assets/javascripts/webshims/shims/form-core.js +9 -8
  42. data/vendor/assets/javascripts/webshims/shims/form-datalist.js +2 -2
  43. data/vendor/assets/javascripts/webshims/shims/form-inputmode.js +52 -0
  44. data/vendor/assets/javascripts/webshims/shims/form-message.js +2 -2
  45. data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +4 -5
  46. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +73 -61
  47. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +7 -8
  48. data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +164 -163
  49. data/vendor/assets/javascripts/webshims/shims/form-validation.js +121 -144
  50. data/vendor/assets/javascripts/webshims/shims/jme/_icons.scss +3 -0
  51. data/vendor/assets/javascripts/webshims/shims/jme/alternate-media.js +184 -0
  52. data/vendor/assets/javascripts/webshims/shims/jme/{b.js → base.js} +38 -27
  53. data/vendor/assets/javascripts/webshims/shims/jme/controls.css +129 -39
  54. data/vendor/assets/javascripts/webshims/shims/jme/controls.scss +145 -44
  55. data/vendor/assets/javascripts/webshims/shims/jme/jme.eot +0 -0
  56. data/vendor/assets/javascripts/webshims/shims/jme/jme.svg +0 -0
  57. data/vendor/assets/javascripts/webshims/shims/jme/jme.ttf +0 -0
  58. data/vendor/assets/javascripts/webshims/shims/jme/jme.woff +0 -0
  59. data/vendor/assets/javascripts/webshims/shims/jme/mediacontrols-lazy.js +448 -90
  60. data/vendor/assets/javascripts/webshims/shims/jme/{c.js → mediacontrols.js} +74 -11
  61. data/vendor/assets/javascripts/webshims/shims/jme/{p.js → playlist.js} +4 -2
  62. data/vendor/assets/javascripts/webshims/shims/matchMedia.js +122 -0
  63. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +12 -24
  64. data/vendor/assets/javascripts/webshims/shims/mediaelement-debug.js +1 -1
  65. data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +37 -15
  66. data/vendor/assets/javascripts/webshims/shims/mediaelement-native-fix.js +3 -3
  67. data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +4 -5
  68. data/vendor/assets/javascripts/webshims/shims/picture.js +13 -54
  69. data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +13 -20
  70. data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +24 -18
  71. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +32 -10
  72. data/vendor/assets/javascripts/webshims/shims/styles/shim-ext.css +43 -47
  73. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +30 -18
  74. data/vendor/assets/javascripts/webshims/shims/styles/transparent.png +0 -0
  75. data/vendor/assets/javascripts/webshims/shims/styles/widget.eot +0 -0
  76. data/vendor/assets/javascripts/webshims/shims/styles/widget.svg +0 -0
  77. data/vendor/assets/javascripts/webshims/shims/styles/widget.ttf +0 -0
  78. data/vendor/assets/javascripts/webshims/shims/styles/widget.woff +0 -0
  79. data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
  80. data/vendor/assets/javascripts/webshims/shims/swfmini.js +1 -1
  81. data/vendor/assets/javascripts/webshims/shims/track-ui.js +4 -5
  82. data/vendor/assets/javascripts/webshims/shims/track.js +24 -16
  83. metadata +9 -8
  84. data/vendor/assets/javascripts/webshims/shims/combos/19.js +0 -4745
  85. data/vendor/assets/javascripts/webshims/shims/combos/20.js +0 -4522
  86. data/vendor/assets/javascripts/webshims/shims/combos/32.js +0 -2443
  87. data/vendor/assets/javascripts/webshims/shims/combos/comboinfo.json +0 -1
@@ -1,4522 +0,0 @@
1
- // Copyright 2009-2012 by contributors, MIT License
2
- // vim: ts=4 sts=4 sw=4 expandtab
3
-
4
- (function () {
5
- setTimeout(function(){
6
- webshims.isReady('es5', true);
7
- });
8
- /**
9
- * Brings an environment as close to ECMAScript 5 compliance
10
- * as is possible with the facilities of erstwhile engines.
11
- *
12
- * Annotated ES5: http://es5.github.com/ (specific links below)
13
- * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
14
- * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/
15
- */
16
-
17
- // Shortcut to an often accessed properties, in order to avoid multiple
18
- // dereference that costs universally.
19
- var call = Function.prototype.call;
20
- var prototypeOfArray = Array.prototype;
21
- var prototypeOfObject = Object.prototype;
22
- var _Array_slice_ = prototypeOfArray.slice;
23
- var array_splice = Array.prototype.splice;
24
- var array_push = Array.prototype.push;
25
- var array_unshift = Array.prototype.unshift;
26
-
27
- // Having a toString local variable name breaks in Opera so use _toString.
28
- var _toString = prototypeOfObject.toString;
29
-
30
- var isFunction = function (val) {
31
- return prototypeOfObject.toString.call(val) === '[object Function]';
32
- };
33
- var isRegex = function (val) {
34
- return prototypeOfObject.toString.call(val) === '[object RegExp]';
35
- };
36
- var isArray = function isArray(obj) {
37
- return _toString.call(obj) === "[object Array]";
38
- };
39
- var isArguments = function isArguments(value) {
40
- var str = _toString.call(value);
41
- var isArgs = str === '[object Arguments]';
42
- if (!isArgs) {
43
- isArgs = !isArray(str)
44
- && value !== null
45
- && typeof value === 'object'
46
- && typeof value.length === 'number'
47
- && value.length >= 0
48
- && isFunction(value.callee);
49
- }
50
- return isArgs;
51
- };
52
-
53
- //
54
- // Function
55
- // ========
56
- //
57
-
58
- // ES-5 15.3.4.5
59
- // http://es5.github.com/#x15.3.4.5
60
-
61
- function Empty() {}
62
-
63
- if (!Function.prototype.bind) {
64
- Function.prototype.bind = function bind(that) { // .length is 1
65
- // 1. Let Target be the this value.
66
- var target = this;
67
- // 2. If IsCallable(Target) is false, throw a TypeError exception.
68
- if (!isFunction(target)) {
69
- throw new TypeError("Function.prototype.bind called on incompatible " + target);
70
- }
71
- // 3. Let A be a new (possibly empty) internal list of all of the
72
- // argument values provided after thisArg (arg1, arg2 etc), in order.
73
- // XXX slicedArgs will stand in for "A" if used
74
- var args = _Array_slice_.call(arguments, 1); // for normal call
75
- // 4. Let F be a new native ECMAScript object.
76
- // 11. Set the [[Prototype]] internal property of F to the standard
77
- // built-in Function prototype object as specified in 15.3.3.1.
78
- // 12. Set the [[Call]] internal property of F as described in
79
- // 15.3.4.5.1.
80
- // 13. Set the [[Construct]] internal property of F as described in
81
- // 15.3.4.5.2.
82
- // 14. Set the [[HasInstance]] internal property of F as described in
83
- // 15.3.4.5.3.
84
- var binder = function () {
85
-
86
- if (this instanceof bound) {
87
- // 15.3.4.5.2 [[Construct]]
88
- // When the [[Construct]] internal method of a function object,
89
- // F that was created using the bind function is called with a
90
- // list of arguments ExtraArgs, the following steps are taken:
91
- // 1. Let target be the value of F's [[TargetFunction]]
92
- // internal property.
93
- // 2. If target has no [[Construct]] internal method, a
94
- // TypeError exception is thrown.
95
- // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
96
- // property.
97
- // 4. Let args be a new list containing the same values as the
98
- // list boundArgs in the same order followed by the same
99
- // values as the list ExtraArgs in the same order.
100
- // 5. Return the result of calling the [[Construct]] internal
101
- // method of target providing args as the arguments.
102
-
103
- var result = target.apply(
104
- this,
105
- args.concat(_Array_slice_.call(arguments))
106
- );
107
- if (Object(result) === result) {
108
- return result;
109
- }
110
- return this;
111
-
112
- } else {
113
- // 15.3.4.5.1 [[Call]]
114
- // When the [[Call]] internal method of a function object, F,
115
- // which was created using the bind function is called with a
116
- // this value and a list of arguments ExtraArgs, the following
117
- // steps are taken:
118
- // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
119
- // property.
120
- // 2. Let boundThis be the value of F's [[BoundThis]] internal
121
- // property.
122
- // 3. Let target be the value of F's [[TargetFunction]] internal
123
- // property.
124
- // 4. Let args be a new list containing the same values as the
125
- // list boundArgs in the same order followed by the same
126
- // values as the list ExtraArgs in the same order.
127
- // 5. Return the result of calling the [[Call]] internal method
128
- // of target providing boundThis as the this value and
129
- // providing args as the arguments.
130
-
131
- // equiv: target.call(this, ...boundArgs, ...args)
132
- return target.apply(
133
- that,
134
- args.concat(_Array_slice_.call(arguments))
135
- );
136
-
137
- }
138
-
139
- };
140
-
141
- // 15. If the [[Class]] internal property of Target is "Function", then
142
- // a. Let L be the length property of Target minus the length of A.
143
- // b. Set the length own property of F to either 0 or L, whichever is
144
- // larger.
145
- // 16. Else set the length own property of F to 0.
146
-
147
- var boundLength = Math.max(0, target.length - args.length);
148
-
149
- // 17. Set the attributes of the length own property of F to the values
150
- // specified in 15.3.5.1.
151
- var boundArgs = [];
152
- for (var i = 0; i < boundLength; i++) {
153
- boundArgs.push("$" + i);
154
- }
155
-
156
- // XXX Build a dynamic function with desired amount of arguments is the only
157
- // way to set the length property of a function.
158
- // In environments where Content Security Policies enabled (Chrome extensions,
159
- // for ex.) all use of eval or Function costructor throws an exception.
160
- // However in all of these environments Function.prototype.bind exists
161
- // and so this code will never be executed.
162
- var bound = Function("binder", "return function (" + boundArgs.join(",") + "){return binder.apply(this,arguments)}")(binder);
163
-
164
- if (target.prototype) {
165
- Empty.prototype = target.prototype;
166
- bound.prototype = new Empty();
167
- // Clean up dangling references.
168
- Empty.prototype = null;
169
- }
170
-
171
- // TODO
172
- // 18. Set the [[Extensible]] internal property of F to true.
173
-
174
- // TODO
175
- // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
176
- // 20. Call the [[DefineOwnProperty]] internal method of F with
177
- // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
178
- // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
179
- // false.
180
- // 21. Call the [[DefineOwnProperty]] internal method of F with
181
- // arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
182
- // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
183
- // and false.
184
-
185
- // TODO
186
- // NOTE Function objects created using Function.prototype.bind do not
187
- // have a prototype property or the [[Code]], [[FormalParameters]], and
188
- // [[Scope]] internal properties.
189
- // XXX can't delete prototype in pure-js.
190
-
191
- // 22. Return F.
192
- return bound;
193
- };
194
- }
195
-
196
- // _Please note: Shortcuts are defined after `Function.prototype.bind` as we
197
- // us it in defining shortcuts.
198
- var owns = call.bind(prototypeOfObject.hasOwnProperty);
199
-
200
- // If JS engine supports accessors creating shortcuts.
201
- var defineGetter;
202
- var defineSetter;
203
- var lookupGetter;
204
- var lookupSetter;
205
- var supportsAccessors;
206
- if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
207
- defineGetter = call.bind(prototypeOfObject.__defineGetter__);
208
- defineSetter = call.bind(prototypeOfObject.__defineSetter__);
209
- lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
210
- lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
211
- }
212
-
213
- //
214
- // Array
215
- // =====
216
- //
217
-
218
- // ES5 15.4.4.12
219
- // http://es5.github.com/#x15.4.4.12
220
- var spliceWorksWithEmptyObject = (function () {
221
- var obj = {};
222
- Array.prototype.splice.call(obj, 0, 0, 1);
223
- return obj.length === 1;
224
- }());
225
- var omittingSecondSpliceArgIsNoop = [1].splice(0).length === 0;
226
- var spliceNoopReturnsEmptyArray = (function () {
227
- var a = [1, 2];
228
- var result = a.splice();
229
- return a.length === 2 && isArray(result) && result.length === 0;
230
- }());
231
- if (spliceNoopReturnsEmptyArray) {
232
- // Safari 5.0 bug where .split() returns undefined
233
- Array.prototype.splice = function splice(start, deleteCount) {
234
- if (arguments.length === 0) { return []; }
235
- else { return array_splice.apply(this, arguments); }
236
- };
237
- }
238
- if (!omittingSecondSpliceArgIsNoop || !spliceWorksWithEmptyObject) {
239
- Array.prototype.splice = function splice(start, deleteCount) {
240
- if (arguments.length === 0) { return []; }
241
- var args = arguments;
242
- this.length = Math.max(toInteger(this.length), 0);
243
- if (arguments.length > 0 && typeof deleteCount !== 'number') {
244
- args = _Array_slice_.call(arguments);
245
- if (args.length < 2) { args.push(toInteger(deleteCount)); }
246
- else { args[1] = toInteger(deleteCount); }
247
- }
248
- return array_splice.apply(this, args);
249
- };
250
- }
251
-
252
- // ES5 15.4.4.12
253
- // http://es5.github.com/#x15.4.4.13
254
- // Return len+argCount.
255
- // [bugfix, ielt8]
256
- // IE < 8 bug: [].unshift(0) === undefined but should be "1"
257
- if ([].unshift(0) !== 1) {
258
- Array.prototype.unshift = function () {
259
- array_unshift.apply(this, arguments);
260
- return this.length;
261
- };
262
- }
263
-
264
- // ES5 15.4.3.2
265
- // http://es5.github.com/#x15.4.3.2
266
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
267
- if (!Array.isArray) {
268
- Array.isArray = isArray;
269
- }
270
-
271
- // The IsCallable() check in the Array functions
272
- // has been replaced with a strict check on the
273
- // internal class of the object to trap cases where
274
- // the provided function was actually a regular
275
- // expression literal, which in V8 and
276
- // JavaScriptCore is a typeof "function". Only in
277
- // V8 are regular expression literals permitted as
278
- // reduce parameters, so it is desirable in the
279
- // general case for the shim to match the more
280
- // strict and common behavior of rejecting regular
281
- // expressions.
282
-
283
- // ES5 15.4.4.18
284
- // http://es5.github.com/#x15.4.4.18
285
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach
286
-
287
- // Check failure of by-index access of string characters (IE < 9)
288
- // and failure of `0 in boxedString` (Rhino)
289
- var boxedString = Object("a");
290
- var splitString = boxedString[0] !== "a" || !(0 in boxedString);
291
-
292
- var properlyBoxesContext = function properlyBoxed(method) {
293
- // Check node 0.6.21 bug where third parameter is not boxed
294
- var properlyBoxesNonStrict = true;
295
- var properlyBoxesStrict = true;
296
- if (method) {
297
- method.call('foo', function (_, __, context) {
298
- if (typeof context !== 'object') { properlyBoxesNonStrict = false; }
299
- });
300
-
301
- method.call([1], function () {
302
- 'use strict';
303
- properlyBoxesStrict = typeof this === 'string';
304
- }, 'x');
305
- }
306
- return !!method && properlyBoxesNonStrict && properlyBoxesStrict;
307
- };
308
-
309
- if (!Array.prototype.forEach || !properlyBoxesContext(Array.prototype.forEach)) {
310
- Array.prototype.forEach = function forEach(fun /*, thisp*/) {
311
- var object = toObject(this),
312
- self = splitString && _toString.call(this) === "[object String]" ?
313
- this.split("") :
314
- object,
315
- thisp = arguments[1],
316
- i = -1,
317
- length = self.length >>> 0;
318
-
319
- // If no callback function or if callback is not a callable function
320
- if (!isFunction(fun)) {
321
- throw new TypeError(); // TODO message
322
- }
323
-
324
- while (++i < length) {
325
- if (i in self) {
326
- // Invoke the callback function with call, passing arguments:
327
- // context, property value, property key, thisArg object
328
- // context
329
- fun.call(thisp, self[i], i, object);
330
- }
331
- }
332
- };
333
- }
334
-
335
- // ES5 15.4.4.19
336
- // http://es5.github.com/#x15.4.4.19
337
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
338
- if (!Array.prototype.map || !properlyBoxesContext(Array.prototype.map)) {
339
- Array.prototype.map = function map(fun /*, thisp*/) {
340
- var object = toObject(this),
341
- self = splitString && _toString.call(this) === "[object String]" ?
342
- this.split("") :
343
- object,
344
- length = self.length >>> 0,
345
- result = Array(length),
346
- thisp = arguments[1];
347
-
348
- // If no callback function or if callback is not a callable function
349
- if (!isFunction(fun)) {
350
- throw new TypeError(fun + " is not a function");
351
- }
352
-
353
- for (var i = 0; i < length; i++) {
354
- if (i in self) {
355
- result[i] = fun.call(thisp, self[i], i, object);
356
- }
357
- }
358
- return result;
359
- };
360
- }
361
-
362
- // ES5 15.4.4.20
363
- // http://es5.github.com/#x15.4.4.20
364
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
365
- if (!Array.prototype.filter || !properlyBoxesContext(Array.prototype.filter)) {
366
- Array.prototype.filter = function filter(fun /*, thisp */) {
367
- var object = toObject(this),
368
- self = splitString && _toString.call(this) === "[object String]" ?
369
- this.split("") :
370
- object,
371
- length = self.length >>> 0,
372
- result = [],
373
- value,
374
- thisp = arguments[1];
375
-
376
- // If no callback function or if callback is not a callable function
377
- if (!isFunction(fun)) {
378
- throw new TypeError(fun + " is not a function");
379
- }
380
-
381
- for (var i = 0; i < length; i++) {
382
- if (i in self) {
383
- value = self[i];
384
- if (fun.call(thisp, value, i, object)) {
385
- result.push(value);
386
- }
387
- }
388
- }
389
- return result;
390
- };
391
- }
392
-
393
- // ES5 15.4.4.16
394
- // http://es5.github.com/#x15.4.4.16
395
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every
396
- if (!Array.prototype.every || !properlyBoxesContext(Array.prototype.every)) {
397
- Array.prototype.every = function every(fun /*, thisp */) {
398
- var object = toObject(this),
399
- self = splitString && _toString.call(this) === "[object String]" ?
400
- this.split("") :
401
- object,
402
- length = self.length >>> 0,
403
- thisp = arguments[1];
404
-
405
- // If no callback function or if callback is not a callable function
406
- if (!isFunction(fun)) {
407
- throw new TypeError(fun + " is not a function");
408
- }
409
-
410
- for (var i = 0; i < length; i++) {
411
- if (i in self && !fun.call(thisp, self[i], i, object)) {
412
- return false;
413
- }
414
- }
415
- return true;
416
- };
417
- }
418
-
419
- // ES5 15.4.4.17
420
- // http://es5.github.com/#x15.4.4.17
421
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
422
- if (!Array.prototype.some || !properlyBoxesContext(Array.prototype.some)) {
423
- Array.prototype.some = function some(fun /*, thisp */) {
424
- var object = toObject(this),
425
- self = splitString && _toString.call(this) === "[object String]" ?
426
- this.split("") :
427
- object,
428
- length = self.length >>> 0,
429
- thisp = arguments[1];
430
-
431
- // If no callback function or if callback is not a callable function
432
- if (!isFunction(fun)) {
433
- throw new TypeError(fun + " is not a function");
434
- }
435
-
436
- for (var i = 0; i < length; i++) {
437
- if (i in self && fun.call(thisp, self[i], i, object)) {
438
- return true;
439
- }
440
- }
441
- return false;
442
- };
443
- }
444
-
445
- // ES5 15.4.4.21
446
- // http://es5.github.com/#x15.4.4.21
447
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
448
- var reduceCoercesToObject = false;
449
- if (Array.prototype.reduce) {
450
- reduceCoercesToObject = typeof Array.prototype.reduce.call('es5', function (_, __, ___, list) { return list; }) === 'object';
451
- }
452
- if (!Array.prototype.reduce || !reduceCoercesToObject) {
453
- Array.prototype.reduce = function reduce(fun /*, initial*/) {
454
- var object = toObject(this),
455
- self = splitString && _toString.call(this) === "[object String]" ?
456
- this.split("") :
457
- object,
458
- length = self.length >>> 0;
459
-
460
- // If no callback function or if callback is not a callable function
461
- if (!isFunction(fun)) {
462
- throw new TypeError(fun + " is not a function");
463
- }
464
-
465
- // no value to return if no initial value and an empty array
466
- if (!length && arguments.length === 1) {
467
- throw new TypeError("reduce of empty array with no initial value");
468
- }
469
-
470
- var i = 0;
471
- var result;
472
- if (arguments.length >= 2) {
473
- result = arguments[1];
474
- } else {
475
- do {
476
- if (i in self) {
477
- result = self[i++];
478
- break;
479
- }
480
-
481
- // if array contains no values, no initial value to return
482
- if (++i >= length) {
483
- throw new TypeError("reduce of empty array with no initial value");
484
- }
485
- } while (true);
486
- }
487
-
488
- for (; i < length; i++) {
489
- if (i in self) {
490
- result = fun.call(void 0, result, self[i], i, object);
491
- }
492
- }
493
-
494
- return result;
495
- };
496
- }
497
-
498
- // ES5 15.4.4.22
499
- // http://es5.github.com/#x15.4.4.22
500
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
501
- var reduceRightCoercesToObject = false;
502
- if (Array.prototype.reduceRight) {
503
- reduceRightCoercesToObject = typeof Array.prototype.reduceRight.call('es5', function (_, __, ___, list) { return list; }) === 'object';
504
- }
505
- if (!Array.prototype.reduceRight || !reduceRightCoercesToObject) {
506
- Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
507
- var object = toObject(this),
508
- self = splitString && _toString.call(this) === "[object String]" ?
509
- this.split("") :
510
- object,
511
- length = self.length >>> 0;
512
-
513
- // If no callback function or if callback is not a callable function
514
- if (!isFunction(fun)) {
515
- throw new TypeError(fun + " is not a function");
516
- }
517
-
518
- // no value to return if no initial value, empty array
519
- if (!length && arguments.length === 1) {
520
- throw new TypeError("reduceRight of empty array with no initial value");
521
- }
522
-
523
- var result, i = length - 1;
524
- if (arguments.length >= 2) {
525
- result = arguments[1];
526
- } else {
527
- do {
528
- if (i in self) {
529
- result = self[i--];
530
- break;
531
- }
532
-
533
- // if array contains no values, no initial value to return
534
- if (--i < 0) {
535
- throw new TypeError("reduceRight of empty array with no initial value");
536
- }
537
- } while (true);
538
- }
539
-
540
- if (i < 0) {
541
- return result;
542
- }
543
-
544
- do {
545
- if (i in self) {
546
- result = fun.call(void 0, result, self[i], i, object);
547
- }
548
- } while (i--);
549
-
550
- return result;
551
- };
552
- }
553
-
554
- // ES5 15.4.4.14
555
- // http://es5.github.com/#x15.4.4.14
556
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
557
- if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) !== -1)) {
558
- Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
559
- var self = splitString && _toString.call(this) === "[object String]" ?
560
- this.split("") :
561
- toObject(this),
562
- length = self.length >>> 0;
563
-
564
- if (!length) {
565
- return -1;
566
- }
567
-
568
- var i = 0;
569
- if (arguments.length > 1) {
570
- i = toInteger(arguments[1]);
571
- }
572
-
573
- // handle negative indices
574
- i = i >= 0 ? i : Math.max(0, length + i);
575
- for (; i < length; i++) {
576
- if (i in self && self[i] === sought) {
577
- return i;
578
- }
579
- }
580
- return -1;
581
- };
582
- }
583
-
584
- // ES5 15.4.4.15
585
- // http://es5.github.com/#x15.4.4.15
586
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
587
- if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) !== -1)) {
588
- Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
589
- var self = splitString && _toString.call(this) === "[object String]" ?
590
- this.split("") :
591
- toObject(this),
592
- length = self.length >>> 0;
593
-
594
- if (!length) {
595
- return -1;
596
- }
597
- var i = length - 1;
598
- if (arguments.length > 1) {
599
- i = Math.min(i, toInteger(arguments[1]));
600
- }
601
- // handle negative indices
602
- i = i >= 0 ? i : length - Math.abs(i);
603
- for (; i >= 0; i--) {
604
- if (i in self && sought === self[i]) {
605
- return i;
606
- }
607
- }
608
- return -1;
609
- };
610
- }
611
-
612
- //
613
- // Object
614
- // ======
615
- //
616
-
617
- // ES5 15.2.3.14
618
- // http://es5.github.com/#x15.2.3.14
619
- var keysWorksWithArguments = Object.keys && (function () {
620
- return Object.keys(arguments).length === 2;
621
- }(1, 2));
622
- if (!Object.keys) {
623
- // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
624
- var hasDontEnumBug = !({'toString': null}).propertyIsEnumerable('toString'),
625
- hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'),
626
- dontEnums = [
627
- "toString",
628
- "toLocaleString",
629
- "valueOf",
630
- "hasOwnProperty",
631
- "isPrototypeOf",
632
- "propertyIsEnumerable",
633
- "constructor"
634
- ],
635
- dontEnumsLength = dontEnums.length;
636
-
637
- Object.keys = function keys(object) {
638
- var isFn = isFunction(object),
639
- isArgs = isArguments(object),
640
- isObject = object !== null && typeof object === 'object',
641
- isString = isObject && _toString.call(object) === '[object String]';
642
-
643
- if (!isObject && !isFn && !isArgs) {
644
- throw new TypeError("Object.keys called on a non-object");
645
- }
646
-
647
- var theKeys = [];
648
- var skipProto = hasProtoEnumBug && isFn;
649
- if (isString || isArgs) {
650
- for (var i = 0; i < object.length; ++i) {
651
- theKeys.push(String(i));
652
- }
653
- } else {
654
- for (var name in object) {
655
- if (!(skipProto && name === 'prototype') && owns(object, name)) {
656
- theKeys.push(String(name));
657
- }
658
- }
659
- }
660
-
661
- if (hasDontEnumBug) {
662
- var ctor = object.constructor,
663
- skipConstructor = ctor && ctor.prototype === object;
664
- for (var j = 0; j < dontEnumsLength; j++) {
665
- var dontEnum = dontEnums[j];
666
- if (!(skipConstructor && dontEnum === 'constructor') && owns(object, dontEnum)) {
667
- theKeys.push(dontEnum);
668
- }
669
- }
670
- }
671
- return theKeys;
672
- };
673
- } else if (!keysWorksWithArguments) {
674
- // Safari 5.0 bug
675
- var originalKeys = Object.keys;
676
- Object.keys = function keys(object) {
677
- if (isArguments(object)) {
678
- return originalKeys(Array.prototype.slice.call(object));
679
- } else {
680
- return originalKeys(object);
681
- }
682
- };
683
- }
684
-
685
- //
686
- // Date
687
- // ====
688
- //
689
-
690
- // ES5 15.9.5.43
691
- // http://es5.github.com/#x15.9.5.43
692
- // This function returns a String value represent the instance in time
693
- // represented by this Date object. The format of the String is the Date Time
694
- // string format defined in 15.9.1.15. All fields are present in the String.
695
- // The time zone is always UTC, denoted by the suffix Z. If the time value of
696
- // this object is not a finite Number a RangeError exception is thrown.
697
- var negativeDate = -62198755200000,
698
- negativeYearString = "-000001";
699
- if (
700
- !Date.prototype.toISOString ||
701
- (new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1)
702
- ) {
703
- Date.prototype.toISOString = function toISOString() {
704
- var result, length, value, year, month;
705
- if (!isFinite(this)) {
706
- throw new RangeError("Date.prototype.toISOString called on non-finite value.");
707
- }
708
-
709
- year = this.getUTCFullYear();
710
-
711
- month = this.getUTCMonth();
712
- // see https://github.com/es-shims/es5-shim/issues/111
713
- year += Math.floor(month / 12);
714
- month = (month % 12 + 12) % 12;
715
-
716
- // the date time string format is specified in 15.9.1.15.
717
- result = [month + 1, this.getUTCDate(), this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
718
- year = (
719
- (year < 0 ? "-" : (year > 9999 ? "+" : "")) +
720
- ("00000" + Math.abs(year)).slice(0 <= year && year <= 9999 ? -4 : -6)
721
- );
722
-
723
- length = result.length;
724
- while (length--) {
725
- value = result[length];
726
- // pad months, days, hours, minutes, and seconds to have two
727
- // digits.
728
- if (value < 10) {
729
- result[length] = "0" + value;
730
- }
731
- }
732
- // pad milliseconds to have three digits.
733
- return (
734
- year + "-" + result.slice(0, 2).join("-") +
735
- "T" + result.slice(2).join(":") + "." +
736
- ("000" + this.getUTCMilliseconds()).slice(-3) + "Z"
737
- );
738
- };
739
- }
740
-
741
-
742
- // ES5 15.9.5.44
743
- // http://es5.github.com/#x15.9.5.44
744
- // This function provides a String representation of a Date object for use by
745
- // JSON.stringify (15.12.3).
746
- var dateToJSONIsSupported = false;
747
- try {
748
- dateToJSONIsSupported = (
749
- Date.prototype.toJSON &&
750
- new Date(NaN).toJSON() === null &&
751
- new Date(negativeDate).toJSON().indexOf(negativeYearString) !== -1 &&
752
- Date.prototype.toJSON.call({ // generic
753
- toISOString: function () {
754
- return true;
755
- }
756
- })
757
- );
758
- } catch (e) {
759
- }
760
- if (!dateToJSONIsSupported) {
761
- Date.prototype.toJSON = function toJSON(key) {
762
- // When the toJSON method is called with argument key, the following
763
- // steps are taken:
764
-
765
- // 1. Let O be the result of calling ToObject, giving it the this
766
- // value as its argument.
767
- // 2. Let tv be toPrimitive(O, hint Number).
768
- var o = Object(this),
769
- tv = toPrimitive(o),
770
- toISO;
771
- // 3. If tv is a Number and is not finite, return null.
772
- if (typeof tv === "number" && !isFinite(tv)) {
773
- return null;
774
- }
775
- // 4. Let toISO be the result of calling the [[Get]] internal method of
776
- // O with argument "toISOString".
777
- toISO = o.toISOString;
778
- // 5. If IsCallable(toISO) is false, throw a TypeError exception.
779
- if (typeof toISO !== "function") {
780
- throw new TypeError("toISOString property is not callable");
781
- }
782
- // 6. Return the result of calling the [[Call]] internal method of
783
- // toISO with O as the this value and an empty argument list.
784
- return toISO.call(o);
785
-
786
- // NOTE 1 The argument is ignored.
787
-
788
- // NOTE 2 The toJSON function is intentionally generic; it does not
789
- // require that its this value be a Date object. Therefore, it can be
790
- // transferred to other kinds of objects for use as a method. However,
791
- // it does require that any such object have a toISOString method. An
792
- // object is free to use the argument key to filter its
793
- // stringification.
794
- };
795
- }
796
-
797
- // ES5 15.9.4.2
798
- // http://es5.github.com/#x15.9.4.2
799
- // based on work shared by Daniel Friesen (dantman)
800
- // http://gist.github.com/303249
801
- var supportsExtendedYears = Date.parse('+033658-09-27T01:46:40.000Z') === 1e15;
802
- var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z'));
803
- var doesNotParseY2KNewYear = isNaN(Date.parse("2000-01-01T00:00:00.000Z"));
804
- if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) {
805
- // XXX global assignment won't work in embeddings that use
806
- // an alternate object for the context.
807
- Date = (function (NativeDate) {
808
-
809
- // Date.length === 7
810
- function Date(Y, M, D, h, m, s, ms) {
811
- var length = arguments.length;
812
- if (this instanceof NativeDate) {
813
- var date = length === 1 && String(Y) === Y ? // isString(Y)
814
- // We explicitly pass it through parse:
815
- new NativeDate(Date.parse(Y)) :
816
- // We have to manually make calls depending on argument
817
- // length here
818
- length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) :
819
- length >= 6 ? new NativeDate(Y, M, D, h, m, s) :
820
- length >= 5 ? new NativeDate(Y, M, D, h, m) :
821
- length >= 4 ? new NativeDate(Y, M, D, h) :
822
- length >= 3 ? new NativeDate(Y, M, D) :
823
- length >= 2 ? new NativeDate(Y, M) :
824
- length >= 1 ? new NativeDate(Y) :
825
- new NativeDate();
826
- // Prevent mixups with unfixed Date object
827
- date.constructor = Date;
828
- return date;
829
- }
830
- return NativeDate.apply(this, arguments);
831
- }
832
-
833
- // 15.9.1.15 Date Time String Format.
834
- var isoDateExpression = new RegExp("^" +
835
- "(\\d{4}|[\+\-]\\d{6})" + // four-digit year capture or sign +
836
- // 6-digit extended year
837
- "(?:-(\\d{2})" + // optional month capture
838
- "(?:-(\\d{2})" + // optional day capture
839
- "(?:" + // capture hours:minutes:seconds.milliseconds
840
- "T(\\d{2})" + // hours capture
841
- ":(\\d{2})" + // minutes capture
842
- "(?:" + // optional :seconds.milliseconds
843
- ":(\\d{2})" + // seconds capture
844
- "(?:(\\.\\d{1,}))?" + // milliseconds capture
845
- ")?" +
846
- "(" + // capture UTC offset component
847
- "Z|" + // UTC capture
848
- "(?:" + // offset specifier +/-hours:minutes
849
- "([-+])" + // sign capture
850
- "(\\d{2})" + // hours offset capture
851
- ":(\\d{2})" + // minutes offset capture
852
- ")" +
853
- ")?)?)?)?" +
854
- "$");
855
-
856
- var months = [
857
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
858
- ];
859
-
860
- function dayFromMonth(year, month) {
861
- var t = month > 1 ? 1 : 0;
862
- return (
863
- months[month] +
864
- Math.floor((year - 1969 + t) / 4) -
865
- Math.floor((year - 1901 + t) / 100) +
866
- Math.floor((year - 1601 + t) / 400) +
867
- 365 * (year - 1970)
868
- );
869
- }
870
-
871
- function toUTC(t) {
872
- return Number(new NativeDate(1970, 0, 1, 0, 0, 0, t));
873
- }
874
-
875
- // Copy any custom methods a 3rd party library may have added
876
- for (var key in NativeDate) {
877
- Date[key] = NativeDate[key];
878
- }
879
-
880
- // Copy "native" methods explicitly; they may be non-enumerable
881
- Date.now = NativeDate.now;
882
- Date.UTC = NativeDate.UTC;
883
- Date.prototype = NativeDate.prototype;
884
- Date.prototype.constructor = Date;
885
-
886
- // Upgrade Date.parse to handle simplified ISO 8601 strings
887
- Date.parse = function parse(string) {
888
- var match = isoDateExpression.exec(string);
889
- if (match) {
890
- // parse months, days, hours, minutes, seconds, and milliseconds
891
- // provide default values if necessary
892
- // parse the UTC offset component
893
- var year = Number(match[1]),
894
- month = Number(match[2] || 1) - 1,
895
- day = Number(match[3] || 1) - 1,
896
- hour = Number(match[4] || 0),
897
- minute = Number(match[5] || 0),
898
- second = Number(match[6] || 0),
899
- millisecond = Math.floor(Number(match[7] || 0) * 1000),
900
- // When time zone is missed, local offset should be used
901
- // (ES 5.1 bug)
902
- // see https://bugs.ecmascript.org/show_bug.cgi?id=112
903
- isLocalTime = Boolean(match[4] && !match[8]),
904
- signOffset = match[9] === "-" ? 1 : -1,
905
- hourOffset = Number(match[10] || 0),
906
- minuteOffset = Number(match[11] || 0),
907
- result;
908
- if (
909
- hour < (
910
- minute > 0 || second > 0 || millisecond > 0 ?
911
- 24 : 25
912
- ) &&
913
- minute < 60 && second < 60 && millisecond < 1000 &&
914
- month > -1 && month < 12 && hourOffset < 24 &&
915
- minuteOffset < 60 && // detect invalid offsets
916
- day > -1 &&
917
- day < (
918
- dayFromMonth(year, month + 1) -
919
- dayFromMonth(year, month)
920
- )
921
- ) {
922
- result = (
923
- (dayFromMonth(year, month) + day) * 24 +
924
- hour +
925
- hourOffset * signOffset
926
- ) * 60;
927
- result = (
928
- (result + minute + minuteOffset * signOffset) * 60 +
929
- second
930
- ) * 1000 + millisecond;
931
- if (isLocalTime) {
932
- result = toUTC(result);
933
- }
934
- if (-8.64e15 <= result && result <= 8.64e15) {
935
- return result;
936
- }
937
- }
938
- return NaN;
939
- }
940
- return NativeDate.parse.apply(this, arguments);
941
- };
942
-
943
- return Date;
944
- })(Date);
945
- }
946
-
947
- // ES5 15.9.4.4
948
- // http://es5.github.com/#x15.9.4.4
949
- if (!Date.now) {
950
- Date.now = function now() {
951
- return new Date().getTime();
952
- };
953
- }
954
-
955
-
956
- //
957
- // Number
958
- // ======
959
- //
960
-
961
- // ES5.1 15.7.4.5
962
- // http://es5.github.com/#x15.7.4.5
963
- if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || (1000000000000000128).toFixed(0) !== "1000000000000000128") {
964
- // Hide these variables and functions
965
- (function () {
966
- var base, size, data, i;
967
-
968
- base = 1e7;
969
- size = 6;
970
- data = [0, 0, 0, 0, 0, 0];
971
-
972
- function multiply(n, c) {
973
- var i = -1;
974
- while (++i < size) {
975
- c += n * data[i];
976
- data[i] = c % base;
977
- c = Math.floor(c / base);
978
- }
979
- }
980
-
981
- function divide(n) {
982
- var i = size, c = 0;
983
- while (--i >= 0) {
984
- c += data[i];
985
- data[i] = Math.floor(c / n);
986
- c = (c % n) * base;
987
- }
988
- }
989
-
990
- function numToString() {
991
- var i = size;
992
- var s = '';
993
- while (--i >= 0) {
994
- if (s !== '' || i === 0 || data[i] !== 0) {
995
- var t = String(data[i]);
996
- if (s === '') {
997
- s = t;
998
- } else {
999
- s += '0000000'.slice(0, 7 - t.length) + t;
1000
- }
1001
- }
1002
- }
1003
- return s;
1004
- }
1005
-
1006
- function pow(x, n, acc) {
1007
- return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc)));
1008
- }
1009
-
1010
- function log(x) {
1011
- var n = 0;
1012
- while (x >= 4096) {
1013
- n += 12;
1014
- x /= 4096;
1015
- }
1016
- while (x >= 2) {
1017
- n += 1;
1018
- x /= 2;
1019
- }
1020
- return n;
1021
- }
1022
-
1023
- Number.prototype.toFixed = function toFixed(fractionDigits) {
1024
- var f, x, s, m, e, z, j, k;
1025
-
1026
- // Test for NaN and round fractionDigits down
1027
- f = Number(fractionDigits);
1028
- f = f !== f ? 0 : Math.floor(f);
1029
-
1030
- if (f < 0 || f > 20) {
1031
- throw new RangeError("Number.toFixed called with invalid number of decimals");
1032
- }
1033
-
1034
- x = Number(this);
1035
-
1036
- // Test for NaN
1037
- if (x !== x) {
1038
- return "NaN";
1039
- }
1040
-
1041
- // If it is too big or small, return the string value of the number
1042
- if (x <= -1e21 || x >= 1e21) {
1043
- return String(x);
1044
- }
1045
-
1046
- s = "";
1047
-
1048
- if (x < 0) {
1049
- s = "-";
1050
- x = -x;
1051
- }
1052
-
1053
- m = "0";
1054
-
1055
- if (x > 1e-21) {
1056
- // 1e-21 < x < 1e21
1057
- // -70 < log2(x) < 70
1058
- e = log(x * pow(2, 69, 1)) - 69;
1059
- z = (e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1));
1060
- z *= 0x10000000000000; // Math.pow(2, 52);
1061
- e = 52 - e;
1062
-
1063
- // -18 < e < 122
1064
- // x = z / 2 ^ e
1065
- if (e > 0) {
1066
- multiply(0, z);
1067
- j = f;
1068
-
1069
- while (j >= 7) {
1070
- multiply(1e7, 0);
1071
- j -= 7;
1072
- }
1073
-
1074
- multiply(pow(10, j, 1), 0);
1075
- j = e - 1;
1076
-
1077
- while (j >= 23) {
1078
- divide(1 << 23);
1079
- j -= 23;
1080
- }
1081
-
1082
- divide(1 << j);
1083
- multiply(1, 1);
1084
- divide(2);
1085
- m = numToString();
1086
- } else {
1087
- multiply(0, z);
1088
- multiply(1 << (-e), 0);
1089
- m = numToString() + '0.00000000000000000000'.slice(2, 2 + f);
1090
- }
1091
- }
1092
-
1093
- if (f > 0) {
1094
- k = m.length;
1095
-
1096
- if (k <= f) {
1097
- m = s + '0.0000000000000000000'.slice(0, f - k + 2) + m;
1098
- } else {
1099
- m = s + m.slice(0, k - f) + '.' + m.slice(k - f);
1100
- }
1101
- } else {
1102
- m = s + m;
1103
- }
1104
-
1105
- return m;
1106
- };
1107
- }());
1108
- }
1109
-
1110
-
1111
- //
1112
- // String
1113
- // ======
1114
- //
1115
-
1116
- // ES5 15.5.4.14
1117
- // http://es5.github.com/#x15.5.4.14
1118
-
1119
- // [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]
1120
- // Many browsers do not split properly with regular expressions or they
1121
- // do not perform the split correctly under obscure conditions.
1122
- // See http://blog.stevenlevithan.com/archives/cross-browser-split
1123
- // I've tested in many browsers and this seems to cover the deviant ones:
1124
- // 'ab'.split(/(?:ab)*/) should be ["", ""], not [""]
1125
- // '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""]
1126
- // 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not
1127
- // [undefined, "t", undefined, "e", ...]
1128
- // ''.split(/.?/) should be [], not [""]
1129
- // '.'.split(/()()/) should be ["."], not ["", "", "."]
1130
-
1131
- var string_split = String.prototype.split;
1132
- if (
1133
- 'ab'.split(/(?:ab)*/).length !== 2 ||
1134
- '.'.split(/(.?)(.?)/).length !== 4 ||
1135
- 'tesst'.split(/(s)*/)[1] === "t" ||
1136
- 'test'.split(/(?:)/, -1).length !== 4 ||
1137
- ''.split(/.?/).length ||
1138
- '.'.split(/()()/).length > 1
1139
- ) {
1140
- (function () {
1141
- var compliantExecNpcg = /()??/.exec("")[1] === void 0; // NPCG: nonparticipating capturing group
1142
-
1143
- String.prototype.split = function (separator, limit) {
1144
- var string = this;
1145
- if (separator === void 0 && limit === 0) {
1146
- return [];
1147
- }
1148
-
1149
- // If `separator` is not a regex, use native split
1150
- if (_toString.call(separator) !== "[object RegExp]") {
1151
- return string_split.call(this, separator, limit);
1152
- }
1153
-
1154
- var output = [],
1155
- flags = (separator.ignoreCase ? "i" : "") +
1156
- (separator.multiline ? "m" : "") +
1157
- (separator.extended ? "x" : "") + // Proposed for ES6
1158
- (separator.sticky ? "y" : ""), // Firefox 3+
1159
- lastLastIndex = 0,
1160
- // Make `global` and avoid `lastIndex` issues by working with a copy
1161
- separator2, match, lastIndex, lastLength;
1162
- separator = new RegExp(separator.source, flags + "g");
1163
- string += ""; // Type-convert
1164
- if (!compliantExecNpcg) {
1165
- // Doesn't need flags gy, but they don't hurt
1166
- separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
1167
- }
1168
- /* Values for `limit`, per the spec:
1169
- * If undefined: 4294967295 // Math.pow(2, 32) - 1
1170
- * If 0, Infinity, or NaN: 0
1171
- * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
1172
- * If negative number: 4294967296 - Math.floor(Math.abs(limit))
1173
- * If other: Type-convert, then use the above rules
1174
- */
1175
- limit = limit === void 0 ?
1176
- -1 >>> 0 : // Math.pow(2, 32) - 1
1177
- ToUint32(limit);
1178
- while (match = separator.exec(string)) {
1179
- // `separator.lastIndex` is not reliable cross-browser
1180
- lastIndex = match.index + match[0].length;
1181
- if (lastIndex > lastLastIndex) {
1182
- output.push(string.slice(lastLastIndex, match.index));
1183
- // Fix browsers whose `exec` methods don't consistently return `undefined` for
1184
- // nonparticipating capturing groups
1185
- if (!compliantExecNpcg && match.length > 1) {
1186
- match[0].replace(separator2, function () {
1187
- for (var i = 1; i < arguments.length - 2; i++) {
1188
- if (arguments[i] === void 0) {
1189
- match[i] = void 0;
1190
- }
1191
- }
1192
- });
1193
- }
1194
- if (match.length > 1 && match.index < string.length) {
1195
- Array.prototype.push.apply(output, match.slice(1));
1196
- }
1197
- lastLength = match[0].length;
1198
- lastLastIndex = lastIndex;
1199
- if (output.length >= limit) {
1200
- break;
1201
- }
1202
- }
1203
- if (separator.lastIndex === match.index) {
1204
- separator.lastIndex++; // Avoid an infinite loop
1205
- }
1206
- }
1207
- if (lastLastIndex === string.length) {
1208
- if (lastLength || !separator.test("")) {
1209
- output.push("");
1210
- }
1211
- } else {
1212
- output.push(string.slice(lastLastIndex));
1213
- }
1214
- return output.length > limit ? output.slice(0, limit) : output;
1215
- };
1216
- }());
1217
-
1218
- // [bugfix, chrome]
1219
- // If separator is undefined, then the result array contains just one String,
1220
- // which is the this value (converted to a String). If limit is not undefined,
1221
- // then the output array is truncated so that it contains no more than limit
1222
- // elements.
1223
- // "0".split(undefined, 0) -> []
1224
- } else if ("0".split(void 0, 0).length) {
1225
- String.prototype.split = function split(separator, limit) {
1226
- if (separator === void 0 && limit === 0) { return []; }
1227
- return string_split.call(this, separator, limit);
1228
- };
1229
- }
1230
-
1231
- var str_replace = String.prototype.replace;
1232
- var replaceReportsGroupsCorrectly = (function () {
1233
- var groups = [];
1234
- 'x'.replace(/x(.)?/g, function (match, group) {
1235
- groups.push(group);
1236
- });
1237
- return groups.length === 1 && typeof groups[0] === 'undefined';
1238
- }());
1239
-
1240
- if (!replaceReportsGroupsCorrectly) {
1241
- String.prototype.replace = function replace(searchValue, replaceValue) {
1242
- var isFn = isFunction(replaceValue);
1243
- var hasCapturingGroups = isRegex(searchValue) && (/\)[*?]/).test(searchValue.source);
1244
- if (!isFn || !hasCapturingGroups) {
1245
- return str_replace.call(this, searchValue, replaceValue);
1246
- } else {
1247
- var wrappedReplaceValue = function (match) {
1248
- var length = arguments.length;
1249
- var originalLastIndex = searchValue.lastIndex;
1250
- searchValue.lastIndex = 0;
1251
- var args = searchValue.exec(match);
1252
- searchValue.lastIndex = originalLastIndex;
1253
- args.push(arguments[length - 2], arguments[length - 1]);
1254
- return replaceValue.apply(this, args);
1255
- };
1256
- return str_replace.call(this, searchValue, wrappedReplaceValue);
1257
- }
1258
- };
1259
- }
1260
-
1261
- // ECMA-262, 3rd B.2.3
1262
- // Not an ECMAScript standard, although ECMAScript 3rd Edition has a
1263
- // non-normative section suggesting uniform semantics and it should be
1264
- // normalized across all browsers
1265
- // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
1266
- if ("".substr && "0b".substr(-1) !== "b") {
1267
- var string_substr = String.prototype.substr;
1268
- /**
1269
- * Get the substring of a string
1270
- * @param {integer} start where to start the substring
1271
- * @param {integer} length how many characters to return
1272
- * @return {string}
1273
- */
1274
- String.prototype.substr = function substr(start, length) {
1275
- return string_substr.call(
1276
- this,
1277
- start < 0 ? ((start = this.length + start) < 0 ? 0 : start) : start,
1278
- length
1279
- );
1280
- };
1281
- }
1282
-
1283
- // ES5 15.5.4.20
1284
- // whitespace from: http://es5.github.io/#x15.5.4.20
1285
- var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
1286
- "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
1287
- "\u2029\uFEFF";
1288
- var zeroWidth = '\u200b';
1289
- if (!String.prototype.trim || ws.trim() || !zeroWidth.trim()) {
1290
- // http://blog.stevenlevithan.com/archives/faster-trim-javascript
1291
- // http://perfectionkills.com/whitespace-deviations/
1292
- ws = "[" + ws + "]";
1293
- var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
1294
- trimEndRegexp = new RegExp(ws + ws + "*$");
1295
- String.prototype.trim = function trim() {
1296
- if (this === void 0 || this === null) {
1297
- throw new TypeError("can't convert " + this + " to object");
1298
- }
1299
- return String(this)
1300
- .replace(trimBeginRegexp, "")
1301
- .replace(trimEndRegexp, "");
1302
- };
1303
- }
1304
-
1305
- // ES-5 15.1.2.2
1306
- if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) {
1307
- parseInt = (function (origParseInt) {
1308
- var hexRegex = /^0[xX]/;
1309
- return function parseIntES5(str, radix) {
1310
- str = String(str).trim();
1311
- if (!Number(radix)) {
1312
- radix = hexRegex.test(str) ? 16 : 10;
1313
- }
1314
- return origParseInt(str, radix);
1315
- };
1316
- }(parseInt));
1317
- }
1318
-
1319
- //
1320
- // Util
1321
- // ======
1322
- //
1323
-
1324
- // ES5 9.4
1325
- // http://es5.github.com/#x9.4
1326
- // http://jsperf.com/to-integer
1327
-
1328
- function toInteger(n) {
1329
- n = +n;
1330
- if (n !== n) { // isNaN
1331
- n = 0;
1332
- } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
1333
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
1334
- }
1335
- return n;
1336
- }
1337
-
1338
- function isPrimitive(input) {
1339
- var type = typeof input;
1340
- return (
1341
- input === null ||
1342
- type === "undefined" ||
1343
- type === "boolean" ||
1344
- type === "number" ||
1345
- type === "string"
1346
- );
1347
- }
1348
-
1349
- function toPrimitive(input) {
1350
- var val, valueOf, toStr;
1351
- if (isPrimitive(input)) {
1352
- return input;
1353
- }
1354
- valueOf = input.valueOf;
1355
- if (isFunction(valueOf)) {
1356
- val = valueOf.call(input);
1357
- if (isPrimitive(val)) {
1358
- return val;
1359
- }
1360
- }
1361
- toStr = input.toString;
1362
- if (isFunction(toStr)) {
1363
- val = toStr.call(input);
1364
- if (isPrimitive(val)) {
1365
- return val;
1366
- }
1367
- }
1368
- throw new TypeError();
1369
- }
1370
-
1371
- // ES5 9.9
1372
- // http://es5.github.com/#x9.9
1373
- var toObject = function (o) {
1374
- if (o == null) { // this matches both null and undefined
1375
- throw new TypeError("can't convert " + o + " to object");
1376
- }
1377
- return Object(o);
1378
- };
1379
-
1380
- var ToUint32 = function ToUint32(x) {
1381
- return x >>> 0;
1382
- };
1383
-
1384
- })();
1385
-
1386
-
1387
-
1388
-
1389
- (function($, shims){
1390
- var defineProperty = 'defineProperty';
1391
- var advancedObjectProperties = !!(Object.create && Object.defineProperties && Object.getOwnPropertyDescriptor);
1392
- //safari5 has defineProperty-interface, but it can't be used on dom-object
1393
- //only do this test in non-IE browsers, because this hurts dhtml-behavior in some IE8 versions
1394
- if (advancedObjectProperties && Object[defineProperty] && Object.prototype.__defineGetter__) {
1395
- (function(){
1396
- try {
1397
- var foo = document.createElement('foo');
1398
- Object[defineProperty](foo, 'bar', {
1399
- get: function(){
1400
- return true;
1401
- }
1402
- });
1403
- advancedObjectProperties = !!foo.bar;
1404
- }
1405
- catch (e) {
1406
- advancedObjectProperties = false;
1407
- }
1408
- foo = null;
1409
- })();
1410
- }
1411
-
1412
- Modernizr.objectAccessor = !!((advancedObjectProperties || (Object.prototype.__defineGetter__ && Object.prototype.__lookupSetter__)));
1413
- Modernizr.advancedObjectProperties = advancedObjectProperties;
1414
-
1415
- if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !Object.getOwnPropertyDescriptor || !Object.defineProperty)){
1416
- var call = Function.prototype.call;
1417
- var prototypeOfObject = Object.prototype;
1418
- var owns = call.bind(prototypeOfObject.hasOwnProperty);
1419
-
1420
- shims.objectCreate = function(proto, props, opts, no__proto__){
1421
- var o;
1422
- var f = function(){};
1423
-
1424
- f.prototype = proto;
1425
- o = new f();
1426
-
1427
- if(!no__proto__ && !('__proto__' in o) && !Modernizr.objectAccessor){
1428
- o.__proto__ = proto;
1429
- }
1430
-
1431
- if(props){
1432
- shims.defineProperties(o, props);
1433
- }
1434
-
1435
- if(opts){
1436
- o.options = $.extend(true, {}, o.options || {}, opts);
1437
- opts = o.options;
1438
- }
1439
-
1440
- if(o._create && $.isFunction(o._create)){
1441
- o._create(opts);
1442
- }
1443
- return o;
1444
- };
1445
-
1446
- shims.defineProperties = function(object, props){
1447
- for (var name in props) {
1448
- if (owns(props, name)) {
1449
- shims.defineProperty(object, name, props[name]);
1450
- }
1451
- }
1452
- return object;
1453
- };
1454
-
1455
- var descProps = ['configurable', 'enumerable', 'writable'];
1456
- shims.defineProperty = function(proto, property, descriptor){
1457
- if(typeof descriptor != "object" || descriptor === null){return proto;}
1458
-
1459
- if(owns(descriptor, "value")){
1460
- proto[property] = descriptor.value;
1461
- return proto;
1462
- }
1463
-
1464
- if(proto.__defineGetter__){
1465
- if (typeof descriptor.get == "function") {
1466
- proto.__defineGetter__(property, descriptor.get);
1467
- }
1468
- if (typeof descriptor.set == "function"){
1469
- proto.__defineSetter__(property, descriptor.set);
1470
- }
1471
- }
1472
- return proto;
1473
- };
1474
-
1475
- shims.getPrototypeOf = function (object) {
1476
- return Object.getPrototypeOf && Object.getPrototypeOf(object) || object.__proto__ || object.constructor && object.constructor.prototype;
1477
- };
1478
-
1479
- //based on http://www.refactory.org/s/object_getownpropertydescriptor/view/latest
1480
- shims.getOwnPropertyDescriptor = function(obj, prop){
1481
- if (typeof obj !== "object" && typeof obj !== "function" || obj === null){
1482
- throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object");
1483
- }
1484
- var descriptor;
1485
- if(Object.defineProperty && Object.getOwnPropertyDescriptor){
1486
- try{
1487
- descriptor = Object.getOwnPropertyDescriptor(obj, prop);
1488
- return descriptor;
1489
- } catch(e){}
1490
- }
1491
- descriptor = {
1492
- configurable: true,
1493
- enumerable: true,
1494
- writable: true,
1495
- value: undefined
1496
- };
1497
- var getter = obj.__lookupGetter__ && obj.__lookupGetter__(prop),
1498
- setter = obj.__lookupSetter__ && obj.__lookupSetter__(prop)
1499
- ;
1500
-
1501
- if (!getter && !setter) { // not an accessor so return prop
1502
- if(!owns(obj, prop)){
1503
- return;
1504
- }
1505
- descriptor.value = obj[prop];
1506
- return descriptor;
1507
- }
1508
-
1509
- // there is an accessor, remove descriptor.writable; populate descriptor.get and descriptor.set
1510
- delete descriptor.writable;
1511
- delete descriptor.value;
1512
- descriptor.get = descriptor.set = undefined;
1513
-
1514
- if(getter){
1515
- descriptor.get = getter;
1516
- }
1517
-
1518
- if(setter){
1519
- descriptor.set = setter;
1520
- }
1521
-
1522
- return descriptor;
1523
- };
1524
-
1525
- }
1526
- webshims.isReady('es5', true);
1527
- })(webshims.$, webshims);
1528
-
1529
-
1530
- ;
1531
- //this might was already extended by ES5 shim feature
1532
- (function($){
1533
- "use strict";
1534
- var webshims = window.webshims;
1535
- if(webshims.defineProperties){return;}
1536
- var defineProperty = 'defineProperty';
1537
- var has = Object.prototype.hasOwnProperty;
1538
- var descProps = ['configurable', 'enumerable', 'writable'];
1539
- var extendUndefined = function(prop){
1540
- for(var i = 0; i < 3; i++){
1541
- if(prop[descProps[i]] === undefined && (descProps[i] !== 'writable' || prop.value !== undefined)){
1542
- prop[descProps[i]] = true;
1543
- }
1544
- }
1545
- };
1546
-
1547
- var extendProps = function(props){
1548
- if(props){
1549
- for(var i in props){
1550
- if(has.call(props, i)){
1551
- extendUndefined(props[i]);
1552
- }
1553
- }
1554
- }
1555
- };
1556
-
1557
- if(Object.create){
1558
- webshims.objectCreate = function(proto, props, opts){
1559
- extendProps(props);
1560
- var o = Object.create(proto, props);
1561
- if(opts){
1562
- o.options = $.extend(true, {}, o.options || {}, opts);
1563
- opts = o.options;
1564
- }
1565
- if(o._create && $.isFunction(o._create)){
1566
- o._create(opts);
1567
- }
1568
- return o;
1569
- };
1570
- }
1571
-
1572
- if(Object[defineProperty]){
1573
- webshims[defineProperty] = function(obj, prop, desc){
1574
- extendUndefined(desc);
1575
- return Object[defineProperty](obj, prop, desc);
1576
- };
1577
- }
1578
- if(Object.defineProperties){
1579
- webshims.defineProperties = function(obj, props){
1580
- extendProps(props);
1581
- return Object.defineProperties(obj, props);
1582
- };
1583
- }
1584
- webshims.getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1585
-
1586
- webshims.getPrototypeOf = Object.getPrototypeOf;
1587
- })(window.webshims.$);
1588
- //DOM-Extension helper
1589
- webshims.register('dom-extend', function($, webshims, window, document, undefined){
1590
- "use strict";
1591
- var supportHrefNormalized = !('hrefNormalized' in $.support) || $.support.hrefNormalized;
1592
- var supportGetSetAttribute = !('getSetAttribute' in $.support) || $.support.getSetAttribute;
1593
- var has = Object.prototype.hasOwnProperty;
1594
- webshims.assumeARIA = supportGetSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing;
1595
-
1596
- if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
1597
- 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");
1598
- }
1599
-
1600
- if('debug' in webshims){
1601
- webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag');
1602
- }
1603
-
1604
- if (!webshims.cfg.no$Switch) {
1605
- var switch$ = function(){
1606
- if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
1607
- webshims.error("jQuery was included more than once. Make sure to include it only once or try the $.noConflict(extreme) feature! Webshims and other Plugins might not work properly. Or set webshims.cfg.no$Switch to 'true'.");
1608
- if (window.$) {
1609
- window.$ = webshims.$;
1610
- }
1611
- window.jQuery = webshims.$;
1612
- }
1613
- if(webshims.M != Modernizr){
1614
- webshims.error("Modernizr was included more than once. Make sure to include it only once! Webshims and other scripts might not work properly.");
1615
- for(var i in Modernizr){
1616
- if(!(i in webshims.M)){
1617
- webshims.M[i] = Modernizr[i];
1618
- }
1619
- }
1620
- Modernizr = webshims.M;
1621
- }
1622
- };
1623
- switch$();
1624
- setTimeout(switch$, 90);
1625
- webshims.ready('DOM', switch$);
1626
- $(switch$);
1627
- webshims.ready('WINDOWLOAD', switch$);
1628
-
1629
- }
1630
-
1631
- //shortcus
1632
- var modules = webshims.modules;
1633
- var listReg = /\s*,\s*/;
1634
-
1635
- //proxying attribute
1636
- var olds = {};
1637
- var havePolyfill = {};
1638
- var hasPolyfillMethod = {};
1639
- var extendedProps = {};
1640
- var extendQ = {};
1641
- var modifyProps = {};
1642
-
1643
- var oldVal = $.fn.val;
1644
- var singleVal = function(elem, name, val, pass, _argless){
1645
- return (_argless) ? oldVal.call($(elem)) : oldVal.call($(elem), val);
1646
- };
1647
-
1648
- //jquery mobile and jquery ui
1649
- if(!$.widget){
1650
- (function(){
1651
- var _cleanData = $.cleanData;
1652
- $.cleanData = function( elems ) {
1653
- if(!$.widget){
1654
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
1655
- try {
1656
- $( elem ).triggerHandler( "remove" );
1657
- // http://bugs.jquery.com/ticket/8235
1658
- } catch( e ) {}
1659
- }
1660
- }
1661
- _cleanData( elems );
1662
- };
1663
- })();
1664
- }
1665
-
1666
-
1667
- $.fn.val = function(val){
1668
- var elem = this[0];
1669
- if(arguments.length && val == null){
1670
- val = '';
1671
- }
1672
- if(!arguments.length){
1673
- if(!elem || elem.nodeType !== 1){return oldVal.call(this);}
1674
- return $.prop(elem, 'value', val, 'val', true);
1675
- }
1676
- if($.isArray(val)){
1677
- return oldVal.apply(this, arguments);
1678
- }
1679
- var isFunction = $.isFunction(val);
1680
- return this.each(function(i){
1681
- elem = this;
1682
- if(elem.nodeType === 1){
1683
- if(isFunction){
1684
- var genVal = val.call( elem, i, $.prop(elem, 'value', undefined, 'val', true));
1685
- if(genVal == null){
1686
- genVal = '';
1687
- }
1688
- $.prop(elem, 'value', genVal, 'val') ;
1689
- } else {
1690
- $.prop(elem, 'value', val, 'val');
1691
- }
1692
- }
1693
- });
1694
- };
1695
- $.fn.onTrigger = function(evt, fn){
1696
- return this.on(evt, fn).each(fn);
1697
- };
1698
-
1699
- $.fn.onWSOff = function(evt, fn, trigger, evtDel){
1700
- if(!evtDel){
1701
- evtDel = document;
1702
- }
1703
- $(evtDel)[trigger ? 'onTrigger' : 'on'](evt, fn);
1704
- this.on('remove', function(e){
1705
- if(!e.originalEvent){
1706
- $(evtDel).off(evt, fn);
1707
- }
1708
- });
1709
- return this;
1710
- };
1711
- var idCount = 0;
1712
- var dataID = '_webshims'+ (Math.round(Math.random() * 1000));
1713
- var elementData = function(elem, key, val){
1714
- elem = elem.jquery ? elem[0] : elem;
1715
- if(!elem){return val || {};}
1716
- var data = $.data(elem, dataID);
1717
- if(val !== undefined){
1718
- if(!data){
1719
- data = $.data(elem, dataID, {});
1720
- }
1721
- if(key){
1722
- data[key] = val;
1723
- }
1724
- }
1725
-
1726
- return key ? data && data[key] : data;
1727
- };
1728
-
1729
-
1730
- [{name: 'getNativeElement', prop: 'nativeElement'}, {name: 'getShadowElement', prop: 'shadowElement'}, {name: 'getShadowFocusElement', prop: 'shadowFocusElement'}].forEach(function(data){
1731
- $.fn[data.name] = function(){
1732
- var elems = [];
1733
- this.each(function(){
1734
- var shadowData = elementData(this, 'shadowData');
1735
- var elem = shadowData && shadowData[data.prop] || this;
1736
- if($.inArray(elem, elems) == -1){
1737
- elems.push(elem);
1738
- }
1739
- });
1740
- return this.pushStack(elems);
1741
- };
1742
- });
1743
-
1744
- function clone(elem, dataAndEvents, uniqueIds){
1745
- var cloned = $.clone( elem, dataAndEvents, false );
1746
- $(cloned.querySelectorAll('.'+webshims.shadowClass)).detach();
1747
- if(uniqueIds){
1748
- idCount++;
1749
- $(cloned.querySelectorAll('[id]')).prop('id', function(i, id){
1750
- return id +idCount;
1751
- });
1752
- } else {
1753
- $(cloned.querySelectorAll('audio[id^="ID-"], video[id^="ID-"], label[id^="ID-"]')).removeAttr('id');
1754
- }
1755
- return cloned;
1756
- }
1757
-
1758
- $.fn.clonePolyfill = function(dataAndEvents, uniqueIds){
1759
- dataAndEvents = dataAndEvents || false;
1760
- return this
1761
- .map(function() {
1762
- var cloned = clone( this, dataAndEvents, uniqueIds );
1763
- setTimeout(function(){
1764
- if($.contains(document.body, cloned)){
1765
- $(cloned).updatePolyfill();
1766
- }
1767
- });
1768
- return cloned;
1769
- })
1770
- ;
1771
- };
1772
-
1773
- //add support for $('video').trigger('play') in case extendNative is set to false
1774
- if(!webshims.cfg.extendNative && !webshims.cfg.noTriggerOverride){
1775
- (function(oldTrigger){
1776
- $.event.trigger = function(event, data, elem, onlyHandlers){
1777
-
1778
- if(!hasPolyfillMethod[event] || onlyHandlers || !elem || elem.nodeType !== 1){
1779
- return oldTrigger.apply(this, arguments);
1780
- }
1781
- var ret, isOrig, origName;
1782
- var origFn = elem[event];
1783
- var polyfilledFn = $.prop(elem, event);
1784
- var changeFn = polyfilledFn && origFn != polyfilledFn;
1785
- if(changeFn){
1786
- origName = '__ws'+event;
1787
- isOrig = (event in elem) && has.call(elem, event);
1788
- elem[event] = polyfilledFn;
1789
- elem[origName] = origFn;
1790
- }
1791
-
1792
- ret = oldTrigger.apply(this, arguments);
1793
- if (changeFn) {
1794
- if(isOrig){
1795
- elem[event] = origFn;
1796
- } else {
1797
- delete elem[event];
1798
- }
1799
- delete elem[origName];
1800
- }
1801
-
1802
- return ret;
1803
- };
1804
- })($.event.trigger);
1805
- }
1806
-
1807
- ['removeAttr', 'prop', 'attr'].forEach(function(type){
1808
- olds[type] = $[type];
1809
- $[type] = function(elem, name, value, pass, _argless){
1810
- var isVal = (pass == 'val');
1811
- var oldMethod = !isVal ? olds[type] : singleVal;
1812
- if( !elem || !havePolyfill[name] || elem.nodeType !== 1 || (!isVal && pass && type == 'attr' && $.attrFn[name]) ){
1813
- return oldMethod(elem, name, value, pass, _argless);
1814
- }
1815
-
1816
- var nodeName = (elem.nodeName || '').toLowerCase();
1817
- var desc = extendedProps[nodeName];
1818
- var curType = (type == 'attr' && (value === false || value === null)) ? 'removeAttr' : type;
1819
- var propMethod;
1820
- var oldValMethod;
1821
- var ret;
1822
-
1823
-
1824
- if(!desc){
1825
- desc = extendedProps['*'];
1826
- }
1827
- if(desc){
1828
- desc = desc[name];
1829
- }
1830
-
1831
- if(desc){
1832
- propMethod = desc[curType];
1833
- }
1834
-
1835
- if(propMethod){
1836
- if(name == 'value'){
1837
- oldValMethod = propMethod.isVal;
1838
- propMethod.isVal = isVal;
1839
- }
1840
- if(curType === 'removeAttr'){
1841
- return propMethod.value.call(elem);
1842
- } else if(value === undefined){
1843
- return (propMethod.get) ?
1844
- propMethod.get.call(elem) :
1845
- propMethod.value
1846
- ;
1847
- } else if(propMethod.set) {
1848
- if(type == 'attr' && value === true){
1849
- value = name;
1850
- }
1851
-
1852
- ret = propMethod.set.call(elem, value);
1853
- }
1854
- if(name == 'value'){
1855
- propMethod.isVal = oldValMethod;
1856
- }
1857
- } else {
1858
- ret = oldMethod(elem, name, value, pass, _argless);
1859
- }
1860
- if((value !== undefined || curType === 'removeAttr') && modifyProps[nodeName] && modifyProps[nodeName][name]){
1861
-
1862
- var boolValue;
1863
- if(curType == 'removeAttr'){
1864
- boolValue = false;
1865
- } else if(curType == 'prop'){
1866
- boolValue = !!(value);
1867
- } else {
1868
- boolValue = true;
1869
- }
1870
-
1871
- modifyProps[nodeName][name].forEach(function(fn){
1872
- if(!fn.only || (fn.only = 'prop' && type == 'prop') || (fn.only == 'attr' && type != 'prop')){
1873
- fn.call(elem, value, boolValue, (isVal) ? 'val' : curType, type);
1874
- }
1875
- });
1876
- }
1877
- return ret;
1878
- };
1879
-
1880
- extendQ[type] = function(nodeName, prop, desc){
1881
-
1882
- if(!extendedProps[nodeName]){
1883
- extendedProps[nodeName] = {};
1884
- }
1885
- if(!extendedProps[nodeName][prop]){
1886
- extendedProps[nodeName][prop] = {};
1887
- }
1888
- var oldDesc = extendedProps[nodeName][prop][type];
1889
- var getSup = function(propType, descriptor, oDesc){
1890
- var origProp;
1891
- if(descriptor && descriptor[propType]){
1892
- return descriptor[propType];
1893
- }
1894
- if(oDesc && oDesc[propType]){
1895
- return oDesc[propType];
1896
- }
1897
- if(type == 'prop' && prop == 'value'){
1898
- return function(value){
1899
- var elem = this;
1900
- return (desc.isVal) ?
1901
- singleVal(elem, prop, value, false, (arguments.length === 0)) :
1902
- olds[type](elem, prop, value)
1903
- ;
1904
- };
1905
- }
1906
- if(type == 'prop' && propType == 'value' && desc.value.apply){
1907
- origProp = '__ws'+prop;
1908
- hasPolyfillMethod[prop] = true;
1909
- return function(value){
1910
- var sup = this[origProp] || olds[type](this, prop);
1911
- if(sup && sup.apply){
1912
- sup = sup.apply(this, arguments);
1913
- }
1914
- return sup;
1915
- };
1916
- }
1917
- return function(value){
1918
- return olds[type](this, prop, value);
1919
- };
1920
- };
1921
- extendedProps[nodeName][prop][type] = desc;
1922
- if(desc.value === undefined){
1923
- if(!desc.set){
1924
- desc.set = desc.writeable ?
1925
- getSup('set', desc, oldDesc) :
1926
- (webshims.cfg.useStrict && prop == 'prop') ?
1927
- function(){throw(prop +' is readonly on '+ nodeName);} :
1928
- function(){webshims.info(prop +' is readonly on '+ nodeName);}
1929
- ;
1930
- }
1931
- if(!desc.get){
1932
- desc.get = getSup('get', desc, oldDesc);
1933
- }
1934
-
1935
- }
1936
-
1937
- ['value', 'get', 'set'].forEach(function(descProp){
1938
- if(desc[descProp]){
1939
- desc['_sup'+descProp] = getSup(descProp, oldDesc);
1940
- }
1941
- });
1942
- };
1943
-
1944
- });
1945
-
1946
- var extendNativeValue = (function(){
1947
- var UNKNOWN = webshims.getPrototypeOf(document.createElement('foobar'));
1948
-
1949
- //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
1950
- var isExtendNativeSave = Modernizr.advancedObjectProperties && Modernizr.objectAccessor;
1951
- return function(nodeName, prop, desc){
1952
- var elem , elemProto;
1953
- if( isExtendNativeSave && (elem = document.createElement(nodeName)) && (elemProto = webshims.getPrototypeOf(elem)) && UNKNOWN !== elemProto && ( !elem[prop] || !has.call(elem, prop) ) ){
1954
- var sup = elem[prop];
1955
- desc._supvalue = function(){
1956
- if(sup && sup.apply){
1957
- return sup.apply(this, arguments);
1958
- }
1959
- return sup;
1960
- };
1961
- elemProto[prop] = desc.value;
1962
- } else {
1963
- desc._supvalue = function(){
1964
- var data = elementData(this, 'propValue');
1965
- if(data && data[prop] && data[prop].apply){
1966
- return data[prop].apply(this, arguments);
1967
- }
1968
- return data && data[prop];
1969
- };
1970
- initProp.extendValue(nodeName, prop, desc.value);
1971
- }
1972
- desc.value._supvalue = desc._supvalue;
1973
- };
1974
- })();
1975
-
1976
- var initProp = (function(){
1977
-
1978
- var initProps = {};
1979
-
1980
- webshims.addReady(function(context, contextElem){
1981
- var nodeNameCache = {};
1982
- var getElementsByName = function(name){
1983
- if(!nodeNameCache[name]){
1984
- nodeNameCache[name] = $(context.getElementsByTagName(name));
1985
- if(contextElem[0] && $.nodeName(contextElem[0], name)){
1986
- nodeNameCache[name] = nodeNameCache[name].add(contextElem);
1987
- }
1988
- }
1989
- };
1990
-
1991
-
1992
- $.each(initProps, function(name, fns){
1993
- getElementsByName(name);
1994
- if(!fns || !fns.forEach){
1995
- webshims.warn('Error: with '+ name +'-property. methods: '+ fns);
1996
- return;
1997
- }
1998
- fns.forEach(function(fn){
1999
- nodeNameCache[name].each(fn);
2000
- });
2001
- });
2002
- nodeNameCache = null;
2003
- });
2004
-
2005
- var tempCache;
2006
- var emptyQ = $([]);
2007
- var createNodeNameInit = function(nodeName, fn){
2008
- if(!initProps[nodeName]){
2009
- initProps[nodeName] = [fn];
2010
- } else {
2011
- initProps[nodeName].push(fn);
2012
- }
2013
- if($.isDOMReady){
2014
- (tempCache || $( document.getElementsByTagName(nodeName) )).each(fn);
2015
- }
2016
- };
2017
-
2018
- var elementExtends = {};
2019
- return {
2020
- createTmpCache: function(nodeName){
2021
- if($.isDOMReady){
2022
- tempCache = tempCache || $( document.getElementsByTagName(nodeName) );
2023
- }
2024
- return tempCache || emptyQ;
2025
- },
2026
- flushTmpCache: function(){
2027
- tempCache = null;
2028
- },
2029
- content: function(nodeName, prop){
2030
- createNodeNameInit(nodeName, function(){
2031
- var val = $.attr(this, prop);
2032
- if(val != null){
2033
- $.attr(this, prop, val);
2034
- }
2035
- });
2036
- },
2037
- createElement: function(nodeName, fn){
2038
- createNodeNameInit(nodeName, fn);
2039
- },
2040
- extendValue: function(nodeName, prop, value){
2041
- createNodeNameInit(nodeName, function(){
2042
- $(this).each(function(){
2043
- var data = elementData(this, 'propValue', {});
2044
- data[prop] = this[prop];
2045
- this[prop] = value;
2046
- });
2047
- });
2048
- }
2049
- };
2050
- })();
2051
-
2052
- var createPropDefault = function(descs, removeType){
2053
- if(descs.defaultValue === undefined){
2054
- descs.defaultValue = '';
2055
- }
2056
- if(!descs.removeAttr){
2057
- descs.removeAttr = {
2058
- value: function(){
2059
- descs[removeType || 'prop'].set.call(this, descs.defaultValue);
2060
- descs.removeAttr._supvalue.call(this);
2061
- }
2062
- };
2063
- }
2064
- if(!descs.attr){
2065
- descs.attr = {};
2066
- }
2067
- };
2068
-
2069
- $.extend(webshims, {
2070
- getID: (function(){
2071
- var ID = new Date().getTime();
2072
- return function(elem){
2073
- elem = $(elem);
2074
- var id = elem.prop('id');
2075
- if(!id){
2076
- ID++;
2077
- id = 'ID-'+ ID;
2078
- elem.eq(0).prop('id', id);
2079
- }
2080
- return id;
2081
- };
2082
- })(),
2083
- shadowClass: 'wsshadow-'+(Date.now()),
2084
- implement: function(elem, type){
2085
- var data = elementData(elem, 'implemented') || elementData(elem, 'implemented', {});
2086
- if(data[type]){
2087
- webshims.warn(type +' already implemented for element #'+elem.id);
2088
- return false;
2089
- }
2090
- data[type] = true;
2091
- return true;
2092
- },
2093
- extendUNDEFProp: function(obj, props){
2094
- $.each(props, function(name, prop){
2095
- if( !(name in obj) ){
2096
- obj[name] = prop;
2097
- }
2098
- });
2099
- },
2100
- getOptions: (function(){
2101
- var normalName = /\-([a-z])/g;
2102
- var regs = {};
2103
- var nameRegs = {};
2104
- var regFn = function(f, upper){
2105
- return upper.toLowerCase();
2106
- };
2107
- var nameFn = function(f, dashed){
2108
- return dashed.toUpperCase();
2109
- };
2110
- return function(elem, name, bases, stringAllowed){
2111
- if(nameRegs[name]){
2112
- name = nameRegs[name];
2113
- } else {
2114
- nameRegs[name] = name.replace(normalName, nameFn);
2115
- name = nameRegs[name];
2116
- }
2117
- var data = elementData(elem, 'cfg'+name);
2118
- var dataName;
2119
- var cfg = {};
2120
-
2121
- if(data){
2122
- return data;
2123
- }
2124
- data = $(elem).data();
2125
- if(data && typeof data[name] == 'string'){
2126
- if(stringAllowed){
2127
- return elementData(elem, 'cfg'+name, data[name]);
2128
- }
2129
- webshims.error('data-'+ name +' attribute has to be a valid JSON, was: '+ data[name]);
2130
- }
2131
- if(!bases){
2132
- bases = [true, {}];
2133
- } else if(!Array.isArray(bases)){
2134
- bases = [true, {}, bases];
2135
- } else {
2136
- bases.unshift(true, {});
2137
- }
2138
-
2139
- if(data && typeof data[name] == 'object'){
2140
- bases.push(data[name]);
2141
- }
2142
-
2143
- if(!regs[name]){
2144
- regs[name] = new RegExp('^'+ name +'([A-Z])');
2145
- }
2146
-
2147
- for(dataName in data){
2148
- if(regs[name].test(dataName)){
2149
- cfg[dataName.replace(regs[name], regFn)] = data[dataName];
2150
- }
2151
- }
2152
- bases.push(cfg);
2153
- return elementData(elem, 'cfg'+name, $.extend.apply($, bases));
2154
- };
2155
- })(),
2156
- //http://www.w3.org/TR/html5/common-dom-interfaces.html#reflect
2157
- createPropDefault: createPropDefault,
2158
- data: elementData,
2159
- moveToFirstEvent: function(elem, eventType, bindType){
2160
- var events = ($._data(elem, 'events') || {})[eventType];
2161
- var fn;
2162
-
2163
- if(events && events.length > 1){
2164
- fn = events.pop();
2165
- if(!bindType){
2166
- bindType = 'bind';
2167
- }
2168
- if(bindType == 'bind' && events.delegateCount){
2169
- events.splice( events.delegateCount, 0, fn);
2170
- } else {
2171
- events.unshift( fn );
2172
- }
2173
-
2174
-
2175
- }
2176
- elem = null;
2177
- },
2178
- addShadowDom: (function(){
2179
- var resizeTimer;
2180
- var lastHeight;
2181
- var lastWidth;
2182
- var $window = $(window);
2183
- var docObserve = {
2184
- init: false,
2185
- runs: 0,
2186
- test: function(){
2187
- var height = docObserve.getHeight();
2188
- var width = docObserve.getWidth();
2189
-
2190
- if(height != docObserve.height || width != docObserve.width){
2191
- docObserve.height = height;
2192
- docObserve.width = width;
2193
- docObserve.handler({type: 'docresize'});
2194
- docObserve.runs++;
2195
- if(docObserve.runs < 9){
2196
- setTimeout(docObserve.test, 90);
2197
- }
2198
- } else {
2199
- docObserve.runs = 0;
2200
- }
2201
- },
2202
- handler: (function(){
2203
- var trigger = function(){
2204
- $(document).triggerHandler('updateshadowdom');
2205
- };
2206
- return function(e){
2207
- clearTimeout(resizeTimer);
2208
- resizeTimer = setTimeout(function(){
2209
- if(e.type == 'resize'){
2210
- var width = $window.width();
2211
- var height = $window.width();
2212
-
2213
- if(height == lastHeight && width == lastWidth){
2214
- return;
2215
- }
2216
- lastHeight = height;
2217
- lastWidth = width;
2218
-
2219
- docObserve.height = docObserve.getHeight();
2220
- docObserve.width = docObserve.getWidth();
2221
- }
2222
-
2223
- if(window.requestAnimationFrame){
2224
- requestAnimationFrame(trigger);
2225
- } else {
2226
- setTimeout(trigger, 0);
2227
- }
2228
-
2229
- }, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
2230
- };
2231
- })(),
2232
- _create: function(){
2233
- $.each({ Height: "getHeight", Width: "getWidth" }, function(name, type){
2234
- var body = document.body;
2235
- var doc = document.documentElement;
2236
- docObserve[type] = function (){
2237
- return Math.max(
2238
- body[ "scroll" + name ], doc[ "scroll" + name ],
2239
- body[ "offset" + name ], doc[ "offset" + name ],
2240
- doc[ "client" + name ]
2241
- );
2242
- };
2243
- });
2244
- },
2245
- start: function(){
2246
- if(!this.init && document.body){
2247
- this.init = true;
2248
- this._create();
2249
- this.height = docObserve.getHeight();
2250
- this.width = docObserve.getWidth();
2251
- setInterval(this.test, 999);
2252
- $(this.test);
2253
- if($.support.boxSizing == null){
2254
- $(function(){
2255
- if($.support.boxSizing){
2256
- docObserve.handler({type: 'boxsizing'});
2257
- }
2258
- });
2259
- }
2260
- webshims.ready('WINDOWLOAD', this.test);
2261
- $(document).on('updatelayout.webshim pageinit popupafteropen panelbeforeopen tabsactivate collapsibleexpand shown.bs.modal shown.bs.collapse slid.bs.carousel', this.handler);
2262
- $(window).on('resize', this.handler);
2263
- }
2264
- }
2265
- };
2266
-
2267
-
2268
- webshims.docObserve = function(){
2269
- webshims.ready('DOM', function(){
2270
- docObserve.start();
2271
-
2272
- });
2273
- };
2274
- return function(nativeElem, shadowElem, opts){
2275
- if(nativeElem && shadowElem){
2276
- opts = opts || {};
2277
- if(nativeElem.jquery){
2278
- nativeElem = nativeElem[0];
2279
- }
2280
- if(shadowElem.jquery){
2281
- shadowElem = shadowElem[0];
2282
- }
2283
- var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
2284
- var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
2285
- var shadowFocusElementData = {};
2286
- if(!opts.shadowFocusElement){
2287
- opts.shadowFocusElement = shadowElem;
2288
- } else if(opts.shadowFocusElement){
2289
- if(opts.shadowFocusElement.jquery){
2290
- opts.shadowFocusElement = opts.shadowFocusElement[0];
2291
- }
2292
- shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
2293
- }
2294
-
2295
- $(nativeElem).on('remove', function(e){
2296
- if (!e.originalEvent) {
2297
- setTimeout(function(){
2298
- $(shadowElem).remove();
2299
- }, 4);
2300
- }
2301
- });
2302
-
2303
- nativeData.hasShadow = shadowElem;
2304
- shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
2305
- shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
2306
- nativeElement: nativeElem,
2307
- shadowElement: shadowElem,
2308
- shadowFocusElement: opts.shadowFocusElement
2309
- };
2310
- if(opts.shadowChilds){
2311
- opts.shadowChilds.each(function(){
2312
- elementData(this, 'shadowData', shadowData.shadowData);
2313
- });
2314
- }
2315
-
2316
- if(opts.data){
2317
- shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
2318
- }
2319
- opts = null;
2320
- }
2321
- webshims.docObserve();
2322
- };
2323
- })(),
2324
- propTypes: {
2325
- standard: function(descs, name){
2326
- createPropDefault(descs);
2327
- if(descs.prop){return;}
2328
- descs.prop = {
2329
- set: function(val){
2330
- descs.attr.set.call(this, ''+val);
2331
- },
2332
- get: function(){
2333
- return descs.attr.get.call(this) || descs.defaultValue;
2334
- }
2335
- };
2336
-
2337
- },
2338
- "boolean": function(descs, name){
2339
-
2340
- createPropDefault(descs);
2341
- if(descs.prop){return;}
2342
- descs.prop = {
2343
- set: function(val){
2344
- if(val){
2345
- descs.attr.set.call(this, "");
2346
- } else {
2347
- descs.removeAttr.value.call(this);
2348
- }
2349
- },
2350
- get: function(){
2351
- return descs.attr.get.call(this) != null;
2352
- }
2353
- };
2354
- },
2355
- "src": (function(){
2356
- var anchor = document.createElement('a');
2357
- anchor.style.display = "none";
2358
- return function(descs, name){
2359
-
2360
- createPropDefault(descs);
2361
- if(descs.prop){return;}
2362
- descs.prop = {
2363
- set: function(val){
2364
- descs.attr.set.call(this, val);
2365
- },
2366
- get: function(){
2367
- var href = this.getAttribute(name);
2368
- var ret;
2369
- if(href == null){return '';}
2370
-
2371
- anchor.setAttribute('href', href+'' );
2372
-
2373
- if(!supportHrefNormalized){
2374
- try {
2375
- $(anchor).insertAfter(this);
2376
- ret = anchor.getAttribute('href', 4);
2377
- } catch(er){
2378
- ret = anchor.getAttribute('href', 4);
2379
- }
2380
- $(anchor).detach();
2381
- }
2382
- return ret || anchor.href;
2383
- }
2384
- };
2385
- };
2386
- })(),
2387
- enumarated: function(descs, name){
2388
-
2389
- createPropDefault(descs);
2390
- if(descs.prop){return;}
2391
- descs.prop = {
2392
- set: function(val){
2393
- descs.attr.set.call(this, val);
2394
- },
2395
- get: function(){
2396
- var val = (descs.attr.get.call(this) || '').toLowerCase();
2397
- if(!val || descs.limitedTo.indexOf(val) == -1){
2398
- val = descs.defaultValue;
2399
- }
2400
- return val;
2401
- }
2402
- };
2403
- }
2404
-
2405
- // ,unsignedLong: $.noop
2406
- // ,"doubble": $.noop
2407
- // ,"long": $.noop
2408
- // ,tokenlist: $.noop
2409
- // ,settableTokenlist: $.noop
2410
- },
2411
- reflectProperties: function(nodeNames, props){
2412
- if(typeof props == 'string'){
2413
- props = props.split(listReg);
2414
- }
2415
- props.forEach(function(prop){
2416
- webshims.defineNodeNamesProperty(nodeNames, prop, {
2417
- prop: {
2418
- set: function(val){
2419
- $.attr(this, prop, val);
2420
- },
2421
- get: function(){
2422
- return $.attr(this, prop) || '';
2423
- }
2424
- }
2425
- });
2426
- });
2427
- },
2428
- defineNodeNameProperty: function(nodeName, prop, descs){
2429
- havePolyfill[prop] = true;
2430
-
2431
- if(descs.reflect){
2432
- if(descs.propType && !webshims.propTypes[descs.propType]){
2433
- webshims.error('could not finde propType '+ descs.propType);
2434
- } else {
2435
- webshims.propTypes[descs.propType || 'standard'](descs, prop);
2436
- }
2437
-
2438
- }
2439
-
2440
- ['prop', 'attr', 'removeAttr'].forEach(function(type){
2441
- var desc = descs[type];
2442
- if(desc){
2443
- if(type === 'prop'){
2444
- desc = $.extend({writeable: true}, desc);
2445
- } else {
2446
- desc = $.extend({}, desc, {writeable: true});
2447
- }
2448
-
2449
- extendQ[type](nodeName, prop, desc);
2450
- if(nodeName != '*' && webshims.cfg.extendNative && type == 'prop' && desc.value && $.isFunction(desc.value)){
2451
- extendNativeValue(nodeName, prop, desc);
2452
- }
2453
- descs[type] = desc;
2454
- }
2455
- });
2456
- if(descs.initAttr){
2457
- initProp.content(nodeName, prop);
2458
- }
2459
- return descs;
2460
- },
2461
-
2462
- defineNodeNameProperties: function(name, descs, propType, _noTmpCache){
2463
- var olddesc;
2464
- for(var prop in descs){
2465
- if(!_noTmpCache && descs[prop].initAttr){
2466
- initProp.createTmpCache(name);
2467
- }
2468
- if(propType){
2469
- if(descs[prop][propType]){
2470
- //webshims.log('override: '+ name +'['+prop +'] for '+ propType);
2471
- } else {
2472
- descs[prop][propType] = {};
2473
- ['value', 'set', 'get'].forEach(function(copyProp){
2474
- if(copyProp in descs[prop]){
2475
- descs[prop][propType][copyProp] = descs[prop][copyProp];
2476
- delete descs[prop][copyProp];
2477
- }
2478
- });
2479
- }
2480
- }
2481
- descs[prop] = webshims.defineNodeNameProperty(name, prop, descs[prop]);
2482
- }
2483
- if(!_noTmpCache){
2484
- initProp.flushTmpCache();
2485
- }
2486
- return descs;
2487
- },
2488
-
2489
- createElement: function(nodeName, create, descs){
2490
- var ret;
2491
- if($.isFunction(create)){
2492
- create = {
2493
- after: create
2494
- };
2495
- }
2496
- initProp.createTmpCache(nodeName);
2497
- if(create.before){
2498
- initProp.createElement(nodeName, create.before);
2499
- }
2500
- if(descs){
2501
- ret = webshims.defineNodeNameProperties(nodeName, descs, false, true);
2502
- }
2503
- if(create.after){
2504
- initProp.createElement(nodeName, create.after);
2505
- }
2506
- initProp.flushTmpCache();
2507
- return ret;
2508
- },
2509
- onNodeNamesPropertyModify: function(nodeNames, props, desc, only){
2510
- if(typeof nodeNames == 'string'){
2511
- nodeNames = nodeNames.split(listReg);
2512
- }
2513
- if($.isFunction(desc)){
2514
- desc = {set: desc};
2515
- }
2516
-
2517
- nodeNames.forEach(function(name){
2518
- if(!modifyProps[name]){
2519
- modifyProps[name] = {};
2520
- }
2521
- if(typeof props == 'string'){
2522
- props = props.split(listReg);
2523
- }
2524
- if(desc.initAttr){
2525
- initProp.createTmpCache(name);
2526
- }
2527
- props.forEach(function(prop){
2528
- if(!modifyProps[name][prop]){
2529
- modifyProps[name][prop] = [];
2530
- havePolyfill[prop] = true;
2531
- }
2532
- if(desc.set){
2533
- if(only){
2534
- desc.set.only = only;
2535
- }
2536
- modifyProps[name][prop].push(desc.set);
2537
- }
2538
-
2539
- if(desc.initAttr){
2540
- initProp.content(name, prop);
2541
- }
2542
- });
2543
- initProp.flushTmpCache();
2544
-
2545
- });
2546
- },
2547
- defineNodeNamesBooleanProperty: function(elementNames, prop, descs){
2548
- if(!descs){
2549
- descs = {};
2550
- }
2551
- if($.isFunction(descs)){
2552
- descs.set = descs;
2553
- }
2554
- webshims.defineNodeNamesProperty(elementNames, prop, {
2555
- attr: {
2556
- set: function(val){
2557
- if(descs.useContentAttribute){
2558
- webshims.contentAttr(this, prop, val);
2559
- } else {
2560
- this.setAttribute(prop, val);
2561
- }
2562
- if(descs.set){
2563
- descs.set.call(this, true);
2564
- }
2565
- },
2566
- get: function(){
2567
- var ret = (descs.useContentAttribute) ? webshims.contentAttr(this, prop) : this.getAttribute(prop);
2568
- return (ret == null) ? undefined : prop;
2569
- }
2570
- },
2571
- removeAttr: {
2572
- value: function(){
2573
- this.removeAttribute(prop);
2574
- if(descs.set){
2575
- descs.set.call(this, false);
2576
- }
2577
- }
2578
- },
2579
- reflect: true,
2580
- propType: 'boolean',
2581
- initAttr: descs.initAttr || false
2582
- });
2583
- },
2584
- contentAttr: function(elem, name, val){
2585
- if(!elem.nodeName){return;}
2586
- var attr;
2587
- if(val === undefined){
2588
- attr = (elem.attributes[name] || {});
2589
- val = attr.specified ? attr.value : null;
2590
- return (val == null) ? undefined : val;
2591
- }
2592
-
2593
- if(typeof val == 'boolean'){
2594
- if(!val){
2595
- elem.removeAttribute(name);
2596
- } else {
2597
- elem.setAttribute(name, name);
2598
- }
2599
- } else {
2600
- elem.setAttribute(name, val);
2601
- }
2602
- },
2603
-
2604
- activeLang: (function(){
2605
- var curLang = [];
2606
- var langDatas = [];
2607
- var loading = {};
2608
- var load = function(src, obj, loadingLang){
2609
- obj._isLoading = true;
2610
- if(loading[src]){
2611
- loading[src].push(obj);
2612
- } else {
2613
- loading[src] = [obj];
2614
- webshims.loader.loadScript(src, function(){
2615
- if(loadingLang == curLang.join()){
2616
- $.each(loading[src], function(i, obj){
2617
- select(obj);
2618
- });
2619
- }
2620
- delete loading[src];
2621
- });
2622
- }
2623
- };
2624
-
2625
- var select = function(obj){
2626
- var oldLang = obj.__active;
2627
- var selectLang = function(i, lang){
2628
- obj._isLoading = false;
2629
- if(obj[lang] || obj.availableLangs.indexOf(lang) != -1){
2630
- if(obj[lang]){
2631
- obj.__active = obj[lang];
2632
- obj.__activeName = lang;
2633
- } else {
2634
- load(obj.langSrc+lang, obj, curLang.join());
2635
- }
2636
- return false;
2637
- }
2638
- };
2639
- $.each(curLang, selectLang);
2640
- if(!obj.__active){
2641
- obj.__active = obj[''];
2642
- obj.__activeName = '';
2643
- }
2644
- if(oldLang != obj.__active){
2645
- $(obj).trigger('change');
2646
- }
2647
- };
2648
- return function(lang){
2649
- var shortLang;
2650
- if(typeof lang == 'string'){
2651
- if(curLang[0] != lang){
2652
- curLang = [lang];
2653
- shortLang = curLang[0].split('-')[0];
2654
- if(shortLang && shortLang != lang){
2655
- curLang.push(shortLang);
2656
- }
2657
- langDatas.forEach(select);
2658
- }
2659
- } else if(typeof lang == 'object'){
2660
- if(!lang.__active){
2661
- langDatas.push(lang);
2662
- select(lang);
2663
- }
2664
- return lang.__active;
2665
- }
2666
- return curLang[0];
2667
- };
2668
- })()
2669
- });
2670
-
2671
- $.each({
2672
- defineNodeNamesProperty: 'defineNodeNameProperty',
2673
- defineNodeNamesProperties: 'defineNodeNameProperties',
2674
- createElements: 'createElement'
2675
- }, function(name, baseMethod){
2676
- webshims[name] = function(names, a, b, c){
2677
- if(typeof names == 'string'){
2678
- names = names.split(listReg);
2679
- }
2680
- var retDesc = {};
2681
- names.forEach(function(nodeName){
2682
- retDesc[nodeName] = webshims[baseMethod](nodeName, a, b, c);
2683
- });
2684
- return retDesc;
2685
- };
2686
- });
2687
-
2688
- webshims.isReady('webshimLocalization', true);
2689
-
2690
- //html5a11y + hidden attribute
2691
- (function(){
2692
- if(('content' in document.createElement('template'))){return;}
2693
-
2694
- $(function(){
2695
- var main = $('main').attr({role: 'main'});
2696
- if(main.length > 1){
2697
- webshims.error('only one main element allowed in document');
2698
- } else if(main.is('article *, section *')) {
2699
- webshims.error('main not allowed inside of article/section elements');
2700
- }
2701
- });
2702
-
2703
- if(('hidden' in document.createElement('a'))){
2704
- return;
2705
- }
2706
-
2707
- webshims.defineNodeNamesBooleanProperty(['*'], 'hidden');
2708
-
2709
- var elemMappings = {
2710
- article: "article",
2711
- aside: "complementary",
2712
- section: "region",
2713
- nav: "navigation",
2714
- address: "contentinfo"
2715
- };
2716
- var addRole = function(elem, role){
2717
- var hasRole = elem.getAttribute('role');
2718
- if (!hasRole) {
2719
- elem.setAttribute('role', role);
2720
- }
2721
- };
2722
-
2723
-
2724
- $.webshims.addReady(function(context, contextElem){
2725
- $.each(elemMappings, function(name, role){
2726
- var elems = $(name, context).add(contextElem.filter(name));
2727
- for (var i = 0, len = elems.length; i < len; i++) {
2728
- addRole(elems[i], role);
2729
- }
2730
- });
2731
- if (context === document) {
2732
- var header = document.getElementsByTagName('header')[0];
2733
- var footers = document.getElementsByTagName('footer');
2734
- var footerLen = footers.length;
2735
-
2736
- if (header && !$(header).closest('section, article')[0]) {
2737
- addRole(header, 'banner');
2738
- }
2739
- if (!footerLen) {
2740
- return;
2741
- }
2742
- var footer = footers[footerLen - 1];
2743
- if (!$(footer).closest('section, article')[0]) {
2744
- addRole(footer, 'contentinfo');
2745
- }
2746
- }
2747
- });
2748
-
2749
- })();
2750
- });
2751
- ;(function(Modernizr, webshims){
2752
- "use strict";
2753
- var hasNative = Modernizr.audio && Modernizr.video;
2754
- var supportsLoop = false;
2755
- var bugs = webshims.bugs;
2756
- var swfType = 'mediaelement-jaris';
2757
- var loadSwf = function(){
2758
- webshims.ready(swfType, function(){
2759
- if(!webshims.mediaelement.createSWF){
2760
- webshims.mediaelement.loadSwf = true;
2761
- webshims.reTest([swfType], hasNative);
2762
- }
2763
- });
2764
- };
2765
-
2766
- var wsCfg = webshims.cfg;
2767
- var options = wsCfg.mediaelement;
2768
- var isIE = navigator.userAgent.indexOf('MSIE') != -1;
2769
- if(!options){
2770
- webshims.error("mediaelement wasn't implemented but loaded");
2771
- return;
2772
- }
2773
-
2774
- if(hasNative){
2775
- var videoElem = document.createElement('video');
2776
- Modernizr.videoBuffered = ('buffered' in videoElem);
2777
- Modernizr.mediaDefaultMuted = ('defaultMuted' in videoElem);
2778
- supportsLoop = ('loop' in videoElem);
2779
- Modernizr.mediaLoop = supportsLoop;
2780
-
2781
- webshims.capturingEvents(['play', 'playing', 'waiting', 'paused', 'ended', 'durationchange', 'loadedmetadata', 'canplay', 'volumechange']);
2782
-
2783
- if( !Modernizr.videoBuffered || !supportsLoop || (!Modernizr.mediaDefaultMuted && isIE && 'ActiveXObject' in window) ){
2784
- webshims.addPolyfill('mediaelement-native-fix', {
2785
- d: ['dom-support']
2786
- });
2787
- webshims.loader.loadList(['mediaelement-native-fix']);
2788
- }
2789
- }
2790
-
2791
- if(Modernizr.track && !bugs.track){
2792
- (function(){
2793
- if(!bugs.track){
2794
-
2795
- if(window.VTTCue && !window.TextTrackCue){
2796
- window.TextTrackCue = window.VTTCue;
2797
- } else if(!window.VTTCue){
2798
- window.VTTCue = window.TextTrackCue;
2799
- }
2800
-
2801
- try {
2802
- new VTTCue(2, 3, '');
2803
- } catch(e){
2804
- bugs.track = true;
2805
- }
2806
- }
2807
- })();
2808
- }
2809
-
2810
- webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
2811
- var hasSwf = swfmini.hasFlashPlayerVersion('10.0.3');
2812
- var mediaelement = webshims.mediaelement;
2813
-
2814
- mediaelement.parseRtmp = function(data){
2815
- var src = data.src.split('://');
2816
- var paths = src[1].split('/');
2817
- var i, len, found;
2818
- data.server = src[0]+'://'+paths[0]+'/';
2819
- data.streamId = [];
2820
- for(i = 1, len = paths.length; i < len; i++){
2821
- if(!found && paths[i].indexOf(':') !== -1){
2822
- paths[i] = paths[i].split(':')[1];
2823
- found = true;
2824
- }
2825
- if(!found){
2826
- data.server += paths[i]+'/';
2827
- } else {
2828
- data.streamId.push(paths[i]);
2829
- }
2830
- }
2831
- if(!data.streamId.length){
2832
- webshims.error('Could not parse rtmp url');
2833
- }
2834
- data.streamId = data.streamId.join('/');
2835
- };
2836
-
2837
- var getSrcObj = function(elem, nodeName){
2838
- elem = $(elem);
2839
- var src = {src: elem.attr('src') || '', elem: elem, srcProp: elem.prop('src')};
2840
- var tmp;
2841
-
2842
- if(!src.src){return src;}
2843
-
2844
- tmp = elem.attr('data-server');
2845
- if(tmp != null){
2846
- src.server = tmp;
2847
- }
2848
-
2849
- tmp = elem.attr('type') || elem.attr('data-type');
2850
- if(tmp){
2851
- src.type = tmp;
2852
- src.container = $.trim(tmp.split(';')[0]);
2853
- } else {
2854
- if(!nodeName){
2855
- nodeName = elem[0].nodeName.toLowerCase();
2856
- if(nodeName == 'source'){
2857
- nodeName = (elem.closest('video, audio')[0] || {nodeName: 'video'}).nodeName.toLowerCase();
2858
- }
2859
- }
2860
- if(src.server){
2861
- src.type = nodeName+'/rtmp';
2862
- src.container = nodeName+'/rtmp';
2863
- } else {
2864
-
2865
- tmp = mediaelement.getTypeForSrc( src.src, nodeName, src );
2866
-
2867
- if(tmp){
2868
- src.type = tmp;
2869
- src.container = tmp;
2870
- }
2871
- }
2872
- }
2873
-
2874
- tmp = elem.attr('media');
2875
- if(tmp){
2876
- src.media = tmp;
2877
- }
2878
- if(src.type == 'audio/rtmp' || src.type == 'video/rtmp'){
2879
- if(src.server){
2880
- src.streamId = src.src;
2881
- } else {
2882
- mediaelement.parseRtmp(src);
2883
- }
2884
- }
2885
- return src;
2886
- };
2887
-
2888
-
2889
-
2890
- var hasYt = !hasSwf && ('postMessage' in window) && hasNative;
2891
-
2892
- var loadTrackUi = function(){
2893
- if(loadTrackUi.loaded){return;}
2894
- loadTrackUi.loaded = true;
2895
- if(!options.noAutoTrack){
2896
- webshims.ready('WINDOWLOAD', function(){
2897
- loadThird();
2898
- webshims.loader.loadList(['track-ui']);
2899
- });
2900
- }
2901
- };
2902
-
2903
- var loadYt = (function(){
2904
- var loaded;
2905
- return function(){
2906
- if(loaded || !hasYt){return;}
2907
- loaded = true;
2908
- webshims.loader.loadScript("https://www.youtube.com/player_api");
2909
- $(function(){
2910
- webshims._polyfill(["mediaelement-yt"]);
2911
- });
2912
- };
2913
- })();
2914
- var loadThird = function(){
2915
- if(hasSwf){
2916
- loadSwf();
2917
- } else {
2918
- loadYt();
2919
- }
2920
- };
2921
-
2922
- webshims.addPolyfill('mediaelement-yt', {
2923
- test: !hasYt,
2924
- d: ['dom-support']
2925
- });
2926
-
2927
-
2928
-
2929
- mediaelement.mimeTypes = {
2930
- audio: {
2931
- //ogm shouldn´t be used!
2932
- 'audio/ogg': ['ogg','oga', 'ogm'],
2933
- 'audio/ogg;codecs="opus"': 'opus',
2934
- 'audio/mpeg': ['mp2','mp3','mpga','mpega'],
2935
- 'audio/mp4': ['mp4','mpg4', 'm4r', 'm4a', 'm4p', 'm4b', 'aac'],
2936
- 'audio/wav': ['wav'],
2937
- 'audio/3gpp': ['3gp','3gpp'],
2938
- 'audio/webm': ['webm'],
2939
- 'audio/fla': ['flv', 'f4a', 'fla'],
2940
- 'application/x-mpegURL': ['m3u8', 'm3u']
2941
- },
2942
- video: {
2943
- //ogm shouldn´t be used!
2944
- 'video/ogg': ['ogg','ogv', 'ogm'],
2945
- 'video/mpeg': ['mpg','mpeg','mpe'],
2946
- 'video/mp4': ['mp4','mpg4', 'm4v'],
2947
- 'video/quicktime': ['mov','qt'],
2948
- 'video/x-msvideo': ['avi'],
2949
- 'video/x-ms-asf': ['asf', 'asx'],
2950
- 'video/flv': ['flv', 'f4v'],
2951
- 'video/3gpp': ['3gp','3gpp'],
2952
- 'video/webm': ['webm'],
2953
- 'application/x-mpegURL': ['m3u8', 'm3u'],
2954
- 'video/MP2T': ['ts']
2955
- }
2956
- }
2957
- ;
2958
-
2959
- mediaelement.mimeTypes.source = $.extend({}, mediaelement.mimeTypes.audio, mediaelement.mimeTypes.video);
2960
-
2961
- mediaelement.getTypeForSrc = function(src, nodeName){
2962
- if(src.indexOf('youtube.com/watch?') != -1 || src.indexOf('youtube.com/v/') != -1){
2963
- return 'video/youtube';
2964
- }
2965
- if(src.indexOf('rtmp') === 0){
2966
- return nodeName+'/rtmp';
2967
- }
2968
- src = src.split('?')[0].split('#')[0].split('.');
2969
- src = src[src.length - 1];
2970
- var mt;
2971
-
2972
- $.each(mediaelement.mimeTypes[nodeName], function(mimeType, exts){
2973
- if(exts.indexOf(src) !== -1){
2974
- mt = mimeType;
2975
- return false;
2976
- }
2977
- });
2978
- return mt;
2979
- };
2980
-
2981
-
2982
- mediaelement.srces = function(mediaElem, srces){
2983
- mediaElem = $(mediaElem);
2984
- if(!srces){
2985
- srces = [];
2986
- var nodeName = mediaElem[0].nodeName.toLowerCase();
2987
- var src = getSrcObj(mediaElem, nodeName);
2988
-
2989
- if(!src.src){
2990
- $('source', mediaElem).each(function(){
2991
- src = getSrcObj(this, nodeName);
2992
- if(src.src){srces.push(src);}
2993
- });
2994
- } else {
2995
- srces.push(src);
2996
- }
2997
- return srces;
2998
- } else {
2999
- webshims.error('setting sources was removed.');
3000
- }
3001
- };
3002
-
3003
- 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'];
3004
-
3005
- mediaelement.canThirdPlaySrces = function(mediaElem, srces){
3006
- var ret = '';
3007
- if(hasSwf || hasYt){
3008
- mediaElem = $(mediaElem);
3009
- srces = srces || mediaelement.srces(mediaElem);
3010
- $.each(srces, function(i, src){
3011
- if(src.container && src.src && ((hasSwf && mediaelement.swfMimeTypes.indexOf(src.container) != -1) || (hasYt && src.container == 'video/youtube'))){
3012
- ret = src;
3013
- return false;
3014
- }
3015
- });
3016
-
3017
- }
3018
-
3019
- return ret;
3020
- };
3021
-
3022
- var nativeCanPlayType = {};
3023
- mediaelement.canNativePlaySrces = function(mediaElem, srces){
3024
- var ret = '';
3025
- if(hasNative){
3026
- mediaElem = $(mediaElem);
3027
- var nodeName = (mediaElem[0].nodeName || '').toLowerCase();
3028
- var nativeCanPlay = (nativeCanPlayType[nodeName] || {prop: {_supvalue: false}}).prop._supvalue || mediaElem[0].canPlayType;
3029
- if(!nativeCanPlay){return ret;}
3030
- srces = srces || mediaelement.srces(mediaElem);
3031
-
3032
- $.each(srces, function(i, src){
3033
- if(src.type && nativeCanPlay.call(mediaElem[0], src.type) ){
3034
- ret = src;
3035
- return false;
3036
- }
3037
- });
3038
- }
3039
- return ret;
3040
- };
3041
- var emptyType = (/^\s*application\/octet\-stream\s*$/i);
3042
- var getRemoveEmptyType = function(){
3043
- var ret = emptyType.test($.attr(this, 'type') || '');
3044
- if(ret){
3045
- $(this).removeAttr('type');
3046
- }
3047
- return ret;
3048
- };
3049
- mediaelement.setError = function(elem, message){
3050
- if($('source', elem).filter(getRemoveEmptyType).length){
3051
- webshims.error('"application/octet-stream" is a useless mimetype for audio/video. Please change this attribute.');
3052
- try {
3053
- $(elem).mediaLoad();
3054
- } catch(er){}
3055
- } else {
3056
- if(!message){
3057
- message = "can't play sources";
3058
- }
3059
- $(elem).pause().data('mediaerror', message);
3060
- webshims.error('mediaelementError: '+ message +'. Run the following line in your console to get more info: webshim.mediaelement.loadDebugger();');
3061
- setTimeout(function(){
3062
- if($(elem).data('mediaerror')){
3063
- $(elem).addClass('media-error').trigger('mediaerror');
3064
- }
3065
- }, 1);
3066
- }
3067
-
3068
-
3069
- };
3070
-
3071
- var handleThird = (function(){
3072
- var requested;
3073
- var readyType = hasSwf ? swfType : 'mediaelement-yt';
3074
- return function( mediaElem, ret, data ){
3075
- //readd to ready
3076
-
3077
- webshims.ready(readyType, function(){
3078
- if(mediaelement.createSWF && $(mediaElem).parent()[0]){
3079
- mediaelement.createSWF( mediaElem, ret, data );
3080
- } else if(!requested) {
3081
- requested = true;
3082
- loadThird();
3083
-
3084
- handleThird( mediaElem, ret, data );
3085
- }
3086
- });
3087
- if(!requested && hasYt && !mediaelement.createSWF){
3088
- loadYt();
3089
- }
3090
- };
3091
- })();
3092
-
3093
- var activate = {
3094
- native: function(elem, src, data){
3095
- if(data && data.isActive == 'third') {
3096
- mediaelement.setActive(elem, 'html5', data);
3097
- }
3098
- },
3099
- third: handleThird
3100
- };
3101
-
3102
- var stepSources = function(elem, data, srces){
3103
- var i, src;
3104
- var testOrder = [{test: 'canNativePlaySrces', activate: 'native'}, {test: 'canThirdPlaySrces', activate: 'third'}];
3105
- if(options.preferFlash || (data && data.isActive == 'third') ){
3106
- testOrder.reverse();
3107
- }
3108
- for(i = 0; i < 2; i++){
3109
- src = mediaelement[testOrder[i].test](elem, srces);
3110
- if(src){
3111
- activate[testOrder[i].activate](elem, src, data);
3112
- break;
3113
- }
3114
- }
3115
-
3116
- if(!src){
3117
- mediaelement.setError(elem, false);
3118
- if(data && data.isActive == 'third') {
3119
- mediaelement.setActive(elem, 'html5', data);
3120
- }
3121
- }
3122
- };
3123
- var allowedPreload = {'metadata': 1, 'auto': 1, '': 1};
3124
- var fixPreload = function(elem){
3125
- var preload, img;
3126
- if(elem.getAttribute('preload') == 'none'){
3127
- if(allowedPreload[(preload = $.attr(elem, 'data-preload'))]){
3128
- $.attr(elem, 'preload', preload);
3129
- } else if(hasNative && (preload = elem.getAttribute('poster'))){
3130
- img = document.createElement('img');
3131
- img.src = preload;
3132
- }
3133
- }
3134
- };
3135
- var stopParent = /^(?:embed|object|datalist)$/i;
3136
- var selectSource = function(elem, data){
3137
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
3138
- var _srces = mediaelement.srces(elem);
3139
- var parent = elem.parentNode;
3140
-
3141
- clearTimeout(baseData.loadTimer);
3142
- $(elem).removeClass('media-error');
3143
- $.data(elem, 'mediaerror', false);
3144
-
3145
- if(!_srces.length || !parent || parent.nodeType != 1 || stopParent.test(parent.nodeName || '')){return;}
3146
- data = data || webshims.data(elem, 'mediaelement');
3147
- if(mediaelement.sortMedia){
3148
- _srces.sort(mediaelement.sortMedia);
3149
- }
3150
- fixPreload(elem);
3151
- stepSources(elem, data, _srces);
3152
-
3153
- };
3154
- mediaelement.selectSource = selectSource;
3155
-
3156
-
3157
- $(document).on('ended', function(e){
3158
- var data = webshims.data(e.target, 'mediaelement');
3159
- if( supportsLoop && (!data || data.isActive == 'html5') && !$.prop(e.target, 'loop')){return;}
3160
- setTimeout(function(){
3161
- if( $.prop(e.target, 'paused') || !$.prop(e.target, 'loop') ){return;}
3162
- $(e.target).prop('currentTime', 0).play();
3163
- });
3164
-
3165
- });
3166
-
3167
- var handleMedia = false;
3168
-
3169
- var initMediaElements = function(){
3170
- var testFixMedia = function(){
3171
-
3172
- if(webshims.implement(this, 'mediaelement')){
3173
- selectSource(this);
3174
- if(!Modernizr.mediaDefaultMuted && $.attr(this, 'muted') != null){
3175
- $.prop(this, 'muted', true);
3176
- }
3177
-
3178
- }
3179
- };
3180
-
3181
- webshims.ready('dom-support', function(){
3182
- handleMedia = true;
3183
-
3184
- if(!supportsLoop){
3185
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
3186
- }
3187
-
3188
- ['audio', 'video'].forEach(function(nodeName){
3189
- var supLoad;
3190
- supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
3191
- prop: {
3192
- value: function(){
3193
- var data = webshims.data(this, 'mediaelement');
3194
-
3195
- selectSource(this, data);
3196
- if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
3197
- supLoad.prop._supvalue.apply(this, arguments);
3198
- }
3199
- if(!loadTrackUi.loaded && $('track', this).length){
3200
- loadTrackUi();
3201
- }
3202
- $(this).triggerHandler('wsmediareload');
3203
- }
3204
- }
3205
- });
3206
-
3207
- nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
3208
- prop: {
3209
- value: function(type){
3210
- var ret = '';
3211
- if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
3212
- ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
3213
- if(ret == 'no'){
3214
- ret = '';
3215
- }
3216
- }
3217
- if(!ret && hasSwf){
3218
- type = $.trim((type || '').split(';')[0]);
3219
- if(mediaelement.swfMimeTypes.indexOf(type) != -1){
3220
- ret = 'maybe';
3221
- }
3222
- }
3223
- if(!ret && hasYt && type == 'video/youtube'){
3224
- ret = 'maybe';
3225
- }
3226
- return ret;
3227
- }
3228
- }
3229
- });
3230
- });
3231
-
3232
-
3233
- webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
3234
- set: function(){
3235
- var elem = this;
3236
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
3237
- clearTimeout(baseData.loadTimer);
3238
- baseData.loadTimer = setTimeout(function(){
3239
- selectSource(elem);
3240
- elem = null;
3241
- }, 9);
3242
- }
3243
- });
3244
-
3245
-
3246
- webshims.addReady(function(context, insertedElement){
3247
- var media = $('video, audio', context)
3248
- .add(insertedElement.filter('video, audio'))
3249
- .each(testFixMedia)
3250
- ;
3251
- if(!loadTrackUi.loaded && $('track', media).length){
3252
- loadTrackUi();
3253
- }
3254
- media = null;
3255
- });
3256
- });
3257
-
3258
- if(hasNative && !handleMedia){
3259
- webshims.addReady(function(context, insertedElement){
3260
- if(!handleMedia){
3261
- $('video, audio', context)
3262
- .add(insertedElement.filter('video, audio'))
3263
- .each(function(){
3264
- if(!mediaelement.canNativePlaySrces(this)){
3265
- loadThird();
3266
- handleMedia = true;
3267
- return false;
3268
- }
3269
- })
3270
- ;
3271
- }
3272
- });
3273
- }
3274
- };
3275
-
3276
- mediaelement.loadDebugger = function(){
3277
- webshims.ready('dom-support', function(){
3278
- webshims.loader.loadScript('mediaelement-debug');
3279
- });
3280
- };
3281
-
3282
- if(({noCombo: 1, media: 1})[webshims.cfg.debug]){
3283
- $(document).on('mediaerror', function(e){
3284
- mediaelement.loadDebugger();
3285
- });
3286
- }
3287
- //set native implementation ready, before swf api is retested
3288
- if(hasNative){
3289
- webshims.isReady('mediaelement-core', true);
3290
- initMediaElements();
3291
- webshims.ready('WINDOWLOAD mediaelement', loadThird);
3292
- } else {
3293
- webshims.ready(swfType, initMediaElements);
3294
- }
3295
- webshims.ready('track', loadTrackUi);
3296
- });
3297
-
3298
- })(Modernizr, webshims);
3299
- ;webshims.register('mediaelement-jaris', function($, webshims, window, document, undefined, options){
3300
- "use strict";
3301
-
3302
- var mediaelement = webshims.mediaelement;
3303
- var swfmini = window.swfmini;
3304
- var hasNative = Modernizr.audio && Modernizr.video;
3305
- var hasFlash = swfmini.hasFlashPlayerVersion('9.0.115');
3306
- var loadedSwf = 0;
3307
- var needsLoadPreload = 'ActiveXObject' in window && hasNative;
3308
- var getProps = {
3309
- paused: true,
3310
- ended: false,
3311
- currentSrc: '',
3312
- duration: window.NaN,
3313
- readyState: 0,
3314
- networkState: 0,
3315
- videoHeight: 0,
3316
- videoWidth: 0,
3317
- seeking: false,
3318
- error: null,
3319
- buffered: {
3320
- start: function(index){
3321
- if(index){
3322
- webshims.error('buffered index size error');
3323
- return;
3324
- }
3325
- return 0;
3326
- },
3327
- end: function(index){
3328
- if(index){
3329
- webshims.error('buffered index size error');
3330
- return;
3331
- }
3332
- return 0;
3333
- },
3334
- length: 0
3335
- }
3336
- };
3337
- var getPropKeys = Object.keys(getProps);
3338
-
3339
- var getSetProps = {
3340
- currentTime: 0,
3341
- volume: 1,
3342
- muted: false
3343
- };
3344
- var getSetPropKeys = Object.keys(getSetProps);
3345
-
3346
- var playerStateObj = $.extend({
3347
- isActive: 'html5',
3348
- activating: 'html5',
3349
- wasSwfReady: false,
3350
- _bufferedEnd: 0,
3351
- _bufferedStart: 0,
3352
- currentTime: 0,
3353
- _ppFlag: undefined,
3354
- _calledMeta: false,
3355
- lastDuration: 0
3356
- }, getProps, getSetProps);
3357
-
3358
-
3359
- var getSwfDataFromElem = function(elem){
3360
- try {
3361
- (elem.nodeName);
3362
- } catch(er){
3363
- return null;
3364
- }
3365
- var data = webshims.data(elem, 'mediaelement');
3366
- return (data && data.isActive== 'third') ? data : null;
3367
- };
3368
-
3369
- var trigger = function(elem, evt){
3370
- evt = $.Event(evt);
3371
- evt.preventDefault();
3372
- $.event.trigger(evt, undefined, elem);
3373
- };
3374
-
3375
- var playerSwfPath = options.playerPath || webshims.cfg.basePath + "swf/" + (options.playerName || 'JarisFLVPlayer.swf');
3376
-
3377
- webshims.extendUNDEFProp(options.params, {
3378
- allowscriptaccess: 'always',
3379
- allowfullscreen: 'true',
3380
- wmode: 'transparent',
3381
- allowNetworking: 'all'
3382
- });
3383
- webshims.extendUNDEFProp(options.vars, {
3384
- controltype: '1',
3385
- jsapi: '1'
3386
- });
3387
- webshims.extendUNDEFProp(options.attrs, {
3388
- bgcolor: '#000000'
3389
- });
3390
-
3391
- var setReadyState = function(readyState, data){
3392
- if(readyState < 3){
3393
- clearTimeout(data._canplaythroughTimer);
3394
- }
3395
- if(readyState >= 3 && data.readyState < 3){
3396
- data.readyState = readyState;
3397
- trigger(data._elem, 'canplay');
3398
- if(!data.paused){
3399
- trigger(data._elem, 'playing');
3400
- }
3401
- clearTimeout(data._canplaythroughTimer);
3402
- data._canplaythroughTimer = setTimeout(function(){
3403
- setReadyState(4, data);
3404
- }, 4000);
3405
- }
3406
- if(readyState >= 4 && data.readyState < 4){
3407
- data.readyState = readyState;
3408
- trigger(data._elem, 'canplaythrough');
3409
- }
3410
- data.readyState = readyState;
3411
- };
3412
- var callSeeked = function(data){
3413
- if(data.seeking && Math.abs(data.currentTime - data._lastSeektime) < 2){
3414
- data.seeking = false;
3415
- $(data._elem).triggerHandler('seeked');
3416
- }
3417
- };
3418
-
3419
-
3420
- mediaelement.jarisEvent = {};
3421
- var localConnectionTimer;
3422
- var onEvent = {
3423
- onPlayPause: function(jaris, data, override){
3424
- var playing, type;
3425
- if(override == null){
3426
- try {
3427
- playing = data.api.api_get("isPlaying");
3428
- } catch(e){}
3429
- } else {
3430
- playing = override;
3431
- }
3432
- if(playing == data.paused){
3433
-
3434
- data.paused = !playing;
3435
- type = data.paused ? 'pause' : 'play';
3436
- data._ppFlag = true;
3437
- trigger(data._elem, type);
3438
- if(data.readyState < 3){
3439
- setReadyState(3, data);
3440
- }
3441
- if(!data.paused){
3442
- trigger(data._elem, 'playing');
3443
- }
3444
- }
3445
- },
3446
- onSeek: function(jaris, data){
3447
- data._lastSeektime = jaris.seekTime;
3448
-
3449
- data.seeking = true;
3450
- $(data._elem).triggerHandler('seeking');
3451
- clearTimeout(data._seekedTimer);
3452
- data._seekedTimer = setTimeout(function(){
3453
- callSeeked(data);
3454
- data.seeking = false;
3455
- }, 300);
3456
- },
3457
- onConnectionFailed: function(jaris, data){
3458
- mediaelement.setError(data._elem, 'flash connection error');
3459
- },
3460
- onNotBuffering: function(jaris, data){
3461
- setReadyState(3, data);
3462
- },
3463
- onDataInitialized: function(jaris, data){
3464
-
3465
- var oldDur = data.duration;
3466
- var durDelta;
3467
- data.duration = jaris.duration;
3468
- if(oldDur == data.duration || isNaN(data.duration)){return;}
3469
-
3470
- if(data._calledMeta && ((durDelta = Math.abs(data.lastDuration - data.duration)) < 2)){return;}
3471
-
3472
-
3473
-
3474
- data.videoHeight = jaris.height;
3475
- data.videoWidth = jaris.width;
3476
-
3477
- if(!data.networkState){
3478
- data.networkState = 2;
3479
- }
3480
- if(data.readyState < 1){
3481
- setReadyState(1, data);
3482
- }
3483
- clearTimeout(data._durationChangeTimer);
3484
- if(data._calledMeta && data.duration){
3485
- data._durationChangeTimer = setTimeout(function(){
3486
- data.lastDuration = data.duration;
3487
- trigger(data._elem, 'durationchange');
3488
- }, durDelta > 50 ? 0 : durDelta > 9 ? 9 : 99);
3489
- } else {
3490
- data.lastDuration = data.duration;
3491
- if(data.duration){
3492
- trigger(data._elem, 'durationchange');
3493
- }
3494
- if(!data._calledMeta){
3495
- trigger(data._elem, 'loadedmetadata');
3496
- }
3497
- }
3498
- data._calledMeta = true;
3499
- },
3500
- onBuffering: function(jaris, data){
3501
- if(data.ended){
3502
- data.ended = false;
3503
- }
3504
- setReadyState(1, data);
3505
- trigger(data._elem, 'waiting');
3506
- },
3507
- onTimeUpdate: function(jaris, data){
3508
- if(data.ended){
3509
- data.ended = false;
3510
- }
3511
- if(data.readyState < 3){
3512
- setReadyState(3, data);
3513
- trigger(data._elem, 'playing');
3514
- }
3515
- if(data.seeking){
3516
- callSeeked(data);
3517
- }
3518
- trigger(data._elem, 'timeupdate');
3519
- },
3520
- onProgress: function(jaris, data){
3521
- if(data.ended){
3522
- data.ended = false;
3523
- }
3524
- if(!data.duration || isNaN(data.duration)){
3525
- return;
3526
- }
3527
- var percentage = jaris.loaded / jaris.total;
3528
- if(percentage > 0.02 && percentage < 0.2){
3529
- setReadyState(3, data);
3530
- } else if(percentage > 0.2){
3531
- if(percentage > 0.99){
3532
- data.networkState = 1;
3533
- }
3534
- setReadyState(4, data);
3535
- }
3536
- if(data._bufferedEnd && (data._bufferedEnd > percentage)){
3537
- data._bufferedStart = data.currentTime || 0;
3538
- }
3539
-
3540
- data._bufferedEnd = percentage;
3541
- data.buffered.length = 1;
3542
-
3543
- $.event.trigger('progress', undefined, data._elem, true);
3544
- },
3545
- onPlaybackFinished: function(jaris, data){
3546
- if(data.readyState < 4){
3547
- setReadyState(4, data);
3548
- }
3549
- data.ended = true;
3550
- trigger(data._elem, 'ended');
3551
- },
3552
- onVolumeChange: function(jaris, data){
3553
- if(data.volume != jaris.volume || data.muted != jaris.mute){
3554
- data.volume = jaris.volume;
3555
- data.muted = jaris.mute;
3556
- trigger(data._elem, 'volumechange');
3557
- }
3558
- },
3559
- ready: (function(){
3560
- var testAPI = function(data){
3561
- var passed = true;
3562
-
3563
- try {
3564
- data.api.api_get('volume');
3565
- } catch(er){
3566
- passed = false;
3567
- }
3568
- return passed;
3569
- };
3570
-
3571
- return function(jaris, data){
3572
- var i = 0;
3573
-
3574
- var doneFn = function(){
3575
- if(i > 9){
3576
- data.tryedReframeing = 0;
3577
- return;
3578
- }
3579
- i++;
3580
-
3581
- data.tryedReframeing++;
3582
- if(testAPI(data)){
3583
- data.wasSwfReady = true;
3584
- data.tryedReframeing = 0;
3585
- startAutoPlay(data);
3586
- workActionQueue(data);
3587
- } else if(data.tryedReframeing < 6) {
3588
- if(data.tryedReframeing < 3){
3589
- data.reframeTimer = setTimeout(doneFn, 9);
3590
- data.shadowElem.css({overflow: 'visible'});
3591
- setTimeout(function(){
3592
- data.shadowElem.css({overflow: 'hidden'});
3593
- }, 1);
3594
- } else {
3595
- data.shadowElem.css({overflow: 'hidden'});
3596
- $(data._elem).mediaLoad();
3597
- }
3598
- } else {
3599
- clearTimeout(data.reframeTimer);
3600
- webshims.error("reframing error");
3601
- }
3602
- };
3603
- if(!data || !data.api){return;}
3604
- if(!data.tryedReframeing){
3605
- data.tryedReframeing = 0;
3606
- }
3607
- clearTimeout(localConnectionTimer);
3608
- clearTimeout(data.reframeTimer);
3609
- data.shadowElem.removeClass('flashblocker-assumed');
3610
-
3611
- if(!i){
3612
- doneFn();
3613
- } else {
3614
- data.reframeTimer = setTimeout(doneFn, 9);
3615
- }
3616
-
3617
- };
3618
- })()
3619
- };
3620
-
3621
- onEvent.onMute = onEvent.onVolumeChange;
3622
-
3623
-
3624
- var workActionQueue = function(data){
3625
- var actionLen = data.actionQueue.length;
3626
- var i = 0;
3627
- var operation;
3628
-
3629
- if(actionLen && data.isActive == 'third'){
3630
- while(data.actionQueue.length && actionLen > i){
3631
- i++;
3632
- operation = data.actionQueue.shift();
3633
- try{
3634
- data.api[operation.fn].apply(data.api, operation.args);
3635
- } catch(er){
3636
- webshims.warn(er);
3637
- }
3638
- }
3639
- }
3640
- if(data.actionQueue.length){
3641
- data.actionQueue = [];
3642
- }
3643
- };
3644
- var startAutoPlay = function(data){
3645
- if(!data){return;}
3646
- if( (data._ppFlag === undefined && ($.prop(data._elem, 'autoplay')) || !data.paused)){
3647
- setTimeout(function(){
3648
- if(data.isActive == 'third' && (data._ppFlag === undefined || !data.paused)){
3649
-
3650
- try {
3651
- $(data._elem).play();
3652
- data._ppFlag = true;
3653
- } catch(er){}
3654
- }
3655
- }, 1);
3656
- }
3657
-
3658
- if(data.muted){
3659
- $.prop(data._elem, 'muted', true);
3660
- }
3661
- if(data.volume != 1){
3662
- $.prop(data._elem, 'volume', data.volume);
3663
- }
3664
- };
3665
-
3666
-
3667
- var addMediaToStopEvents = $.noop;
3668
- if(hasNative){
3669
- var stopEvents = {
3670
- play: 1,
3671
- playing: 1
3672
- };
3673
- var hideEvtArray = ['play', 'pause', 'playing', 'canplay', 'progress', 'waiting', 'ended', 'loadedmetadata', 'durationchange', 'emptied'];
3674
- var hidevents = hideEvtArray.map(function(evt){
3675
- return evt +'.webshimspolyfill';
3676
- }).join(' ');
3677
-
3678
- var hidePlayerEvents = function(event){
3679
- var data = webshims.data(event.target, 'mediaelement');
3680
- if(!data){return;}
3681
- var isNativeHTML5 = ( event.originalEvent && event.originalEvent.type === event.type );
3682
- if( isNativeHTML5 == (data.activating == 'third') ){
3683
- event.stopImmediatePropagation();
3684
-
3685
- if(stopEvents[event.type]){
3686
- if(data.isActive != data.activating){
3687
- $(event.target).pause();
3688
- } else if(isNativeHTML5){
3689
- ($.prop(event.target, 'pause')._supvalue || $.noop).apply(event.target);
3690
- }
3691
- }
3692
- }
3693
- };
3694
-
3695
- addMediaToStopEvents = function(elem){
3696
- $(elem)
3697
- .off(hidevents)
3698
- .on(hidevents, hidePlayerEvents)
3699
- ;
3700
- hideEvtArray.forEach(function(evt){
3701
- webshims.moveToFirstEvent(elem, evt);
3702
- });
3703
- };
3704
- addMediaToStopEvents(document);
3705
- }
3706
-
3707
-
3708
- mediaelement.setActive = function(elem, type, data){
3709
- if(!data){
3710
- data = webshims.data(elem, 'mediaelement');
3711
- }
3712
- if(!data || data.isActive == type){return;}
3713
- if(type != 'html5' && type != 'third'){
3714
- webshims.warn('wrong type for mediaelement activating: '+ type);
3715
- }
3716
- var shadowData = webshims.data(elem, 'shadowData');
3717
- data.activating = type;
3718
- $(elem).pause();
3719
- data.isActive = type;
3720
- if(type == 'third'){
3721
- shadowData.shadowElement = shadowData.shadowFocusElement = data.shadowElem[0];
3722
- $(elem).addClass('swf-api-active nonnative-api-active').hide().getShadowElement().show();
3723
- } else {
3724
- $(elem).removeClass('swf-api-active nonnative-api-active').show().getShadowElement().hide();
3725
- shadowData.shadowElement = shadowData.shadowFocusElement = false;
3726
- }
3727
- $(elem).trigger('mediaelementapichange');
3728
- };
3729
-
3730
-
3731
-
3732
- var resetSwfProps = (function(){
3733
- var resetProtoProps = ['_calledMeta', 'lastDuration', '_bufferedEnd', '_bufferedStart', '_ppFlag', 'currentSrc', 'currentTime', 'duration', 'ended', 'networkState', 'paused', 'seeking', 'videoHeight', 'videoWidth'];
3734
- var len = resetProtoProps.length;
3735
- return function(data){
3736
-
3737
- if(!data){return;}
3738
- clearTimeout(data._seekedTimer);
3739
- var lenI = len;
3740
- var networkState = data.networkState;
3741
- setReadyState(0, data);
3742
- clearTimeout(data._durationChangeTimer);
3743
- while(--lenI > -1){
3744
- delete data[resetProtoProps[lenI]];
3745
- }
3746
- data.actionQueue = [];
3747
- data.buffered.length = 0;
3748
- if(networkState){
3749
- trigger(data._elem, 'emptied');
3750
- }
3751
- };
3752
- })();
3753
-
3754
-
3755
- var getComputedDimension = (function(){
3756
- var dimCache = {};
3757
- var getVideoDims = function(data){
3758
- var ret, poster, img;
3759
- if(dimCache[data.currentSrc]){
3760
- ret = dimCache[data.currentSrc];
3761
- } else if(data.videoHeight && data.videoWidth){
3762
- dimCache[data.currentSrc] = {
3763
- width: data.videoWidth,
3764
- height: data.videoHeight
3765
- };
3766
- ret = dimCache[data.currentSrc];
3767
- } else if((poster = $.attr(data._elem, 'poster'))){
3768
- ret = dimCache[poster];
3769
- if(!ret){
3770
- img = document.createElement('img');
3771
- img.onload = function(){
3772
- dimCache[poster] = {
3773
- width: this.width,
3774
- height: this.height
3775
- };
3776
-
3777
- if(dimCache[poster].height && dimCache[poster].width){
3778
- setElementDimension(data, $.prop(data._elem, 'controls'));
3779
- } else {
3780
- delete dimCache[poster];
3781
- }
3782
- img.onload = null;
3783
- };
3784
- img.src = poster;
3785
- if(img.complete && img.onload){
3786
- img.onload();
3787
- }
3788
- }
3789
- }
3790
- return ret || {width: 300, height: data._elemNodeName == 'video' ? 150 : 50};
3791
- };
3792
-
3793
- var getCssStyle = function(elem, style){
3794
- return elem.style[style] || (elem.currentStyle && elem.currentStyle[style]) || (window.getComputedStyle && (window.getComputedStyle( elem, null ) || {} )[style]) || '';
3795
- };
3796
- var minMaxProps = ['minWidth', 'maxWidth', 'minHeight', 'maxHeight'];
3797
-
3798
- var addMinMax = function(elem, ret){
3799
- var i, prop;
3800
- var hasMinMax = false;
3801
- for (i = 0; i < 4; i++) {
3802
- prop = getCssStyle(elem, minMaxProps[i]);
3803
- if(parseFloat(prop, 10)){
3804
- hasMinMax = true;
3805
- ret[minMaxProps[i]] = prop;
3806
- }
3807
- }
3808
- return hasMinMax;
3809
- };
3810
- var retFn = function(data){
3811
- var videoDims, ratio, hasMinMax;
3812
- var elem = data._elem;
3813
- var autos = {
3814
- width: getCssStyle(elem, 'width') == 'auto',
3815
- height: getCssStyle(elem, 'height') == 'auto'
3816
- };
3817
- var ret = {
3818
- width: !autos.width && $(elem).width(),
3819
- height: !autos.height && $(elem).height()
3820
- };
3821
-
3822
- if(autos.width || autos.height){
3823
- videoDims = getVideoDims(data);
3824
- ratio = videoDims.width / videoDims.height;
3825
-
3826
- if(autos.width && autos.height){
3827
- ret.width = videoDims.width;
3828
- ret.height = videoDims.height;
3829
- } else if(autos.width){
3830
- ret.width = ret.height * ratio;
3831
- } else if(autos.height){
3832
- ret.height = ret.width / ratio;
3833
- }
3834
-
3835
- if(addMinMax(elem, ret)){
3836
- data.shadowElem.css(ret);
3837
- if(autos.width){
3838
- ret.width = data.shadowElem.height() * ratio;
3839
- }
3840
- if(autos.height){
3841
- ret.height = ((autos.width) ? ret.width : data.shadowElem.width()) / ratio;
3842
- }
3843
- if(autos.width && autos.height){
3844
- data.shadowElem.css(ret);
3845
- ret.height = data.shadowElem.width() / ratio;
3846
- ret.width = ret.height * ratio;
3847
-
3848
- data.shadowElem.css(ret);
3849
- ret.width = data.shadowElem.height() * ratio;
3850
- ret.height = ret.width / ratio;
3851
-
3852
- }
3853
- if(!Modernizr.video){
3854
- ret.width = data.shadowElem.width();
3855
- ret.height = data.shadowElem.height();
3856
- }
3857
- }
3858
- }
3859
- return ret;
3860
- };
3861
-
3862
- return retFn;
3863
- })();
3864
-
3865
- var setElementDimension = function(data, hasControls){
3866
- var dims;
3867
-
3868
- var box = data.shadowElem;
3869
- $(data._elem)[hasControls ? 'addClass' : 'removeClass']('webshims-controls');
3870
-
3871
- if(data.isActive == 'third' || data.activating == 'third'){
3872
- if(data._elemNodeName == 'audio' && !hasControls){
3873
- box.css({width: 0, height: 0});
3874
- } else {
3875
- data._elem.style.display = '';
3876
- dims = getComputedDimension(data);
3877
- data._elem.style.display = 'none';
3878
- box.css(dims);
3879
- }
3880
- }
3881
- };
3882
-
3883
- var bufferSrc = (function(){
3884
- var preloads = {
3885
- '': 1,
3886
- 'auto': 1
3887
- };
3888
- return function(elem){
3889
- var preload = $.attr(elem, 'preload');
3890
- if(preload == null || preload == 'none' || $.prop(elem, 'autoplay')){
3891
- return false;
3892
- }
3893
- preload = $.prop(elem, 'preload');
3894
- return !!(preloads[preload] || (preload == 'metadata' && $(elem).is('.preload-in-doubt, video:not([poster])')));
3895
- };
3896
- })();
3897
-
3898
- var regs = {
3899
- A: /&amp;/g,
3900
- a: /&/g,
3901
- e: /\=/g,
3902
- q: /\?/g
3903
- },
3904
- replaceVar = function(val){
3905
- return (val.replace) ? val.replace(regs.A, '%26').replace(regs.a, '%26').replace(regs.e, '%3D').replace(regs.q, '%3F') : val;
3906
- };
3907
-
3908
- if('matchMedia' in window){
3909
- var allowMediaSorting = false;
3910
- try {
3911
- allowMediaSorting = window.matchMedia('only all').matches;
3912
- } catch(er){}
3913
- if(allowMediaSorting){
3914
- mediaelement.sortMedia = function(src1, src2){
3915
- try {
3916
- src1 = !src1.media || matchMedia( src1.media ).matches;
3917
- src2 = !src2.media || matchMedia( src2.media ).matches;
3918
- } catch(er){
3919
- return 0;
3920
- }
3921
- return src1 == src2 ?
3922
- 0 :
3923
- src1 ? -1
3924
- : 1;
3925
- };
3926
- }
3927
- }
3928
-
3929
- mediaelement.createSWF = function( elem, canPlaySrc, data ){
3930
- if(!hasFlash){
3931
- setTimeout(function(){
3932
- $(elem).mediaLoad(); //<- this should produce a mediaerror
3933
- }, 1);
3934
- return;
3935
- }
3936
-
3937
- var attrStyle = {};
3938
-
3939
- if(loadedSwf < 1){
3940
- loadedSwf = 1;
3941
- } else {
3942
- loadedSwf++;
3943
- }
3944
- if(!data){
3945
- data = webshims.data(elem, 'mediaelement');
3946
- }
3947
-
3948
- if((attrStyle.height = $.attr(elem, 'height') || '') || (attrStyle.width = $.attr(elem, 'width') || '')){
3949
- $(elem).css(attrStyle);
3950
- webshims.warn("width or height content attributes used. Webshims prefers the usage of CSS (computed styles or inline styles) to detect size of a video/audio. It's really more powerfull.");
3951
- }
3952
-
3953
- var isRtmp = canPlaySrc.type == 'audio/rtmp' || canPlaySrc.type == 'video/rtmp';
3954
- var vars = $.extend({}, options.vars, {
3955
- poster: replaceVar($.attr(elem, 'poster') && $.prop(elem, 'poster') || ''),
3956
- source: replaceVar(canPlaySrc.streamId || canPlaySrc.srcProp),
3957
- server: replaceVar(canPlaySrc.server || '')
3958
- });
3959
- var elemVars = $(elem).data('vars') || {};
3960
-
3961
-
3962
-
3963
- var hasControls = $.prop(elem, 'controls');
3964
- var elemId = 'jarisplayer-'+ webshims.getID(elem);
3965
-
3966
- var params = $.extend(
3967
- {},
3968
- options.params,
3969
- $(elem).data('params')
3970
- );
3971
- var elemNodeName = elem.nodeName.toLowerCase();
3972
- var attrs = $.extend(
3973
- {},
3974
- options.attrs,
3975
- {
3976
- name: elemId,
3977
- id: elemId
3978
- },
3979
- $(elem).data('attrs')
3980
- );
3981
- var setDimension = function(){
3982
- if(data.isActive == 'third'){
3983
- setElementDimension(data, $.prop(elem, 'controls'));
3984
- }
3985
- };
3986
-
3987
- var box;
3988
-
3989
- if(data && data.swfCreated){
3990
- mediaelement.setActive(elem, 'third', data);
3991
-
3992
- data.currentSrc = canPlaySrc.srcProp;
3993
-
3994
- data.shadowElem.html('<div id="'+ elemId +'">');
3995
-
3996
- data.api = false;
3997
- data.actionQueue = [];
3998
- box = data.shadowElem;
3999
- resetSwfProps(data);
4000
- } else {
4001
- $(document.getElementById('wrapper-'+ elemId )).remove();
4002
- box = $('<div class="polyfill-'+ (elemNodeName) +' polyfill-mediaelement '+ webshims.shadowClass +'" id="wrapper-'+ elemId +'"><div id="'+ elemId +'"></div>')
4003
- .css({
4004
- position: 'relative',
4005
- overflow: 'hidden'
4006
- })
4007
- ;
4008
- data = webshims.data(elem, 'mediaelement', webshims.objectCreate(playerStateObj, {
4009
- actionQueue: {
4010
- value: []
4011
- },
4012
- shadowElem: {
4013
- value: box
4014
- },
4015
- _elemNodeName: {
4016
- value: elemNodeName
4017
- },
4018
- _elem: {
4019
- value: elem
4020
- },
4021
- currentSrc: {
4022
- value: canPlaySrc.srcProp
4023
- },
4024
- swfCreated: {
4025
- value: true
4026
- },
4027
- id: {
4028
- value: elemId.replace(/-/g, '')
4029
- },
4030
- buffered: {
4031
- value: {
4032
- start: function(index){
4033
- if(index >= data.buffered.length){
4034
- webshims.error('buffered index size error');
4035
- return;
4036
- }
4037
- return 0;
4038
- },
4039
- end: function(index){
4040
- if(index >= data.buffered.length){
4041
- webshims.error('buffered index size error');
4042
- return;
4043
- }
4044
- return ( (data.duration - data._bufferedStart) * data._bufferedEnd) + data._bufferedStart;
4045
- },
4046
- length: 0
4047
- }
4048
- }
4049
- }));
4050
-
4051
-
4052
-
4053
- box.insertBefore(elem);
4054
-
4055
- if(hasNative){
4056
- $.extend(data, {volume: $.prop(elem, 'volume'), muted: $.prop(elem, 'muted'), paused: $.prop(elem, 'paused')});
4057
- }
4058
-
4059
- webshims.addShadowDom(elem, box);
4060
- if(!webshims.data(elem, 'mediaelement')){
4061
- webshims.data(elem, 'mediaelement', data);
4062
- }
4063
- addMediaToStopEvents(elem);
4064
-
4065
- mediaelement.setActive(elem, 'third', data);
4066
-
4067
- setElementDimension(data, hasControls);
4068
-
4069
- $(elem)
4070
- .on({
4071
- 'updatemediaelementdimensions loadedmetadata emptied': setDimension,
4072
- 'remove': function(e){
4073
- if(!e.originalEvent && mediaelement.jarisEvent[data.id] && mediaelement.jarisEvent[data.id].elem == elem){
4074
- delete mediaelement.jarisEvent[data.id];
4075
- clearTimeout(localConnectionTimer);
4076
- clearTimeout(data.flashBlock);
4077
- }
4078
- }
4079
- })
4080
- .onWSOff('updateshadowdom', setDimension)
4081
- ;
4082
- }
4083
-
4084
- if(mediaelement.jarisEvent[data.id] && mediaelement.jarisEvent[data.id].elem != elem){
4085
- webshims.error('something went wrong');
4086
- return;
4087
- } else if(!mediaelement.jarisEvent[data.id]){
4088
-
4089
- mediaelement.jarisEvent[data.id] = function(jaris){
4090
-
4091
- if(jaris.type == 'ready'){
4092
- var onReady = function(){
4093
- if(data.api){
4094
- if(!data.paused){
4095
- data.api.api_play();
4096
- }
4097
- if(bufferSrc(elem)){
4098
- data.api.api_preload();
4099
- }
4100
- onEvent.ready(jaris, data);
4101
- }
4102
- };
4103
- if(data.api){
4104
- onReady();
4105
- } else {
4106
- setTimeout(onReady, 9);
4107
- }
4108
- } else {
4109
- data.currentTime = jaris.position;
4110
-
4111
- if(data.api){
4112
- if(!data._calledMeta && isNaN(jaris.duration) && data.duration != jaris.duration && isNaN(data.duration)){
4113
- onEvent.onDataInitialized(jaris, data);
4114
- }
4115
-
4116
- if(!data._ppFlag && jaris.type != 'onPlayPause'){
4117
- onEvent.onPlayPause(jaris, data);
4118
- }
4119
-
4120
- if(onEvent[jaris.type]){
4121
- onEvent[jaris.type](jaris, data);
4122
- }
4123
- }
4124
- data.duration = jaris.duration;
4125
- }
4126
- };
4127
- mediaelement.jarisEvent[data.id].elem = elem;
4128
- }
4129
-
4130
- $.extend(vars,
4131
- {
4132
- id: elemId,
4133
- evtId: data.id,
4134
- controls: ''+hasControls,
4135
- autostart: 'false',
4136
- nodename: elemNodeName
4137
- },
4138
- elemVars
4139
- );
4140
-
4141
- if(isRtmp){
4142
- vars.streamtype = 'rtmp';
4143
- } else if(canPlaySrc.type == 'audio/mpeg' || canPlaySrc.type == 'audio/mp3'){
4144
- vars.type = 'audio';
4145
- vars.streamtype = 'file';
4146
- } else if(canPlaySrc.type == 'video/youtube'){
4147
- vars.streamtype = 'youtube';
4148
- }
4149
- options.changeSWF(vars, elem, canPlaySrc, data, 'embed');
4150
- clearTimeout(data.flashBlock);
4151
-
4152
- swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.115", false, vars, params, attrs, function(swfData){
4153
- if(swfData.success){
4154
- var fBlocker = function(){
4155
- if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
4156
- box.addClass('flashblocker-assumed');
4157
- $(elem).trigger('flashblocker');
4158
- webshims.warn("flashblocker assumed");
4159
- }
4160
- $(swfData.ref).css({'minHeight': '2px', 'minWidth': '2px', display: 'block'});
4161
- };
4162
- data.api = swfData.ref;
4163
-
4164
- if(!hasControls){
4165
- $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
4166
- }
4167
-
4168
- data.flashBlock = setTimeout(fBlocker, 99);
4169
-
4170
- if(!localConnectionTimer){
4171
- clearTimeout(localConnectionTimer);
4172
- localConnectionTimer = setTimeout(function(){
4173
- fBlocker();
4174
- var flash = $(swfData.ref);
4175
- if(flash[0].offsetWidth > 1 && flash[0].offsetHeight > 1 && location.protocol.indexOf('file:') === 0){
4176
- 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");
4177
- } else if(flash[0].offsetWidth < 2 || flash[0].offsetHeight < 2) {
4178
- webshims.warn("JS-SWF connection can't be established on hidden or unconnected flash objects");
4179
- }
4180
- flash = null;
4181
- }, 8000);
4182
- }
4183
- }
4184
- });
4185
-
4186
- };
4187
-
4188
-
4189
- var queueSwfMethod = function(elem, fn, args, data){
4190
- data = data || getSwfDataFromElem(elem);
4191
-
4192
- if(data){
4193
- if(data.api && data.api[fn]){
4194
- data.api[fn].apply(data.api, args || []);
4195
- } else {
4196
- //todo add to queue
4197
- data.actionQueue.push({fn: fn, args: args});
4198
-
4199
- if(data.actionQueue.length > 10){
4200
- setTimeout(function(){
4201
- if(data.actionQueue.length > 5){
4202
- data.actionQueue.shift();
4203
- }
4204
- }, 99);
4205
- }
4206
- }
4207
- return data;
4208
- }
4209
- return false;
4210
- };
4211
-
4212
- ['audio', 'video'].forEach(function(nodeName){
4213
- var descs = {};
4214
- var mediaSup;
4215
- var createGetProp = function(key){
4216
- if(nodeName == 'audio' && (key == 'videoHeight' || key == 'videoWidth')){return;}
4217
-
4218
- descs[key] = {
4219
- get: function(){
4220
- var data = getSwfDataFromElem(this);
4221
- if(data){
4222
- return data[key];
4223
- } else if(hasNative && mediaSup[key].prop._supget) {
4224
- return mediaSup[key].prop._supget.apply(this);
4225
- } else {
4226
- return playerStateObj[key];
4227
- }
4228
- },
4229
- writeable: false
4230
- };
4231
- };
4232
- var createGetSetProp = function(key, setFn){
4233
- createGetProp(key);
4234
- delete descs[key].writeable;
4235
- descs[key].set = setFn;
4236
- };
4237
-
4238
- createGetSetProp('seeking');
4239
-
4240
- createGetSetProp('volume', function(v){
4241
- var data = getSwfDataFromElem(this);
4242
- if(data){
4243
- v *= 1;
4244
- if(!isNaN(v)){
4245
-
4246
- if(v < 0 || v > 1){
4247
- webshims.error('volume greater or less than allowed '+ (v / 100));
4248
- }
4249
-
4250
- queueSwfMethod(this, 'api_volume', [v], data);
4251
-
4252
-
4253
- if(data.volume != v){
4254
- data.volume = v;
4255
- trigger(data._elem, 'volumechange');
4256
- }
4257
- data = null;
4258
- }
4259
- } else if(mediaSup.volume.prop._supset) {
4260
- return mediaSup.volume.prop._supset.apply(this, arguments);
4261
- }
4262
- });
4263
-
4264
- createGetSetProp('muted', function(m){
4265
- var data = getSwfDataFromElem(this);
4266
- if(data){
4267
- m = !!m;
4268
- queueSwfMethod(this, 'api_muted', [m], data);
4269
- if(data.muted != m){
4270
- data.muted = m;
4271
- trigger(data._elem, 'volumechange');
4272
- }
4273
- data = null;
4274
- } else if(mediaSup.muted.prop._supset) {
4275
- return mediaSup.muted.prop._supset.apply(this, arguments);
4276
- }
4277
- });
4278
-
4279
-
4280
- createGetSetProp('currentTime', function(t){
4281
- var data = getSwfDataFromElem(this);
4282
- if(data){
4283
- t *= 1;
4284
- if (!isNaN(t)) {
4285
- queueSwfMethod(this, 'api_seek', [t], data);
4286
- }
4287
-
4288
- } else if(mediaSup.currentTime.prop._supset) {
4289
- return mediaSup.currentTime.prop._supset.apply(this, arguments);
4290
- }
4291
- });
4292
-
4293
- ['play', 'pause'].forEach(function(fn){
4294
- descs[fn] = {
4295
- value: function(){
4296
- var data = getSwfDataFromElem(this);
4297
-
4298
- if(data){
4299
- if(data.stopPlayPause){
4300
- clearTimeout(data.stopPlayPause);
4301
- }
4302
- queueSwfMethod(this, fn == 'play' ? 'api_play' : 'api_pause', [], data);
4303
-
4304
- data._ppFlag = true;
4305
- if(data.paused != (fn != 'play')){
4306
- data.paused = fn != 'play';
4307
- trigger(data._elem, fn);
4308
- }
4309
- } else if(mediaSup[fn].prop._supvalue) {
4310
- return mediaSup[fn].prop._supvalue.apply(this, arguments);
4311
- }
4312
- }
4313
- };
4314
- });
4315
-
4316
- getPropKeys.forEach(createGetProp);
4317
-
4318
- webshims.onNodeNamesPropertyModify(nodeName, 'controls', function(val, boolProp){
4319
- var data = getSwfDataFromElem(this);
4320
-
4321
- $(this)[boolProp ? 'addClass' : 'removeClass']('webshims-controls');
4322
-
4323
- if(data){
4324
- if(nodeName == 'audio'){
4325
- setElementDimension(data, boolProp);
4326
- }
4327
- queueSwfMethod(this, 'api_controls', [boolProp], data);
4328
- }
4329
- });
4330
-
4331
-
4332
- webshims.onNodeNamesPropertyModify(nodeName, 'preload', function(val){
4333
- var data, baseData, elem;
4334
-
4335
-
4336
- if(bufferSrc(this)){
4337
- data = getSwfDataFromElem(this);
4338
- if(data){
4339
- queueSwfMethod(this, 'api_preload', [], data);
4340
- } else if(needsLoadPreload && this.paused && !this.error && !$.data(this, 'mediaerror') && !this.readyState && !this.networkState && !this.autoplay && $(this).is(':not(.nonnative-api-active)')){
4341
- elem = this;
4342
- baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
4343
- clearTimeout(baseData.loadTimer);
4344
- baseData.loadTimer = setTimeout(function(){
4345
- $(elem).mediaLoad();
4346
- }, 9);
4347
- }
4348
- }
4349
- });
4350
-
4351
- mediaSup = webshims.defineNodeNameProperties(nodeName, descs, 'prop');
4352
-
4353
- if(!Modernizr.mediaDefaultMuted){
4354
- webshims.defineNodeNameProperties(nodeName, {
4355
- defaultMuted: {
4356
- get: function(){
4357
- return $.attr(this, 'muted') != null;
4358
- },
4359
- set: function(val){
4360
- if(val){
4361
- $.attr(this, 'muted', '');
4362
- } else {
4363
- $(this).removeAttr('muted');
4364
- }
4365
- }
4366
- }
4367
- }, 'prop');
4368
- }
4369
- });
4370
-
4371
-
4372
- if(hasFlash && $.cleanData){
4373
- var oldClean = $.cleanData;
4374
- var objElem = document.createElement('object');
4375
- var noRemove = {
4376
- SetVariable: 1,
4377
- GetVariable: 1,
4378
- SetReturnValue: 1,
4379
- GetReturnValue: 1
4380
- };
4381
- var flashNames = {
4382
- object: 1,
4383
- OBJECT: 1
4384
- };
4385
-
4386
- $.cleanData = function(elems){
4387
- var i, len, prop;
4388
- var ret = oldClean.apply(this, arguments);
4389
- if(elems && (len = elems.length) && loadedSwf){
4390
-
4391
- for(i = 0; i < len; i++){
4392
- if(flashNames[elems[i].nodeName] && 'api_pause' in elems[i]){
4393
- loadedSwf--;
4394
- try {
4395
- elems[i].api_pause();
4396
- if(elems[i].readyState == 4){
4397
- for (prop in elems[i]) {
4398
- if (!noRemove[prop] && !objElem[prop] && typeof elems[i][prop] == "function") {
4399
- elems[i][prop] = null;
4400
- }
4401
- }
4402
- }
4403
- } catch(er){}
4404
- }
4405
- }
4406
-
4407
- }
4408
- return ret;
4409
- };
4410
- }
4411
-
4412
- if(!hasNative){
4413
-
4414
- ['poster', 'src'].forEach(function(prop){
4415
- webshims.defineNodeNamesProperty(prop == 'src' ? ['audio', 'video', 'source'] : ['video'], prop, {
4416
- //attr: {},
4417
- reflect: true,
4418
- propType: 'src'
4419
- });
4420
- });
4421
-
4422
- webshims.defineNodeNamesProperty(['audio', 'video'], 'preload', {
4423
- reflect: true,
4424
- propType: 'enumarated',
4425
- defaultValue: '',
4426
- limitedTo: ['', 'auto', 'metadata', 'none']
4427
- });
4428
-
4429
- webshims.reflectProperties('source', ['type', 'media']);
4430
-
4431
-
4432
- ['autoplay', 'controls'].forEach(function(name){
4433
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], name);
4434
- });
4435
-
4436
- webshims.defineNodeNamesProperties(['audio', 'video'], {
4437
- HAVE_CURRENT_DATA: {
4438
- value: 2
4439
- },
4440
- HAVE_ENOUGH_DATA: {
4441
- value: 4
4442
- },
4443
- HAVE_FUTURE_DATA: {
4444
- value: 3
4445
- },
4446
- HAVE_METADATA: {
4447
- value: 1
4448
- },
4449
- HAVE_NOTHING: {
4450
- value: 0
4451
- },
4452
- NETWORK_EMPTY: {
4453
- value: 0
4454
- },
4455
- NETWORK_IDLE: {
4456
- value: 1
4457
- },
4458
- NETWORK_LOADING: {
4459
- value: 2
4460
- },
4461
- NETWORK_NO_SOURCE: {
4462
- value: 3
4463
- }
4464
-
4465
- }, 'prop');
4466
-
4467
-
4468
- if(hasFlash){
4469
- webshims.ready('WINDOWLOAD', function(){
4470
- setTimeout(function(){
4471
- if(!loadedSwf){
4472
- document.createElement('img').src = playerSwfPath;
4473
- }
4474
- }, 9);
4475
- });
4476
- }
4477
- } else if(!('media' in document.createElement('source'))){
4478
- webshims.reflectProperties('source', ['media']);
4479
- }
4480
-
4481
- if(hasNative && hasFlash && !options.preferFlash){
4482
- var switchErrors = {
4483
- 3: 1,
4484
- 4: 1
4485
- };
4486
- var switchOptions = function(e){
4487
- var media, error, parent;
4488
- if(
4489
- ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source', parent).last()[0] == e.target)) &&
4490
- (media = $(e.target).closest('audio, video')) && !media.is('.nonnative-api-active')
4491
- ){
4492
- error = media.prop('error');
4493
- setTimeout(function(){
4494
- if(!media.is('.nonnative-api-active')){
4495
- if(error && switchErrors[error.code]){
4496
- options.preferFlash = true;
4497
- document.removeEventListener('error', switchOptions, true);
4498
- $('audio, video').each(function(){
4499
- webshims.mediaelement.selectSource(this);
4500
- });
4501
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.currentSrc+" Mediaerror: "+ media.prop('error')+ ' error.code: '+ error.code);
4502
- }
4503
- webshims.warn('There was a mediaelement error. Run the following line in your console to get more info: webshim.mediaelement.loadDebugger();')
4504
- }
4505
- });
4506
-
4507
-
4508
- }
4509
- };
4510
-
4511
- document.addEventListener('error', switchOptions, true);
4512
- setTimeout(function(){
4513
- $('audio, video').each(function(){
4514
- var error = $.prop(this, 'error');
4515
- if(error && switchErrors[error]){
4516
- switchOptions({target: this});
4517
- }
4518
- });
4519
- });
4520
- }
4521
-
4522
- });