closed #40 by removing jquery call that repetitvely bound and unbound anchors

v1.18.x
Julian Lam 12 years ago
parent e5817eecb0
commit d413d3b29a

@ -52,7 +52,6 @@ var ajaxify = {};
templates.load_template(function() {
exec_body_scripts(content);
ajaxify.enable();
if (callback) {
callback();
}
@ -67,21 +66,8 @@ var ajaxify = {};
return false;
}
ajaxify.enable = function() {
$('a').unbind('click', ajaxify.onclick).bind('click', ajaxify.onclick);
}
ajaxify.onclick = function(ev) {
if (this.href == window.location.href + "#") return;
var url = this.href.replace(rootUrl +'/', '');
if (this.target !== '') return;
if (!ev.ctrlKey && ev.which === 1) {
if (ajaxify.go(url)) {
ev.preventDefault();
}
}
}
$('document').ready(function() {
@ -89,7 +75,19 @@ var ajaxify = {};
content = content || document.getElementById('content');
ajaxify.enable();
// Enhancing all anchors to ajaxify...
$(document.body).on('click', 'a', function(e) {
if (this.href == window.location.href + "#") return;
var url = this.href.replace(rootUrl +'/', '');
if (this.target !== '') return;
if (!e.ctrlKey && e.which === 1) {
if (ajaxify.go(url)) {
e.preventDefault();
}
}
});
});

Loading…
Cancel
Save