-
Notifications
You must be signed in to change notification settings - Fork 0
/
konfigurator.js
43 lines (39 loc) · 1.66 KB
/
konfigurator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$(document).ready(function () {
$("#jahr").text(new Date().getFullYear());
const titel_input = $("#titel");
const bgcolor_input = $("#bgcolor");
const logo_url_input = $("#logo_url");
const erstellen_button = $("#erstellen");
const result_container = $("#result_container");
const preview_container = $("#preview_container");
const preview_iframe = $("#preview_iframe");
const result_url = $("#result_url");
const result_iframe = $("#result_iframe");
erstellen_button.click(function () {
let rechnertyp = $("input:radio[name='auswahl_rechner_angabe']:checked").val();
let url = "";
if (rechnertyp === "auswahl_rechner_einkauf") {
url = "https://ivdresearch.github.io/rechner/einkaufsrechner.html?";
} else if (rechnertyp === "auswahl_rechner_leistbarkeit") {
url = "https://ivdresearch.github.io/rechner/rechner.html?";
} else {
return;
}
let params = ["footer=false"];
let titel = titel_input.val();
if (titel.length > 0) {
params.push("titel=" + encodeURIComponent(titel));
}
let bgcolor = bgcolor_input.val();
params.push("bgcolor=" + encodeURIComponent(bgcolor));
let logo_url = logo_url_input.val();
params.push("logo_url=" + encodeURIComponent(logo_url));
url = url.concat(params.join("&"));
let iframe = '<iframe src="' + url + '" style="width:100%; height:800px"></iframe>'
result_url.val(url);
result_iframe.val(iframe);
result_container.show();
preview_iframe.html(iframe);
preview_container.show();
});
});