Permalink
Browse files

Updated to Sammy 0.4.1

  • Loading branch information...
1 parent f995163 commit c72671c494cd2429d5a9e7bdee7eab1cedc44ef5 @quirkey quirkey committed Jan 12, 2010
View
5 javascripts/sammy/min/plugins/sammy.cache-0.4.1.min.js
@@ -0,0 +1,5 @@
+// -- Sammy -- /plugins/sammy.cache.js
+// http://code.quirkey.com/sammy
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:10 -0500 2010
+(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){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);
View
4 javascripts/sammy/min/plugins/sammy.cache-lastest.min.js
@@ -1,5 +1,5 @@
// -- Sammy -- /plugins/sammy.cache.js
// http://code.quirkey.com/sammy
-// Version: 0.4.0
-// Built: Fri Jan 01 14:36:03 -0500 2010
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:10 -0500 2010
(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){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);
View
5 javascripts/sammy/min/plugins/sammy.json-0.4.1.min.js
@@ -0,0 +1,5 @@
+// -- Sammy -- /plugins/sammy.json.js
+// http://code.quirkey.com/sammy
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:11 -0500 2010
+(function($){if(!window.JSON){window.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());Sammy=Sammy||{};Sammy.JSON=function(app){app.helpers({json:function(object){if(typeof object=="string"){return JSON.parse(object)}else{return JSON.stringify(object)}}})}})(jQuery);
View
6 javascripts/sammy/min/plugins/sammy.json-lastest.min.js
@@ -1,5 +1,5 @@
// -- Sammy -- /plugins/sammy.json.js
// http://code.quirkey.com/sammy
-// Version: 0.4.0
-// Built: Fri Jan 01 14:36:04 -0500 2010
-(function($){if(!JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());Sammy=Sammy||{};Sammy.JSON=function(app){app.helpers({json:function(object){if(typeof object=="string"){return JSON.parse(object)}else{return JSON.stringify(object)}}})}})(jQuery);
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:11 -0500 2010
+(function($){if(!window.JSON){window.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());Sammy=Sammy||{};Sammy.JSON=function(app){app.helpers({json:function(object){if(typeof object=="string"){return JSON.parse(object)}else{return JSON.stringify(object)}}})}})(jQuery);
View
5 javascripts/sammy/min/plugins/sammy.mustache-0.4.1.min.js
@@ -0,0 +1,5 @@
+// -- Sammy -- /plugins/sammy.mustache.js
+// http://code.quirkey.com/sammy
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:12 -0500 2010
+(function(b){if(!a){var a=function(){var c=function(){};c.prototype={otag:"{{",ctag:"}}",pragmas:{},render:function(g,f,e){if(g.indexOf(this.otag)==-1){return g}g=this.render_pragmas(g);var d=this.render_section(g,f,e);return this.render_tags(d,f,e)},render_pragmas:function(d){if(d.indexOf(this.otag+"%")==-1){return d}var f=this;var e=new RegExp(this.otag+"%(.+)"+this.ctag);return d.replace(e,function(h,g){f.pragmas[g]=true;return""})},render_partial:function(d,f,e){if(typeof(f[d])!="object"){throw ({message:"subcontext for '"+d+"' is not an object"})}if(!e||!e[d]){throw ({message:"unknown_partial"})}return this.render(e[d],f[d],e)},render_section:function(f,e,d){if(f.indexOf(this.otag+"#")==-1){return f}var h=this;var g=new RegExp(this.otag+"\\#(.+)"+this.ctag+"\\s*([\\s\\S]+?)"+this.otag+"\\/\\1"+this.ctag+"\\s*","mg");return f.replace(g,function(k,j,l){var m=h.find(j,e);if(h.is_array(m)){return h.map(m,function(n){return h.render(l,h.merge(e,h.create_context(n)),d)}).join("")}else{if(m){return h.render(l,e,d)}else{return""}}})},render_tags:function(j,h,g){var d=j.split("\n");var e=function(){return new RegExp(l.otag+"(=|!|>|\\{|%)?([^/#]+?)\\1?"+l.ctag+"+","g")};var l=this;var k=e();for(var f=0;f<d.length;f++){d[f]=d[f].replace(k,function(o,m,n){switch(m){case"!":return o;case"=":l.set_delimiters(n);k=e();f--;return"";case">":return l.render_partial(n,h,g);case"{":return l.find(n,h);return"";default:return l.escape(l.find(n,h))}},this)}return d.join("\n")},set_delimiters:function(e){var d=e.split(" ");this.otag=this.escape_regex(d[0]);this.ctag=this.escape_regex(d[1])},escape_regex:function(e){if(!arguments.callee.sRE){var d=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];arguments.callee.sRE=new RegExp("(\\"+d.join("|\\")+")","g")}return e.replace(arguments.callee.sRE,"\\$1")},find:function(d,e){d=this.trim(d);if(typeof e[d]==="function"){return e[d].apply(e)}if(e[d]!==undefined){return e[d]}return""},escape:function(d){return d.toString().replace(/[&"<>\\]/g,function(e){switch(e){case"&":return"&amp;";case"\\":return"\\\\";case'"':return'"';case"<":return"&lt;";case">":return"&gt;";default:return e}})},merge:function(e,d){var g={};for(var f in e){if(e.hasOwnProperty(f)){g[f]=e[f]}}for(var f in d){if(d.hasOwnProperty(f)){g[f]=d[f]}}return g},create_context:function(d){if(this.is_object(d)){return d}else{if(this.pragmas["JSTACHE-ENABLE-STRING-ARRAYS"]){return{".":d}}}},is_object:function(d){return d&&typeof d=="object"},is_array:function(d){return(d&&typeof d==="object"&&d.constructor===Array)},trim:function(d){return d.replace(/^\s*|\s*$/g,"")},map:function(g,e){if(typeof g.map=="function"){return g.map(e)}else{var f=[];var d=g.length;for(i=0;i<d;i++){f.push(e(g[i]))}return f}}};return({name:"mustache.js",version:"0.2",to_html:function(f,d,e){return new c().render(f,d,e)}})}()}Sammy=Sammy||{};Sammy.Mustache=function(e,c){var d=function(f,g){return a.to_html(f,b.extend({},this,g))};if(!c){c="mustache"}e.helper(c,d)}})(jQuery);
View
6 javascripts/sammy/min/plugins/sammy.mustache-lastest.min.js
@@ -1,5 +1,5 @@
// -- Sammy -- /plugins/sammy.mustache.js
// http://code.quirkey.com/sammy
-// Version: 0.4.0
-// Built: Fri Jan 01 14:36:05 -0500 2010
-(function(b){if(!a){var a=function(){var c=function(){};c.prototype={otag:"{{",ctag:"}}",pragmas:{},render:function(g,f,e){if(g.indexOf(this.otag)==-1){return g}g=this.render_pragmas(g);var d=this.render_section(g,f,e);return this.render_tags(d,f,e)},render_pragmas:function(d){if(d.indexOf(this.otag+"%")==-1){return d}var f=this;var e=new RegExp(this.otag+"%(.+)"+this.ctag);return d.replace(e,function(h,g){f.pragmas[g]=true;return""})},render_partial:function(d,f,e){if(typeof(f[d])!="object"){throw ({message:"subcontext for '"+d+"' is not an object"})}if(!e||!e[d]){throw ({message:"unknown_partial"})}return this.render(e[d],f[d],e)},render_section:function(f,e,d){if(f.indexOf(this.otag+"#")==-1){return f}var h=this;var g=new RegExp(this.otag+"\\#(.+)"+this.ctag+"\\s*([\\s\\S]+?)"+this.otag+"\\/\\1"+this.ctag+"\\s*","mg");return f.replace(g,function(k,j,l){var m=h.find(j,e);if(h.is_array(m)){return h.map(m,function(n){return h.render(l,h.merge(e,h.create_context(n)),d)}).join("")}else{if(m){return h.render(l,e,d)}else{return""}}})},render_tags:function(j,h,g){var d=j.split("\n");var e=function(){return new RegExp(l.otag+"(=|!|>|\\{|%)?([^/#]+?)\\1?"+l.ctag+"+","g")};var l=this;var k=e();for(var f=0;f<d.length;f++){d[f]=d[f].replace(k,function(o,m,n){switch(m){case"!":return o;case"=":l.set_delimiters(n);k=e();f--;return"";case">":return l.render_partial(n,h,g);case"{":return l.find(n,h);return"";default:return l.escape(l.find(n,h))}},this)}return d.join("\n")},set_delimiters:function(e){var d=e.split(" ");this.otag=this.escape_regex(d[0]);this.ctag=this.escape_regex(d[1])},escape_regex:function(e){if(!arguments.callee.sRE){var d=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];arguments.callee.sRE=new RegExp("(\\"+d.join("|\\")+")","g")}return e.replace(arguments.callee.sRE,"\\$1")},find:function(d,e){d=this.trim(d);if(typeof e[d]==="function"){return e[d].apply(e)}if(e[d]!==undefined){return e[d]}return""},escape:function(d){return d.toString().replace(/[&"<>\\]/g,function(e){switch(e){case"&":return"&amp;";case"\\":return"\\\\";case'"':return'"';case"<":return"&lt;";case">":return"&gt;";default:return e}})},merge:function(e,d){var g={};for(var f in e){if(e.hasOwnProperty(f)){g[f]=e[f]}}for(var f in d){if(d.hasOwnProperty(f)){g[f]=d[f]}}return g},create_context:function(d){if(this.is_object(d)){return d}else{if(this.pragmas["JSTACHE-ENABLE-STRING-ARRAYS"]){return{".":d}}}},is_object:function(d){return d&&typeof d=="object"},is_array:function(d){return(d&&typeof d==="object"&&d.constructor===Array)},trim:function(d){return d.replace(/^\s*|\s*$/g,"")},map:function(g,e){if(typeof g.map=="function"){return g.map(e)}else{var f=[];var d=g.length;for(i=0;i<d;i++){f.push(e(g[i]))}return f}}};return({name:"mustache.js",version:"0.2",to_html:function(f,d,e){return new c().render(f,d,e)}})}()}Sammy=Sammy||{};Sammy.Mustache=function(f,c){var e=function(g,h){return a.to_html(g,b.extend({},this,h))};var d={};if(!c){c="mustache"}d[c]=e;f.helpers(d)}})(jQuery);
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:12 -0500 2010
+(function(b){if(!a){var a=function(){var c=function(){};c.prototype={otag:"{{",ctag:"}}",pragmas:{},render:function(g,f,e){if(g.indexOf(this.otag)==-1){return g}g=this.render_pragmas(g);var d=this.render_section(g,f,e);return this.render_tags(d,f,e)},render_pragmas:function(d){if(d.indexOf(this.otag+"%")==-1){return d}var f=this;var e=new RegExp(this.otag+"%(.+)"+this.ctag);return d.replace(e,function(h,g){f.pragmas[g]=true;return""})},render_partial:function(d,f,e){if(typeof(f[d])!="object"){throw ({message:"subcontext for '"+d+"' is not an object"})}if(!e||!e[d]){throw ({message:"unknown_partial"})}return this.render(e[d],f[d],e)},render_section:function(f,e,d){if(f.indexOf(this.otag+"#")==-1){return f}var h=this;var g=new RegExp(this.otag+"\\#(.+)"+this.ctag+"\\s*([\\s\\S]+?)"+this.otag+"\\/\\1"+this.ctag+"\\s*","mg");return f.replace(g,function(k,j,l){var m=h.find(j,e);if(h.is_array(m)){return h.map(m,function(n){return h.render(l,h.merge(e,h.create_context(n)),d)}).join("")}else{if(m){return h.render(l,e,d)}else{return""}}})},render_tags:function(j,h,g){var d=j.split("\n");var e=function(){return new RegExp(l.otag+"(=|!|>|\\{|%)?([^/#]+?)\\1?"+l.ctag+"+","g")};var l=this;var k=e();for(var f=0;f<d.length;f++){d[f]=d[f].replace(k,function(o,m,n){switch(m){case"!":return o;case"=":l.set_delimiters(n);k=e();f--;return"";case">":return l.render_partial(n,h,g);case"{":return l.find(n,h);return"";default:return l.escape(l.find(n,h))}},this)}return d.join("\n")},set_delimiters:function(e){var d=e.split(" ");this.otag=this.escape_regex(d[0]);this.ctag=this.escape_regex(d[1])},escape_regex:function(e){if(!arguments.callee.sRE){var d=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];arguments.callee.sRE=new RegExp("(\\"+d.join("|\\")+")","g")}return e.replace(arguments.callee.sRE,"\\$1")},find:function(d,e){d=this.trim(d);if(typeof e[d]==="function"){return e[d].apply(e)}if(e[d]!==undefined){return e[d]}return""},escape:function(d){return d.toString().replace(/[&"<>\\]/g,function(e){switch(e){case"&":return"&amp;";case"\\":return"\\\\";case'"':return'"';case"<":return"&lt;";case">":return"&gt;";default:return e}})},merge:function(e,d){var g={};for(var f in e){if(e.hasOwnProperty(f)){g[f]=e[f]}}for(var f in d){if(d.hasOwnProperty(f)){g[f]=d[f]}}return g},create_context:function(d){if(this.is_object(d)){return d}else{if(this.pragmas["JSTACHE-ENABLE-STRING-ARRAYS"]){return{".":d}}}},is_object:function(d){return d&&typeof d=="object"},is_array:function(d){return(d&&typeof d==="object"&&d.constructor===Array)},trim:function(d){return d.replace(/^\s*|\s*$/g,"")},map:function(g,e){if(typeof g.map=="function"){return g.map(e)}else{var f=[];var d=g.length;for(i=0;i<d;i++){f.push(e(g[i]))}return f}}};return({name:"mustache.js",version:"0.2",to_html:function(f,d,e){return new c().render(f,d,e)}})}()}Sammy=Sammy||{};Sammy.Mustache=function(e,c){var d=function(f,g){return a.to_html(f,b.extend({},this,g))};if(!c){c="mustache"}e.helper(c,d)}})(jQuery);
View
5 javascripts/sammy/min/plugins/sammy.nested_params-0.4.1.min.js
@@ -0,0 +1,5 @@
+// -- Sammy -- /plugins/sammy.nested_params.js
+// http://code.quirkey.com/sammy
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:13 -0500 2010
+(function(a){Sammy=Sammy||{};function b(g,f,h){var d,c,e;if(f.match(/^[^\[]+$/)){h[f]=unescape(g)}else{if(d=f.match(/^([^\[]+)\[\](.*)$/)){c=d[1];e=d[2];if(h[c]&&!a.isArray(h[c])){throw ("400 Bad Request")}if(e){d=e.match(/^\[([^\]]+)\](.*)$/);if(!d){throw ("400 Bad Request")}if(h[c]){if(h[c][h[c].length-1][d[1]]){h[c].push(b(g,d[1]+d[2],{}))}else{a.extend(true,h[c][h[c].length-1],b(g,d[1]+d[2],{}))}}else{h[c]=[b(g,d[1]+d[2],{})]}}else{if(h[c]){h[c].push(unescape(g))}else{h[c]=[unescape(g)]}}}else{if(d=f.match(/^([^\[]+)\[([^\[]+)\](.*)$/)){c=d[1];e=d[2]+d[3];if(h[c]&&a.isArray(h[c])){throw ("400 Bad Request")}if(h[c]){a.extend(true,h[c],b(g,e,h[c]))}else{h[c]=b(g,e,{})}}}}return h}Sammy.NestedParams=function(c){a.extend(c,{_parseFormParams:function(d){var e={};a.each(d.serializeArray(),function(f,g){a.extend(true,e,b(g.value,g.name,e))});return e}})}})(jQuery);
View
4 javascripts/sammy/min/plugins/sammy.nested_params-lastest.min.js
@@ -1,5 +1,5 @@
// -- Sammy -- /plugins/sammy.nested_params.js
// http://code.quirkey.com/sammy
-// Version: 0.4.0
-// Built: Fri Jan 01 14:36:06 -0500 2010
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:13 -0500 2010
(function(a){Sammy=Sammy||{};function b(g,f,h){var d,c,e;if(f.match(/^[^\[]+$/)){h[f]=unescape(g)}else{if(d=f.match(/^([^\[]+)\[\](.*)$/)){c=d[1];e=d[2];if(h[c]&&!a.isArray(h[c])){throw ("400 Bad Request")}if(e){d=e.match(/^\[([^\]]+)\](.*)$/);if(!d){throw ("400 Bad Request")}if(h[c]){if(h[c][h[c].length-1][d[1]]){h[c].push(b(g,d[1]+d[2],{}))}else{a.extend(true,h[c][h[c].length-1],b(g,d[1]+d[2],{}))}}else{h[c]=[b(g,d[1]+d[2],{})]}}else{if(h[c]){h[c].push(unescape(g))}else{h[c]=[unescape(g)]}}}else{if(d=f.match(/^([^\[]+)\[([^\[]+)\](.*)$/)){c=d[1];e=d[2]+d[3];if(h[c]&&a.isArray(h[c])){throw ("400 Bad Request")}if(h[c]){a.extend(true,h[c],b(g,e,h[c]))}else{h[c]=b(g,e,{})}}}}return h}Sammy.NestedParams=function(c){a.extend(c,{_parseFormParams:function(d){var e={};a.each(d.serializeArray(),function(f,g){a.extend(true,e,b(g.value,g.name,e))});return e}})}})(jQuery);
View
5 javascripts/sammy/min/plugins/sammy.storage-0.4.1.min.js
@@ -0,0 +1,5 @@
+// -- Sammy -- /plugins/sammy.storage.js
+// http://code.quirkey.com/sammy
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:13 -0500 2010
+(function(a){Sammy=Sammy||{};Sammy.Store=function(b){this.options=b||{};this.name=this.options.name||"store";this.$element=a(this.options.element||"body");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(b,c){c=(typeof c=="string")?c:JSON.stringify(c);if(b!=this.meta_key){this._addKey(b)}this.storage.set(b,c);this.$element.trigger("set-"+this.name+"."+b,[b,c]);this.$element.trigger("set-"+this.name,[b,c]);return c},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;a.each(this.keys(),function(d,c){b.clear(c)})},keys:function(){return this.get(this.meta_key)||[]},fetch:function(b,c){if(!this.exists(b)){return this.set(b,c.apply(this))}else{return this.get(b)}},_addKey:function(b){var c=this.keys();if(a.inArray(b,c)==-1){c.push(b)}this.set(this.meta_key,c)},_removeKey:function(c){var d=this.keys();var b=a.inArray(c,d);if(b!=-1){d.splice(b,1)}this.set(this.meta_key,d)}});Sammy.Store.isAvailable=function(b){return Sammy.Store[Sammy.Store.stores[b]].prototype.isAvailable()};Sammy.Store.Memory=function(b){this.name=b;Sammy.Store.Memory.store=Sammy.Store.Memory.store||{};Sammy.Store.Memory.store[b]=Sammy.Store.Memory.store[b]||{};this.store=Sammy.Store.Memory.store[b]};a.extend(Sammy.Store.Memory.prototype,{exists:function(b){return(typeof this.store[b]!="undefined")},set:function(b,c){return this.store[b]=c},get:function(b){return this.store[b]},clear:function(b){delete this.store[b]}});Sammy.Store.Data=function(c,b){this.name=c;this.$element=b};a.extend(Sammy.Store.Data.prototype,{exists:function(b){return(typeof this.$element.data(this._key(b))!="undefined")},set:function(b,c){return this.$element.data(this._key(b),c)},get:function(b){return this.$element.data(this._key(b))},clear:function(b){this.$element.removeData(this._key(b))},_key:function(b){return["store",this.name,b].join(".")}});Sammy.Store.LocalStorage=function(b){this.name=b};a.extend(Sammy.Store.LocalStorage.prototype,{isAvailable:function(){return("localStorage" in window)&&(window.location.protocol!="file:")},exists:function(b){return(this.get(b)!=null)},set:function(b,c){return window.localStorage.setItem(this._key(b),c)},get:function(b){return window.localStorage.getItem(this._key(b))},clear:function(b){window.localStorage.removeItem(this._key(b))},_key:function(b){return["store",this.name,b].join(".")}});Sammy.Store.SessionStorage=function(b){this.name=b};a.extend(Sammy.Store.SessionStorage.prototype,{isAvailable:function(){return("sessionStorage" in window)},exists:function(b){return(this.get(b)!=null)},set:function(b,c){return window.sessionStorage.setItem(this._key(b),c)},get:function(b){return window.sessionStorage.getItem(this._key(b))},clear:function(b){window.sessionStorage.removeItem(this._key(b))},_key:function(b){return["store",this.name,b].join(".")}});Sammy.Store.Cookie=function(d,b,c){this.name=d;this.$element=b;this.options=c||{};this.path=this.options.path||"/";this.expires_in=this.options.expires_in||(14*24*60*60)};a.extend(Sammy.Store.Cookie.prototype,{isAvailable:function(){return("cookie" in document)},exists:function(b){return(this.get(b)!=null)},set:function(b,c){return this._setCookie(b,c)},get:function(b){return this._getCookie(b)},clear:function(b){this._setCookie(b,"",-1)},_key:function(b){return["store",this.name,b].join(".")},_getCookie:function(c){var d=this._key(c).replace(/(\.|\*|\(|\)|\[|\])/g,"\\$1");var b=document.cookie.match("(^|;\\s)"+d+"=([^;]*)(;|$)");return(b?b[2]:null)},_setCookie:function(e,f,c){if(!c){c=(this.expires_in*1000)}var d=new Date();d.setTime(d.getTime()+c);var b=[this._key(e),"=",f,"; expires=",d.toGMTString(),"; path=",this.path].join("");document.cookie=b}});Sammy.Storage=function(b){this.use(Sammy.JSON);this.stores=this.stores||{};this.store=function(d,c){if(typeof this.stores[d]=="undefined"){this.stores[d]=new Sammy.Store(a.extend({name:d,element:this.element_selector},c||{}));this[d]=function(e,f){if(typeof f=="undefined"){return this.stores[d].get(e)}else{if(a.isFunction(f)){return this.stores[d].fetch(e,f)}else{return this.stores[d].set(e,f)}}};this.helper(d,function(){return this.app[d].apply(this.app,arguments)})}return this.stores[d]};this.helpers({store:function(){return this.app.store.apply(this.app,arguments)}})};Sammy.Session=function(d,b){this.use(Sammy.Storage);var c="memory";if(Sammy.Store.isAvailable("local")){c="local"}else{if(Sammy.Store.isAvailable("cookie")){c="cookie"}}this.store("session",a.extend({type:c},b))}})(jQuery);
View
6 javascripts/sammy/min/plugins/sammy.storage-lastest.min.js
@@ -1,5 +1,5 @@
// -- Sammy -- /plugins/sammy.storage.js
// http://code.quirkey.com/sammy
-// Version: 0.4.0
-// Built: Fri Jan 01 14:36:07 -0500 2010
-(function(a){Sammy=Sammy||{};Sammy.Store=function(b){this.options=b||{};this.name=this.options.name||"store";this.$element=a(this.options.element||"body");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"};Sammy.Store.isAvailable=function(b){return Sammy.Store[Sammy.Store.stores[b]].prototype.isAvailable()};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(b,c){c=(typeof c=="string")?c:JSON.stringify(c);if(b!=this.meta_key){this._addKey(b)}this.storage.set(b,c);this.$element.trigger("set-"+this.name+"."+b,[b,c]);this.$element.trigger("set-"+this.name,[b,c]);return c},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;a.each(this.keys(),function(d,c){b.clear(c)})},keys:function(){return this.get(this.meta_key)||[]},fetch:function(b,c){if(!this.exists(b)){return this.set(b,c.apply(this))}else{return this.get(b)}},_addKey:function(b){var c=this.keys();if(a.inArray(b,c)==-1){c.push(b)}this.set(this.meta_key,c)},_removeKey:function(c){var d=this.keys();var b=a.inArray(c,d);if(b!=-1){d.splice(b,1)}this.set(this.meta_key,d)}});Sammy.Store.Memory=function(b){this.name=b;Sammy.Store.Memory.store=Sammy.Store.Memory.store||{};Sammy.Store.Memory.store[b]=Sammy.Store.Memory.store[b]||{};this.store=Sammy.Store.Memory.store[b]};a.extend(Sammy.Store.Memory.prototype,{exists:function(b){return(typeof this.store[b]!="undefined")},set:function(b,c){return this.store[b]=c},get:function(b){return this.store[b]},clear:function(b){delete this.store[b]}});Sammy.Store.Data=function(c,b){this.name=c;this.$element=b};a.extend(Sammy.Store.Data.prototype,{exists:function(b){return(typeof this.$element.data(this._key(b))!="undefined")},set:function(b,c){return this.$element.data(this._key(b),c)},get:function(b){return this.$element.data(this._key(b))},clear:function(b){this.$element.removeData(this._key(b))},_key:function(b){return["store",this.name,b].join(".")}});Sammy.Store.LocalStorage=function(b){this.name=b};a.extend(Sammy.Store.LocalStorage.prototype,{isAvailable:function(){return("localStorage" in window)},exists:function(b){return(this.get(b)!=null)},set:function(b,c){return window.localStorage.setItem(this._key(b),c)},get:function(b){return window.localStorage.getItem(this._key(b))},clear:function(b){window.localStorage.removeItem(this._key(b))},_key:function(b){return["store",this.name,b].join(".")}});Sammy.Store.SessionStorage=function(b){this.name=b};a.extend(Sammy.Store.SessionStorage.prototype,{isAvailable:function(){return("sessionStorage" in window)},exists:function(b){return(this.get(b)!=null)},set:function(b,c){return window.sessionStorage.setItem(this._key(b),c)},get:function(b){return window.sessionStorage.getItem(this._key(b))},clear:function(b){window.sessionStorage.removeItem(this._key(b))},_key:function(b){return["store",this.name,b].join(".")}});Sammy.Store.Cookie=function(d,b,c){this.name=d;this.$element=b;this.options=c||{};this.path=this.options.path||"/";this.expires_in=this.options.expires_in||(14*24*60*60)};a.extend(Sammy.Store.Cookie.prototype,{isAvailable:function(){return("cookie" in document)},exists:function(b){return(this.get(b)!=null)},set:function(b,c){return this._setCookie(b,c)},get:function(b){return this._getCookie(b)},clear:function(b){this._setCookie(b,"",-1)},_key:function(b){return["store",this.name,b].join(".")},_getCookie:function(c){var d=this._key(c).replace(/(\.|\*|\(|\)|\[|\])/g,"\\$1");var b=document.cookie.match("(^|;\\s)"+d+"=([^;]*)(;|$)");return(b?b[2]:null)},_setCookie:function(e,f,c){if(!c){c=(this.expires_in*1000)}var d=new Date();d.setTime(d.getTime()+c);var b=[this._key(e),"=",f,"; expires=",d.toGMTString(),"; path=",this.path].join("");document.cookie=b}});Sammy.Storage=function(b){this.use(Sammy.JSON);this.stores=this.stores||{};this.store=function(d,c){if(typeof this.stores[d]=="undefined"){this.stores[d]=new Sammy.Store(a.extend({name:d,element:this.element_selector},c||{}));this[d]=function(e,f){if(typeof f=="undefined"){return this.stores[d].get(e)}else{if(a.isFunction(f)){return this.stores[d].fetch(e,f)}else{return this.stores[d].set(e,f)}}};this.helper(d,function(){return this.app[d].apply(this.app,arguments)})}return this.stores[d]};this.helpers({store:function(){return this.app.apply(this.app,arguments)}})};Sammy.Session=function(d,b){this.use(Sammy.Storage);var c="memory";if(Sammy.Store.isAvailable("local")){c="local"}else{if(Sammy.Store.isAvailable("cookie")){c="cookie"}}this.store("session",a.extend({type:c},b))}})(jQuery);
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:13 -0500 2010
+(function(a){Sammy=Sammy||{};Sammy.Store=function(b){this.options=b||{};this.name=this.options.name||"store";this.$element=a(this.options.element||"body");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(b,c){c=(typeof c=="string")?c:JSON.stringify(c);if(b!=this.meta_key){this._addKey(b)}this.storage.set(b,c);this.$element.trigger("set-"+this.name+"."+b,[b,c]);this.$element.trigger("set-"+this.name,[b,c]);return c},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;a.each(this.keys(),function(d,c){b.clear(c)})},keys:function(){return this.get(this.meta_key)||[]},fetch:function(b,c){if(!this.exists(b)){return this.set(b,c.apply(this))}else{return this.get(b)}},_addKey:function(b){var c=this.keys();if(a.inArray(b,c)==-1){c.push(b)}this.set(this.meta_key,c)},_removeKey:function(c){var d=this.keys();var b=a.inArray(c,d);if(b!=-1){d.splice(b,1)}this.set(this.meta_key,d)}});Sammy.Store.isAvailable=function(b){return Sammy.Store[Sammy.Store.stores[b]].prototype.isAvailable()};Sammy.Store.Memory=function(b){this.name=b;Sammy.Store.Memory.store=Sammy.Store.Memory.store||{};Sammy.Store.Memory.store[b]=Sammy.Store.Memory.store[b]||{};this.store=Sammy.Store.Memory.store[b]};a.extend(Sammy.Store.Memory.prototype,{exists:function(b){return(typeof this.store[b]!="undefined")},set:function(b,c){return this.store[b]=c},get:function(b){return this.store[b]},clear:function(b){delete this.store[b]}});Sammy.Store.Data=function(c,b){this.name=c;this.$element=b};a.extend(Sammy.Store.Data.prototype,{exists:function(b){return(typeof this.$element.data(this._key(b))!="undefined")},set:function(b,c){return this.$element.data(this._key(b),c)},get:function(b){return this.$element.data(this._key(b))},clear:function(b){this.$element.removeData(this._key(b))},_key:function(b){return["store",this.name,b].join(".")}});Sammy.Store.LocalStorage=function(b){this.name=b};a.extend(Sammy.Store.LocalStorage.prototype,{isAvailable:function(){return("localStorage" in window)&&(window.location.protocol!="file:")},exists:function(b){return(this.get(b)!=null)},set:function(b,c){return window.localStorage.setItem(this._key(b),c)},get:function(b){return window.localStorage.getItem(this._key(b))},clear:function(b){window.localStorage.removeItem(this._key(b))},_key:function(b){return["store",this.name,b].join(".")}});Sammy.Store.SessionStorage=function(b){this.name=b};a.extend(Sammy.Store.SessionStorage.prototype,{isAvailable:function(){return("sessionStorage" in window)},exists:function(b){return(this.get(b)!=null)},set:function(b,c){return window.sessionStorage.setItem(this._key(b),c)},get:function(b){return window.sessionStorage.getItem(this._key(b))},clear:function(b){window.sessionStorage.removeItem(this._key(b))},_key:function(b){return["store",this.name,b].join(".")}});Sammy.Store.Cookie=function(d,b,c){this.name=d;this.$element=b;this.options=c||{};this.path=this.options.path||"/";this.expires_in=this.options.expires_in||(14*24*60*60)};a.extend(Sammy.Store.Cookie.prototype,{isAvailable:function(){return("cookie" in document)},exists:function(b){return(this.get(b)!=null)},set:function(b,c){return this._setCookie(b,c)},get:function(b){return this._getCookie(b)},clear:function(b){this._setCookie(b,"",-1)},_key:function(b){return["store",this.name,b].join(".")},_getCookie:function(c){var d=this._key(c).replace(/(\.|\*|\(|\)|\[|\])/g,"\\$1");var b=document.cookie.match("(^|;\\s)"+d+"=([^;]*)(;|$)");return(b?b[2]:null)},_setCookie:function(e,f,c){if(!c){c=(this.expires_in*1000)}var d=new Date();d.setTime(d.getTime()+c);var b=[this._key(e),"=",f,"; expires=",d.toGMTString(),"; path=",this.path].join("");document.cookie=b}});Sammy.Storage=function(b){this.use(Sammy.JSON);this.stores=this.stores||{};this.store=function(d,c){if(typeof this.stores[d]=="undefined"){this.stores[d]=new Sammy.Store(a.extend({name:d,element:this.element_selector},c||{}));this[d]=function(e,f){if(typeof f=="undefined"){return this.stores[d].get(e)}else{if(a.isFunction(f)){return this.stores[d].fetch(e,f)}else{return this.stores[d].set(e,f)}}};this.helper(d,function(){return this.app[d].apply(this.app,arguments)})}return this.stores[d]};this.helpers({store:function(){return this.app.store.apply(this.app,arguments)}})};Sammy.Session=function(d,b){this.use(Sammy.Storage);var c="memory";if(Sammy.Store.isAvailable("local")){c="local"}else{if(Sammy.Store.isAvailable("cookie")){c="cookie"}}this.store("session",a.extend({type:c},b))}})(jQuery);
View
5 javascripts/sammy/min/plugins/sammy.template-0.4.1.min.js
@@ -0,0 +1,5 @@
+// -- Sammy -- /plugins/sammy.template.js
+// http://code.quirkey.com/sammy
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:14 -0500 2010
+(function(c){var a={};var b=function(d,e,f){if(a[d]){fn=a[d]}else{if(typeof e=="undefined"){return false}fn=a[d]=new Function("obj",'var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push("'+e.replace(/[\r\t\n]/g," ").replace(/\"/g,'\\"').split("<%").join("\t").replace(/((^|%>)[^\t]*)/g,"$1\r").replace(/\t=(.*?)%>/g,'",$1,"').split("\t").join('");').split("%>").join('p.push("').split("\r").join("")+"\");}return p.join('');")}if(typeof f!="undefined"){return fn(f)}else{return fn}};Sammy=Sammy||{};Sammy.Template=function(f,d){var e=function(h,i,g){if(typeof g=="undefined"){g=h}return b(g,h,c.extend({},this,i))};if(!d){d="template"}f.helper(d,e)}})(jQuery);
View
6 javascripts/sammy/min/plugins/sammy.template-lastest.min.js
@@ -1,5 +1,5 @@
// -- Sammy -- /plugins/sammy.template.js
// http://code.quirkey.com/sammy
-// Version: 0.4.0
-// Built: Fri Jan 01 14:36:08 -0500 2010
-(function(c){var a={};var b=function(d,e,f){if(a[d]){fn=a[d]}else{if(typeof e=="undefined"){return false}fn=a[d]=new Function("obj",'var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push("'+e.replace(/[\r\t\n]/g," ").replace(/\"/g,'\\"').split("<%").join("\t").replace(/((^|%>)[^\t]*)/g,"$1\r").replace(/\t=(.*?)%>/g,'",$1,"').split("\t").join('");').split("%>").join('p.push("').split("\r").join("")+"\");}return p.join('');")}if(typeof f!="undefined"){return fn(f)}else{return fn}};Sammy=Sammy||{};Sammy.Template=function(g,d){var e=function(i,j,h){if(typeof h=="undefined"){h=i}return b(h,i,c.extend({},this,j))};var f={};if(!d){d="template"}f[d]=e;g.helpers(f)}})(jQuery);
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:14 -0500 2010
+(function(c){var a={};var b=function(d,e,f){if(a[d]){fn=a[d]}else{if(typeof e=="undefined"){return false}fn=a[d]=new Function("obj",'var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push("'+e.replace(/[\r\t\n]/g," ").replace(/\"/g,'\\"').split("<%").join("\t").replace(/((^|%>)[^\t]*)/g,"$1\r").replace(/\t=(.*?)%>/g,'",$1,"').split("\t").join('");').split("%>").join('p.push("').split("\r").join("")+"\");}return p.join('');")}if(typeof f!="undefined"){return fn(f)}else{return fn}};Sammy=Sammy||{};Sammy.Template=function(f,d){var e=function(h,i,g){if(typeof g=="undefined"){g=h}return b(g,h,c.extend({},this,i))};if(!d){d="template"}f.helper(d,e)}})(jQuery);
View
5 javascripts/sammy/min/sammy-0.4.1.min.js
@@ -0,0 +1,5 @@
+// -- Sammy -- /sammy.js
+// http://code.quirkey.com/sammy
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:15 -0500 2010
+(function(f){var c="([^/]+)",e=/:([\w\d]+)/g,b=/\?([^#]*)$/,a=decodeURIComponent,d=[];Sammy={};Sammy.VERSION="0.4.1";Sammy.addLogger=function(g){d.push(g)};Sammy.log=function(){var g=f.makeArray(arguments);g.unshift("["+Date()+"]");f.each(d,function(j,h){h.apply(Sammy,g)})};if(typeof window.console!="undefined"){if(f.isFunction(console.log.apply)){Sammy.addLogger(function(){window.console.log.apply(console,arguments)})}else{Sammy.addLogger(function(){window.console.log(arguments)})}}else{if(typeof console!="undefined"){Sammy.addLogger(function(){console.log.apply(console,arguments)})}}Sammy.Object=function(g){this.extend(g)};f.extend(Sammy.Object.prototype,{extend:function(g){f.extend(this,g)},clone:function(g){if(typeof g=="undefined"){g=this}return f.extend({},g)},toHash:function(){var g={};this.each(function(i,h){if(!f.isFunction(h)){g[i]=h}});return g},toHTML:function(){var g="";this.each(function(i,h){if(!f.isFunction(h)){g+="<strong>"+i+"</strong> "+h+"<br />"}});return g},uuid:function(){if(typeof this._uuid=="undefined"||!this._uuid){this._uuid=(new Date()).getTime()+"-"+parseInt(Math.random()*1000)}return this._uuid},each:function(){var i,h,j,g;i=this;if(typeof arguments[0]!="function"){h=arguments[0];j=arguments[1]}else{h=this;j=arguments[0]}g=function(){return j.apply(i,arguments)};f.each(h,g)},keys:function(g){var h=[];for(var i in this){if(!f.isFunction(this[i])||!g){h.push(i)}}return h},join:function(){var h=f.makeArray(arguments);var g=h.shift();return h.join(g)},log:function(){Sammy.log.apply(Sammy,arguments)},toString:function(g){var h=[];this.each(function(j,i){if(!f.isFunction(i)||g){h.push('"'+j+'": '+i.toString())}});return"Sammy.Object: {"+h.join(",")+"}"}});Sammy.HashLocationProxy=function(h,g){this.app=h;if("onhashchange" in window){Sammy.log("native hash change exists, using");this.is_native=true}else{Sammy.log("no native hash change, falling back to polling");this.is_native=false;this._startPolling(g)}};Sammy.HashLocationProxy.prototype={bind:function(){var g=this.app;f(window).bind("hashchange."+this.app.eventNamespace(),function(){g.trigger("location-changed")})},unbind:function(){f(window).die("hashchange."+this.app.eventNamespace())},getLocation:function(){var g=window.location.toString().match(/^[^#]*(#.+)$/);return g?g[1]:""},setLocation:function(g){return window.location=g},_startPolling:function(i){var h=this;if(!Sammy.HashLocationProxy._interval){if(!i){i=10}var g=function(){current_location=h.getLocation();if(!Sammy.HashLocationProxy._last_location||current_location!=Sammy.HashLocationProxy._last_location){setTimeout(function(){f(window).trigger("hashchange")},1)}Sammy.HashLocationProxy._last_location=current_location};g();Sammy.HashLocationProxy._interval=setInterval(g,i);f(window).bind("unload",function(){clearInterval(Sammy.HashLocationProxy._interval)})}}};Sammy.DataLocationProxy=function(h,g){this.app=h;this.data_name=g||"sammy-location"};Sammy.DataLocationProxy.prototype={bind:function(){var g=this;this.app.$element().bind("setData",function(i,h){if(h==g.data_name){g.app.trigger("location-changed")}})},unbind:function(){this.app.$element().die("setData")},getLocation:function(){return this.app.$element().data(this.data_name)},setLocation:function(g){return this.app.$element().data(this.data_name,g)}};Sammy.Application=function(g){var h=this;this.routes={};this.listeners=new Sammy.Object({});this.befores=[];this.namespace=this.uuid();this.context_prototype=function(){Sammy.EventContext.apply(this,arguments)};this.context_prototype.prototype=new Sammy.EventContext();this.each(this.ROUTE_VERBS,function(j,k){this._defineRouteShortcut(k)});if(f.isFunction(g)){g.apply(this,[this])}if(!this.location_proxy){this.location_proxy=new Sammy.HashLocationProxy(h,this.run_interval_every)}if(this.debug){this.bindToAllEvents(function(j,i){h.log(h.toString(),j.cleaned_type,i||{})})}};Sammy.Application.prototype=f.extend({},Sammy.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-404","check-form-submission","redirect"],_last_route:null,_running:false,data_store_name:"sammy-app",element_selector:"body",debug:false,silence_404:true,run_interval_every:50,location_proxy:null,toString:function(){return"Sammy.Application:"+this.element_selector},$element:function(){return f(this.element_selector)},use:function(){var g=f.makeArray(arguments);var h=g.shift();try{g.unshift(this);h.apply(this,g)}catch(i){if(typeof h=="undefined"){throw ("Error: called use() but plugin is not defined")}else{if(!f.isFunction(h)){throw ("Error: called use() but '"+h.toString()+"' is not a function")}else{throw (i)}}}},route:function(j,h,l){var i=this,k=[],g;if(h.constructor==String){e.lastIndex=0;while((path_match=e.exec(h))!=null){k.push(path_match[1])}h=new RegExp(h.replace(e,c)+"$")}g={verb:j,path:h,callback:l,param_names:k};if(typeof this.routes[j]=="undefined"||this.routes[j].length==0){this.routes[j]=[g]}else{this.routes[j].push(g)}return g},eventNamespace:function(){return[this.data_store_name,this.namespace].join("-")},bind:function(g,i,k){var j=this;if(typeof k=="undefined"){k=i}var h=function(){var n,l,m;n=arguments[0];m=arguments[1];if(m&&m.context){l=m.context;delete m.context}else{l=new j.context_prototype(j,"bind",n.type,m)}n.cleaned_type=n.type.replace(j.eventNamespace(),"");k.apply(l,[n,m])};if(!this.listeners[g]){this.listeners[g]=[]}this.listeners[g].push(h);if(this.isRunning()){return this._listen(g,h)}},trigger:function(g,h){return this.$element().trigger([g,this.eventNamespace()].join("."),[h])},refresh:function(){this.last_location=null},before:function(g){return this.befores.push(g)},after:function(g){return this.bind("event-context-after",g)},isRunning:function(){return this._running},helpers:function(g){f.extend(this.context_prototype.prototype,g)},helper:function(g,h){this.context_prototype.prototype[g]=h},run:function(g){if(this.isRunning()){return false}var h=this;this.each(this.listeners.toHash(),function(i,j){this.each(j,function(l,k){this._listen(i,k)})});this.trigger("run",{start_url:g});this._running=true;this.$element().data(this.data_store_name,this);this.last_location=null;if(this.getLocation()==""&&typeof g!="undefined"){this.setLocation(g)}this._checkLocation();this.location_proxy.bind();this.bind("location-changed",function(){h._checkLocation()});this.bind("changed",function(){h.$element().find("form:not(."+h.eventNamespace()+")").bind("submit",function(){return h._checkFormSubmission(this)}).addClass(h.eventNamespace())});f("body").bind("onunload",function(){h.unload()});this.trigger("changed")},unload:function(){if(!this.isRunning()){return false}var g=this;this.trigger("unload");this.location_proxy.unbind();this.$element().find("form").unbind("submit").removeClass(g.eventNamespace());this.$element().removeData(this.data_store_name);this.each(this.listeners.toHash(),function(h,i){this.each(i,function(k,j){this._unlisten(h,j)})});this._running=false},bindToAllEvents:function(g){this.each(this.APP_EVENTS,function(h,j){this.bind(j,g)});this.each(this.listeners.keys(true),function(j,h){if(this.APP_EVENTS.indexOf(h)==-1){this.bind(h,g)}})},routablePath:function(g){return g.replace(b,"")},lookupRoute:function(i,h){var g=false;this.trigger("lookup-route",{verb:i,path:h});if(typeof this.routes[i]!="undefined"){this.each(this.routes[i],function(k,j){if(this.routablePath(h).match(j.path)){g=j;return false}})}return g},runRoute:function(n,k,m){this.log("runRoute",[n,k].join(" "));this.trigger("run-route",{verb:n,path:k,params:m});if(typeof m=="undefined"){m={}}f.extend(m,this._parseQueryString(k));var h=this.lookupRoute(n,k);if(h){this.trigger("route-found",{route:h});if((path_params=h.path.exec(this.routablePath(k)))!=null){path_params.shift();this.each(path_params,function(o,p){if(h.param_names[o]){m[h.param_names[o]]=a(p)}else{if(!m.splat){m.splat=[]}m.splat.push(a(p))}})}var i=new this.context_prototype(this,n,k,m);this.last_route=h;var g=true;var l=this.befores.slice(0);while(l.length>0){if(l.shift().apply(i)===false){return false}}i.trigger("event-context-before",{context:i});var j=h.callback.apply(i,[i]);i.trigger("event-context-after",{context:i});return j}else{this.notFound(n,k)}},getLocation:function(){return this.location_proxy.getLocation()},setLocation:function(g){return this.location_proxy.setLocation(g)},swap:function(g){return this.$element().html(g)},notFound:function(h,g){this.trigger("error-404",{verb:h,path:g});throw ("404 Not Found "+h+" "+g)},_defineRouteShortcut:function(h){var g=this;this[h]=function(i,j){g.route.apply(g,[h,i,j])}},_checkLocation:function(){try{var g,h;g=this.getLocation();if(g!=this.last_location){h=this.runRoute("get",g)}this.last_location=g}catch(i){this.last_location=g;if(i.toString().match(/^404/)&&this.silence_404){return h}else{throw (i)}}return h},_checkFormSubmission:function(i){var g,k,m,l,h;this.trigger("check-form-submission",{form:i});g=f(i);k=g.attr("action");m=f.trim(g.attr("method").toString().toLowerCase());if(!m||m==""){m="get"}l=f.extend({},this._parseFormParams(g),{"$form":g});try{h=this.runRoute(m,k,l)}catch(j){if(j.toString().match(/^404/)&&this.silence_404){return true}else{throw (j)}}return(typeof h=="undefined")?false:h},_parseFormParams:function(g){var h={};f.each(g.serializeArray(),function(j,k){if(h[k.name]){if(f.isArray(h[k.name])){h[k.name].push(k.value)}else{h[k.name]=[h[k.name],k.value]}}else{h[k.name]=k.value}});return h},_parseQueryString:function(l){var j={},k,h,m,g;k=l.match(b);if(k){h=k[1].split("&");for(g=0;g<h.length;g+=1){m=h[g].split("=");j[m[0]]=a(m[1])}}return j},_listen:function(g,h){return this.$element().bind([g,this.eventNamespace()].join("."),h)},_unlisten:function(g,h){return this.$element().unbind([g,this.eventNamespace()].join("."),h)}});Sammy.EventContext=function(j,i,g,h){this.app=j;this.verb=i;this.path=g;this.params=new Sammy.Object(h)};Sammy.EventContext.prototype=f.extend({},Sammy.Object.prototype,{$element:function(){return this.app.$element()},partial:function(m,l,n){var i,g,k,h="partial:"+m,j=this;if((k=m.match(/\.([^\.]+)$/))){k=k[1]}if(typeof n=="undefined"){if(f.isFunction(l)){n=l;l={}}else{n=function(o){j.app.swap(o)}}}l=f.extend({},l,this);g=function(o){if(k&&f.isFunction(j[k])){o=j[k].apply(j,[o,l])}n.apply(j,[o]);j.trigger("changed")};if(this.app.cache_partials&&this.cache(h)){g.apply(j,[this.cache(h)])}else{f.get(m,function(o){if(j.app.cache_partials){j.cache(h,o)}g.apply(j,[o])})}},redirect:function(){var i,h=f.makeArray(arguments),g=this.app.getLocation();if(h.length>1){h.unshift("/");i=this.join.apply(this,h)}else{i=h[0]}this.trigger("redirect",{to:i});this.app.last_location=this.path;this.app.setLocation(i);if(g==i){this.app.trigger("location-changed")}},trigger:function(g,h){if(typeof h=="undefined"){h={}}if(!h.context){h.context=this}return this.app.trigger(g,h)},eventNamespace:function(){return this.app.eventNamespace()},notFound:function(){return this.app.notFound(this.verb,this.path)},toString:function(){return"Sammy.EventContext: "+[this.verb,this.path,this.params].join(" ")}});f.sammy=function(g){return new Sammy.Application(g)}})(jQuery);
View
6 javascripts/sammy/min/sammy-lastest.min.js
@@ -1,5 +1,5 @@
// -- Sammy -- /sammy.js
// http://code.quirkey.com/sammy
-// Version: 0.4.0
-// Built: Fri Jan 01 14:36:09 -0500 2010
-(function(e){var b="([^/]+)";var d=/:([\w\d]+)/g;var a=/\?([^#]*)$/;var c=[];Sammy={};Sammy.VERSION="0.4.0";Sammy.addLogger=function(f){c.push(f)};Sammy.log=function(){var f=e.makeArray(arguments);f.unshift("["+Date()+"]");e.each(c,function(h,g){g.apply(Sammy,f)})};if(typeof window.console!="undefined"){Sammy.addLogger(function(){window.console.log.apply(window.console,arguments)})}else{if(typeof console!="undefined"){Sammy.addLogger.push(function(){console.log.apply(console,arguments)})}}Sammy.Object=function(f){this.extend(f)};e.extend(Sammy.Object.prototype,{extend:function(f){e.extend(this,f)},clone:function(f){if(typeof f=="undefined"){f=this}return e.extend({},f)},toHash:function(){var f={};this.each(function(h,g){if(!e.isFunction(g)){f[h]=g}});return f},toHTML:function(){var f="";this.each(function(h,g){if(!e.isFunction(g)){f+="<strong>"+h+"</strong> "+g+"<br />"}});return f},uuid:function(){if(typeof this._uuid=="undefined"||!this._uuid){this._uuid=(new Date()).getTime()+"-"+parseInt(Math.random()*1000)}return this._uuid},each:function(){var h,g,i,f;h=this;if(typeof arguments[0]!="function"){g=arguments[0];i=arguments[1]}else{g=this;i=arguments[0]}f=function(){return i.apply(h,arguments)};e.each(g,f)},keys:function(f){var g=[];for(var h in this){if(!e.isFunction(this[h])||!f){g.push(h)}}return g},join:function(){var g=e.makeArray(arguments);var f=g.shift();return g.join(f)},log:function(){Sammy.log.apply(Sammy,arguments)},toString:function(f){var g=[];this.each(function(i,h){if(!e.isFunction(h)||f){g.push('"'+i+'": '+h.toString())}});return"Sammy.Object: {"+g.join(",")+"}"}});Sammy.HashLocationProxy=function(g,f){this.app=g;if("onhashchange" in window){Sammy.log("native hash change exists, using");this.is_native=true}else{Sammy.log("no native hash change, falling back to polling");this.is_native=false;this._startPolling(f)}};Sammy.HashLocationProxy.prototype={bind:function(){var f=this.app;e(window).bind("hashchange."+this.app.eventNamespace(),function(){f.trigger("location-changed")})},unbind:function(){e(window).die("hashchange."+this.app.eventNamespace())},getLocation:function(){var f=window.location.toString().match(/^[^#]*(#.+)$/);return f?f[1]:""},setLocation:function(f){return window.location=f},_startPolling:function(h){var g=this;if(!Sammy.HashLocationProxy._interval){if(!h){h=10}var f=function(){current_location=g.getLocation();if(!Sammy.HashLocationProxy._last_location||current_location!=Sammy.HashLocationProxy._last_location){setTimeout(function(){e(window).trigger("hashchange")},1)}Sammy.HashLocationProxy._last_location=current_location};f();Sammy.HashLocationProxy._interval=setInterval(f,h);e(window).bind("unload",function(){clearInterval(Sammy.HashLocationProxy._interval)})}}};Sammy.DataLocationProxy=function(g,f){this.app=g;this.data_name=f||"sammy-location"};Sammy.DataLocationProxy.prototype={bind:function(){var f=this;this.app.$element().bind("setData",function(h,g){if(g==f.data_name){f.app.trigger("location-changed")}})},unbind:function(){this.app.$element().die("setData")},getLocation:function(){return this.app.$element().data(this.data_name)},setLocation:function(f){return this.app.$element().data(this.data_name,f)}};Sammy.Application=function(f){var g=this;this.routes={};this.listeners=new Sammy.Object({});this.befores=[];this.namespace=this.uuid();this.context_prototype=function(){Sammy.EventContext.apply(this,arguments)};this.context_prototype.prototype=new Sammy.EventContext();this.each(this.ROUTE_VERBS,function(h,j){this._defineRouteShortcut(j)});if(e.isFunction(f)){f.apply(this,[this])}if(!this.location_proxy){this.location_proxy=new Sammy.HashLocationProxy(g,this.run_interval_every)}if(this.debug){this.bindToAllEvents(function(i,h){g.log(g.toString(),i.cleaned_type,h||{})})}};Sammy.Application.prototype=e.extend({},Sammy.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-404","check-form-submission","redirect"],_last_route:null,_running:false,data_store_name:"sammy-app",element_selector:"body",debug:false,silence_404:true,run_interval_every:50,toString:function(){return"Sammy.Application:"+this.element_selector},$element:function(){return e(this.element_selector)},use:function(){var f=e.makeArray(arguments);var g=f.shift();try{f.unshift(this);g.apply(this,f)}catch(h){if(typeof g=="undefined"){throw ("Error: called use() but plugin is not defined")}else{if(!e.isFunction(g)){throw ("Error: called use() but '"+g.toString()+"' is not a function")}else{throw (h)}}}},route:function(i,g,k){var h=this,j=[],f;if(g.constructor==String){d.lastIndex=0;while((path_match=d.exec(g))!=null){j.push(path_match[1])}g=new RegExp(g.replace(d,b)+"$")}f={verb:i,path:g,callback:k,param_names:j};if(typeof this.routes[i]=="undefined"||this.routes[i].length==0){this.routes[i]=[f]}else{this.routes[i].push(f)}return f},eventNamespace:function(){return[this.data_store_name,this.namespace].join("-")},bind:function(f,h,j){var i=this;if(typeof j=="undefined"){j=h}var g=function(){var m,k,l;m=arguments[0];l=arguments[1];if(l&&l.context){k=l.context;delete l.context}else{k=new i.context_prototype(i,"bind",m.type,l)}m.cleaned_type=m.type.replace(i.eventNamespace(),"");j.apply(k,[m,l])};if(!this.listeners[f]){this.listeners[f]=[]}this.listeners[f].push(g);if(this.isRunning()){return this._listen(f,g)}},trigger:function(f,g){return this.$element().trigger([f,this.eventNamespace()].join("."),[g])},refresh:function(){this.last_location=null},before:function(f){return this.befores.push(f)},after:function(f){return this.bind("event-context-after",f)},isRunning:function(){return this._running},helpers:function(f){e.extend(this.context_prototype.prototype,f)},helper:function(f,g){this.context_prototype.prototype[f]=g},run:function(f){if(this.isRunning()){return false}var g=this;this.each(this.listeners.toHash(),function(h,i){this.each(i,function(k,j){this._listen(h,j)})});this.trigger("run",{start_url:f});this._running=true;this.$element().data(this.data_store_name,this);this.last_location=null;if(this.getLocation()==""&&typeof f!="undefined"){this.setLocation(f)}this._checkLocation();this.location_proxy.bind();this.bind("location-changed",function(){g._checkLocation()});this.bind("changed",function(){g.$element().find("form:not(."+g.eventNamespace()+")").bind("submit",function(){return g._checkFormSubmission(this)}).addClass(g.eventNamespace())});e("body").bind("onunload",function(){g.unload()});this.trigger("changed")},unload:function(){if(!this.isRunning()){return false}var f=this;this.trigger("unload");this.location_proxy.unbind();this.$element().find("form").unbind("submit").removeClass(f.eventNamespace());this.$element().removeData(this.data_store_name);this.each(this.listeners.toHash(),function(g,h){this.each(h,function(k,j){this._unlisten(g,j)})});this._running=false},bindToAllEvents:function(f){this.each(this.APP_EVENTS,function(g,h){this.bind(h,f)});this.each(this.listeners.keys(true),function(h,g){if(this.APP_EVENTS.indexOf(g)==-1){this.bind(g,f)}})},routablePath:function(f){return f.replace(a,"")},lookupRoute:function(h,g){var f=false;this.trigger("lookup-route",{verb:h,path:g});if(typeof this.routes[h]!="undefined"){this.each(this.routes[h],function(k,j){if(this.routablePath(g).match(j.path)){f=j;return false}})}return f},runRoute:function(m,j,l){this.log("runRoute",[m,j].join(" "));this.trigger("run-route",{verb:m,path:j,params:l});if(typeof l=="undefined"){l={}}e.extend(l,this._parseQueryString(j));var g=this.lookupRoute(m,j);if(g){this.trigger("route-found",{route:g});if((path_params=g.path.exec(this.routablePath(j)))!=null){path_params.shift();this.each(path_params,function(n,o){if(g.param_names[n]){l[g.param_names[n]]=o}else{if(!l.splat){l.splat=[]}l.splat.push(o)}})}var h=new this.context_prototype(this,m,j,l);this.last_route=g;var f=true;var k=this.befores.slice(0);while(k.length>0){if(k.shift().apply(h)===false){return false}}h.trigger("event-context-before",{context:h});var i=g.callback.apply(h,[h]);h.trigger("event-context-after",{context:h});return i}else{this.notFound(m,j)}},getLocation:function(){return this.location_proxy.getLocation()},setLocation:function(f){return this.location_proxy.setLocation(f)},swap:function(f){return this.$element().html(f)},notFound:function(g,f){this.trigger("error-404",{verb:g,path:f});throw ("404 Not Found "+g+" "+f)},_defineRouteShortcut:function(g){var f=this;this[g]=function(h,i){f.route.apply(f,[g,h,i])}},_checkLocation:function(){try{var f,g;f=this.getLocation();if(f!=this.last_location){g=this.runRoute("get",f)}this.last_location=f}catch(h){this.last_location=f;if(h.toString().match(/^404/)&&this.silence_404){return g}else{throw (h)}}return g},_checkFormSubmission:function(h){var f,j,l,k,g;this.trigger("check-form-submission",{form:h});f=e(h);j=f.attr("action");l=e.trim(f.attr("method").toString().toLowerCase());if(!l||l==""){l="get"}k=e.extend({},this._parseFormParams(f),{"$form":f});try{g=this.runRoute(l,j,k)}catch(i){if(i.toString().match(/^404/)&&this.silence_404){return true}else{throw (i)}}return(typeof g=="undefined")?false:g},_parseFormParams:function(f){var g={};e.each(f.serializeArray(),function(h,j){if(g[j.name]){if(e.isArray(g[j.name])){g[j.name].push(j.value)}else{g[j.name]=[g[j.name],j.value]}}else{g[j.name]=j.value}});return g},_parseQueryString:function(k){var h={},j,g,l,f;j=k.match(a);if(j){g=j[1].split("&");for(f=0;f<g.length;f+=1){l=g[f].split("=");h[l[0]]=decodeURIComponent(l[1])}}return h},_listen:function(f,g){return this.$element().bind([f,this.eventNamespace()].join("."),g)},_unlisten:function(f,g){return this.$element().unbind([f,this.eventNamespace()].join("."),g)}});Sammy.EventContext=function(i,h,f,g){this.app=i;this.verb=h;this.path=f;this.params=new Sammy.Object(g)};Sammy.EventContext.prototype=e.extend({},Sammy.Object.prototype,{$element:function(){return this.app.$element()},partial:function(l,k,m){var h,f,j,g="partial:"+l,i=this;if((j=l.match(/\.([^\.]+)$/))){j=j[1]}if(typeof m=="undefined"){if(e.isFunction(k)){m=k;k={}}else{m=function(n){i.app.swap(n)}}}k=e.extend({},k,this);f=function(n){if(j&&e.isFunction(i[j])){n=i[j].apply(i,[n,k])}m.apply(i,[n]);i.trigger("changed")};if(this.app.cache_partials&&this.cache(g)){f.apply(i,[this.cache(g)])}else{e.get(l,function(n){if(i.app.cache_partials){i.cache(g,n)}f.apply(i,[n])})}},redirect:function(){var h,g=e.makeArray(arguments),f=this.app.getLocation();if(g.length>1){g.unshift("/");h=this.join.apply(this,g)}else{h=g[0]}this.trigger("redirect",{to:h});this.app.last_location=this.path;this.app.setLocation(h);if(f==h){this.app.trigger("location-changed")}},trigger:function(f,g){if(typeof g=="undefined"){g={}}if(!g.context){g.context=this}return this.app.trigger(f,g)},eventNamespace:function(){return this.app.eventNamespace()},notFound:function(){return this.app.notFound(this.verb,this.path)},toString:function(){return"Sammy.EventContext: "+[this.verb,this.path,this.params].join(" ")}});e.sammy=function(f){return new Sammy.Application(f)}})(jQuery);
+// Version: 0.4.1
+// Built: Mon Jan 11 22:02:15 -0500 2010
+(function(f){var c="([^/]+)",e=/:([\w\d]+)/g,b=/\?([^#]*)$/,a=decodeURIComponent,d=[];Sammy={};Sammy.VERSION="0.4.1";Sammy.addLogger=function(g){d.push(g)};Sammy.log=function(){var g=f.makeArray(arguments);g.unshift("["+Date()+"]");f.each(d,function(j,h){h.apply(Sammy,g)})};if(typeof window.console!="undefined"){if(f.isFunction(console.log.apply)){Sammy.addLogger(function(){window.console.log.apply(console,arguments)})}else{Sammy.addLogger(function(){window.console.log(arguments)})}}else{if(typeof console!="undefined"){Sammy.addLogger(function(){console.log.apply(console,arguments)})}}Sammy.Object=function(g){this.extend(g)};f.extend(Sammy.Object.prototype,{extend:function(g){f.extend(this,g)},clone:function(g){if(typeof g=="undefined"){g=this}return f.extend({},g)},toHash:function(){var g={};this.each(function(i,h){if(!f.isFunction(h)){g[i]=h}});return g},toHTML:function(){var g="";this.each(function(i,h){if(!f.isFunction(h)){g+="<strong>"+i+"</strong> "+h+"<br />"}});return g},uuid:function(){if(typeof this._uuid=="undefined"||!this._uuid){this._uuid=(new Date()).getTime()+"-"+parseInt(Math.random()*1000)}return this._uuid},each:function(){var i,h,j,g;i=this;if(typeof arguments[0]!="function"){h=arguments[0];j=arguments[1]}else{h=this;j=arguments[0]}g=function(){return j.apply(i,arguments)};f.each(h,g)},keys:function(g){var h=[];for(var i in this){if(!f.isFunction(this[i])||!g){h.push(i)}}return h},join:function(){var h=f.makeArray(arguments);var g=h.shift();return h.join(g)},log:function(){Sammy.log.apply(Sammy,arguments)},toString:function(g){var h=[];this.each(function(j,i){if(!f.isFunction(i)||g){h.push('"'+j+'": '+i.toString())}});return"Sammy.Object: {"+h.join(",")+"}"}});Sammy.HashLocationProxy=function(h,g){this.app=h;if("onhashchange" in window){Sammy.log("native hash change exists, using");this.is_native=true}else{Sammy.log("no native hash change, falling back to polling");this.is_native=false;this._startPolling(g)}};Sammy.HashLocationProxy.prototype={bind:function(){var g=this.app;f(window).bind("hashchange."+this.app.eventNamespace(),function(){g.trigger("location-changed")})},unbind:function(){f(window).die("hashchange."+this.app.eventNamespace())},getLocation:function(){var g=window.location.toString().match(/^[^#]*(#.+)$/);return g?g[1]:""},setLocation:function(g){return window.location=g},_startPolling:function(i){var h=this;if(!Sammy.HashLocationProxy._interval){if(!i){i=10}var g=function(){current_location=h.getLocation();if(!Sammy.HashLocationProxy._last_location||current_location!=Sammy.HashLocationProxy._last_location){setTimeout(function(){f(window).trigger("hashchange")},1)}Sammy.HashLocationProxy._last_location=current_location};g();Sammy.HashLocationProxy._interval=setInterval(g,i);f(window).bind("unload",function(){clearInterval(Sammy.HashLocationProxy._interval)})}}};Sammy.DataLocationProxy=function(h,g){this.app=h;this.data_name=g||"sammy-location"};Sammy.DataLocationProxy.prototype={bind:function(){var g=this;this.app.$element().bind("setData",function(i,h){if(h==g.data_name){g.app.trigger("location-changed")}})},unbind:function(){this.app.$element().die("setData")},getLocation:function(){return this.app.$element().data(this.data_name)},setLocation:function(g){return this.app.$element().data(this.data_name,g)}};Sammy.Application=function(g){var h=this;this.routes={};this.listeners=new Sammy.Object({});this.befores=[];this.namespace=this.uuid();this.context_prototype=function(){Sammy.EventContext.apply(this,arguments)};this.context_prototype.prototype=new Sammy.EventContext();this.each(this.ROUTE_VERBS,function(j,k){this._defineRouteShortcut(k)});if(f.isFunction(g)){g.apply(this,[this])}if(!this.location_proxy){this.location_proxy=new Sammy.HashLocationProxy(h,this.run_interval_every)}if(this.debug){this.bindToAllEvents(function(j,i){h.log(h.toString(),j.cleaned_type,i||{})})}};Sammy.Application.prototype=f.extend({},Sammy.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-404","check-form-submission","redirect"],_last_route:null,_running:false,data_store_name:"sammy-app",element_selector:"body",debug:false,silence_404:true,run_interval_every:50,location_proxy:null,toString:function(){return"Sammy.Application:"+this.element_selector},$element:function(){return f(this.element_selector)},use:function(){var g=f.makeArray(arguments);var h=g.shift();try{g.unshift(this);h.apply(this,g)}catch(i){if(typeof h=="undefined"){throw ("Error: called use() but plugin is not defined")}else{if(!f.isFunction(h)){throw ("Error: called use() but '"+h.toString()+"' is not a function")}else{throw (i)}}}},route:function(j,h,l){var i=this,k=[],g;if(h.constructor==String){e.lastIndex=0;while((path_match=e.exec(h))!=null){k.push(path_match[1])}h=new RegExp(h.replace(e,c)+"$")}g={verb:j,path:h,callback:l,param_names:k};if(typeof this.routes[j]=="undefined"||this.routes[j].length==0){this.routes[j]=[g]}else{this.routes[j].push(g)}return g},eventNamespace:function(){return[this.data_store_name,this.namespace].join("-")},bind:function(g,i,k){var j=this;if(typeof k=="undefined"){k=i}var h=function(){var n,l,m;n=arguments[0];m=arguments[1];if(m&&m.context){l=m.context;delete m.context}else{l=new j.context_prototype(j,"bind",n.type,m)}n.cleaned_type=n.type.replace(j.eventNamespace(),"");k.apply(l,[n,m])};if(!this.listeners[g]){this.listeners[g]=[]}this.listeners[g].push(h);if(this.isRunning()){return this._listen(g,h)}},trigger:function(g,h){return this.$element().trigger([g,this.eventNamespace()].join("."),[h])},refresh:function(){this.last_location=null},before:function(g){return this.befores.push(g)},after:function(g){return this.bind("event-context-after",g)},isRunning:function(){return this._running},helpers:function(g){f.extend(this.context_prototype.prototype,g)},helper:function(g,h){this.context_prototype.prototype[g]=h},run:function(g){if(this.isRunning()){return false}var h=this;this.each(this.listeners.toHash(),function(i,j){this.each(j,function(l,k){this._listen(i,k)})});this.trigger("run",{start_url:g});this._running=true;this.$element().data(this.data_store_name,this);this.last_location=null;if(this.getLocation()==""&&typeof g!="undefined"){this.setLocation(g)}this._checkLocation();this.location_proxy.bind();this.bind("location-changed",function(){h._checkLocation()});this.bind("changed",function(){h.$element().find("form:not(."+h.eventNamespace()+")").bind("submit",function(){return h._checkFormSubmission(this)}).addClass(h.eventNamespace())});f("body").bind("onunload",function(){h.unload()});this.trigger("changed")},unload:function(){if(!this.isRunning()){return false}var g=this;this.trigger("unload");this.location_proxy.unbind();this.$element().find("form").unbind("submit").removeClass(g.eventNamespace());this.$element().removeData(this.data_store_name);this.each(this.listeners.toHash(),function(h,i){this.each(i,function(k,j){this._unlisten(h,j)})});this._running=false},bindToAllEvents:function(g){this.each(this.APP_EVENTS,function(h,j){this.bind(j,g)});this.each(this.listeners.keys(true),function(j,h){if(this.APP_EVENTS.indexOf(h)==-1){this.bind(h,g)}})},routablePath:function(g){return g.replace(b,"")},lookupRoute:function(i,h){var g=false;this.trigger("lookup-route",{verb:i,path:h});if(typeof this.routes[i]!="undefined"){this.each(this.routes[i],function(k,j){if(this.routablePath(h).match(j.path)){g=j;return false}})}return g},runRoute:function(n,k,m){this.log("runRoute",[n,k].join(" "));this.trigger("run-route",{verb:n,path:k,params:m});if(typeof m=="undefined"){m={}}f.extend(m,this._parseQueryString(k));var h=this.lookupRoute(n,k);if(h){this.trigger("route-found",{route:h});if((path_params=h.path.exec(this.routablePath(k)))!=null){path_params.shift();this.each(path_params,function(o,p){if(h.param_names[o]){m[h.param_names[o]]=a(p)}else{if(!m.splat){m.splat=[]}m.splat.push(a(p))}})}var i=new this.context_prototype(this,n,k,m);this.last_route=h;var g=true;var l=this.befores.slice(0);while(l.length>0){if(l.shift().apply(i)===false){return false}}i.trigger("event-context-before",{context:i});var j=h.callback.apply(i,[i]);i.trigger("event-context-after",{context:i});return j}else{this.notFound(n,k)}},getLocation:function(){return this.location_proxy.getLocation()},setLocation:function(g){return this.location_proxy.setLocation(g)},swap:function(g){return this.$element().html(g)},notFound:function(h,g){this.trigger("error-404",{verb:h,path:g});throw ("404 Not Found "+h+" "+g)},_defineRouteShortcut:function(h){var g=this;this[h]=function(i,j){g.route.apply(g,[h,i,j])}},_checkLocation:function(){try{var g,h;g=this.getLocation();if(g!=this.last_location){h=this.runRoute("get",g)}this.last_location=g}catch(i){this.last_location=g;if(i.toString().match(/^404/)&&this.silence_404){return h}else{throw (i)}}return h},_checkFormSubmission:function(i){var g,k,m,l,h;this.trigger("check-form-submission",{form:i});g=f(i);k=g.attr("action");m=f.trim(g.attr("method").toString().toLowerCase());if(!m||m==""){m="get"}l=f.extend({},this._parseFormParams(g),{"$form":g});try{h=this.runRoute(m,k,l)}catch(j){if(j.toString().match(/^404/)&&this.silence_404){return true}else{throw (j)}}return(typeof h=="undefined")?false:h},_parseFormParams:function(g){var h={};f.each(g.serializeArray(),function(j,k){if(h[k.name]){if(f.isArray(h[k.name])){h[k.name].push(k.value)}else{h[k.name]=[h[k.name],k.value]}}else{h[k.name]=k.value}});return h},_parseQueryString:function(l){var j={},k,h,m,g;k=l.match(b);if(k){h=k[1].split("&");for(g=0;g<h.length;g+=1){m=h[g].split("=");j[m[0]]=a(m[1])}}return j},_listen:function(g,h){return this.$element().bind([g,this.eventNamespace()].join("."),h)},_unlisten:function(g,h){return this.$element().unbind([g,this.eventNamespace()].join("."),h)}});Sammy.EventContext=function(j,i,g,h){this.app=j;this.verb=i;this.path=g;this.params=new Sammy.Object(h)};Sammy.EventContext.prototype=f.extend({},Sammy.Object.prototype,{$element:function(){return this.app.$element()},partial:function(m,l,n){var i,g,k,h="partial:"+m,j=this;if((k=m.match(/\.([^\.]+)$/))){k=k[1]}if(typeof n=="undefined"){if(f.isFunction(l)){n=l;l={}}else{n=function(o){j.app.swap(o)}}}l=f.extend({},l,this);g=function(o){if(k&&f.isFunction(j[k])){o=j[k].apply(j,[o,l])}n.apply(j,[o]);j.trigger("changed")};if(this.app.cache_partials&&this.cache(h)){g.apply(j,[this.cache(h)])}else{f.get(m,function(o){if(j.app.cache_partials){j.cache(h,o)}g.apply(j,[o])})}},redirect:function(){var i,h=f.makeArray(arguments),g=this.app.getLocation();if(h.length>1){h.unshift("/");i=this.join.apply(this,h)}else{i=h[0]}this.trigger("redirect",{to:i});this.app.last_location=this.path;this.app.setLocation(i);if(g==i){this.app.trigger("location-changed")}},trigger:function(g,h){if(typeof h=="undefined"){h={}}if(!h.context){h.context=this}return this.app.trigger(g,h)},eventNamespace:function(){return this.app.eventNamespace()},notFound:function(){return this.app.notFound(this.verb,this.path)},toString:function(){return"Sammy.EventContext: "+[this.verb,this.path,this.params].join(" ")}});f.sammy=function(g){return new Sammy.Application(g)}})(jQuery);
View
6 javascripts/sammy/plugins/sammy.json.js
@@ -2,8 +2,8 @@
// json2.js - only included if native json does not exist
// http://www.json.org/js.html
- if (!JSON) {
- JSON = {};
+ if (!window.JSON) {
+ window.JSON = {};
}
(function () {
@@ -324,7 +324,7 @@
Sammy = Sammy || {};
// Sammy.JSON is a simple wrapper around Douglas Crockford's ever-useful json2.js
- // [http://www.json.org/js.html] Sammy.JSON includes the top level JSON object if
+ // (http://www.json.org/js.html]) Sammy.JSON includes the top level JSON object if
// it doesn't already exist (a.k.a. does not override the native implementation that
// some browsers include). It also adds a <tt>json()</tt> helper to a Sammy app when
// included.
View
8 javascripts/sammy/plugins/sammy.mustache.js
@@ -288,7 +288,7 @@ var Mustache = function() {
//
// The template (mytemplate.ms):
//
- // <h1>{{title}}<h1>
+ // <h1>\{\{title\}\}<h1>
//
// Hey, {{name}}! Welcome to Mustache!
//
@@ -331,13 +331,9 @@ var Mustache = function() {
return Mustache.to_html(template, $.extend({}, this, data));
};
- var helpers = {};
// set the default method name/extension
if (!method_alias) method_alias = 'mustache';
- // create the helper at the method alias
- helpers[method_alias] = mustache;
-
- app.helpers(helpers);
+ app.helper(method_alias, mustache);
};
View
16 javascripts/sammy/plugins/sammy.storage.js
@@ -63,13 +63,6 @@
'cookie': 'Cookie'
};
- // Tests if the type of storage is available/works in the current browser/config.
- // Especially useful for testing the availability of the awesome, but not widely
- // supported HTML5 DOM storage
- Sammy.Store.isAvailable = function(type) {
- return Sammy.Store[Sammy.Store.stores[type]].prototype.isAvailable();
- };
-
$.extend(Sammy.Store.prototype, {
// Checks for the availability of the current storage type in the current browser/config.
isAvailable: function() {
@@ -168,6 +161,13 @@
this.set(this.meta_key, keys);
}
});
+
+ // Tests if the type of storage is available/works in the current browser/config.
+ // Especially useful for testing the availability of the awesome, but not widely
+ // supported HTML5 DOM storage
+ Sammy.Store.isAvailable = function(type) {
+ return Sammy.Store[Sammy.Store.stores[type]].prototype.isAvailable();
+ };
// Memory ('memory') is the basic/default store. It stores data in a global
// JS object. Data is lost on refresh.
@@ -232,7 +232,7 @@
};
$.extend(Sammy.Store.LocalStorage.prototype, {
isAvailable: function() {
- return ('localStorage' in window) && window.location.protocol != 'file:';
+ return ('localStorage' in window) && (window.location.protocol != 'file:');
},
exists: function(key) {
return (this.get(key) != null);
View
5 javascripts/sammy/plugins/sammy.template.js
@@ -107,13 +107,10 @@
return srender(name, template, $.extend({}, this, data));
};
- var helpers = {};
// set the default method name/extension
if (!method_alias) method_alias = 'template';
// create the helper at the method alias
- helpers[method_alias] = template;
-
- app.helpers(helpers);
+ app.helper(method_alias, template);
};
View
73 javascripts/sammy/sammy.js
@@ -1,14 +1,14 @@
;(function($) {
- var PATH_REPLACER = "([^\/]+)";
- var PATH_NAME_MATCHER = /:([\w\d]+)/g;
- var QUERY_STRING_MATCHER = /\?([^#]*)$/;
-
- var loggers = [];
+ var PATH_REPLACER = "([^\/]+)",
+ PATH_NAME_MATCHER = /:([\w\d]+)/g,
+ QUERY_STRING_MATCHER = /\?([^#]*)$/,
+ _decode = decodeURIComponent,
+ loggers = [];
Sammy = {};
- Sammy.VERSION = '0.4.0';
+ Sammy.VERSION = '0.4.1';
// Add to the global logger pool. Takes a function that accepts an
// unknown number of arguments and should print them or send them somewhere
@@ -29,11 +29,17 @@
};
if (typeof window.console != 'undefined') {
- Sammy.addLogger(function() {
- window.console.log.apply(window.console, arguments);
- });
+ if ($.isFunction(console.log.apply)) {
+ Sammy.addLogger(function() {
+ window.console.log.apply(console, arguments);
+ });
+ } else {
+ Sammy.addLogger(function() {
+ window.console.log(arguments);
+ });
+ }
} else if (typeof console != 'undefined') {
- Sammy.addLogger.push(function() {
+ Sammy.addLogger(function() {
console.log.apply(console, arguments);
});
}
@@ -153,6 +159,18 @@
}
});
+ // The HashLocationProxy is the default location proxy for all Sammy applications.
+ // A location proxy is a prototype that conforms to a simple interface. The purpose
+ // of a location proxy is to notify the Sammy.Application its bound to when the location
+ // or 'external state' changes. The HashLocationProxy considers the state to be
+ // changed when the 'hash' (window.location.hash / '#') changes. It does this in two
+ // different ways depending on what browser you are using. The newest browsers
+ // (IE, Safari > 4, FF >= 3.6) support a 'onhashchange' DOM event, thats fired whenever
+ // the location.hash changes. In this situation the HashLocationProxy just binds
+ // to this event and delegates it to the application. In the case of older browsers
+ // a poller is set up to track changes to the hash. Unlike Sammy 0.3 or earlier,
+ // the HashLocationProxy allows the poller to be a global object, eliminating the
+ // need for multiple pollers even when thier are multiple apps on the page.
Sammy.HashLocationProxy = function(app, run_interval_every) {
this.app = app;
@@ -168,25 +186,26 @@
};
Sammy.HashLocationProxy.prototype = {
+ // bind the proxy events to the current app.
bind: function() {
var app = this.app;
$(window).bind('hashchange.' + this.app.eventNamespace(), function() {
app.trigger('location-changed');
});
},
-
+ // unbind the proxy events from the current app
unbind: function() {
$(window).die('hashchange.' + this.app.eventNamespace());
},
-
+ // get the current location from the hash.
getLocation: function() {
// Bypass the `window.location.hash` attribute. If a question mark
// appears in the hash IE6 will strip it and all of the following
// characters from `window.location.hash`.
var matches = window.location.toString().match(/^[^#]*(#.+)$/);
return matches ? matches[1] : '';
},
-
+ // set the current location to <tt>new_location</tt>
setLocation: function(new_location) {
return window.location = new_location;
},
@@ -216,6 +235,12 @@
}
};
+ // The DataLocationProxy is an optional location proxy prototype. As opposed to
+ // the <tt>HashLocationProxy</tt> it gets its location from a jQuery.data attribute
+ // tied to the application's element. You can set the name of the attribute by
+ // passing a string as the second argument to the constructor. The default attribute
+ // name is 'sammy-location'. To read more about location proxies, check out the
+ // documentation for <tt>Sammy.HashLocationProxy</tt>
Sammy.DataLocationProxy = function(app, data_name) {
this.app = app;
this.data_name = data_name || 'sammy-location';
@@ -303,6 +328,12 @@
// The time in milliseconds that the URL is queried for changes
run_interval_every: 50,
+
+ // The location proxy for the current app. By default this is set to a new
+ // <tt>Sammy.HashLocationProxy</tt> on initialization. However, you can set
+ // the location_proxy inside you're app function to give youre app a custom
+ // location mechanism
+ location_proxy: null,
// //=> Sammy.Application: body
toString: function() {
@@ -716,11 +747,11 @@
// if theres a matching param name
if (route.param_names[i]) {
// set the name to the match
- params[route.param_names[i]] = param;
+ params[route.param_names[i]] = _decode(param);
} else {
// initialize 'splat'
if (!params['splat']) params['splat'] = [];
- params['splat'].push(param);
+ params['splat'].push(_decode(param));
}
});
}
@@ -743,16 +774,14 @@
}
},
- // The default behavior is to return the current window's location hash.
- // Override this and <tt>setLocation()</tt> to detach the app from the
- // window.location object.
+ // Delegates to the <tt>location_proxy</tt> to get the current location.
+ // See <tt>Sammy.HashLocationProxy</tt> for more info on location proxies.
getLocation: function() {
return this.location_proxy.getLocation()
},
- // The default behavior is to set the current window's location.
- // Override this and <tt>getLocation()</tt> to detach the app from the
- // window.location object.
+ // Delegates to the <tt>location_proxy</tt> to set the current location.
+ // See <tt>Sammy.HashLocationProxy</tt> for more info on location proxies.
//
// === Arguments
//
@@ -868,7 +897,7 @@
pairs = parts[1].split('&');
for (i = 0; i < pairs.length; i += 1) {
pair = pairs[i].split('=');
- query[pair[0]] = decodeURIComponent(pair[1]);
+ query[pair[0]] = _decode(pair[1]);
}
}

0 comments on commit c72671c

Please sign in to comment.