diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index 5ce58f34b7..2f180dde73 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -23,8 +23,7 @@ var ajaxify = {};
window.onpopstate = function (event) {
- // "quiet": If set to true, will not call pushState
- if (event !== null && event.state && event.state.url !== undefined) {
+ if (event !== null && event.state && event.state.url !== undefined && !ajaxify.initialLoad) {
ajaxify.go(event.state.url, null, true);
}
};
@@ -32,13 +31,10 @@ var ajaxify = {};
var pagination, paginator_bar;
ajaxify.currentPage = null;
+ ajaxify.initialLoad = false;
ajaxify.go = function (url, callback, quiet) {
- if ($('#content').hasClass('ajaxifying')) {
- return true;
- }
-
- jQuery('#footer, #content').addClass('ajaxifying');
+ // "quiet": If set to true, will not call pushState
// start: the following should be set like so: ajaxify.onchange(function(){}); where the code actually belongs
$(window).off('scroll');
@@ -54,6 +50,9 @@ var ajaxify = {};
window.onscroll = null;
// end
+ if ($('#content').hasClass('ajaxifying')) {
+ templates.cancelRequest();
+ }
// Remove trailing slash
url = url.replace(/\/$/, "");
@@ -101,12 +100,11 @@ var ajaxify = {};
translator.load(tpl_url);
- jQuery('#footer, #content').removeClass('hide');
+ jQuery('#footer, #content').removeClass('hide').addClass('ajaxifying');
templates.flush();
templates.load_template(function () {
exec_body_scripts(content);
-
require(['forum/' + tpl_url], function(script) {
if (script && script.init) {
script.init();
@@ -176,6 +174,7 @@ var ajaxify = {};
var url = this.href.replace(rootUrl + '/', '');
if (ajaxify.go(url)) {
+
e.preventDefault();
}
} else if (window.location.pathname !== '/outgoing') {
diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js
index 223cc25ad1..a48d8c82cf 100644
--- a/public/src/forum/topic.js
+++ b/public/src/forum/topic.js
@@ -366,7 +366,6 @@ define(['composer'], function(composer) {
});
}
-
$('.topic').on('click', '.post_reply', function() {
var selectionText = '',
selection = window.getSelection() || document.getSelection();
diff --git a/public/templates/admin/header.tpl b/public/templates/admin/header.tpl
index 539828daf2..2baa221059 100644
--- a/public/templates/admin/header.tpl
+++ b/public/templates/admin/header.tpl
@@ -22,6 +22,8 @@
+
+
';
+ var routerScript = '';
+
+ return routerScript;
};
app.namespace(nconf.get('relative_path'), function () {
@@ -648,8 +653,7 @@ if(nconf.get('ssl')) {
res.send(
data.header +
'\n\t' +
- '\n\t' +
- templates.footer
+ '\n\t' + app.create_route('topic/' + topic_url) + templates.footer
);
});
});
@@ -763,8 +767,7 @@ if(nconf.get('ssl')) {
res.send(
data.header +
'\n\t' +
- '\n\t' +
- templates.footer
+ '\n\t' + app.create_route('category/' + category_url) + templates.footer
);
});
});
@@ -774,7 +777,7 @@ if(nconf.get('ssl')) {
req: req,
res: res
}, function (err, header) {
- res.send(header + '' + templates.footer);
+ res.send(header + app.create_route('confirm/' + req.params.code) + templates.footer);
});
});
@@ -845,11 +848,7 @@ if(nconf.get('ssl')) {
req: req,
res: res
}, function (err, header) {
- res.send(
- header +
- '\n\t' +
- templates.footer
- );
+ res.send(header + app.create_route('outgoing?url=' + encodeURIComponent(req.query.url)) + templates.footer);
});
});
diff --git a/tests/categories.js b/tests/categories.js
index 009d195e92..6f83d774f8 100644
--- a/tests/categories.js
+++ b/tests/categories.js
@@ -1,5 +1,4 @@
-// this test currently needs to talk to the redis database.
-// get the redis config info from root directory's config.json:
+
var winston = require('winston');
process.on('uncaughtException', function (err) {
@@ -59,4 +58,4 @@ describe('Categories', function() {
db.delete('category:' + categoryObj.cid);
db.listRemoveLast('categories:cid');
});
-});
\ No newline at end of file
+});