vendor/assets/javascripts/webshims/shims/json-storage.js in webshims-rails-0.4.7 vs vendor/assets/javascripts/webshims/shims/json-storage.js in webshims-rails-1.10.3

- old
+ new

@@ -187,27 +187,32 @@ var emptyString = '(empty string)+1287520303738'; var runStart; var shim; var localStorageSwfCallback = function(type){ clearTimeout(swfTimer); - + var getType; if(window.localStorage && (type != 'swf' || (shim && shim.key))){ $.webshims.isReady('json-storage', true); return; } + if(type === 'swf'){ shim = document.getElementById('swflocalstorageshim'); + getType = shim ? typeof(shim.GetVariable) : 'undefined'; + //brute force flash getter - if( !shim || typeof shim.GetVariable == 'undefined' ){ + if( getType == 'undefined' ){ shim = document.swflocalstorageshim; + getType = shim ? typeof(shim.GetVariable) : 'undefined'; + if( getType == 'undefined' ){ + shim = window.localstorageshim; + getType = shim ? typeof(shim.GetVariable) : 'undefined'; + } } - if( !shim || typeof shim.GetVariable == 'undefined'){ - shim = window.localstorageshim; - } - if(shim && typeof shim.GetVariable !== 'undefined'){ + if(getType != 'undefined'){ window.localStorage = {}; window.localStorage.clear = function(){ if(shim.clear){shim.clear();} }; @@ -243,11 +248,10 @@ } if(!('localStorage' in window)){ window.localStorage = new Storage('local'); $.webshims.warn('implement cookie-localStorage'); } - $.webshims.isReady('json-storage', true); }; var storageCFG = $.webshims.cfg['json-storage']; $.webshims.swfLocalStorage = { show: function(){ @@ -278,15 +282,17 @@ // $.webshims.swfLocalStorage.storageEvent = function(newVal, oldVal, url){ // // }; - $.webshims.ready('DOM swfobject', function(){ + $.webshims.ready('DOM swfmini', function(){ + + var swfmini = window.swfmini; if(runStart || (('localStorage' in window) && document.getElementById('swflocalstorageshim')) ){return;} runStart = true; - if(window.swfobject && swfobject.hasFlashPlayerVersion('8.0.0')){ + if(swfmini && swfmini.hasFlashPlayerVersion('8.0.0')){ $('body').append('<div id="swflocalstorageshim-wrapper"><div id="swflocalstorageshim" /></div>'); - swfobject.embedSWF($.webshims.cfg.basePath +'swf/localStorage.swf' +($.webshims.cfg.addCacheBuster || ''), 'swflocalstorageshim', '295', '198', '8.0.0', '', {allowscriptaccess: 'always'}, {name: 'swflocalstorageshim'}, function(e){ + swfmini.embedSWF($.webshims.cfg.basePath +'swf/localStorage.swf' +($.webshims.cfg.addCacheBuster || ''), 'swflocalstorageshim', '295', '198', '8.0.0', null, {allowscriptaccess: 'always'}, {name: 'swflocalstorageshim'}, function(e){ if(!e.success && !window.localStorage){ localStorageSwfCallback(); } }); clearTimeout(swfTimer);