diff --git a/lib/min/plugins/sammy.cache-0.7.0.min.js b/lib/min/plugins/sammy.cache-0.7.1.min.js similarity index 96% rename from lib/min/plugins/sammy.cache-0.7.0.min.js rename to lib/min/plugins/sammy.cache-0.7.1.min.js index 4bf9a34e..e182a37a 100644 --- a/lib/min/plugins/sammy.cache-0.7.0.min.js +++ b/lib/min/plugins/sammy.cache-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.cache.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:39 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:15 -0800 (function(a){Sammy=Sammy||{};Sammy.MemoryCacheProxy=function(b){this._cache=b||{}};a.extend(Sammy.MemoryCacheProxy.prototype,{exists:function(b){return(typeof this._cache[b]!="undefined")},set:function(b,c){return this._cache[b]=c},get:function(b){return this._cache[b]},clear:function(b){delete this._cache[b]}});Sammy.DataCacheProxy=function(c,b){c=c||{};this.$element=b;a.each(c,function(d,e){b.data("cache."+d,e)})};a.extend(Sammy.DataCacheProxy.prototype,{exists:function(b){return(typeof this.$element.data("cache."+b)!="undefined")},set:function(b,c){return this.$element.data("cache."+b,c)},get:function(b){return this.$element.data("cache."+b)},clear:function(b){this.$element.removeData("cache."+b)}});Sammy.Cache=function(c,b){c.log("**WARNING:** This version of Sammy.Cache has been deprecated in favor of using the version in Sammy.Storage and will be removed in 1.0");if(b=="data"){this.cache_proxy=new Sammy.DataCacheProxy({},this.$element())}else{this.cache_proxy=new Sammy.MemoryCacheProxy({})}c.cache_partials=true;a.extend(c,{cache:function(d,e){if(typeof e=="undefined"){return this.cache_proxy.get(d)}else{if(a.isFunction(e)&&!this.cache_proxy.exists(d)){return this.cache_proxy.set(d,e.apply(this))}else{return this.cache_proxy.set(d,e)}}},clearCache:function(d){return this.cache_proxy.clear(d)}});c.helpers({cache:function(d,e){return this.app.cache(d,e)}})}})(jQuery); diff --git a/lib/min/plugins/sammy.cache-latest.min.js b/lib/min/plugins/sammy.cache-latest.min.js index 4bf9a34e..e182a37a 100644 --- a/lib/min/plugins/sammy.cache-latest.min.js +++ b/lib/min/plugins/sammy.cache-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.cache.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:39 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:15 -0800 (function(a){Sammy=Sammy||{};Sammy.MemoryCacheProxy=function(b){this._cache=b||{}};a.extend(Sammy.MemoryCacheProxy.prototype,{exists:function(b){return(typeof this._cache[b]!="undefined")},set:function(b,c){return this._cache[b]=c},get:function(b){return this._cache[b]},clear:function(b){delete this._cache[b]}});Sammy.DataCacheProxy=function(c,b){c=c||{};this.$element=b;a.each(c,function(d,e){b.data("cache."+d,e)})};a.extend(Sammy.DataCacheProxy.prototype,{exists:function(b){return(typeof this.$element.data("cache."+b)!="undefined")},set:function(b,c){return this.$element.data("cache."+b,c)},get:function(b){return this.$element.data("cache."+b)},clear:function(b){this.$element.removeData("cache."+b)}});Sammy.Cache=function(c,b){c.log("**WARNING:** This version of Sammy.Cache has been deprecated in favor of using the version in Sammy.Storage and will be removed in 1.0");if(b=="data"){this.cache_proxy=new Sammy.DataCacheProxy({},this.$element())}else{this.cache_proxy=new Sammy.MemoryCacheProxy({})}c.cache_partials=true;a.extend(c,{cache:function(d,e){if(typeof e=="undefined"){return this.cache_proxy.get(d)}else{if(a.isFunction(e)&&!this.cache_proxy.exists(d)){return this.cache_proxy.set(d,e.apply(this))}else{return this.cache_proxy.set(d,e)}}},clearCache:function(d){return this.cache_proxy.clear(d)}});c.helpers({cache:function(d,e){return this.app.cache(d,e)}})}})(jQuery); diff --git a/lib/min/plugins/sammy.data_location_proxy-0.7.0.min.js b/lib/min/plugins/sammy.data_location_proxy-0.7.1.min.js similarity index 94% rename from lib/min/plugins/sammy.data_location_proxy-0.7.0.min.js rename to lib/min/plugins/sammy.data_location_proxy-0.7.1.min.js index dabf2c8f..8decff04 100644 --- a/lib/min/plugins/sammy.data_location_proxy-0.7.0.min.js +++ b/lib/min/plugins/sammy.data_location_proxy-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.data_location_proxy.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:39 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:16 -0800 (function(a){Sammy=Sammy||{};Sammy.DataLocationProxy=function(d,c,b){this.app=d;this.data_name=c||"sammy-location";this.href_attribute=b};Sammy.DataLocationProxy.prototype={bind:function(){var b=this;this.app.$element().bind("setData",function(f,c,d){if(c==b.data_name){b.app.$element().each(function(){a.data(this,b.data_name,d)});b.app.trigger("location-changed")}});if(this.href_attribute){this.app.$element().delegate("["+this.href_attribute+"]","click",function(c){c.preventDefault();b.setLocation(a(this).attr(b.href_attribute))})}},unbind:function(){if(this.href_attribute){this.app.$element().undelegate("["+this.href_attribute+"]","click")}this.app.$element().unbind("setData")},getLocation:function(){return this.app.$element().data(this.data_name)||""},setLocation:function(b){return this.app.$element().data(this.data_name,b)}}})(jQuery); diff --git a/lib/min/plugins/sammy.data_location_proxy-latest.min.js b/lib/min/plugins/sammy.data_location_proxy-latest.min.js index dabf2c8f..8decff04 100644 --- a/lib/min/plugins/sammy.data_location_proxy-latest.min.js +++ b/lib/min/plugins/sammy.data_location_proxy-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.data_location_proxy.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:39 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:16 -0800 (function(a){Sammy=Sammy||{};Sammy.DataLocationProxy=function(d,c,b){this.app=d;this.data_name=c||"sammy-location";this.href_attribute=b};Sammy.DataLocationProxy.prototype={bind:function(){var b=this;this.app.$element().bind("setData",function(f,c,d){if(c==b.data_name){b.app.$element().each(function(){a.data(this,b.data_name,d)});b.app.trigger("location-changed")}});if(this.href_attribute){this.app.$element().delegate("["+this.href_attribute+"]","click",function(c){c.preventDefault();b.setLocation(a(this).attr(b.href_attribute))})}},unbind:function(){if(this.href_attribute){this.app.$element().undelegate("["+this.href_attribute+"]","click")}this.app.$element().unbind("setData")},getLocation:function(){return this.app.$element().data(this.data_name)||""},setLocation:function(b){return this.app.$element().data(this.data_name,b)}}})(jQuery); diff --git a/lib/min/plugins/sammy.ejs-0.7.0.min.js b/lib/min/plugins/sammy.ejs-0.7.1.min.js similarity index 82% rename from lib/min/plugins/sammy.ejs-0.7.0.min.js rename to lib/min/plugins/sammy.ejs-0.7.1.min.js index 982ddb3a..cb58cf6f 100644 --- a/lib/min/plugins/sammy.ejs-0.7.0.min.js +++ b/lib/min/plugins/sammy.ejs-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.ejs.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:40 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:17 -0800 (function(a){Sammy=Sammy||{};Sammy.EJS=function(d,b){var c=function(f,g,e){if(typeof e=="undefined"){e=f}return new EJS({text:f,name:e}).render(g)};if(!b){b="ejs"}d.helper(b,c)}})(jQuery); diff --git a/lib/min/plugins/sammy.ejs-latest.min.js b/lib/min/plugins/sammy.ejs-latest.min.js index 982ddb3a..cb58cf6f 100644 --- a/lib/min/plugins/sammy.ejs-latest.min.js +++ b/lib/min/plugins/sammy.ejs-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.ejs.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:40 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:17 -0800 (function(a){Sammy=Sammy||{};Sammy.EJS=function(d,b){var c=function(f,g,e){if(typeof e=="undefined"){e=f}return new EJS({text:f,name:e}).render(g)};if(!b){b="ejs"}d.helper(b,c)}})(jQuery); diff --git a/lib/min/plugins/sammy.exceptional-0.7.0.min.js b/lib/min/plugins/sammy.exceptional-0.7.1.min.js similarity index 83% rename from lib/min/plugins/sammy.exceptional-0.7.0.min.js rename to lib/min/plugins/sammy.exceptional-0.7.1.min.js index 36a22e98..19bbc8be 100644 --- a/lib/min/plugins/sammy.exceptional-0.7.0.min.js +++ b/lib/min/plugins/sammy.exceptional-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.exceptional.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:40 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:17 -0800 (function(a){Sammy=Sammy||{};Sammy.Exceptional=function(c,b){b=b||window.Exceptional;c.bind("error",function(f,d){if(d&&d.error){b.handle(d.error.message,window.location.href,"0")}})}}(jQuery)); diff --git a/lib/min/plugins/sammy.exceptional-latest.min.js b/lib/min/plugins/sammy.exceptional-latest.min.js index 36a22e98..19bbc8be 100644 --- a/lib/min/plugins/sammy.exceptional-latest.min.js +++ b/lib/min/plugins/sammy.exceptional-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.exceptional.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:40 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:17 -0800 (function(a){Sammy=Sammy||{};Sammy.Exceptional=function(c,b){b=b||window.Exceptional;c.bind("error",function(f,d){if(d&&d.error){b.handle(d.error.message,window.location.href,"0")}})}}(jQuery)); diff --git a/lib/min/plugins/sammy.flash-0.7.0.min.js b/lib/min/plugins/sammy.flash-0.7.1.min.js similarity index 95% rename from lib/min/plugins/sammy.flash-0.7.0.min.js rename to lib/min/plugins/sammy.flash-0.7.1.min.js index 35de2d7c..d666981f 100644 --- a/lib/min/plugins/sammy.flash-0.7.0.min.js +++ b/lib/min/plugins/sammy.flash-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.flash.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:41 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:18 -0800 (function(a){Sammy=Sammy||{};Sammy.FlashHash=function(){this.now={}};Sammy.FlashHash.prototype={toHTML:function(){var b=this._renderUL();this.clear();return b},clear:function(){this._clearHash(this);this._clearHash(this.now)},_onRedirect:function(){this._clearHash(this.now)},_clearHash:function(c){var b;for(b in c){if(b!=="now"&&c.hasOwnProperty(b)){delete c[b]}}},_renderUL:function(){return'"},_renderLIs:function(d){var b="",c;for(c in d){if(d[c]&&c!=="now"&&d.hasOwnProperty(c)){b=b+'
  • '+d[c]+"
  • "}}Sammy.log("rendered flash: "+b);return b}};Sammy.Flash=function(b){b.flash=new Sammy.FlashHash();b.helper("flash",function(c,d){if(arguments.length===0){return this.app.flash}else{if(arguments.length===2){this.app.flash[c]=d}}return this.app.flash[c]});b.helper("flashNow",function(c,d){if(arguments.length===0){return this.app.flash.now}else{if(arguments.length===2){this.app.flash.now[c]=d}}return this.app.flash.now[c]});b.bind("redirect",function(){this.app.flash._onRedirect()})}})(jQuery); diff --git a/lib/min/plugins/sammy.flash-latest.min.js b/lib/min/plugins/sammy.flash-latest.min.js index 35de2d7c..d666981f 100644 --- a/lib/min/plugins/sammy.flash-latest.min.js +++ b/lib/min/plugins/sammy.flash-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.flash.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:41 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:18 -0800 (function(a){Sammy=Sammy||{};Sammy.FlashHash=function(){this.now={}};Sammy.FlashHash.prototype={toHTML:function(){var b=this._renderUL();this.clear();return b},clear:function(){this._clearHash(this);this._clearHash(this.now)},_onRedirect:function(){this._clearHash(this.now)},_clearHash:function(c){var b;for(b in c){if(b!=="now"&&c.hasOwnProperty(b)){delete c[b]}}},_renderUL:function(){return'"},_renderLIs:function(d){var b="",c;for(c in d){if(d[c]&&c!=="now"&&d.hasOwnProperty(c)){b=b+'
  • '+d[c]+"
  • "}}Sammy.log("rendered flash: "+b);return b}};Sammy.Flash=function(b){b.flash=new Sammy.FlashHash();b.helper("flash",function(c,d){if(arguments.length===0){return this.app.flash}else{if(arguments.length===2){this.app.flash[c]=d}}return this.app.flash[c]});b.helper("flashNow",function(c,d){if(arguments.length===0){return this.app.flash.now}else{if(arguments.length===2){this.app.flash.now[c]=d}}return this.app.flash.now[c]});b.bind("redirect",function(){this.app.flash._onRedirect()})}})(jQuery); diff --git a/lib/min/plugins/sammy.form-0.7.0.min.js b/lib/min/plugins/sammy.form-0.7.1.min.js similarity index 97% rename from lib/min/plugins/sammy.form-0.7.0.min.js rename to lib/min/plugins/sammy.form-0.7.1.min.js index 40daba29..bce8ff8f 100644 --- a/lib/min/plugins/sammy.form-0.7.0.min.js +++ b/lib/min/plugins/sammy.form-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.form.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:42 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:19 -0800 (function(b){Sammy=Sammy||{};function a(d,e){if(typeof e==="undefined"){return""}else{if(b.isFunction(e)){e=e.apply(d)}}return e.toString()}function c(d,e,g){var f="<";f+=d;if(typeof e!="undefined"){b.each(e,function(h,i){if(i!=null){f+=" "+h+"='";f+=a(e,i).replace(/\'/g,"'");f+="'"}})}if(g===false){f+=">"}else{if(typeof g!="undefined"){f+=">";f+=a(this,g);f+=""}else{f+=" />"}}return f}Sammy.FormBuilder=function(e,d){this.name=e;this.object=d};b.extend(Sammy.FormBuilder.prototype,{open:function(d){return c("form",b.extend({method:"post",action:"#/"+this.name+"s"},d),false)},close:function(){return""},label:function(e,g,d){var f={"for":this._attributesForKeyPath(e).name};return c("label",b.extend(f,d),g)},hidden:function(e,d){d=b.extend({type:"hidden"},this._attributesForKeyPath(e),d);return c("input",d)},text:function(e,d){d=b.extend({type:"text"},this._attributesForKeyPath(e),d);return c("input",d)},textarea:function(e,d){var f;d=b.extend(this._attributesForKeyPath(e),d);f=d.value;delete d.value;return c("textarea",d,f)},password:function(e,d){return this.text(e,b.extend({type:"password"},d))},select:function(e,f,d){var h="",g;d=b.extend(this._attributesForKeyPath(e),d);g=d.value;delete d.value;b.each(f,function(j,k){var l,n,m;if(b.isArray(k)){l=k[1],n=k[0]}else{l=k,n=k}m={value:a(this.object,l)};if(l===g){m.selected="selected"}h+=c("option",m,n)});return c("select",d,h)},radio:function(e,g,d){var f;d=b.extend(this._attributesForKeyPath(e),d);f=d.value;d.value=a(this.object,g);if(f==d.value){d.checked="checked"}return c("input",b.extend({type:"radio"},d))},checkbox:function(e,g,d){var f="";if(!d){d={}}if(d.hidden_element!==false){f+=this.hidden(e,{value:!g})}delete d.hidden_element;f+=this.radio(e,g,b.extend({type:"checkbox"},d));return f},submit:function(d){return c("input",b.extend({type:"submit"},d))},_attributesForKeyPath:function(e){var d=this,g=b.isArray(e)?e:e.split(/\./),f=d.name,i=d.object,h=d.name;b.each(g,function(k,j){if((typeof i==="undefined")||i==""){i=""}else{if(typeof j=="number"||j.match(/^\d+$/)){i=i[parseInt(j,10)]}else{i=i[j]}}f+="["+j+"]";h+="-"+j});return{name:f,value:a(d.object,i),"class":h}}});Sammy.Form=function(d){d.helpers({simple_element:c,formFor:function(g,f,h){var e;if(b.isFunction(f)){h=f;f=this[g]}e=new Sammy.FormBuilder(g,f),h.apply(this,[e]);return e}})}})(jQuery); diff --git a/lib/min/plugins/sammy.form-latest.min.js b/lib/min/plugins/sammy.form-latest.min.js index 40daba29..bce8ff8f 100644 --- a/lib/min/plugins/sammy.form-latest.min.js +++ b/lib/min/plugins/sammy.form-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.form.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:42 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:19 -0800 (function(b){Sammy=Sammy||{};function a(d,e){if(typeof e==="undefined"){return""}else{if(b.isFunction(e)){e=e.apply(d)}}return e.toString()}function c(d,e,g){var f="<";f+=d;if(typeof e!="undefined"){b.each(e,function(h,i){if(i!=null){f+=" "+h+"='";f+=a(e,i).replace(/\'/g,"'");f+="'"}})}if(g===false){f+=">"}else{if(typeof g!="undefined"){f+=">";f+=a(this,g);f+=""}else{f+=" />"}}return f}Sammy.FormBuilder=function(e,d){this.name=e;this.object=d};b.extend(Sammy.FormBuilder.prototype,{open:function(d){return c("form",b.extend({method:"post",action:"#/"+this.name+"s"},d),false)},close:function(){return""},label:function(e,g,d){var f={"for":this._attributesForKeyPath(e).name};return c("label",b.extend(f,d),g)},hidden:function(e,d){d=b.extend({type:"hidden"},this._attributesForKeyPath(e),d);return c("input",d)},text:function(e,d){d=b.extend({type:"text"},this._attributesForKeyPath(e),d);return c("input",d)},textarea:function(e,d){var f;d=b.extend(this._attributesForKeyPath(e),d);f=d.value;delete d.value;return c("textarea",d,f)},password:function(e,d){return this.text(e,b.extend({type:"password"},d))},select:function(e,f,d){var h="",g;d=b.extend(this._attributesForKeyPath(e),d);g=d.value;delete d.value;b.each(f,function(j,k){var l,n,m;if(b.isArray(k)){l=k[1],n=k[0]}else{l=k,n=k}m={value:a(this.object,l)};if(l===g){m.selected="selected"}h+=c("option",m,n)});return c("select",d,h)},radio:function(e,g,d){var f;d=b.extend(this._attributesForKeyPath(e),d);f=d.value;d.value=a(this.object,g);if(f==d.value){d.checked="checked"}return c("input",b.extend({type:"radio"},d))},checkbox:function(e,g,d){var f="";if(!d){d={}}if(d.hidden_element!==false){f+=this.hidden(e,{value:!g})}delete d.hidden_element;f+=this.radio(e,g,b.extend({type:"checkbox"},d));return f},submit:function(d){return c("input",b.extend({type:"submit"},d))},_attributesForKeyPath:function(e){var d=this,g=b.isArray(e)?e:e.split(/\./),f=d.name,i=d.object,h=d.name;b.each(g,function(k,j){if((typeof i==="undefined")||i==""){i=""}else{if(typeof j=="number"||j.match(/^\d+$/)){i=i[parseInt(j,10)]}else{i=i[j]}}f+="["+j+"]";h+="-"+j});return{name:f,value:a(d.object,i),"class":h}}});Sammy.Form=function(d){d.helpers({simple_element:c,formFor:function(g,f,h){var e;if(b.isFunction(f)){h=f;f=this[g]}e=new Sammy.FormBuilder(g,f),h.apply(this,[e]);return e}})}})(jQuery); diff --git a/lib/min/plugins/sammy.form_2_json-0.7.0.min.js b/lib/min/plugins/sammy.form_2_json-0.7.1.min.js similarity index 96% rename from lib/min/plugins/sammy.form_2_json-0.7.0.min.js rename to lib/min/plugins/sammy.form_2_json-0.7.1.min.js index 0471faeb..80dc60fc 100644 --- a/lib/min/plugins/sammy.form_2_json-0.7.0.min.js +++ b/lib/min/plugins/sammy.form_2_json-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.form_2_json.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:42 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:19 -0800 (function(a){Sammy=Sammy||{};(function(){window.form2object=function(l,h,e){if(typeof e=="undefined"||e==null){e=true}if(typeof h=="undefined"||h==null){h="."}l=typeof l=="string"?document.getElementById(l):l;var q=c(l);var v={};var k={};for(var p=0;p-1&&n==o.length-1){m=f=t.substr(0,t.indexOf("["));if(!s[f]){s[f]=[]}s[f].push(r)}else{if(t.indexOf("[")>-1){f=t.substr(0,t.indexOf("["));var u=t.replace(/^[a-z]+\[|\]$/gi,"");m=m+f+u;if(!k[m]){k[m]={}}if(!s[f]){s[f]=[]}if(n==o.length-1){s[f].push(r)}else{if(!k[m][u]){s[f].push({});k[m][u]=s[f][s[f].length-1]}}s=k[m][u]}else{if(n-1&&n==o.length-1){m=f=t.substr(0,t.indexOf("["));if(!s[f]){s[f]=[]}s[f].push(r)}else{if(t.indexOf("[")>-1){f=t.substr(0,t.indexOf("["));var u=t.replace(/^[a-z]+\[|\]$/gi,"");m=m+f+u;if(!k[m]){k[m]={}}if(!s[f]){s[f]=[]}if(n==o.length-1){s[f].push(r)}else{if(!k[m][u]){s[f].push({});k[m][u]=s[f][s[f].length-1]}}s=k[m][u]}else{if(n0){if(a.isArray(q)){t=a("
    ");if(p.is("ol, ul")){m=true;r=p.children("li:first");if(r.length==0){r=a("
  • ")}}else{if(p.children().length==1){m=true;r=p.children(":first").clone()}else{r=p.clone()}}for(var l=0;l=0){var o=[n,1];o=o.concat(t.children().get());f.splice.apply(f,o)}}}}else{if(g.remove_false&&q===false){f.splice(n,1)}else{if(typeof q==="object"){if(p.is(":empty")){p.attr(q,true)}else{p.html(b(p.html(),q,g))}}else{p.html(q.toString())}}}}else{f.attr(s,q,true)}})}var j=f;return j};if(!c){c="meld"}d.helper(c,b)}})(jQuery); diff --git a/lib/min/plugins/sammy.meld-latest.min.js b/lib/min/plugins/sammy.meld-latest.min.js index 13199ce5..4a445cb8 100644 --- a/lib/min/plugins/sammy.meld-latest.min.js +++ b/lib/min/plugins/sammy.meld-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.meld.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:46 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:23 -0800 (function(a){Sammy=Sammy||{};Sammy.Meld=function(d,c){var e={selector:function(f){return"."+f},remove_false:true};var b=function(h,i,g){var f=a(h);g=a.extend(e,g||{});if(typeof i==="string"){f.html(i)}else{a.each(i,function(s,q){var k=g.selector(s),p=f.filter(k),t,r,m=false,n=f.index(p);if(p.length===0){p=f.find(k)}if(p.length>0){if(a.isArray(q)){t=a("
    ");if(p.is("ol, ul")){m=true;r=p.children("li:first");if(r.length==0){r=a("
  • ")}}else{if(p.children().length==1){m=true;r=p.children(":first").clone()}else{r=p.clone()}}for(var l=0;l=0){var o=[n,1];o=o.concat(t.children().get());f.splice.apply(f,o)}}}}else{if(g.remove_false&&q===false){f.splice(n,1)}else{if(typeof q==="object"){if(p.is(":empty")){p.attr(q,true)}else{p.html(b(p.html(),q,g))}}else{p.html(q.toString())}}}}else{f.attr(s,q,true)}})}var j=f;return j};if(!c){c="meld"}d.helper(c,b)}})(jQuery); diff --git a/lib/min/plugins/sammy.mustache-0.7.0.min.js b/lib/min/plugins/sammy.mustache-0.7.1.min.js similarity index 83% rename from lib/min/plugins/sammy.mustache-0.7.0.min.js rename to lib/min/plugins/sammy.mustache-0.7.1.min.js index 04a153ac..43eefede 100644 --- a/lib/min/plugins/sammy.mustache-0.7.0.min.js +++ b/lib/min/plugins/sammy.mustache-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.mustache.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:47 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:24 -0800 (function(a){Sammy=Sammy||{};Sammy.Mustache=function(d,b){var c=function(f,g,e){g=a.extend({},this,g);e=a.extend({},g.partials,e);return Mustache.to_html(f,g,e)};if(!b){b="mustache"}d.helper(b,c)}})(jQuery); diff --git a/lib/min/plugins/sammy.mustache-latest.min.js b/lib/min/plugins/sammy.mustache-latest.min.js index 04a153ac..43eefede 100644 --- a/lib/min/plugins/sammy.mustache-latest.min.js +++ b/lib/min/plugins/sammy.mustache-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.mustache.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:47 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:24 -0800 (function(a){Sammy=Sammy||{};Sammy.Mustache=function(d,b){var c=function(f,g,e){g=a.extend({},this,g);e=a.extend({},g.partials,e);return Mustache.to_html(f,g,e)};if(!b){b="mustache"}d.helper(b,c)}})(jQuery); diff --git a/lib/min/plugins/sammy.nested_params-0.7.0.min.js b/lib/min/plugins/sammy.nested_params-0.7.1.min.js similarity index 94% rename from lib/min/plugins/sammy.nested_params-0.7.0.min.js rename to lib/min/plugins/sammy.nested_params-0.7.1.min.js index 4bde5e7f..df939728 100644 --- a/lib/min/plugins/sammy.nested_params-0.7.0.min.js +++ b/lib/min/plugins/sammy.nested_params-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.nested_params.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:47 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:25 -0800 (function(b){Sammy=Sammy||{};function a(d){d=unescape(d);if(d==="true"){return true}else{if(d==="false"){return false}else{return d}}}function c(i,h,g){var e,d,f;if(h.match(/^[^\[]+$/)){i[h]=a(g)}else{if(e=h.match(/^([^\[]+)\[\](.*)$/)){d=e[1];f=e[2];if(i[d]&&!b.isArray(i[d])){throw ("400 Bad Request")}if(f){e=f.match(/^\[([^\]]+)\](.*)$/);if(!e){throw ("400 Bad Request")}if(i[d]){if(i[d][i[d].length-1][e[1]]){i[d].push(c({},e[1]+e[2],g))}else{b.extend(true,i[d][i[d].length-1],c({},e[1]+e[2],g))}}else{i[d]=[c({},e[1]+e[2],g)]}}else{if(i[d]){i[d].push(a(g))}else{i[d]=[a(g)]}}}else{if(e=h.match(/^([^\[]+)\[([^\[]+)\](.*)$/)){d=e[1];f=e[2]+e[3];if(i[d]&&b.isArray(i[d])){throw ("400 Bad Request")}if(i[d]){b.extend(true,i[d],c(i[d],f,g))}else{i[d]=c({},f,g)}}}}return i}Sammy.NestedParams=function(d){d._parseParamPair=c}})(jQuery); diff --git a/lib/min/plugins/sammy.nested_params-latest.min.js b/lib/min/plugins/sammy.nested_params-latest.min.js index 4bde5e7f..df939728 100644 --- a/lib/min/plugins/sammy.nested_params-latest.min.js +++ b/lib/min/plugins/sammy.nested_params-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.nested_params.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:47 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:25 -0800 (function(b){Sammy=Sammy||{};function a(d){d=unescape(d);if(d==="true"){return true}else{if(d==="false"){return false}else{return d}}}function c(i,h,g){var e,d,f;if(h.match(/^[^\[]+$/)){i[h]=a(g)}else{if(e=h.match(/^([^\[]+)\[\](.*)$/)){d=e[1];f=e[2];if(i[d]&&!b.isArray(i[d])){throw ("400 Bad Request")}if(f){e=f.match(/^\[([^\]]+)\](.*)$/);if(!e){throw ("400 Bad Request")}if(i[d]){if(i[d][i[d].length-1][e[1]]){i[d].push(c({},e[1]+e[2],g))}else{b.extend(true,i[d][i[d].length-1],c({},e[1]+e[2],g))}}else{i[d]=[c({},e[1]+e[2],g)]}}else{if(i[d]){i[d].push(a(g))}else{i[d]=[a(g)]}}}else{if(e=h.match(/^([^\[]+)\[([^\[]+)\](.*)$/)){d=e[1];f=e[2]+e[3];if(i[d]&&b.isArray(i[d])){throw ("400 Bad Request")}if(i[d]){b.extend(true,i[d],c(i[d],f,g))}else{i[d]=c({},f,g)}}}}return i}Sammy.NestedParams=function(d){d._parseParamPair=c}})(jQuery); diff --git a/lib/min/plugins/sammy.oauth2-0.7.0.min.js b/lib/min/plugins/sammy.oauth2-0.7.1.min.js similarity index 96% rename from lib/min/plugins/sammy.oauth2-0.7.0.min.js rename to lib/min/plugins/sammy.oauth2-0.7.1.min.js index 138a8c84..b94ba497 100644 --- a/lib/min/plugins/sammy.oauth2-0.7.0.min.js +++ b/lib/min/plugins/sammy.oauth2-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.oauth2.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:48 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:26 -0800 (function(a){Sammy=Sammy||{};Sammy.OAuth2=function(d){d.use("JSON");this.authorize="/oauth/authorize";this.helper("requireOAuth",function(e){if(this.app.getAccessToken()){if(e){e.apply(this)}}else{this.redirect(this.app.authorize+"?state="+escape(this.path));return false}});this.helper("loseAccessToken",function(){this.app.loseAccessToken()});this.requireOAuth=function(e){this.before(e||{},function(f){return f.requireOAuth()})};this.getAccessToken=function(){return this.session("oauth.token")};this.setAccessToken=function(e){this.session("oauth.token",e);this.trigger("oauth.connected")};this.loseAccessToken=function(){this.session("oauth.token",null);this.trigger("oauth.disconnected")};a(document).ajaxSend(function(e,g){var f=d.getAccessToken();if(f){g.setRequestHeader("Authorization","OAuth "+f)}});function c(h){var g=h.match(/#(.*)$/)[1];var f=g.split("&"),j={};for(var e in f){var k=f[e].split("=");j[k[0]]=k[1].replace(/\+/g," ")}return j}var b;this.bind("run",function(e,f){b=f.start_url||"#";if(this.app.getAccessToken()){this.trigger("oauth.connected")}});this.before(/#(access_token=|[^\\].*\&access_token=)/,function(e){var f=c(e.path);this.app.setAccessToken(f.access_token);e.redirect(f.state.length===0?this.app.start_url:unescape(f.state));return false}).get(/#(access_token=|[^\\].*\&access_token=)/,function(e){});this.before(/#(error=|[^\\].*\&error=)/,function(e){var g=c(e.path);var f=g.error_description||"Access denined";e.trigger("oauth.denied",{code:g.error,message:f});return false}).get(/#(error=|[^\\].*\&error=)/,function(e){})}})(jQuery); diff --git a/lib/min/plugins/sammy.oauth2-latest.min.js b/lib/min/plugins/sammy.oauth2-latest.min.js index 138a8c84..b94ba497 100644 --- a/lib/min/plugins/sammy.oauth2-latest.min.js +++ b/lib/min/plugins/sammy.oauth2-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.oauth2.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:48 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:26 -0800 (function(a){Sammy=Sammy||{};Sammy.OAuth2=function(d){d.use("JSON");this.authorize="/oauth/authorize";this.helper("requireOAuth",function(e){if(this.app.getAccessToken()){if(e){e.apply(this)}}else{this.redirect(this.app.authorize+"?state="+escape(this.path));return false}});this.helper("loseAccessToken",function(){this.app.loseAccessToken()});this.requireOAuth=function(e){this.before(e||{},function(f){return f.requireOAuth()})};this.getAccessToken=function(){return this.session("oauth.token")};this.setAccessToken=function(e){this.session("oauth.token",e);this.trigger("oauth.connected")};this.loseAccessToken=function(){this.session("oauth.token",null);this.trigger("oauth.disconnected")};a(document).ajaxSend(function(e,g){var f=d.getAccessToken();if(f){g.setRequestHeader("Authorization","OAuth "+f)}});function c(h){var g=h.match(/#(.*)$/)[1];var f=g.split("&"),j={};for(var e in f){var k=f[e].split("=");j[k[0]]=k[1].replace(/\+/g," ")}return j}var b;this.bind("run",function(e,f){b=f.start_url||"#";if(this.app.getAccessToken()){this.trigger("oauth.connected")}});this.before(/#(access_token=|[^\\].*\&access_token=)/,function(e){var f=c(e.path);this.app.setAccessToken(f.access_token);e.redirect(f.state.length===0?this.app.start_url:unescape(f.state));return false}).get(/#(access_token=|[^\\].*\&access_token=)/,function(e){});this.before(/#(error=|[^\\].*\&error=)/,function(e){var g=c(e.path);var f=g.error_description||"Access denined";e.trigger("oauth.denied",{code:g.error,message:f});return false}).get(/#(error=|[^\\].*\&error=)/,function(e){})}})(jQuery); diff --git a/lib/min/plugins/sammy.path_location_proxy-0.7.0.min.js b/lib/min/plugins/sammy.path_location_proxy-0.7.1.min.js similarity index 87% rename from lib/min/plugins/sammy.path_location_proxy-0.7.0.min.js rename to lib/min/plugins/sammy.path_location_proxy-0.7.1.min.js index c661b403..b5abee57 100644 --- a/lib/min/plugins/sammy.path_location_proxy-0.7.0.min.js +++ b/lib/min/plugins/sammy.path_location_proxy-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.path_location_proxy.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:49 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:26 -0800 (function(a){Sammy=Sammy||{};Sammy.PathLocationProxy=function(b){this.app=b};Sammy.PathLocationProxy.prototype={bind:function(){},unbind:function(){},getLocation:function(){return[window.location.pathname,window.location.search].join("")},setLocation:function(b){return window.location=b}}})(jQuery); diff --git a/lib/min/plugins/sammy.path_location_proxy-latest.min.js b/lib/min/plugins/sammy.path_location_proxy-latest.min.js index c661b403..b5abee57 100644 --- a/lib/min/plugins/sammy.path_location_proxy-latest.min.js +++ b/lib/min/plugins/sammy.path_location_proxy-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.path_location_proxy.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:49 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:26 -0800 (function(a){Sammy=Sammy||{};Sammy.PathLocationProxy=function(b){this.app=b};Sammy.PathLocationProxy.prototype={bind:function(){},unbind:function(){},getLocation:function(){return[window.location.pathname,window.location.search].join("")},setLocation:function(b){return window.location=b}}})(jQuery); diff --git a/lib/min/plugins/sammy.pure-0.7.0.min.js b/lib/min/plugins/sammy.pure-0.7.1.min.js similarity index 79% rename from lib/min/plugins/sammy.pure-0.7.0.min.js rename to lib/min/plugins/sammy.pure-0.7.1.min.js index d1759666..90c5cd13 100644 --- a/lib/min/plugins/sammy.pure-0.7.0.min.js +++ b/lib/min/plugins/sammy.pure-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.pure.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:49 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:27 -0800 (function(a){Sammy=Sammy||{};Sammy.Pure=function(d,b){var c=function(e,f,g){return a(e).autoRender(f,g)};if(!b){b="pure"}d.helper(b,c)}})(jQuery); diff --git a/lib/min/plugins/sammy.pure-latest.min.js b/lib/min/plugins/sammy.pure-latest.min.js index d1759666..90c5cd13 100644 --- a/lib/min/plugins/sammy.pure-latest.min.js +++ b/lib/min/plugins/sammy.pure-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.pure.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:49 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:27 -0800 (function(a){Sammy=Sammy||{};Sammy.Pure=function(d,b){var c=function(e,f,g){return a(e).autoRender(f,g)};if(!b){b="pure"}d.helper(b,c)}})(jQuery); diff --git a/lib/min/plugins/sammy.push_location_proxy-0.7.0.min.js b/lib/min/plugins/sammy.push_location_proxy-0.7.1.min.js similarity index 92% rename from lib/min/plugins/sammy.push_location_proxy-0.7.0.min.js rename to lib/min/plugins/sammy.push_location_proxy-0.7.1.min.js index 0266f003..325612d3 100644 --- a/lib/min/plugins/sammy.push_location_proxy-0.7.0.min.js +++ b/lib/min/plugins/sammy.push_location_proxy-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.push_location_proxy.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:50 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:28 -0800 (function(a){Sammy=Sammy||{};Sammy.PushLocationProxy=function(b){this.app=b};Sammy.PushLocationProxy.prototype={bind:function(){var b=this;a(window).bind("popstate",function(c){b.app.trigger("location-changed")});a("a").live("click",function(c){if(location.hostname==this.hostname){c.preventDefault();b.setLocation(a(this).attr("href"));b.app.trigger("location-changed")}})},unbind:function(){a("a").unbind("click");a(window).unbind("popstate")},getLocation:function(){return window.location.pathname},setLocation:function(b){history.pushState({path:this.path},"",b)}}})(jQuery); diff --git a/lib/min/plugins/sammy.push_location_proxy-latest.min.js b/lib/min/plugins/sammy.push_location_proxy-latest.min.js index 0266f003..325612d3 100644 --- a/lib/min/plugins/sammy.push_location_proxy-latest.min.js +++ b/lib/min/plugins/sammy.push_location_proxy-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.push_location_proxy.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:50 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:28 -0800 (function(a){Sammy=Sammy||{};Sammy.PushLocationProxy=function(b){this.app=b};Sammy.PushLocationProxy.prototype={bind:function(){var b=this;a(window).bind("popstate",function(c){b.app.trigger("location-changed")});a("a").live("click",function(c){if(location.hostname==this.hostname){c.preventDefault();b.setLocation(a(this).attr("href"));b.app.trigger("location-changed")}})},unbind:function(){a("a").unbind("click");a(window).unbind("popstate")},getLocation:function(){return window.location.pathname},setLocation:function(b){history.pushState({path:this.path},"",b)}}})(jQuery); diff --git a/lib/min/plugins/sammy.storage-0.7.0.min.js b/lib/min/plugins/sammy.storage-0.7.1.min.js similarity index 99% rename from lib/min/plugins/sammy.storage-0.7.0.min.js rename to lib/min/plugins/sammy.storage-0.7.1.min.js index f73c0e31..bb10295a 100644 --- a/lib/min/plugins/sammy.storage-0.7.0.min.js +++ b/lib/min/plugins/sammy.storage-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.storage.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:51 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:28 -0800 (function(a){Sammy=Sammy||{};Sammy.Store=function(c){var b=this;this.options=c||{};this.name=this.options.name||"store";this.element=this.options.element||"body";this.$element=a(this.element);if(a.isArray(this.options.type)){a.each(this.options.type,function(d,e){if(Sammy.Store.isAvailable(e)){b.type=e;return false}})}else{this.type=this.options.type||"memory"}this.meta_key=this.options.meta_key||"__keys__";this.storage=new Sammy.Store[Sammy.Store.stores[this.type]](this.name,this.element,this.options)};Sammy.Store.stores={memory:"Memory",data:"Data",local:"LocalStorage",session:"SessionStorage",cookie:"Cookie"};a.extend(Sammy.Store.prototype,{isAvailable:function(){if(a.isFunction(this.storage.isAvailable)){return this.storage.isAvailable()}else{true}},exists:function(b){return this.storage.exists(b)},set:function(c,d){var b=(typeof d=="string")?d:JSON.stringify(d);c=c.toString();this.storage.set(c,b);if(c!=this.meta_key){this._addKey(c);this.$element.trigger("set-"+this.name,{key:c,value:d});this.$element.trigger("set-"+this.name+"-"+c,{key:c,value:d})}return d},get:function(b){var c=this.storage.get(b);if(typeof c=="undefined"||c==null||c==""){return c}try{return JSON.parse(c)}catch(d){return c}},clear:function(b){this._removeKey(b);return this.storage.clear(b)},clearAll:function(){var b=this;this.each(function(c,d){b.clear(c)})},keys:function(){return this.get(this.meta_key)||[]},each:function(e){var b=0,d=this.keys(),c;for(b;b)[^\t]*)/g,"$1\r").replace(/\t=(.*?)%>/g,i).replace(/\t!(.*?)%>/g,'",$1,"').split("\t").join('");').split("%>").join('___$$$___.push("').split("\r").join("")+"\");}return ___$$$___.join('');")}if(typeof h!="undefined"){return f(h)}else{return f}};Sammy=Sammy||{};Sammy.Template=function(f,d){var e=function(i,j,h,g){if(typeof h=="undefined"){h=i}if(typeof g=="undefined"&&typeof h=="object"){g=h;h=i}return b(h,i,c.extend({},this,j),g)};if(!d){d="template"}f.helper(d,e)}})(jQuery); diff --git a/lib/min/plugins/sammy.template-latest.min.js b/lib/min/plugins/sammy.template-latest.min.js index 1a8b1e4e..021656d2 100644 --- a/lib/min/plugins/sammy.template-latest.min.js +++ b/lib/min/plugins/sammy.template-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.template.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:51 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:29 -0800 (function(c){var a={};var b=function(e,g,h,d){var f,i;if(a[e]){f=a[e]}else{if(typeof g=="undefined"){return false}if(d&&d.escape_html===false){i='",$1,"'}else{i='",h($1),"'}f=a[e]=new Function("obj",'var ___$$$___=[],print=function(){___$$$___.push.apply(___$$$___,arguments);};with(obj){___$$$___.push("'+String(g).replace(/[\r\t\n]/g," ").replace(/\"/g,'\\"').split("<%").join("\t").replace(/((^|%>)[^\t]*)/g,"$1\r").replace(/\t=(.*?)%>/g,i).replace(/\t!(.*?)%>/g,'",$1,"').split("\t").join('");').split("%>").join('___$$$___.push("').split("\r").join("")+"\");}return ___$$$___.join('');")}if(typeof h!="undefined"){return f(h)}else{return f}};Sammy=Sammy||{};Sammy.Template=function(f,d){var e=function(i,j,h,g){if(typeof h=="undefined"){h=i}if(typeof g=="undefined"&&typeof h=="object"){g=h;h=i}return b(h,i,c.extend({},this,j),g)};if(!d){d="template"}f.helper(d,e)}})(jQuery); diff --git a/lib/min/plugins/sammy.title-0.7.0.min.js b/lib/min/plugins/sammy.title-0.7.1.min.js similarity index 88% rename from lib/min/plugins/sammy.title-0.7.0.min.js rename to lib/min/plugins/sammy.title-0.7.1.min.js index 011de778..b37b454a 100644 --- a/lib/min/plugins/sammy.title-0.7.0.min.js +++ b/lib/min/plugins/sammy.title-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.title.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:52 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:30 -0800 (function(a){Sammy=Sammy||{};Sammy.Title=function(){this.setTitle=function(b){if(!a.isFunction(b)){this.title_function=function(c){return[b,c].join(" ")}}else{this.title_function=b}};this.helper("title",function(){var b=a.makeArray(arguments).join(" ");if(this.app.title_function){b=this.app.title_function(b)}document.title=b})}})(jQuery); diff --git a/lib/min/plugins/sammy.title-latest.min.js b/lib/min/plugins/sammy.title-latest.min.js index 011de778..b37b454a 100644 --- a/lib/min/plugins/sammy.title-latest.min.js +++ b/lib/min/plugins/sammy.title-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.title.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:52 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:30 -0800 (function(a){Sammy=Sammy||{};Sammy.Title=function(){this.setTitle=function(b){if(!a.isFunction(b)){this.title_function=function(c){return[b,c].join(" ")}}else{this.title_function=b}};this.helper("title",function(){var b=a.makeArray(arguments).join(" ");if(this.app.title_function){b=this.app.title_function(b)}document.title=b})}})(jQuery); diff --git a/lib/min/plugins/sammy.tmpl-0.7.0.min.js b/lib/min/plugins/sammy.tmpl-0.7.1.min.js similarity index 84% rename from lib/min/plugins/sammy.tmpl-0.7.0.min.js rename to lib/min/plugins/sammy.tmpl-0.7.1.min.js index b8e71f67..7381e14e 100644 --- a/lib/min/plugins/sammy.tmpl-0.7.0.min.js +++ b/lib/min/plugins/sammy.tmpl-0.7.1.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.tmpl.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:53 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:31 -0800 (function(a){Sammy=Sammy||{};Sammy.Tmpl=function(d,b){var c=function(f,g,e){if(typeof e=="undefined"){e=f}if(!jQuery.template[e]){jQuery.template(e,f)}return jQuery.tmpl(e,jQuery.extend({},this,g))};if(!b){b="tmpl"}d.helper(b,c)}})(jQuery); diff --git a/lib/min/plugins/sammy.tmpl-latest.min.js b/lib/min/plugins/sammy.tmpl-latest.min.js index b8e71f67..7381e14e 100644 --- a/lib/min/plugins/sammy.tmpl-latest.min.js +++ b/lib/min/plugins/sammy.tmpl-latest.min.js @@ -1,5 +1,5 @@ // -- Sammy.js -- /plugins/sammy.tmpl.js // http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:53 -0700 +// Version: 0.7.1 +// Built: 2012-01-21 16:40:31 -0800 (function(a){Sammy=Sammy||{};Sammy.Tmpl=function(d,b){var c=function(f,g,e){if(typeof e=="undefined"){e=f}if(!jQuery.template[e]){jQuery.template(e,f)}return jQuery.tmpl(e,jQuery.extend({},this,g))};if(!b){b="tmpl"}d.helper(b,c)}})(jQuery); diff --git a/lib/min/sammy-0.7.0.min.js b/lib/min/sammy-0.7.0.min.js deleted file mode 100644 index c6f0d088..00000000 --- a/lib/min/sammy-0.7.0.min.js +++ /dev/null @@ -1,5 +0,0 @@ -// -- Sammy.js -- /sammy.js -// http://sammyjs.org -// Version: 0.7.0 -// Built: 2011-07-30 16:55:53 -0700 -(function(h,j){var p,g="([^/]+)",k=/:([\w\d]+)/g,l=/\?([^#]*)$/,c=function(q){return Array.prototype.slice.call(q)},d=function(q){return Object.prototype.toString.call(q)==="[object Function]"},m=function(q){return Object.prototype.toString.call(q)==="[object Array]"},i=function(q){return decodeURIComponent((q||"").replace(/\+/g," "))},b=encodeURIComponent,f=function(q){return String(q).replace(/&(?!\w+;)/g,"&").replace(//g,">").replace(/"/g,""")},n=function(q){return function(r,s){return this.route.apply(this,[q,r,s])}},a={},o=!!(j.history&&history.pushState),e=[];p=function(){var r=c(arguments),s,q;p.apps=p.apps||{};if(r.length===0||r[0]&&d(r[0])){return p.apply(p,["body"].concat(r))}else{if(typeof(q=r.shift())=="string"){s=p.apps[q]||new p.Application();s.element_selector=q;if(r.length>0){h.each(r,function(t,u){s.use(u)})}if(s.element_selector!=q){delete p.apps[q]}p.apps[s.element_selector]=s;return s}}};p.VERSION="0.7.0";p.addLogger=function(q){e.push(q)};p.log=function(){var q=c(arguments);q.unshift("["+Date()+"]");h.each(e,function(s,r){r.apply(p,q)})};if(typeof j.console!="undefined"){if(d(j.console.log.apply)){p.addLogger(function(){j.console.log.apply(j.console,arguments)})}else{p.addLogger(function(){j.console.log(arguments)})}}else{if(typeof console!="undefined"){p.addLogger(function(){console.log.apply(console,arguments)})}}h.extend(p,{makeArray:c,isFunction:d,isArray:m});p.Object=function(q){return h.extend(this,q||{})};h.extend(p.Object.prototype,{escapeHTML:f,h:f,toHash:function(){var q={};h.each(this,function(s,r){if(!d(r)){q[s]=r}});return q},toHTML:function(){var q="";h.each(this,function(s,r){if(!d(r)){q+=""+s+" "+r+"
    "}});return q},keys:function(q){var r=[];for(var s in this){if(!d(this[s])||!q){r.push(s)}}return r},has:function(q){return this[q]&&h.trim(this[q].toString())!==""},join:function(){var r=c(arguments);var q=r.shift();return r.join(q)},log:function(){p.log.apply(p,arguments)},toString:function(q){var r=[];h.each(this,function(t,s){if(!d(s)||q){r.push('"'+t+'": '+s.toString())}});return"Sammy.Object: {"+r.join(",")+"}"}});p.DefaultLocationProxy=function(r,q){this.app=r;this.is_native=false;this.has_history=o;this._startPolling(q)};p.DefaultLocationProxy.fullPath=function(q){var r=q.toString().match(/^[^#]*(#.+)$/);var s=r?r[1]:"";return[q.pathname,q.search,s].join("")};p.DefaultLocationProxy.prototype={bind:function(){var r=this,s=this.app,q=p.DefaultLocationProxy;h(j).bind("hashchange."+this.app.eventNamespace(),function(u,t){if(r.is_native===false&&!t){r.is_native=true;j.clearInterval(q._interval)}s.trigger("location-changed")});if(o&&!s.disable_push_state){h(j).bind("popstate."+this.app.eventNamespace(),function(t){s.trigger("location-changed")});h("a").live("click.history-"+this.app.eventNamespace(),function(u){var t=q.fullPath(this);if(this.hostname==j.location.hostname&&s.lookupRoute("get",t)){u.preventDefault();r.setLocation(t);return false}})}if(!q._bindings){q._bindings=0}q._bindings++},unbind:function(){h(j).unbind("hashchange."+this.app.eventNamespace());h(j).unbind("popstate."+this.app.eventNamespace());h("a").die("click.history-"+this.app.eventNamespace());p.DefaultLocationProxy._bindings--;if(p.DefaultLocationProxy._bindings<=0){j.clearInterval(p.DefaultLocationProxy._interval)}},getLocation:function(){return p.DefaultLocationProxy.fullPath(j.location)},setLocation:function(q){if(/^([^#\/]|$)/.test(q)){if(o){q="/"+q}else{q="#!/"+q}}if(q!=this.getLocation()){if(o&&/^\//.test(q)){history.pushState({path:q},j.title,q);this.app.trigger("location-changed")}else{return(j.location=q)}}},_startPolling:function(s){var r=this;if(!p.DefaultLocationProxy._interval){if(!s){s=10}var q=function(){var t=r.getLocation();if(typeof p.DefaultLocationProxy._last_location=="undefined"||t!=p.DefaultLocationProxy._last_location){j.setTimeout(function(){h(j).trigger("hashchange",[true])},0)}p.DefaultLocationProxy._last_location=t};q();p.DefaultLocationProxy._interval=j.setInterval(q,s)}}};p.Application=function(q){var r=this;this.routes={};this.listeners=new p.Object({});this.arounds=[];this.befores=[];this.namespace=(new Date()).getTime()+"-"+parseInt(Math.random()*1000,10);this.context_prototype=function(){p.EventContext.apply(this,arguments)};this.context_prototype.prototype=new p.EventContext();if(d(q)){q.apply(this,[this])}if(!this._location_proxy){this.setLocationProxy(new p.DefaultLocationProxy(this,this.run_interval_every))}if(this.debug){this.bindToAllEvents(function(t,s){r.log(r.toString(),t.cleaned_type,s||{})})}};p.Application.prototype=h.extend({},p.Object.prototype,{ROUTE_VERBS:["get","post","put","delete"],APP_EVENTS:["run","unload","lookup-route","run-route","route-found","event-context-before","event-context-after","changed","error","check-form-submission","redirect","location-changed"],_last_route:null,_location_proxy:null,_running:false,element_selector:"body",debug:false,raise_errors:false,run_interval_every:50,disable_push_state:false,template_engine:null,toString:function(){return"Sammy.Application:"+this.element_selector},$element:function(q){return q?h(this.element_selector).find(q):h(this.element_selector)},use:function(){var q=c(arguments),s=q.shift(),r=s||"";try{q.unshift(this);if(typeof s=="string"){r="Sammy."+s;s=p[s]}s.apply(this,q)}catch(t){if(typeof s==="undefined"){this.error("Plugin Error: called use() but plugin ("+r.toString()+") is not defined",t)}else{if(!d(s)){this.error("Plugin Error: called use() but '"+r.toString()+"' is not a function",t)}else{this.error("Plugin Error",t)}}}return this},setLocationProxy:function(q){var r=this._location_proxy;this._location_proxy=q;if(this.isRunning()){if(r){r.unbind()}this._location_proxy.bind()}},route:function(u,r,w){var t=this,v=[],q,s;if(!w&&d(r)){r=u;w=r;u="any"}u=u.toLowerCase();if(r.constructor==String){k.lastIndex=0;while((s=k.exec(r))!==null){v.push(s[1])}r=new RegExp(r.replace(k,g)+"$")}if(typeof w=="string"){w=t[w]}q=function(x){var y={verb:x,path:r,callback:w,param_names:v};t.routes[x]=t.routes[x]||[];t.routes[x].push(y)};if(u==="any"){h.each(this.ROUTE_VERBS,function(y,x){q(x)})}else{q(u)}return this},get:n("get"),post:n("post"),put:n("put"),del:n("delete"),any:n("any"),mapRoutes:function(r){var q=this;h.each(r,function(s,t){q.route.apply(q,t)});return this},eventNamespace:function(){return["sammy-app",this.namespace].join("-")},bind:function(q,s,u){var t=this;if(typeof u=="undefined"){u=s}var r=function(){var x,v,w;x=arguments[0];w=arguments[1];if(w&&w.context){v=w.context;delete w.context}else{v=new t.context_prototype(t,"bind",x.type,w,x.target)}x.cleaned_type=x.type.replace(t.eventNamespace(),"");u.apply(v,[x,w])};if(!this.listeners[q]){this.listeners[q]=[]}this.listeners[q].push(r);if(this.isRunning()){this._listen(q,r)}return this},trigger:function(q,r){this.$element().trigger([q,this.eventNamespace()].join("."),[r]);return this},refresh:function(){this.last_location=null;this.trigger("location-changed");return this},before:function(q,r){if(d(q)){r=q;q={}}this.befores.push([q,r]);return this},after:function(q){return this.bind("event-context-after",q)},around:function(q){this.arounds.push(q);return this},isRunning:function(){return this._running},helpers:function(q){h.extend(this.context_prototype.prototype,q);return this},helper:function(q,r){this.context_prototype.prototype[q]=r;return this},run:function(q){if(this.isRunning()){return false}var r=this;h.each(this.listeners.toHash(),function(s,t){h.each(t,function(v,u){r._listen(s,u)})});this.trigger("run",{start_url:q});this._running=true;this.last_location=null;if(!(/\#(.+)/.test(this.getLocation()))&&typeof q!="undefined"){this.setLocation(q)}this._checkLocation();this._location_proxy.bind();this.bind("location-changed",function(){r._checkLocation()});this.bind("submit",function(t){var s=r._checkFormSubmission(h(t.target).closest("form"));return(s===false)?t.preventDefault():false});h(j).bind("beforeunload",function(){r.unload()});return this.trigger("changed")},unload:function(){if(!this.isRunning()){return false}var q=this;this.trigger("unload");this._location_proxy.unbind();this.$element().unbind("submit").removeClass(q.eventNamespace());h.each(this.listeners.toHash(),function(r,s){h.each(s,function(u,t){q._unlisten(r,t)})});this._running=false;return this},bindToAllEvents:function(r){var q=this;h.each(this.APP_EVENTS,function(s,t){q.bind(t,r)});h.each(this.listeners.keys(true),function(t,s){if(h.inArray(s,q.APP_EVENTS)==-1){q.bind(s,r)}});return this},routablePath:function(q){return q.replace(l,"")},lookupRoute:function(w,u){var v=this,t=false,s=0,q,r;if(typeof this.routes[w]!="undefined"){q=this.routes[w].length;for(;s0){B=E.shift();if(t.contextMatchesOptions(r,B[0])){G=B[1].apply(r,[r]);if(G===false){return false}}}t.last_route=D;r.trigger("event-context-before",{context:r});G=D.callback.apply(r,y);r.trigger("event-context-after",{context:r});return G};h.each(v.reverse(),function(G,H){var I=A;A=function(){return H.apply(r,[I])}});try{q=A()}catch(w){this.error(["500 Error",s,F].join(" "),w)}return q}else{return this.notFound(s,F)}},contextMatchesOptions:function(t,v,r){var s=v;if(typeof s==="undefined"||s=={}){return true}if(typeof r==="undefined"){r=true}if(typeof s==="string"||d(s.test)){s={path:s}}if(s.only){return this.contextMatchesOptions(t,s.only,true)}else{if(s.except){return this.contextMatchesOptions(t,s.except,false)}}var q=true,u=true;if(s.path){if(!d(s.path.test)){s.path=new RegExp(s.path.toString()+"$")}q=s.path.test(t.path)}if(s.verb){if(typeof s.verb==="string"){u=s.verb===t.verb}else{u=s.verb.indexOf(t.verb)>-1}}return r?(u&&q):!(u&&q)},getLocation:function(){return this._location_proxy.getLocation()},setLocation:function(q){return this._location_proxy.setLocation(q)},swap:function(q){return this.$element().html(q)},templateCache:function(q,r){if(typeof r!="undefined"){return a[q]=r}else{return a[q]}},clearTemplateCache:function(){return a={}},notFound:function(s,r){var q=this.error(["404 Not Found",s,r].join(" "));return(s==="get")?q:true},error:function(r,q){if(!q){q=new Error()}q.message=[r,q.message].join(" ");this.trigger("error",{message:q.message,error:q});if(this.raise_errors){throw (q)}else{this.log(q.message,q)}},_checkLocation:function(){var q,r;q=this.getLocation();if(!this.last_location||this.last_location[0]!="get"||this.last_location[1]!=q){this.last_location=["get",q];r=this.runRoute("get",q)}return r},_getFormVerb:function(s){var r=h(s),t,q;q=r.find('input[name="_method"]');if(q.length>0){t=q.val()}if(!t){t=r[0].getAttribute("method")}if(!t||t==""){t="get"}return h.trim(t.toString().toLowerCase())},_checkFormSubmission:function(s){var q,t,v,u,r;this.trigger("check-form-submission",{form:s});q=h(s);t=q.attr("action")||"";v=this._getFormVerb(q);this.log("_checkFormSubmission",q,t,v);if(v==="get"){this.setLocation(t+"?"+this._serializeFormParams(q));r=false}else{u=h.extend({},this._parseFormParams(q));r=this.runRoute(v,t,u,s.get(0))}return(typeof r=="undefined")?false:r},_serializeFormParams:function(r){var t="",q=r.serializeArray(),s;if(q.length>0){t=this._encodeFormPair(q[0].name,q[0].value);for(s=1;s0){this.then(this.callbacks.shift())}},load:function(q,r,t){var s=this;return this.then(function(){var u,v,x,w;if(d(r)){t=r;r={}}else{r=h.extend({},r)}if(t){this.then(t)}if(typeof q==="string"){x=(q.match(/\.json$/)||r.json);u=((x&&r.cache===true)||r.cache!==false);s.next_engine=s.event_context.engineFor(q);delete r.cache;delete r.json;if(r.engine){s.next_engine=r.engine;delete r.engine}if(u&&(v=this.event_context.app.templateCache(q))){return v}this.wait();h.ajax(h.extend({url:q,data:{},dataType:x?"json":null,type:"get",success:function(y){if(u){s.event_context.app.templateCache(q,y)}s.next(y)}},r));return false}else{if(q.nodeType){return q.innerHTML}if(q.selector){s.next_engine=q.attr("data-engine");if(r.clone===false){return q.remove()[0].innerHTML.toString()}else{return q[0].innerHTML.toString()}}}})},loadPartials:function(q){if(q){this.partials=this.partials||{};for(name in q){this.load(q[name]).then(function(r){this.partials[name]=r})}}return this},render:function(q,s,t,r){if(d(q)&&!s){return this.then(q)}else{return this.loadPartials(r).load(q).interpolate(s,q).then(t)}},partial:function(q,r){return this.render(q,r).swap()},send:function(){var s=this,r=c(arguments),q=r.shift();if(m(r[0])){r=r[0]}return this.then(function(t){r.push(function(u){s.next(u)});s.wait();q.apply(q,r);return false})},collect:function(u,t,q){var s=this;var r=function(){if(d(u)){t=u;u=this.content}var v=[],w=false;h.each(u,function(x,z){var y=t.apply(s,[x,z]);if(y.jquery&&y.length==1){y=y[0];w=true}v.push(y);return y});return w?v:v.join("")};return q?r():this.then(r)},renderEach:function(q,r,s,t){if(m(r)){t=s;s=r;r=null}return this.load(q).then(function(v){var u=this;if(!s){s=m(this.previous_content)?this.previous_content:[]}if(t){h.each(s,function(w,y){var z={},x=this.next_engine||q;r?(z[r]=y):(z=y);t(y,u.event_context.interpolate(v,z,x))})}else{return this.collect(s,function(w,y){var z={},x=this.next_engine||q;r?(z[r]=y):(z=y);return this.event_context.interpolate(v,z,x)},true)}})},interpolate:function(t,s,q){var r=this;return this.then(function(v,u){if(!t&&u){t=u}if(this.next_engine){s=this.next_engine;this.next_engine=false}var w=r.event_context.interpolate(v,t,s,this.partials);return q?u+w:w})},swap:function(){return this.then(function(q){this.event_context.swap(q)}).trigger("changed",{})},appendTo:function(q){return this.then(function(r){h(q).append(r)}).trigger("changed",{})},prependTo:function(q){return this.then(function(r){h(q).prepend(r)}).trigger("changed",{})},replace:function(q){return this.then(function(r){h(q).html(r)}).trigger("changed",{})},trigger:function(q,r){return this.then(function(s){if(typeof r=="undefined"){r={content:s}}this.event_context.trigger(q,r)})}});p.EventContext=function(u,t,r,s,q){this.app=u;this.verb=t;this.path=r;this.params=new p.Object(s);this.target=q};p.EventContext.prototype=h.extend({},p.Object.prototype,{$element:function(){return this.app.$element(c(arguments).shift())},engineFor:function(s){var r=this,q;if(d(s)){return s}s=(s||r.app.template_engine).toString();if((q=s.match(/\.([^\.\?\#]+)$/))){s=q[1]}if(s&&d(r[s])){return r[s]}if(r.app.template_engine){return this.engineFor(r.app.template_engine)}return function(t,u){return t}},interpolate:function(s,t,r,q){return this.engineFor(r).apply(this,[s,t,q])},render:function(q,s,t,r){return new p.RenderContext(this).render(q,s,t,r)},renderEach:function(q,r,s,t){return new p.RenderContext(this).renderEach(q,r,s,t)},load:function(q,r,s){return new p.RenderContext(this).load(q,r,s)},partial:function(q,r){return new p.RenderContext(this).partial(q,r)},send:function(){var q=new p.RenderContext(this);return q.send.apply(q,arguments)},redirect:function(){var y,w=c(arguments),v=this.app.getLocation(),r=w.length;if(r>1){var u=0,z=[],q=[],t={},x=false;for(;u/g,">").replace(/"/g,""")},n=function(q){return function(r,s){return this.route.apply(this,[q,r,s])}},a={},o=!!(j.history&&history.pushState),e=[];p=function(){var r=c(arguments),s,q;p.apps=p.apps||{};if(r.length===0||r[0]&&d(r[0])){return p.apply(p,["body"].concat(r))}else{if(typeof(q=r.shift())=="string"){s=p.apps[q]||new p.Application();s.element_selector=q;if(r.length>0){h.each(r,function(t,u){s.use(u)})}if(s.element_selector!=q){delete p.apps[q]}p.apps[s.element_selector]=s;return s}}};p.VERSION="0.7.1";p.addLogger=function(q){e.push(q)};p.log=function(){var q=c(arguments);q.unshift("["+Date()+"]");h.each(e,function(s,r){r.apply(p,q)})};if(typeof j.console!="undefined"){if(d(j.console.log.apply)){p.addLogger(function(){j.console.log.apply(j.console,arguments)})}else{p.addLogger(function(){j.console.log(arguments)})}}else{if(typeof console!="undefined"){p.addLogger(function(){console.log.apply(console,arguments)})}}h.extend(p,{makeArray:c,isFunction:d,isArray:m});p.Object=function(q){return h.extend(this,q||{})};h.extend(p.Object.prototype,{escapeHTML:f,h:f,toHash:function(){var q={};h.each(this,function(s,r){if(!d(r)){q[s]=r}});return q},toHTML:function(){var q="";h.each(this,function(s,r){if(!d(r)){q+=""+s+" "+r+"
    "}});return q},keys:function(q){var r=[];for(var s in this){if(!d(this[s])||!q){r.push(s)}}return r},has:function(q){return this[q]&&h.trim(this[q].toString())!==""},join:function(){var r=c(arguments);var q=r.shift();return r.join(q)},log:function(){p.log.apply(p,arguments)},toString:function(q){var r=[];h.each(this,function(t,s){if(!d(s)||q){r.push('"'+t+'": '+s.toString())}});return"Sammy.Object: {"+r.join(",")+"}"}});p.DefaultLocationProxy=function(r,q){this.app=r;this.is_native=false;this.has_history=o;this._startPolling(q)};p.DefaultLocationProxy.fullPath=function(q){var r=q.toString().match(/^[^#]*(#.+)$/);var s=r?r[1]:"";return[q.pathname,q.search,s].join("")};p.DefaultLocationProxy.prototype={bind:function(){var r=this,s=this.app,q=p.DefaultLocationProxy;h(j).bind("hashchange."+this.app.eventNamespace(),function(u,t){if(r.is_native===false&&!t){r.is_native=true;j.clearInterval(q._interval)}s.trigger("location-changed")});if(o&&!s.disable_push_state){h(j).bind("popstate."+this.app.eventNamespace(),function(t){s.trigger("location-changed")});h("a").live("click.history-"+this.app.eventNamespace(),function(u){if(u.isDefaultPrevented()){return}var t=q.fullPath(this);if(this.hostname==j.location.hostname&&s.lookupRoute("get",t)){u.preventDefault();r.setLocation(t);return false}})}if(!q._bindings){q._bindings=0}q._bindings++},unbind:function(){h(j).unbind("hashchange."+this.app.eventNamespace());h(j).unbind("popstate."+this.app.eventNamespace());h("a").die("click.history-"+this.app.eventNamespace());p.DefaultLocationProxy._bindings--;if(p.DefaultLocationProxy._bindings<=0){j.clearInterval(p.DefaultLocationProxy._interval)}},getLocation:function(){return p.DefaultLocationProxy.fullPath(j.location)},setLocation:function(q){if(/^([^#\/]|$)/.test(q)){if(o){q="/"+q}else{q="#!/"+q}}if(q!=this.getLocation()){if(o&&/^\//.test(q)){history.pushState({path:q},j.title,q);this.app.trigger("location-changed")}else{return(j.location=q)}}},_startPolling:function(s){var r=this;if(!p.DefaultLocationProxy._interval){if(!s){s=10}var q=function(){var t=r.getLocation();if(typeof p.DefaultLocationProxy._last_location=="undefined"||t!=p.DefaultLocationProxy._last_location){j.setTimeout(function(){h(j).trigger("hashchange",[true])},0)}p.DefaultLocationProxy._last_location=t};q();p.DefaultLocationProxy._interval=j.setInterval(q,s)}}};p.Application=function(q){var r=this;this.routes={};this.listeners=new p.Object({});this.arounds=[];this.befores=[];this.namespace=(new Date()).getTime()+"-"+parseInt(Math.random()*1000,10);this.context_prototype=function(){p.EventContext.apply(this,arguments)};this.context_prototype.prototype=new p.EventContext();if(d(q)){q.apply(this,[this])}if(!this._location_proxy){this.setLocationProxy(new p.DefaultLocationProxy(this,this.run_interval_every))}if(this.debug){this.bindToAllEvents(function(t,s){r.log(r.toString(),t.cleaned_type,s||{})})}};p.Application.prototype=h.extend({},p.Object.prototype,{ROUTE_VERBS:["get","post","put","delete"],APP_EVENTS:["run","unload","lookup-route","run-route","route-found","event-context-before","event-context-after","changed","error","check-form-submission","redirect","location-changed"],_last_route:null,_location_proxy:null,_running:false,element_selector:"body",debug:false,raise_errors:false,run_interval_every:50,disable_push_state:false,template_engine:null,toString:function(){return"Sammy.Application:"+this.element_selector},$element:function(q){return q?h(this.element_selector).find(q):h(this.element_selector)},use:function(){var q=c(arguments),s=q.shift(),r=s||"";try{q.unshift(this);if(typeof s=="string"){r="Sammy."+s;s=p[s]}s.apply(this,q)}catch(t){if(typeof s==="undefined"){this.error("Plugin Error: called use() but plugin ("+r.toString()+") is not defined",t)}else{if(!d(s)){this.error("Plugin Error: called use() but '"+r.toString()+"' is not a function",t)}else{this.error("Plugin Error",t)}}}return this},setLocationProxy:function(q){var r=this._location_proxy;this._location_proxy=q;if(this.isRunning()){if(r){r.unbind()}this._location_proxy.bind()}},log:function(){p.log.apply(p,Array.prototype.concat.apply([this.element_selector],arguments))},route:function(u,r,w){var t=this,v=[],q,s;if(!w&&d(r)){r=u;w=r;u="any"}u=u.toLowerCase();if(r.constructor==String){k.lastIndex=0;while((s=k.exec(r))!==null){v.push(s[1])}r=new RegExp(r.replace(k,g)+"$")}if(typeof w=="string"){w=t[w]}q=function(x){var y={verb:x,path:r,callback:w,param_names:v};t.routes[x]=t.routes[x]||[];t.routes[x].push(y)};if(u==="any"){h.each(this.ROUTE_VERBS,function(y,x){q(x)})}else{q(u)}return this},get:n("get"),post:n("post"),put:n("put"),del:n("delete"),any:n("any"),mapRoutes:function(r){var q=this;h.each(r,function(s,t){q.route.apply(q,t)});return this},eventNamespace:function(){return["sammy-app",this.namespace].join("-")},bind:function(q,s,u){var t=this;if(typeof u=="undefined"){u=s}var r=function(){var x,v,w;x=arguments[0];w=arguments[1];if(w&&w.context){v=w.context;delete w.context}else{v=new t.context_prototype(t,"bind",x.type,w,x.target)}x.cleaned_type=x.type.replace(t.eventNamespace(),"");u.apply(v,[x,w])};if(!this.listeners[q]){this.listeners[q]=[]}this.listeners[q].push(r);if(this.isRunning()){this._listen(q,r)}return this},trigger:function(q,r){this.$element().trigger([q,this.eventNamespace()].join("."),[r]);return this},refresh:function(){this.last_location=null;this.trigger("location-changed");return this},before:function(q,r){if(d(q)){r=q;q={}}this.befores.push([q,r]);return this},after:function(q){return this.bind("event-context-after",q)},around:function(q){this.arounds.push(q);return this},isRunning:function(){return this._running},helpers:function(q){h.extend(this.context_prototype.prototype,q);return this},helper:function(q,r){this.context_prototype.prototype[q]=r;return this},run:function(q){if(this.isRunning()){return false}var r=this;h.each(this.listeners.toHash(),function(s,t){h.each(t,function(v,u){r._listen(s,u)})});this.trigger("run",{start_url:q});this._running=true;this.last_location=null;if(!(/\#(.+)/.test(this.getLocation()))&&typeof q!="undefined"){this.setLocation(q)}this._checkLocation();this._location_proxy.bind();this.bind("location-changed",function(){r._checkLocation()});this.bind("submit",function(t){var s=r._checkFormSubmission(h(t.target).closest("form"));return(s===false)?t.preventDefault():false});h(j).bind("beforeunload",function(){r.unload()});return this.trigger("changed")},unload:function(){if(!this.isRunning()){return false}var q=this;this.trigger("unload");this._location_proxy.unbind();this.$element().unbind("submit").removeClass(q.eventNamespace());h.each(this.listeners.toHash(),function(r,s){h.each(s,function(u,t){q._unlisten(r,t)})});this._running=false;return this},bindToAllEvents:function(r){var q=this;h.each(this.APP_EVENTS,function(s,t){q.bind(t,r)});h.each(this.listeners.keys(true),function(t,s){if(h.inArray(s,q.APP_EVENTS)==-1){q.bind(s,r)}});return this},routablePath:function(q){return q.replace(l,"")},lookupRoute:function(w,u){var v=this,t=false,s=0,q,r;if(typeof this.routes[w]!="undefined"){q=this.routes[w].length;for(;s0){B=E.shift();if(t.contextMatchesOptions(r,B[0])){G=B[1].apply(r,[r]);if(G===false){return false}}}t.last_route=D;r.trigger("event-context-before",{context:r});G=D.callback.apply(r,y);r.trigger("event-context-after",{context:r});return G};h.each(v.reverse(),function(G,H){var I=A;A=function(){return H.apply(r,[I])}});try{q=A()}catch(w){this.error(["500 Error",s,F].join(" "),w)}return q}else{return this.notFound(s,F)}},contextMatchesOptions:function(r,t,y){var z=t;if(typeof z==="undefined"||h.isPlainObject(z)){return true}if(typeof y==="undefined"){y=true}if(typeof z==="string"||d(z.test)){z={path:z}}if(m(z.path)){var x,u,q;x=[];for(u in z.path){q=h.extend({},z,{path:z.path[u]});x.push(this.contextMatchesOptions(r,q))}var s=h.inArray(true,x)>-1?true:false;return y?s:!s}if(z.only){return this.contextMatchesOptions(r,z.only,true)}else{if(z.except){return this.contextMatchesOptions(r,z.except,false)}}var v=true,w=true;if(z.path){if(!d(z.path.test)){z.path=new RegExp(z.path.toString()+"$")}v=z.path.test(r.path)}if(z.verb){if(typeof z.verb==="string"){w=z.verb===r.verb}else{w=z.verb.indexOf(r.verb)>-1}}return y?(w&&v):!(w&&v)},getLocation:function(){return this._location_proxy.getLocation()},setLocation:function(q){return this._location_proxy.setLocation(q)},swap:function(r,s){var q=this.$element().html(r);if(d(s)){s(r)}return q},templateCache:function(q,r){if(typeof r!="undefined"){return a[q]=r}else{return a[q]}},clearTemplateCache:function(){return a={}},notFound:function(s,r){var q=this.error(["404 Not Found",s,r].join(" "));return(s==="get")?q:true},error:function(r,q){if(!q){q=new Error()}q.message=[r,q.message].join(" ");this.trigger("error",{message:q.message,error:q});if(this.raise_errors){throw (q)}else{this.log(q.message,q)}},_checkLocation:function(){var q,r;q=this.getLocation();if(!this.last_location||this.last_location[0]!="get"||this.last_location[1]!=q){this.last_location=["get",q];r=this.runRoute("get",q)}return r},_getFormVerb:function(s){var r=h(s),t,q;q=r.find('input[name="_method"]');if(q.length>0){t=q.val()}if(!t){t=r[0].getAttribute("method")}if(!t||t==""){t="get"}return h.trim(t.toString().toLowerCase())},_checkFormSubmission:function(s){var q,t,v,u,r;this.trigger("check-form-submission",{form:s});q=h(s);t=q.attr("action")||"";v=this._getFormVerb(q);this.log("_checkFormSubmission",q,t,v);if(v==="get"){u=this._serializeFormParams(q);if(u!==""){t+="?"+u}this.setLocation(t);r=false}else{u=h.extend({},this._parseFormParams(q));r=this.runRoute(v,t,u,s.get(0))}return(typeof r=="undefined")?false:r},_serializeFormParams:function(r){var t="",q=r.serializeArray(),s;if(q.length>0){t=this._encodeFormPair(q[0].name,q[0].value);for(s=1;s0){this.then(this.callbacks.shift())}},load:function(q,r,t){var s=this;return this.then(function(){var u,v,x,w;if(d(r)){t=r;r={}}else{r=h.extend({},r)}if(t){this.then(t)}if(typeof q==="string"){x=(q.match(/\.json$/)||r.json);u=((x&&r.cache===true)||r.cache!==false);s.next_engine=s.event_context.engineFor(q);delete r.cache;delete r.json;if(r.engine){s.next_engine=r.engine;delete r.engine}if(u&&(v=this.event_context.app.templateCache(q))){return v}this.wait();h.ajax(h.extend({url:q,data:{},dataType:x?"json":"text",type:"get",success:function(y){if(u){s.event_context.app.templateCache(q,y)}s.next(y)}},r));return false}else{if(q.nodeType){return q.innerHTML}if(q.selector){s.next_engine=q.attr("data-engine");if(r.clone===false){return q.remove()[0].innerHTML.toString()}else{return q[0].innerHTML.toString()}}}})},loadPartials:function(r){var q;if(r){this.partials=this.partials||{};for(q in r){(function(t,s){t.load(r[s]).then(function(u){this.partials[s]=u})})(this,q)}}return this},render:function(q,s,t,r){if(d(q)&&!s){return this.then(q)}else{return this.loadPartials(r).load(q).interpolate(s,q).then(t)}},partial:function(q,r,s){if(d(s)){return this.render(q,r).swap(s)}else{if(!s&&d(r)){return this.render(q).swap(r)}else{return this.render(q,r).swap()}}},send:function(){var s=this,r=c(arguments),q=r.shift();if(m(r[0])){r=r[0]}return this.then(function(t){r.push(function(u){s.next(u)});s.wait();q.apply(q,r);return false})},collect:function(u,t,q){var s=this;var r=function(){if(d(u)){t=u;u=this.content}var v=[],w=false;h.each(u,function(x,z){var y=t.apply(s,[x,z]);if(y.jquery&&y.length==1){y=y[0];w=true}v.push(y);return y});return w?v:v.join("")};return q?r():this.then(r)},renderEach:function(q,r,s,t){if(m(r)){t=s;s=r;r=null}return this.load(q).then(function(v){var u=this;if(!s){s=m(this.previous_content)?this.previous_content:[]}if(t){h.each(s,function(w,y){var z={},x=this.next_engine||q;r?(z[r]=y):(z=y);t(y,u.event_context.interpolate(v,z,x))})}else{return this.collect(s,function(w,y){var z={},x=this.next_engine||q;r?(z[r]=y):(z=y);return this.event_context.interpolate(v,z,x)},true)}})},interpolate:function(t,s,q){var r=this;return this.then(function(v,u){if(!t&&u){t=u}if(this.next_engine){s=this.next_engine;this.next_engine=false}var w=r.event_context.interpolate(v,t,s,this.partials);return q?u+w:w})},swap:function(q){return this.then(function(r){this.event_context.swap(r,q);return r}).trigger("changed",{})},appendTo:function(q){return this.then(function(r){h(q).append(r)}).trigger("changed",{})},prependTo:function(q){return this.then(function(r){h(q).prepend(r)}).trigger("changed",{})},replace:function(q){return this.then(function(r){h(q).html(r)}).trigger("changed",{})},trigger:function(q,r){return this.then(function(s){if(typeof r=="undefined"){r={content:s}}this.event_context.trigger(q,r);return s})}});p.EventContext=function(u,t,r,s,q){this.app=u;this.verb=t;this.path=r;this.params=new p.Object(s);this.target=q};p.EventContext.prototype=h.extend({},p.Object.prototype,{$element:function(){return this.app.$element(c(arguments).shift())},engineFor:function(s){var r=this,q;if(d(s)){return s}s=(s||r.app.template_engine).toString();if((q=s.match(/\.([^\.\?\#]+)$/))){s=q[1]}if(s&&d(r[s])){return r[s]}if(r.app.template_engine){return this.engineFor(r.app.template_engine)}return function(t,u){return t}},interpolate:function(s,t,r,q){return this.engineFor(r).apply(this,[s,t,q])},render:function(q,s,t,r){return new p.RenderContext(this).render(q,s,t,r)},renderEach:function(q,r,s,t){return new p.RenderContext(this).renderEach(q,r,s,t)},load:function(q,r,s){return new p.RenderContext(this).load(q,r,s)},partial:function(q,r,s){return new p.RenderContext(this).partial(q,r,s)},send:function(){var q=new p.RenderContext(this);return q.send.apply(q,arguments)},redirect:function(){var y,w=c(arguments),v=this.app.getLocation(),r=w.length;if(r>1){var u=0,z=[],q=[],t={},x=false;for(;u/g,">").replace(/"/g,""")},n=function(q){return function(r,s){return this.route.apply(this,[q,r,s])}},a={},o=!!(j.history&&history.pushState),e=[];p=function(){var r=c(arguments),s,q;p.apps=p.apps||{};if(r.length===0||r[0]&&d(r[0])){return p.apply(p,["body"].concat(r))}else{if(typeof(q=r.shift())=="string"){s=p.apps[q]||new p.Application();s.element_selector=q;if(r.length>0){h.each(r,function(t,u){s.use(u)})}if(s.element_selector!=q){delete p.apps[q]}p.apps[s.element_selector]=s;return s}}};p.VERSION="0.7.0";p.addLogger=function(q){e.push(q)};p.log=function(){var q=c(arguments);q.unshift("["+Date()+"]");h.each(e,function(s,r){r.apply(p,q)})};if(typeof j.console!="undefined"){if(d(j.console.log.apply)){p.addLogger(function(){j.console.log.apply(j.console,arguments)})}else{p.addLogger(function(){j.console.log(arguments)})}}else{if(typeof console!="undefined"){p.addLogger(function(){console.log.apply(console,arguments)})}}h.extend(p,{makeArray:c,isFunction:d,isArray:m});p.Object=function(q){return h.extend(this,q||{})};h.extend(p.Object.prototype,{escapeHTML:f,h:f,toHash:function(){var q={};h.each(this,function(s,r){if(!d(r)){q[s]=r}});return q},toHTML:function(){var q="";h.each(this,function(s,r){if(!d(r)){q+=""+s+" "+r+"
    "}});return q},keys:function(q){var r=[];for(var s in this){if(!d(this[s])||!q){r.push(s)}}return r},has:function(q){return this[q]&&h.trim(this[q].toString())!==""},join:function(){var r=c(arguments);var q=r.shift();return r.join(q)},log:function(){p.log.apply(p,arguments)},toString:function(q){var r=[];h.each(this,function(t,s){if(!d(s)||q){r.push('"'+t+'": '+s.toString())}});return"Sammy.Object: {"+r.join(",")+"}"}});p.DefaultLocationProxy=function(r,q){this.app=r;this.is_native=false;this.has_history=o;this._startPolling(q)};p.DefaultLocationProxy.fullPath=function(q){var r=q.toString().match(/^[^#]*(#.+)$/);var s=r?r[1]:"";return[q.pathname,q.search,s].join("")};p.DefaultLocationProxy.prototype={bind:function(){var r=this,s=this.app,q=p.DefaultLocationProxy;h(j).bind("hashchange."+this.app.eventNamespace(),function(u,t){if(r.is_native===false&&!t){r.is_native=true;j.clearInterval(q._interval)}s.trigger("location-changed")});if(o&&!s.disable_push_state){h(j).bind("popstate."+this.app.eventNamespace(),function(t){s.trigger("location-changed")});h("a").live("click.history-"+this.app.eventNamespace(),function(u){var t=q.fullPath(this);if(this.hostname==j.location.hostname&&s.lookupRoute("get",t)){u.preventDefault();r.setLocation(t);return false}})}if(!q._bindings){q._bindings=0}q._bindings++},unbind:function(){h(j).unbind("hashchange."+this.app.eventNamespace());h(j).unbind("popstate."+this.app.eventNamespace());h("a").die("click.history-"+this.app.eventNamespace());p.DefaultLocationProxy._bindings--;if(p.DefaultLocationProxy._bindings<=0){j.clearInterval(p.DefaultLocationProxy._interval)}},getLocation:function(){return p.DefaultLocationProxy.fullPath(j.location)},setLocation:function(q){if(/^([^#\/]|$)/.test(q)){if(o){q="/"+q}else{q="#!/"+q}}if(q!=this.getLocation()){if(o&&/^\//.test(q)){history.pushState({path:q},j.title,q);this.app.trigger("location-changed")}else{return(j.location=q)}}},_startPolling:function(s){var r=this;if(!p.DefaultLocationProxy._interval){if(!s){s=10}var q=function(){var t=r.getLocation();if(typeof p.DefaultLocationProxy._last_location=="undefined"||t!=p.DefaultLocationProxy._last_location){j.setTimeout(function(){h(j).trigger("hashchange",[true])},0)}p.DefaultLocationProxy._last_location=t};q();p.DefaultLocationProxy._interval=j.setInterval(q,s)}}};p.Application=function(q){var r=this;this.routes={};this.listeners=new p.Object({});this.arounds=[];this.befores=[];this.namespace=(new Date()).getTime()+"-"+parseInt(Math.random()*1000,10);this.context_prototype=function(){p.EventContext.apply(this,arguments)};this.context_prototype.prototype=new p.EventContext();if(d(q)){q.apply(this,[this])}if(!this._location_proxy){this.setLocationProxy(new p.DefaultLocationProxy(this,this.run_interval_every))}if(this.debug){this.bindToAllEvents(function(t,s){r.log(r.toString(),t.cleaned_type,s||{})})}};p.Application.prototype=h.extend({},p.Object.prototype,{ROUTE_VERBS:["get","post","put","delete"],APP_EVENTS:["run","unload","lookup-route","run-route","route-found","event-context-before","event-context-after","changed","error","check-form-submission","redirect","location-changed"],_last_route:null,_location_proxy:null,_running:false,element_selector:"body",debug:false,raise_errors:false,run_interval_every:50,disable_push_state:false,template_engine:null,toString:function(){return"Sammy.Application:"+this.element_selector},$element:function(q){return q?h(this.element_selector).find(q):h(this.element_selector)},use:function(){var q=c(arguments),s=q.shift(),r=s||"";try{q.unshift(this);if(typeof s=="string"){r="Sammy."+s;s=p[s]}s.apply(this,q)}catch(t){if(typeof s==="undefined"){this.error("Plugin Error: called use() but plugin ("+r.toString()+") is not defined",t)}else{if(!d(s)){this.error("Plugin Error: called use() but '"+r.toString()+"' is not a function",t)}else{this.error("Plugin Error",t)}}}return this},setLocationProxy:function(q){var r=this._location_proxy;this._location_proxy=q;if(this.isRunning()){if(r){r.unbind()}this._location_proxy.bind()}},route:function(u,r,w){var t=this,v=[],q,s;if(!w&&d(r)){r=u;w=r;u="any"}u=u.toLowerCase();if(r.constructor==String){k.lastIndex=0;while((s=k.exec(r))!==null){v.push(s[1])}r=new RegExp(r.replace(k,g)+"$")}if(typeof w=="string"){w=t[w]}q=function(x){var y={verb:x,path:r,callback:w,param_names:v};t.routes[x]=t.routes[x]||[];t.routes[x].push(y)};if(u==="any"){h.each(this.ROUTE_VERBS,function(y,x){q(x)})}else{q(u)}return this},get:n("get"),post:n("post"),put:n("put"),del:n("delete"),any:n("any"),mapRoutes:function(r){var q=this;h.each(r,function(s,t){q.route.apply(q,t)});return this},eventNamespace:function(){return["sammy-app",this.namespace].join("-")},bind:function(q,s,u){var t=this;if(typeof u=="undefined"){u=s}var r=function(){var x,v,w;x=arguments[0];w=arguments[1];if(w&&w.context){v=w.context;delete w.context}else{v=new t.context_prototype(t,"bind",x.type,w,x.target)}x.cleaned_type=x.type.replace(t.eventNamespace(),"");u.apply(v,[x,w])};if(!this.listeners[q]){this.listeners[q]=[]}this.listeners[q].push(r);if(this.isRunning()){this._listen(q,r)}return this},trigger:function(q,r){this.$element().trigger([q,this.eventNamespace()].join("."),[r]);return this},refresh:function(){this.last_location=null;this.trigger("location-changed");return this},before:function(q,r){if(d(q)){r=q;q={}}this.befores.push([q,r]);return this},after:function(q){return this.bind("event-context-after",q)},around:function(q){this.arounds.push(q);return this},isRunning:function(){return this._running},helpers:function(q){h.extend(this.context_prototype.prototype,q);return this},helper:function(q,r){this.context_prototype.prototype[q]=r;return this},run:function(q){if(this.isRunning()){return false}var r=this;h.each(this.listeners.toHash(),function(s,t){h.each(t,function(v,u){r._listen(s,u)})});this.trigger("run",{start_url:q});this._running=true;this.last_location=null;if(!(/\#(.+)/.test(this.getLocation()))&&typeof q!="undefined"){this.setLocation(q)}this._checkLocation();this._location_proxy.bind();this.bind("location-changed",function(){r._checkLocation()});this.bind("submit",function(t){var s=r._checkFormSubmission(h(t.target).closest("form"));return(s===false)?t.preventDefault():false});h(j).bind("beforeunload",function(){r.unload()});return this.trigger("changed")},unload:function(){if(!this.isRunning()){return false}var q=this;this.trigger("unload");this._location_proxy.unbind();this.$element().unbind("submit").removeClass(q.eventNamespace());h.each(this.listeners.toHash(),function(r,s){h.each(s,function(u,t){q._unlisten(r,t)})});this._running=false;return this},bindToAllEvents:function(r){var q=this;h.each(this.APP_EVENTS,function(s,t){q.bind(t,r)});h.each(this.listeners.keys(true),function(t,s){if(h.inArray(s,q.APP_EVENTS)==-1){q.bind(s,r)}});return this},routablePath:function(q){return q.replace(l,"")},lookupRoute:function(w,u){var v=this,t=false,s=0,q,r;if(typeof this.routes[w]!="undefined"){q=this.routes[w].length;for(;s0){B=E.shift();if(t.contextMatchesOptions(r,B[0])){G=B[1].apply(r,[r]);if(G===false){return false}}}t.last_route=D;r.trigger("event-context-before",{context:r});G=D.callback.apply(r,y);r.trigger("event-context-after",{context:r});return G};h.each(v.reverse(),function(G,H){var I=A;A=function(){return H.apply(r,[I])}});try{q=A()}catch(w){this.error(["500 Error",s,F].join(" "),w)}return q}else{return this.notFound(s,F)}},contextMatchesOptions:function(t,v,r){var s=v;if(typeof s==="undefined"||s=={}){return true}if(typeof r==="undefined"){r=true}if(typeof s==="string"||d(s.test)){s={path:s}}if(s.only){return this.contextMatchesOptions(t,s.only,true)}else{if(s.except){return this.contextMatchesOptions(t,s.except,false)}}var q=true,u=true;if(s.path){if(!d(s.path.test)){s.path=new RegExp(s.path.toString()+"$")}q=s.path.test(t.path)}if(s.verb){if(typeof s.verb==="string"){u=s.verb===t.verb}else{u=s.verb.indexOf(t.verb)>-1}}return r?(u&&q):!(u&&q)},getLocation:function(){return this._location_proxy.getLocation()},setLocation:function(q){return this._location_proxy.setLocation(q)},swap:function(q){return this.$element().html(q)},templateCache:function(q,r){if(typeof r!="undefined"){return a[q]=r}else{return a[q]}},clearTemplateCache:function(){return a={}},notFound:function(s,r){var q=this.error(["404 Not Found",s,r].join(" "));return(s==="get")?q:true},error:function(r,q){if(!q){q=new Error()}q.message=[r,q.message].join(" ");this.trigger("error",{message:q.message,error:q});if(this.raise_errors){throw (q)}else{this.log(q.message,q)}},_checkLocation:function(){var q,r;q=this.getLocation();if(!this.last_location||this.last_location[0]!="get"||this.last_location[1]!=q){this.last_location=["get",q];r=this.runRoute("get",q)}return r},_getFormVerb:function(s){var r=h(s),t,q;q=r.find('input[name="_method"]');if(q.length>0){t=q.val()}if(!t){t=r[0].getAttribute("method")}if(!t||t==""){t="get"}return h.trim(t.toString().toLowerCase())},_checkFormSubmission:function(s){var q,t,v,u,r;this.trigger("check-form-submission",{form:s});q=h(s);t=q.attr("action")||"";v=this._getFormVerb(q);this.log("_checkFormSubmission",q,t,v);if(v==="get"){this.setLocation(t+"?"+this._serializeFormParams(q));r=false}else{u=h.extend({},this._parseFormParams(q));r=this.runRoute(v,t,u,s.get(0))}return(typeof r=="undefined")?false:r},_serializeFormParams:function(r){var t="",q=r.serializeArray(),s;if(q.length>0){t=this._encodeFormPair(q[0].name,q[0].value);for(s=1;s0){this.then(this.callbacks.shift())}},load:function(q,r,t){var s=this;return this.then(function(){var u,v,x,w;if(d(r)){t=r;r={}}else{r=h.extend({},r)}if(t){this.then(t)}if(typeof q==="string"){x=(q.match(/\.json$/)||r.json);u=((x&&r.cache===true)||r.cache!==false);s.next_engine=s.event_context.engineFor(q);delete r.cache;delete r.json;if(r.engine){s.next_engine=r.engine;delete r.engine}if(u&&(v=this.event_context.app.templateCache(q))){return v}this.wait();h.ajax(h.extend({url:q,data:{},dataType:x?"json":null,type:"get",success:function(y){if(u){s.event_context.app.templateCache(q,y)}s.next(y)}},r));return false}else{if(q.nodeType){return q.innerHTML}if(q.selector){s.next_engine=q.attr("data-engine");if(r.clone===false){return q.remove()[0].innerHTML.toString()}else{return q[0].innerHTML.toString()}}}})},loadPartials:function(q){if(q){this.partials=this.partials||{};for(name in q){this.load(q[name]).then(function(r){this.partials[name]=r})}}return this},render:function(q,s,t,r){if(d(q)&&!s){return this.then(q)}else{return this.loadPartials(r).load(q).interpolate(s,q).then(t)}},partial:function(q,r){return this.render(q,r).swap()},send:function(){var s=this,r=c(arguments),q=r.shift();if(m(r[0])){r=r[0]}return this.then(function(t){r.push(function(u){s.next(u)});s.wait();q.apply(q,r);return false})},collect:function(u,t,q){var s=this;var r=function(){if(d(u)){t=u;u=this.content}var v=[],w=false;h.each(u,function(x,z){var y=t.apply(s,[x,z]);if(y.jquery&&y.length==1){y=y[0];w=true}v.push(y);return y});return w?v:v.join("")};return q?r():this.then(r)},renderEach:function(q,r,s,t){if(m(r)){t=s;s=r;r=null}return this.load(q).then(function(v){var u=this;if(!s){s=m(this.previous_content)?this.previous_content:[]}if(t){h.each(s,function(w,y){var z={},x=this.next_engine||q;r?(z[r]=y):(z=y);t(y,u.event_context.interpolate(v,z,x))})}else{return this.collect(s,function(w,y){var z={},x=this.next_engine||q;r?(z[r]=y):(z=y);return this.event_context.interpolate(v,z,x)},true)}})},interpolate:function(t,s,q){var r=this;return this.then(function(v,u){if(!t&&u){t=u}if(this.next_engine){s=this.next_engine;this.next_engine=false}var w=r.event_context.interpolate(v,t,s,this.partials);return q?u+w:w})},swap:function(){return this.then(function(q){this.event_context.swap(q)}).trigger("changed",{})},appendTo:function(q){return this.then(function(r){h(q).append(r)}).trigger("changed",{})},prependTo:function(q){return this.then(function(r){h(q).prepend(r)}).trigger("changed",{})},replace:function(q){return this.then(function(r){h(q).html(r)}).trigger("changed",{})},trigger:function(q,r){return this.then(function(s){if(typeof r=="undefined"){r={content:s}}this.event_context.trigger(q,r)})}});p.EventContext=function(u,t,r,s,q){this.app=u;this.verb=t;this.path=r;this.params=new p.Object(s);this.target=q};p.EventContext.prototype=h.extend({},p.Object.prototype,{$element:function(){return this.app.$element(c(arguments).shift())},engineFor:function(s){var r=this,q;if(d(s)){return s}s=(s||r.app.template_engine).toString();if((q=s.match(/\.([^\.\?\#]+)$/))){s=q[1]}if(s&&d(r[s])){return r[s]}if(r.app.template_engine){return this.engineFor(r.app.template_engine)}return function(t,u){return t}},interpolate:function(s,t,r,q){return this.engineFor(r).apply(this,[s,t,q])},render:function(q,s,t,r){return new p.RenderContext(this).render(q,s,t,r)},renderEach:function(q,r,s,t){return new p.RenderContext(this).renderEach(q,r,s,t)},load:function(q,r,s){return new p.RenderContext(this).load(q,r,s)},partial:function(q,r){return new p.RenderContext(this).partial(q,r)},send:function(){var q=new p.RenderContext(this);return q.send.apply(q,arguments)},redirect:function(){var y,w=c(arguments),v=this.app.getLocation(),r=w.length;if(r>1){var u=0,z=[],q=[],t={},x=false;for(;u/g,">").replace(/"/g,""")},n=function(q){return function(r,s){return this.route.apply(this,[q,r,s])}},a={},o=!!(j.history&&history.pushState),e=[];p=function(){var r=c(arguments),s,q;p.apps=p.apps||{};if(r.length===0||r[0]&&d(r[0])){return p.apply(p,["body"].concat(r))}else{if(typeof(q=r.shift())=="string"){s=p.apps[q]||new p.Application();s.element_selector=q;if(r.length>0){h.each(r,function(t,u){s.use(u)})}if(s.element_selector!=q){delete p.apps[q]}p.apps[s.element_selector]=s;return s}}};p.VERSION="0.7.1";p.addLogger=function(q){e.push(q)};p.log=function(){var q=c(arguments);q.unshift("["+Date()+"]");h.each(e,function(s,r){r.apply(p,q)})};if(typeof j.console!="undefined"){if(d(j.console.log.apply)){p.addLogger(function(){j.console.log.apply(j.console,arguments)})}else{p.addLogger(function(){j.console.log(arguments)})}}else{if(typeof console!="undefined"){p.addLogger(function(){console.log.apply(console,arguments)})}}h.extend(p,{makeArray:c,isFunction:d,isArray:m});p.Object=function(q){return h.extend(this,q||{})};h.extend(p.Object.prototype,{escapeHTML:f,h:f,toHash:function(){var q={};h.each(this,function(s,r){if(!d(r)){q[s]=r}});return q},toHTML:function(){var q="";h.each(this,function(s,r){if(!d(r)){q+=""+s+" "+r+"
    "}});return q},keys:function(q){var r=[];for(var s in this){if(!d(this[s])||!q){r.push(s)}}return r},has:function(q){return this[q]&&h.trim(this[q].toString())!==""},join:function(){var r=c(arguments);var q=r.shift();return r.join(q)},log:function(){p.log.apply(p,arguments)},toString:function(q){var r=[];h.each(this,function(t,s){if(!d(s)||q){r.push('"'+t+'": '+s.toString())}});return"Sammy.Object: {"+r.join(",")+"}"}});p.DefaultLocationProxy=function(r,q){this.app=r;this.is_native=false;this.has_history=o;this._startPolling(q)};p.DefaultLocationProxy.fullPath=function(q){var r=q.toString().match(/^[^#]*(#.+)$/);var s=r?r[1]:"";return[q.pathname,q.search,s].join("")};p.DefaultLocationProxy.prototype={bind:function(){var r=this,s=this.app,q=p.DefaultLocationProxy;h(j).bind("hashchange."+this.app.eventNamespace(),function(u,t){if(r.is_native===false&&!t){r.is_native=true;j.clearInterval(q._interval)}s.trigger("location-changed")});if(o&&!s.disable_push_state){h(j).bind("popstate."+this.app.eventNamespace(),function(t){s.trigger("location-changed")});h("a").live("click.history-"+this.app.eventNamespace(),function(u){if(u.isDefaultPrevented()){return}var t=q.fullPath(this);if(this.hostname==j.location.hostname&&s.lookupRoute("get",t)){u.preventDefault();r.setLocation(t);return false}})}if(!q._bindings){q._bindings=0}q._bindings++},unbind:function(){h(j).unbind("hashchange."+this.app.eventNamespace());h(j).unbind("popstate."+this.app.eventNamespace());h("a").die("click.history-"+this.app.eventNamespace());p.DefaultLocationProxy._bindings--;if(p.DefaultLocationProxy._bindings<=0){j.clearInterval(p.DefaultLocationProxy._interval)}},getLocation:function(){return p.DefaultLocationProxy.fullPath(j.location)},setLocation:function(q){if(/^([^#\/]|$)/.test(q)){if(o){q="/"+q}else{q="#!/"+q}}if(q!=this.getLocation()){if(o&&/^\//.test(q)){history.pushState({path:q},j.title,q);this.app.trigger("location-changed")}else{return(j.location=q)}}},_startPolling:function(s){var r=this;if(!p.DefaultLocationProxy._interval){if(!s){s=10}var q=function(){var t=r.getLocation();if(typeof p.DefaultLocationProxy._last_location=="undefined"||t!=p.DefaultLocationProxy._last_location){j.setTimeout(function(){h(j).trigger("hashchange",[true])},0)}p.DefaultLocationProxy._last_location=t};q();p.DefaultLocationProxy._interval=j.setInterval(q,s)}}};p.Application=function(q){var r=this;this.routes={};this.listeners=new p.Object({});this.arounds=[];this.befores=[];this.namespace=(new Date()).getTime()+"-"+parseInt(Math.random()*1000,10);this.context_prototype=function(){p.EventContext.apply(this,arguments)};this.context_prototype.prototype=new p.EventContext();if(d(q)){q.apply(this,[this])}if(!this._location_proxy){this.setLocationProxy(new p.DefaultLocationProxy(this,this.run_interval_every))}if(this.debug){this.bindToAllEvents(function(t,s){r.log(r.toString(),t.cleaned_type,s||{})})}};p.Application.prototype=h.extend({},p.Object.prototype,{ROUTE_VERBS:["get","post","put","delete"],APP_EVENTS:["run","unload","lookup-route","run-route","route-found","event-context-before","event-context-after","changed","error","check-form-submission","redirect","location-changed"],_last_route:null,_location_proxy:null,_running:false,element_selector:"body",debug:false,raise_errors:false,run_interval_every:50,disable_push_state:false,template_engine:null,toString:function(){return"Sammy.Application:"+this.element_selector},$element:function(q){return q?h(this.element_selector).find(q):h(this.element_selector)},use:function(){var q=c(arguments),s=q.shift(),r=s||"";try{q.unshift(this);if(typeof s=="string"){r="Sammy."+s;s=p[s]}s.apply(this,q)}catch(t){if(typeof s==="undefined"){this.error("Plugin Error: called use() but plugin ("+r.toString()+") is not defined",t)}else{if(!d(s)){this.error("Plugin Error: called use() but '"+r.toString()+"' is not a function",t)}else{this.error("Plugin Error",t)}}}return this},setLocationProxy:function(q){var r=this._location_proxy;this._location_proxy=q;if(this.isRunning()){if(r){r.unbind()}this._location_proxy.bind()}},log:function(){p.log.apply(p,Array.prototype.concat.apply([this.element_selector],arguments))},route:function(u,r,w){var t=this,v=[],q,s;if(!w&&d(r)){r=u;w=r;u="any"}u=u.toLowerCase();if(r.constructor==String){k.lastIndex=0;while((s=k.exec(r))!==null){v.push(s[1])}r=new RegExp(r.replace(k,g)+"$")}if(typeof w=="string"){w=t[w]}q=function(x){var y={verb:x,path:r,callback:w,param_names:v};t.routes[x]=t.routes[x]||[];t.routes[x].push(y)};if(u==="any"){h.each(this.ROUTE_VERBS,function(y,x){q(x)})}else{q(u)}return this},get:n("get"),post:n("post"),put:n("put"),del:n("delete"),any:n("any"),mapRoutes:function(r){var q=this;h.each(r,function(s,t){q.route.apply(q,t)});return this},eventNamespace:function(){return["sammy-app",this.namespace].join("-")},bind:function(q,s,u){var t=this;if(typeof u=="undefined"){u=s}var r=function(){var x,v,w;x=arguments[0];w=arguments[1];if(w&&w.context){v=w.context;delete w.context}else{v=new t.context_prototype(t,"bind",x.type,w,x.target)}x.cleaned_type=x.type.replace(t.eventNamespace(),"");u.apply(v,[x,w])};if(!this.listeners[q]){this.listeners[q]=[]}this.listeners[q].push(r);if(this.isRunning()){this._listen(q,r)}return this},trigger:function(q,r){this.$element().trigger([q,this.eventNamespace()].join("."),[r]);return this},refresh:function(){this.last_location=null;this.trigger("location-changed");return this},before:function(q,r){if(d(q)){r=q;q={}}this.befores.push([q,r]);return this},after:function(q){return this.bind("event-context-after",q)},around:function(q){this.arounds.push(q);return this},isRunning:function(){return this._running},helpers:function(q){h.extend(this.context_prototype.prototype,q);return this},helper:function(q,r){this.context_prototype.prototype[q]=r;return this},run:function(q){if(this.isRunning()){return false}var r=this;h.each(this.listeners.toHash(),function(s,t){h.each(t,function(v,u){r._listen(s,u)})});this.trigger("run",{start_url:q});this._running=true;this.last_location=null;if(!(/\#(.+)/.test(this.getLocation()))&&typeof q!="undefined"){this.setLocation(q)}this._checkLocation();this._location_proxy.bind();this.bind("location-changed",function(){r._checkLocation()});this.bind("submit",function(t){var s=r._checkFormSubmission(h(t.target).closest("form"));return(s===false)?t.preventDefault():false});h(j).bind("beforeunload",function(){r.unload()});return this.trigger("changed")},unload:function(){if(!this.isRunning()){return false}var q=this;this.trigger("unload");this._location_proxy.unbind();this.$element().unbind("submit").removeClass(q.eventNamespace());h.each(this.listeners.toHash(),function(r,s){h.each(s,function(u,t){q._unlisten(r,t)})});this._running=false;return this},bindToAllEvents:function(r){var q=this;h.each(this.APP_EVENTS,function(s,t){q.bind(t,r)});h.each(this.listeners.keys(true),function(t,s){if(h.inArray(s,q.APP_EVENTS)==-1){q.bind(s,r)}});return this},routablePath:function(q){return q.replace(l,"")},lookupRoute:function(w,u){var v=this,t=false,s=0,q,r;if(typeof this.routes[w]!="undefined"){q=this.routes[w].length;for(;s0){B=E.shift();if(t.contextMatchesOptions(r,B[0])){G=B[1].apply(r,[r]);if(G===false){return false}}}t.last_route=D;r.trigger("event-context-before",{context:r});G=D.callback.apply(r,y);r.trigger("event-context-after",{context:r});return G};h.each(v.reverse(),function(G,H){var I=A;A=function(){return H.apply(r,[I])}});try{q=A()}catch(w){this.error(["500 Error",s,F].join(" "),w)}return q}else{return this.notFound(s,F)}},contextMatchesOptions:function(r,t,y){var z=t;if(typeof z==="undefined"||h.isPlainObject(z)){return true}if(typeof y==="undefined"){y=true}if(typeof z==="string"||d(z.test)){z={path:z}}if(m(z.path)){var x,u,q;x=[];for(u in z.path){q=h.extend({},z,{path:z.path[u]});x.push(this.contextMatchesOptions(r,q))}var s=h.inArray(true,x)>-1?true:false;return y?s:!s}if(z.only){return this.contextMatchesOptions(r,z.only,true)}else{if(z.except){return this.contextMatchesOptions(r,z.except,false)}}var v=true,w=true;if(z.path){if(!d(z.path.test)){z.path=new RegExp(z.path.toString()+"$")}v=z.path.test(r.path)}if(z.verb){if(typeof z.verb==="string"){w=z.verb===r.verb}else{w=z.verb.indexOf(r.verb)>-1}}return y?(w&&v):!(w&&v)},getLocation:function(){return this._location_proxy.getLocation()},setLocation:function(q){return this._location_proxy.setLocation(q)},swap:function(r,s){var q=this.$element().html(r);if(d(s)){s(r)}return q},templateCache:function(q,r){if(typeof r!="undefined"){return a[q]=r}else{return a[q]}},clearTemplateCache:function(){return a={}},notFound:function(s,r){var q=this.error(["404 Not Found",s,r].join(" "));return(s==="get")?q:true},error:function(r,q){if(!q){q=new Error()}q.message=[r,q.message].join(" ");this.trigger("error",{message:q.message,error:q});if(this.raise_errors){throw (q)}else{this.log(q.message,q)}},_checkLocation:function(){var q,r;q=this.getLocation();if(!this.last_location||this.last_location[0]!="get"||this.last_location[1]!=q){this.last_location=["get",q];r=this.runRoute("get",q)}return r},_getFormVerb:function(s){var r=h(s),t,q;q=r.find('input[name="_method"]');if(q.length>0){t=q.val()}if(!t){t=r[0].getAttribute("method")}if(!t||t==""){t="get"}return h.trim(t.toString().toLowerCase())},_checkFormSubmission:function(s){var q,t,v,u,r;this.trigger("check-form-submission",{form:s});q=h(s);t=q.attr("action")||"";v=this._getFormVerb(q);this.log("_checkFormSubmission",q,t,v);if(v==="get"){u=this._serializeFormParams(q);if(u!==""){t+="?"+u}this.setLocation(t);r=false}else{u=h.extend({},this._parseFormParams(q));r=this.runRoute(v,t,u,s.get(0))}return(typeof r=="undefined")?false:r},_serializeFormParams:function(r){var t="",q=r.serializeArray(),s;if(q.length>0){t=this._encodeFormPair(q[0].name,q[0].value);for(s=1;s0){this.then(this.callbacks.shift())}},load:function(q,r,t){var s=this;return this.then(function(){var u,v,x,w;if(d(r)){t=r;r={}}else{r=h.extend({},r)}if(t){this.then(t)}if(typeof q==="string"){x=(q.match(/\.json$/)||r.json);u=((x&&r.cache===true)||r.cache!==false);s.next_engine=s.event_context.engineFor(q);delete r.cache;delete r.json;if(r.engine){s.next_engine=r.engine;delete r.engine}if(u&&(v=this.event_context.app.templateCache(q))){return v}this.wait();h.ajax(h.extend({url:q,data:{},dataType:x?"json":"text",type:"get",success:function(y){if(u){s.event_context.app.templateCache(q,y)}s.next(y)}},r));return false}else{if(q.nodeType){return q.innerHTML}if(q.selector){s.next_engine=q.attr("data-engine");if(r.clone===false){return q.remove()[0].innerHTML.toString()}else{return q[0].innerHTML.toString()}}}})},loadPartials:function(r){var q;if(r){this.partials=this.partials||{};for(q in r){(function(t,s){t.load(r[s]).then(function(u){this.partials[s]=u})})(this,q)}}return this},render:function(q,s,t,r){if(d(q)&&!s){return this.then(q)}else{return this.loadPartials(r).load(q).interpolate(s,q).then(t)}},partial:function(q,r,s){if(d(s)){return this.render(q,r).swap(s)}else{if(!s&&d(r)){return this.render(q).swap(r)}else{return this.render(q,r).swap()}}},send:function(){var s=this,r=c(arguments),q=r.shift();if(m(r[0])){r=r[0]}return this.then(function(t){r.push(function(u){s.next(u)});s.wait();q.apply(q,r);return false})},collect:function(u,t,q){var s=this;var r=function(){if(d(u)){t=u;u=this.content}var v=[],w=false;h.each(u,function(x,z){var y=t.apply(s,[x,z]);if(y.jquery&&y.length==1){y=y[0];w=true}v.push(y);return y});return w?v:v.join("")};return q?r():this.then(r)},renderEach:function(q,r,s,t){if(m(r)){t=s;s=r;r=null}return this.load(q).then(function(v){var u=this;if(!s){s=m(this.previous_content)?this.previous_content:[]}if(t){h.each(s,function(w,y){var z={},x=this.next_engine||q;r?(z[r]=y):(z=y);t(y,u.event_context.interpolate(v,z,x))})}else{return this.collect(s,function(w,y){var z={},x=this.next_engine||q;r?(z[r]=y):(z=y);return this.event_context.interpolate(v,z,x)},true)}})},interpolate:function(t,s,q){var r=this;return this.then(function(v,u){if(!t&&u){t=u}if(this.next_engine){s=this.next_engine;this.next_engine=false}var w=r.event_context.interpolate(v,t,s,this.partials);return q?u+w:w})},swap:function(q){return this.then(function(r){this.event_context.swap(r,q);return r}).trigger("changed",{})},appendTo:function(q){return this.then(function(r){h(q).append(r)}).trigger("changed",{})},prependTo:function(q){return this.then(function(r){h(q).prepend(r)}).trigger("changed",{})},replace:function(q){return this.then(function(r){h(q).html(r)}).trigger("changed",{})},trigger:function(q,r){return this.then(function(s){if(typeof r=="undefined"){r={content:s}}this.event_context.trigger(q,r);return s})}});p.EventContext=function(u,t,r,s,q){this.app=u;this.verb=t;this.path=r;this.params=new p.Object(s);this.target=q};p.EventContext.prototype=h.extend({},p.Object.prototype,{$element:function(){return this.app.$element(c(arguments).shift())},engineFor:function(s){var r=this,q;if(d(s)){return s}s=(s||r.app.template_engine).toString();if((q=s.match(/\.([^\.\?\#]+)$/))){s=q[1]}if(s&&d(r[s])){return r[s]}if(r.app.template_engine){return this.engineFor(r.app.template_engine)}return function(t,u){return t}},interpolate:function(s,t,r,q){return this.engineFor(r).apply(this,[s,t,q])},render:function(q,s,t,r){return new p.RenderContext(this).render(q,s,t,r)},renderEach:function(q,r,s,t){return new p.RenderContext(this).renderEach(q,r,s,t)},load:function(q,r,s){return new p.RenderContext(this).load(q,r,s)},partial:function(q,r,s){return new p.RenderContext(this).partial(q,r,s)},send:function(){var q=new p.RenderContext(this);return q.send.apply(q,arguments)},redirect:function(){var y,w=c(arguments),v=this.app.getLocation(),r=w.length;if(r>1){var u=0,z=[],q=[],t={},x=false;for(;u