From ccbfae1249dfff64f50c10653824f9d76018e7c1 Mon Sep 17 00:00:00 2001 From: Matt Karl Date: Wed, 26 Mar 2014 18:06:08 -0400 Subject: [PATCH] Less strict dependency versions --- bower.json | 8 ++++---- build.properties | 2 +- lib/canteen.debug.js | 2 +- lib/canteen.js | 2 +- lib/canteen.min.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bower.json b/bower.json index d86edbb..93db65c 100644 --- a/bower.json +++ b/bower.json @@ -1,14 +1,14 @@ { "name": "canteen", - "version": "1.1.2", + "version": "1.1.3", "main": "lib/canteen.min.js", "dependencies": { "cloudkid-debug": "*", "cloudkid-namespace": "*", "jquery": "~1", - "history.js": "~1.8", - "touchclick": "~1.1", - "jquery-form": "~3.45" + "history.js": "*", + "touchclick": "*", + "jquery-form": "~3" }, "ignore": [ ".gitignore", diff --git a/build.properties b/build.properties index 86763a7..8e5edef 100644 --- a/build.properties +++ b/build.properties @@ -18,7 +18,7 @@ git.master=master compressor=uglifyjs js.validator=jshint -version=1.1.2 +version=1.1.3 output.name=canteen output.min=${build.dir}/${output.name}.min.js diff --git a/lib/canteen.debug.js b/lib/canteen.debug.js index c0ae579..348b499 100644 --- a/lib/canteen.debug.js +++ b/lib/canteen.debug.js @@ -202,7 +202,7 @@ }; p.gateway = null, p.parameters = null, p.options = {}, Site.ENTER = "enter", Site.EXIT = "exit", Site.READY = "ready", Site.LOADING = "loading", Site.LOADING_DONE = "loadingDone", - Site.VERSION = "1.1.2", p.initialize = function() { + Site.VERSION = "1.1.3", p.initialize = function() { if (_instance) throw "Site has already been created. Use Canteen.Site.instance"; _instance = this; var opts = this.options = _defaultOptions; diff --git a/lib/canteen.js b/lib/canteen.js index bf392a1..77f5b45 100644 --- a/lib/canteen.js +++ b/lib/canteen.js @@ -1226,7 +1226,7 @@ * @property {String} VERSION * @readOnly */ - Site.VERSION = "1.1.2"; + Site.VERSION = "1.1.3"; /** * Constructor for the site diff --git a/lib/canteen.min.js b/lib/canteen.min.js index 0c56ecc..c621947 100644 --- a/lib/canteen.min.js +++ b/lib/canteen.min.js @@ -1 +1 @@ -!function(){"use strict";Function.prototype.bind||(Function.prototype.bind=function(t){var e,n,r=this;if("function"!=typeof r)throw new TypeError;return e=Array.prototype.slice.call(arguments,1),n=function(){if(this instanceof n){var i,a,o;return i=function(){},i.prototype=r.prototype,a=new i,o=r.apply(a,e.concat(Array.prototype.slice.call(arguments))),Object(o)===o?o:a}return r.apply(t,e.concat(Array.prototype.slice.call(arguments)))}})}(),function(t,e){"use strict";function n(t){return null===t?String(t):"object"==typeof t||"function"==typeof t?Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase()||"object":typeof t}var r=function(){},i=r.prototype;i._listeners=[],i.trigger=function(t,n){if(this._listeners[t]!==e)for(var r=this._listeners[t],i=0;io;o++)a=i[o],this._listeners[a]=this._listeners[a]||[],-1===this._callbackIndex(a,e)&&this._listeners[a].push(e);else if("array"===n(e))for(var u=0,l=e.length;l>u;u++)this.on(t,e[u]);return this},i.off=function(t,r){if(t===e)this._listeners=[];else if("array"===n(r))for(var i=0,a=r.length;a>i;i++)this.off(t,r[i]);else for(var o=t.split(" "),s=null,u=0,l=o.length;l>u;u++)if(s=o[u],this._listeners[s]=this._listeners[s]||[],r===e)this._listeners[s].length=0;else{var c=this._callbackIndex(s,r);-1!==c&&this._listeners[t].splice(c,1)}return this},i._callbackIndex=function(t,e){for(var n=0,r=this._listeners[t].length;r>n;n++)if(this._listeners[t][n]===e)return n;return-1},namespace("Canteen").EventDispatcher=r}(window),$.fn.touch=function(t){return this.on("click",!1).on("touchclick",t)},$.fn.untouch=function(){return this.off("touchclick")},$.fn.internalLink=function(t){var e=Canteen.settings.basePath,n=Canteen.settings.siteIndex,r=t.currentState,i=function(t){if(t.hasClass("confirm")){var e=t.data("confirm")||"Are you sure you wish to continue?",n=confirm(e);return n}return!0};return this.each(function(){var a,o=$(this),s=o.data("refresh"),u=o.attr("href");if("undefined"!=typeof s)return o.untouch().touch(function(e){return i(o)?"soft"==s?(e.preventDefault(),t.refresh(),void 0):(u?document.location.href=u:t.refresh(!1),void 0):void 0}),void 0;if(u&&0===u.indexOf(e)){a=u.substr(e.length),o.untouch().touch(function(e){e.preventDefault(),i(o)&&t.redirect(a)}).removeClass("selected");var l=new RegExp("^"+a.replace("/","/")+"(/.*)?$");(a==r||""!==r&&l.test(r)||a==n&&""===r)&&o.addClass("selected")}})},function(){"use strict";var t=function(){},e=864e5;t.NEVER_EXPIRE="neverExpire",t.clear=function(e){t.write(e,"",-1)},t.write=function(n,r,i){var a,o;i?(i==t.NEVER_EXPIRE?o=new Date(2147483646e3):(o=new Date,o.setTime(o.getTime()+i*e)),a="; expires="+o.toGMTString()):a="",document.cookie=n+"="+r+a+"; path=/"},t.read=function(t){var e,n=t+"=",r=document.cookie.split(";"),i=0;for(i=0;in?"":e.substr(n+1),i=r.indexOf("#"),r=0>i?r:r.substring(0,i),a=r.split("&");for(s in a)o=a[s].split("="),t[o[0]]=o[1];return t},namespace("Canteen").LocationUtils=t}(),function(t){"use strict";var e=function(){};e.ERROR="error",e.DISABLED="disabled",e.SELECTED="selected",e.REQUIRED="required",e.CONFIRM="confirm",e.FEEDBACK_ERROR="formError",e.FEEDBACK_SUCCESS="formSuccess",e.destroy=function(){$("input."+e.CONFIRM+", button."+e.CONFIRM).untouch(),$("form").resetForm().off("submit"),$(":submit").untouch()},e.setup=function(n,r){for(var i=new Array("text","button","reset","submit","checkbox","image","radio","file","password","date"),a=function(t){var e=$(t.target).closest("form"),n=e.find(":submit").eq(0);13==t.keyCode&&n&&(t.stopImmediatePropagation(),t.preventDefault(),n.trigger("touchclick"))},o=0,s=i.length;s>o;o++)$("input[type='"+i[o]+"']").removeClass(i[o]).addClass(i[o]).keyup(a);$("input."+e.CONFIRM+", button."+e.CONFIRM).untouch().touch(function(t){var n=$(this).data(e.CONFIRM)||"Are you sure you wish to continue?",r=confirm(n);return r?void 0:(t.stopImmediatePropagation(),!1)}),$('input[name="formSession"]').remove();var u=function(t,r){var i=r.find("."+e.REQUIRED).removeClass(e.ERROR),a=i.filter(function(){return!this.value}).addClass(e.ERROR);if(a.length>0){var o=function(){$(this).removeClass(e.ERROR).off("keydown")};return a.untouch().on("touchclick focus keydown",o),!1}for(var s={},u=0,l=t.length;l>u;u++)s[t[u].name]=t[u].value;return s.form?!0:(n.refresh(!0,s),!1)},l=function(r,i,a,o){if(-1==r.search(/^{.*}$/))return Debug.error(r),void 0;if(r=JSON.parse(r),"fatalError"==r.type)return Debug.fatalError(r),void 0;var s=o.find('input[name="refresh"]'),u=s.data("async");return r.redirect!==t?(n.redirect(r.redirect,!1,!0,u),void 0):!r.ifError&&s.length&&"true"==s.val()?(n.refresh(u),void 0):(e.formFeedback(o,r.messages,r.ifError),void 0)},c={data:{async:!0},beforeSubmit:u,success:l};$(":submit").touch(function(t){this.name&&this.value&&(c.data={async:!0},c.data[this.name]=this.value);var e=$(this).closest("form");e.length>0&&(t.preventDefault(),e.ajaxSubmit(c))}),$("form").on("submit",function(t){t.preventDefault(),$(this).ajaxSubmit(c)})},e.formFeedback=function(t,n,r){$("ul."+e.FEEDBACK_ERROR+", ul."+e.FEEDBACK_SUCCESS).remove();for(var i=r?e.FEEDBACK_ERROR:e.FEEDBACK_SUCCESS,a='
    ',o=0,s=n.length;s>o;o++)a+="
  • "+n[o]+"
  • ";a+="
";var u=t.find("legend");u.length?u.after(a):t.prepend(a)},namespace("Canteen").Forms=e}(),function(t){"use strict";var e=function(t,e){this.initialize(t,e)},n=e.prototype;n.gatewayUrl=null,n.initialize=function(t,e){this.gatewayUrl=t,"/"!=t.charAt(t.length-1)&&(this.gatewayUrl+="/"),this.get(function(t){var n=null===t||"error"==t.type;if(n)throw"Couldn't connect to gateway";e(!n)},"time","get-server-time")},n.get=function(e,n,r,i){var a=this.gatewayUrl+n+"/"+r;i!==t&&(a+="/"+($.isArray(i)?i.join("/"):String(i))),$.get(a,function(t){if(!t||"null"==t)return e(null),void 0;if(-1==t.search(/^{.*}$/))return Debug.error(t),e(null),void 0;var n=JSON.parse(t);return"fatalError"==n.type?(Debug.fatalError(n),e(null),void 0):(e(n),void 0)})},n.destroy=function(){n=null},namespace("Canteen").Gateway=e}(),function(){"use strict";var t=function(){},e=t.prototype;e.site=null,e.active=!1,e.uri=null,e.enter=function(){},e.exit=function(){},e.refresh=function(){return!0},e.resize=function(){},namespace("Canteen").Page=t}(),function(t,e,n){"use strict";var r=Canteen.EventDispatcher,i=Canteen.LocationUtils,a=Canteen.Gateway,o=Canteen.Forms,s=Canteen.Page,u=function(){this.initialize()},l=u.prototype=new r,c=null,f=null,d=null,h=null,g=[],p=null,v={contentId:"#content",pageTitleId:"h1",pageLoadingId:"article",siteLoadingId:"body",loadingClass:"loading"};l.gateway=null,l.parameters=null,l.options={},u.ENTER="enter",u.EXIT="exit",u.READY="ready",u.LOADING="loading",u.LOADING_DONE="loadingDone",u.VERSION="1.1.2",l.initialize=function(){if(c)throw"Site has already been created. Use Canteen.Site.instance";c=this;var t=this.options=v;(Canteen.settings.clientEnabled===n||Canteen.settings.clientEnabled)&&(e(t.siteLoadingId).addClass(t.loadingClass),this.parameters=i.getParameters(),Debug.enabled=Canteen.settings.debug,d=1,h=Canteen.settings.uriRequest,this._enableHistory(!0),this._fixInternalLinks(),this.gateway=new a(Canteen.settings.gatewayPath,this._gatewayReady.bind(this)))},l._enableHistory=function(n){e(t).off("statechange"),n&&e(t).on("statechange",this._onStateChange.bind(this))},l.redirect=function(t,r,i,a){var o=Canteen.settings.basePath,s=e("
").html(e("title").html()).text();return r=r===n?!1:r,i=i===n?!1:i,a=a===n?!0:a,Canteen.settings.siteIndex!=t&&(o+=t),h==t?(i&&this.refresh(a),void 0):(r?History.replaceState({state:d},s,o):(d++,History.pushState({state:d},s,o)),void 0)},Object.defineProperty(u,"instance",{get:function(){return c}}),Object.defineProperty(l,"currentState",{get:function(){return h}}),Object.defineProperty(l,"currentPage",{get:function(){return p}}),l.refresh=function(t,e){t=t===n?!0:t,t?this._updatePageContent(h,e):document.location.reload(!0)},l._fixInternalLinks=function(){e("a").internalLink(this),o.setup(this,"true"===this.parameters.debugForms)},l._onStateChange=function(){var t=History.getState(),e=t.url.split(Canteen.settings.baseUrl)[1];h!=e&&this._updatePageContent(e)},l._gatewayReady=function(t){t||Debug.error("Unable to setup gateway.");var n=this.options;e(n.siteLoadingId).removeClass(n.loadingClass),e(window).on("resize",this.resize.bind(this)),this.resize(),this.trigger(u.READY),this._enterPage()},l.resize=function(){p&&p.active&&p.resize()},l.addPage=function(t,e){e instanceof s?(e.site=this,g.push({uri:t,content:e})):Debug.warn("The page your trying to add needs to extend Canteen.Page")},l._enterPage=function(){var t=this.getPageByUri(h);t&&(p=t.content,p.uri=h,p.active=!0,p.enter(),this.resize()),this.trigger(u.ENTER,h)},l.getPageByUri=function(t){var e=g.length,n=0,r=null;if(0===e)return null;for(n=0;e>n;n++)if(r=g[n],r.uri===t||r.uri instanceof RegExp&&r.uri.test(t))return r;return null},l._updatePageContent=function(t,r){var i=this,a=this.options,s=this.getPageByUri(t),l=Canteen.settings.baseUrl+t;return this.trigger(u.EXIT,h),h=t,s&&s.content===p&&!s.content.refresh(t)?(s.content.uri=t,void 0):(p&&(p.exit(),p.active=!1,p=null),o.destroy(),f=t,r=r===n?{}:r,r.async=!0,this.trigger(u.LOADING),e(a.pageLoadingId).removeClass(a.loadingClass).addClass(a.loadingClass),e.post(l,r,function(r){if(t==f){if(f=null,i.trigger(u.LOADING_DONE),e(a.pageLoadingId).removeClass(a.loadingClass),!r||"null"==r)return Debug.error("No data for "+t),void 0;if(-1==r.search(/^{.*}$/))return Debug.error(r),void 0;var o=JSON.parse(r);if("fatalError"==o.type)return Debug.fatalError(o),void 0;if(o.redirect!==n)return i.redirect(o.redirect,!0),void 0;e("body").attr("id",o.pageId),e(a.pageTitleId).html(o.title),e(a.contentId).html(o.content),document.title=e("
").html(o.fullTitle).text(),e("meta[name='keywords']").attr("content",o.keywords),e("meta[name='description']").attr("content",o.description),i._fixInternalLinks(),i._enterPage()}}),void 0)},namespace("Canteen").Site=u,e(function(){new u})}(window,jQuery); \ No newline at end of file +!function(){"use strict";Function.prototype.bind||(Function.prototype.bind=function(t){var e,n,r=this;if("function"!=typeof r)throw new TypeError;return e=Array.prototype.slice.call(arguments,1),n=function(){if(this instanceof n){var i,a,o;return i=function(){},i.prototype=r.prototype,a=new i,o=r.apply(a,e.concat(Array.prototype.slice.call(arguments))),Object(o)===o?o:a}return r.apply(t,e.concat(Array.prototype.slice.call(arguments)))}})}(),function(t,e){"use strict";function n(t){return null===t?String(t):"object"==typeof t||"function"==typeof t?Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase()||"object":typeof t}var r=function(){},i=r.prototype;i._listeners=[],i.trigger=function(t,n){if(this._listeners[t]!==e)for(var r=this._listeners[t],i=0;io;o++)a=i[o],this._listeners[a]=this._listeners[a]||[],-1===this._callbackIndex(a,e)&&this._listeners[a].push(e);else if("array"===n(e))for(var u=0,l=e.length;l>u;u++)this.on(t,e[u]);return this},i.off=function(t,r){if(t===e)this._listeners=[];else if("array"===n(r))for(var i=0,a=r.length;a>i;i++)this.off(t,r[i]);else for(var o=t.split(" "),s=null,u=0,l=o.length;l>u;u++)if(s=o[u],this._listeners[s]=this._listeners[s]||[],r===e)this._listeners[s].length=0;else{var c=this._callbackIndex(s,r);-1!==c&&this._listeners[t].splice(c,1)}return this},i._callbackIndex=function(t,e){for(var n=0,r=this._listeners[t].length;r>n;n++)if(this._listeners[t][n]===e)return n;return-1},namespace("Canteen").EventDispatcher=r}(window),$.fn.touch=function(t){return this.on("click",!1).on("touchclick",t)},$.fn.untouch=function(){return this.off("touchclick")},$.fn.internalLink=function(t){var e=Canteen.settings.basePath,n=Canteen.settings.siteIndex,r=t.currentState,i=function(t){if(t.hasClass("confirm")){var e=t.data("confirm")||"Are you sure you wish to continue?",n=confirm(e);return n}return!0};return this.each(function(){var a,o=$(this),s=o.data("refresh"),u=o.attr("href");if("undefined"!=typeof s)return o.untouch().touch(function(e){return i(o)?"soft"==s?(e.preventDefault(),t.refresh(),void 0):(u?document.location.href=u:t.refresh(!1),void 0):void 0}),void 0;if(u&&0===u.indexOf(e)){a=u.substr(e.length),o.untouch().touch(function(e){e.preventDefault(),i(o)&&t.redirect(a)}).removeClass("selected");var l=new RegExp("^"+a.replace("/","/")+"(/.*)?$");(a==r||""!==r&&l.test(r)||a==n&&""===r)&&o.addClass("selected")}})},function(){"use strict";var t=function(){},e=864e5;t.NEVER_EXPIRE="neverExpire",t.clear=function(e){t.write(e,"",-1)},t.write=function(n,r,i){var a,o;i?(i==t.NEVER_EXPIRE?o=new Date(2147483646e3):(o=new Date,o.setTime(o.getTime()+i*e)),a="; expires="+o.toGMTString()):a="",document.cookie=n+"="+r+a+"; path=/"},t.read=function(t){var e,n=t+"=",r=document.cookie.split(";"),i=0;for(i=0;in?"":e.substr(n+1),i=r.indexOf("#"),r=0>i?r:r.substring(0,i),a=r.split("&");for(s in a)o=a[s].split("="),t[o[0]]=o[1];return t},namespace("Canteen").LocationUtils=t}(),function(t){"use strict";var e=function(){};e.ERROR="error",e.DISABLED="disabled",e.SELECTED="selected",e.REQUIRED="required",e.CONFIRM="confirm",e.FEEDBACK_ERROR="formError",e.FEEDBACK_SUCCESS="formSuccess",e.destroy=function(){$("input."+e.CONFIRM+", button."+e.CONFIRM).untouch(),$("form").resetForm().off("submit"),$(":submit").untouch()},e.setup=function(n,r){for(var i=new Array("text","button","reset","submit","checkbox","image","radio","file","password","date"),a=function(t){var e=$(t.target).closest("form"),n=e.find(":submit").eq(0);13==t.keyCode&&n&&(t.stopImmediatePropagation(),t.preventDefault(),n.trigger("touchclick"))},o=0,s=i.length;s>o;o++)$("input[type='"+i[o]+"']").removeClass(i[o]).addClass(i[o]).keyup(a);$("input."+e.CONFIRM+", button."+e.CONFIRM).untouch().touch(function(t){var n=$(this).data(e.CONFIRM)||"Are you sure you wish to continue?",r=confirm(n);return r?void 0:(t.stopImmediatePropagation(),!1)}),$('input[name="formSession"]').remove();var u=function(t,r){var i=r.find("."+e.REQUIRED).removeClass(e.ERROR),a=i.filter(function(){return!this.value}).addClass(e.ERROR);if(a.length>0){var o=function(){$(this).removeClass(e.ERROR).off("keydown")};return a.untouch().on("touchclick focus keydown",o),!1}for(var s={},u=0,l=t.length;l>u;u++)s[t[u].name]=t[u].value;return s.form?!0:(n.refresh(!0,s),!1)},l=function(r,i,a,o){if(-1==r.search(/^{.*}$/))return Debug.error(r),void 0;if(r=JSON.parse(r),"fatalError"==r.type)return Debug.fatalError(r),void 0;var s=o.find('input[name="refresh"]'),u=s.data("async");return r.redirect!==t?(n.redirect(r.redirect,!1,!0,u),void 0):!r.ifError&&s.length&&"true"==s.val()?(n.refresh(u),void 0):(e.formFeedback(o,r.messages,r.ifError),void 0)},c={data:{async:!0},beforeSubmit:u,success:l};$(":submit").touch(function(t){this.name&&this.value&&(c.data={async:!0},c.data[this.name]=this.value);var e=$(this).closest("form");e.length>0&&(t.preventDefault(),e.ajaxSubmit(c))}),$("form").on("submit",function(t){t.preventDefault(),$(this).ajaxSubmit(c)})},e.formFeedback=function(t,n,r){$("ul."+e.FEEDBACK_ERROR+", ul."+e.FEEDBACK_SUCCESS).remove();for(var i=r?e.FEEDBACK_ERROR:e.FEEDBACK_SUCCESS,a='
    ',o=0,s=n.length;s>o;o++)a+="
  • "+n[o]+"
  • ";a+="
";var u=t.find("legend");u.length?u.after(a):t.prepend(a)},namespace("Canteen").Forms=e}(),function(t){"use strict";var e=function(t,e){this.initialize(t,e)},n=e.prototype;n.gatewayUrl=null,n.initialize=function(t,e){this.gatewayUrl=t,"/"!=t.charAt(t.length-1)&&(this.gatewayUrl+="/"),this.get(function(t){var n=null===t||"error"==t.type;if(n)throw"Couldn't connect to gateway";e(!n)},"time","get-server-time")},n.get=function(e,n,r,i){var a=this.gatewayUrl+n+"/"+r;i!==t&&(a+="/"+($.isArray(i)?i.join("/"):String(i))),$.get(a,function(t){if(!t||"null"==t)return e(null),void 0;if(-1==t.search(/^{.*}$/))return Debug.error(t),e(null),void 0;var n=JSON.parse(t);return"fatalError"==n.type?(Debug.fatalError(n),e(null),void 0):(e(n),void 0)})},n.destroy=function(){n=null},namespace("Canteen").Gateway=e}(),function(){"use strict";var t=function(){},e=t.prototype;e.site=null,e.active=!1,e.uri=null,e.enter=function(){},e.exit=function(){},e.refresh=function(){return!0},e.resize=function(){},namespace("Canteen").Page=t}(),function(t,e,n){"use strict";var r=Canteen.EventDispatcher,i=Canteen.LocationUtils,a=Canteen.Gateway,o=Canteen.Forms,s=Canteen.Page,u=function(){this.initialize()},l=u.prototype=new r,c=null,f=null,d=null,h=null,g=[],p=null,v={contentId:"#content",pageTitleId:"h1",pageLoadingId:"article",siteLoadingId:"body",loadingClass:"loading"};l.gateway=null,l.parameters=null,l.options={},u.ENTER="enter",u.EXIT="exit",u.READY="ready",u.LOADING="loading",u.LOADING_DONE="loadingDone",u.VERSION="1.1.3",l.initialize=function(){if(c)throw"Site has already been created. Use Canteen.Site.instance";c=this;var t=this.options=v;(Canteen.settings.clientEnabled===n||Canteen.settings.clientEnabled)&&(e(t.siteLoadingId).addClass(t.loadingClass),this.parameters=i.getParameters(),Debug.enabled=Canteen.settings.debug,d=1,h=Canteen.settings.uriRequest,this._enableHistory(!0),this._fixInternalLinks(),this.gateway=new a(Canteen.settings.gatewayPath,this._gatewayReady.bind(this)))},l._enableHistory=function(n){e(t).off("statechange"),n&&e(t).on("statechange",this._onStateChange.bind(this))},l.redirect=function(t,r,i,a){var o=Canteen.settings.basePath,s=e("
").html(e("title").html()).text();return r=r===n?!1:r,i=i===n?!1:i,a=a===n?!0:a,Canteen.settings.siteIndex!=t&&(o+=t),h==t?(i&&this.refresh(a),void 0):(r?History.replaceState({state:d},s,o):(d++,History.pushState({state:d},s,o)),void 0)},Object.defineProperty(u,"instance",{get:function(){return c}}),Object.defineProperty(l,"currentState",{get:function(){return h}}),Object.defineProperty(l,"currentPage",{get:function(){return p}}),l.refresh=function(t,e){t=t===n?!0:t,t?this._updatePageContent(h,e):document.location.reload(!0)},l._fixInternalLinks=function(){e("a").internalLink(this),o.setup(this,"true"===this.parameters.debugForms)},l._onStateChange=function(){var t=History.getState(),e=t.url.split(Canteen.settings.baseUrl)[1];h!=e&&this._updatePageContent(e)},l._gatewayReady=function(t){t||Debug.error("Unable to setup gateway.");var n=this.options;e(n.siteLoadingId).removeClass(n.loadingClass),e(window).on("resize",this.resize.bind(this)),this.resize(),this.trigger(u.READY),this._enterPage()},l.resize=function(){p&&p.active&&p.resize()},l.addPage=function(t,e){e instanceof s?(e.site=this,g.push({uri:t,content:e})):Debug.warn("The page your trying to add needs to extend Canteen.Page")},l._enterPage=function(){var t=this.getPageByUri(h);t&&(p=t.content,p.uri=h,p.active=!0,p.enter(),this.resize()),this.trigger(u.ENTER,h)},l.getPageByUri=function(t){var e=g.length,n=0,r=null;if(0===e)return null;for(n=0;e>n;n++)if(r=g[n],r.uri===t||r.uri instanceof RegExp&&r.uri.test(t))return r;return null},l._updatePageContent=function(t,r){var i=this,a=this.options,s=this.getPageByUri(t),l=Canteen.settings.baseUrl+t;return this.trigger(u.EXIT,h),h=t,s&&s.content===p&&!s.content.refresh(t)?(s.content.uri=t,void 0):(p&&(p.exit(),p.active=!1,p=null),o.destroy(),f=t,r=r===n?{}:r,r.async=!0,this.trigger(u.LOADING),e(a.pageLoadingId).removeClass(a.loadingClass).addClass(a.loadingClass),e.post(l,r,function(r){if(t==f){if(f=null,i.trigger(u.LOADING_DONE),e(a.pageLoadingId).removeClass(a.loadingClass),!r||"null"==r)return Debug.error("No data for "+t),void 0;if(-1==r.search(/^{.*}$/))return Debug.error(r),void 0;var o=JSON.parse(r);if("fatalError"==o.type)return Debug.fatalError(o),void 0;if(o.redirect!==n)return i.redirect(o.redirect,!0),void 0;e("body").attr("id",o.pageId),e(a.pageTitleId).html(o.title),e(a.contentId).html(o.content),document.title=e("
").html(o.fullTitle).text(),e("meta[name='keywords']").attr("content",o.keywords),e("meta[name='description']").attr("content",o.description),i._fixInternalLinks(),i._enterPage()}}),void 0)},namespace("Canteen").Site=u,e(function(){new u})}(window,jQuery); \ No newline at end of file