From cae076dc88f6d939ead85eb38d77fb8ced418128 Mon Sep 17 00:00:00 2001 From: Tom Blanchard Date: Mon, 16 Nov 2015 18:30:09 +0100 Subject: [PATCH 1/2] Only use strftime if in browser environment --- source/core.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/core.js b/source/core.js index 300c2ca..0765828 100755 --- a/source/core.js +++ b/source/core.js @@ -6,15 +6,15 @@ var Liquid = { readTemplateFile: function(path) { throw ("This liquid context does not allow includes."); }, - + registerFilters: function(filters) { Liquid.Template.registerFilter(filters); }, - + parse: function(src) { return Liquid.Template.parse(src); } - + }; //= require "extensions" @@ -31,8 +31,9 @@ var Liquid = { //= require "default_tags" //= require "default_filters" - -//= require +if (typeof window !== 'undefined') { + //= require +} //= require if (typeof exports !== 'undefined') { From 713691acbfbf63deb86aa96bce2f9912c925d544 Mon Sep 17 00:00:00 2001 From: Tom Blanchard Date: Mon, 16 Nov 2015 18:30:42 +0100 Subject: [PATCH 2/2] Only use strftime if in browser environment --- dist/liquid.js | 3 ++- dist/liquid.min.js | 2 +- dist/liquid.ymin.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dist/liquid.js b/dist/liquid.js index ce277aa..f3f4aef 100644 --- a/dist/liquid.js +++ b/dist/liquid.js @@ -1422,12 +1422,13 @@ Liquid.Template.registerFilter({ }); - +if (typeof window !== 'undefined') { if(!(new Date()).strftime) {(function(){ Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof (r)=="undefined"){r=10}for(;parseInt(x,10)1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"}; if(typeof JSON != 'undefined'){ Date.ext.locales['en-US'] = JSON.parse(JSON.stringify(Date.ext.locales.en)); } else { Date.ext.locales["en-US"]=Date.ext.locales.en;}; Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof (f)=="string"){return d[f]()}else{if(typeof (f)=="function"){return f.call(d,d)}else{if(typeof (f)=="object"&&typeof (f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str}; })();} +} /*! * Cross-Browser Split 1.1.1 * Copyright 2007-2012 Steven Levithan diff --git a/dist/liquid.min.js b/dist/liquid.min.js index 863fa8d..a2b8922 100644 --- a/dist/liquid.min.js +++ b/dist/liquid.min.js @@ -124,7 +124,7 @@ if(!(date instanceof Date)&&typeof(input)=='number'){date=new Date(input*1000);} if(!(date instanceof Date)&&typeof(input)=='string'){date=new Date(Date.parse(input));} if(!(date instanceof Date)){return input;} return date.strftime(format);},first:function(input){return input[0];},last:function(input){input=input;return input[input.length-1];},minus:function(input,number){return(Number(input)||0)-(Number(number)||0);},plus:function(input,number){return(Number(input)||0)+(Number(number)||0);},times:function(input,number){return(Number(input)||0)*(Number(number)||0);},divided_by:function(input,number){return(Number(input)||0)/(Number(number)||0);},modulo:function(input,number){return(Number(input)||0)%(Number(number)||0);},map:function(input,property){input=input||[];var results=[];for(var i=0;i<']|&(?!([a-zA-Z]+|(#\d+));)/g,function(chr){return self._HTML_ESCAPE_MAP[chr];});},remove:function(input,string){return input.toString().replace(new RegExp(string,'g'),'');},remove_first:function(input,string){return input.toString().replace(string,'');},prepend:function(input,string){return''+(string||'').toString()+(input||'').toString();},append:function(input,string){return''+(input||'').toString()+(string||'').toString();}});if(!(new Date()).strftime){(function(){Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof(r)=="undefined"){r=10}for(;parseInt(x,10)1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};if(typeof JSON!='undefined'){Date.ext.locales['en-US']=JSON.parse(JSON.stringify(Date.ext.locales.en));}else{Date.ext.locales["en-US"]=Date.ext.locales.en;};Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"")in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof(f)=="string"){return d[f]()}else{if(typeof(f)=="function"){return f.call(d,d)}else{if(typeof(f)=="object"&&typeof(f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str};})();} +return results;},escape_once:function(input){var self=this;return input.replace(/["><']|&(?!([a-zA-Z]+|(#\d+));)/g,function(chr){return self._HTML_ESCAPE_MAP[chr];});},remove:function(input,string){return input.toString().replace(new RegExp(string,'g'),'');},remove_first:function(input,string){return input.toString().replace(string,'');},prepend:function(input,string){return''+(string||'').toString()+(input||'').toString();},append:function(input,string){return''+(input||'').toString()+(string||'').toString();}});if(typeof window!=='undefined'){if(!(new Date()).strftime){(function(){Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof(r)=="undefined"){r=10}for(;parseInt(x,10)1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};if(typeof JSON!='undefined'){Date.ext.locales['en-US']=JSON.parse(JSON.stringify(Date.ext.locales.en));}else{Date.ext.locales["en-US"]=Date.ext.locales.en;};Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"")in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof(f)=="string"){return d[f]()}else{if(typeof(f)=="function"){return f.call(d,d)}else{if(typeof(f)=="object"&&typeof(f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str};})();}} var split;split=split||function(undef){var nativeSplit=String.prototype.split,compliantExecNpcg=/()??/.exec("")[1]===undef,self;self=function(str,separator,limit){if(Object.prototype.toString.call(separator)!=="[object RegExp]"){return nativeSplit.call(str,separator,limit);} var output=[],flags=(separator.ignoreCase?"i":"")+ (separator.multiline?"m":"")+ diff --git a/dist/liquid.ymin.js b/dist/liquid.ymin.js index fcc03f5..0c27b1f 100644 --- a/dist/liquid.ymin.js +++ b/dist/liquid.ymin.js @@ -1,4 +1,4 @@ -var Liquid={author:"Matt McCray ",version:"1.3.2",readTemplateFile:function(a){throw ("This liquid context does not allow includes.")},registerFilters:function(a){Liquid.Template.registerFilter(a)},parse:function(a){return Liquid.Template.parse(a)}};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(b){for(var a=0;a=0;for(var c=0;c"}});Liquid.Condition.operators={"==":function(a,b){return(a==b)},"=":function(a,b){return(a==b)},"!=":function(a,b){return(a!=b)},"<>":function(a,b){return(a!=b)},"<":function(a,b){return(a":function(a,b){return(a>b)},"<=":function(a,b){return(a<=b)},">=":function(a,b){return(a>=b)},contains:function(a,b){if(Object.prototype.toString.call(a)==="[object Array]"){return a.indexOf(b)>=0}else{return a.match(b)}},hasKey:function(a,b){return Liquid.extensions.object.hasKey.call(a,b)},hasValue:function(a,b){return Liquid.extensions.object.hasValue.call(a,b)}};Liquid.ElseCondition=Liquid.Condition.extend({isElse:true,evaluate:function(a){return true},toString:function(){return""}});Liquid.Drop=Liquid.Class.extend({setContext:function(a){this.context=a},beforeMethod:function(a){},invokeDrop:function(b){var a=this.beforeMethod();if(!a&&(b in this)){a=this[b].apply(this)}return a},hasKey:function(a){return true}});var hackObjectEach=function(a){if(typeof a!="function"){throw"Object.each requires first argument to be a function"}var c=0;var b=arguments[1];for(var e in this){var d=this[e],f=[e,d];f.key=e;f.value=d;a.call(b,f,c,this);c++}return null};Liquid.Template.registerTag("assign",Liquid.Tag.extend({tagSyntax:/((?:\(?[\w\-\.\[\]]\)?)+)\s*=\s*(.+)/,init:function(b,a,d){var c=a.match(this.tagSyntax);if(c){this.to=c[1];this.from=c[2]}else{throw ("Syntax error in 'assign' - Valid syntax: assign [var] = [source]")}this._super(b,a,d)},render:function(a){var b=new Liquid.Variable(this.from);a.scopes.last()[this.to.toString()]=b.render(a);return""}}));Liquid.Template.registerTag("cache",Liquid.Block.extend({tagSyntax:/(\w+)/,init:function(b,a,d){var c=a.match(this.tagSyntax);if(c){this.to=c[1]}else{throw ("Syntax error in 'cache' - Valid syntax: cache [var]")}this._super(b,a,d)},render:function(b){var a=this._super(b);b.scopes.last()[this.to]=[a].flatten().join("");return""}}));Liquid.Template.registerTag("capture",Liquid.Block.extend({tagSyntax:/(\w+)/,init:function(b,a,d){var c=a.match(this.tagSyntax);if(c){this.to=c[1]}else{throw ("Syntax error in 'capture' - Valid syntax: capture [var]")}this._super(b,a,d)},render:function(b){var a=this._super(b);b.scopes.last()[this.to.toString()]=[a].flatten().join("");return""}}));Liquid.Template.registerTag("case",Liquid.Block.extend({tagSyntax:/("[^"]+"|'[^']+'|[^\s,|]+)/,tagWhenSyntax:/("[^"]+"|'[^']+'|[^\s,|]+)(?:(?:\s+or\s+|\s*\,\s*)("[^"]+"|'[^']+'|[^\s,|]+.*))?/,init:function(b,a,d){this.blocks=[];this.nodelist=[];var c=a.match(this.tagSyntax);if(c){this.left=c[1]}else{throw ("Syntax error in 'case' - Valid syntax: case [condition]")}this._super(b,a,d)},unknownTag:function(a,b,c){switch(a){case"when":this.recordWhenCondition(b);break;case"else":this.recordElseCondition(b);break;default:this._super(a,b,c)}},render:function(c){var b=this,a=[],d=true;c.stack(function(){for(var e=0;ea-z_]+)?\s*("[^"]+"|'[^']+'|[^\s,|]+)?/,init:function(a,b,c){this.nodelist=[];this.blocks=[];this.pushBlock("if",b);this._super(a,b,c)},unknownTag:function(a,b,c){if(["elsif","else"].include(a)){this.pushBlock(a,b)}else{this._super(a,b,c)}},render:function(c){var b=this,a="";c.stack(function(){for(var d=0;d0){var b=f.shift(),e=f.shift().match(this.tagSyntax);if(!e){throw ("Syntax Error in tag '"+a+"' - Valid syntax: "+a+" [expression]")}var d=new Liquid.Condition(e[1],e[2],e[3]);d[b](h);h=d}g=h}g.attach([]);this.blocks.push(g);this.nodelist=g.attachment}}));Liquid.Template.registerTag("ifchanged",Liquid.Block.extend({render:function(c){var b=this,a="";c.stack(function(){var d=b.renderAll(b.nodelist,c).join("");if(d!=c.registers.ifchanged){a=d;c.registers.ifchanged=a}});return a}}));Liquid.Template.registerTag("include",Liquid.Tag.extend({tagSyntax:/((?:"[^"]+"|'[^']+'|[^\s,|]+)+)(\s+(?:with|for)\s+((?:"[^"]+"|'[^']+'|[^\s,|]+)+))?/,init:function(a,b,e){var d=(b||"").match(this.tagSyntax);if(d){this.templateName=d[1];this.templateNameVar=this.templateName.substring(1,this.templateName.length-1);this.variableName=d[3];this.attributes={};var c=b.match(/(\w*?)\s*\:\s*("[^"]+"|'[^']+'|[^\s,|]+)/g);if(c){c.each(function(f){f=f.split(":");this.attributes[f[0].strip()]=f[1].strip()},this)}}else{throw ("Error in tag 'include' - Valid syntax: include '[template]' (with|for) [object|collection]")}this._super(a,b,e)},render:function(e){var c=this,f=Liquid.readTemplateFile(e.get(this.templateName)),b=Liquid.parse(f),d=e.get((this.variableName||this.templateNameVar)),a="";e.stack(function(){c.attributes.each=hackObjectEach;c.attributes.each(function(g){e.set(g.key,e.get(g.value))});if(d instanceof Array){a=d.map(function(g){e.set(c.templateNameVar,g);return b.render(e)})}else{e.set(c.templateNameVar,d);a=b.render(e)}});a=[a].flatten().join("");return a}}));Liquid.Template.registerTag("unless",Liquid.Template.tags["if"].extend({render:function(c){var b=this,a="";c.stack(function(){var e=b.blocks[0];if(!e.evaluate(c)){a=b.renderAll(e.attachment,c);return}for(var d=1;d":">","<":"<",'"':""","'":"'"},size:function(a){return(a.length)?a.length:0},downcase:function(a){return a.toString().toLowerCase()},upcase:function(a){return a.toString().toUpperCase()},capitalize:function(a){return a.toString().capitalize()},escape:function(b){var a=this;return b.replace(/[&<>"']/g,function(c){return a._HTML_ESCAPE_MAP[c]})},h:function(b){var a=this;return b.replace(/[&<>"']/g,function(c){return a._HTML_ESCAPE_MAP[c]})},truncate:function(b,d,c){if(!b||b==""){return""}d=d||50;c=c||"...";var a=b.slice(0,d);return(b.length>d?b.slice(0,d)+c:b)},truncatewords:function(b,e,c){if(!b||b==""){return""}e=parseInt(e||15);c=c||"...";var d=b.toString().split(" "),a=Math.max((e),0);return(d.length>a)?d.slice(0,a).join(" ")+c:b},truncate_words:function(b,e,c){if(!b||b==""){return""}e=parseInt(e||15);c=c||"...";var d=b.toString().split(" "),a=Math.max((e),0);return(d.length>a)?d.slice(0,a).join(" ")+c:b},strip_html:function(a){return a.toString().replace(/<.*?>/g,"")},strip_newlines:function(a){return a.toString().replace(/\n/g,"")},join:function(a,b){b=b||" ";return a.join(b)},split:function(a,b){b=b||" ";return a.split(b)},sort:function(a){return a.sort()},reverse:function(a){return a.reverse()},replace:function(a,b,c){c=c||"";return a.toString().replace(new RegExp(b,"g"),c)},replace_first:function(a,b,c){c=c||"";return a.toString().replace(new RegExp(b,""),c)},newline_to_br:function(a){return a.toString().replace(/\n/g,"
\n")},date:function(a,c){var b;if(a instanceof Date){b=a}if(!(b instanceof Date)&&a=="now"){b=new Date()}if(!(b instanceof Date)&&typeof(a)=="number"){b=new Date(a*1000)}if(!(b instanceof Date)&&typeof(a)=="string"){b=new Date(Date.parse(a))}if(!(b instanceof Date)){return a}return b.strftime(c)},first:function(a){return a[0]},last:function(a){a=a;return a[a.length-1]},minus:function(a,b){return(Number(a)||0)-(Number(b)||0)},plus:function(a,b){return(Number(a)||0)+(Number(b)||0)},times:function(a,b){return(Number(a)||0)*(Number(b)||0)},divided_by:function(a,b){return(Number(a)||0)/(Number(b)||0)},modulo:function(a,b){return(Number(a)||0)%(Number(b)||0)},map:function(a,d){a=a||[];var c=[];for(var b=0;b<']|&(?!([a-zA-Z]+|(#\d+));)/g,function(c){return a._HTML_ESCAPE_MAP[c]})},remove:function(a,b){return a.toString().replace(new RegExp(b,"g"),"")},remove_first:function(a,b){return a.toString().replace(b,"")},prepend:function(a,b){return""+(b||"").toString()+(a||"").toString()},append:function(a,b){return""+(a||"").toString()+(b||"").toString()}});if(!(new Date()).strftime){(function(){Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(a,c,b){if(typeof(b)=="undefined"){b=10}for(;parseInt(a,10)1;b/=10){a=c.toString()+a}return a.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};if(typeof JSON!="undefined"){Date.ext.locales["en-US"]=JSON.parse(JSON.stringify(Date.ext.locales.en))}else{Date.ext.locales["en-US"]=Date.ext.locales.en}Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(a){return Date.ext.locales[a.locale].a[a.getDay()]},A:function(a){return Date.ext.locales[a.locale].A[a.getDay()]},b:function(a){return Date.ext.locales[a.locale].b[a.getMonth()]},B:function(a){return Date.ext.locales[a.locale].B[a.getMonth()]},c:"toLocaleString",C:function(a){return Date.ext.util.xPad(parseInt(a.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(a){return Date.ext.util.xPad(parseInt(Date.ext.util.G(a)/100,10),0)},G:function(c){var e=c.getFullYear();var b=parseInt(Date.ext.formats.V(c),10);var a=parseInt(Date.ext.formats.W(c),10);if(a>b){e++}else{if(a===0&&b>=52){e--}}return e},H:["getHours","0"],I:function(b){var a=b.getHours()%12;return Date.ext.util.xPad(a===0?12:a,0)},j:function(c){var a=c-new Date(""+c.getFullYear()+"/1/1 GMT");a+=c.getTimezoneOffset()*60000;var b=parseInt(a/60000/60/24,10)+1;return Date.ext.util.xPad(b,0,100)},m:function(a){return Date.ext.util.xPad(a.getMonth()+1,0)},M:["getMinutes","0"],p:function(a){return Date.ext.locales[a.locale].p[a.getHours()>=12?1:0]},P:function(a){return Date.ext.locales[a.locale].P[a.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(a){var b=a.getDay();return b===0?7:b},U:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=6-e.getDay();var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0)},V:function(e){var c=parseInt(Date.ext.formats.W(e),10);var a=(new Date(""+e.getFullYear()+"/1/1")).getDay();var b=c+(a>4||a<=1?0:1);if(b==53&&(new Date(""+e.getFullYear()+"/12/31")).getDay()<4){b=1}else{if(b===0){b=Date.ext.formats.V(new Date(""+(e.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(b,0)},w:"getDay",W:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=7-Date.ext.formats.u(e);var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0,10)},y:function(a){return Date.ext.util.xPad(a.getFullYear()%100,0)},Y:"getFullYear",z:function(c){var b=c.getTimezoneOffset();var a=Date.ext.util.xPad(parseInt(Math.abs(b/60),10),0);var e=Date.ext.util.xPad(b%60,0);return(b>0?"-":"+")+a+e},Z:function(a){return a.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(a){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(a){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var c=this;while(a.match(/%[cDhnrRtTxXzZ]/)){a=a.replace(/%([cDhnrRtTxXzZ])/g,function(e,d){var g=Date.ext.aggregates[d];return(g=="locale"?Date.ext.locales[c.locale][d]:g)})}var b=a.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(e,d){var g=Date.ext.formats[d];if(typeof(g)=="string"){return c[g]()}else{if(typeof(g)=="function"){return g.call(c,c)}else{if(typeof(g)=="object"&&typeof(g[0])=="string"){return Date.ext.util.xPad(c[g[0]](),g[1])}else{return d}}}});c=null;return b}})(); +var Liquid={author:"Matt McCray ",version:"1.3.2",readTemplateFile:function(a){throw ("This liquid context does not allow includes.")},registerFilters:function(a){Liquid.Template.registerFilter(a)},parse:function(a){return Liquid.Template.parse(a)}};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(b){for(var a=0;a=0;for(var c=0;c"}});Liquid.Condition.operators={"==":function(a,b){return(a==b)},"=":function(a,b){return(a==b)},"!=":function(a,b){return(a!=b)},"<>":function(a,b){return(a!=b)},"<":function(a,b){return(a":function(a,b){return(a>b)},"<=":function(a,b){return(a<=b)},">=":function(a,b){return(a>=b)},contains:function(a,b){if(Object.prototype.toString.call(a)==="[object Array]"){return a.indexOf(b)>=0}else{return a.match(b)}},hasKey:function(a,b){return Liquid.extensions.object.hasKey.call(a,b)},hasValue:function(a,b){return Liquid.extensions.object.hasValue.call(a,b)}};Liquid.ElseCondition=Liquid.Condition.extend({isElse:true,evaluate:function(a){return true},toString:function(){return""}});Liquid.Drop=Liquid.Class.extend({setContext:function(a){this.context=a},beforeMethod:function(a){},invokeDrop:function(b){var a=this.beforeMethod();if(!a&&(b in this)){a=this[b].apply(this)}return a},hasKey:function(a){return true}});var hackObjectEach=function(a){if(typeof a!="function"){throw"Object.each requires first argument to be a function"}var c=0;var b=arguments[1];for(var e in this){var d=this[e],f=[e,d];f.key=e;f.value=d;a.call(b,f,c,this);c++}return null};Liquid.Template.registerTag("assign",Liquid.Tag.extend({tagSyntax:/((?:\(?[\w\-\.\[\]]\)?)+)\s*=\s*(.+)/,init:function(b,a,d){var c=a.match(this.tagSyntax);if(c){this.to=c[1];this.from=c[2]}else{throw ("Syntax error in 'assign' - Valid syntax: assign [var] = [source]")}this._super(b,a,d)},render:function(a){var b=new Liquid.Variable(this.from);a.scopes.last()[this.to.toString()]=b.render(a);return""}}));Liquid.Template.registerTag("cache",Liquid.Block.extend({tagSyntax:/(\w+)/,init:function(b,a,d){var c=a.match(this.tagSyntax);if(c){this.to=c[1]}else{throw ("Syntax error in 'cache' - Valid syntax: cache [var]")}this._super(b,a,d)},render:function(b){var a=this._super(b);b.scopes.last()[this.to]=[a].flatten().join("");return""}}));Liquid.Template.registerTag("capture",Liquid.Block.extend({tagSyntax:/(\w+)/,init:function(b,a,d){var c=a.match(this.tagSyntax);if(c){this.to=c[1]}else{throw ("Syntax error in 'capture' - Valid syntax: capture [var]")}this._super(b,a,d)},render:function(b){var a=this._super(b);b.scopes.last()[this.to.toString()]=[a].flatten().join("");return""}}));Liquid.Template.registerTag("case",Liquid.Block.extend({tagSyntax:/("[^"]+"|'[^']+'|[^\s,|]+)/,tagWhenSyntax:/("[^"]+"|'[^']+'|[^\s,|]+)(?:(?:\s+or\s+|\s*\,\s*)("[^"]+"|'[^']+'|[^\s,|]+.*))?/,init:function(b,a,d){this.blocks=[];this.nodelist=[];var c=a.match(this.tagSyntax);if(c){this.left=c[1]}else{throw ("Syntax error in 'case' - Valid syntax: case [condition]")}this._super(b,a,d)},unknownTag:function(a,b,c){switch(a){case"when":this.recordWhenCondition(b);break;case"else":this.recordElseCondition(b);break;default:this._super(a,b,c)}},render:function(c){var b=this,a=[],d=true;c.stack(function(){for(var e=0;ea-z_]+)?\s*("[^"]+"|'[^']+'|[^\s,|]+)?/,init:function(a,b,c){this.nodelist=[];this.blocks=[];this.pushBlock("if",b);this._super(a,b,c)},unknownTag:function(a,b,c){if(["elsif","else"].include(a)){this.pushBlock(a,b)}else{this._super(a,b,c)}},render:function(c){var b=this,a="";c.stack(function(){for(var d=0;d0){var b=f.shift(),e=f.shift().match(this.tagSyntax);if(!e){throw ("Syntax Error in tag '"+a+"' - Valid syntax: "+a+" [expression]")}var d=new Liquid.Condition(e[1],e[2],e[3]);d[b](h);h=d}g=h}g.attach([]);this.blocks.push(g);this.nodelist=g.attachment}}));Liquid.Template.registerTag("ifchanged",Liquid.Block.extend({render:function(c){var b=this,a="";c.stack(function(){var d=b.renderAll(b.nodelist,c).join("");if(d!=c.registers.ifchanged){a=d;c.registers.ifchanged=a}});return a}}));Liquid.Template.registerTag("include",Liquid.Tag.extend({tagSyntax:/((?:"[^"]+"|'[^']+'|[^\s,|]+)+)(\s+(?:with|for)\s+((?:"[^"]+"|'[^']+'|[^\s,|]+)+))?/,init:function(a,b,e){var d=(b||"").match(this.tagSyntax);if(d){this.templateName=d[1];this.templateNameVar=this.templateName.substring(1,this.templateName.length-1);this.variableName=d[3];this.attributes={};var c=b.match(/(\w*?)\s*\:\s*("[^"]+"|'[^']+'|[^\s,|]+)/g);if(c){c.each(function(f){f=f.split(":");this.attributes[f[0].strip()]=f[1].strip()},this)}}else{throw ("Error in tag 'include' - Valid syntax: include '[template]' (with|for) [object|collection]")}this._super(a,b,e)},render:function(e){var c=this,f=Liquid.readTemplateFile(e.get(this.templateName)),b=Liquid.parse(f),d=e.get((this.variableName||this.templateNameVar)),a="";e.stack(function(){c.attributes.each=hackObjectEach;c.attributes.each(function(g){e.set(g.key,e.get(g.value))});if(d instanceof Array){a=d.map(function(g){e.set(c.templateNameVar,g);return b.render(e)})}else{e.set(c.templateNameVar,d);a=b.render(e)}});a=[a].flatten().join("");return a}}));Liquid.Template.registerTag("unless",Liquid.Template.tags["if"].extend({render:function(c){var b=this,a="";c.stack(function(){var e=b.blocks[0];if(!e.evaluate(c)){a=b.renderAll(e.attachment,c);return}for(var d=1;d":">","<":"<",'"':""","'":"'"},size:function(a){return(a.length)?a.length:0},downcase:function(a){return a.toString().toLowerCase()},upcase:function(a){return a.toString().toUpperCase()},capitalize:function(a){return a.toString().capitalize()},escape:function(b){var a=this;return b.replace(/[&<>"']/g,function(c){return a._HTML_ESCAPE_MAP[c]})},h:function(b){var a=this;return b.replace(/[&<>"']/g,function(c){return a._HTML_ESCAPE_MAP[c]})},truncate:function(b,d,c){if(!b||b==""){return""}d=d||50;c=c||"...";var a=b.slice(0,d);return(b.length>d?b.slice(0,d)+c:b)},truncatewords:function(b,e,c){if(!b||b==""){return""}e=parseInt(e||15);c=c||"...";var d=b.toString().split(" "),a=Math.max((e),0);return(d.length>a)?d.slice(0,a).join(" ")+c:b},truncate_words:function(b,e,c){if(!b||b==""){return""}e=parseInt(e||15);c=c||"...";var d=b.toString().split(" "),a=Math.max((e),0);return(d.length>a)?d.slice(0,a).join(" ")+c:b},strip_html:function(a){return a.toString().replace(/<.*?>/g,"")},strip_newlines:function(a){return a.toString().replace(/\n/g,"")},join:function(a,b){b=b||" ";return a.join(b)},split:function(a,b){b=b||" ";return a.split(b)},sort:function(a){return a.sort()},reverse:function(a){return a.reverse()},replace:function(a,b,c){c=c||"";return a.toString().replace(new RegExp(b,"g"),c)},replace_first:function(a,b,c){c=c||"";return a.toString().replace(new RegExp(b,""),c)},newline_to_br:function(a){return a.toString().replace(/\n/g,"
\n")},date:function(a,c){var b;if(a instanceof Date){b=a}if(!(b instanceof Date)&&a=="now"){b=new Date()}if(!(b instanceof Date)&&typeof(a)=="number"){b=new Date(a*1000)}if(!(b instanceof Date)&&typeof(a)=="string"){b=new Date(Date.parse(a))}if(!(b instanceof Date)){return a}return b.strftime(c)},first:function(a){return a[0]},last:function(a){a=a;return a[a.length-1]},minus:function(a,b){return(Number(a)||0)-(Number(b)||0)},plus:function(a,b){return(Number(a)||0)+(Number(b)||0)},times:function(a,b){return(Number(a)||0)*(Number(b)||0)},divided_by:function(a,b){return(Number(a)||0)/(Number(b)||0)},modulo:function(a,b){return(Number(a)||0)%(Number(b)||0)},map:function(a,d){a=a||[];var c=[];for(var b=0;b<']|&(?!([a-zA-Z]+|(#\d+));)/g,function(c){return a._HTML_ESCAPE_MAP[c]})},remove:function(a,b){return a.toString().replace(new RegExp(b,"g"),"")},remove_first:function(a,b){return a.toString().replace(b,"")},prepend:function(a,b){return""+(b||"").toString()+(a||"").toString()},append:function(a,b){return""+(a||"").toString()+(b||"").toString()}});if(typeof window!=="undefined"){if(!(new Date()).strftime){(function(){Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(a,c,b){if(typeof(b)=="undefined"){b=10}for(;parseInt(a,10)1;b/=10){a=c.toString()+a}return a.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};if(typeof JSON!="undefined"){Date.ext.locales["en-US"]=JSON.parse(JSON.stringify(Date.ext.locales.en))}else{Date.ext.locales["en-US"]=Date.ext.locales.en}Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(a){return Date.ext.locales[a.locale].a[a.getDay()]},A:function(a){return Date.ext.locales[a.locale].A[a.getDay()]},b:function(a){return Date.ext.locales[a.locale].b[a.getMonth()]},B:function(a){return Date.ext.locales[a.locale].B[a.getMonth()]},c:"toLocaleString",C:function(a){return Date.ext.util.xPad(parseInt(a.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(a){return Date.ext.util.xPad(parseInt(Date.ext.util.G(a)/100,10),0)},G:function(c){var e=c.getFullYear();var b=parseInt(Date.ext.formats.V(c),10);var a=parseInt(Date.ext.formats.W(c),10);if(a>b){e++}else{if(a===0&&b>=52){e--}}return e},H:["getHours","0"],I:function(b){var a=b.getHours()%12;return Date.ext.util.xPad(a===0?12:a,0)},j:function(c){var a=c-new Date(""+c.getFullYear()+"/1/1 GMT");a+=c.getTimezoneOffset()*60000;var b=parseInt(a/60000/60/24,10)+1;return Date.ext.util.xPad(b,0,100)},m:function(a){return Date.ext.util.xPad(a.getMonth()+1,0)},M:["getMinutes","0"],p:function(a){return Date.ext.locales[a.locale].p[a.getHours()>=12?1:0]},P:function(a){return Date.ext.locales[a.locale].P[a.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(a){var b=a.getDay();return b===0?7:b},U:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=6-e.getDay();var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0)},V:function(e){var c=parseInt(Date.ext.formats.W(e),10);var a=(new Date(""+e.getFullYear()+"/1/1")).getDay();var b=c+(a>4||a<=1?0:1);if(b==53&&(new Date(""+e.getFullYear()+"/12/31")).getDay()<4){b=1}else{if(b===0){b=Date.ext.formats.V(new Date(""+(e.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(b,0)},w:"getDay",W:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=7-Date.ext.formats.u(e);var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0,10)},y:function(a){return Date.ext.util.xPad(a.getFullYear()%100,0)},Y:"getFullYear",z:function(c){var b=c.getTimezoneOffset();var a=Date.ext.util.xPad(parseInt(Math.abs(b/60),10),0);var e=Date.ext.util.xPad(b%60,0);return(b>0?"-":"+")+a+e},Z:function(a){return a.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(a){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(a){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var c=this;while(a.match(/%[cDhnrRtTxXzZ]/)){a=a.replace(/%([cDhnrRtTxXzZ])/g,function(e,d){var g=Date.ext.aggregates[d];return(g=="locale"?Date.ext.locales[c.locale][d]:g)})}var b=a.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(e,d){var g=Date.ext.formats[d];if(typeof(g)=="string"){return c[g]()}else{if(typeof(g)=="function"){return g.call(c,c)}else{if(typeof(g)=="object"&&typeof(g[0])=="string"){return Date.ext.util.xPad(c[g[0]](),g[1])}else{return d}}}});c=null;return b}})()} /*! * Cross-Browser Split 1.1.1 * Copyright 2007-2012 Steven Levithan