webshims-rails 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/lib/webshims-rails/version.rb +2 -2
  2. data/vendor/assets/javascripts/webshims/extras/custom-validity.js +253 -253
  3. data/vendor/assets/javascripts/webshims/extras/modernizr-custom.js +534 -534
  4. data/vendor/assets/javascripts/webshims/extras/mousepress.js +60 -60
  5. data/vendor/assets/javascripts/webshims/minified/polyfiller.js +1 -1
  6. data/vendor/assets/javascripts/webshims/minified/shims/combos/10.js +1 -1
  7. data/vendor/assets/javascripts/webshims/minified/shims/combos/12.js +1 -1
  8. data/vendor/assets/javascripts/webshims/minified/shims/combos/16.js +1 -1
  9. data/vendor/assets/javascripts/webshims/minified/shims/combos/17.js +1 -1
  10. data/vendor/assets/javascripts/webshims/minified/shims/combos/19.js +1 -1
  11. data/vendor/assets/javascripts/webshims/minified/shims/combos/2.js +1 -1
  12. data/vendor/assets/javascripts/webshims/minified/shims/combos/20.js +1 -1
  13. data/vendor/assets/javascripts/webshims/minified/shims/combos/21.js +1 -1
  14. data/vendor/assets/javascripts/webshims/minified/shims/combos/22.js +1 -1
  15. data/vendor/assets/javascripts/webshims/minified/shims/combos/23.js +1 -1
  16. data/vendor/assets/javascripts/webshims/minified/shims/combos/24.js +1 -1
  17. data/vendor/assets/javascripts/webshims/minified/shims/combos/25.js +1 -1
  18. data/vendor/assets/javascripts/webshims/minified/shims/combos/26.js +1 -1
  19. data/vendor/assets/javascripts/webshims/minified/shims/combos/27.js +1 -1
  20. data/vendor/assets/javascripts/webshims/minified/shims/combos/3.js +1 -1
  21. data/vendor/assets/javascripts/webshims/minified/shims/combos/4.js +1 -1
  22. data/vendor/assets/javascripts/webshims/minified/shims/combos/5.js +1 -1
  23. data/vendor/assets/javascripts/webshims/minified/shims/combos/59.js +1 -1
  24. data/vendor/assets/javascripts/webshims/minified/shims/combos/8.js +1 -1
  25. data/vendor/assets/javascripts/webshims/minified/shims/combos/9.js +1 -1
  26. data/vendor/assets/javascripts/webshims/minified/shims/form-core.js +1 -1
  27. data/vendor/assets/javascripts/webshims/minified/shims/form-message.js +1 -1
  28. data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-de.txt +33 -33
  29. data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-en.txt +34 -34
  30. data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-core.js +1 -1
  31. data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-jaris.js +1 -1
  32. data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-swf.js +1 -1
  33. data/vendor/assets/javascripts/webshims/minified/shims/swf/JarisFLVPlayer.swf +0 -0
  34. data/vendor/assets/javascripts/webshims/polyfiller.js +1188 -1188
  35. data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/README +82 -82
  36. data/vendor/assets/javascripts/webshims/shims/combos/1.js +1752 -1752
  37. data/vendor/assets/javascripts/webshims/shims/combos/10.js +3310 -3311
  38. data/vendor/assets/javascripts/webshims/shims/combos/11.js +1631 -1631
  39. data/vendor/assets/javascripts/webshims/shims/combos/12.js +1695 -1696
  40. data/vendor/assets/javascripts/webshims/shims/combos/13.js +1098 -1098
  41. data/vendor/assets/javascripts/webshims/shims/combos/14.js +477 -477
  42. data/vendor/assets/javascripts/webshims/shims/combos/15.js +317 -317
  43. data/vendor/assets/javascripts/webshims/shims/combos/16.js +2177 -2154
  44. data/vendor/assets/javascripts/webshims/shims/combos/17.js +2354 -2319
  45. data/vendor/assets/javascripts/webshims/shims/combos/18.js +1322 -1322
  46. data/vendor/assets/javascripts/webshims/shims/combos/19.js +2262 -2238
  47. data/vendor/assets/javascripts/webshims/shims/combos/2.js +2376 -2340
  48. data/vendor/assets/javascripts/webshims/shims/combos/20.js +1557 -1558
  49. data/vendor/assets/javascripts/webshims/shims/combos/21.js +1745 -1733
  50. data/vendor/assets/javascripts/webshims/shims/combos/22.js +2360 -2361
  51. data/vendor/assets/javascripts/webshims/shims/combos/23.js +2342 -2331
  52. data/vendor/assets/javascripts/webshims/shims/combos/24.js +2859 -2836
  53. data/vendor/assets/javascripts/webshims/shims/combos/25.js +1547 -1548
  54. data/vendor/assets/javascripts/webshims/shims/combos/26.js +2178 -2155
  55. data/vendor/assets/javascripts/webshims/shims/combos/27.js +3311 -3312
  56. data/vendor/assets/javascripts/webshims/shims/combos/3.js +3058 -3022
  57. data/vendor/assets/javascripts/webshims/shims/combos/4.js +807 -771
  58. data/vendor/assets/javascripts/webshims/shims/combos/5.js +1063 -1027
  59. data/vendor/assets/javascripts/webshims/shims/combos/59.js +1745 -1709
  60. data/vendor/assets/javascripts/webshims/shims/combos/6.js +384 -384
  61. data/vendor/assets/javascripts/webshims/shims/combos/7.js +640 -640
  62. data/vendor/assets/javascripts/webshims/shims/combos/8.js +1546 -1547
  63. data/vendor/assets/javascripts/webshims/shims/combos/9.js +2507 -2508
  64. data/vendor/assets/javascripts/webshims/shims/details.js +148 -148
  65. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +949 -949
  66. data/vendor/assets/javascripts/webshims/shims/es5.js +802 -802
  67. data/vendor/assets/javascripts/webshims/shims/excanvas.js +924 -924
  68. data/vendor/assets/javascripts/webshims/shims/form-core.js +630 -606
  69. data/vendor/assets/javascripts/webshims/shims/form-datalist.js +681 -681
  70. data/vendor/assets/javascripts/webshims/shims/form-message.js +176 -164
  71. data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +255 -255
  72. data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +383 -383
  73. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +1568 -1568
  74. data/vendor/assets/javascripts/webshims/shims/geolocation.js +168 -168
  75. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ar.js +32 -32
  76. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ch-ZN.js +32 -32
  77. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-de.txt +33 -33
  78. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-el.js +32 -32
  79. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-en.txt +34 -34
  80. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-es.js +31 -31
  81. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-fr.js +32 -32
  82. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-he.js +32 -32
  83. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-hi.js +32 -32
  84. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-hu.js +32 -32
  85. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-it.js +32 -32
  86. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ja.js +32 -32
  87. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-nl.js +32 -32
  88. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-pt-PT.js +32 -32
  89. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ru.js +31 -31
  90. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-sv.js +32 -32
  91. data/vendor/assets/javascripts/webshims/shims/json-storage.js +308 -308
  92. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +596 -597
  93. data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +891 -891
  94. data/vendor/assets/javascripts/webshims/shims/mediaelement-native-fix.js +98 -98
  95. data/vendor/assets/javascripts/webshims/shims/mediaelement-swf.js +960 -960
  96. data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +543 -543
  97. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +697 -697
  98. data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
  99. metadata +2 -4
  100. data/vendor/assets/javascripts/webshims/minified/shims/range-ui.js +0 -1
  101. data/vendor/assets/javascripts/webshims/shims/range-ui.js +0 -66
