mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 16:30:34 +01:00
closes #114. updated ajaxify to allow for get parameters to be passed in without issues.
This commit is contained in:
@@ -35,13 +35,13 @@ var ajaxify = {};
|
|||||||
url = url.slice(RELATIVE_PATH.length);
|
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 (tpl_url == false && !templates[url]) {
|
||||||
if(url === '' || url === '/') {
|
if(url === '' || url === '/') {
|
||||||
tpl_url = 'home';
|
tpl_url = 'home';
|
||||||
} else {
|
} else {
|
||||||
tpl_url = url.split('/')[0];
|
tpl_url = url.split('/')[0].split('?')[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (templates[url]) {
|
} else if (templates[url]) {
|
||||||
@@ -75,10 +75,6 @@ var ajaxify = {};
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ajaxify.onclick = function(ev) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$('document').ready(function() {
|
$('document').ready(function() {
|
||||||
if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers
|
if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
templates.getTemplateNameFromUrl = function(url) {
|
templates.getTemplateNameFromUrl = function(url) {
|
||||||
var parts = url.split('/');
|
var parts = url.split('?')[0].split('/');
|
||||||
|
|
||||||
for(var i=0; i<parts.length; ++i) {
|
for(var i=0; i<parts.length; ++i) {
|
||||||
if (templates.is_available(parts[i])) {
|
if (templates.is_available(parts[i])) {
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
|
|
||||||
var api_url = (url === '' || url === '/') ? 'home' : url;
|
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;
|
var trimmed = api_url;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p>
|
||||||
<button class="btn btn-large" type="button" onclick="window.location='{url}'">Continue to {url}</button>
|
<a href="{url}" rel="nofollow" class="btn btn-large">Continue to {url}</a>
|
||||||
<button class="btn btn-large btn-inverse" type="button" onclick="history.go(-1); window.location='{home}'">Return to NodeBB</button>
|
<a href="{home}" class="btn btn-large btn-inverse">Return to NodeBB</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -413,6 +413,19 @@ var express = require('express'),
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
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 :
|
default :
|
||||||
res.json(404, { error: 'unrecognized API endpoint' });
|
res.json(404, { error: 'unrecognized API endpoint' });
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user