freifunk-rhein-sieg.net/assets/js/kontakt.js

25 lines
815 B
JavaScript
Raw Normal View History

2018-03-20 20:18:03 +00:00
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
2018-03-18 18:37:59 +00:00
$(function () {
var param_rcp = getParameterByName('rcp');
2018-03-21 17:32:23 +00:00
if(param_rcp !== "" && param_rcp !== null && param_rcp !== undefined) {
var rcp_option = $('#recipient>option[value=' + param_rcp + ']');
2018-03-20 20:18:03 +00:00
if(rcp_option.length === 1) {
rcp_option.attr('selected', true);
$('#recipient_option_choose').removeAttr('selected');
$('select').formSelect();
2018-03-21 17:34:06 +00:00
} else {
$('select').formSelect();
2018-03-20 20:18:03 +00:00
}
} else {
$('select').formSelect();
2018-03-20 20:18:03 +00:00
}
});