Skip to content

Node.js based forum software built for the modern web

closes #114. updated ajaxify to allow for get parameters to be passed in without issues.

psychobunny6f6a2e4127ec
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index 3aa10071b8..f9087966d0 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -35,13 +35,13 @@ var ajaxify = {};
url = url.slice(RELATIVE_PATH.length);
}
- var tpl_url = templates.get_custom_map(url);
+ var tpl_url = templates.get_custom_map(url.split('?')[0]);
if (tpl_url == false && !templates[url]) {
if(url === '' || url === '/') {
tpl_url = 'home';
} else {
- tpl_url = url.split('/')[0];
+ tpl_url = url.split('/')[0].split('?')[0];
}
} else if (templates[url]) {
@@ -75,10 +75,6 @@ var ajaxify = {};
return false;
}
- ajaxify.onclick = function(ev) {
-
- }
-
$('document').ready(function() {
if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers
diff --git a/public/src/templates.js b/public/src/templates.js
index 6ebeab82d3..79395b5cf1 100644
--- a/public/src/templates.js
+++ b/public/src/templates.js
@@ -106,7 +106,7 @@
}
templates.getTemplateNameFromUrl = function(url) {
- var parts = url.split('/');
+ var parts = url.split('?')[0].split('/');
for(var i=0; i<parts.length; ++i) {
if (templates.is_available(parts[i])) {
@@ -123,7 +123,7 @@
var api_url = (url === '' || url === '/') ? 'home' : url;
- var tpl_url = templates.get_custom_map(api_url);
+ var tpl_url = templates.get_custom_map(api_url.split('?')[0]);
var trimmed = api_url;
diff --git a/public/templates/outgoing.tpl b/public/templates/outgoing.tpl
index c4c6a065ae..cd27b3a682 100644
--- a/public/templates/outgoing.tpl
+++ b/public/templates/outgoing.tpl
@@ -5,7 +5,7 @@
</p>
<br />
<p>
- <button class="btn btn-large" type="button" onclick="window.location='{url}'">Continue to {url}</button>
- <button class="btn btn-large btn-inverse" type="button" onclick="history.go(-1); window.location='{home}'">Return to NodeBB</button>
+ <a href="{url}" rel="nofollow" class="btn btn-large">Continue to {url}</a>
+ <a href="{home}" class="btn btn-large btn-inverse">Return to NodeBB</a>
</p>
</div>
\ No newline at end of file
diff --git a/src/webserver.js b/src/webserver.js
index 911a9a154e..3c692a5812 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -413,6 +413,19 @@ var express = require('express'),
}
});
break;
+ case 'outgoing' :
+ var url = req.url.split('?');
+
+ if (url[1]) {
+ res.json({
+ url: url[1],
+ home: global.nconf.get('url')
+ });
+ } else {
+ res.status(404);
+ res.redirect(global.nconf.get('relative_path') + '/404');
+ }
+ break;
default :
res.json(404, { error: 'unrecognized API endpoint' });
break;