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

v1.18.x
psychobunny 12 years ago
parent 9e7afcf0ab
commit 6f6a2e4127

@ -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

@ -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;

@ -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>

@ -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;

Loading…
Cancel
Save