Node.js based forum software built for the modern web
closed #40 by removing jquery call that repetitvely bound and unbound anchors
Julian Lamd413d3b29ae7
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.jsindex 5e25ce5c78..060373230f 100644--- a/public/src/ajaxify.js+++ b/public/src/ajaxify.js@@ -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();+ }+ }+ });});