Skip to content
Browse files

Update Knockback

  • Loading branch information...
1 parent cc99937 commit 0be12922cdcb63fd1a8adadb40d79b087994da04 Kevin Malakoff committed Sep 13, 2012
View
2 examples/pnp-t-e_jq_kb.html
@@ -29,7 +29,7 @@ <h1 data-bind="text: title"></h1>
</script>
<script src="vendor/jquery-1.8.0.js"></script>
- <script src="vendor/knockback-core-stack-0.16.4.js"></script>
+ <script src="vendor/knockback-core-stack-0.16.5.js"></script>
<script src="../knockback-page-navigator-panes.js"></script>
<script src="../lib/knockback-sample-transitions.js"></script>
View
2 examples/pnp-t_jq_kb.html
@@ -29,7 +29,7 @@ <h1 data-bind="text: title"></h1>
</script>
<script src="vendor/jquery-1.8.0.js"></script>
- <script src="vendor/knockback-core-stack-0.16.4.js"></script>
+ <script src="vendor/knockback-core-stack-0.16.5.js"></script>
<script src="../knockback-page-navigator-panes.js"></script>
<script src="../lib/knockback-sample-transitions.js"></script>
View
2 examples/pnp-t_zpt_kb.html
@@ -29,7 +29,7 @@ <h1 data-bind="text: title"></h1>
</div>
<script src="vendor/zepto-1.0rc1.js"></script>
- <script src="vendor/knockback-core-stack-0.16.4.js"></script>
+ <script src="vendor/knockback-core-stack-0.16.5.js"></script>
<script src="../knockback-page-navigator-panes.js"></script>
<script src="../lib/knockback-sample-transitions.js"></script>
View
2 examples/pns-e_jq_kb.html
@@ -29,7 +29,7 @@ <h1 data-bind="text: title"></h1>
</script>
<script src="vendor/jquery-1.8.0.js"></script>
- <script src="vendor/knockback-core-stack-0.16.4.js"></script>
+ <script src="vendor/knockback-core-stack-0.16.5.js"></script>
<script src="../knockback-page-navigator-simple.js"></script>
<script type='text/javascript'>
View
2 examples/pns_jq_kb.html
@@ -29,7 +29,7 @@ <h1 data-bind="text: title"></h1>
</script>
<script src="vendor/jquery-1.8.0.js"></script>
- <script src="vendor/knockback-core-stack-0.16.4.js"></script>
+ <script src="vendor/knockback-core-stack-0.16.5.js"></script>
<script src="../knockback-page-navigator-simple.js"></script>
<script type='text/javascript'>
View
2 examples/pns_zpt_kb.html
@@ -29,7 +29,7 @@ <h1 data-bind="text: title"></h1>
</div>
<script src="vendor/zepto-1.0rc1.js"></script>
- <script src="vendor/knockback-core-stack-0.16.4.js"></script>
+ <script src="vendor/knockback-core-stack-0.16.5.js"></script>
<script src="../knockback-page-navigator-simple.js"></script>
<script type='text/javascript'>
View
7,739 examples/vendor/knockback-core-stack-0.16.5.js
7,739 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
5 knockback-page-navigator-panes.js
@@ -621,10 +621,11 @@
kb.loadUrlFn = function(url, transition) {
return function(vm, event) {
kb.loadUrl(url, transition);
- if (event && event.currentTarget) {
+ (!vm || !vm.stopPropagation) || (event = vm);
+ if (event && event.stopPropagation) {
event.stopPropagation();
+ return event.preventDefault();
}
- return false;
};
};
View
2 knockback-page-navigator-panes.min.js
@@ -6,4 +6,4 @@
See the following for full license details:
https://github.com/kmalakoff/knockback-navigators/blob/master/LICENSE
Dependencies: None
-*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return r=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),r?{transition:r}: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(){if(t.destroyed)return;return 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 r,i;e||throwMissing(this,"el");for(r in t)i=t[r],this[r]=i;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,s,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),s=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(s)return o.no_history?(e=o.panes(),e.splice(i.indexOf(e,s),1),s.destroy(o)):s.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,s,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(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,r,i){var s,o,u,a,f,l,c,h;if(!e)return;e.transition&&e.transition.options&&(f=e.transition.options.use_previous),f&&(c=[n,e],e=c[0],n=c[1],i=!i),a=e.transition?e.transition:this.transition;if(!a)return null;typeof a=="string"&&(a={name:a});if(!t.transistions[a.name])throw"transition "+a.name+" not found";u={forward:i};for(o in a)l=a[o],u[o]=l;return u.inverse&&(h=[n,e],e=h[0],n=h[1],u.forward=!u.forward),delete u.inverse,e&&e.activate(this.el),n&&n.activate(this.el),s={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:r},this.active_transition={callback:r,transition:new t.transistions[a.name](s,u)},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={}),i.indexOf||(i.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)},$.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,s,o,u;s=i.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(s).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(i.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=i.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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=e},t.loadUrlFn=function(e,n){return function(r,i){return t.loadUrl(e,n),i&&i.currentTarget&&i.stopPropagation(),!1}},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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
+*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return r=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),r?{transition:r}: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(){if(t.destroyed)return;return 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 r,i;e||throwMissing(this,"el");for(r in t)i=t[r],this[r]=i;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,s,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),s=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(s)return o.no_history?(e=o.panes(),e.splice(i.indexOf(e,s),1),s.destroy(o)):s.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,s,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(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,r,i){var s,o,u,a,f,l,c,h;if(!e)return;e.transition&&e.transition.options&&(f=e.transition.options.use_previous),f&&(c=[n,e],e=c[0],n=c[1],i=!i),a=e.transition?e.transition:this.transition;if(!a)return null;typeof a=="string"&&(a={name:a});if(!t.transistions[a.name])throw"transition "+a.name+" not found";u={forward:i};for(o in a)l=a[o],u[o]=l;return u.inverse&&(h=[n,e],e=h[0],n=h[1],u.forward=!u.forward),delete u.inverse,e&&e.activate(this.el),n&&n.activate(this.el),s={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:r},this.active_transition={callback:r,transition:new t.transistions[a.name](s,u)},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={}),i.indexOf||(i.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)},$.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,s,o,u;s=i.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(s).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(i.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=i.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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
View
5 knockback-page-navigator-simple.js
@@ -217,10 +217,11 @@
kb.loadUrlFn = function(url, transition) {
return function(vm, event) {
kb.loadUrl(url, transition);
- if (event && event.currentTarget) {
+ (!vm || !vm.stopPropagation) || (event = vm);
+ if (event && event.stopPropagation) {
event.stopPropagation();
+ return event.preventDefault();
}
- return false;
};
};
View
2 knockback-page-navigator-simple.min.js
@@ -6,4 +6,4 @@
See the following for full license details:
https://github.com/kmalakoff/knockback-navigators/blob/master/LICENSE
Dependencies: None
-*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.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||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):((r=this.activePage())&&r.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(){if(t.destroyed)return;return 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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=e},t.loadUrlFn=function(e,n){return function(r,i){return t.loadUrl(e,n),i&&i.currentTarget&&i.stopPropagation(),!1}},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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
+*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.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||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):((r=this.activePage())&&r.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(){if(t.destroyed)return;return 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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
View
2 package.json
@@ -24,7 +24,7 @@
"codo": ">=1.2.3"
},
"dependencies": {
- "knockback": ">=0.16.4",
+ "knockback": ">=0.16.5",
"knockout-client": ">=2.1.0",
"backbone": ">=0.9.2",
"underscore": ">=1.3.3"
View
5 packages/npm/knockback-page-navigator-panes.js
@@ -621,10 +621,11 @@
kb.loadUrlFn = function(url, transition) {
return function(vm, event) {
kb.loadUrl(url, transition);
- if (event && event.currentTarget) {
+ (!vm || !vm.stopPropagation) || (event = vm);
+ if (event && event.stopPropagation) {
event.stopPropagation();
+ return event.preventDefault();
}
- return false;
};
};
View
2 packages/npm/knockback-page-navigator-panes.min.js
@@ -6,4 +6,4 @@
See the following for full license details:
https://github.com/kmalakoff/knockback-navigators/blob/master/LICENSE
Dependencies: None
-*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return r=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),r?{transition:r}: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(){if(t.destroyed)return;return 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 r,i;e||throwMissing(this,"el");for(r in t)i=t[r],this[r]=i;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,s,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),s=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(s)return o.no_history?(e=o.panes(),e.splice(i.indexOf(e,s),1),s.destroy(o)):s.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,s,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(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,r,i){var s,o,u,a,f,l,c,h;if(!e)return;e.transition&&e.transition.options&&(f=e.transition.options.use_previous),f&&(c=[n,e],e=c[0],n=c[1],i=!i),a=e.transition?e.transition:this.transition;if(!a)return null;typeof a=="string"&&(a={name:a});if(!t.transistions[a.name])throw"transition "+a.name+" not found";u={forward:i};for(o in a)l=a[o],u[o]=l;return u.inverse&&(h=[n,e],e=h[0],n=h[1],u.forward=!u.forward),delete u.inverse,e&&e.activate(this.el),n&&n.activate(this.el),s={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:r},this.active_transition={callback:r,transition:new t.transistions[a.name](s,u)},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={}),i.indexOf||(i.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)},$.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,s,o,u;s=i.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(s).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(i.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=i.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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=e},t.loadUrlFn=function(e,n){return function(r,i){return t.loadUrl(e,n),i&&i.currentTarget&&i.stopPropagation(),!1}},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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
+*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return r=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),r?{transition:r}: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(){if(t.destroyed)return;return 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 r,i;e||throwMissing(this,"el");for(r in t)i=t[r],this[r]=i;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,s,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),s=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(s)return o.no_history?(e=o.panes(),e.splice(i.indexOf(e,s),1),s.destroy(o)):s.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,s,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(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,r,i){var s,o,u,a,f,l,c,h;if(!e)return;e.transition&&e.transition.options&&(f=e.transition.options.use_previous),f&&(c=[n,e],e=c[0],n=c[1],i=!i),a=e.transition?e.transition:this.transition;if(!a)return null;typeof a=="string"&&(a={name:a});if(!t.transistions[a.name])throw"transition "+a.name+" not found";u={forward:i};for(o in a)l=a[o],u[o]=l;return u.inverse&&(h=[n,e],e=h[0],n=h[1],u.forward=!u.forward),delete u.inverse,e&&e.activate(this.el),n&&n.activate(this.el),s={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:r},this.active_transition={callback:r,transition:new t.transistions[a.name](s,u)},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={}),i.indexOf||(i.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)},$.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,s,o,u;s=i.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(s).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(i.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=i.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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
View
5 packages/npm/knockback-page-navigator-simple.js
@@ -217,10 +217,11 @@
kb.loadUrlFn = function(url, transition) {
return function(vm, event) {
kb.loadUrl(url, transition);
- if (event && event.currentTarget) {
+ (!vm || !vm.stopPropagation) || (event = vm);
+ if (event && event.stopPropagation) {
event.stopPropagation();
+ return event.preventDefault();
}
- return false;
};
};
View
2 packages/npm/knockback-page-navigator-simple.min.js
@@ -6,4 +6,4 @@
See the following for full license details:
https://github.com/kmalakoff/knockback-navigators/blob/master/LICENSE
Dependencies: None
-*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.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||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):((r=this.activePage())&&r.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(){if(t.destroyed)return;return 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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=e},t.loadUrlFn=function(e,n){return function(r,i){return t.loadUrl(e,n),i&&i.currentTarget&&i.stopPropagation(),!1}},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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
+*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.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||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):((r=this.activePage())&&r.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(){if(t.destroyed)return;return 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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
View
5 packages/nuget/Content/Scripts/knockback-page-navigator-panes.js
@@ -621,10 +621,11 @@
kb.loadUrlFn = function(url, transition) {
return function(vm, event) {
kb.loadUrl(url, transition);
- if (event && event.currentTarget) {
+ (!vm || !vm.stopPropagation) || (event = vm);
+ if (event && event.stopPropagation) {
event.stopPropagation();
+ return event.preventDefault();
}
- return false;
};
};
View
2 packages/nuget/Content/Scripts/knockback-page-navigator-panes.min.js
@@ -6,4 +6,4 @@
See the following for full license details:
https://github.com/kmalakoff/knockback-navigators/blob/master/LICENSE
Dependencies: None
-*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return r=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),r?{transition:r}: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(){if(t.destroyed)return;return 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 r,i;e||throwMissing(this,"el");for(r in t)i=t[r],this[r]=i;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,s,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),s=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(s)return o.no_history?(e=o.panes(),e.splice(i.indexOf(e,s),1),s.destroy(o)):s.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,s,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(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,r,i){var s,o,u,a,f,l,c,h;if(!e)return;e.transition&&e.transition.options&&(f=e.transition.options.use_previous),f&&(c=[n,e],e=c[0],n=c[1],i=!i),a=e.transition?e.transition:this.transition;if(!a)return null;typeof a=="string"&&(a={name:a});if(!t.transistions[a.name])throw"transition "+a.name+" not found";u={forward:i};for(o in a)l=a[o],u[o]=l;return u.inverse&&(h=[n,e],e=h[0],n=h[1],u.forward=!u.forward),delete u.inverse,e&&e.activate(this.el),n&&n.activate(this.el),s={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:r},this.active_transition={callback:r,transition:new t.transistions[a.name](s,u)},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={}),i.indexOf||(i.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)},$.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,s,o,u;s=i.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(s).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(i.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=i.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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=e},t.loadUrlFn=function(e,n){return function(r,i){return t.loadUrl(e,n),i&&i.currentTarget&&i.stopPropagation(),!1}},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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
+*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.isElement=function(e){return e&&e.nodeType===1}),this.x$&&(this.$=this.x$),t.PageNavigatorPanes=function(){function e(e,n){n==null&&(n={}),e||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return r=t.popOverrideTransition(),this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):this.pane_navigator.push(new t.Pane(e,window.location.hash),r?{transition:r}: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(){if(t.destroyed)return;return 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 r,i;e||throwMissing(this,"el");for(r in t)i=t[r],this[r]=i;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,s,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),s=this.previousPane(),r=!1,n=function(){var e;if(r)return;r=!0,o.cleanupTransition();if(s)return o.no_history?(e=o.panes(),e.splice(i.indexOf(e,s),1),s.destroy(o)):s.deactivate(o)},e&&(e.transition||this.transition)?this.startTransition(e,s,n,!0):n(),e},e.prototype.pop=function(e){var t,n,r,i,s=this;return e==null&&(e={}),i=this.previousPane(),i?(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,r,i){var s,o,u,a,f,l,c,h;if(!e)return;e.transition&&e.transition.options&&(f=e.transition.options.use_previous),f&&(c=[n,e],e=c[0],n=c[1],i=!i),a=e.transition?e.transition:this.transition;if(!a)return null;typeof a=="string"&&(a={name:a});if(!t.transistions[a.name])throw"transition "+a.name+" not found";u={forward:i};for(o in a)l=a[o],u[o]=l;return u.inverse&&(h=[n,e],e=h[0],n=h[1],u.forward=!u.forward),delete u.inverse,e&&e.activate(this.el),n&&n.activate(this.el),s={container_el:this.el,from_el:n?n.el:null,to_el:e?e.el:null,callback:r},this.active_transition={callback:r,transition:new t.transistions[a.name](s,u)},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={}),i.indexOf||(i.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)},$.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,s,o,u;s=i.isElement(e)?e:e.currentTarget?e.currentTarget:n.currentTarget,u=$(s).findPaneNavigator();if(!u||!(r=u.activePane()))return;o=r.el;while(o=o.nextSibling)if(i.isElement(o)&&$(o).hasClass("pane"))break;if(o)return u.push(new t.Pane(o))},t.previousPane=function(e,t){var n,r;n=i.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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
View
5 packages/nuget/Content/Scripts/knockback-page-navigator-simple.js
@@ -217,10 +217,11 @@
kb.loadUrlFn = function(url, transition) {
return function(vm, event) {
kb.loadUrl(url, transition);
- if (event && event.currentTarget) {
+ (!vm || !vm.stopPropagation) || (event = vm);
+ if (event && event.stopPropagation) {
event.stopPropagation();
+ return event.preventDefault();
}
- return false;
};
};
View
2 packages/nuget/Content/Scripts/knockback-page-navigator-simple.min.js
@@ -6,4 +6,4 @@
See the following for full license details:
https://github.com/kmalakoff/knockback-navigators/blob/master/LICENSE
Dependencies: None
-*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.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||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):((r=this.activePage())&&r.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(){if(t.destroyed)return;return 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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=e},t.loadUrlFn=function(e,n){return function(r,i){return t.loadUrl(e,n),i&&i.currentTarget&&i.stopPropagation(),!1}},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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
+*/(function(){var e,t,n,r,i;r=function(e,t){throw""+e.constructor.name+": "+t+" is unexpected"};try{t=typeof require!="undefined"?require("knockback"):this.kb}catch(s){({})}this.kb=t||(t={});try{n=typeof require!="undefined"?require("knockout"):this.ko}catch(s){({})}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}),i=this._?this._:t._?t._:{},i.bindAll||(e=function(e,t){var n;return n=e[t],e[t]=function(){return n.apply(e,arguments)}},i.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)}),i.isElement||(i.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||throwMissing(this,"el"),i.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,r;if(!e)throw"missing page info";return this.activeUrl()===window.location.hash?(n=this.activePage(),n.el||pane_navigator.ensureElement(n),n.el.parentNode!==this.el&&$(this.el).append(n.el),n):((r=this.activePage())&&r.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(){if(t.destroyed)return;return 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.loadUrl=function(e,n){return t.override_transitions.push(n),window.location.hash=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(i.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;if(this.el)return this.el;if(!this.create)throw"expecting create";e=this.create.apply(this,this.args),e&&this.setInfo(e);if(!this.el)throw"expecting el";return 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).append(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)}).call(this);
View
2 packages/nuget/package.nuspec
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
- <version>0.16.4</version>
+ <version>0.16.5</version>
<authors>Kevin Malakoff</authors>
<owners />
<licenseUrl>https://github.com/kmalakoff/knockback/blob/master/LICENSE</licenseUrl>
View
6 src/shared/knockback-page-navigator-helpers.coffee
@@ -21,8 +21,10 @@ kb.loadUrlFn = (url, transition) ->
kb.loadUrl(url, transition)
# stop the event handling chains
- event.stopPropagation() if event and event.currentTarget
- return false
+ (not vm or not vm.stopPropagation) or (event = vm) # not a ViewModel, but an event
+ if event and event.stopPropagation
+ event.stopPropagation()
+ event.preventDefault()
# utilities namespace
kb.utils or= {}
View
2 test/knockback-page-navigator-panes/test-latest.html
@@ -4,7 +4,7 @@
<head>
<title>Knockback.PageNavigatorPanes Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../vendor/knockback-core-stack-0.16.4.js"></script>
+ <script type="text/javascript" src="../vendor/knockback-core-stack-0.16.5.js"></script>
<!-- LIBRARY -->
<script type="text/javascript" src="../../knockback-page-navigator-panes.js"></script>
View
2 test/knockback-page-navigator-simple/test-latest.html
@@ -4,7 +4,7 @@
<head>
<title>Knockback.PageNavigatorSimple Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../vendor/knockback-core-stack-0.16.4.js"></script>
+ <script type="text/javascript" src="../vendor/knockback-core-stack-0.16.5.js"></script>
<!-- LIBRARY -->
<script type="text/javascript" src="../../knockback-page-navigator-simple.js"></script>
View
2 test/knockback-pane-navigator/test-latest.html
@@ -4,7 +4,7 @@
<head>
<title>Knockback.PaneNavigator Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../vendor/knockback-core-stack-0.16.4.js"></script>
+ <script type="text/javascript" src="../vendor/knockback-core-stack-0.16.5.js"></script>
<!-- LIBRARY -->
<script type="text/javascript" src="../../knockback-pane-navigator.js"></script>
View
7,739 test/vendor/knockback-core-stack-0.16.5.js
7,739 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit 0be1292

Please sign in to comment.
Something went wrong with that request. Please try again.