webshims-rails 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/lib/webshims-rails/version.rb +2 -2
  2. data/vendor/assets/javascripts/webshims/extras/custom-validity.js +261 -261
  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/extras/custom-validity.js +1 -1
  6. data/vendor/assets/javascripts/webshims/minified/polyfiller.js +24 -24
  7. data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/README +82 -82
  8. data/vendor/assets/javascripts/webshims/minified/shims/combos/1.js +35 -34
  9. data/vendor/assets/javascripts/webshims/minified/shims/combos/10.js +79 -82
  10. data/vendor/assets/javascripts/webshims/minified/shims/combos/11.js +45 -44
  11. data/vendor/assets/javascripts/webshims/minified/shims/combos/12.js +43 -42
  12. data/vendor/assets/javascripts/webshims/minified/shims/combos/13.js +28 -27
  13. data/vendor/assets/javascripts/webshims/minified/shims/combos/15.js +4 -4
  14. data/vendor/assets/javascripts/webshims/minified/shims/combos/16.js +57 -59
  15. data/vendor/assets/javascripts/webshims/minified/shims/combos/17.js +64 -66
  16. data/vendor/assets/javascripts/webshims/minified/shims/combos/18.js +53 -54
  17. data/vendor/assets/javascripts/webshims/minified/shims/combos/19.js +64 -66
  18. data/vendor/assets/javascripts/webshims/minified/shims/combos/2.js +72 -73
  19. data/vendor/assets/javascripts/webshims/minified/shims/combos/20.js +42 -46
  20. data/vendor/assets/javascripts/webshims/minified/shims/combos/21.js +52 -50
  21. data/vendor/assets/javascripts/webshims/minified/shims/combos/22.js +55 -59
  22. data/vendor/assets/javascripts/webshims/minified/shims/combos/23.js +66 -64
  23. data/vendor/assets/javascripts/webshims/minified/shims/combos/24.js +80 -82
  24. data/vendor/assets/javascripts/webshims/minified/shims/combos/25.js +60 -59
  25. data/vendor/assets/javascripts/webshims/minified/shims/combos/26.js +79 -81
  26. data/vendor/assets/javascripts/webshims/minified/shims/combos/27.js +101 -104
  27. data/vendor/assets/javascripts/webshims/minified/shims/combos/3.js +94 -95
  28. data/vendor/assets/javascripts/webshims/minified/shims/combos/4.js +26 -29
  29. data/vendor/assets/javascripts/webshims/minified/shims/combos/5.js +33 -36
  30. data/vendor/assets/javascripts/webshims/minified/shims/combos/59.js +51 -54
  31. data/vendor/assets/javascripts/webshims/minified/shims/combos/6.js +27 -28
  32. data/vendor/assets/javascripts/webshims/minified/shims/combos/7.js +27 -28
  33. data/vendor/assets/javascripts/webshims/minified/shims/combos/8.js +39 -38
  34. data/vendor/assets/javascripts/webshims/minified/shims/combos/9.js +65 -68
  35. data/vendor/assets/javascripts/webshims/minified/shims/details.js +4 -4
  36. data/vendor/assets/javascripts/webshims/minified/shims/dom-extend.js +23 -22
  37. data/vendor/assets/javascripts/webshims/minified/shims/form-core.js +19 -22
  38. data/vendor/assets/javascripts/webshims/minified/shims/form-datalist.js +14 -14
  39. data/vendor/assets/javascripts/webshims/minified/shims/form-number-date-api.js +9 -9
  40. data/vendor/assets/javascripts/webshims/minified/shims/form-number-date-ui.js +18 -19
  41. data/vendor/assets/javascripts/webshims/minified/shims/form-shim-extend.js +45 -43
  42. data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-de.txt +33 -33
  43. data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-en.txt +34 -34
  44. data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-core.js +12 -12
  45. data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-jaris.js +23 -0
  46. data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-native-fix.js +1 -1
  47. data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-swf.js +26 -30
  48. data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-yt.js +3 -3
  49. data/vendor/assets/javascripts/webshims/minified/shims/styles/shim.css +689 -686
  50. data/vendor/assets/javascripts/webshims/minified/shims/swf/JarisFLVPlayer.swf +0 -0
  51. data/vendor/assets/javascripts/webshims/minified/shims/track-ui.js +9 -9
  52. data/vendor/assets/javascripts/webshims/minified/shims/track.js +21 -21
  53. data/vendor/assets/javascripts/webshims/polyfiller.js +1191 -1175
  54. data/vendor/assets/javascripts/webshims/shims/combos/1.js +1754 -1714
  55. data/vendor/assets/javascripts/webshims/shims/combos/10.js +3247 -3320
  56. data/vendor/assets/javascripts/webshims/shims/combos/11.js +1633 -1588
  57. data/vendor/assets/javascripts/webshims/shims/combos/12.js +1636 -1591
  58. data/vendor/assets/javascripts/webshims/shims/combos/13.js +1100 -1058
  59. data/vendor/assets/javascripts/webshims/shims/combos/14.js +476 -476
  60. data/vendor/assets/javascripts/webshims/shims/combos/15.js +316 -314
  61. data/vendor/assets/javascripts/webshims/shims/combos/16.js +2094 -2104
  62. data/vendor/assets/javascripts/webshims/shims/combos/17.js +2258 -2267
  63. data/vendor/assets/javascripts/webshims/shims/combos/18.js +1380 -1364
  64. data/vendor/assets/javascripts/webshims/shims/combos/19.js +2239 -2247
  65. data/vendor/assets/javascripts/webshims/shims/combos/2.js +2339 -2294
  66. data/vendor/assets/javascripts/webshims/shims/combos/20.js +1493 -1606
  67. data/vendor/assets/javascripts/webshims/shims/combos/21.js +1733 -1635
  68. data/vendor/assets/javascripts/webshims/shims/combos/22.js +2295 -2408
  69. data/vendor/assets/javascripts/webshims/shims/combos/23.js +2269 -2168
  70. data/vendor/assets/javascripts/webshims/shims/combos/24.js +2775 -2780
  71. data/vendor/assets/javascripts/webshims/shims/combos/25.js +1505 -1456
  72. data/vendor/assets/javascripts/webshims/shims/combos/26.js +2111 -2115
  73. data/vendor/assets/javascripts/webshims/shims/combos/27.js +3264 -3331
  74. data/vendor/assets/javascripts/webshims/shims/combos/3.js +3020 -2970
  75. data/vendor/assets/javascripts/webshims/shims/combos/4.js +770 -822
  76. data/vendor/assets/javascripts/webshims/shims/combos/5.js +1025 -1077
  77. data/vendor/assets/javascripts/webshims/shims/combos/59.js +1706 -1753
  78. data/vendor/assets/javascripts/webshims/shims/combos/6.js +444 -433
  79. data/vendor/assets/javascripts/webshims/shims/combos/7.js +699 -688
  80. data/vendor/assets/javascripts/webshims/shims/combos/8.js +1488 -1445
  81. data/vendor/assets/javascripts/webshims/shims/combos/9.js +2445 -2518
  82. data/vendor/assets/javascripts/webshims/shims/details.js +148 -146
  83. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +952 -912
  84. data/vendor/assets/javascripts/webshims/shims/es5.js +802 -802
  85. data/vendor/assets/javascripts/webshims/shims/excanvas.js +924 -924
  86. data/vendor/assets/javascripts/webshims/shims/form-core.js +606 -659
  87. data/vendor/assets/javascripts/webshims/shims/form-datalist.js +681 -676
  88. data/vendor/assets/javascripts/webshims/shims/form-message.js +164 -163
  89. data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +255 -255
  90. data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +383 -383
  91. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +61 -50
  92. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +1569 -1472
  93. data/vendor/assets/javascripts/webshims/shims/geolocation.js +168 -168
  94. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ar.js +32 -32
  95. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ch-ZN.js +32 -32
  96. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-de.txt +33 -33
  97. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-el.js +32 -32
  98. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-en.txt +34 -34
  99. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-es.js +31 -31
  100. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-fr.js +32 -32
  101. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-he.js +32 -32
  102. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-hi.js +32 -32
  103. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-hu.js +32 -32
  104. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-it.js +32 -32
  105. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ja.js +32 -32
  106. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-nl.js +32 -32
  107. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-pt-PT.js +32 -32
  108. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ru.js +31 -31
  109. data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-sv.js +32 -32
  110. data/vendor/assets/javascripts/webshims/shims/json-storage.js +308 -308
  111. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +536 -533
  112. data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +861 -0
  113. data/vendor/assets/javascripts/webshims/shims/mediaelement-native-fix.js +98 -98
  114. data/vendor/assets/javascripts/webshims/shims/mediaelement-swf.js +957 -1073
  115. data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +543 -543
  116. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +689 -686
  117. data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
  118. data/vendor/assets/javascripts/webshims/shims/track-ui.js +9 -8
  119. data/vendor/assets/javascripts/webshims/shims/track.js +17 -11
  120. metadata +6 -6
  121. data/vendor/assets/javascripts/webshims/minified/shims/form-native-fix.js +0 -7
  122. data/vendor/assets/javascripts/webshims/shims/FlashCanvas/README +0 -62
  123. data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/README +0 -82
  124. data/vendor/assets/javascripts/webshims/shims/form-native-fix.js +0 -261