@@ -1,82 +1,82 @@
1
- FlashCanvas Pro
2
- ===============
3
-
4
- An implementation of the HTML5 Canvas API for Internet Explorer.
5
-
6
-
7
- Description
8
- -----------
9
-
10
- FlashCanvas is a JavaScript library which adds the HTML5 Canvas support
11
- to Internet Explorer. It renders shapes and images via Flash drawing
12
- API, and in many cases, runs faster than other similar libraries which
13
- use VML or Silverlight.
14
-
15
- FlashCanvas Pro is a professional edition of FlashCanvas. It supports
16
- almost all Canvas APIs including text, shadow and pixel manipulation.
17
- Moreover, it utilizes Flash Player 10 features if available, that
18
- provides better performance and compatibility.
19
-
20
-
21
- Requirements
22
- ------------
23
-
24
- * Microsoft Internet Explorer
25
- * Adobe Flash Player 9 or later
26
-
27
-
28
- Usage
29
- -----
30
-
31
- FlashCanvas Pro consists of JavaScript, Flash and PHP files:
32
-
33
- * flashcanvas.js
34
- * flash9canvas.swf
35
- * flash10canvas.swf
36
- * canvas2png.js (helps you to save a canvas image)
37
- * proxy.php (used to load a file from other domain)
38
- * save.php (used to save a canvas image)
39
-
40
- These files can be found in the bin directory in this distribution
41
- package. To install FlashCanvas Pro, copy these files into some
42
- directory on a Web server, and then add the following HTML code between
43
- <head> and </head> tags on your web page.
44
-
45
- <!--[if lt IE 9]>
46
- <script type="text/javascript" src="path/to/flashcanvas.js"></script>
47
- <![endif]-->
48
-
49
- That's all you have to do in most cases. For more details, please read
50
- the online manual at the project page.
51
-
52
-
53
- License
54
- -------
55
-
56
- FlashCanvas Pro is released under the FlashCanvas Pro License. This
57
- license is based on the MIT License, but includes the following
58
- modifications:
59
-
60
- * Remove the rights to "sublicense, and/or sell copies of the Software".
61
- * Permit to use "free of charge" only for non-profit use.
62
- * Add conditions for commercial use.
63
-
64
- As a result, FlashCanvas Pro is available free of charge for non-profit
65
- use. If you use FlashCanvas Pro for commercial purposes, however, you
66
- are required to purchase a commercial license. This commercial license
67
- includes the following rights:
68
-
69
- * The licensee can use FlashCanvas Pro as many times as needed.
70
- * The licensee can download the latest version of FlashCanvas Pro as
71
- many times as needed.
72
-
73
-
74
- Contact
75
- -------
76
-
77
- If you have a question about FlashCanvas Pro, please utilize the
78
- discussion group and issue tracker found at the project page. If you
79
- need to contact us directly, you can reach us at the e-mail address.
80
-
81
- Project page: http://flashcanvas.net/
82
- E-mail: info@flashcanvas.net
1
+ FlashCanvas Pro
2
+ ===============
3
+
4
+ An implementation of the HTML5 Canvas API for Internet Explorer.
5
+
6
+
7
+ Description
8
+ -----------
9
+
10
+ FlashCanvas is a JavaScript library which adds the HTML5 Canvas support
11
+ to Internet Explorer. It renders shapes and images via Flash drawing
12
+ API, and in many cases, runs faster than other similar libraries which
13
+ use VML or Silverlight.
14
+
15
+ FlashCanvas Pro is a professional edition of FlashCanvas. It supports
16
+ almost all Canvas APIs including text, shadow and pixel manipulation.
17
+ Moreover, it utilizes Flash Player 10 features if available, that
18
+ provides better performance and compatibility.
19
+
20
+
21
+ Requirements
22
+ ------------
23
+
24
+ * Microsoft Internet Explorer
25
+ * Adobe Flash Player 9 or later
26
+
27
+
28
+ Usage
29
+ -----
30
+
31
+ FlashCanvas Pro consists of JavaScript, Flash and PHP files:
32
+
33
+ * flashcanvas.js
34
+ * flash9canvas.swf
35
+ * flash10canvas.swf
36
+ * canvas2png.js (helps you to save a canvas image)
37
+ * proxy.php (used to load a file from other domain)
38
+ * save.php (used to save a canvas image)
39
+
40
+ These files can be found in the bin directory in this distribution
41
+ package. To install FlashCanvas Pro, copy these files into some
42
+ directory on a Web server, and then add the following HTML code between
43
+ <head> and </head> tags on your web page.
44
+
45
+ <!--[if lt IE 9]>
46
+ <script type="text/javascript" src="path/to/flashcanvas.js"></script>
47
+ <![endif]-->
48
+
49
+ That's all you have to do in most cases. For more details, please read
50
+ the online manual at the project page.
51
+
52
+
53
+ License
54
+ -------
55
+
56
+ FlashCanvas Pro is released under the FlashCanvas Pro License. This
57
+ license is based on the MIT License, but includes the following
58
+ modifications:
59
+
60
+ * Remove the rights to "sublicense, and/or sell copies of the Software".
61
+ * Permit to use "free of charge" only for non-profit use.
62
+ * Add conditions for commercial use.
63
+
64
+ As a result, FlashCanvas Pro is available free of charge for non-profit
65
+ use. If you use FlashCanvas Pro for commercial purposes, however, you
66
+ are required to purchase a commercial license. This commercial license
67
+ includes the following rights:
68
+
69
+ * The licensee can use FlashCanvas Pro as many times as needed.
70
+ * The licensee can download the latest version of FlashCanvas Pro as
71
+ many times as needed.
72
+
73
+
74
+ Contact
75
+ -------
76
+
77
+ If you have a question about FlashCanvas Pro, please utilize the
78
+ discussion group and issue tracker found at the project page. If you
79
+ need to contact us directly, you can reach us at the e-mail address.
80
+
81
+ Project page: http://flashcanvas.net/
82
+ E-mail: info@flashcanvas.net
@@ -1,1752 +1,1752 @@
1
- // vim: ts=4 sts=4 sw=4 expandtab
2
- // -- kriskowal Kris Kowal Copyright (C) 2009-2011 MIT License
3
- // -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
4
- // -- dantman Daniel Friesen Copyright (C) 2010 XXX TODO License or CLA
5
- // -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
6
- // -- Gozala Irakli Gozalishvili Copyright (C) 2010 MIT License
7
- // -- kitcambridge Kit Cambridge Copyright (C) 2011 MIT License
8
- // -- kossnocorp Sasha Koss XXX TODO License or CLA
9
- // -- bryanforbes Bryan Forbes XXX TODO License or CLA
10
- // -- killdream Quildreen Motta Copyright (C) 2011 MIT Licence
11
- // -- michaelficarra Michael Ficarra Copyright (C) 2011 3-clause BSD License
12
- // -- sharkbrainguy Gerard Paapu Copyright (C) 2011 MIT License
13
- // -- bbqsrc Brendan Molloy XXX TODO License or CLA
14
- // -- iwyg XXX TODO License or CLA
15
- // -- DomenicDenicola Domenic Denicola XXX TODO License or CLA
16
- // -- xavierm02 Montillet Xavier XXX TODO License or CLA
17
- // -- Raynos Raynos XXX TODO License or CLA
18
- // -- samsonjs Sami Samhuri XXX TODO License or CLA
19
- // -- rwldrn Rick Waldron Copyright (C) 2011 MIT License
20
- // -- lexer Alexey Zakharov XXX TODO License or CLA
21
-
22
- /*!
23
- Copyright (c) 2009, 280 North Inc. http://280north.com/
24
- MIT License. http://github.com/280north/narwhal/blob/master/README.md
25
- */
26
-
27
- (function (undefined) {
28
-
29
- /**
30
- * Brings an environment as close to ECMAScript 5 compliance
31
- * as is possible with the facilities of erstwhile engines.
32
- *
33
- * ES5 Draft
34
- * http://www.ecma-international.org/publications/files/drafts/tc39-2009-050.pdf
35
- *
36
- * NOTE: this is a draft, and as such, the URL is subject to change. If the
37
- * link is broken, check in the parent directory for the latest TC39 PDF.
38
- * http://www.ecma-international.org/publications/files/drafts/
39
- *
40
- * Previous ES5 Draft
41
- * http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
42
- * This is a broken link to the previous draft of ES5 on which most of the
43
- * numbered specification references and quotes herein were taken. Updating
44
- * these references and quotes to reflect the new document would be a welcome
45
- * volunteer project.
46
- *
47
- * @module
48
- */
49
-
50
- /*whatsupdoc*/
51
-
52
- // Shortcut to an often accessed properties, in order to avoid multiple
53
- // dereference that costs universally.
54
- // _Please note: Shortcuts are defined after `Function.prototype.bind` as we
55
- // us it in defining shortcuts.
56
- var call = Function.prototype.call;
57
- var prototypeOfArray = Array.prototype;
58
- var prototypeOfObject = Object.prototype;
59
- var slice = prototypeOfArray.slice;
60
- var owns;
61
- var toString;
62
-
63
- // ES-5 15.3.4.5
64
- // http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
65
-
66
- if (!Function.prototype.bind) {
67
- Function.prototype.bind = function (that) { // .length is 1
68
- // 1. Let Target be the this value.
69
- var target = this;
70
- // 2. If IsCallable(Target) is false, throw a TypeError exception.
71
- if (typeof target != "function")
72
- throw new TypeError(); // TODO message
73
- // 3. Let A be a new (possibly empty) internal list of all of the
74
- // argument values provided after thisArg (arg1, arg2 etc), in order.
75
- // XXX slicedArgs will stand in for "A" if used
76
- var args = slice.call(arguments, 1); // for normal call
77
- // 4. Let F be a new native ECMAScript object.
78
- // 9. Set the [[Prototype]] internal property of F to the standard
79
- // built-in Function prototype object as specified in 15.3.3.1.
80
- // 10. Set the [[Call]] internal property of F as described in
81
- // 15.3.4.5.1.
82
- // 11. Set the [[Construct]] internal property of F as described in
83
- // 15.3.4.5.2.
84
- // 12. Set the [[HasInstance]] internal property of F as described in
85
- // 15.3.4.5.3.
86
- // 13. The [[Scope]] internal property of F is unused and need not
87
- // exist.
88
- var bound = function () {
89
-
90
- if (this instanceof bound) {
91
- // 15.3.4.5.2 [[Construct]]
92
- // When the [[Construct]] internal method of a function object,
93
- // F that was created using the bind function is called with a
94
- // list of arguments ExtraArgs the following steps are taken:
95
- // 1. Let target be the value of F's [[TargetFunction]]
96
- // internal property.
97
- // 2. If target has no [[Construct]] internal method, a
98
- // TypeError exception is thrown.
99
- // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
100
- // property.
101
- // 4. Let args be a new list containing the same values as the
102
- // list boundArgs in the same order followed by the same
103
- // values as the list ExtraArgs in the same order.
104
-
105
- var F = function(){};
106
- F.prototype = target.prototype;
107
- var self = new F;
108
-
109
- var result = target.apply(
110
- self,
111
- args.concat(slice.call(arguments))
112
- );
113
- if (result !== null && Object(result) === result)
114
- return result;
115
- return self;
116
-
117
- } else {
118
- // 15.3.4.5.1 [[Call]]
119
- // When the [[Call]] internal method of a function object, F,
120
- // which was created using the bind function is called with a
121
- // this value and a list of arguments ExtraArgs the following
122
- // steps are taken:
123
- // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
124
- // property.
125
- // 2. Let boundThis be the value of F's [[BoundThis]] internal
126
- // property.
127
- // 3. Let target be the value of F's [[TargetFunction]] internal
128
- // property.
129
- // 4. Let args be a new list containing the same values as the list
130
- // boundArgs in the same order followed by the same values as
131
- // the list ExtraArgs in the same order. 5. Return the
132
- // result of calling the [[Call]] internal method of target
133
- // providing boundThis as the this value and providing args
134
- // as the arguments.
135
-
136
- // equiv: target.call(this, ...boundArgs, ...args)
137
- return target.apply(
138
- that,
139
- args.concat(slice.call(arguments))
140
- );
141
-
142
- }
143
-
144
- };
145
- // XXX bound.length is never writable, so don't even try
146
- //
147
- // 16. The length own property of F is given attributes as specified in
148
- // 15.3.5.1.
149
- // TODO
150
- // 17. Set the [[Extensible]] internal property of F to true.
151
- // TODO
152
- // 18. Call the [[DefineOwnProperty]] internal method of F with
153
- // arguments "caller", PropertyDescriptor {[[Value]]: null,
154
- // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
155
- // false}, and false.
156
- // TODO
157
- // 19. Call the [[DefineOwnProperty]] internal method of F with
158
- // arguments "arguments", PropertyDescriptor {[[Value]]: null,
159
- // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
160
- // false}, and false.
161
- // TODO
162
- // NOTE Function objects created using Function.prototype.bind do not
163
- // have a prototype property.
164
- // XXX can't delete it in pure-js.
165
- return bound;
166
- };
167
- }
168
-
169
- toString = call.bind(prototypeOfObject.toString);
170
- owns = call.bind(prototypeOfObject.hasOwnProperty);
171
-
172
-
173
- //
174
- // Array
175
- // =====
176
- //
177
-
178
- // ES5 15.4.3.2
179
- if (!Array.isArray) {
180
- Array.isArray = function (obj) {
181
- return toString(obj) == "[object Array]";
182
- };
183
- }
184
-
185
- // The IsCallable() check in the Array functions
186
- // has been replaced with a strict check on the
187
- // internal class of the object to trap cases where
188
- // the provided function was actually a regular
189
- // expression literal, which in V8 and
190
- // JavaScriptCore is a typeof "function". Only in
191
- // V8 are regular expression literals permitted as
192
- // reduce parameters, so it is desirable in the
193
- // general case for the shim to match the more
194
- // strict and common behavior of rejecting regular
195
- // expressions.
196
-
197
- // ES5 15.4.4.18
198
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach
199
- if (!Array.prototype.forEach) {
200
- Array.prototype.forEach = function (fun /*, thisp*/) {
201
- var self = toObject(this),
202
- thisp = arguments[1],
203
- i = 0,
204
- length = self.length >>> 0;
205
-
206
- // If no callback function or if callback is not a callable function
207
- if (toString(fun) != "[object Function]") {
208
- throw new TypeError(); // TODO message
209
- }
210
-
211
- while (i < length) {
212
- if (i in self) {
213
- // Invoke the callback function with call, passing arguments:
214
- // context, property value, property key, thisArg object context
215
- fun.call(thisp, self[i], i, self);
216
- }
217
- i++;
218
- }
219
- };
220
- }
221
-
222
- // ES5 15.4.4.19
223
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
224
- if (!Array.prototype.map) {
225
- Array.prototype.map = function (fun /*, thisp*/) {
226
- var self = toObject(this),
227
- length = self.length >>> 0,
228
- result = Array(length),
229
- thisp = arguments[1];
230
-
231
- // If no callback function or if callback is not a callable function
232
- if (toString(fun) != "[object Function]") {
233
- throw new TypeError(); // TODO message
234
- }
235
-
236
- for (var i = 0; i < length; i++) {
237
- if (i in self)
238
- result[i] = fun.call(thisp, self[i], i, self);
239
- }
240
- return result;
241
- };
242
- }
243
-
244
- // ES5 15.4.4.20
245
- if (!Array.prototype.filter) {
246
- Array.prototype.filter = function (fun /*, thisp */) {
247
- var self = toObject(this),
248
- length = self.length >>> 0,
249
- result = [],
250
- thisp = arguments[1];
251
-
252
- // If no callback function or if callback is not a callable function
253
- if (toString(fun) != "[object Function]") {
254
- throw new TypeError(); // TODO message
255
- }
256
-
257
- for (var i = 0; i < length; i++) {
258
- if (i in self && fun.call(thisp, self[i], i, self))
259
- result.push(self[i]);
260
- }
261
- return result;
262
- };
263
- }
264
-
265
- // ES5 15.4.4.16
266
- if (!Array.prototype.every) {
267
- Array.prototype.every = function (fun /*, thisp */) {
268
- var self = toObject(this),
269
- length = self.length >>> 0,
270
- thisp = arguments[1];
271
-
272
- // If no callback function or if callback is not a callable function
273
- if (toString(fun) != "[object Function]") {
274
- throw new TypeError(); // TODO message
275
- }
276
-
277
- for (var i = 0; i < length; i++) {
278
- if (i in self && !fun.call(thisp, self[i], i, self))
279
- return false;
280
- }
281
- return true;
282
- };
283
- }
284
-
285
- // ES5 15.4.4.17
286
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
287
- if (!Array.prototype.some) {
288
- Array.prototype.some = function (fun /*, thisp */) {
289
- var self = toObject(this),
290
- length = self.length >>> 0,
291
- thisp = arguments[1];
292
-
293
- // If no callback function or if callback is not a callable function
294
- if (toString(fun) != "[object Function]") {
295
- throw new TypeError(); // TODO message
296
- }
297
-
298
- for (var i = 0; i < length; i++) {
299
- if (i in self && fun.call(thisp, self[i], i, self))
300
- return true;
301
- }
302
- return false;
303
- };
304
- }
305
-
306
- // ES5 15.4.4.21
307
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
308
- if (!Array.prototype.reduce) {
309
- Array.prototype.reduce = function (fun /*, initial*/) {
310
- var self = toObject(this),
311
- length = self.length >>> 0;
312
-
313
- // If no callback function or if callback is not a callable function
314
- if (toString(fun) != "[object Function]") {
315
- throw new TypeError(); // TODO message
316
- }
317
-
318
- // no value to return if no initial value and an empty array
319
- if (!length && arguments.length == 1)
320
- throw new TypeError(); // TODO message
321
-
322
- var i = 0;
323
- var result;
324
- if (arguments.length >= 2) {
325
- result = arguments[1];
326
- } else {
327
- do {
328
- if (i in self) {
329
- result = self[i++];
330
- break;
331
- }
332
-
333
- // if array contains no values, no initial value to return
334
- if (++i >= length)
335
- throw new TypeError(); // TODO message
336
- } while (true);
337
- }
338
-
339
- for (; i < length; i++) {
340
- if (i in self)
341
- result = fun.call(void 0, result, self[i], i, self);
342
- }
343
-
344
- return result;
345
- };
346
- }
347
-
348
- // ES5 15.4.4.22
349
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
350
- if (!Array.prototype.reduceRight) {
351
- Array.prototype.reduceRight = function (fun /*, initial*/) {
352
- var self = toObject(this),
353
- length = self.length >>> 0;
354
-
355
- // If no callback function or if callback is not a callable function
356
- if (toString(fun) != "[object Function]") {
357
- throw new TypeError(); // TODO message
358
- }
359
-
360
- // no value to return if no initial value, empty array
361
- if (!length && arguments.length == 1)
362
- throw new TypeError(); // TODO message
363
-
364
- var result, i = length - 1;
365
- if (arguments.length >= 2) {
366
- result = arguments[1];
367
- } else {
368
- do {
369
- if (i in self) {
370
- result = self[i--];
371
- break;
372
- }
373
-
374
- // if array contains no values, no initial value to return
375
- if (--i < 0)
376
- throw new TypeError(); // TODO message
377
- } while (true);
378
- }
379
-
380
- do {
381
- if (i in this)
382
- result = fun.call(void 0, result, self[i], i, self);
383
- } while (i--);
384
-
385
- return result;
386
- };
387
- }
388
-
389
- // ES5 15.4.4.14
390
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
391
- if (!Array.prototype.indexOf) {
392
- Array.prototype.indexOf = function (sought /*, fromIndex */ ) {
393
- var self = toObject(this),
394
- length = self.length >>> 0;
395
-
396
- if (!length)
397
- return -1;
398
-
399
- var i = 0;
400
- if (arguments.length > 1)
401
- i = toInteger(arguments[1]);
402
-
403
- // handle negative indices
404
- i = i >= 0 ? i : length - Math.abs(i);
405
- for (; i < length; i++) {
406
- if (i in self && self[i] === sought) {
407
- return i;
408
- }
409
- }
410
- return -1;
411
- };
412
- }
413
-
414
- // ES5 15.4.4.15
415
- if (!Array.prototype.lastIndexOf) {
416
- Array.prototype.lastIndexOf = function (sought /*, fromIndex */) {
417
- var self = toObject(this),
418
- length = self.length >>> 0;
419
-
420
- if (!length)
421
- return -1;
422
- var i = length - 1;
423
- if (arguments.length > 1)
424
- i = toInteger(arguments[1]);
425
- // handle negative indices
426
- i = i >= 0 ? i : length - Math.abs(i);
427
- for (; i >= 0; i--) {
428
- if (i in self && sought === self[i])
429
- return i;
430
- }
431
- return -1;
432
- };
433
- }
434
-
435
- //
436
- // Array
437
- // =====
438
- //
439
-
440
- // ES5 15.4.4.12
441
- // http://es5.github.com/#x15.4.4.12
442
- // Default value for second param
443
- // [bugfix, ielt9, old browsers]
444
- // IE < 9 bug: [1,2].splice(0).join("") == "" but should be "12"
445
- if([1,2].splice(0).length != 2) {
446
- var _origArraySplice = Array.prototype.splice;
447
-
448
- Array.prototype.splice = function(start, deleteCount) {
449
- if(!arguments.length)return [];
450
-
451
- return _origArraySplice.apply(this, [
452
- start === void 0 ? 0 : start,
453
- deleteCount === void 0 ? (this.length - start) : deleteCount
454
- ].concat(slice.call(arguments, 2)))
455
- };
456
- }
457
-
458
- //
459
- // Object
460
- // ======
461
- //
462
-
463
-
464
- // ES5 15.2.3.14
465
- // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
466
- if (!Object.keys) {
467
-
468
- var hasDontEnumBug = true,
469
- dontEnums = [
470
- "toString",
471
- "toLocaleString",
472
- "valueOf",
473
- "hasOwnProperty",
474
- "isPrototypeOf",
475
- "propertyIsEnumerable",
476
- "constructor"
477
- ],
478
- dontEnumsLength = dontEnums.length;
479
-
480
- for (var key in {"toString": null})
481
- hasDontEnumBug = false;
482
-
483
- Object.keys = function keys(object) {
484
-
485
- if ((typeof object != "object" && typeof object != "function") || object === null)
486
- throw new TypeError("Object.keys called on a non-object");
487
-
488
- var keys = [];
489
- for (var name in object) {
490
- if (owns(object, name)) {
491
- keys.push(name);
492
- }
493
- }
494
-
495
- if (hasDontEnumBug) {
496
- for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
497
- var dontEnum = dontEnums[i];
498
- if (owns(object, dontEnum)) {
499
- keys.push(dontEnum);
500
- }
501
- }
502
- }
503
-
504
- return keys;
505
- };
506
-
507
- }
508
-
509
- //
510
- // Date
511
- // ====
512
- //
513
-
514
- // ES5 15.9.5.43
515
- // Format a Date object as a string according to a simplified subset of the ISO 8601
516
- // standard as defined in 15.9.1.15.
517
- if (!Date.prototype.toISOString) {
518
- Date.prototype.toISOString = function toISOString() {
519
- var result, length, value;
520
- if (!isFinite(this))
521
- throw new RangeError;
522
-
523
- // the date time string format is specified in 15.9.1.15.
524
- result = [this.getUTCFullYear(), this.getUTCMonth() + 1, this.getUTCDate(),
525
- this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
526
-
527
- length = result.length;
528
- while (length--) {
529
- value = result[length];
530
- // pad months, days, hours, minutes, and seconds to have two digits.
531
- if (value < 10)
532
- result[length] = "0" + value;
533
- }
534
- // pad milliseconds to have three digits.
535
- return result.slice(0, 3).join("-") + "T" + result.slice(3).join(":") + "." +
536
- ("000" + this.getUTCMilliseconds()).slice(-3) + "Z";
537
- }
538
- }
539
-
540
- // ES5 15.9.4.4
541
- if (!Date.now) {
542
- Date.now = function now() {
543
- return new Date().getTime();
544
- };
545
- }
546
-
547
- // ES5 15.9.5.44
548
- if (!Date.prototype.toJSON) {
549
- Date.prototype.toJSON = function toJSON(key) {
550
- // This function provides a String representation of a Date object for
551
- // use by JSON.stringify (15.12.3). When the toJSON method is called
552
- // with argument key, the following steps are taken:
553
-
554
- // 1. Let O be the result of calling ToObject, giving it the this
555
- // value as its argument.
556
- // 2. Let tv be ToPrimitive(O, hint Number).
557
- // 3. If tv is a Number and is not finite, return null.
558
- // XXX
559
- // 4. Let toISO be the result of calling the [[Get]] internal method of
560
- // O with argument "toISOString".
561
- // 5. If IsCallable(toISO) is false, throw a TypeError exception.
562
- if (typeof this.toISOString != "function")
563
- throw new TypeError(); // TODO message
564
- // 6. Return the result of calling the [[Call]] internal method of
565
- // toISO with O as the this value and an empty argument list.
566
- return this.toISOString();
567
-
568
- // NOTE 1 The argument is ignored.
569
-
570
- // NOTE 2 The toJSON function is intentionally generic; it does not
571
- // require that its this value be a Date object. Therefore, it can be
572
- // transferred to other kinds of objects for use as a method. However,
573
- // it does require that any such object have a toISOString method. An
574
- // object is free to use the argument key to filter its
575
- // stringification.
576
- };
577
- }
578
-
579
-
580
- //
581
- // String
582
- // ======
583
- //
584
-
585
- // ES5 15.5.4.20
586
- var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
587
- "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
588
- "\u2029\uFEFF";
589
- if (!String.prototype.trim || ws.trim()) {
590
- // http://blog.stevenlevithan.com/archives/faster-trim-javascript
591
- // http://perfectionkills.com/whitespace-deviations/
592
- ws = "[" + ws + "]";
593
- var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
594
- trimEndRegexp = new RegExp(ws + ws + "*$");
595
- String.prototype.trim = function trim() {
596
- return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
597
- };
598
- }
599
-
600
- // ES5 15.5.4.14
601
- // http://es5.github.com/#x15.5.4.14
602
- // [bugfix, chrome]
603
- // If separator is undefined, then the result array contains just one String, which is the this value (converted to a String). If limit is not undefined, then the output array is truncated so that it contains no more than limit elements.
604
- // "0".split(undefined, 0) -> []
605
- if("0".split(void 0, 0).length) {
606
- var oldSplit = String.prototype.split;
607
- String.prototype.split = function(separator, limit) {
608
- if(separator === void 0 && limit === 0)return [];
609
- return oldSplit.apply(this, arguments);
610
- }
611
- }
612
-
613
- // ECMA-262, 3rd B.2.3
614
- // Note an ECMAScript standart, although ECMAScript 3rd Edition has a non-normative section suggesting uniform semantics
615
- // and it should be normalized across all browsers
616
- // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
617
- if("".substr && "0b".substr(-1) !== "b") {
618
- var oldSubstr = String.prototype.substr;
619
- /**
620
- * Get the substring of a string
621
- * @param {integer} start where to start the substring
622
- * @param {integer} length how many characters to return
623
- * @return {string}
624
- */
625
- String.prototype.substr = function(start, length) {
626
- return oldSubstr.call(this, start < 0 ? (start = this.length + start) < 0 ? 0 : start : start, length);
627
- }
628
- }
629
-
630
- //
631
- // Util
632
- // ======
633
- //
634
-
635
- // http://jsperf.com/to-integer
636
- var toInteger = function (n) {
637
- n = +n;
638
- if (n !== n) // isNaN
639
- n = -1;
640
- else if (n !== 0 && n !== (1/0) && n !== -(1/0))
641
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
642
- return n;
643
- };
644
-
645
- var prepareString = "a"[0] != "a",
646
- // ES5 9.9
647
- toObject = function (o) {
648
- if (o == null) { // this matches both null and undefined
649
- throw new TypeError(); // TODO message
650
- }
651
- // If the implementation doesn't support by-index access of
652
- // string characters (ex. IE < 7), split the string
653
- if (prepareString && typeof o == "string" && o) {
654
- return o.split("");
655
- }
656
- return Object(o);
657
- };
658
-
659
- })();
660
-
661
-
662
-
663
- (function($, shims){
664
- var defineProperty = 'defineProperty';
665
- var advancedObjectProperties = !!(Object.create && Object.defineProperties && Object.getOwnPropertyDescriptor);
666
- //safari5 has defineProperty-interface, but it can't be used on dom-object
667
- //only do this test in non-IE browsers, because this hurts dhtml-behavior in some IE8 versions
668
- if (advancedObjectProperties && !$.browser.msie && Object[defineProperty] && Object.prototype.__defineGetter__) {
669
- (function(){
670
- try {
671
- var foo = document.createElement('foo');
672
- Object[defineProperty](foo, 'bar', {
673
- get: function(){
674
- return true;
675
- }
676
- });
677
- advancedObjectProperties = !!foo.bar;
678
- }
679
- catch (e) {
680
- advancedObjectProperties = false;
681
- }
682
- foo = null;
683
- })();
684
- }
685
-
686
- Modernizr.objectAccessor = !!((advancedObjectProperties || (Object.prototype.__defineGetter__ && Object.prototype.__lookupSetter__)) && (!$.browser.opera || shims.browserVersion >= 11));
687
- Modernizr.advancedObjectProperties = advancedObjectProperties;
688
-
689
- if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !Object.getOwnPropertyDescriptor || !Object.defineProperty)){
690
- var call = Function.prototype.call;
691
- var prototypeOfObject = Object.prototype;
692
- var owns = call.bind(prototypeOfObject.hasOwnProperty);
693
-
694
- shims.objectCreate = function(proto, props, opts, no__proto__){
695
- var o;
696
- var f = function(){};
697
-
698
- f.prototype = proto;
699
- o = new f();
700
-
701
- if(!no__proto__ && !('__proto__' in o) && !Modernizr.objectAccessor){
702
- o.__proto__ = proto;
703
- }
704
-
705
- if(props){
706
- shims.defineProperties(o, props);
707
- }
708
-
709
- if(opts){
710
- o.options = jQuery.extend(true, {}, o.options || {}, opts);
711
- opts = o.options;
712
- }
713
-
714
- if(o._create && jQuery.isFunction(o._create)){
715
- o._create(opts);
716
- }
717
- return o;
718
- };
719
-
720
- shims.defineProperties = function(object, props){
721
- for (var name in props) {
722
- if (owns(props, name)) {
723
- shims.defineProperty(object, name, props[name]);
724
- }
725
- }
726
- return object;
727
- };
728
-
729
- var descProps = ['configurable', 'enumerable', 'writable'];
730
- shims.defineProperty = function(proto, property, descriptor){
731
- if(typeof descriptor != "object" || descriptor === null){return proto;}
732
-
733
- if(owns(descriptor, "value")){
734
- proto[property] = descriptor.value;
735
- return proto;
736
- }
737
-
738
- if(proto.__defineGetter__){
739
- if (typeof descriptor.get == "function") {
740
- proto.__defineGetter__(property, descriptor.get);
741
- }
742
- if (typeof descriptor.set == "function"){
743
- proto.__defineSetter__(property, descriptor.set);
744
- }
745
- }
746
- return proto;
747
- };
748
-
749
- shims.getPrototypeOf = function (object) {
750
- return Object.getPrototypeOf && Object.getPrototypeOf(object) || object.__proto__ || object.constructor && object.constructor.prototype;
751
- };
752
-
753
- //based on http://www.refactory.org/s/object_getownpropertydescriptor/view/latest
754
- shims.getOwnPropertyDescriptor = function(obj, prop){
755
- if (typeof obj !== "object" && typeof obj !== "function" || obj === null){
756
- throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object");
757
- }
758
- var descriptor;
759
- if(Object.defineProperty && Object.getOwnPropertyDescriptor){
760
- try{
761
- descriptor = Object.getOwnPropertyDescriptor(obj, prop);
762
- return descriptor;
763
- } catch(e){}
764
- }
765
- descriptor = {
766
- configurable: true,
767
- enumerable: true,
768
- writable: true,
769
- value: undefined
770
- };
771
- var getter = obj.__lookupGetter__ && obj.__lookupGetter__(prop),
772
- setter = obj.__lookupSetter__ && obj.__lookupSetter__(prop)
773
- ;
774
-
775
- if (!getter && !setter) { // not an accessor so return prop
776
- if(!owns(obj, prop)){
777
- return;
778
- }
779
- descriptor.value = obj[prop];
780
- return descriptor;
781
- }
782
-
783
- // there is an accessor, remove descriptor.writable; populate descriptor.get and descriptor.set
784
- delete descriptor.writable;
785
- delete descriptor.value;
786
- descriptor.get = descriptor.set = undefined;
787
-
788
- if(getter){
789
- descriptor.get = getter;
790
- }
791
-
792
- if(setter){
793
- descriptor.set = setter;
794
- }
795
-
796
- return descriptor;
797
- };
798
-
799
- }
800
- })(jQuery, jQuery.webshims);
801
-
802
-
803
-
804
- //DOM-Extension helper
805
- jQuery.webshims.register('dom-extend', function($, webshims, window, document, undefined){
806
- "use strict";
807
- //shortcus
808
- var modules = webshims.modules;
809
- var listReg = /\s*,\s*/;
810
-
811
- //proxying attribute
812
- var olds = {};
813
- var havePolyfill = {};
814
- var extendedProps = {};
815
- var extendQ = {};
816
- var modifyProps = {};
817
-
818
- var oldVal = $.fn.val;
819
- var singleVal = function(elem, name, val, pass, _argless){
820
- return (_argless) ? oldVal.call($(elem)) : oldVal.call($(elem), val);
821
- };
822
- $.fn.val = function(val){
823
- var elem = this[0];
824
- if(arguments.length && val == null){
825
- val = '';
826
- }
827
- if(!arguments.length){
828
- if(!elem || elem.nodeType !== 1){return oldVal.call(this);}
829
- return $.prop(elem, 'value', val, 'val', true);
830
- }
831
- if($.isArray(val)){
832
- return oldVal.apply(this, arguments);
833
- }
834
- var isFunction = $.isFunction(val);
835
- return this.each(function(i){
836
- elem = this;
837
- if(elem.nodeType === 1){
838
- if(isFunction){
839
- var genVal = val.call( elem, i, $.prop(elem, 'value', undefined, 'val', true));
840
- if(genVal == null){
841
- genVal = '';
842
- }
843
- $.prop(elem, 'value', genVal, 'val') ;
844
- } else {
845
- $.prop(elem, 'value', val, 'val');
846
- }
847
- }
848
- });
849
- };
850
-
851
- var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
852
- var elementData = function(elem, key, val){
853
- elem = elem.jquery ? elem[0] : elem;
854
- if(!elem){return val || {};}
855
- var data = $.data(elem, dataID);
856
- if(val !== undefined){
857
- if(!data){
858
- data = $.data(elem, dataID, {});
859
- }
860
- if(key){
861
- data[key] = val;
862
- }
863
- }
864
-
865
- return key ? data && data[key] : data;
866
- };
867
-
868
-
869
- [{name: 'getNativeElement', prop: 'nativeElement'}, {name: 'getShadowElement', prop: 'shadowElement'}, {name: 'getShadowFocusElement', prop: 'shadowFocusElement'}].forEach(function(data){
870
- $.fn[data.name] = function(){
871
- return this.map(function(){
872
- var shadowData = elementData(this, 'shadowData');
873
- return shadowData && shadowData[data.prop] || this;
874
- });
875
- };
876
- });
877
-
878
-
879
- ['removeAttr', 'prop', 'attr'].forEach(function(type){
880
- olds[type] = $[type];
881
- $[type] = function(elem, name, value, pass, _argless){
882
- var isVal = (pass == 'val');
883
- var oldMethod = !isVal ? olds[type] : singleVal;
884
- if( !elem || !havePolyfill[name] || elem.nodeType !== 1 || (!isVal && pass && type == 'attr' && $.attrFn[name]) ){
885
- return oldMethod(elem, name, value, pass, _argless);
886
- }
887
-
888
- var nodeName = (elem.nodeName || '').toLowerCase();
889
- var desc = extendedProps[nodeName];
890
- var curType = (type == 'attr' && (value === false || value === null)) ? 'removeAttr' : type;
891
- var propMethod;
892
- var oldValMethod;
893
- var ret;
894
-
895
-
896
- if(!desc){
897
- desc = extendedProps['*'];
898
- }
899
- if(desc){
900
- desc = desc[name];
901
- }
902
-
903
- if(desc){
904
- propMethod = desc[curType];
905
- }
906
-
907
- if(propMethod){
908
- if(name == 'value'){
909
- oldValMethod = propMethod.isVal;
910
- propMethod.isVal = isVal;
911
- }
912
- if(curType === 'removeAttr'){
913
- return propMethod.value.call(elem);
914
- } else if(value === undefined){
915
- return (propMethod.get) ?
916
- propMethod.get.call(elem) :
917
- propMethod.value
918
- ;
919
- } else if(propMethod.set) {
920
- if(type == 'attr' && value === true){
921
- value = name;
922
- }
923
-
924
- ret = propMethod.set.call(elem, value);
925
- }
926
- if(name == 'value'){
927
- propMethod.isVal = oldValMethod;
928
- }
929
- } else {
930
- ret = oldMethod(elem, name, value, pass, _argless);
931
- }
932
- if((value !== undefined || curType === 'removeAttr') && modifyProps[nodeName] && modifyProps[nodeName][name]){
933
-
934
- var boolValue;
935
- if(curType == 'removeAttr'){
936
- boolValue = false;
937
- } else if(curType == 'prop'){
938
- boolValue = !!(value);
939
- } else {
940
- boolValue = true;
941
- }
942
-
943
- modifyProps[nodeName][name].forEach(function(fn){
944
- if(!fn.only || (fn.only = 'prop' && type == 'prop') || (fn.only == 'attr' && type != 'prop')){
945
- fn.call(elem, value, boolValue, (isVal) ? 'val' : curType, type);
946
- }
947
- });
948
- }
949
- return ret;
950
- };
951
-
952
- extendQ[type] = function(nodeName, prop, desc){
953
-
954
- if(!extendedProps[nodeName]){
955
- extendedProps[nodeName] = {};
956
- }
957
- if(!extendedProps[nodeName][prop]){
958
- extendedProps[nodeName][prop] = {};
959
- }
960
- var oldDesc = extendedProps[nodeName][prop][type];
961
- var getSup = function(propType, descriptor, oDesc){
962
- if(descriptor && descriptor[propType]){
963
- return descriptor[propType];
964
- }
965
- if(oDesc && oDesc[propType]){
966
- return oDesc[propType];
967
- }
968
- if(type == 'prop' && prop == 'value'){
969
- return function(value){
970
- var elem = this;
971
- return (desc.isVal) ?
972
- singleVal(elem, prop, value, false, (arguments.length === 0)) :
973
- olds[type](elem, prop, value)
974
- ;
975
- };
976
- }
977
- if(type == 'prop' && propType == 'value' && desc.value.apply){
978
- return function(value){
979
- var sup = olds[type](this, prop);
980
- if(sup && sup.apply){
981
- sup = sup.apply(this, arguments);
982
- }
983
- return sup;
984
- };
985
- }
986
- return function(value){
987
- return olds[type](this, prop, value);
988
- };
989
- };
990
- extendedProps[nodeName][prop][type] = desc;
991
- if(desc.value === undefined){
992
- if(!desc.set){
993
- desc.set = desc.writeable ?
994
- getSup('set', desc, oldDesc) :
995
- (webshims.cfg.useStrict && prop == 'prop') ?
996
- function(){throw(prop +' is readonly on '+ nodeName);} :
997
- $.noop
998
- ;
999
- }
1000
- if(!desc.get){
1001
- desc.get = getSup('get', desc, oldDesc);
1002
- }
1003
-
1004
- }
1005
-
1006
- ['value', 'get', 'set'].forEach(function(descProp){
1007
- if(desc[descProp]){
1008
- desc['_sup'+descProp] = getSup(descProp, oldDesc);
1009
- }
1010
- });
1011
- };
1012
-
1013
- });
1014
-
1015
- //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
1016
- var isExtendNativeSave = (!$.browser.msie || parseInt($.browser.version, 10) > 8);
1017
- var extendNativeValue = (function(){
1018
- var UNKNOWN = webshims.getPrototypeOf(document.createElement('foobar'));
1019
- var has = Object.prototype.hasOwnProperty;
1020
- return function(nodeName, prop, desc){
1021
- var elem = document.createElement(nodeName);
1022
- var elemProto = webshims.getPrototypeOf(elem);
1023
- if( isExtendNativeSave && elemProto && UNKNOWN !== elemProto && ( !elem[prop] || !has.call(elem, prop) ) ){
1024
- var sup = elem[prop];
1025
- desc._supvalue = function(){
1026
- if(sup && sup.apply){
1027
- return sup.apply(this, arguments);
1028
- }
1029
- return sup;
1030
- };
1031
- elemProto[prop] = desc.value;
1032
- } else {
1033
- desc._supvalue = function(){
1034
- var data = elementData(this, 'propValue');
1035
- if(data && data[prop] && data[prop].apply){
1036
- return data[prop].apply(this, arguments);
1037
- }
1038
- return data && data[prop];
1039
- };
1040
- initProp.extendValue(nodeName, prop, desc.value);
1041
- }
1042
- desc.value._supvalue = desc._supvalue;
1043
- };
1044
- })();
1045
-
1046
- var initProp = (function(){
1047
-
1048
- var initProps = {};
1049
-
1050
- webshims.addReady(function(context, contextElem){
1051
- var nodeNameCache = {};
1052
- var getElementsByName = function(name){
1053
- if(!nodeNameCache[name]){
1054
- nodeNameCache[name] = $(context.getElementsByTagName(name));
1055
- if(contextElem[0] && $.nodeName(contextElem[0], name)){
1056
- nodeNameCache[name] = nodeNameCache[name].add(contextElem);
1057
- }
1058
- }
1059
- };
1060
-
1061
-
1062
- $.each(initProps, function(name, fns){
1063
- getElementsByName(name);
1064
- if(!fns || !fns.forEach){
1065
- webshims.warn('Error: with '+ name +'-property. methods: '+ fns);
1066
- return;
1067
- }
1068
- fns.forEach(function(fn){
1069
- nodeNameCache[name].each(fn);
1070
- });
1071
- });
1072
- nodeNameCache = null;
1073
- });
1074
-
1075
- var tempCache;
1076
- var emptyQ = $([]);
1077
- var createNodeNameInit = function(nodeName, fn){
1078
- if(!initProps[nodeName]){
1079
- initProps[nodeName] = [fn];
1080
- } else {
1081
- initProps[nodeName].push(fn);
1082
- }
1083
- if($.isDOMReady){
1084
- (tempCache || $( document.getElementsByTagName(nodeName) )).each(fn);
1085
- }
1086
- };
1087
-
1088
- var elementExtends = {};
1089
- return {
1090
- createTmpCache: function(nodeName){
1091
- if($.isDOMReady){
1092
- tempCache = tempCache || $( document.getElementsByTagName(nodeName) );
1093
- }
1094
- return tempCache || emptyQ;
1095
- },
1096
- flushTmpCache: function(){
1097
- tempCache = null;
1098
- },
1099
- content: function(nodeName, prop){
1100
- createNodeNameInit(nodeName, function(){
1101
- var val = $.attr(this, prop);
1102
- if(val != null){
1103
- $.attr(this, prop, val);
1104
- }
1105
- });
1106
- },
1107
- createElement: function(nodeName, fn){
1108
- createNodeNameInit(nodeName, fn);
1109
- },
1110
- extendValue: function(nodeName, prop, value){
1111
- createNodeNameInit(nodeName, function(){
1112
- $(this).each(function(){
1113
- var data = elementData(this, 'propValue', {});
1114
- data[prop] = this[prop];
1115
- this[prop] = value;
1116
- });
1117
- });
1118
- }
1119
- };
1120
- })();
1121
-
1122
- var createPropDefault = function(descs, removeType){
1123
- if(descs.defaultValue === undefined){
1124
- descs.defaultValue = '';
1125
- }
1126
- if(!descs.removeAttr){
1127
- descs.removeAttr = {
1128
- value: function(){
1129
- descs[removeType || 'prop'].set.call(this, descs.defaultValue);
1130
- descs.removeAttr._supvalue.call(this);
1131
- }
1132
- };
1133
- }
1134
- if(!descs.attr){
1135
- descs.attr = {};
1136
- }
1137
- };
1138
-
1139
- $.extend(webshims, {
1140
-
1141
- getID: (function(){
1142
- var ID = new Date().getTime();
1143
- return function(elem){
1144
- elem = $(elem);
1145
- var id = elem.attr('id');
1146
- if(!id){
1147
- ID++;
1148
- id = 'ID-'+ ID;
1149
- elem.attr('id', id);
1150
- }
1151
- return id;
1152
- };
1153
- })(),
1154
- extendUNDEFProp: function(obj, props){
1155
- $.each(props, function(name, prop){
1156
- if( !(name in obj) ){
1157
- obj[name] = prop;
1158
- }
1159
- });
1160
- },
1161
- //http://www.w3.org/TR/html5/common-dom-interfaces.html#reflect
1162
- createPropDefault: createPropDefault,
1163
- data: elementData,
1164
- moveToFirstEvent: function(elem, eventType, bindType){
1165
- var events = ($._data(elem, 'events') || {})[eventType];
1166
- var fn;
1167
-
1168
- if(events && events.length > 1){
1169
- fn = events.pop();
1170
- if(!bindType){
1171
- bindType = 'bind';
1172
- }
1173
- if(bindType == 'bind' && events.delegateCount){
1174
- events.splice( events.delegateCount, 0, fn);
1175
- } else {
1176
- events.unshift( fn );
1177
- }
1178
-
1179
-
1180
- }
1181
- elem = null;
1182
- },
1183
- addShadowDom: (function(){
1184
- var resizeTimer;
1185
- var lastHeight;
1186
- var lastWidth;
1187
-
1188
- var docObserve = {
1189
- init: false,
1190
- runs: 0,
1191
- test: function(){
1192
- var height = docObserve.getHeight();
1193
- var width = docObserve.getWidth();
1194
-
1195
- if(height != docObserve.height || width != docObserve.width){
1196
- docObserve.height = height;
1197
- docObserve.width = width;
1198
- docObserve.handler({type: 'docresize'});
1199
- docObserve.runs++;
1200
- if(docObserve.runs < 9){
1201
- setTimeout(docObserve.test, 90);
1202
- }
1203
- } else {
1204
- docObserve.runs = 0;
1205
- }
1206
- },
1207
- handler: function(e){
1208
- clearTimeout(resizeTimer);
1209
- resizeTimer = setTimeout(function(){
1210
- if(e.type == 'resize'){
1211
- var width = $(window).width();
1212
- var height = $(window).width();
1213
- if(height == lastHeight && width == lastWidth){
1214
- return;
1215
- }
1216
- lastHeight = height;
1217
- lastWidth = width;
1218
-
1219
- docObserve.height = docObserve.getHeight();
1220
- docObserve.width = docObserve.getWidth();
1221
-
1222
- }
1223
- $.event.trigger('updateshadowdom');
1224
- }, (e.type == 'resize') ? 50 : 9);
1225
- },
1226
- _create: function(){
1227
- $.each({ Height: "getHeight", Width: "getWidth" }, function(name, type){
1228
- var body = document.body;
1229
- var doc = document.documentElement;
1230
- docObserve[type] = function(){
1231
- return Math.max(
1232
- body[ "scroll" + name ], doc[ "scroll" + name ],
1233
- body[ "offset" + name ], doc[ "offset" + name ],
1234
- doc[ "client" + name ]
1235
- );
1236
- };
1237
- });
1238
- },
1239
- start: function(){
1240
- if(!this.init && document.body){
1241
- this.init = true;
1242
- this._create();
1243
- this.height = docObserve.getHeight();
1244
- this.width = docObserve.getWidth();
1245
- setInterval(this.test, 600);
1246
- $(this.test);
1247
- webshims.ready('WINDOWLOAD', this.test);
1248
- $(window).bind('resize', this.handler);
1249
- (function(){
1250
- var oldAnimate = $.fn.animate;
1251
- var animationTimer;
1252
-
1253
- $.fn.animate = function(){
1254
- clearTimeout(animationTimer);
1255
- animationTimer = setTimeout(function(){
1256
- docObserve.test();
1257
- }, 99);
1258
-
1259
- return oldAnimate.apply(this, arguments);
1260
- };
1261
- })();
1262
- }
1263
- }
1264
- };
1265
-
1266
-
1267
- $.event.customEvent.updateshadowdom = true;
1268
- webshims.docObserve = function(){
1269
- webshims.ready('DOM', function(){
1270
- docObserve.start();
1271
- });
1272
- };
1273
- return function(nativeElem, shadowElem, opts){
1274
- opts = opts || {};
1275
- if(nativeElem.jquery){
1276
- nativeElem = nativeElem[0];
1277
- }
1278
- if(shadowElem.jquery){
1279
- shadowElem = shadowElem[0];
1280
- }
1281
- var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1282
- var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1283
- var shadowFocusElementData = {};
1284
- if(!opts.shadowFocusElement){
1285
- opts.shadowFocusElement = shadowElem;
1286
- } else if(opts.shadowFocusElement){
1287
- if(opts.shadowFocusElement.jquery){
1288
- opts.shadowFocusElement = opts.shadowFocusElement[0];
1289
- }
1290
- shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1291
- }
1292
-
1293
- nativeData.hasShadow = shadowElem;
1294
- shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1295
- shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1296
- nativeElement: nativeElem,
1297
- shadowElement: shadowElem,
1298
- shadowFocusElement: opts.shadowFocusElement
1299
- };
1300
- if(opts.shadowChilds){
1301
- opts.shadowChilds.each(function(){
1302
- elementData(this, 'shadowData', shadowData.shadowData);
1303
- });
1304
- }
1305
-
1306
- if(opts.data){
1307
- shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1308
- }
1309
- opts = null;
1310
- webshims.docObserve();
1311
- };
1312
- })(),
1313
- propTypes: {
1314
- standard: function(descs, name){
1315
- createPropDefault(descs);
1316
- if(descs.prop){return;}
1317
- descs.prop = {
1318
- set: function(val){
1319
- descs.attr.set.call(this, ''+val);
1320
- },
1321
- get: function(){
1322
- return descs.attr.get.call(this) || descs.defaultValue;
1323
- }
1324
- };
1325
-
1326
- },
1327
- "boolean": function(descs, name){
1328
-
1329
- createPropDefault(descs);
1330
- if(descs.prop){return;}
1331
- descs.prop = {
1332
- set: function(val){
1333
- if(val){
1334
- descs.attr.set.call(this, "");
1335
- } else {
1336
- descs.removeAttr.value.call(this);
1337
- }
1338
- },
1339
- get: function(){
1340
- return descs.attr.get.call(this) != null;
1341
- }
1342
- };
1343
- },
1344
- "src": (function(){
1345
- var anchor = document.createElement('a');
1346
- anchor.style.display = "none";
1347
- return function(descs, name){
1348
-
1349
- createPropDefault(descs);
1350
- if(descs.prop){return;}
1351
- descs.prop = {
1352
- set: function(val){
1353
- descs.attr.set.call(this, val);
1354
- },
1355
- get: function(){
1356
- var href = this.getAttribute(name);
1357
- var ret;
1358
- if(href == null){return '';}
1359
-
1360
- anchor.setAttribute('href', href+'' );
1361
-
1362
- if(!$.support.hrefNormalized){
1363
- try {
1364
- $(anchor).insertAfter(this);
1365
- ret = anchor.getAttribute('href', 4);
1366
- } catch(er){
1367
- ret = anchor.getAttribute('href', 4);
1368
- }
1369
- $(anchor).detach();
1370
- }
1371
- return ret || anchor.href;
1372
- }
1373
- };
1374
- };
1375
- })(),
1376
- enumarated: function(descs, name){
1377
-
1378
- createPropDefault(descs);
1379
- if(descs.prop){return;}
1380
- descs.prop = {
1381
- set: function(val){
1382
- descs.attr.set.call(this, val);
1383
- },
1384
- get: function(){
1385
- var val = (descs.attr.get.call(this) || '').toLowerCase();
1386
- if(!val || descs.limitedTo.indexOf(val) == -1){
1387
- val = descs.defaultValue;
1388
- }
1389
- return val;
1390
- }
1391
- };
1392
- }
1393
-
1394
- // ,unsignedLong: $.noop
1395
- // ,"doubble": $.noop
1396
- // ,"long": $.noop
1397
- // ,tokenlist: $.noop
1398
- // ,settableTokenlist: $.noop
1399
- },
1400
- reflectProperties: function(nodeNames, props){
1401
- if(typeof props == 'string'){
1402
- props = props.split(listReg);
1403
- }
1404
- props.forEach(function(prop){
1405
- webshims.defineNodeNamesProperty(nodeNames, prop, {
1406
- prop: {
1407
- set: function(val){
1408
- $.attr(this, prop, val);
1409
- },
1410
- get: function(){
1411
- return $.attr(this, prop) || '';
1412
- }
1413
- }
1414
- });
1415
- });
1416
- },
1417
- defineNodeNameProperty: function(nodeName, prop, descs){
1418
- havePolyfill[prop] = true;
1419
-
1420
- if(descs.reflect){
1421
- webshims.propTypes[descs.propType || 'standard'](descs, prop);
1422
- }
1423
-
1424
- ['prop', 'attr', 'removeAttr'].forEach(function(type){
1425
- var desc = descs[type];
1426
- if(desc){
1427
- if(type === 'prop'){
1428
- desc = $.extend({writeable: true}, desc);
1429
- } else {
1430
- desc = $.extend({}, desc, {writeable: true});
1431
- }
1432
-
1433
- extendQ[type](nodeName, prop, desc);
1434
- if(nodeName != '*' && webshims.cfg.extendNative && type == 'prop' && desc.value && $.isFunction(desc.value)){
1435
- extendNativeValue(nodeName, prop, desc);
1436
- }
1437
- descs[type] = desc;
1438
- }
1439
- });
1440
- if(descs.initAttr){
1441
- initProp.content(nodeName, prop);
1442
- }
1443
- return descs;
1444
- },
1445
-
1446
- defineNodeNameProperties: function(name, descs, propType, _noTmpCache){
1447
- var olddesc;
1448
- for(var prop in descs){
1449
- if(!_noTmpCache && descs[prop].initAttr){
1450
- initProp.createTmpCache(name);
1451
- }
1452
- if(propType){
1453
- if(descs[prop][propType]){
1454
- //webshims.log('override: '+ name +'['+prop +'] for '+ propType);
1455
- } else {
1456
- descs[prop][propType] = {};
1457
- ['value', 'set', 'get'].forEach(function(copyProp){
1458
- if(copyProp in descs[prop]){
1459
- descs[prop][propType][copyProp] = descs[prop][copyProp];
1460
- delete descs[prop][copyProp];
1461
- }
1462
- });
1463
- }
1464
- }
1465
- descs[prop] = webshims.defineNodeNameProperty(name, prop, descs[prop]);
1466
- }
1467
- if(!_noTmpCache){
1468
- initProp.flushTmpCache();
1469
- }
1470
- return descs;
1471
- },
1472
-
1473
- createElement: function(nodeName, create, descs){
1474
- var ret;
1475
- if($.isFunction(create)){
1476
- create = {
1477
- after: create
1478
- };
1479
- }
1480
- initProp.createTmpCache(nodeName);
1481
- if(create.before){
1482
- initProp.createElement(nodeName, create.before);
1483
- }
1484
- if(descs){
1485
- ret = webshims.defineNodeNameProperties(nodeName, descs, false, true);
1486
- }
1487
- if(create.after){
1488
- initProp.createElement(nodeName, create.after);
1489
- }
1490
- initProp.flushTmpCache();
1491
- return ret;
1492
- },
1493
- onNodeNamesPropertyModify: function(nodeNames, props, desc, only){
1494
- if(typeof nodeNames == 'string'){
1495
- nodeNames = nodeNames.split(listReg);
1496
- }
1497
- if($.isFunction(desc)){
1498
- desc = {set: desc};
1499
- }
1500
-
1501
- nodeNames.forEach(function(name){
1502
- if(!modifyProps[name]){
1503
- modifyProps[name] = {};
1504
- }
1505
- if(typeof props == 'string'){
1506
- props = props.split(listReg);
1507
- }
1508
- if(desc.initAttr){
1509
- initProp.createTmpCache(name);
1510
- }
1511
- props.forEach(function(prop){
1512
- if(!modifyProps[name][prop]){
1513
- modifyProps[name][prop] = [];
1514
- havePolyfill[prop] = true;
1515
- }
1516
- if(desc.set){
1517
- if(only){
1518
- desc.set.only = only;
1519
- }
1520
- modifyProps[name][prop].push(desc.set);
1521
- }
1522
-
1523
- if(desc.initAttr){
1524
- initProp.content(name, prop);
1525
- }
1526
- });
1527
- initProp.flushTmpCache();
1528
-
1529
- });
1530
- },
1531
- defineNodeNamesBooleanProperty: function(elementNames, prop, descs){
1532
- if(!descs){
1533
- descs = {};
1534
- }
1535
- if($.isFunction(descs)){
1536
- descs.set = descs;
1537
- }
1538
- webshims.defineNodeNamesProperty(elementNames, prop, {
1539
- attr: {
1540
- set: function(val){
1541
- this.setAttribute(prop, val);
1542
- if(descs.set){
1543
- descs.set.call(this, true);
1544
- }
1545
- },
1546
- get: function(){
1547
- var ret = this.getAttribute(prop);
1548
- return (ret == null) ? undefined : prop;
1549
- }
1550
- },
1551
- removeAttr: {
1552
- value: function(){
1553
- this.removeAttribute(prop);
1554
- if(descs.set){
1555
- descs.set.call(this, false);
1556
- }
1557
- }
1558
- },
1559
- reflect: true,
1560
- propType: 'boolean',
1561
- initAttr: descs.initAttr || false
1562
- });
1563
- },
1564
- contentAttr: function(elem, name, val){
1565
- if(!elem.nodeName){return;}
1566
- var attr;
1567
- if(val === undefined){
1568
- attr = (elem.attributes[name] || {});
1569
- val = attr.specified ? attr.value : null;
1570
- return (val == null) ? undefined : val;
1571
- }
1572
-
1573
- if(typeof val == 'boolean'){
1574
- if(!val){
1575
- elem.removeAttribute(name);
1576
- } else {
1577
- elem.setAttribute(name, name);
1578
- }
1579
- } else {
1580
- elem.setAttribute(name, val);
1581
- }
1582
- },
1583
-
1584
- // set current Lang:
1585
- // - webshims.activeLang(lang:string);
1586
- // get current lang
1587
- // - webshims.activeLang();
1588
- // get current lang
1589
- // webshims.activeLang({
1590
- // register: moduleName:string,
1591
- // callback: callback:function
1592
- // });
1593
- // get/set including removeLang
1594
- // - webshims.activeLang({
1595
- // module: moduleName:string,
1596
- // callback: callback:function,
1597
- // langObj: languageObj:array/object
1598
- // });
1599
- activeLang: (function(){
1600
- var callbacks = [];
1601
- var registeredCallbacks = {};
1602
- var currentLang;
1603
- var shortLang;
1604
- var notLocal = /:\/\/|^\.*\//;
1605
- var loadRemoteLang = function(data, lang, options){
1606
- var langSrc;
1607
- if(lang && options && $.inArray(lang, options.availabeLangs || []) !== -1){
1608
- data.loading = true;
1609
- langSrc = options.langSrc;
1610
- if(!notLocal.test(langSrc)){
1611
- langSrc = webshims.cfg.basePath+langSrc;
1612
- }
1613
- webshims.loader.loadScript(langSrc+lang+'.js', function(){
1614
- if(data.langObj[lang]){
1615
- data.loading = false;
1616
- callLang(data, true);
1617
- } else {
1618
- $(function(){
1619
- if(data.langObj[lang]){
1620
- callLang(data, true);
1621
- }
1622
- data.loading = false;
1623
- });
1624
- }
1625
- });
1626
- return true;
1627
- }
1628
- return false;
1629
- };
1630
- var callRegister = function(module){
1631
- if(registeredCallbacks[module]){
1632
- registeredCallbacks[module].forEach(function(data){
1633
- data.callback();
1634
- });
1635
- }
1636
- };
1637
- var callLang = function(data, _noLoop){
1638
- if(data.activeLang != currentLang && data.activeLang !== shortLang){
1639
- var options = modules[data.module].options;
1640
- if( data.langObj[currentLang] || (shortLang && data.langObj[shortLang]) ){
1641
- data.activeLang = currentLang;
1642
- data.callback(data.langObj[currentLang] || data.langObj[shortLang], currentLang);
1643
- callRegister(data.module);
1644
- } else if( !_noLoop &&
1645
- !loadRemoteLang(data, currentLang, options) &&
1646
- !loadRemoteLang(data, shortLang, options) &&
1647
- data.langObj[''] && data.activeLang !== '' ) {
1648
- data.activeLang = '';
1649
- data.callback(data.langObj[''], currentLang);
1650
- callRegister(data.module);
1651
- }
1652
- }
1653
- };
1654
-
1655
-
1656
- var activeLang = function(lang){
1657
-
1658
- if(typeof lang == 'string' && lang !== currentLang){
1659
- currentLang = lang;
1660
- shortLang = currentLang.split('-')[0];
1661
- if(currentLang == shortLang){
1662
- shortLang = false;
1663
- }
1664
- $.each(callbacks, function(i, data){
1665
- callLang(data);
1666
- });
1667
- } else if(typeof lang == 'object'){
1668
-
1669
- if(lang.register){
1670
- if(!registeredCallbacks[lang.register]){
1671
- registeredCallbacks[lang.register] = [];
1672
- }
1673
- registeredCallbacks[lang.register].push(lang);
1674
- lang.callback();
1675
- } else {
1676
- if(!lang.activeLang){
1677
- lang.activeLang = '';
1678
- }
1679
- callbacks.push(lang);
1680
- callLang(lang);
1681
- }
1682
- }
1683
- return currentLang;
1684
- };
1685
-
1686
- return activeLang;
1687
- })()
1688
- });
1689
-
1690
- $.each({
1691
- defineNodeNamesProperty: 'defineNodeNameProperty',
1692
- defineNodeNamesProperties: 'defineNodeNameProperties',
1693
- createElements: 'createElement'
1694
- }, function(name, baseMethod){
1695
- webshims[name] = function(names, a, b, c){
1696
- if(typeof names == 'string'){
1697
- names = names.split(listReg);
1698
- }
1699
- var retDesc = {};
1700
- names.forEach(function(nodeName){
1701
- retDesc[nodeName] = webshims[baseMethod](nodeName, a, b, c);
1702
- });
1703
- return retDesc;
1704
- };
1705
- });
1706
-
1707
- webshims.isReady('webshimLocalization', true);
1708
- });
1709
- //html5a11y
1710
- (function($, document){
1711
- var browserVersion = $.webshims.browserVersion;
1712
- if($.browser.mozilla && browserVersion > 5){return;}
1713
- if (!$.browser.msie || (browserVersion < 12 && browserVersion > 7)) {
1714
- var elemMappings = {
1715
- article: "article",
1716
- aside: "complementary",
1717
- section: "region",
1718
- nav: "navigation",
1719
- address: "contentinfo"
1720
- };
1721
- var addRole = function(elem, role){
1722
- var hasRole = elem.getAttribute('role');
1723
- if (!hasRole) {
1724
- elem.setAttribute('role', role);
1725
- }
1726
- };
1727
-
1728
- $.webshims.addReady(function(context, contextElem){
1729
- $.each(elemMappings, function(name, role){
1730
- var elems = $(name, context).add(contextElem.filter(name));
1731
- for (var i = 0, len = elems.length; i < len; i++) {
1732
- addRole(elems[i], role);
1733
- }
1734
- });
1735
- if (context === document) {
1736
- var header = document.getElementsByTagName('header')[0];
1737
- var footers = document.getElementsByTagName('footer');
1738
- var footerLen = footers.length;
1739
- if (header && !$(header).closest('section, article')[0]) {
1740
- addRole(header, 'banner');
1741
- }
1742
- if (!footerLen) {
1743
- return;
1744
- }
1745
- var footer = footers[footerLen - 1];
1746
- if (!$(footer).closest('section, article')[0]) {
1747
- addRole(footer, 'contentinfo');
1748
- }
1749
- }
1750
- });
1751
- }
1752
- })(jQuery, document);
1
+ // vim: ts=4 sts=4 sw=4 expandtab
2
+ // -- kriskowal Kris Kowal Copyright (C) 2009-2011 MIT License
3
+ // -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
4
+ // -- dantman Daniel Friesen Copyright (C) 2010 XXX TODO License or CLA
5
+ // -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
6
+ // -- Gozala Irakli Gozalishvili Copyright (C) 2010 MIT License
7
+ // -- kitcambridge Kit Cambridge Copyright (C) 2011 MIT License
8
+ // -- kossnocorp Sasha Koss XXX TODO License or CLA
9
+ // -- bryanforbes Bryan Forbes XXX TODO License or CLA
10
+ // -- killdream Quildreen Motta Copyright (C) 2011 MIT Licence
11
+ // -- michaelficarra Michael Ficarra Copyright (C) 2011 3-clause BSD License
12
+ // -- sharkbrainguy Gerard Paapu Copyright (C) 2011 MIT License
13
+ // -- bbqsrc Brendan Molloy XXX TODO License or CLA
14
+ // -- iwyg XXX TODO License or CLA
15
+ // -- DomenicDenicola Domenic Denicola XXX TODO License or CLA
16
+ // -- xavierm02 Montillet Xavier XXX TODO License or CLA
17
+ // -- Raynos Raynos XXX TODO License or CLA
18
+ // -- samsonjs Sami Samhuri XXX TODO License or CLA
19
+ // -- rwldrn Rick Waldron Copyright (C) 2011 MIT License
20
+ // -- lexer Alexey Zakharov XXX TODO License or CLA
21
+
22
+ /*!
23
+ Copyright (c) 2009, 280 North Inc. http://280north.com/
24
+ MIT License. http://github.com/280north/narwhal/blob/master/README.md
25
+ */
26
+
27
+ (function (undefined) {
28
+
29
+ /**
30
+ * Brings an environment as close to ECMAScript 5 compliance
31
+ * as is possible with the facilities of erstwhile engines.
32
+ *
33
+ * ES5 Draft
34
+ * http://www.ecma-international.org/publications/files/drafts/tc39-2009-050.pdf
35
+ *
36
+ * NOTE: this is a draft, and as such, the URL is subject to change. If the
37
+ * link is broken, check in the parent directory for the latest TC39 PDF.
38
+ * http://www.ecma-international.org/publications/files/drafts/
39
+ *
40
+ * Previous ES5 Draft
41
+ * http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
42
+ * This is a broken link to the previous draft of ES5 on which most of the
43
+ * numbered specification references and quotes herein were taken. Updating
44
+ * these references and quotes to reflect the new document would be a welcome
45
+ * volunteer project.
46
+ *
47
+ * @module
48
+ */
49
+
50
+ /*whatsupdoc*/
51
+
52
+ // Shortcut to an often accessed properties, in order to avoid multiple
53
+ // dereference that costs universally.
54
+ // _Please note: Shortcuts are defined after `Function.prototype.bind` as we
55
+ // us it in defining shortcuts.
56
+ var call = Function.prototype.call;
57
+ var prototypeOfArray = Array.prototype;
58
+ var prototypeOfObject = Object.prototype;
59
+ var slice = prototypeOfArray.slice;
60
+ var owns;
61
+ var toString;
62
+
63
+ // ES-5 15.3.4.5
64
+ // http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
65
+
66
+ if (!Function.prototype.bind) {
67
+ Function.prototype.bind = function (that) { // .length is 1
68
+ // 1. Let Target be the this value.
69
+ var target = this;
70
+ // 2. If IsCallable(Target) is false, throw a TypeError exception.
71
+ if (typeof target != "function")
72
+ throw new TypeError(); // TODO message
73
+ // 3. Let A be a new (possibly empty) internal list of all of the
74
+ // argument values provided after thisArg (arg1, arg2 etc), in order.
75
+ // XXX slicedArgs will stand in for "A" if used
76
+ var args = slice.call(arguments, 1); // for normal call
77
+ // 4. Let F be a new native ECMAScript object.
78
+ // 9. Set the [[Prototype]] internal property of F to the standard
79
+ // built-in Function prototype object as specified in 15.3.3.1.
80
+ // 10. Set the [[Call]] internal property of F as described in
81
+ // 15.3.4.5.1.
82
+ // 11. Set the [[Construct]] internal property of F as described in
83
+ // 15.3.4.5.2.
84
+ // 12. Set the [[HasInstance]] internal property of F as described in
85
+ // 15.3.4.5.3.
86
+ // 13. The [[Scope]] internal property of F is unused and need not
87
+ // exist.
88
+ var bound = function () {
89
+
90
+ if (this instanceof bound) {
91
+ // 15.3.4.5.2 [[Construct]]
92
+ // When the [[Construct]] internal method of a function object,
93
+ // F that was created using the bind function is called with a
94
+ // list of arguments ExtraArgs the following steps are taken:
95
+ // 1. Let target be the value of F's [[TargetFunction]]
96
+ // internal property.
97
+ // 2. If target has no [[Construct]] internal method, a
98
+ // TypeError exception is thrown.
99
+ // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
100
+ // property.
101
+ // 4. Let args be a new list containing the same values as the
102
+ // list boundArgs in the same order followed by the same
103
+ // values as the list ExtraArgs in the same order.
104
+
105
+ var F = function(){};
106
+ F.prototype = target.prototype;
107
+ var self = new F;
108
+
109
+ var result = target.apply(
110
+ self,
111
+ args.concat(slice.call(arguments))
112
+ );
113
+ if (result !== null && Object(result) === result)
114
+ return result;
115
+ return self;
116
+
117
+ } else {
118
+ // 15.3.4.5.1 [[Call]]
119
+ // When the [[Call]] internal method of a function object, F,
120
+ // which was created using the bind function is called with a
121
+ // this value and a list of arguments ExtraArgs the following
122
+ // steps are taken:
123
+ // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
124
+ // property.
125
+ // 2. Let boundThis be the value of F's [[BoundThis]] internal
126
+ // property.
127
+ // 3. Let target be the value of F's [[TargetFunction]] internal
128
+ // property.
129
+ // 4. Let args be a new list containing the same values as the list
130
+ // boundArgs in the same order followed by the same values as
131
+ // the list ExtraArgs in the same order. 5. Return the
132
+ // result of calling the [[Call]] internal method of target
133
+ // providing boundThis as the this value and providing args
134
+ // as the arguments.
135
+
136
+ // equiv: target.call(this, ...boundArgs, ...args)
137
+ return target.apply(
138
+ that,
139
+ args.concat(slice.call(arguments))
140
+ );
141
+
142
+ }
143
+
144
+ };
145
+ // XXX bound.length is never writable, so don't even try
146
+ //
147
+ // 16. The length own property of F is given attributes as specified in
148
+ // 15.3.5.1.
149
+ // TODO
150
+ // 17. Set the [[Extensible]] internal property of F to true.
151
+ // TODO
152
+ // 18. Call the [[DefineOwnProperty]] internal method of F with
153
+ // arguments "caller", PropertyDescriptor {[[Value]]: null,
154
+ // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
155
+ // false}, and false.
156
+ // TODO
157
+ // 19. Call the [[DefineOwnProperty]] internal method of F with
158
+ // arguments "arguments", PropertyDescriptor {[[Value]]: null,
159
+ // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
160
+ // false}, and false.
161
+ // TODO
162
+ // NOTE Function objects created using Function.prototype.bind do not
163
+ // have a prototype property.
164
+ // XXX can't delete it in pure-js.
165
+ return bound;
166
+ };
167
+ }
168
+
169
+ toString = call.bind(prototypeOfObject.toString);
170
+ owns = call.bind(prototypeOfObject.hasOwnProperty);
171
+
172
+
173
+ //
174
+ // Array
175
+ // =====
176
+ //
177
+
178
+ // ES5 15.4.3.2
179
+ if (!Array.isArray) {
180
+ Array.isArray = function (obj) {
181
+ return toString(obj) == "[object Array]";
182
+ };
183
+ }
184
+
185
+ // The IsCallable() check in the Array functions
186
+ // has been replaced with a strict check on the
187
+ // internal class of the object to trap cases where
188
+ // the provided function was actually a regular
189
+ // expression literal, which in V8 and
190
+ // JavaScriptCore is a typeof "function". Only in
191
+ // V8 are regular expression literals permitted as
192
+ // reduce parameters, so it is desirable in the
193
+ // general case for the shim to match the more
194
+ // strict and common behavior of rejecting regular
195
+ // expressions.
196
+
197
+ // ES5 15.4.4.18
198
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach
199
+ if (!Array.prototype.forEach) {
200
+ Array.prototype.forEach = function (fun /*, thisp*/) {
201
+ var self = toObject(this),
202
+ thisp = arguments[1],
203
+ i = 0,
204
+ length = self.length >>> 0;
205
+
206
+ // If no callback function or if callback is not a callable function
207
+ if (toString(fun) != "[object Function]") {
208
+ throw new TypeError(); // TODO message
209
+ }
210
+
211
+ while (i < length) {
212
+ if (i in self) {
213
+ // Invoke the callback function with call, passing arguments:
214
+ // context, property value, property key, thisArg object context
215
+ fun.call(thisp, self[i], i, self);
216
+ }
217
+ i++;
218
+ }
219
+ };
220
+ }
221
+
222
+ // ES5 15.4.4.19
223
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
224
+ if (!Array.prototype.map) {
225
+ Array.prototype.map = function (fun /*, thisp*/) {
226
+ var self = toObject(this),
227
+ length = self.length >>> 0,
228
+ result = Array(length),
229
+ thisp = arguments[1];
230
+
231
+ // If no callback function or if callback is not a callable function
232
+ if (toString(fun) != "[object Function]") {
233
+ throw new TypeError(); // TODO message
234
+ }
235
+
236
+ for (var i = 0; i < length; i++) {
237
+ if (i in self)
238
+ result[i] = fun.call(thisp, self[i], i, self);
239
+ }
240
+ return result;
241
+ };
242
+ }
243
+
244
+ // ES5 15.4.4.20
245
+ if (!Array.prototype.filter) {
246
+ Array.prototype.filter = function (fun /*, thisp */) {
247
+ var self = toObject(this),
248
+ length = self.length >>> 0,
249
+ result = [],
250
+ thisp = arguments[1];
251
+
252
+ // If no callback function or if callback is not a callable function
253
+ if (toString(fun) != "[object Function]") {
254
+ throw new TypeError(); // TODO message
255
+ }
256
+
257
+ for (var i = 0; i < length; i++) {
258
+ if (i in self && fun.call(thisp, self[i], i, self))
259
+ result.push(self[i]);
260
+ }
261
+ return result;
262
+ };
263
+ }
264
+
265
+ // ES5 15.4.4.16
266
+ if (!Array.prototype.every) {
267
+ Array.prototype.every = function (fun /*, thisp */) {
268
+ var self = toObject(this),
269
+ length = self.length >>> 0,
270
+ thisp = arguments[1];
271
+
272
+ // If no callback function or if callback is not a callable function
273
+ if (toString(fun) != "[object Function]") {
274
+ throw new TypeError(); // TODO message
275
+ }
276
+
277
+ for (var i = 0; i < length; i++) {
278
+ if (i in self && !fun.call(thisp, self[i], i, self))
279
+ return false;
280
+ }
281
+ return true;
282
+ };
283
+ }
284
+
285
+ // ES5 15.4.4.17
286
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
287
+ if (!Array.prototype.some) {
288
+ Array.prototype.some = function (fun /*, thisp */) {
289
+ var self = toObject(this),
290
+ length = self.length >>> 0,
291
+ thisp = arguments[1];
292
+
293
+ // If no callback function or if callback is not a callable function
294
+ if (toString(fun) != "[object Function]") {
295
+ throw new TypeError(); // TODO message
296
+ }
297
+
298
+ for (var i = 0; i < length; i++) {
299
+ if (i in self && fun.call(thisp, self[i], i, self))
300
+ return true;
301
+ }
302
+ return false;
303
+ };
304
+ }
305
+
306
+ // ES5 15.4.4.21
307
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
308
+ if (!Array.prototype.reduce) {
309
+ Array.prototype.reduce = function (fun /*, initial*/) {
310
+ var self = toObject(this),
311
+ length = self.length >>> 0;
312
+
313
+ // If no callback function or if callback is not a callable function
314
+ if (toString(fun) != "[object Function]") {
315
+ throw new TypeError(); // TODO message
316
+ }
317
+
318
+ // no value to return if no initial value and an empty array
319
+ if (!length && arguments.length == 1)
320
+ throw new TypeError(); // TODO message
321
+
322
+ var i = 0;
323
+ var result;
324
+ if (arguments.length >= 2) {
325
+ result = arguments[1];
326
+ } else {
327
+ do {
328
+ if (i in self) {
329
+ result = self[i++];
330
+ break;
331
+ }
332
+
333
+ // if array contains no values, no initial value to return
334
+ if (++i >= length)
335
+ throw new TypeError(); // TODO message
336
+ } while (true);
337
+ }
338
+
339
+ for (; i < length; i++) {
340
+ if (i in self)
341
+ result = fun.call(void 0, result, self[i], i, self);
342
+ }
343
+
344
+ return result;
345
+ };
346
+ }
347
+
348
+ // ES5 15.4.4.22
349
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
350
+ if (!Array.prototype.reduceRight) {
351
+ Array.prototype.reduceRight = function (fun /*, initial*/) {
352
+ var self = toObject(this),
353
+ length = self.length >>> 0;
354
+
355
+ // If no callback function or if callback is not a callable function
356
+ if (toString(fun) != "[object Function]") {
357
+ throw new TypeError(); // TODO message
358
+ }
359
+
360
+ // no value to return if no initial value, empty array
361
+ if (!length && arguments.length == 1)
362
+ throw new TypeError(); // TODO message
363
+
364
+ var result, i = length - 1;
365
+ if (arguments.length >= 2) {
366
+ result = arguments[1];
367
+ } else {
368
+ do {
369
+ if (i in self) {
370
+ result = self[i--];
371
+ break;
372
+ }
373
+
374
+ // if array contains no values, no initial value to return
375
+ if (--i < 0)
376
+ throw new TypeError(); // TODO message
377
+ } while (true);
378
+ }
379
+
380
+ do {
381
+ if (i in this)
382
+ result = fun.call(void 0, result, self[i], i, self);
383
+ } while (i--);
384
+
385
+ return result;
386
+ };
387
+ }
388
+
389
+ // ES5 15.4.4.14
390
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
391
+ if (!Array.prototype.indexOf) {
392
+ Array.prototype.indexOf = function (sought /*, fromIndex */ ) {
393
+ var self = toObject(this),
394
+ length = self.length >>> 0;
395
+
396
+ if (!length)
397
+ return -1;
398
+
399
+ var i = 0;
400
+ if (arguments.length > 1)
401
+ i = toInteger(arguments[1]);
402
+
403
+ // handle negative indices
404
+ i = i >= 0 ? i : length - Math.abs(i);
405
+ for (; i < length; i++) {
406
+ if (i in self && self[i] === sought) {
407
+ return i;
408
+ }
409
+ }
410
+ return -1;
411
+ };
412
+ }
413
+
414
+ // ES5 15.4.4.15
415
+ if (!Array.prototype.lastIndexOf) {
416
+ Array.prototype.lastIndexOf = function (sought /*, fromIndex */) {
417
+ var self = toObject(this),
418
+ length = self.length >>> 0;
419
+
420
+ if (!length)
421
+ return -1;
422
+ var i = length - 1;
423
+ if (arguments.length > 1)
424
+ i = toInteger(arguments[1]);
425
+ // handle negative indices
426
+ i = i >= 0 ? i : length - Math.abs(i);
427
+ for (; i >= 0; i--) {
428
+ if (i in self && sought === self[i])
429
+ return i;
430
+ }
431
+ return -1;
432
+ };
433
+ }
434
+
435
+ //
436
+ // Array
437
+ // =====
438
+ //
439
+
440
+ // ES5 15.4.4.12
441
+ // http://es5.github.com/#x15.4.4.12
442
+ // Default value for second param
443
+ // [bugfix, ielt9, old browsers]
444
+ // IE < 9 bug: [1,2].splice(0).join("") == "" but should be "12"
445
+ if([1,2].splice(0).length != 2) {
446
+ var _origArraySplice = Array.prototype.splice;
447
+
448
+ Array.prototype.splice = function(start, deleteCount) {
449
+ if(!arguments.length)return [];
450
+
451
+ return _origArraySplice.apply(this, [
452
+ start === void 0 ? 0 : start,
453
+ deleteCount === void 0 ? (this.length - start) : deleteCount
454
+ ].concat(slice.call(arguments, 2)))
455
+ };
456
+ }
457
+
458
+ //
459
+ // Object
460
+ // ======
461
+ //
462
+
463
+
464
+ // ES5 15.2.3.14
465
+ // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
466
+ if (!Object.keys) {
467
+
468
+ var hasDontEnumBug = true,
469
+ dontEnums = [
470
+ "toString",
471
+ "toLocaleString",
472
+ "valueOf",
473
+ "hasOwnProperty",
474
+ "isPrototypeOf",
475
+ "propertyIsEnumerable",
476
+ "constructor"
477
+ ],
478
+ dontEnumsLength = dontEnums.length;
479
+
480
+ for (var key in {"toString": null})
481
+ hasDontEnumBug = false;
482
+
483
+ Object.keys = function keys(object) {
484
+
485
+ if ((typeof object != "object" && typeof object != "function") || object === null)
486
+ throw new TypeError("Object.keys called on a non-object");
487
+
488
+ var keys = [];
489
+ for (var name in object) {
490
+ if (owns(object, name)) {
491
+ keys.push(name);
492
+ }
493
+ }
494
+
495
+ if (hasDontEnumBug) {
496
+ for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
497
+ var dontEnum = dontEnums[i];
498
+ if (owns(object, dontEnum)) {
499
+ keys.push(dontEnum);
500
+ }
501
+ }
502
+ }
503
+
504
+ return keys;
505
+ };
506
+
507
+ }
508
+
509
+ //
510
+ // Date
511
+ // ====
512
+ //
513
+
514
+ // ES5 15.9.5.43
515
+ // Format a Date object as a string according to a simplified subset of the ISO 8601
516
+ // standard as defined in 15.9.1.15.
517
+ if (!Date.prototype.toISOString) {
518
+ Date.prototype.toISOString = function toISOString() {
519
+ var result, length, value;
520
+ if (!isFinite(this))
521
+ throw new RangeError;
522
+
523
+ // the date time string format is specified in 15.9.1.15.
524
+ result = [this.getUTCFullYear(), this.getUTCMonth() + 1, this.getUTCDate(),
525
+ this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
526
+
527
+ length = result.length;
528
+ while (length--) {
529
+ value = result[length];
530
+ // pad months, days, hours, minutes, and seconds to have two digits.
531
+ if (value < 10)
532
+ result[length] = "0" + value;
533
+ }
534
+ // pad milliseconds to have three digits.
535
+ return result.slice(0, 3).join("-") + "T" + result.slice(3).join(":") + "." +
536
+ ("000" + this.getUTCMilliseconds()).slice(-3) + "Z";
537
+ }
538
+ }
539
+
540
+ // ES5 15.9.4.4
541
+ if (!Date.now) {
542
+ Date.now = function now() {
543
+ return new Date().getTime();
544
+ };
545
+ }
546
+
547
+ // ES5 15.9.5.44
548
+ if (!Date.prototype.toJSON) {
549
+ Date.prototype.toJSON = function toJSON(key) {
550
+ // This function provides a String representation of a Date object for
551
+ // use by JSON.stringify (15.12.3). When the toJSON method is called
552
+ // with argument key, the following steps are taken:
553
+
554
+ // 1. Let O be the result of calling ToObject, giving it the this
555
+ // value as its argument.
556
+ // 2. Let tv be ToPrimitive(O, hint Number).
557
+ // 3. If tv is a Number and is not finite, return null.
558
+ // XXX
559
+ // 4. Let toISO be the result of calling the [[Get]] internal method of
560
+ // O with argument "toISOString".
561
+ // 5. If IsCallable(toISO) is false, throw a TypeError exception.
562
+ if (typeof this.toISOString != "function")
563
+ throw new TypeError(); // TODO message
564
+ // 6. Return the result of calling the [[Call]] internal method of
565
+ // toISO with O as the this value and an empty argument list.
566
+ return this.toISOString();
567
+
568
+ // NOTE 1 The argument is ignored.
569
+
570
+ // NOTE 2 The toJSON function is intentionally generic; it does not
571
+ // require that its this value be a Date object. Therefore, it can be
572
+ // transferred to other kinds of objects for use as a method. However,
573
+ // it does require that any such object have a toISOString method. An
574
+ // object is free to use the argument key to filter its
575
+ // stringification.
576
+ };
577
+ }
578
+
579
+
580
+ //
581
+ // String
582
+ // ======
583
+ //
584
+
585
+ // ES5 15.5.4.20
586
+ var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
587
+ "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
588
+ "\u2029\uFEFF";
589
+ if (!String.prototype.trim || ws.trim()) {
590
+ // http://blog.stevenlevithan.com/archives/faster-trim-javascript
591
+ // http://perfectionkills.com/whitespace-deviations/
592
+ ws = "[" + ws + "]";
593
+ var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
594
+ trimEndRegexp = new RegExp(ws + ws + "*$");
595
+ String.prototype.trim = function trim() {
596
+ return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
597
+ };
598
+ }
599
+
600
+ // ES5 15.5.4.14
601
+ // http://es5.github.com/#x15.5.4.14
602
+ // [bugfix, chrome]
603
+ // If separator is undefined, then the result array contains just one String, which is the this value (converted to a String). If limit is not undefined, then the output array is truncated so that it contains no more than limit elements.
604
+ // "0".split(undefined, 0) -> []
605
+ if("0".split(void 0, 0).length) {
606
+ var oldSplit = String.prototype.split;
607
+ String.prototype.split = function(separator, limit) {
608
+ if(separator === void 0 && limit === 0)return [];
609
+ return oldSplit.apply(this, arguments);
610
+ }
611
+ }
612
+
613
+ // ECMA-262, 3rd B.2.3
614
+ // Note an ECMAScript standart, although ECMAScript 3rd Edition has a non-normative section suggesting uniform semantics
615
+ // and it should be normalized across all browsers
616
+ // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
617
+ if("".substr && "0b".substr(-1) !== "b") {
618
+ var oldSubstr = String.prototype.substr;
619
+ /**
620
+ * Get the substring of a string
621
+ * @param {integer} start where to start the substring
622
+ * @param {integer} length how many characters to return
623
+ * @return {string}
624
+ */
625
+ String.prototype.substr = function(start, length) {
626
+ return oldSubstr.call(this, start < 0 ? (start = this.length + start) < 0 ? 0 : start : start, length);
627
+ }
628
+ }
629
+
630
+ //
631
+ // Util
632
+ // ======
633
+ //
634
+
635
+ // http://jsperf.com/to-integer
636
+ var toInteger = function (n) {
637
+ n = +n;
638
+ if (n !== n) // isNaN
639
+ n = -1;
640
+ else if (n !== 0 && n !== (1/0) && n !== -(1/0))
641
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
642
+ return n;
643
+ };
644
+
645
+ var prepareString = "a"[0] != "a",
646
+ // ES5 9.9
647
+ toObject = function (o) {
648
+ if (o == null) { // this matches both null and undefined
649
+ throw new TypeError(); // TODO message
650
+ }
651
+ // If the implementation doesn't support by-index access of
652
+ // string characters (ex. IE < 7), split the string
653
+ if (prepareString && typeof o == "string" && o) {
654
+ return o.split("");
655
+ }
656
+ return Object(o);
657
+ };
658
+
659
+ })();
660
+
661
+
662
+
663
+ (function($, shims){
664
+ var defineProperty = 'defineProperty';
665
+ var advancedObjectProperties = !!(Object.create && Object.defineProperties && Object.getOwnPropertyDescriptor);
666
+ //safari5 has defineProperty-interface, but it can't be used on dom-object
667
+ //only do this test in non-IE browsers, because this hurts dhtml-behavior in some IE8 versions
668
+ if (advancedObjectProperties && !$.browser.msie && Object[defineProperty] && Object.prototype.__defineGetter__) {
669
+ (function(){
670
+ try {
671
+ var foo = document.createElement('foo');
672
+ Object[defineProperty](foo, 'bar', {
673
+ get: function(){
674
+ return true;
675
+ }
676
+ });
677
+ advancedObjectProperties = !!foo.bar;
678
+ }
679
+ catch (e) {
680
+ advancedObjectProperties = false;
681
+ }
682
+ foo = null;
683
+ })();
684
+ }
685
+
686
+ Modernizr.objectAccessor = !!((advancedObjectProperties || (Object.prototype.__defineGetter__ && Object.prototype.__lookupSetter__)) && (!$.browser.opera || shims.browserVersion >= 11));
687
+ Modernizr.advancedObjectProperties = advancedObjectProperties;
688
+
689
+ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !Object.getOwnPropertyDescriptor || !Object.defineProperty)){
690
+ var call = Function.prototype.call;
691
+ var prototypeOfObject = Object.prototype;
692
+ var owns = call.bind(prototypeOfObject.hasOwnProperty);
693
+
694
+ shims.objectCreate = function(proto, props, opts, no__proto__){
695
+ var o;
696
+ var f = function(){};
697
+
698
+ f.prototype = proto;
699
+ o = new f();
700
+
701
+ if(!no__proto__ && !('__proto__' in o) && !Modernizr.objectAccessor){
702
+ o.__proto__ = proto;
703
+ }
704
+
705
+ if(props){
706
+ shims.defineProperties(o, props);
707
+ }
708
+
709
+ if(opts){
710
+ o.options = jQuery.extend(true, {}, o.options || {}, opts);
711
+ opts = o.options;
712
+ }
713
+
714
+ if(o._create && jQuery.isFunction(o._create)){
715
+ o._create(opts);
716
+ }
717
+ return o;
718
+ };
719
+
720
+ shims.defineProperties = function(object, props){
721
+ for (var name in props) {
722
+ if (owns(props, name)) {
723
+ shims.defineProperty(object, name, props[name]);
724
+ }
725
+ }
726
+ return object;
727
+ };
728
+
729
+ var descProps = ['configurable', 'enumerable', 'writable'];
730
+ shims.defineProperty = function(proto, property, descriptor){
731
+ if(typeof descriptor != "object" || descriptor === null){return proto;}
732
+
733
+ if(owns(descriptor, "value")){
734
+ proto[property] = descriptor.value;
735
+ return proto;
736
+ }
737
+
738
+ if(proto.__defineGetter__){
739
+ if (typeof descriptor.get == "function") {
740
+ proto.__defineGetter__(property, descriptor.get);
741
+ }
742
+ if (typeof descriptor.set == "function"){
743
+ proto.__defineSetter__(property, descriptor.set);
744
+ }
745
+ }
746
+ return proto;
747
+ };
748
+
749
+ shims.getPrototypeOf = function (object) {
750
+ return Object.getPrototypeOf && Object.getPrototypeOf(object) || object.__proto__ || object.constructor && object.constructor.prototype;
751
+ };
752
+
753
+ //based on http://www.refactory.org/s/object_getownpropertydescriptor/view/latest
754
+ shims.getOwnPropertyDescriptor = function(obj, prop){
755
+ if (typeof obj !== "object" && typeof obj !== "function" || obj === null){
756
+ throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object");
757
+ }
758
+ var descriptor;
759
+ if(Object.defineProperty && Object.getOwnPropertyDescriptor){
760
+ try{
761
+ descriptor = Object.getOwnPropertyDescriptor(obj, prop);
762
+ return descriptor;
763
+ } catch(e){}
764
+ }
765
+ descriptor = {
766
+ configurable: true,
767
+ enumerable: true,
768
+ writable: true,
769
+ value: undefined
770
+ };
771
+ var getter = obj.__lookupGetter__ && obj.__lookupGetter__(prop),
772
+ setter = obj.__lookupSetter__ && obj.__lookupSetter__(prop)
773
+ ;
774
+
775
+ if (!getter && !setter) { // not an accessor so return prop
776
+ if(!owns(obj, prop)){
777
+ return;
778
+ }
779
+ descriptor.value = obj[prop];
780
+ return descriptor;
781
+ }
782
+
783
+ // there is an accessor, remove descriptor.writable; populate descriptor.get and descriptor.set
784
+ delete descriptor.writable;
785
+ delete descriptor.value;
786
+ descriptor.get = descriptor.set = undefined;
787
+
788
+ if(getter){
789
+ descriptor.get = getter;
790
+ }
791
+
792
+ if(setter){
793
+ descriptor.set = setter;
794
+ }
795
+
796
+ return descriptor;
797
+ };
798
+
799
+ }
800
+ })(jQuery, jQuery.webshims);
801
+
802
+
803
+
804
+ //DOM-Extension helper
805
+ jQuery.webshims.register('dom-extend', function($, webshims, window, document, undefined){
806
+ "use strict";
807
+ //shortcus
808
+ var modules = webshims.modules;
809
+ var listReg = /\s*,\s*/;
810
+
811
+ //proxying attribute
812
+ var olds = {};
813
+ var havePolyfill = {};
814
+ var extendedProps = {};
815
+ var extendQ = {};
816
+ var modifyProps = {};
817
+
818
+ var oldVal = $.fn.val;
819
+ var singleVal = function(elem, name, val, pass, _argless){
820
+ return (_argless) ? oldVal.call($(elem)) : oldVal.call($(elem), val);
821
+ };
822
+ $.fn.val = function(val){
823
+ var elem = this[0];
824
+ if(arguments.length && val == null){
825
+ val = '';
826
+ }
827
+ if(!arguments.length){
828
+ if(!elem || elem.nodeType !== 1){return oldVal.call(this);}
829
+ return $.prop(elem, 'value', val, 'val', true);
830
+ }
831
+ if($.isArray(val)){
832
+ return oldVal.apply(this, arguments);
833
+ }
834
+ var isFunction = $.isFunction(val);
835
+ return this.each(function(i){
836
+ elem = this;
837
+ if(elem.nodeType === 1){
838
+ if(isFunction){
839
+ var genVal = val.call( elem, i, $.prop(elem, 'value', undefined, 'val', true));
840
+ if(genVal == null){
841
+ genVal = '';
842
+ }
843
+ $.prop(elem, 'value', genVal, 'val') ;
844
+ } else {
845
+ $.prop(elem, 'value', val, 'val');
846
+ }
847
+ }
848
+ });
849
+ };
850
+
851
+ var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
852
+ var elementData = function(elem, key, val){
853
+ elem = elem.jquery ? elem[0] : elem;
854
+ if(!elem){return val || {};}
855
+ var data = $.data(elem, dataID);
856
+ if(val !== undefined){
857
+ if(!data){
858
+ data = $.data(elem, dataID, {});
859
+ }
860
+ if(key){
861
+ data[key] = val;
862
+ }
863
+ }
864
+
865
+ return key ? data && data[key] : data;
866
+ };
867
+
868
+
869
+ [{name: 'getNativeElement', prop: 'nativeElement'}, {name: 'getShadowElement', prop: 'shadowElement'}, {name: 'getShadowFocusElement', prop: 'shadowFocusElement'}].forEach(function(data){
870
+ $.fn[data.name] = function(){
871
+ return this.map(function(){
872
+ var shadowData = elementData(this, 'shadowData');
873
+ return shadowData && shadowData[data.prop] || this;
874
+ });
875
+ };
876
+ });
877
+
878
+
879
+ ['removeAttr', 'prop', 'attr'].forEach(function(type){
880
+ olds[type] = $[type];
881
+ $[type] = function(elem, name, value, pass, _argless){
882
+ var isVal = (pass == 'val');
883
+ var oldMethod = !isVal ? olds[type] : singleVal;
884
+ if( !elem || !havePolyfill[name] || elem.nodeType !== 1 || (!isVal && pass && type == 'attr' && $.attrFn[name]) ){
885
+ return oldMethod(elem, name, value, pass, _argless);
886
+ }
887
+
888
+ var nodeName = (elem.nodeName || '').toLowerCase();
889
+ var desc = extendedProps[nodeName];
890
+ var curType = (type == 'attr' && (value === false || value === null)) ? 'removeAttr' : type;
891
+ var propMethod;
892
+ var oldValMethod;
893
+ var ret;
894
+
895
+
896
+ if(!desc){
897
+ desc = extendedProps['*'];
898
+ }
899
+ if(desc){
900
+ desc = desc[name];
901
+ }
902
+
903
+ if(desc){
904
+ propMethod = desc[curType];
905
+ }
906
+
907
+ if(propMethod){
908
+ if(name == 'value'){
909
+ oldValMethod = propMethod.isVal;
910
+ propMethod.isVal = isVal;
911
+ }
912
+ if(curType === 'removeAttr'){
913
+ return propMethod.value.call(elem);
914
+ } else if(value === undefined){
915
+ return (propMethod.get) ?
916
+ propMethod.get.call(elem) :
917
+ propMethod.value
918
+ ;
919
+ } else if(propMethod.set) {
920
+ if(type == 'attr' && value === true){
921
+ value = name;
922
+ }
923
+
924
+ ret = propMethod.set.call(elem, value);
925
+ }
926
+ if(name == 'value'){
927
+ propMethod.isVal = oldValMethod;
928
+ }
929
+ } else {
930
+ ret = oldMethod(elem, name, value, pass, _argless);
931
+ }
932
+ if((value !== undefined || curType === 'removeAttr') && modifyProps[nodeName] && modifyProps[nodeName][name]){
933
+
934
+ var boolValue;
935
+ if(curType == 'removeAttr'){
936
+ boolValue = false;
937
+ } else if(curType == 'prop'){
938
+ boolValue = !!(value);
939
+ } else {
940
+ boolValue = true;
941
+ }
942
+
943
+ modifyProps[nodeName][name].forEach(function(fn){
944
+ if(!fn.only || (fn.only = 'prop' && type == 'prop') || (fn.only == 'attr' && type != 'prop')){
945
+ fn.call(elem, value, boolValue, (isVal) ? 'val' : curType, type);
946
+ }
947
+ });
948
+ }
949
+ return ret;
950
+ };
951
+
952
+ extendQ[type] = function(nodeName, prop, desc){
953
+
954
+ if(!extendedProps[nodeName]){
955
+ extendedProps[nodeName] = {};
956
+ }
957
+ if(!extendedProps[nodeName][prop]){
958
+ extendedProps[nodeName][prop] = {};
959
+ }
960
+ var oldDesc = extendedProps[nodeName][prop][type];
961
+ var getSup = function(propType, descriptor, oDesc){
962
+ if(descriptor && descriptor[propType]){
963
+ return descriptor[propType];
964
+ }
965
+ if(oDesc && oDesc[propType]){
966
+ return oDesc[propType];
967
+ }
968
+ if(type == 'prop' && prop == 'value'){
969
+ return function(value){
970
+ var elem = this;
971
+ return (desc.isVal) ?
972
+ singleVal(elem, prop, value, false, (arguments.length === 0)) :
973
+ olds[type](elem, prop, value)
974
+ ;
975
+ };
976
+ }
977
+ if(type == 'prop' && propType == 'value' && desc.value.apply){
978
+ return function(value){
979
+ var sup = olds[type](this, prop);
980
+ if(sup && sup.apply){
981
+ sup = sup.apply(this, arguments);
982
+ }
983
+ return sup;
984
+ };
985
+ }
986
+ return function(value){
987
+ return olds[type](this, prop, value);
988
+ };
989
+ };
990
+ extendedProps[nodeName][prop][type] = desc;
991
+ if(desc.value === undefined){
992
+ if(!desc.set){
993
+ desc.set = desc.writeable ?
994
+ getSup('set', desc, oldDesc) :
995
+ (webshims.cfg.useStrict && prop == 'prop') ?
996
+ function(){throw(prop +' is readonly on '+ nodeName);} :
997
+ $.noop
998
+ ;
999
+ }
1000
+ if(!desc.get){
1001
+ desc.get = getSup('get', desc, oldDesc);
1002
+ }
1003
+
1004
+ }
1005
+
1006
+ ['value', 'get', 'set'].forEach(function(descProp){
1007
+ if(desc[descProp]){
1008
+ desc['_sup'+descProp] = getSup(descProp, oldDesc);
1009
+ }
1010
+ });
1011
+ };
1012
+
1013
+ });
1014
+
1015
+ //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
1016
+ var isExtendNativeSave = (!$.browser.msie || parseInt($.browser.version, 10) > 8);
1017
+ var extendNativeValue = (function(){
1018
+ var UNKNOWN = webshims.getPrototypeOf(document.createElement('foobar'));
1019
+ var has = Object.prototype.hasOwnProperty;
1020
+ return function(nodeName, prop, desc){
1021
+ var elem = document.createElement(nodeName);
1022
+ var elemProto = webshims.getPrototypeOf(elem);
1023
+ if( isExtendNativeSave && elemProto && UNKNOWN !== elemProto && ( !elem[prop] || !has.call(elem, prop) ) ){
1024
+ var sup = elem[prop];
1025
+ desc._supvalue = function(){
1026
+ if(sup && sup.apply){
1027
+ return sup.apply(this, arguments);
1028
+ }
1029
+ return sup;
1030
+ };
1031
+ elemProto[prop] = desc.value;
1032
+ } else {
1033
+ desc._supvalue = function(){
1034
+ var data = elementData(this, 'propValue');
1035
+ if(data && data[prop] && data[prop].apply){
1036
+ return data[prop].apply(this, arguments);
1037
+ }
1038
+ return data && data[prop];
1039
+ };
1040
+ initProp.extendValue(nodeName, prop, desc.value);
1041
+ }
1042
+ desc.value._supvalue = desc._supvalue;
1043
+ };
1044
+ })();
1045
+
1046
+ var initProp = (function(){
1047
+
1048
+ var initProps = {};
1049
+
1050
+ webshims.addReady(function(context, contextElem){
1051
+ var nodeNameCache = {};
1052
+ var getElementsByName = function(name){
1053
+ if(!nodeNameCache[name]){
1054
+ nodeNameCache[name] = $(context.getElementsByTagName(name));
1055
+ if(contextElem[0] && $.nodeName(contextElem[0], name)){
1056
+ nodeNameCache[name] = nodeNameCache[name].add(contextElem);
1057
+ }
1058
+ }
1059
+ };
1060
+
1061
+
1062
+ $.each(initProps, function(name, fns){
1063
+ getElementsByName(name);
1064
+ if(!fns || !fns.forEach){
1065
+ webshims.warn('Error: with '+ name +'-property. methods: '+ fns);
1066
+ return;
1067
+ }
1068
+ fns.forEach(function(fn){
1069
+ nodeNameCache[name].each(fn);
1070
+ });
1071
+ });
1072
+ nodeNameCache = null;
1073
+ });
1074
+
1075
+ var tempCache;
1076
+ var emptyQ = $([]);
1077
+ var createNodeNameInit = function(nodeName, fn){
1078
+ if(!initProps[nodeName]){
1079
+ initProps[nodeName] = [fn];
1080
+ } else {
1081
+ initProps[nodeName].push(fn);
1082
+ }
1083
+ if($.isDOMReady){
1084
+ (tempCache || $( document.getElementsByTagName(nodeName) )).each(fn);
1085
+ }
1086
+ };
1087
+
1088
+ var elementExtends = {};
1089
+ return {
1090
+ createTmpCache: function(nodeName){
1091
+ if($.isDOMReady){
1092
+ tempCache = tempCache || $( document.getElementsByTagName(nodeName) );
1093
+ }
1094
+ return tempCache || emptyQ;
1095
+ },
1096
+ flushTmpCache: function(){
1097
+ tempCache = null;
1098
+ },
1099
+ content: function(nodeName, prop){
1100
+ createNodeNameInit(nodeName, function(){
1101
+ var val = $.attr(this, prop);
1102
+ if(val != null){
1103
+ $.attr(this, prop, val);
1104
+ }
1105
+ });
1106
+ },
1107
+ createElement: function(nodeName, fn){
1108
+ createNodeNameInit(nodeName, fn);
1109
+ },
1110
+ extendValue: function(nodeName, prop, value){
1111
+ createNodeNameInit(nodeName, function(){
1112
+ $(this).each(function(){
1113
+ var data = elementData(this, 'propValue', {});
1114
+ data[prop] = this[prop];
1115
+ this[prop] = value;
1116
+ });
1117
+ });
1118
+ }
1119
+ };
1120
+ })();
1121
+
1122
+ var createPropDefault = function(descs, removeType){
1123
+ if(descs.defaultValue === undefined){
1124
+ descs.defaultValue = '';
1125
+ }
1126
+ if(!descs.removeAttr){
1127
+ descs.removeAttr = {
1128
+ value: function(){
1129
+ descs[removeType || 'prop'].set.call(this, descs.defaultValue);
1130
+ descs.removeAttr._supvalue.call(this);
1131
+ }
1132
+ };
1133
+ }
1134
+ if(!descs.attr){
1135
+ descs.attr = {};
1136
+ }
1137
+ };
1138
+
1139
+ $.extend(webshims, {
1140
+
1141
+ getID: (function(){
1142
+ var ID = new Date().getTime();
1143
+ return function(elem){
1144
+ elem = $(elem);
1145
+ var id = elem.attr('id');
1146
+ if(!id){
1147
+ ID++;
1148
+ id = 'ID-'+ ID;
1149
+ elem.attr('id', id);
1150
+ }
1151
+ return id;
1152
+ };
1153
+ })(),
1154
+ extendUNDEFProp: function(obj, props){
1155
+ $.each(props, function(name, prop){
1156
+ if( !(name in obj) ){
1157
+ obj[name] = prop;
1158
+ }
1159
+ });
1160
+ },
1161
+ //http://www.w3.org/TR/html5/common-dom-interfaces.html#reflect
1162
+ createPropDefault: createPropDefault,
1163
+ data: elementData,
1164
+ moveToFirstEvent: function(elem, eventType, bindType){
1165
+ var events = ($._data(elem, 'events') || {})[eventType];
1166
+ var fn;
1167
+
1168
+ if(events && events.length > 1){
1169
+ fn = events.pop();
1170
+ if(!bindType){
1171
+ bindType = 'bind';
1172
+ }
1173
+ if(bindType == 'bind' && events.delegateCount){
1174
+ events.splice( events.delegateCount, 0, fn);
1175
+ } else {
1176
+ events.unshift( fn );
1177
+ }
1178
+
1179
+
1180
+ }
1181
+ elem = null;
1182
+ },
1183
+ addShadowDom: (function(){
1184
+ var resizeTimer;
1185
+ var lastHeight;
1186
+ var lastWidth;
1187
+
1188
+ var docObserve = {
1189
+ init: false,
1190
+ runs: 0,
1191
+ test: function(){
1192
+ var height = docObserve.getHeight();
1193
+ var width = docObserve.getWidth();
1194
+
1195
+ if(height != docObserve.height || width != docObserve.width){
1196
+ docObserve.height = height;
1197
+ docObserve.width = width;
1198
+ docObserve.handler({type: 'docresize'});
1199
+ docObserve.runs++;
1200
+ if(docObserve.runs < 9){
1201
+ setTimeout(docObserve.test, 90);
1202
+ }
1203
+ } else {
1204
+ docObserve.runs = 0;
1205
+ }
1206
+ },
1207
+ handler: function(e){
1208
+ clearTimeout(resizeTimer);
1209
+ resizeTimer = setTimeout(function(){
1210
+ if(e.type == 'resize'){
1211
+ var width = $(window).width();
1212
+ var height = $(window).width();
1213
+ if(height == lastHeight && width == lastWidth){
1214
+ return;
1215
+ }
1216
+ lastHeight = height;
1217
+ lastWidth = width;
1218
+
1219
+ docObserve.height = docObserve.getHeight();
1220
+ docObserve.width = docObserve.getWidth();
1221
+
1222
+ }
1223
+ $.event.trigger('updateshadowdom');
1224
+ }, (e.type == 'resize') ? 50 : 9);
1225
+ },
1226
+ _create: function(){
1227
+ $.each({ Height: "getHeight", Width: "getWidth" }, function(name, type){
1228
+ var body = document.body;
1229
+ var doc = document.documentElement;
1230
+ docObserve[type] = function(){
1231
+ return Math.max(
1232
+ body[ "scroll" + name ], doc[ "scroll" + name ],
1233
+ body[ "offset" + name ], doc[ "offset" + name ],
1234
+ doc[ "client" + name ]
1235
+ );
1236
+ };
1237
+ });
1238
+ },
1239
+ start: function(){
1240
+ if(!this.init && document.body){
1241
+ this.init = true;
1242
+ this._create();
1243
+ this.height = docObserve.getHeight();
1244
+ this.width = docObserve.getWidth();
1245
+ setInterval(this.test, 600);
1246
+ $(this.test);
1247
+ webshims.ready('WINDOWLOAD', this.test);
1248
+ $(window).bind('resize', this.handler);
1249
+ (function(){
1250
+ var oldAnimate = $.fn.animate;
1251
+ var animationTimer;
1252
+
1253
+ $.fn.animate = function(){
1254
+ clearTimeout(animationTimer);
1255
+ animationTimer = setTimeout(function(){
1256
+ docObserve.test();
1257
+ }, 99);
1258
+
1259
+ return oldAnimate.apply(this, arguments);
1260
+ };
1261
+ })();
1262
+ }
1263
+ }
1264
+ };
1265
+
1266
+
1267
+ $.event.customEvent.updateshadowdom = true;
1268
+ webshims.docObserve = function(){
1269
+ webshims.ready('DOM', function(){
1270
+ docObserve.start();
1271
+ });
1272
+ };
1273
+ return function(nativeElem, shadowElem, opts){
1274
+ opts = opts || {};
1275
+ if(nativeElem.jquery){
1276
+ nativeElem = nativeElem[0];
1277
+ }
1278
+ if(shadowElem.jquery){
1279
+ shadowElem = shadowElem[0];
1280
+ }
1281
+ var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1282
+ var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1283
+ var shadowFocusElementData = {};
1284
+ if(!opts.shadowFocusElement){
1285
+ opts.shadowFocusElement = shadowElem;
1286
+ } else if(opts.shadowFocusElement){
1287
+ if(opts.shadowFocusElement.jquery){
1288
+ opts.shadowFocusElement = opts.shadowFocusElement[0];
1289
+ }
1290
+ shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1291
+ }
1292
+
1293
+ nativeData.hasShadow = shadowElem;
1294
+ shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1295
+ shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1296
+ nativeElement: nativeElem,
1297
+ shadowElement: shadowElem,
1298
+ shadowFocusElement: opts.shadowFocusElement
1299
+ };
1300
+ if(opts.shadowChilds){
1301
+ opts.shadowChilds.each(function(){
1302
+ elementData(this, 'shadowData', shadowData.shadowData);
1303
+ });
1304
+ }
1305
+
1306
+ if(opts.data){
1307
+ shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1308
+ }
1309
+ opts = null;
1310
+ webshims.docObserve();
1311
+ };
1312
+ })(),
1313
+ propTypes: {
1314
+ standard: function(descs, name){
1315
+ createPropDefault(descs);
1316
+ if(descs.prop){return;}
1317
+ descs.prop = {
1318
+ set: function(val){
1319
+ descs.attr.set.call(this, ''+val);
1320
+ },
1321
+ get: function(){
1322
+ return descs.attr.get.call(this) || descs.defaultValue;
1323
+ }
1324
+ };
1325
+
1326
+ },
1327
+ "boolean": function(descs, name){
1328
+
1329
+ createPropDefault(descs);
1330
+ if(descs.prop){return;}
1331
+ descs.prop = {
1332
+ set: function(val){
1333
+ if(val){
1334
+ descs.attr.set.call(this, "");
1335
+ } else {
1336
+ descs.removeAttr.value.call(this);
1337
+ }
1338
+ },
1339
+ get: function(){
1340
+ return descs.attr.get.call(this) != null;
1341
+ }
1342
+ };
1343
+ },
1344
+ "src": (function(){
1345
+ var anchor = document.createElement('a');
1346
+ anchor.style.display = "none";
1347
+ return function(descs, name){
1348
+
1349
+ createPropDefault(descs);
1350
+ if(descs.prop){return;}
1351
+ descs.prop = {
1352
+ set: function(val){
1353
+ descs.attr.set.call(this, val);
1354
+ },
1355
+ get: function(){
1356
+ var href = this.getAttribute(name);
1357
+ var ret;
1358
+ if(href == null){return '';}
1359
+
1360
+ anchor.setAttribute('href', href+'' );
1361
+
1362
+ if(!$.support.hrefNormalized){
1363
+ try {
1364
+ $(anchor).insertAfter(this);
1365
+ ret = anchor.getAttribute('href', 4);
1366
+ } catch(er){
1367
+ ret = anchor.getAttribute('href', 4);
1368
+ }
1369
+ $(anchor).detach();
1370
+ }
1371
+ return ret || anchor.href;
1372
+ }
1373
+ };
1374
+ };
1375
+ })(),
1376
+ enumarated: function(descs, name){
1377
+
1378
+ createPropDefault(descs);
1379
+ if(descs.prop){return;}
1380
+ descs.prop = {
1381
+ set: function(val){
1382
+ descs.attr.set.call(this, val);
1383
+ },
1384
+ get: function(){
1385
+ var val = (descs.attr.get.call(this) || '').toLowerCase();
1386
+ if(!val || descs.limitedTo.indexOf(val) == -1){
1387
+ val = descs.defaultValue;
1388
+ }
1389
+ return val;
1390
+ }
1391
+ };
1392
+ }
1393
+
1394
+ // ,unsignedLong: $.noop
1395
+ // ,"doubble": $.noop
1396
+ // ,"long": $.noop
1397
+ // ,tokenlist: $.noop
1398
+ // ,settableTokenlist: $.noop
1399
+ },
1400
+ reflectProperties: function(nodeNames, props){
1401
+ if(typeof props == 'string'){
1402
+ props = props.split(listReg);
1403
+ }
1404
+ props.forEach(function(prop){
1405
+ webshims.defineNodeNamesProperty(nodeNames, prop, {
1406
+ prop: {
1407
+ set: function(val){
1408
+ $.attr(this, prop, val);
1409
+ },
1410
+ get: function(){
1411
+ return $.attr(this, prop) || '';
1412
+ }
1413
+ }
1414
+ });
1415
+ });
1416
+ },
1417
+ defineNodeNameProperty: function(nodeName, prop, descs){
1418
+ havePolyfill[prop] = true;
1419
+
1420
+ if(descs.reflect){
1421
+ webshims.propTypes[descs.propType || 'standard'](descs, prop);
1422
+ }
1423
+
1424
+ ['prop', 'attr', 'removeAttr'].forEach(function(type){
1425
+ var desc = descs[type];
1426
+ if(desc){
1427
+ if(type === 'prop'){
1428
+ desc = $.extend({writeable: true}, desc);
1429
+ } else {
1430
+ desc = $.extend({}, desc, {writeable: true});
1431
+ }
1432
+
1433
+ extendQ[type](nodeName, prop, desc);
1434
+ if(nodeName != '*' && webshims.cfg.extendNative && type == 'prop' && desc.value && $.isFunction(desc.value)){
1435
+ extendNativeValue(nodeName, prop, desc);
1436
+ }
1437
+ descs[type] = desc;
1438
+ }
1439
+ });
1440
+ if(descs.initAttr){
1441
+ initProp.content(nodeName, prop);
1442
+ }
1443
+ return descs;
1444
+ },
1445
+
1446
+ defineNodeNameProperties: function(name, descs, propType, _noTmpCache){
1447
+ var olddesc;
1448
+ for(var prop in descs){
1449
+ if(!_noTmpCache && descs[prop].initAttr){
1450
+ initProp.createTmpCache(name);
1451
+ }
1452
+ if(propType){
1453
+ if(descs[prop][propType]){
1454
+ //webshims.log('override: '+ name +'['+prop +'] for '+ propType);
1455
+ } else {
1456
+ descs[prop][propType] = {};
1457
+ ['value', 'set', 'get'].forEach(function(copyProp){
1458
+ if(copyProp in descs[prop]){
1459
+ descs[prop][propType][copyProp] = descs[prop][copyProp];
1460
+ delete descs[prop][copyProp];
1461
+ }
1462
+ });
1463
+ }
1464
+ }
1465
+ descs[prop] = webshims.defineNodeNameProperty(name, prop, descs[prop]);
1466
+ }
1467
+ if(!_noTmpCache){
1468
+ initProp.flushTmpCache();
1469
+ }
1470
+ return descs;
1471
+ },
1472
+
1473
+ createElement: function(nodeName, create, descs){
1474
+ var ret;
1475
+ if($.isFunction(create)){
1476
+ create = {
1477
+ after: create
1478
+ };
1479
+ }
1480
+ initProp.createTmpCache(nodeName);
1481
+ if(create.before){
1482
+ initProp.createElement(nodeName, create.before);
1483
+ }
1484
+ if(descs){
1485
+ ret = webshims.defineNodeNameProperties(nodeName, descs, false, true);
1486
+ }
1487
+ if(create.after){
1488
+ initProp.createElement(nodeName, create.after);
1489
+ }
1490
+ initProp.flushTmpCache();
1491
+ return ret;
1492
+ },
1493
+ onNodeNamesPropertyModify: function(nodeNames, props, desc, only){
1494
+ if(typeof nodeNames == 'string'){
1495
+ nodeNames = nodeNames.split(listReg);
1496
+ }
1497
+ if($.isFunction(desc)){
1498
+ desc = {set: desc};
1499
+ }
1500
+
1501
+ nodeNames.forEach(function(name){
1502
+ if(!modifyProps[name]){
1503
+ modifyProps[name] = {};
1504
+ }
1505
+ if(typeof props == 'string'){
1506
+ props = props.split(listReg);
1507
+ }
1508
+ if(desc.initAttr){
1509
+ initProp.createTmpCache(name);
1510
+ }
1511
+ props.forEach(function(prop){
1512
+ if(!modifyProps[name][prop]){
1513
+ modifyProps[name][prop] = [];
1514
+ havePolyfill[prop] = true;
1515
+ }
1516
+ if(desc.set){
1517
+ if(only){
1518
+ desc.set.only = only;
1519
+ }
1520
+ modifyProps[name][prop].push(desc.set);
1521
+ }
1522
+
1523
+ if(desc.initAttr){
1524
+ initProp.content(name, prop);
1525
+ }
1526
+ });
1527
+ initProp.flushTmpCache();
1528
+
1529
+ });
1530
+ },
1531
+ defineNodeNamesBooleanProperty: function(elementNames, prop, descs){
1532
+ if(!descs){
1533
+ descs = {};
1534
+ }
1535
+ if($.isFunction(descs)){
1536
+ descs.set = descs;
1537
+ }
1538
+ webshims.defineNodeNamesProperty(elementNames, prop, {
1539
+ attr: {
1540
+ set: function(val){
1541
+ this.setAttribute(prop, val);
1542
+ if(descs.set){
1543
+ descs.set.call(this, true);
1544
+ }
1545
+ },
1546
+ get: function(){
1547
+ var ret = this.getAttribute(prop);
1548
+ return (ret == null) ? undefined : prop;
1549
+ }
1550
+ },
1551
+ removeAttr: {
1552
+ value: function(){
1553
+ this.removeAttribute(prop);
1554
+ if(descs.set){
1555
+ descs.set.call(this, false);
1556
+ }
1557
+ }
1558
+ },
1559
+ reflect: true,
1560
+ propType: 'boolean',
1561
+ initAttr: descs.initAttr || false
1562
+ });
1563
+ },
1564
+ contentAttr: function(elem, name, val){
1565
+ if(!elem.nodeName){return;}
1566
+ var attr;
1567
+ if(val === undefined){
1568
+ attr = (elem.attributes[name] || {});
1569
+ val = attr.specified ? attr.value : null;
1570
+ return (val == null) ? undefined : val;
1571
+ }
1572
+
1573
+ if(typeof val == 'boolean'){
1574
+ if(!val){
1575
+ elem.removeAttribute(name);
1576
+ } else {
1577
+ elem.setAttribute(name, name);
1578
+ }
1579
+ } else {
1580
+ elem.setAttribute(name, val);
1581
+ }
1582
+ },
1583
+
1584
+ // set current Lang:
1585
+ // - webshims.activeLang(lang:string);
1586
+ // get current lang
1587
+ // - webshims.activeLang();
1588
+ // get current lang
1589
+ // webshims.activeLang({
1590
+ // register: moduleName:string,
1591
+ // callback: callback:function
1592
+ // });
1593
+ // get/set including removeLang
1594
+ // - webshims.activeLang({
1595
+ // module: moduleName:string,
1596
+ // callback: callback:function,
1597
+ // langObj: languageObj:array/object
1598
+ // });
1599
+ activeLang: (function(){
1600
+ var callbacks = [];
1601
+ var registeredCallbacks = {};
1602
+ var currentLang;
1603
+ var shortLang;
1604
+ var notLocal = /:\/\/|^\.*\//;
1605
+ var loadRemoteLang = function(data, lang, options){
1606
+ var langSrc;
1607
+ if(lang && options && $.inArray(lang, options.availabeLangs || []) !== -1){
1608
+ data.loading = true;
1609
+ langSrc = options.langSrc;
1610
+ if(!notLocal.test(langSrc)){
1611
+ langSrc = webshims.cfg.basePath+langSrc;
1612
+ }
1613
+ webshims.loader.loadScript(langSrc+lang+'.js', function(){
1614
+ if(data.langObj[lang]){
1615
+ data.loading = false;
1616
+ callLang(data, true);
1617
+ } else {
1618
+ $(function(){
1619
+ if(data.langObj[lang]){
1620
+ callLang(data, true);
1621
+ }
1622
+ data.loading = false;
1623
+ });
1624
+ }
1625
+ });
1626
+ return true;
1627
+ }
1628
+ return false;
1629
+ };
1630
+ var callRegister = function(module){
1631
+ if(registeredCallbacks[module]){
1632
+ registeredCallbacks[module].forEach(function(data){
1633
+ data.callback();
1634
+ });
1635
+ }
1636
+ };
1637
+ var callLang = function(data, _noLoop){
1638
+ if(data.activeLang != currentLang && data.activeLang !== shortLang){
1639
+ var options = modules[data.module].options;
1640
+ if( data.langObj[currentLang] || (shortLang && data.langObj[shortLang]) ){
1641
+ data.activeLang = currentLang;
1642
+ data.callback(data.langObj[currentLang] || data.langObj[shortLang], currentLang);
1643
+ callRegister(data.module);
1644
+ } else if( !_noLoop &&
1645
+ !loadRemoteLang(data, currentLang, options) &&
1646
+ !loadRemoteLang(data, shortLang, options) &&
1647
+ data.langObj[''] && data.activeLang !== '' ) {
1648
+ data.activeLang = '';
1649
+ data.callback(data.langObj[''], currentLang);
1650
+ callRegister(data.module);
1651
+ }
1652
+ }
1653
+ };
1654
+
1655
+
1656
+ var activeLang = function(lang){
1657
+
1658
+ if(typeof lang == 'string' && lang !== currentLang){
1659
+ currentLang = lang;
1660
+ shortLang = currentLang.split('-')[0];
1661
+ if(currentLang == shortLang){
1662
+ shortLang = false;
1663
+ }
1664
+ $.each(callbacks, function(i, data){
1665
+ callLang(data);
1666
+ });
1667
+ } else if(typeof lang == 'object'){
1668
+
1669
+ if(lang.register){
1670
+ if(!registeredCallbacks[lang.register]){
1671
+ registeredCallbacks[lang.register] = [];
1672
+ }
1673
+ registeredCallbacks[lang.register].push(lang);
1674
+ lang.callback();
1675
+ } else {
1676
+ if(!lang.activeLang){
1677
+ lang.activeLang = '';
1678
+ }
1679
+ callbacks.push(lang);
1680
+ callLang(lang);
1681
+ }
1682
+ }
1683
+ return currentLang;
1684
+ };
1685
+
1686
+ return activeLang;
1687
+ })()
1688
+ });
1689
+
1690
+ $.each({
1691
+ defineNodeNamesProperty: 'defineNodeNameProperty',
1692
+ defineNodeNamesProperties: 'defineNodeNameProperties',
1693
+ createElements: 'createElement'
1694
+ }, function(name, baseMethod){
1695
+ webshims[name] = function(names, a, b, c){
1696
+ if(typeof names == 'string'){
1697
+ names = names.split(listReg);
1698
+ }
1699
+ var retDesc = {};
1700
+ names.forEach(function(nodeName){
1701
+ retDesc[nodeName] = webshims[baseMethod](nodeName, a, b, c);
1702
+ });
1703
+ return retDesc;
1704
+ };
1705
+ });
1706
+
1707
+ webshims.isReady('webshimLocalization', true);
1708
+ });
1709
+ //html5a11y
1710
+ (function($, document){
1711
+ var browserVersion = $.webshims.browserVersion;
1712
+ if($.browser.mozilla && browserVersion > 5){return;}
1713
+ if (!$.browser.msie || (browserVersion < 12 && browserVersion > 7)) {
1714
+ var elemMappings = {
1715
+ article: "article",
1716
+ aside: "complementary",
1717
+ section: "region",
1718
+ nav: "navigation",
1719
+ address: "contentinfo"
1720
+ };
1721
+ var addRole = function(elem, role){
1722
+ var hasRole = elem.getAttribute('role');
1723
+ if (!hasRole) {
1724
+ elem.setAttribute('role', role);
1725
+ }
1726
+ };
1727
+
1728
+ $.webshims.addReady(function(context, contextElem){
1729
+ $.each(elemMappings, function(name, role){
1730
+ var elems = $(name, context).add(contextElem.filter(name));
1731
+ for (var i = 0, len = elems.length; i < len; i++) {
1732
+ addRole(elems[i], role);
1733
+ }
1734
+ });
1735
+ if (context === document) {
1736
+ var header = document.getElementsByTagName('header')[0];
1737
+ var footers = document.getElementsByTagName('footer');
1738
+ var footerLen = footers.length;
1739
+ if (header && !$(header).closest('section, article')[0]) {
1740
+ addRole(header, 'banner');
1741
+ }
1742
+ if (!footerLen) {
1743
+ return;
1744
+ }
1745
+ var footer = footers[footerLen - 1];
1746
+ if (!$(footer).closest('section, article')[0]) {
1747
+ addRole(footer, 'contentinfo');
1748
+ }
1749
+ }
1750
+ });
1751
+ }
1752
+ })(jQuery, document);