mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
closes #3815
This commit is contained in:
@@ -6,10 +6,9 @@
|
|||||||
ajaxify.variables = {};
|
ajaxify.variables = {};
|
||||||
|
|
||||||
ajaxify.variables.parse = function() {
|
ajaxify.variables.parse = function() {
|
||||||
var dataEl = $('#content [ajaxify-data]');
|
var dataEl = $('#content #ajaxify-data');
|
||||||
if (dataEl.length) {
|
if (dataEl.length) {
|
||||||
ajaxify.data = JSON.parse(decodeURIComponent(dataEl.attr('ajaxify-data')));
|
ajaxify.data = JSON.parse(dataEl.text());
|
||||||
dataEl.remove();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}(ajaxify || {}));
|
}(ajaxify || {}));
|
||||||
|
|||||||
@@ -45,13 +45,15 @@ module.exports = function(middleware) {
|
|||||||
fn = defaultFn;
|
fn = defaultFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ajaxifyData = encodeURIComponent(JSON.stringify(options));
|
var ajaxifyData = JSON.stringify(options);
|
||||||
|
|
||||||
render.call(self, template, options, function(err, str) {
|
render.call(self, template, options, function(err, str) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return fn(err);
|
return fn(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str + '<input type="hidden" ajaxify-data="' + ajaxifyData + '" />';
|
str = str + '<script id="ajaxify-data" type="application/json">' + ajaxifyData + '</script>';
|
||||||
|
|
||||||
str = (res.locals.postHeader ? res.locals.postHeader : '') + str + (res.locals.preFooter ? res.locals.preFooter : '');
|
str = (res.locals.postHeader ? res.locals.postHeader : '') + str + (res.locals.preFooter ? res.locals.preFooter : '');
|
||||||
|
|
||||||
if (res.locals.footer) {
|
if (res.locals.footer) {
|
||||||
|
|||||||
Reference in New Issue
Block a user