Skip to content

Commit

Permalink
minified v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Derick Bailey committed Oct 20, 2011
1 parent 22245f9 commit ec39fc4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backbone.memento.min.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Backbone.Memento v0.3.0
// Backbone.Memento v0.4.0
//
// Copyright (C)2011 Derick Bailey, Muted Solutions, LLC
// Distributed Under MIT Liscene
Expand All @@ -9,5 +9,6 @@
// ----------------------------
// Backbone.Memento
// ----------------------------
Backbone.Memento=function(c,a){function h(b,l){var d=e[b];if(d!==void 0){var d=i(d,l),f=c.toJSON(),f=i(f,l);var a=d,j=f,f=[];if(a&&j)for(var g in j)j.hasOwnProperty(g)&&(a.hasOwnProperty(g)||f.push(g));var a=c,h;for(h in f)g=f[h],k==="model"?a.unset(g):a.remove(g);k==="model"?c.set(d):c.reset(d);delete e[b]}}function i(b,a){b=_.clone(b);if(a.hasOwnProperty("ignore")&&a.ignore.length>0)for(var d in a.ignore)delete b[a.ignore[d]];return b}this.version="0.3.0";var a=_.extend({ignore:[]},a),e,k=c instanceof
Backbone.Model?"model":"collection";this.store=function(){var b=c.toJSON(),b=i(b,a);e.push(b)};this.restore=function(b){b===void 0&&(b=_.clone(a));var c=e.length-1;if(c<0)return null;h(c,b)};this.restart=function(){if(e.length===0)return null;h(0,a);e=[]};if(k==="model")this.reset=this.restart;e=[]};
Backbone.Memento=function(h,i){var m=function(b){b instanceof h.Model?(this.removeAttr=function(a){b.unset(a)},this.restore=function(a){b.set(a)}):(this.removeAttr=function(a){b.remove(a)},this.restore=function(a){b.reset(a)})},n=function(b,a){function c(a,b){a=i.clone(a);if(b.hasOwnProperty("ignore")&&b.ignore.length>0)for(var c in b.ignore)delete a[b.ignore[c]];return a}var d=new m(b);this.serialize=function(){var g=b.toJSON();return g=c(g,a)};this.deserialize=function(g,l){var e=l=i.extend({},
a,l);oldAttrs=c(g,e);var f=b.toJSON(),f=c(f,e);var e=oldAttrs,j=[];if(e&&f)for(var k in f)f.hasOwnProperty(k)&&(e.hasOwnProperty(k)||j.push(k));for(var h in j)d.removeAttr(j[h]);d.restore(oldAttrs)}},o=function(){var b;this.push=function(a){b.push(a)};this.pop=function(){return b.pop()};this.rewind=function(){var a=b[0];b=[];return a};b=[]};return function(b,a){this.version="0.4.0";var a=i.extend({ignore:[]},a),c=new n(b,a),d=new o(b,a);this.store=function(){var a=c.serialize();d.push(a)};this.restore=
function(a){var b=d.pop();b&&c.deserialize(b,a)};this.restart=function(a){var b=d.rewind();b&&c.deserialize(b,a)}}}(Backbone,_);

0 comments on commit ec39fc4

Please sign in to comment.