Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updating importing for Brunch importing compliance

  • Loading branch information...
commit 51504c79b0edd455ac03fd9cbd1aa4030c203e63 1 parent bdacb9e
@kmalakoff authored
View
2  knockback-page-navigator-panes.js
@@ -36,7 +36,7 @@ this.kb || (this.kb = kb || (kb = {}));
this.Backbone || (this.Backbone = this.kb.Backbone);
try {
- ko = typeof require !== 'undefined' ? require('knockout') : this.ko;
+ ko = !this.ko && (typeof require !== 'undefined') ? require('knockout') : this.ko;
} catch (e) {
({});
}
View
2  knockback-page-navigator-panes.min.js
@@ -3,4 +3,4 @@
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
-*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-panes",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","previousPage","activeUrl","loadPage","goBack","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.pane_navigator=new t.PaneNavigator(e,n)}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.pane_navigator.destroy(),this.pane_navigator=null},e.prototype.hasHistory=function(){return!this.pane_navigator.no_history},e.prototype.activePage=function(){return this.pane_navigator.activePane()},e.prototype.activeUrl=function(){var e;return(e=this.pane_navigator.activePane())?e.url:null},e.prototype.previousPage=function(){return this.pane_navigator.previousPane()},e.prototype.previousUrl=function(){var e;return(e=this.pane_navigator.previousPage())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),i=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),i?{transition:i}:null)},e.prototype.goBack=function(){var e,n;return n=t.popOverrideTransition(),this.pane_navigator.pop(),!(e=this.pane_navigator.activePane())||t.loadUrl(e.url),e},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r,i,s;s=window.location.hash;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if((i=this.previousPage())&&i.url===s)return this.goBack();if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorPanes=t.PageNavigatorPanes),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorPanes={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorPanes(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
+*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-panes",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","previousPage","activeUrl","loadPage","goBack","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.pane_navigator=new t.PaneNavigator(e,n)}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.pane_navigator.destroy(),this.pane_navigator=null},e.prototype.hasHistory=function(){return!this.pane_navigator.no_history},e.prototype.activePage=function(){return this.pane_navigator.activePane()},e.prototype.activeUrl=function(){var e;return(e=this.pane_navigator.activePane())?e.url:null},e.prototype.previousPage=function(){return this.pane_navigator.previousPane()},e.prototype.previousUrl=function(){var e;return(e=this.pane_navigator.previousPage())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),i=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),i?{transition:i}:null)},e.prototype.goBack=function(){var e,n;return n=t.popOverrideTransition(),this.pane_navigator.pop(),!(e=this.pane_navigator.activePane())||t.loadUrl(e.url),e},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r,i,s;s=window.location.hash;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if((i=this.previousPage())&&i.url===s)return this.goBack();if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorPanes=t.PageNavigatorPanes),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorPanes={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorPanes(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
View
2  knockback-page-navigator-simple.js
@@ -36,7 +36,7 @@ this.kb || (this.kb = kb || (kb = {}));
this.Backbone || (this.Backbone = this.kb.Backbone);
try {
- ko = typeof require !== 'undefined' ? require('knockout') : this.ko;
+ ko = !this.ko && (typeof require !== 'undefined') ? require('knockout') : this.ko;
} catch (e) {
({});
}
View
2  knockback-page-navigator-simple.min.js
@@ -3,4 +3,4 @@
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
-*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-simple",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorSimple=function(){function e(e,t){this.options=t!=null?t:{},e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","activeUrl","loadPage","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.active_page=n.observable()}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.active_page=null},e.prototype.hasHistory=function(){return!1},e.prototype.activePage=function(){return this.active_page()},e.prototype.activeUrl=function(){var e;return(e=this.active_page())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):((i=this.activePage())&&i.destroy(this.options),n=new t.Pane(e,window.location.hash),n.activate(this.el),this.active_page(n),n)},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorSimple=t.PageNavigatorSimple),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorSimple={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorSimple(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t})}).call(this);
+*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-simple",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorSimple=function(){function e(e,t){this.options=t!=null?t:{},e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","activeUrl","loadPage","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.active_page=n.observable()}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.active_page=null},e.prototype.hasHistory=function(){return!1},e.prototype.activePage=function(){return this.active_page()},e.prototype.activeUrl=function(){var e;return(e=this.active_page())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):((i=this.activePage())&&i.destroy(this.options),n=new t.Pane(e,window.location.hash),n.activate(this.el),this.active_page(n),n)},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorSimple=t.PageNavigatorSimple),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorSimple={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorSimple(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t})}).call(this);
View
2  knockback-pane-navigator.js
@@ -36,7 +36,7 @@ this.kb || (this.kb = kb || (kb = {}));
this.Backbone || (this.Backbone = this.kb.Backbone);
try {
- ko = typeof require !== 'undefined' ? require('knockout') : this.ko;
+ ko = !this.ko && (typeof require !== 'undefined') ? require('knockout') : this.ko;
} catch (e) {
({});
}
View
2  knockback-pane-navigator.min.js
@@ -3,4 +3,4 @@
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
-*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-pane-navigator",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
+*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-pane-navigator",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
View
2  packages/npm/knockback-page-navigator-panes.js
@@ -36,7 +36,7 @@ this.kb || (this.kb = kb || (kb = {}));
this.Backbone || (this.Backbone = this.kb.Backbone);
try {
- ko = typeof require !== 'undefined' ? require('knockout') : this.ko;
+ ko = !this.ko && (typeof require !== 'undefined') ? require('knockout') : this.ko;
} catch (e) {
({});
}
View
2  packages/npm/knockback-page-navigator-panes.min.js
@@ -3,4 +3,4 @@
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
-*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-panes",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","previousPage","activeUrl","loadPage","goBack","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.pane_navigator=new t.PaneNavigator(e,n)}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.pane_navigator.destroy(),this.pane_navigator=null},e.prototype.hasHistory=function(){return!this.pane_navigator.no_history},e.prototype.activePage=function(){return this.pane_navigator.activePane()},e.prototype.activeUrl=function(){var e;return(e=this.pane_navigator.activePane())?e.url:null},e.prototype.previousPage=function(){return this.pane_navigator.previousPane()},e.prototype.previousUrl=function(){var e;return(e=this.pane_navigator.previousPage())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),i=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),i?{transition:i}:null)},e.prototype.goBack=function(){var e,n;return n=t.popOverrideTransition(),this.pane_navigator.pop(),!(e=this.pane_navigator.activePane())||t.loadUrl(e.url),e},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r,i,s;s=window.location.hash;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if((i=this.previousPage())&&i.url===s)return this.goBack();if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorPanes=t.PageNavigatorPanes),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorPanes={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorPanes(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
+*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-panes",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","previousPage","activeUrl","loadPage","goBack","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.pane_navigator=new t.PaneNavigator(e,n)}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.pane_navigator.destroy(),this.pane_navigator=null},e.prototype.hasHistory=function(){return!this.pane_navigator.no_history},e.prototype.activePage=function(){return this.pane_navigator.activePane()},e.prototype.activeUrl=function(){var e;return(e=this.pane_navigator.activePane())?e.url:null},e.prototype.previousPage=function(){return this.pane_navigator.previousPane()},e.prototype.previousUrl=function(){var e;return(e=this.pane_navigator.previousPage())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),i=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),i?{transition:i}:null)},e.prototype.goBack=function(){var e,n;return n=t.popOverrideTransition(),this.pane_navigator.pop(),!(e=this.pane_navigator.activePane())||t.loadUrl(e.url),e},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r,i,s;s=window.location.hash;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if((i=this.previousPage())&&i.url===s)return this.goBack();if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorPanes=t.PageNavigatorPanes),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorPanes={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorPanes(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
View
2  packages/npm/knockback-page-navigator-simple.js
@@ -36,7 +36,7 @@ this.kb || (this.kb = kb || (kb = {}));
this.Backbone || (this.Backbone = this.kb.Backbone);
try {
- ko = typeof require !== 'undefined' ? require('knockout') : this.ko;
+ ko = !this.ko && (typeof require !== 'undefined') ? require('knockout') : this.ko;
} catch (e) {
({});
}
View
2  packages/npm/knockback-page-navigator-simple.min.js
@@ -3,4 +3,4 @@
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
-*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-simple",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorSimple=function(){function e(e,t){this.options=t!=null?t:{},e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","activeUrl","loadPage","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.active_page=n.observable()}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.active_page=null},e.prototype.hasHistory=function(){return!1},e.prototype.activePage=function(){return this.active_page()},e.prototype.activeUrl=function(){var e;return(e=this.active_page())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):((i=this.activePage())&&i.destroy(this.options),n=new t.Pane(e,window.location.hash),n.activate(this.el),this.active_page(n),n)},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorSimple=t.PageNavigatorSimple),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorSimple={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorSimple(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t})}).call(this);
+*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-simple",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorSimple=function(){function e(e,t){this.options=t!=null?t:{},e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","activeUrl","loadPage","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.active_page=n.observable()}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.active_page=null},e.prototype.hasHistory=function(){return!1},e.prototype.activePage=function(){return this.active_page()},e.prototype.activeUrl=function(){var e;return(e=this.active_page())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):((i=this.activePage())&&i.destroy(this.options),n=new t.Pane(e,window.location.hash),n.activate(this.el),this.active_page(n),n)},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorSimple=t.PageNavigatorSimple),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorSimple={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorSimple(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t})}).call(this);
View
2  packages/npm/knockback-pane-navigator.js
@@ -36,7 +36,7 @@ this.kb || (this.kb = kb || (kb = {}));
this.Backbone || (this.Backbone = this.kb.Backbone);
try {
- ko = typeof require !== 'undefined' ? require('knockout') : this.ko;
+ ko = !this.ko && (typeof require !== 'undefined') ? require('knockout') : this.ko;
} catch (e) {
({});
}
View
2  packages/npm/knockback-pane-navigator.min.js
@@ -3,4 +3,4 @@
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
-*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-pane-navigator",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
+*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-pane-navigator",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
View
2  packages/nuget/Content/Scripts/knockback-page-navigator-panes.js
@@ -36,7 +36,7 @@ this.kb || (this.kb = kb || (kb = {}));
this.Backbone || (this.Backbone = this.kb.Backbone);
try {
- ko = typeof require !== 'undefined' ? require('knockout') : this.ko;
+ ko = !this.ko && (typeof require !== 'undefined') ? require('knockout') : this.ko;
} catch (e) {
({});
}
View
2  packages/nuget/Content/Scripts/knockback-page-navigator-panes.min.js
@@ -3,4 +3,4 @@
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
-*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-panes",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","previousPage","activeUrl","loadPage","goBack","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.pane_navigator=new t.PaneNavigator(e,n)}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.pane_navigator.destroy(),this.pane_navigator=null},e.prototype.hasHistory=function(){return!this.pane_navigator.no_history},e.prototype.activePage=function(){return this.pane_navigator.activePane()},e.prototype.activeUrl=function(){var e;return(e=this.pane_navigator.activePane())?e.url:null},e.prototype.previousPage=function(){return this.pane_navigator.previousPane()},e.prototype.previousUrl=function(){var e;return(e=this.pane_navigator.previousPage())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),i=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),i?{transition:i}:null)},e.prototype.goBack=function(){var e,n;return n=t.popOverrideTransition(),this.pane_navigator.pop(),!(e=this.pane_navigator.activePane())||t.loadUrl(e.url),e},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r,i,s;s=window.location.hash;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if((i=this.previousPage())&&i.url===s)return this.goBack();if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorPanes=t.PageNavigatorPanes),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorPanes={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorPanes(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
+*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-panes",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","previousPage","activeUrl","loadPage","goBack","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.pane_navigator=new t.PaneNavigator(e,n)}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.pane_navigator.destroy(),this.pane_navigator=null},e.prototype.hasHistory=function(){return!this.pane_navigator.no_history},e.prototype.activePage=function(){return this.pane_navigator.activePane()},e.prototype.activeUrl=function(){var e;return(e=this.pane_navigator.activePane())?e.url:null},e.prototype.previousPage=function(){return this.pane_navigator.previousPane()},e.prototype.previousUrl=function(){var e;return(e=this.pane_navigator.previousPage())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),i=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),i?{transition:i}:null)},e.prototype.goBack=function(){var e,n;return n=t.popOverrideTransition(),this.pane_navigator.pop(),!(e=this.pane_navigator.activePane())||t.loadUrl(e.url),e},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r,i,s;s=window.location.hash;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if((i=this.previousPage())&&i.url===s)return this.goBack();if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorPanes=t.PageNavigatorPanes),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorPanes={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorPanes(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
View
2  packages/nuget/Content/Scripts/knockback-page-navigator-simple.js
@@ -36,7 +36,7 @@ this.kb || (this.kb = kb || (kb = {}));
this.Backbone || (this.Backbone = this.kb.Backbone);
try {
- ko = typeof require !== 'undefined' ? require('knockout') : this.ko;
+ ko = !this.ko && (typeof require !== 'undefined') ? require('knockout') : this.ko;
} catch (e) {
({});
}
View
2  packages/nuget/Content/Scripts/knockback-page-navigator-simple.min.js
@@ -3,4 +3,4 @@
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
-*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-simple",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorSimple=function(){function e(e,t){this.options=t!=null?t:{},e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","activeUrl","loadPage","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.active_page=n.observable()}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.active_page=null},e.prototype.hasHistory=function(){return!1},e.prototype.activePage=function(){return this.active_page()},e.prototype.activeUrl=function(){var e;return(e=this.active_page())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):((i=this.activePage())&&i.destroy(this.options),n=new t.Pane(e,window.location.hash),n.activate(this.el),this.active_page(n),n)},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorSimple=t.PageNavigatorSimple),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorSimple={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorSimple(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t})}).call(this);
+*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-page-navigator-simple",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorSimple=function(){function e(e,t){this.options=t!=null?t:{},e||r(this,"el"),s.bindAll(this,"hasHistory","activePage","activeUrl","loadPage","dispatcher"),this.el=e.length?e[0]:e,$(this.el).addClass("page"),this.active_page=n.observable()}return e.prototype.destroy=function(){return this.destroyed=!0,this.el=null,this.active_page=null},e.prototype.hasHistory=function(){return!1},e.prototype.activePage=function(){return this.active_page()},e.prototype.activeUrl=function(){var e;return(e=this.active_page())?e.url:null},e.prototype.loadPage=function(e){var n,i;return e||r(this,"page info"),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&this.el.appendChild(n.el),n):((i=this.activePage())&&i.destroy(this.options),n=new t.Pane(e,window.location.hash),n.activate(this.el),this.active_page(n),n)},e.prototype.dispatcher=function(e){var t;return t=this,function(){t.destroyed||t.routeTriggered(this,e,arguments)}},e.prototype.routeTriggered=function(e,t,n){var r;if((r=this.activePage())&&r.url===window.location.hash)return this.loadPage(r);if(t)return t.apply(e,n)},e}(),typeof exports!="undefined"&&(exports.PageNavigatorSimple=t.PageNavigatorSimple),n&&n.bindingHandlers&&(n.bindingHandlers.PageNavigatorSimple={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PageNavigatorSimple(e,o),t.utils.wrappedPageNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return typeof o.unloaded=="function"&&o.unloaded(u),t.utils.wrappedPageNavigator(e,null)}),typeof o.loaded=="function"?o.loaded(u):void 0}}),t.override_transitions=[],t.popOverrideTransition=function(){return t.override_transitions.length?t.override_transitions.pop():null},t.dispatchUrl=function(e){window.location.hash=e;if(window.Backbone&&window.Backbone.History.started)return window.Backbone.history.loadUrl(e);if(window.Path)return window.Path.dispatch(e)},t.loadUrl=function(e,n){return t.override_transitions.push(n),t.dispatchUrl(e)},t.loadUrlFn=function(e,n){return function(r,i){t.loadUrl(e,n),!r||!r.stopPropagation||(i=r);if(i&&i.stopPropagation)return i.stopPropagation(),i.preventDefault()}},t.utils||(t.utils={}),t.utils.wrappedPageNavigator=function(e,t){return arguments.length===1||e.__kb_page_navigator===t?e.__kb_page_navigator:(e.__kb_page_navigator&&e.__kb_page_navigator.destroy(),e.__kb_page_navigator=t,t)},t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t})}).call(this);
View
2  packages/nuget/Content/Scripts/knockback-pane-navigator.js
@@ -36,7 +36,7 @@ this.kb || (this.kb = kb || (kb = {}));
this.Backbone || (this.Backbone = this.kb.Backbone);
try {
- ko = typeof require !== 'undefined' ? require('knockout') : this.ko;
+ ko = !this.ko && (typeof require !== 'undefined') ? require('knockout') : this.ko;
} catch (e) {
({});
}
View
2  packages/nuget/Content/Scripts/knockback-pane-navigator.min.js
@@ -3,4 +3,4 @@
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
-*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-pane-navigator",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
+*/(function(){return function(e){return typeof define=="function"&&define.amd?define("knockback-pane-navigator",e):e.call(this)}(function(){var e,t,n,r,i,s;r=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is missing"},i=function(e,t){throw""+(s.isString(e)?e:e.constructor.name)+": "+t+" is unexpected"};try{this.kb=t=!this.kb&&typeof require!="undefined"?require("knockback"):this.kb}catch(o){({})}this.kb||(this.kb=t||(t={})),this.Backbone||(this.Backbone=this.kb.Backbone);try{n=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko}catch(o){({})}return n||(n={}),n.observable||(n.dataFor=function(e){return null},n.removeNode=function(e){return $(e).remove()},n.observable=function(e){var t;return t=e,function(e){return arguments.length?t=e:t}},n.observableArray=function(e){var t;return t=n.observable(arguments.length?e:[]),t.push=function(){return t().push.apply(t(),arguments)},t.pop=function(){return t().pop.apply(t(),arguments)},t}),s=this._?this._:t._?t._:{},s.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},s.bindAll=function(t,n){var r,i,s,o;o=Array.prototype.slice.call(arguments,1);for(i=0,s=o.length;i<s;i++)r=o[i],e(t,r)}),s.isElement||(s.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PaneNavigator=function(){function e(e,t){var i,s;e||r(this,"el");for(i in t)s=t[i],this[i]=s;this.panes=n.observableArray(),this.el=e&&e.length?e[0]:e,$(this.el).addClass("pane-navigator")}return e.prototype.destroy=function(){return this.el=null,this.clear({silent:!0})},e.prototype.clear=function(e){var t,n,r,i;e==null&&(e={}),this.cleanupTransition(!0),(t=this.activePane())&&t.destroy(this),n=this.panes(),i=n.slice(),i.pop(),n.splice(0,n.length);while(r=i.pop())r.el&&r.destroy(this);return e.silent||this.panes([]),this},e.prototype.activePane=function(){return this.paneAt(-1)},e.prototype.previousPane=function(){return this.paneAt(-2)},e.prototype.paneAt=function(e){var t,n;return n=this.panes(),t=e<0?n.length+e:e,t>=0&&t<n.length?n[t]:null},e.prototype.push=function(e,t){var n,r,i,o=this;t==null&&(t={});if(!e)return;return this.cleanupTransition(!0),"transition"in t&&(e.transition=t.transition),e.activate(this.el),t.silent?this.panes().push(e):this.panes.push(e),i=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(i)return o.no_history?(e=o.panes(),e.splice(s.indexOf(e,i),1),i.destroy(o)):i.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,i,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(i.activate(this.el),this.cleanupTransition(!0),t=this.activePane(),"transition"in e&&(t.transition=e.transition),this.panes.pop(),r=!1,n=function(){if(r)return;r=!0,s.cleanupTransition();if(t)return t.destroy(s)},t&&(t.transition||this.transition)?this.startTransition(t,i,n,!1):n(),i):null},e.prototype.startTransition=function(e,n,i,s){var o,u,a,f,l,c,h,p;if(!e)return;e.transition&&e.transition.options&&(l=e.transition.options.use_previous),l&&(h=[n,e],e=h[0],n=h[1],s=!s),f=e.transition?e.transition:this.transition;if(!f)return null;typeof f=="string"&&(f={name:f}),t.transistions[f.name]||r(this,"transition "+f.name),a={forward:s};for(u in f)c=f[u],a[u]=c;return a.inverse&&(p=[n,e],e=p[0],n=p[1],a.forward=!a.forward),delete a.inverse,e&&e.activate(this.el),n&&n.activate(this.el),o={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:i},this.active_transition={callback:i,transition:new t.transistions[f.name](o,a)},this.active_transition.transition.start()},e.prototype.cleanupTransition=function(e){var t;if(!this.active_transition)return;return t=this.active_transition,this.active_transition=null,e&&t.transition.cancel(),t.callback()},e}(),typeof exports!="undefined"&&(exports.PaneNavigator=t.PaneNavigator),t.transistions||(t.transistions={}),s.indexOf||(s.indexOf=function(e,t){var n,r;for(n in e){r=e[n];if(r===t)return n}return-1}),t.utils||(t.utils={}),t.utils.wrappedPaneNavigator=function(e,t){return arguments.length===1||e.__kb_pane_navigator===t?e.__kb_pane_navigator:(e.__kb_pane_navigator&&e.__kb_pane_navigator.destroy(),e.__kb_pane_navigator=t,t)},this.$&&$.fn&&($.fn.findByPath=function(e){var t,n,r,i,s,o,u,a,f,l;o=[];for(u=0,f=this.length;u<f;u++){s=this[u],r=e.split("/"),i=s;for(a=0,l=r.length;a<l;a++){n=r[a],n[0]==="^"?(e=n.substring(1),e?(t=$(i).closest(e),i=t.length?t[0]:null):i=i.parentNode):n===".."?i=i.parentNode:(t=$(i).find(n),i=t.length?t[0]:null);if(!i)break}i&&o.push(i)}return $(o)},$.fn.findPaneNavigator=function(){var e,n,r,i,s,o,u,a,f,l,c;for(u=0,f=this.length;u<f;u++){r=this[u];if(o=r.getAttribute("data-path"))return e=this.findByPath(o),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null;n=$(r).parent();while(n.length&&!n.is("div"))n=n.parent();c=n.parent().find(".pane-navigator");for(a=0,l=c.length;a<l;a++){s=c[a];if(i=t.utils.wrappedPaneNavigator(s))return i}return e=$(r).closest(".pane-navigator"),e.length&&(i=t.utils.wrappedPaneNavigator(e[0]))?i:null}}),t.nextPane=function(e,n){var r,i,o,u;i=s.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(i).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(s.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=s.isElement(e)?e:e.currentTarget?e.currentTarget:t.currentTarget,r=$(n).findPaneNavigator();if(r&&r.activePane())return r.pop()},n.bindingHandlers&&(n.bindingHandlers.PaneNavigator={init:function(e,r,i,s){var o,u;return o=n.utils.unwrapObservable(r()),"no_remove"in o||(o.no_remove=!0),u=new t.PaneNavigator(e,o),t.utils.wrappedPaneNavigator(e,u),n.utils.domNodeDisposal.addDisposeCallback(e,function(){return t.utils.wrappedPaneNavigator(e,null)}),$(e).addClass("pane-navigator")},update:function(e,n){var r;return r=function(){var n,r;r=t.utils.wrappedPaneNavigator(e);if(r.activePane())return;n=$(r.el).children().filter(".pane");if(n.length)return r.push(new t.Pane(n[0]))},e.children.length?r():setTimeout(r,0)}}),t.Pane=function(){function e(e,t){arguments.length&&(this.url=t),this.setInfo(e)}return e.prototype.destroy=function(e){return e==null&&(e={}),this.deactivate(e),this.removeElement(e,!0),this.create=null,this.el=null},e.prototype.setInfo=function(e){var t,n;if(s.isElement(e))this.el=e;else for(t in e)n=e[t],this[t]=n;return this.el&&$(this.el).addClass("pane"),this},e.prototype.ensureElement=function(){var e;return this.el?this.el:(this.create||r(this,"create"),e=this.create.apply(this,this.args),e&&this.setInfo(e),this.el||r(this,"element"),this.el&&$(this.el).addClass("pane"),this)},e.prototype.removeElement=function(e,t){e==null&&(e={});if(!this.el)return this;if(e.no_remove)return;return t||this.create&&!e.no_destroy?(n.removeNode(this.el),this.el=null):this.el.parentNode&&this.el.parentNode.removeChild(this.el),this},e.prototype.activate=function(e){var t;this.ensureElement();if($(this.el).hasClass("active"))return;return $(this.el).addClass("active"),this.el.parentNode!==e&&e.appendChild(this.el),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.activate&&t.activate(this),this},e.prototype.deactivate=function(e){var t;e==null&&(e={});if(!this.el||!$(this.el).hasClass("active"))return;return $(this.el).removeClass("active"),t=this.view_model?this.view_model:n.dataFor(this.el),t&&t.deactivate&&t.deactivate(this),this.removeElement(e),this},e}(),typeof exports!="undefined"&&(exports.Pane=t.Pane),t.TransitionSavedState=function(){function e(e,t){var n,r;this.el_states=[];if(!t)return;for(r in t)n=t[r],this.push(e[r],n)}return e.prototype.push=function(e,t){var n,r,i,s;if(!e)return;r={className:""+e.className,css:{}};if(t)for(i=0,s=t.length;i<s;i++)n=t[i],r.css[n]=e.style[n];return this.el_states.push({el:e,state:r}),this},e.prototype.restore=function(){var e,t,n,r,i,s,o,u,a;u=this.el_states;for(s=0,o=u.length;s<o;s++){t=u[s],e=t.el,r=t.state;if(!e||!r)continue;"className"in r&&(e.className=r.className),a=r.css;for(n in a)i=a[n],e.style[n]=i}return this.el_states=null,this},e}(),typeof exports!="undefined"&&(exports.TransitionSavedState=t.TransitionSavedState),t})}).call(this);
Please sign in to comment.
Something went wrong with that request. Please try again.