Skip to content

Commit

Permalink
Update Knockback to 0.16.7 and added pane navigator polling for DOM c…
Browse files Browse the repository at this point in the history
…hanges
  • Loading branch information
Kevin Malakoff committed Sep 21, 2012
1 parent 8f0a436 commit 950d7fd
Show file tree
Hide file tree
Showing 43 changed files with 252 additions and 204 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
@@ -1,5 +1,9 @@
Please refer to the following release notes when upgrading your version of Knockback-Navigators.js.

## 0.1.2

* made pane navigator check for DOM changes using setInterval to ensure an active element is always present.

## 0.1.1

* added AMD loader to all components.
Expand Down
2 changes: 1 addition & 1 deletion examples/pnp-nt-i_xui_pth_kb.html
Expand Up @@ -39,7 +39,7 @@ <h1>Page2</h1>

<script src="vendor/xui-2.3.2.js"></script>
<script src="vendor/path-0.8.4.js"></script>
<script src="vendor/knockback-core-stack-0.16.6.js"></script>
<script src="vendor/knockback-core-stack-0.16.7.js"></script>
<script src="../knockback-page-navigator-panes.js"></script>

<script type='text/javascript'>
Expand Down
2 changes: 1 addition & 1 deletion examples/pnp-t-e_jq_kb.html
Expand Up @@ -30,7 +30,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.6.js"></script>
<script src="vendor/knockback-core-stack-0.16.7.js"></script>
<script src="../knockback-page-navigator-panes.js"></script>
<script src="../lib/knockback-sample-transitions-jquery.js"></script>

Expand Down
2 changes: 1 addition & 1 deletion examples/pnp-t-i_jq_kb.html
Expand Up @@ -30,7 +30,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.6.js"></script>
<script src="vendor/knockback-core-stack-0.16.7.js"></script>
<script src="../knockback-page-navigator-panes.js"></script>
<script src="../lib/knockback-sample-transitions-jquery.js"></script>

Expand Down
2 changes: 1 addition & 1 deletion examples/pnp-t_jq_kb.html
Expand Up @@ -30,7 +30,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.6.js"></script>
<script src="vendor/knockback-core-stack-0.16.7.js"></script>
<script src="../knockback-page-navigator-panes.js"></script>
<script src="../lib/knockback-sample-transitions-jquery.js"></script>

Expand Down
2 changes: 1 addition & 1 deletion examples/pnp-t_zpt_kb.html
Expand Up @@ -30,7 +30,7 @@ <h1 data-bind="text: title"></h1>
</div>

<script src="vendor/zepto-1.0rc1.js"></script>
<script src="vendor/knockback-core-stack-0.16.6.js"></script>
<script src="vendor/knockback-core-stack-0.16.7.js"></script>
<script src="../knockback-page-navigator-panes.js"></script>
<script src="../lib/knockback-sample-transitions-jquery.js"></script>

Expand Down
2 changes: 1 addition & 1 deletion examples/pns-e_jq_kb.html
Expand Up @@ -30,7 +30,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.6.js"></script>
<script src="vendor/knockback-core-stack-0.16.7.js"></script>
<script src="../knockback-page-navigator-simple.js"></script>

<script type='text/javascript'>
Expand Down
2 changes: 1 addition & 1 deletion examples/pns-i_zpt_kb.html
Expand Up @@ -30,7 +30,7 @@ <h1 data-bind="text: title"></h1>
</div>

<script src="vendor/zepto-1.0rc1.js"></script>
<script src="vendor/knockback-core-stack-0.16.6.js"></script>
<script src="vendor/knockback-core-stack-0.16.7.js"></script>
<script src="../knockback-page-navigator-simple.js"></script>

<script type='text/javascript'>
Expand Down
2 changes: 1 addition & 1 deletion examples/pns_jq_kb.html
Expand Up @@ -30,7 +30,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.6.js"></script>
<script src="vendor/knockback-core-stack-0.16.7.js"></script>
<script src="../knockback-page-navigator-simple.js"></script>

<script type='text/javascript'>
Expand Down
2 changes: 1 addition & 1 deletion examples/pns_zpt_kb.html
Expand Up @@ -30,7 +30,7 @@ <h1 data-bind="text: title"></h1>
</div>

<script src="vendor/zepto-1.0rc1.js"></script>
<script src="vendor/knockback-core-stack-0.16.6.js"></script>
<script src="vendor/knockback-core-stack-0.16.7.js"></script>
<script src="../knockback-page-navigator-simple.js"></script>

