From a0e9e52e70a30d714672144ef32030e061030543 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 23 Jan 2014 15:16:30 -0500 Subject: [PATCH 1/7] adding xregexp to ACP header --- public/templates/admin/header.tpl | 2 ++ 1 file changed, 2 insertions(+) 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 @@ + + '; + return ''; }; app.namespace(nconf.get('relative_path'), function () { @@ -648,7 +648,7 @@ if(nconf.get('ssl')) { res.send( data.header + '\n\t' + - '\n\t' + + '\n\t' + templates.footer ); }); @@ -763,7 +763,7 @@ if(nconf.get('ssl')) { res.send( data.header + '\n\t' + - '\n\t' + + '\n\t' + templates.footer ); }); @@ -774,7 +774,7 @@ if(nconf.get('ssl')) { req: req, res: res }, function (err, header) { - res.send(header + '' + templates.footer); + res.send(header + '' + templates.footer); }); }); @@ -847,7 +847,7 @@ if(nconf.get('ssl')) { }, function (err, header) { res.send( header + - '\n\t' + + '\n\t' + templates.footer ); }); From 43808c01ecb0cacb329e6ae6013c7c13554fefb9 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 24 Jan 2014 10:00:57 -0500 Subject: [PATCH 6/7] reduced the number of 'ajaxify.go' calls to one, in /src --- src/webserver.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/webserver.js b/src/webserver.js index 0a81db656f..615a3e44c8 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -400,7 +400,11 @@ if(nconf.get('ssl')) { }; app.create_route = function (url, tpl) { // to remove - return ''; + var routerScript = ''; + + return routerScript; }; app.namespace(nconf.get('relative_path'), function () { @@ -648,8 +652,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 +766,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 +776,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 +847,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); }); }); From 459d5ddccdb185734ce7a5509f7b005b12ebaa66 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 24 Jan 2014 10:09:28 -0500 Subject: [PATCH 7/7] fixed #867 - added proper detection so that onpopstate would not react if it was a proper page load --- public/src/ajaxify.js | 3 ++- src/webserver.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 86a9c7062a..2f180dde73 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -23,7 +23,7 @@ var ajaxify = {}; window.onpopstate = function (event) { - 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); } }; @@ -31,6 +31,7 @@ var ajaxify = {}; var pagination, paginator_bar; ajaxify.currentPage = null; + ajaxify.initialLoad = false; ajaxify.go = function (url, callback, quiet) { // "quiet": If set to true, will not call pushState diff --git a/src/webserver.js b/src/webserver.js index 615a3e44c8..bf31fd22f4 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -401,6 +401,7 @@ if(nconf.get('ssl')) { app.create_route = function (url, tpl) { // to remove var routerScript = '';