diff --git a/assets/js/kontakt.js b/assets/js/kontakt.js index 71f76e0..f18bb3a 100644 --- a/assets/js/kontakt.js +++ b/assets/js/kontakt.js @@ -1,3 +1,22 @@ +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, " ")); +} $(function () { - $('select').material_select(); + const param_rcp = getParameterByName('rcp') + if(param_rcp !== "") { + const rcp_option = $('#recipient>option[value=' + param_rcp + ']'); + if(rcp_option.length === 1) { + rcp_option.attr('selected', true); + $('#recipient_option_choose').removeAttr('selected'); + $('select').material_select(); + } + } else { + $('select').material_select(); + } }) \ No newline at end of file diff --git a/kontakt.html b/kontakt.html index 020fc20..7afeed0 100644 --- a/kontakt.html +++ b/kontakt.html @@ -13,8 +13,9 @@ permalink: '/kontakt/'