1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/limesurvey_ynh.git synced 2024-09-03 19:36:32 +02:00
limesurvey_ynh/sources/application/extensions/LimeScript/assets/script.js

50 lines
No EOL
1,003 B
JavaScript

// Initial definition of Limesurvey javascript object.
var LS = {};
LS.createUrl = function (route, params)
{
if (typeof params === 'undefined') {
params = {};
}
var result = LS.data.baseUrl;
if (result.indexOf('/', result.length - 1) === -1)
{
result = result + '/';
}
if (LS.data.showScriptName)
{
result = result + 'index.php';
}
if (LS.data.urlFormat == 'get')
{
// Configure route.
result += '?r=' + route;
// Configure params.
for (var key in params)
{
result = result + '&' + key+ '=' + params[key];
}
}
else
{
if (LS.data.showScriptName)
{
result = result + '/';
}
// Configure route.
result += route;
// Configure params.
for (var key in params)
{
result = result + '/' + key + '/' + params[key];
}
}
return result;
}