*/(function(){functiona(){return((1+Math.random())*65536|0).toString(16).substring(1)}functionb(){returna()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}Backbone.LocalStorage=window.Store=function(a){this.name=a;varb=this.localStorage().getItem(this.name);this.records=b&&b.split(",")||[]},_.extend(Backbone.LocalStorage.prototype,{save:function(){this.localStorage().setItem(this.name,this.records.join(","))},create:function(a){returna.id||(a.id=b(),a.set(a.idAttribute,a.id)),this.localStorage().setItem(this.name+"-"+a.id,JSON.stringify(a)),this.records.push(a.id.toString()),this.save(),a},update:function(a){returnthis.localStorage().setItem(this.name+"-"+a.id,JSON.stringify(a)),_.include(this.records,a.id.toString())||this.records.push(a.id.toString()),this.save(),a},find:function(a){returnJSON.parse(this.localStorage().getItem(this.name+"-"+a.id))},findAll:function(){return_(this.records).chain().map(function(a){returnJSON.parse(this.localStorage().getItem(this.name+"-"+a))},this).compact().value()},destroy:function(a){returnthis.localStorage().removeItem(this.name+"-"+a.id),this.records=_.reject(this.records,function(b){returnb==a.id.toString()}),this.save(),a},localStorage:function(){returnlocalStorage}}),Backbone.LocalStorage.sync=window.Store.sync=Backbone.localSync=function(a,b,c,d){vare=b.localStorage||b.collection.localStorage;typeofc=="function"&&(c={success:c,error:d});varf;switch(a){case"read":f=b.id!=undefined?e.find(b):e.findAll();break;case"create":f=e.create(b);break;case"update":f=e.update(b);break;case"delete":f=e.destroy(b)}f?c.success(f):c.error("Record not found")},Backbone.ajaxSync=Backbone.sync,Backbone.getSyncMethod=function(a){returna.localStorage||a.collection&&a.collection.localStorage?Backbone.localSync:Backbone.ajaxSync},Backbone.sync=function(a,b,c,d){returnBackbone.getSyncMethod(b).apply(this,[a,b,c,d])}})();
*/(function(){functiona(){return((1+Math.random())*65536|0).toString(16).substring(1)}functionb(){returna()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}Backbone.LocalStorage=window.Store=function(a){this.name=a;varb=this.localStorage().getItem(this.name);this.records=b&&b.split(",")||[]},_.extend(Backbone.LocalStorage.prototype,{save:function(){this.localStorage().setItem(this.name,this.records.join(","))},create:function(a){returna.id||(a.id=b(),a.set(a.idAttribute,a.id)),this.localStorage().setItem(this.name+"-"+a.id,JSON.stringify(a)),this.records.push(a.id.toString()),this.save(),a},update:function(a){returnthis.localStorage().setItem(this.name+"-"+a.id,JSON.stringify(a)),_.include(this.records,a.id.toString())||this.records.push(a.id.toString()),this.save(),a},find:function(a){returnJSON.parse(this.localStorage().getItem(this.name+"-"+a.id))},findAll:function(){return_(this.records).chain().map(function(a){returnJSON.parse(this.localStorage().getItem(this.name+"-"+a))},this).compact().value()},destroy:function(a){returnthis.localStorage().removeItem(this.name+"-"+a.id),this.records=_.reject(this.records,function(b){returnb==a.id.toString()}),this.save(),a},localStorage:function(){returnlocalStorage}}),Backbone.LocalStorage.sync=window.Store.sync=Backbone.localSync=function(a,b,c,d){vare=b.localStorage||b.collection.localStorage;typeofc=="function"&&(c={success:c,error:d});varf;switch(a){case"read":f=b.id!=undefined?e.find(b):e.findAll();break;case"create":f=e.create(b);break;case"update":f=e.update(b);break;case"delete":f=e.destroy(b)}f?c.success(f):c.error("Record not found")},Backbone.ajaxSync=Backbone.sync,Backbone.getSyncMethod=function(a){returna.localStorage||a.collection&&a.collection.localStorage?Backbone.localSync:Backbone.ajaxSync},Backbone.sync=function(a,b,c,d){returnBackbone.getSyncMethod(b).apply(this,[a,b,c,d])}})();