@@ -1,308 +1,308 @@
1
-
2
- //JSON
3
- (function(){
4
- if('JSON'in window && JSON.stringify && JSON.parse){return;}
5
-
6
- if(!this.JSON){this.JSON={};}(function(){function f(n){return n<10?'0'+n:n;}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}if(typeof rep==='function'){value=rep.call(holder,key,value);}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}return str('',{'':value});};}if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}throw new SyntaxError('JSON.parse');};}}());
7
-
8
- })();
9
-
10
- //modified version from http://gist.github.com/350433
11
- //using window.name for sessionStorage and cookies for localStorage
12
-
13
- (function () {
14
- var $ = jQuery;
15
- if ('localStorage' in window && 'sessionStorage' in window) {
16
- $.webshims.isReady('json-storage', true);
17
- return;
18
- }
19
-
20
-
21
- var storageNameError = function(name){
22
- if(name && name.indexOf && name.indexOf(';') != -1){
23
- setTimeout(function(){
24
- $.webshims.warn("Bad key for localStorage: ; in localStorage. name was: "+ name);
25
- }, 0);
26
- }
27
- };
28
- var winData;
29
- var selfWindow = false;
30
- $.each(['opener', 'top', 'parent'], function(i, name){
31
- try {
32
- winData = window[name];
33
- if(winData && 'name' in winData){
34
- var test = winData.name;
35
- return false;
36
- } else {
37
- winData = false;
38
- }
39
- } catch(e){
40
- winData = false;
41
- }
42
- });
43
- if(!winData){
44
- winData = window;
45
- selfWindow = true;
46
- }
47
- var setWindowData = function(data){
48
- if(!selfWindow){
49
- try {
50
- window.name = data;
51
- } catch(e){}
52
- }
53
- try {
54
- winData.name = data;
55
- } catch(e){
56
- winData = window;
57
- selfWindow = true;
58
- }
59
- };
60
- var getWindowData = function(){
61
- var data;
62
- if(!selfWindow){
63
- try {
64
- data = window.name;
65
- } catch(e){}
66
- }
67
- if(!data){
68
- try {
69
- data = winData.name;
70
- } catch(e){
71
- winData = window;
72
- selfWindow = true;
73
- }
74
- }
75
- return data;
76
- };
77
- var Storage = function (type) {
78
- function createCookie(name, value, days) {
79
- var date, expires;
80
-
81
- if (days) {
82
- date = new Date();
83
- date.setTime(date.getTime()+(days*24*60*60*1000));
84
- expires = "; expires="+date.toGMTString();
85
- } else {
86
- expires = "";
87
- }
88
- document.cookie = name+"="+value+expires+"; path=/";
89
- }
90
-
91
- function readCookie(name) {
92
- var nameEQ = name + "=",
93
- ca = document.cookie.split(';'),
94
- i, c;
95
-
96
- for (i=0; i < ca.length; i++) {
97
- c = ca[i];
98
- while (c.charAt(0)==' ') {
99
- c = c.substring(1,c.length);
100
- }
101
-
102
- if (c.indexOf(nameEQ) === 0) {
103
- return c.substring(nameEQ.length,c.length);
104
- }
105
- }
106
- return null;
107
- }
108
-
109
- function setData(data) {
110
- data = JSON.stringify(data);
111
- if (type == 'session') {
112
- setWindowData(data);
113
- } else {
114
- createCookie('localStorage', data, 365);
115
- }
116
- }
117
-
118
- function clearData() {
119
- if (type == 'session') {
120
- setWindowData('');
121
- } else {
122
- createCookie('localStorage', '', 365);
123
- }
124
- }
125
-
126
- function getData() {
127
- var data;
128
- if(type == 'session'){
129
- data = getWindowData();
130
- } else {
131
- data = readCookie('localStorage');
132
- }
133
- if(data){
134
- try {
135
- data = JSON.parse(data);
136
- } catch(e){
137
- data = {};
138
- }
139
- }
140
- return data || {};
141
- }
142
-
143
-
144
- // initialise if there's already data
145
- var data = getData();
146
-
147
- return {
148
- clear: function () {
149
- data = {};
150
- clearData();
151
- },
152
- getItem: function (key) {
153
- return (key in data) ? data[key] : null;
154
- },
155
- key: function (i) {
156
- // not perfect, but works
157
- var ctr = 0;
158
- for (var k in data) {
159
- if (ctr == i) {
160
- return k;
161
- } else {
162
- ctr++;
163
- }
164
- }
165
- return null;
166
- },
167
- removeItem: function (key) {
168
- delete data[key];
169
- setData(data);
170
- },
171
- setItem: function (key, value) {
172
- storageNameError(key);
173
- data[key] = value+''; // forces the value to a string
174
- setData(data);
175
- }
176
- };
177
- };
178
-
179
-
180
-
181
- if (!('sessionStorage' in window)) {window.sessionStorage = new Storage('session');}
182
-
183
-
184
-
185
- (function(){
186
- var swfTimer;
187
- var emptyString = '(empty string)+1287520303738';
188
- var runStart;
189
- var shim;
190
- var localStorageSwfCallback = function(type){
191
- clearTimeout(swfTimer);
192
-
193
- if(window.localStorage && (type != 'swf' || (shim && shim.key))){
194
- $.webshims.isReady('json-storage', true);
195
- return;
196
- }
197
-
198
- if(type === 'swf'){
199
- shim = document.getElementById('swflocalstorageshim');
200
- //brute force flash getter
201
- if( !shim || typeof shim.GetVariable == 'undefined' ){
202
- shim = document.swflocalstorageshim;
203
- }
204
- if( !shim || typeof shim.GetVariable == 'undefined'){
205
- shim = window.localstorageshim;
206
- }
207
-
208
- if(shim && typeof shim.GetVariable !== 'undefined'){
209
- window.localStorage = {};
210
-
211
- window.localStorage.clear = function(){
212
- if(shim.clear){shim.clear();}
213
- };
214
- window.localStorage.key = function(i){
215
- if(shim.key){shim.key(i);}
216
- };
217
- window.localStorage.removeItem = function(name){
218
- if(shim.removeItem){shim.removeItem(name);}
219
- };
220
-
221
- window.localStorage.setItem = function(name, val){
222
- storageNameError(name);
223
- val += '';
224
- if(!val){
225
- val = emptyString;
226
- }
227
- if(shim.setItem){
228
- shim.setItem(name, val);
229
- }
230
- };
231
- window.localStorage.getItem = function(name){
232
- if(!shim.getItem){
233
- return null;
234
- }
235
- var val = shim.getItem(name, val);
236
- if(val == emptyString){
237
- val = '';
238
- }
239
- return val;
240
- };
241
- $.webshims.log('flash-localStorage was implemented');
242
- }
243
- }
244
- if(!('localStorage' in window)){
245
- window.localStorage = new Storage('local');
246
- $.webshims.warn('implement cookie-localStorage');
247
- }
248
-
249
- $.webshims.isReady('json-storage', true);
250
- };
251
- var storageCFG = $.webshims.cfg['json-storage'];
252
- $.webshims.swfLocalStorage = {
253
- show: function(){
254
- if(storageCFG.exceededMessage){
255
- $('#swflocalstorageshim-wrapper').prepend('<div class="polyfill-exceeded-message">'+ storageCFG.exceededMessage +'</div>');
256
- }
257
- $('#swflocalstorageshim-wrapper').css({
258
- top: $(window).scrollTop() + 20,
259
- left: ($(window).width() / 2) - ($('#swflocalstorageshim-wrapper').outerWidth() / 2)
260
- });
261
-
262
- },
263
- hide: function(success){
264
- $('#swflocalstorageshim-wrapper')
265
- .css({top: '', left: ''})
266
- .find('div.polyfill-exceeded-message')
267
- .remove()
268
- ;
269
- if(!success){
270
- var err = new Error('DOMException: QUOTA_EXCEEDED_ERR');
271
- err.code = 22;
272
- err.name = 'DOMException';
273
- throw(err);
274
- }
275
- },
276
- isReady: localStorageSwfCallback
277
- };
278
-
279
- // $.webshims.swfLocalStorage.storageEvent = function(newVal, oldVal, url){
280
- //
281
- // };
282
-
283
- $.webshims.ready('DOM swfobject', function(){
284
- if(runStart || (('localStorage' in window) && document.getElementById('swflocalstorageshim')) ){return;}
285
- runStart = true;
286
- if(window.swfobject && swfobject.hasFlashPlayerVersion('8.0.0')){
287
- $('body')[$.browser.mozilla ? 'after' : 'append']('<div id="swflocalstorageshim-wrapper"><div id="swflocalstorageshim" /></div>');
288
- swfobject.embedSWF($.webshims.cfg.basePath +'swf/localStorage.swf' +($.webshims.cfg.addCacheBuster || ''), 'swflocalstorageshim', '295', '198', '8.0.0', '', {allowscriptaccess: 'always'}, {name: 'swflocalstorageshim'}, function(e){
289
- if(!e.success && !window.localStorage){
290
- localStorageSwfCallback();
291
- }
292
- });
293
- clearTimeout(swfTimer);
294
- swfTimer = setTimeout(function(){
295
- if(!('localStorage' in window)){
296
- $.webshims.warn('Add your development-directory to the local-trusted security sandbox: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html');
297
- }
298
- localStorageSwfCallback();
299
- }, (location.protocol.indexOf('file') === 0) ? 500 : 9999);
300
- } else {
301
- localStorageSwfCallback();
302
- }
303
- });
304
- })();
305
-
306
-
307
- })();
308
-
1
+
2
+ //JSON
3
+ (function(){
4
+ if('JSON'in window && JSON.stringify && JSON.parse){return;}
5
+
6
+ if(!this.JSON){this.JSON={};}(function(){function f(n){return n<10?'0'+n:n;}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}if(typeof rep==='function'){value=rep.call(holder,key,value);}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}return str('',{'':value});};}if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}throw new SyntaxError('JSON.parse');};}}());
7
+
8
+ })();
9
+
10
+ //modified version from http://gist.github.com/350433
11
+ //using window.name for sessionStorage and cookies for localStorage
12
+
13
+ (function () {
14
+ var $ = jQuery;
15
+ if ('localStorage' in window && 'sessionStorage' in window) {
16
+ $.webshims.isReady('json-storage', true);
17
+ return;
18
+ }
19
+
20
+
21
+ var storageNameError = function(name){
22
+ if(name && name.indexOf && name.indexOf(';') != -1){
23
+ setTimeout(function(){
24
+ $.webshims.warn("Bad key for localStorage: ; in localStorage. name was: "+ name);
25
+ }, 0);
26
+ }
27
+ };
28
+ var winData;
29
+ var selfWindow = false;
30
+ $.each(['opener', 'top', 'parent'], function(i, name){
31
+ try {
32
+ winData = window[name];
33
+ if(winData && 'name' in winData){
34
+ var test = winData.name;
35
+ return false;
36
+ } else {
37
+ winData = false;
38
+ }
39
+ } catch(e){
40
+ winData = false;
41
+ }
42
+ });
43
+ if(!winData){
44
+ winData = window;
45
+ selfWindow = true;
46
+ }
47
+ var setWindowData = function(data){
48
+ if(!selfWindow){
49
+ try {
50
+ window.name = data;
51
+ } catch(e){}
52
+ }
53
+ try {
54
+ winData.name = data;
55
+ } catch(e){
56
+ winData = window;
57
+ selfWindow = true;
58
+ }
59
+ };
60
+ var getWindowData = function(){
61
+ var data;
62
+ if(!selfWindow){
63
+ try {
64
+ data = window.name;
65
+ } catch(e){}
66
+ }
67
+ if(!data){
68
+ try {
69
+ data = winData.name;
70
+ } catch(e){
71
+ winData = window;
72
+ selfWindow = true;
73
+ }
74
+ }
75
+ return data;
76
+ };
77
+ var Storage = function (type) {
78
+ function createCookie(name, value, days) {
79
+ var date, expires;
80
+
81
+ if (days) {
82
+ date = new Date();
83
+ date.setTime(date.getTime()+(days*24*60*60*1000));
84
+ expires = "; expires="+date.toGMTString();
85
+ } else {
86
+ expires = "";
87
+ }
88
+ document.cookie = name+"="+value+expires+"; path=/";
89
+ }
90
+
91
+ function readCookie(name) {
92
+ var nameEQ = name + "=",
93
+ ca = document.cookie.split(';'),
94
+ i, c;
95
+
96
+ for (i=0; i < ca.length; i++) {
97
+ c = ca[i];
98
+ while (c.charAt(0)==' ') {
99
+ c = c.substring(1,c.length);
100
+ }
101
+
102
+ if (c.indexOf(nameEQ) === 0) {
103
+ return c.substring(nameEQ.length,c.length);
104
+ }
105
+ }
106
+ return null;
107
+ }
108
+
109
+ function setData(data) {
110
+ data = JSON.stringify(data);
111
+ if (type == 'session') {
112
+ setWindowData(data);
113
+ } else {
114
+ createCookie('localStorage', data, 365);
115
+ }
116
+ }
117
+
118
+ function clearData() {
119
+ if (type == 'session') {
120
+ setWindowData('');
121
+ } else {
122
+ createCookie('localStorage', '', 365);
123
+ }
124
+ }
125
+
126
+ function getData() {
127
+ var data;
128
+ if(type == 'session'){
129
+ data = getWindowData();
130
+ } else {
131
+ data = readCookie('localStorage');
132
+ }
133
+ if(data){
134
+ try {
135
+ data = JSON.parse(data);
136
+ } catch(e){
137
+ data = {};
138
+ }
139
+ }
140
+ return data || {};
141
+ }
142
+
143
+
144
+ // initialise if there's already data
145
+ var data = getData();
146
+
147
+ return {
148
+ clear: function () {
149
+ data = {};
150
+ clearData();
151
+ },
152
+ getItem: function (key) {
153
+ return (key in data) ? data[key] : null;
154
+ },
155
+ key: function (i) {
156
+ // not perfect, but works
157
+ var ctr = 0;
158
+ for (var k in data) {
159
+ if (ctr == i) {
160
+ return k;
161
+ } else {
162
+ ctr++;
163
+ }
164
+ }
165
+ return null;
166
+ },
167
+ removeItem: function (key) {
168
+ delete data[key];
169
+ setData(data);
170
+ },
171
+ setItem: function (key, value) {
172
+ storageNameError(key);
173
+ data[key] = value+''; // forces the value to a string
174
+ setData(data);
175
+ }
176
+ };
177
+ };
178
+
179
+
180
+
181
+ if (!('sessionStorage' in window)) {window.sessionStorage = new Storage('session');}
182
+
183
+
184
+
185
+ (function(){
186
+ var swfTimer;
187
+ var emptyString = '(empty string)+1287520303738';
188
+ var runStart;
189
+ var shim;
190
+ var localStorageSwfCallback = function(type){
191
+ clearTimeout(swfTimer);
192
+
193
+ if(window.localStorage && (type != 'swf' || (shim && shim.key))){
194
+ $.webshims.isReady('json-storage', true);
195
+ return;
196
+ }
197
+
198
+ if(type === 'swf'){
199
+ shim = document.getElementById('swflocalstorageshim');
200
+ //brute force flash getter
201
+ if( !shim || typeof shim.GetVariable == 'undefined' ){
202
+ shim = document.swflocalstorageshim;
203
+ }
204
+ if( !shim || typeof shim.GetVariable == 'undefined'){
205
+ shim = window.localstorageshim;
206
+ }
207
+
208
+ if(shim && typeof shim.GetVariable !== 'undefined'){
209
+ window.localStorage = {};
210
+
211
+ window.localStorage.clear = function(){
212
+ if(shim.clear){shim.clear();}
213
+ };
214
+ window.localStorage.key = function(i){
215
+ if(shim.key){shim.key(i);}
216
+ };
217
+ window.localStorage.removeItem = function(name){
218
+ if(shim.removeItem){shim.removeItem(name);}
219
+ };
220
+
221
+ window.localStorage.setItem = function(name, val){
222
+ storageNameError(name);
223
+ val += '';
224
+ if(!val){
225
+ val = emptyString;
226
+ }
227
+ if(shim.setItem){
228
+ shim.setItem(name, val);
229
+ }
230
+ };
231
+ window.localStorage.getItem = function(name){
232
+ if(!shim.getItem){
233
+ return null;
234
+ }
235
+ var val = shim.getItem(name, val);
236
+ if(val == emptyString){
237
+ val = '';
238
+ }
239
+ return val;
240
+ };
241
+ $.webshims.log('flash-localStorage was implemented');
242
+ }
243
+ }
244
+ if(!('localStorage' in window)){
245
+ window.localStorage = new Storage('local');
246
+ $.webshims.warn('implement cookie-localStorage');
247
+ }
248
+
249
+ $.webshims.isReady('json-storage', true);
250
+ };
251
+ var storageCFG = $.webshims.cfg['json-storage'];
252
+ $.webshims.swfLocalStorage = {
253
+ show: function(){
254
+ if(storageCFG.exceededMessage){
255
+ $('#swflocalstorageshim-wrapper').prepend('<div class="polyfill-exceeded-message">'+ storageCFG.exceededMessage +'</div>');
256
+ }
257
+ $('#swflocalstorageshim-wrapper').css({
258
+ top: $(window).scrollTop() + 20,
259
+ left: ($(window).width() / 2) - ($('#swflocalstorageshim-wrapper').outerWidth() / 2)
260
+ });
261
+
262
+ },
263
+ hide: function(success){
264
+ $('#swflocalstorageshim-wrapper')
265
+ .css({top: '', left: ''})
266
+ .find('div.polyfill-exceeded-message')
267
+ .remove()
268
+ ;
269
+ if(!success){
270
+ var err = new Error('DOMException: QUOTA_EXCEEDED_ERR');
271
+ err.code = 22;
272
+ err.name = 'DOMException';
273
+ throw(err);
274
+ }
275
+ },
276
+ isReady: localStorageSwfCallback
277
+ };
278
+
279
+ // $.webshims.swfLocalStorage.storageEvent = function(newVal, oldVal, url){
280
+ //
281
+ // };
282
+
283
+ $.webshims.ready('DOM swfobject', function(){
284
+ if(runStart || (('localStorage' in window) && document.getElementById('swflocalstorageshim')) ){return;}
285
+ runStart = true;
286
+ if(window.swfobject && swfobject.hasFlashPlayerVersion('8.0.0')){
287
+ $('body')[$.browser.mozilla ? 'after' : 'append']('<div id="swflocalstorageshim-wrapper"><div id="swflocalstorageshim" /></div>');
288
+ swfobject.embedSWF($.webshims.cfg.basePath +'swf/localStorage.swf' +($.webshims.cfg.addCacheBuster || ''), 'swflocalstorageshim', '295', '198', '8.0.0', '', {allowscriptaccess: 'always'}, {name: 'swflocalstorageshim'}, function(e){
289
+ if(!e.success && !window.localStorage){
290
+ localStorageSwfCallback();
291
+ }
292
+ });
293
+ clearTimeout(swfTimer);
294
+ swfTimer = setTimeout(function(){
295
+ if(!('localStorage' in window)){
296
+ $.webshims.warn('Add your development-directory to the local-trusted security sandbox: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html');
297
+ }
298
+ localStorageSwfCallback();
299
+ }, (location.protocol.indexOf('file') === 0) ? 500 : 9999);
300
+ } else {
301
+ localStorageSwfCallback();
302
+ }
303
+ });
304
+ })();
305
+
306
+
307
+ })();
308
+