got ajaxify working with threads, some cleanup, fixed anon posting, got rid of a few more global.sockets calls

This commit is contained in:
psychobunny
2013-05-01 21:26:47 +00:00
parent 6471109a25
commit b2bc967e9b
7 changed files with 31 additions and 24 deletions

View File

@@ -26,7 +26,7 @@ var templates = {};
function init() {
loadTemplates([
'header', 'footer', 'register', 'home',
'header', 'footer', 'register', 'home', 'topic',
'login', 'reset', 'reset_code', 'account_settings',
'emails/reset', 'emails/reset_plaintext'
]);
@@ -116,10 +116,11 @@ function load_template(callback) {
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : '');
var url = location.href.replace(rootUrl +'/', '');
if (url == '') url = 'home';
jQuery.get('api/' + url, function(data) {
url = (url === '') ? 'home' : url;
jQuery.get(API_URL + url, function(data) {
document.getElementById('content').innerHTML = templates[url].parse(JSON.parse(data));
document.getElementById('content').innerHTML = templates[url.split('/')[0]].parse(JSON.parse(data));
if (callback) callback();
});
}