diff options
author | David Lawrence <dlawrence@mozilla.com> | 2011-04-23 08:03:15 -0400 |
---|---|---|
committer | David Lawrence <dlawrence@mozilla.com> | 2011-04-23 08:03:15 -0400 |
commit | 4c08043332e39576eed0868c22e6089eafa6aabf (patch) | |
tree | 5a8ad25f26a345feadedfe82782a763da051564e /js/yui/storage | |
parent | 8bb0ca1f5c922f8ea2fe64a59b1e1811dfaca65a (diff) | |
download | bugs-4c08043332e39576eed0868c22e6089eafa6aabf.tar bugs-4c08043332e39576eed0868c22e6089eafa6aabf.tar.gz bugs-4c08043332e39576eed0868c22e6089eafa6aabf.tar.bz2 bugs-4c08043332e39576eed0868c22e6089eafa6aabf.tar.xz bugs-4c08043332e39576eed0868c22e6089eafa6aabf.zip |
Bug 649879 - Update to YUI 2.9.0
r/a=mkanat
Diffstat (limited to 'js/yui/storage')
-rw-r--r-- | js/yui/storage/storage-min.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/js/yui/storage/storage-min.js b/js/yui/storage/storage-min.js index 08b477a4d..8cf0932cb 100644 --- a/js/yui/storage/storage-min.js +++ b/js/yui/storage/storage-min.js @@ -1,8 +1,8 @@ /* -Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Copyright (c) 2011, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html -version: 2.8.2r1 +version: 2.9.0 */ -(function(){var D=YAHOO,B=D.util,A=D.lang,C;if(!B.Storage){C=function(E){D.log("Exception in YAHOO.util.Storage.?? - must be extended by a storage engine".replace("??",E).replace("??",this.getName?this.getName():"Unknown"),"error");};B.Storage=function(E,G,F){var H=this;D.env._id_counter+=1;H._cfg=A.isObject(F)?F:{};H._location=E;H._name=G;H.isReady=false;H.createEvent(H.CE_READY,{scope:H});H.createEvent(H.CE_CHANGE,{scope:H});H.subscribe(H.CE_READY,function(){H.isReady=true;});};B.Storage.prototype={CE_READY:"YUIStorageReady",CE_CHANGE:"YUIStorageChange",DELIMITER:"__",_cfg:"",_name:"",_location:"",length:0,isReady:false,clear:function(){this._clear();this.length=0;},getItem:function(E){D.log("Fetching item at "+E);var F=this._getItem(E);return A.isValue(F)?this._getValue(F):null;},getName:function(){return this._name;},hasKey:function(E){return A.isString(E)&&this._hasKey(E);},key:function(E){D.log("Fetching key at "+E);if(A.isNumber(E)&&-1<E&&this.length>E){var F=this._key(E);if(F){return F;}}throw ("INDEX_SIZE_ERR - Storage.setItem - The provided index ("+E+") is not available");},removeItem:function(F){D.log("removing "+F);if(this.hasKey(F)){var E=this._getItem(F);if(!E){E=null;}this._removeItem(F);this.fireEvent(this.CE_CHANGE,new B.StorageEvent(this,F,E,null,B.StorageEvent.TYPE_REMOVE_ITEM));}else{}},setItem:function(G,H){D.log("SETTING "+H+" to "+G);if(A.isString(G)){var F=this.hasKey(G)?B.StorageEvent.TYPE_UPDATE_ITEM:B.StorageEvent.TYPE_ADD_ITEM,E=this._getItem(G);if(!E){E=null;}if(this._setItem(G,this._createValue(H))){this.fireEvent(this.CE_CHANGE,new B.StorageEvent(this,G,E,H,F));}else{throw ("QUOTA_EXCEEDED_ERROR - Storage.setItem - The choosen storage method ("+this.getName()+") has exceeded capacity");}}else{}},_clear:function(){C("_clear");return"";},_createValue:function(F){var E=(A.isNull(F)||A.isUndefined(F))?(""+F):typeof F;return"string"===E?F:E+this.DELIMITER+F;},_getItem:function(E){C("_getItem");return"";},_getValue:function(F){var E=F?F.split(this.DELIMITER):[];if(1==E.length){return F;}switch(E[0]){case"boolean":return"true"===E[1];case"number":return parseFloat(E[1]);case"null":return null;default:return E[1];}},_key:function(E){C("_key");return"";},_hasKey:function(E){return null!==this._getItem(E);},_removeItem:function(E){C("_removeItem");return"";},_setItem:function(E,F){C("_setItem");return"";}};A.augmentProto(B.Storage,B.EventProvider);}}());(function(){var H=YAHOO.util,B=YAHOO.lang,E={},G=[],F={},C=function(I){return(I&&I.isAvailable())?I:null;},A=function(J,I,K){var L=E[J+I.ENGINE_NAME];if(!L){L=new I(J,K);E[J+I.ENGINE_NAME]=L;}return L;},D=function(I){switch(I){case H.StorageManager.LOCATION_LOCAL:case H.StorageManager.LOCATION_SESSION:return I;default:return H.StorageManager.LOCATION_SESSION;}};H.StorageManager={LOCATION_SESSION:"sessionStorage",LOCATION_LOCAL:"localStorage",get:function(O,J,M){var K=B.isObject(M)?M:{},I=C(F[O]);if(!I&&!K.force){var N,L;if(K.order){L=K.order.length;for(N=0;N<L&&!I;N+=1){I=C(K.order[N]);}}if(!I){L=G.length;for(N=0;N<L&&!I;N+=1){I=C(G[N]);}}}if(I){return A(D(J),I,K.engine);}throw ("YAHOO.util.StorageManager.get - No engine available, please include an engine before calling this function.");},getByteSize:function(I){return encodeURIComponent(""+I).length;},register:function(I){if(B.isFunction(I)&&B.isFunction(I.isAvailable)&&B.isString(I.ENGINE_NAME)){F[I.ENGINE_NAME]=I;G.push(I);return true;}return false;}};YAHOO.register("StorageManager",H.SWFStore,{version:"2.8.2r1",build:"7"});}());(function(){YAHOO.util.StorageEvent=function(D,B,A,E,C){this.key=B;this.oldValue=A;this.newValue=E;this.url=window.location.href;this.window=window;this.storageArea=D;this.type=C;};YAHOO.lang.augmentObject(YAHOO.util.StorageEvent,{TYPE_ADD_ITEM:"addItem",TYPE_REMOVE_ITEM:"removeItem",TYPE_UPDATE_ITEM:"updateItem"});YAHOO.util.StorageEvent.prototype={key:null,newValue:null,oldValue:null,source:null,storageArea:null,type:null,url:null};}());(function(){var B=YAHOO.util,A=YAHOO.lang;B.StorageEngineKeyed=function(){B.StorageEngineKeyed.superclass.constructor.apply(this,arguments);this._keys=[];this._keyMap={};};A.extend(B.StorageEngineKeyed,B.Storage,{_keys:null,_keyMap:null,_addKey:function(C){this._keyMap[C]=this.length;this._keys.push(C);this.length=this._keys.length;},_indexOfKey:function(D){var C=this._keyMap[D];return undefined===C?-1:C;},_removeKey:function(E){var D=this._indexOfKey(E),F=this._keys.slice(D+1);delete this._keyMap[E];for(var C in this._keyMap){if(D<this._keyMap[C]){this._keyMap[C]-=1;}}this._keys.length=D;this._keys=this._keys.concat(F);this.length=this._keys.length;}});}());(function(){var D=YAHOO.util,B=YAHOO.lang,A=function(E){if(E.begin){E.begin();}},C=function(E){if(E.commit){E.commit();}};D.StorageEngineHTML5=function(E,F){var G=this;D.StorageEngineHTML5.superclass.constructor.call(G,E,D.StorageEngineHTML5.ENGINE_NAME,F);G._engine=window[E];G.length=G._engine.length;B.later(250,G,function(){G.fireEvent(G.CE_READY);});};YAHOO.lang.extend(D.StorageEngineHTML5,D.Storage,{_engine:null,_clear:function(){var G=this;if(G._engine.clear){G._engine.clear();}else{for(var F=G.length,E;0<=F;F-=1){E=G._key(F);G._removeItem(E);}}},_getItem:function(E){var F=this._engine.getItem(E);return B.isObject(F)?F.value:F;},_key:function(E){return this._engine.key(E);},_removeItem:function(E){var F=this;A(F._engine);F._engine.removeItem(E);C(F._engine);F.length=F._engine.length;},_setItem:function(E,F){var H=this;try{A(H._engine);H._engine.setItem(E,F);C(H._engine);H.length=H._engine.length;return true;}catch(G){return false;}}},true);D.StorageEngineHTML5.ENGINE_NAME="html5";D.StorageEngineHTML5.isAvailable=function(){return window.localStorage;};D.StorageManager.register(D.StorageEngineHTML5);}());(function(){var G=YAHOO.util,B=YAHOO.lang,D=9948,C="YUIStorageEngine",F=null,E=encodeURIComponent,A=decodeURIComponent;G.StorageEngineGears=function(I,L){var O=this;G.StorageEngineGears.superclass.constructor.call(O,I,G.StorageEngineGears.ENGINE_NAME,L); -if(!F){F=google.gears.factory.create(G.StorageEngineGears.GEARS);F.open(window.location.host+"-"+G.StorageEngineGears.DATABASE);F.execute("CREATE TABLE IF NOT EXISTS "+C+" (key TEXT, location TEXT, value TEXT)");}var K=G.StorageManager.LOCATION_SESSION===O._location,H=G.Cookie.get("sessionKey"+G.StorageEngineGears.ENGINE_NAME);if(!H){F.execute("BEGIN");F.execute("DELETE FROM "+C+' WHERE location="'+E(G.StorageManager.LOCATION_SESSION)+'"');F.execute("COMMIT");}var J=F.execute("SELECT key FROM "+C+' WHERE location="'+E(O._location)+'"'),N={};try{while(J.isValidRow()){var M=A(J.field(0));if(!N[M]){N[M]=true;O._addKey(M);}J.next();}}finally{J.close();}if(K){G.Cookie.set("sessionKey"+G.StorageEngineGears.ENGINE_NAME,true);}O.length=O._keys.length;B.later(250,O,function(){O.fireEvent(O.CE_READY);});};B.extend(G.StorageEngineGears,G.StorageEngineKeyed,{_clear:function(){F.execute("BEGIN");F.execute("DELETE FROM "+C+' WHERE location="'+E(this._location)+'"');F.execute("COMMIT");this._keys=[];this.length=0;},_getItem:function(J){var I=F.execute("SELECT value FROM "+C+' WHERE key="'+E(J)+'" AND location="'+E(this._location)+'"'),K="";try{while(I.isValidRow()){var H=I.field(0);K+=I.field(0);I.next();}}finally{I.close();}return K?A(K):null;},_key:function(H){return this._keys[H];},_removeItem:function(H){F.execute("BEGIN");F.execute("DELETE FROM "+C+' WHERE key="'+E(H)+'" AND location="'+E(this._location)+'"');F.execute("COMMIT");this._removeKey(H);},_setItem:function(P,M){if(!this.hasKey(P)){this._addKey(P);}var H=E(P),Q=E(this._location),R=E(M),K=[],O=D-(H+Q).length;if(O<R.length){for(var N=0,L=R.length;N<L;N+=O){K.push(R.substr(N,O));}}else{K.push(R);}F.execute("BEGIN");F.execute("DELETE FROM "+C+' WHERE key="'+E(P)+'" AND location="'+E(this._location)+'"');for(var J=0,I=K.length;J<I;J+=1){F.execute("INSERT INTO "+C+' VALUES ("'+H+'", "'+Q+'", "'+K[J]+'")');}F.execute("COMMIT");return true;}});G.Event.on("unload",function(){if(F){F.close();}});G.StorageEngineGears.ENGINE_NAME="gears";G.StorageEngineGears.GEARS="beta.database";G.StorageEngineGears.DATABASE="yui.database";G.StorageEngineGears.isAvailable=function(){if(window.google&&window.google.gears){try{google.gears.factory.create(G.StorageEngineGears.GEARS);return true;}catch(H){}}return false;};G.StorageManager.register(G.StorageEngineGears);}());(function(){var G=YAHOO.util,B=YAHOO.lang,H=G.Dom,C=215,E=138,F=null,D=function(J,I){return J._location+J.DELIMITER+I;},A=function(J){if(!F){if(!B.isString(J.swfURL)){J.swfURL=G.StorageEngineSWF.SWFURL;}if(!J.containerID){var K=document.getElementsByTagName("body")[0],I=K.appendChild(document.createElement("div"));J.containerID=H.generateId(I);}if(!J.attributes){J.attributes={};}if(!J.attributes.flashVars){J.attributes.flashVars={};}J.attributes.flashVars.useCompression="true";J.attributes.version=9.115;F=new YAHOO.widget.SWF(J.containerID,J.swfURL,J.attributes);}};G.StorageEngineSWF=function(I,J){var K=this;G.StorageEngineSWF.superclass.constructor.call(K,I,G.StorageEngineSWF.ENGINE_NAME,J);A(K._cfg);F.unsubscribe("contentReady");F.addListener("contentReady",function(){K._swf=F._swf;F.initialized=true;var N=G.StorageManager.LOCATION_SESSION===K._location,M=G.Cookie.get("sessionKey"+G.StorageEngineSWF.ENGINE_NAME);for(var P=F.callSWF("getLength",[])-1;0<=P;P-=1){var O=F.callSWF("getNameAt",[P]),L=-1<O.indexOf(G.StorageManager.LOCATION_SESSION+K.DELIMITER);if(N&&!M){F.callSWF("removeItem",[O]);}else{if(N===L){K._addKey(O);}}}if(N){G.Cookie.set("sessionKey"+G.StorageEngineSWF.ENGINE_NAME,true);}K.length=K._keys.length;K.fireEvent(K.CE_READY);});if(F.initialized){F.fireEvent("contentReady");}};B.extend(G.StorageEngineSWF,G.StorageEngineKeyed,{_swf:null,_clear:function(){for(var J=this._keys.length-1;0<=J;J-=1){var I=this._keys[J];F.callSWF("removeItem",[I]);}this._keys=[];this.length=0;},_getItem:function(I){var J=D(this,I);return F.callSWF("getValueOf",[J]);},_key:function(I){return(this._keys[I]||"").replace(/^.*?__/,"");},_removeItem:function(I){var J=D(this,I);F.callSWF("removeItem",[J]);this._removeKey(J);},_setItem:function(I,K){var J=D(this,I),L;if(F.callSWF("getValueOf",[J])){this._removeItem(I);}this._addKey(J);if(F.callSWF("setItem",[J,K])){return true;}else{L=H.get(F._id);if(C>H.getStyle(L,"width").replace(/\D+/g,"")){H.setStyle(L,"width",C+"px");}if(E>H.getStyle(L,"height").replace(/\D+/g,"")){H.setStyle(L,"height",E+"px");}return F.callSWF("displaySettings",[]);}}});G.StorageEngineSWF.SWFURL="swfstore.swf";G.StorageEngineSWF.ENGINE_NAME="swf";G.StorageEngineSWF.isAvailable=function(){return(6<=YAHOO.env.ua.flash&&YAHOO.widget.SWF);};G.StorageManager.register(G.StorageEngineSWF);}());YAHOO.register("storage",YAHOO.util.Storage,{version:"2.8.2r1",build:"7"});
\ No newline at end of file +(function(){var g=YAHOO,f=g.util,e=g.lang,c,d,b=/^type=(\w+)/i,a=/&value=(.*)/i;if(!f.Storage){c=function(h){g.log("Exception in YAHOO.util.Storage.?? - must be extended by a storage engine".replace("??",h).replace("??",this.getName?this.getName():"Unknown"),"error");};d=function(h,k,j){var i=this;g.env._id_counter+=1;i._cfg=e.isObject(j)?j:{};i._location=h;i._name=k;i.isReady=false;i.createEvent(d.CE_READY,{scope:i,fireOnce:true});i.createEvent(d.CE_CHANGE,{scope:i});i.subscribe(d.CE_READY,function(){i.isReady=true;});};d.CE_READY="YUIStorageReady";d.CE_CHANGE="YUIStorageChange";d.prototype={CE_READY:d.CE_READY,CE_CHANGE:d.CE_CHANGE,_cfg:"",_name:"",_location:"",length:0,isReady:false,clear:function(){this._clear();this.length=0;},getItem:function(h){g.log("Fetching item at "+h);var i=this._getItem(h);return e.isValue(i)?this._getValue(i):null;},getName:function(){return this._name;},hasKey:function(h){return e.isString(h)&&this._hasKey(h);},key:function(h){g.log("Fetching key at "+h);if(e.isNumber(h)&&-1<h&&this.length>h){var i=this._key(h);if(i){return i;}}throw ("INDEX_SIZE_ERR - Storage.setItem - The provided index ("+h+") is not available");},removeItem:function(j){g.log("removing "+j);var i=this,h;if(i.hasKey(j)){h=i._getItem(j);if(!h){h=null;}i._removeItem(j);i.fireEvent(d.CE_CHANGE,new f.StorageEvent(i,j,h,null,f.StorageEvent.TYPE_REMOVE_ITEM));}else{}},setItem:function(j,k){g.log("SETTING "+k+" to "+j);if(e.isString(j)){var i=this,h=i._getItem(j);if(!h){h=null;}if(i._setItem(j,i._createValue(k))){i.fireEvent(d.CE_CHANGE,new f.StorageEvent(i,j,h,k,i.hasKey(j)?f.StorageEvent.TYPE_UPDATE_ITEM:f.StorageEvent.TYPE_ADD_ITEM));}else{throw ("QUOTA_EXCEEDED_ERROR - Storage.setItem - The choosen storage method ("+i.getName()+") has exceeded capacity");}}else{}},_clear:function(){c("_clear");return"";},_createValue:function(h){var i=(e.isNull(h)||e.isUndefined(h))?(""+h):typeof h;return"type="+i+"&value="+encodeURIComponent(""+h);},_getItem:function(h){c("_getItem");return"";},_getValue:function(h){var j=h.match(b)[1],i=h.match(a)[1];switch(j){case"boolean":return"true"==i;case"number":return parseFloat(i);case"null":return null;default:return decodeURIComponent(i);}},_key:function(h){c("_key");return"";},_hasKey:function(h){return null!==this._getItem(h);},_removeItem:function(h){c("_removeItem");return"";},_setItem:function(h,i){c("_setItem");return"";}};e.augmentProto(d,f.EventProvider);f.Storage=d;}}());(function(){var h=YAHOO.util,e=YAHOO.lang,d={},g=[],f={},b=function(i){return(i&&i.isAvailable())?i:null;},a=function(i,l,k){var j=d[i+l.ENGINE_NAME];if(!j){j=new l(i,k);d[i+l.ENGINE_NAME]=j;}return j;},c=function(i){switch(i){case h.StorageManager.LOCATION_LOCAL:case h.StorageManager.LOCATION_SESSION:return i;default:return h.StorageManager.LOCATION_SESSION;}};h.StorageManager={LOCATION_SESSION:"sessionStorage",LOCATION_LOCAL:"localStorage",get:function(q,k,p){var n=e.isObject(p)?p:{},o=b(f[q]),m,l;if(!o&&!n.force){if(n.order){l=n.order.length;for(m=0;m<l&&!o;m+=1){o=b(n.order[m]);}}if(!o){l=g.length;for(m=0;m<l&&!o;m+=1){o=b(g[m]);}}}if(o){return a(c(k),o,n.engine);}throw ("YAHOO.util.StorageManager.get - No engine available, please include an engine before calling this function.");},getByteSize:function(i){return encodeURIComponent(""+i).length;},register:function(i){if(e.isFunction(i)&&e.isFunction(i.isAvailable)&&e.isString(i.ENGINE_NAME)){f[i.ENGINE_NAME]=i;g.push(i);return true;}return false;}};YAHOO.register("StorageManager",h.SWFStore,{version:"2.9.0",build:"2800"});}());(function(){function a(e,d,c,b,f){this.key=d;this.oldValue=c;this.newValue=b;this.url=window.location.href;this.window=window;this.storageArea=e;this.type=f;}YAHOO.lang.augmentObject(a,{TYPE_ADD_ITEM:"addItem",TYPE_REMOVE_ITEM:"removeItem",TYPE_UPDATE_ITEM:"updateItem"});a.prototype={key:null,newValue:null,oldValue:null,source:null,storageArea:null,type:null,url:null};YAHOO.util.StorageEvent=a;}());(function(){var a=YAHOO.util;a.StorageEngineKeyed=function(){a.StorageEngineKeyed.superclass.constructor.apply(this,arguments);this._keys=[];this._keyMap={};};YAHOO.lang.extend(a.StorageEngineKeyed,a.Storage,{_keys:null,_keyMap:null,_addKey:function(b){if(!this._keyMap.hasOwnProperty(b)){this._keys.push(b);this._keyMap[b]=this.length;this.length=this._keys.length;}},_clear:function(){this._keys=[];this.length=0;},_indexOfKey:function(c){var b=this._keyMap[c];return undefined===b?-1:b;},_key:function(b){return this._keys[b];},_removeItem:function(f){var e=this,c=e._indexOfKey(f),d=e._keys.slice(c+1),b;delete e._keyMap[f];for(b in e._keyMap){if(c<e._keyMap[b]){e._keyMap[b]-=1;}}e._keys.length=c;e._keys=e._keys.concat(d);e.length=e._keys.length;}});}());(function(){var e=YAHOO.util,c=YAHOO.lang,a=function(f){f.begin();},b=function(f){f.commit();},d=function(f,h){var g=this,i=window[f];d.superclass.constructor.call(g,f,d.ENGINE_NAME,h);if(!i.begin){a=function(){};}if(!i.commit){b=function(){};}g.length=i.length;g._driver=i;g.fireEvent(e.Storage.CE_READY);};c.extend(d,e.Storage,{_driver:null,_clear:function(){var g=this,f,h;if(g._driver.clear){g._driver.clear();}else{for(f=g.length;0<=f;f-=1){h=g._key(f);g._removeItem(h);}}},_getItem:function(f){var g=this._driver.getItem(f);return c.isObject(g)?g.value:g;},_key:function(f){return this._driver.key(f);},_removeItem:function(f){var g=this._driver;a(g);g.removeItem(f);b(g);this.length=g.length;},_setItem:function(g,f){var i=this._driver;try{a(i);i.setItem(g,f);b(i);this.length=i.length;return true;}catch(h){return false;}}},true);d.ENGINE_NAME="html5";d.isAvailable=function(){try{return("localStorage" in window)&&window["localStorage"]!==null&&("sessionStorage" in window)&&window["sessionStorage"]!==null;}catch(f){return false;}};e.StorageManager.register(d);e.StorageEngineHTML5=d;}());(function(){var h=YAHOO.util,d=YAHOO.lang,e=9948,g="YUIStorageEngine",b=null,f=encodeURIComponent,a=decodeURIComponent,c=function(l,o){var n=this,p={},k,i,j;c.superclass.constructor.call(n,l,c.ENGINE_NAME,o); +if(!b){b=google.gears.factory.create(c.GEARS);b.open(window.location.host.replace(/[\/\:\*\?"\<\>\|;,]/g,"")+"-"+c.DATABASE);b.execute("CREATE TABLE IF NOT EXISTS "+g+" (key TEXT, location TEXT, value TEXT)");}k=h.StorageManager.LOCATION_SESSION===n._location;i=h.Cookie.get("sessionKey"+c.ENGINE_NAME);if(!i){b.execute("BEGIN");b.execute("DELETE FROM "+g+' WHERE location="'+f(h.StorageManager.LOCATION_SESSION)+'"');b.execute("COMMIT");}j=b.execute("SELECT key FROM "+g+' WHERE location="'+f(n._location)+'"');p={};try{while(j.isValidRow()){var m=a(j.field(0));if(!p[m]){p[m]=true;n._addKey(m);}j.next();}}finally{j.close();}if(k){h.Cookie.set("sessionKey"+c.ENGINE_NAME,true);}n.fireEvent(h.Storage.CE_READY);};d.extend(c,h.StorageEngineKeyed,{_clear:function(){c.superclass._clear.call(this);b.execute("BEGIN");b.execute("DELETE FROM "+g+' WHERE location="'+f(this._location)+'"');b.execute("COMMIT");},_getItem:function(k){var i=b.execute("SELECT value FROM "+g+' WHERE key="'+f(k)+'" AND location="'+f(this._location)+'"'),j="";try{while(i.isValidRow()){j+=i.field(0);i.next();}}finally{i.close();}return j?a(j):null;},_removeItem:function(i){c.superclass._removeItem.call(this,i);b.execute("BEGIN");b.execute("DELETE FROM "+g+' WHERE key="'+f(i)+'" AND location="'+f(this._location)+'"');b.execute("COMMIT");},_setItem:function(r,k){this._addKey(r);var l=f(r),m=f(this._location),p=f(k),q=[],s=e-(l+m).length,o=0,n;if(s<p.length){for(n=p.length;o<n;o+=s){q.push(p.substr(o,s));}}else{q.push(p);}b.execute("BEGIN");b.execute("DELETE FROM "+g+' WHERE key="'+l+'" AND location="'+m+'"');for(o=0,n=q.length;o<n;o+=1){b.execute("INSERT INTO "+g+' VALUES ("'+l+'", "'+m+'", "'+q[o]+'")');}b.execute("COMMIT");return true;}});h.Event.on("unload",function(){if(b){b.close();}});c.ENGINE_NAME="gears";c.GEARS="beta.database";c.DATABASE="yui.database";c.isAvailable=function(){if(("google" in window)&&("gears" in window.google)){try{google.gears.factory.create(c.GEARS);return true;}catch(i){}}return false;};h.StorageManager.register(c);h.StorageEngineGears=c;}());(function(){var b=YAHOO,i=b.util,g=b.lang,f=i.Dom,j=i.StorageManager,c=215,h=138,d=new RegExp("^("+j.LOCATION_SESSION+"|"+j.LOCATION_LOCAL+")"),e=null,k=function(m,n){return m._location+n;},a=function(n){if(!e){if(!g.isString(n.swfURL)){n.swfURL=l.SWFURL;}if(!n.containerID){var o=document.getElementsByTagName("body")[0],m=o.appendChild(document.createElement("div"));n.containerID=f.generateId(m);}if(!n.attributes){n.attributes={};}if(!n.attributes.flashVars){n.attributes.flashVars={};}n.attributes.flashVars.allowedDomain=document.location.hostname;n.attributes.flashVars.useCompression="true";n.attributes.version=9.115;e=new b.widget.SWF(n.containerID,n.swfURL,n.attributes);e.subscribe("save",function(p){b.log(p.message,"info");});e.subscribe("quotaExceededError",function(p){b.log(p.message,"error");});e.subscribe("inadequateDimensions",function(p){b.log(p.message,"error");});e.subscribe("error",function(p){b.log(p.message,"error");});e.subscribe("securityError",function(p){b.log(p.message,"error");});}},l=function(m,p){var o=this;l.superclass.constructor.call(o,m,l.ENGINE_NAME,p);a(o._cfg);var n=function(){o._swf=e._swf;e.initialized=true;var s=j.LOCATION_SESSION===o._location,r=i.Cookie.get("sessionKey"+l.ENGINE_NAME),u,t,q;for(u=e.callSWF("getLength",[])-1;0<=u;u-=1){t=e.callSWF("getNameAt",[u]);q=s&&(-1<t.indexOf(j.LOCATION_SESSION));if(q&&!r){e.callSWF("removeItem",[t]);}else{if(s===q){o._addKey(t);}}}if(s){i.Cookie.set("sessionKey"+l.ENGINE_NAME,true);}o.fireEvent(i.Storage.CE_READY);};if(e.initialized){n();}else{e.addListener("contentReady",n);}};g.extend(l,i.StorageEngineKeyed,{_swf:null,_clear:function(){for(var m=this._keys.length-1,n;0<=m;m-=1){n=this._keys[m];e.callSWF("removeItem",[n]);}l.superclass._clear.call(this);},_getItem:function(m){var n=k(this,m);return e.callSWF("getValueOf",[n]);},_key:function(m){return l.superclass._key.call(this,m).replace(d,"");},_removeItem:function(m){b.log("removing SWF key: "+m);var n=k(this,m);l.superclass._removeItem.call(this,n);e.callSWF("removeItem",[n]);},_setItem:function(m,p){var n=k(this,m),o;if(e.callSWF("setItem",[n,p])){this._addKey(n);return true;}else{o=f.get(e._id);if(c>f.getStyle(o,"width").replace(/\D+/g,"")){f.setStyle(o,"width",c+"px");}if(h>f.getStyle(o,"height").replace(/\D+/g,"")){f.setStyle(o,"height",h+"px");}b.log("attempting to show settings. are dimensions adequate? "+e.callSWF("hasAdequateDimensions"));return e.callSWF("displaySettings",[]);}}});l.SWFURL="swfstore.swf";l.ENGINE_NAME="swf";l.isAvailable=function(){return(6<=b.env.ua.flash&&b.widget.SWF);};j.register(l);i.StorageEngineSWF=l;}());YAHOO.register("storage",YAHOO.util.Storage,{version:"2.9.0",build:"2800"});
\ No newline at end of file |