Merge branch 'master' of github.com:psychobunny/node-forum

v1.18.x
Julian Lam 12 years ago
commit 531515b8be

@ -3,9 +3,12 @@
var rootUrl = document.location.protocol + '//' + (document.location.hostname || document.location.host) + (document.location.port ? ':'+document.location.port : ''), var rootUrl = document.location.protocol + '//' + (document.location.hostname || document.location.host) + (document.location.port ? ':'+document.location.port : ''),
content = null; content = null;
var current_state = '';
$('document').ready(function() { $('document').ready(function() {
if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers
content = content || document.getElementById('content'); content = content || document.getElementById('content');
@ -14,13 +17,21 @@
var tpl_url = (url === '') ? 'home' : url; var tpl_url = (url === '') ? 'home' : url;
if (templates[tpl_url]) { if (templates[tpl_url]) {
window.history.pushState({}, url, "/" + url); if (current_state != url) {
content.innerHTML = templates[tpl_url]; current_state = url;
exec_body_scripts(content);
window.history.pushState({}, url, "/" + url);
content.innerHTML = templates[tpl_url];
exec_body_scripts(content);
}
ev.preventDefault();
return false;
} }
ev.preventDefault();
return false;
}); });
}); });

Loading…
Cancel
Save