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

26 lines
884 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 () {
2018-03-20 20:18:03 +00:00
const param_rcp = getParameterByName('rcp')
2018-03-21 17:32:23 +00:00
if(param_rcp !== "" && param_rcp !== null && param_rcp !== undefined) {
2018-03-20 20:18:03 +00:00
const rcp_option = $('#recipient>option[value=' + param_rcp + ']');
2018-03-21 17:32:23 +00:00
console.log(param_rcp)
2018-03-20 20:18:03 +00:00
if(rcp_option.length === 1) {
2018-03-21 17:34:06 +00:00
console.log(rcp_option)
2018-03-20 20:18:03 +00:00
rcp_option.attr('selected', true);
$('#recipient_option_choose').removeAttr('selected');
$('select').material_select();
2018-03-21 17:34:06 +00:00
} else {
$('select').material_select();
2018-03-20 20:18:03 +00:00
}
} else {
$('select').material_select();
}
2018-03-18 18:37:59 +00:00
})