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.
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/extras/custom-validity.js +261 -261
- data/vendor/assets/javascripts/webshims/extras/modernizr-custom.js +534 -534
- data/vendor/assets/javascripts/webshims/extras/mousepress.js +60 -60
- data/vendor/assets/javascripts/webshims/minified/extras/custom-validity.js +1 -1
- data/vendor/assets/javascripts/webshims/minified/polyfiller.js +24 -24
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/README +82 -82
- data/vendor/assets/javascripts/webshims/minified/shims/combos/1.js +35 -34
- data/vendor/assets/javascripts/webshims/minified/shims/combos/10.js +79 -82
- data/vendor/assets/javascripts/webshims/minified/shims/combos/11.js +45 -44
- data/vendor/assets/javascripts/webshims/minified/shims/combos/12.js +43 -42
- data/vendor/assets/javascripts/webshims/minified/shims/combos/13.js +28 -27
- data/vendor/assets/javascripts/webshims/minified/shims/combos/15.js +4 -4
- data/vendor/assets/javascripts/webshims/minified/shims/combos/16.js +57 -59
- data/vendor/assets/javascripts/webshims/minified/shims/combos/17.js +64 -66
- data/vendor/assets/javascripts/webshims/minified/shims/combos/18.js +53 -54
- data/vendor/assets/javascripts/webshims/minified/shims/combos/19.js +64 -66
- data/vendor/assets/javascripts/webshims/minified/shims/combos/2.js +72 -73
- data/vendor/assets/javascripts/webshims/minified/shims/combos/20.js +42 -46
- data/vendor/assets/javascripts/webshims/minified/shims/combos/21.js +52 -50
- data/vendor/assets/javascripts/webshims/minified/shims/combos/22.js +55 -59
- data/vendor/assets/javascripts/webshims/minified/shims/combos/23.js +66 -64
- data/vendor/assets/javascripts/webshims/minified/shims/combos/24.js +80 -82
- data/vendor/assets/javascripts/webshims/minified/shims/combos/25.js +60 -59
- data/vendor/assets/javascripts/webshims/minified/shims/combos/26.js +79 -81
- data/vendor/assets/javascripts/webshims/minified/shims/combos/27.js +101 -104
- data/vendor/assets/javascripts/webshims/minified/shims/combos/3.js +94 -95
- data/vendor/assets/javascripts/webshims/minified/shims/combos/4.js +26 -29
- data/vendor/assets/javascripts/webshims/minified/shims/combos/5.js +33 -36
- data/vendor/assets/javascripts/webshims/minified/shims/combos/59.js +51 -54
- data/vendor/assets/javascripts/webshims/minified/shims/combos/6.js +27 -28
- data/vendor/assets/javascripts/webshims/minified/shims/combos/7.js +27 -28
- data/vendor/assets/javascripts/webshims/minified/shims/combos/8.js +39 -38
- data/vendor/assets/javascripts/webshims/minified/shims/combos/9.js +65 -68
- data/vendor/assets/javascripts/webshims/minified/shims/details.js +4 -4
- data/vendor/assets/javascripts/webshims/minified/shims/dom-extend.js +23 -22
- data/vendor/assets/javascripts/webshims/minified/shims/form-core.js +19 -22
- data/vendor/assets/javascripts/webshims/minified/shims/form-datalist.js +14 -14
- data/vendor/assets/javascripts/webshims/minified/shims/form-number-date-api.js +9 -9
- data/vendor/assets/javascripts/webshims/minified/shims/form-number-date-ui.js +18 -19
- data/vendor/assets/javascripts/webshims/minified/shims/form-shim-extend.js +45 -43
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-de.txt +33 -33
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-en.txt +34 -34
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-core.js +12 -12
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-jaris.js +23 -0
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-native-fix.js +1 -1
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-swf.js +26 -30
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-yt.js +3 -3
- data/vendor/assets/javascripts/webshims/minified/shims/styles/shim.css +689 -686
- data/vendor/assets/javascripts/webshims/minified/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/track-ui.js +9 -9
- data/vendor/assets/javascripts/webshims/minified/shims/track.js +21 -21
- data/vendor/assets/javascripts/webshims/polyfiller.js +1191 -1175
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +1754 -1714
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +3247 -3320
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +1633 -1588
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +1636 -1591
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +1100 -1058
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +476 -476
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +316 -314
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +2094 -2104
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +2258 -2267
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +1380 -1364
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +2239 -2247
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +2339 -2294
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +1493 -1606
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +1733 -1635
- data/vendor/assets/javascripts/webshims/shims/combos/22.js +2295 -2408
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +2269 -2168
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +2775 -2780
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +1505 -1456
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +2111 -2115
- data/vendor/assets/javascripts/webshims/shims/combos/27.js +3264 -3331
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +3020 -2970
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +770 -822
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +1025 -1077
- data/vendor/assets/javascripts/webshims/shims/combos/59.js +1706 -1753
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +444 -433
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +699 -688
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +1488 -1445
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +2445 -2518
- data/vendor/assets/javascripts/webshims/shims/details.js +148 -146
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +952 -912
- data/vendor/assets/javascripts/webshims/shims/es5.js +802 -802
- data/vendor/assets/javascripts/webshims/shims/excanvas.js +924 -924
- data/vendor/assets/javascripts/webshims/shims/form-core.js +606 -659
- data/vendor/assets/javascripts/webshims/shims/form-datalist.js +681 -676
- data/vendor/assets/javascripts/webshims/shims/form-message.js +164 -163
- data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +255 -255
- data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +383 -383
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +61 -50
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +1569 -1472
- data/vendor/assets/javascripts/webshims/shims/geolocation.js +168 -168
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ar.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ch-ZN.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-de.txt +33 -33
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-el.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-en.txt +34 -34
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-es.js +31 -31
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-fr.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-he.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-hi.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-hu.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-it.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ja.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-nl.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-pt-PT.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-ru.js +31 -31
- data/vendor/assets/javascripts/webshims/shims/i18n/errormessages-sv.js +32 -32
- data/vendor/assets/javascripts/webshims/shims/json-storage.js +308 -308
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +536 -533
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +861 -0
- data/vendor/assets/javascripts/webshims/shims/mediaelement-native-fix.js +98 -98
- data/vendor/assets/javascripts/webshims/shims/mediaelement-swf.js +957 -1073
- data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +543 -543
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +689 -686
- data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +9 -8
- data/vendor/assets/javascripts/webshims/shims/track.js +17 -11
- metadata +6 -6
- data/vendor/assets/javascripts/webshims/minified/shims/form-native-fix.js +0 -7
- data/vendor/assets/javascripts/webshims/shims/FlashCanvas/README +0 -62
- data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/README +0 -82
- data/vendor/assets/javascripts/webshims/shims/form-native-fix.js +0 -261
@@ -1,476 +1,476 @@
|
|
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
|
-
|
309
|
-
(function($){
|
310
|
-
if(navigator.geolocation){return;}
|
311
|
-
var domWrite = function(){
|
312
|
-
setTimeout(function(){
|
313
|
-
throw('document.write is overwritten by geolocation shim. This method is incompatible with this plugin');
|
314
|
-
}, 1);
|
315
|
-
},
|
316
|
-
id = 0
|
317
|
-
;
|
318
|
-
var geoOpts = $.webshims.cfg.geolocation.options || {};
|
319
|
-
navigator.geolocation = (function(){
|
320
|
-
var pos;
|
321
|
-
var api = {
|
322
|
-
getCurrentPosition: function(success, error, opts){
|
323
|
-
var locationAPIs = 2,
|
324
|
-
errorTimer,
|
325
|
-
googleTimer,
|
326
|
-
calledEnd,
|
327
|
-
endCallback = function(){
|
328
|
-
if(calledEnd){return;}
|
329
|
-
if(pos){
|
330
|
-
calledEnd = true;
|
331
|
-
success($.extend({timestamp: new Date().getTime()}, pos));
|
332
|
-
resetCallback();
|
333
|
-
if(window.JSON && window.sessionStorage){
|
334
|
-
try{
|
335
|
-
sessionStorage.setItem('storedGeolocationData654321', JSON.stringify(pos));
|
336
|
-
} catch(e){}
|
337
|
-
}
|
338
|
-
} else if(error && !locationAPIs) {
|
339
|
-
calledEnd = true;
|
340
|
-
resetCallback();
|
341
|
-
error({ code: 2, message: "POSITION_UNAVAILABLE"});
|
342
|
-
}
|
343
|
-
},
|
344
|
-
googleCallback = function(){
|
345
|
-
locationAPIs--;
|
346
|
-
getGoogleCoords();
|
347
|
-
endCallback();
|
348
|
-
},
|
349
|
-
resetCallback = function(){
|
350
|
-
$(document).unbind('google-loader', resetCallback);
|
351
|
-
clearTimeout(googleTimer);
|
352
|
-
clearTimeout(errorTimer);
|
353
|
-
},
|
354
|
-
getGoogleCoords = function(){
|
355
|
-
if(pos || !window.google || !google.loader || !google.loader.ClientLocation){return false;}
|
356
|
-
var cl = google.loader.ClientLocation;
|
357
|
-
pos = {
|
358
|
-
coords: {
|
359
|
-
latitude: cl.latitude,
|
360
|
-
longitude: cl.longitude,
|
361
|
-
altitude: null,
|
362
|
-
accuracy: 43000,
|
363
|
-
altitudeAccuracy: null,
|
364
|
-
heading: parseInt('NaN', 10),
|
365
|
-
velocity: null
|
366
|
-
},
|
367
|
-
//extension similiar to FF implementation
|
368
|
-
address: $.extend({streetNumber: '', street: '', premises: '', county: '', postalCode: ''}, cl.address)
|
369
|
-
};
|
370
|
-
return true;
|
371
|
-
},
|
372
|
-
getInitCoords = function(){
|
373
|
-
if(pos){return;}
|
374
|
-
getGoogleCoords();
|
375
|
-
if(pos || !window.JSON || !window.sessionStorage){return;}
|
376
|
-
try{
|
377
|
-
pos = sessionStorage.getItem('storedGeolocationData654321');
|
378
|
-
pos = (pos) ? JSON.parse(pos) : false;
|
379
|
-
if(!pos.coords){pos = false;}
|
380
|
-
} catch(e){
|
381
|
-
pos = false;
|
382
|
-
}
|
383
|
-
}
|
384
|
-
;
|
385
|
-
|
386
|
-
getInitCoords();
|
387
|
-
|
388
|
-
if(!pos){
|
389
|
-
if(geoOpts.confirmText && !confirm(geoOpts.confirmText.replace('{location}', location.hostname))){
|
390
|
-
if(error){
|
391
|
-
error({ code: 1, message: "PERMISSION_DENIED"});
|
392
|
-
}
|
393
|
-
return;
|
394
|
-
}
|
395
|
-
$.ajax({
|
396
|
-
url: 'http://freegeoip.net/json/',
|
397
|
-
dataType: 'jsonp',
|
398
|
-
cache: true,
|
399
|
-
jsonp: 'callback',
|
400
|
-
success: function(data){
|
401
|
-
locationAPIs--;
|
402
|
-
if(!data){return;}
|
403
|
-
pos = pos || {
|
404
|
-
coords: {
|
405
|
-
latitude: data.latitude,
|
406
|
-
longitude: data.longitude,
|
407
|
-
altitude: null,
|
408
|
-
accuracy: 43000,
|
409
|
-
altitudeAccuracy: null,
|
410
|
-
heading: parseInt('NaN', 10),
|
411
|
-
velocity: null
|
412
|
-
},
|
413
|
-
//extension similiar to FF implementation
|
414
|
-
address: {
|
415
|
-
city: data.city,
|
416
|
-
country: data.country_name,
|
417
|
-
countryCode: data.country_code,
|
418
|
-
county: "",
|
419
|
-
postalCode: data.zipcode,
|
420
|
-
premises: "",
|
421
|
-
region: data.region_name,
|
422
|
-
street: "",
|
423
|
-
streetNumber: ""
|
424
|
-
}
|
425
|
-
};
|
426
|
-
endCallback();
|
427
|
-
},
|
428
|
-
error: function(){
|
429
|
-
locationAPIs--;
|
430
|
-
endCallback();
|
431
|
-
}
|
432
|
-
});
|
433
|
-
clearTimeout(googleTimer);
|
434
|
-
if (!window.google || !window.google.loader) {
|
435
|
-
googleTimer = setTimeout(function(){
|
436
|
-
//destroys document.write!!!
|
437
|
-
if (geoOpts.destroyWrite) {
|
438
|
-
document.write = domWrite;
|
439
|
-
document.writeln = domWrite;
|
440
|
-
}
|
441
|
-
$(document).one('google-loader', googleCallback);
|
442
|
-
$.webshims.loader.loadScript('http://www.google.com/jsapi', false, 'google-loader');
|
443
|
-
}, 800);
|
444
|
-
} else {
|
445
|
-
locationAPIs--;
|
446
|
-
}
|
447
|
-
} else {
|
448
|
-
setTimeout(endCallback, 1);
|
449
|
-
return;
|
450
|
-
}
|
451
|
-
if(opts && opts.timeout){
|
452
|
-
errorTimer = setTimeout(function(){
|
453
|
-
resetCallback();
|
454
|
-
if(error) {
|
455
|
-
error({ code: 3, message: "TIMEOUT"});
|
456
|
-
}
|
457
|
-
}, opts.timeout);
|
458
|
-
} else {
|
459
|
-
errorTimer = setTimeout(function(){
|
460
|
-
locationAPIs = 0;
|
461
|
-
endCallback();
|
462
|
-
}, 10000);
|
463
|
-
}
|
464
|
-
},
|
465
|
-
clearWatch: $.noop
|
466
|
-
};
|
467
|
-
api.watchPosition = function(a, b, c){
|
468
|
-
api.getCurrentPosition(a, b, c);
|
469
|
-
id++;
|
470
|
-
return id;
|
471
|
-
};
|
472
|
-
return api;
|
473
|
-
})();
|
474
|
-
|
475
|
-
$.webshims.isReady('geolocation', true);
|
476
|
-
})(jQuery);
|
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
|
+
|
309
|
+
(function($){
|
310
|
+
if(navigator.geolocation){return;}
|
311
|
+
var domWrite = function(){
|
312
|
+
setTimeout(function(){
|
313
|
+
throw('document.write is overwritten by geolocation shim. This method is incompatible with this plugin');
|
314
|
+
}, 1);
|
315
|
+
},
|
316
|
+
id = 0
|
317
|
+
;
|
318
|
+
var geoOpts = $.webshims.cfg.geolocation.options || {};
|
319
|
+
navigator.geolocation = (function(){
|
320
|
+
var pos;
|
321
|
+
var api = {
|
322
|
+
getCurrentPosition: function(success, error, opts){
|
323
|
+
var locationAPIs = 2,
|
324
|
+
errorTimer,
|
325
|
+
googleTimer,
|
326
|
+
calledEnd,
|
327
|
+
endCallback = function(){
|
328
|
+
if(calledEnd){return;}
|
329
|
+
if(pos){
|
330
|
+
calledEnd = true;
|
331
|
+
success($.extend({timestamp: new Date().getTime()}, pos));
|
332
|
+
resetCallback();
|
333
|
+
if(window.JSON && window.sessionStorage){
|
334
|
+
try{
|
335
|
+
sessionStorage.setItem('storedGeolocationData654321', JSON.stringify(pos));
|
336
|
+
} catch(e){}
|
337
|
+
}
|
338
|
+
} else if(error && !locationAPIs) {
|
339
|
+
calledEnd = true;
|
340
|
+
resetCallback();
|
341
|
+
error({ code: 2, message: "POSITION_UNAVAILABLE"});
|
342
|
+
}
|
343
|
+
},
|
344
|
+
googleCallback = function(){
|
345
|
+
locationAPIs--;
|
346
|
+
getGoogleCoords();
|
347
|
+
endCallback();
|
348
|
+
},
|
349
|
+
resetCallback = function(){
|
350
|
+
$(document).unbind('google-loader', resetCallback);
|
351
|
+
clearTimeout(googleTimer);
|
352
|
+
clearTimeout(errorTimer);
|
353
|
+
},
|
354
|
+
getGoogleCoords = function(){
|
355
|
+
if(pos || !window.google || !google.loader || !google.loader.ClientLocation){return false;}
|
356
|
+
var cl = google.loader.ClientLocation;
|
357
|
+
pos = {
|
358
|
+
coords: {
|
359
|
+
latitude: cl.latitude,
|
360
|
+
longitude: cl.longitude,
|
361
|
+
altitude: null,
|
362
|
+
accuracy: 43000,
|
363
|
+
altitudeAccuracy: null,
|
364
|
+
heading: parseInt('NaN', 10),
|
365
|
+
velocity: null
|
366
|
+
},
|
367
|
+
//extension similiar to FF implementation
|
368
|
+
address: $.extend({streetNumber: '', street: '', premises: '', county: '', postalCode: ''}, cl.address)
|
369
|
+
};
|
370
|
+
return true;
|
371
|
+
},
|
372
|
+
getInitCoords = function(){
|
373
|
+
if(pos){return;}
|
374
|
+
getGoogleCoords();
|
375
|
+
if(pos || !window.JSON || !window.sessionStorage){return;}
|
376
|
+
try{
|
377
|
+
pos = sessionStorage.getItem('storedGeolocationData654321');
|
378
|
+
pos = (pos) ? JSON.parse(pos) : false;
|
379
|
+
if(!pos.coords){pos = false;}
|
380
|
+
} catch(e){
|
381
|
+
pos = false;
|
382
|
+
}
|
383
|
+
}
|
384
|
+
;
|
385
|
+
|
386
|
+
getInitCoords();
|
387
|
+
|
388
|
+
if(!pos){
|
389
|
+
if(geoOpts.confirmText && !confirm(geoOpts.confirmText.replace('{location}', location.hostname))){
|
390
|
+
if(error){
|
391
|
+
error({ code: 1, message: "PERMISSION_DENIED"});
|
392
|
+
}
|
393
|
+
return;
|
394
|
+
}
|
395
|
+
$.ajax({
|
396
|
+
url: 'http://freegeoip.net/json/',
|
397
|
+
dataType: 'jsonp',
|
398
|
+
cache: true,
|
399
|
+
jsonp: 'callback',
|
400
|
+
success: function(data){
|
401
|
+
locationAPIs--;
|
402
|
+
if(!data){return;}
|
403
|
+
pos = pos || {
|
404
|
+
coords: {
|
405
|
+
latitude: data.latitude,
|
406
|
+
longitude: data.longitude,
|
407
|
+
altitude: null,
|
408
|
+
accuracy: 43000,
|
409
|
+
altitudeAccuracy: null,
|
410
|
+
heading: parseInt('NaN', 10),
|
411
|
+
velocity: null
|
412
|
+
},
|
413
|
+
//extension similiar to FF implementation
|
414
|
+
address: {
|
415
|
+
city: data.city,
|
416
|
+
country: data.country_name,
|
417
|
+
countryCode: data.country_code,
|
418
|
+
county: "",
|
419
|
+
postalCode: data.zipcode,
|
420
|
+
premises: "",
|
421
|
+
region: data.region_name,
|
422
|
+
street: "",
|
423
|
+
streetNumber: ""
|
424
|
+
}
|
425
|
+
};
|
426
|
+
endCallback();
|
427
|
+
},
|
428
|
+
error: function(){
|
429
|
+
locationAPIs--;
|
430
|
+
endCallback();
|
431
|
+
}
|
432
|
+
});
|
433
|
+
clearTimeout(googleTimer);
|
434
|
+
if (!window.google || !window.google.loader) {
|
435
|
+
googleTimer = setTimeout(function(){
|
436
|
+
//destroys document.write!!!
|
437
|
+
if (geoOpts.destroyWrite) {
|
438
|
+
document.write = domWrite;
|
439
|
+
document.writeln = domWrite;
|
440
|
+
}
|
441
|
+
$(document).one('google-loader', googleCallback);
|
442
|
+
$.webshims.loader.loadScript('http://www.google.com/jsapi', false, 'google-loader');
|
443
|
+
}, 800);
|
444
|
+
} else {
|
445
|
+
locationAPIs--;
|
446
|
+
}
|
447
|
+
} else {
|
448
|
+
setTimeout(endCallback, 1);
|
449
|
+
return;
|
450
|
+
}
|
451
|
+
if(opts && opts.timeout){
|
452
|
+
errorTimer = setTimeout(function(){
|
453
|
+
resetCallback();
|
454
|
+
if(error) {
|
455
|
+
error({ code: 3, message: "TIMEOUT"});
|
456
|
+
}
|
457
|
+
}, opts.timeout);
|
458
|
+
} else {
|
459
|
+
errorTimer = setTimeout(function(){
|
460
|
+
locationAPIs = 0;
|
461
|
+
endCallback();
|
462
|
+
}, 10000);
|
463
|
+
}
|
464
|
+
},
|
465
|
+
clearWatch: $.noop
|
466
|
+
};
|
467
|
+
api.watchPosition = function(a, b, c){
|
468
|
+
api.getCurrentPosition(a, b, c);
|
469
|
+
id++;
|
470
|
+
return id;
|
471
|
+
};
|
472
|
+
return api;
|
473
|
+
})();
|
474
|
+
|
475
|
+
$.webshims.isReady('geolocation', true);
|
476
|
+
})(jQuery);
|