<script type='text/javascript'>
Expand Down
@@ -1,5 +1,5 @@
/*
knockback-core-stack.js 0.16.6
knockback-core-stack.js 0.16.7
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
Expand Down Expand Up @@ -5938,7 +5938,7 @@ ko.exportSymbol('nativeTemplateEngine', ko.nativeTemplateEngine);
});
})(window,document,navigator);
/*
knockback-core.js 0.16.6
knockback-core.js 0.16.7
(c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
Expand All @@ -5955,7 +5955,7 @@ ko.exportSymbol('nativeTemplateEngine', ko.nativeTemplateEngine);
}
})(function() {// Generated by CoffeeScript 1.3.3
/*
knockback-core.js 0.16.6
knockback-core.js 0.16.7
(c) 2011, 2012 Kevin Malakoff.
Knockback.js is freely distributable under the MIT license.
See the following for full license details:
Expand All @@ -5970,7 +5970,7 @@ kb = (function() {

function kb() {}

kb.VERSION = '0.16.6';
kb.VERSION = '0.16.7';

kb.TYPE_UNKNOWN = 0;

Expand Down
56 changes: 31 additions & 25 deletions knockback-page-navigator-panes.js
Expand Up @@ -15,7 +15,7 @@
return factory.call(this);
}
})(function() {// Generated by CoffeeScript 1.3.3
var bind, kb, ko, throwMissing, throwUnexpected, _;
var ACTIVE_CHECK_INTERVAL, bind, checkPanesForActivate, kb, ko, root, throwMissing, throwUnexpected, _;

throwMissing = function(instance, message) {
throw "" + (_.isString(instance) ? instance : instance.constructor.name) + ": " + message + " is missing";
Expand Down Expand Up @@ -228,10 +228,33 @@ if (ko && ko.bindingHandlers) {
};
}

root = this;

ACTIVE_CHECK_INTERVAL = 100;

checkPanesForActivate = function(pane_navigator) {
var $pane_els, active_pane, parent_el;
if (active_pane = pane_navigator.activePane()) {
parent_el = active_pane.el.parentNode;
while (parent_el && (parent_el !== pane_navigator.el)) {
parent_el = parent_el.parentNode;
}
if (parent_el) {
return;
}
pane_navigator.clear();
}
$pane_els = $(pane_navigator.el).children().filter('.pane');
if ($pane_els.length) {
return pane_navigator.push(new kb.Pane($pane_els[0]));
}
};

kb.PaneNavigator = (function() {

function PaneNavigator(el, options) {
var key, value;
var key, value,
_this = this;
el || throwMissing(this, 'el');
for (key in options) {
value = options[key];
Expand All @@ -240,9 +263,14 @@ kb.PaneNavigator = (function() {
this.panes = ko.observableArray();
this.el = el && el.length ? el[0] : el;
$(this.el).addClass('pane-navigator');
this.interval = root.setInterval(function() {
return checkPanesForActivate(_this);
});
}

PaneNavigator.prototype.destroy = function() {
root.clearInterval(this.interval);
this.interval = null;
this.el = null;
return this.clear({
silent: true
Expand Down Expand Up @@ -584,25 +612,6 @@ if (ko.bindingHandlers) {
return kb.utils.wrappedPaneNavigator(element, null);
});
return $(element).addClass('pane-navigator');
},
'update': function(element, value_accessor) {
var checkPanesForActivate;
checkPanesForActivate = function() {
var $pane_els, pane_navigator;
pane_navigator = kb.utils.wrappedPaneNavigator(element);
if (pane_navigator.activePane()) {
return;
}
$pane_els = $(pane_navigator.el).children().filter('.pane');
if ($pane_els.length) {
return pane_navigator.push(new kb.Pane($pane_els[0]));
}
};
if (element.children.length) {
return checkPanesForActivate();
} else {
return setTimeout(checkPanesForActivate, 0);
}
}
};
}
Expand Down Expand Up @@ -635,10 +644,7 @@ kb.loadUrlFn = function(url, transition) {
return function(vm, event) {
kb.loadUrl(url, transition);
(!vm || !vm.stopPropagation) || (event = vm);
if (event && event.stopPropagation) {
event.stopPropagation();
return event.preventDefault();
}
!(event && event.stopPropagation) || (event.stopPropagation(), event.preventDefault());
};
};

Expand Down
2 changes: 1 addition & 1 deletion knockback-page-navigator-panes.min.js

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions knockback-page-navigator-simple.js
Expand Up @@ -232,10 +232,7 @@ kb.loadUrlFn = function(url, transition) {
return function(vm, event) {
kb.loadUrl(url, transition);
(!vm || !vm.stopPropagation) || (event = vm);
if (event && event.stopPropagation) {
event.stopPropagation();
return event.preventDefault();
}
!(event && event.stopPropagation) || (event.stopPropagation(), event.preventDefault());
};
};

Expand Down
2 changes: 1 addition & 1 deletion knockback-page-navigator-simple.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 950d7fd

Please sign in to comment.