mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
reduced the number of 'ajaxify.go' calls to one, in /src
This commit is contained in:
@@ -400,7 +400,11 @@ if(nconf.get('ssl')) {
|
||||
};
|
||||
|
||||
app.create_route = function (url, tpl) { // to remove
|
||||
return '<script>templates.ready(function(){ajaxify.go("' + url + '", null, true);});</script>';
|
||||
var routerScript = '<script> \
|
||||
templates.ready(function(){ajaxify.go("' + url + '", null, true);}); \
|
||||
</script>';
|
||||
|
||||
return routerScript;
|
||||
};
|
||||
|
||||
app.namespace(nconf.get('relative_path'), function () {
|
||||
@@ -648,8 +652,7 @@ if(nconf.get('ssl')) {
|
||||
res.send(
|
||||
data.header +
|
||||
'\n\t<noscript>\n' + templates['noscript/header'] + templates['noscript/topic'].parse(data.topics) + '\n\t</noscript>' +
|
||||
'\n\t<script>templates.ready(function(){ajaxify.go("topic/' + topic_url + '", undefined, true);});</script>' +
|
||||
templates.footer
|
||||
'\n\t' + app.create_route('topic/' + topic_url) + templates.footer
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -763,8 +766,7 @@ if(nconf.get('ssl')) {
|
||||
res.send(
|
||||
data.header +
|
||||
'\n\t<noscript>\n' + templates['noscript/header'] + templates['noscript/category'].parse(data.categories) + '\n\t</noscript>' +
|
||||
'\n\t<script>templates.ready(function(){ajaxify.go("category/' + category_url + '", undefined, true);});</script>' +
|
||||
templates.footer
|
||||
'\n\t' + app.create_route('category/' + category_url) + templates.footer
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -774,7 +776,7 @@ if(nconf.get('ssl')) {
|
||||
req: req,
|
||||
res: res
|
||||
}, function (err, header) {
|
||||
res.send(header + '<script>templates.ready(function(){ajaxify.go("confirm/' + req.params.code + '", undefined, true);});</script>' + templates.footer);
|
||||
res.send(header + app.create_route('confirm/' + req.params.code) + templates.footer);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -845,11 +847,7 @@ if(nconf.get('ssl')) {
|
||||
req: req,
|
||||
res: res
|
||||
}, function (err, header) {
|
||||
res.send(
|
||||
header +
|
||||
'\n\t<script>templates.ready(function(){ajaxify.go("outgoing?url=' + encodeURIComponent(req.query.url) + '", null, true);});</script>' +
|
||||
templates.footer
|
||||
);
|
||||
res.send(header + app.create_route('outgoing?url=' + encodeURIComponent(req.query.url)) + templates.footer);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user