2017-11-26 03:03:53 +01:00
|
|
|
/* global $ */
|
|
|
|
(function () {
|
|
|
|
"use strict";
|
|
|
|
function updateQueryParameters() {
|
|
|
|
let baseURL = window.location.origin + "/embed/" + $("#queryparam_guildid").val();
|
|
|
|
let inputs = $("input.queryparam");
|
|
|
|
let url = baseURL;
|
|
|
|
for (let i = 0; i < inputs.length; i++) {
|
|
|
|
let input = $(inputs[i]);
|
|
|
|
let name = input.attr("name");
|
2020-03-23 02:06:49 +01:00
|
|
|
let value = input.val().trim();
|
2017-11-26 03:03:53 +01:00
|
|
|
if (!value) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!url.includes("?")) {
|
|
|
|
url += "?";
|
|
|
|
} else {
|
|
|
|
url += "&";
|
|
|
|
}
|
2020-03-23 02:06:49 +01:00
|
|
|
if (value.startsWith(`${name}=`)) {
|
|
|
|
value = value.substr(name.length + 1);
|
|
|
|
}
|
2017-11-26 03:03:53 +01:00
|
|
|
url += `${name}=${value}`;
|
|
|
|
}
|
|
|
|
$("#queryparam_url").val(url);
|
2018-04-26 05:19:40 +02:00
|
|
|
$("#queryparam_iframe").val("<iframe src=\"" + url + "\" height=\"600\" width=\"800\" frameborder=\"0\"></iframe>");
|
2017-11-26 03:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
$("input.queryparam").change(updateQueryParameters);
|
|
|
|
$("#queryparam_guildid").change(updateQueryParameters);
|
2018-04-26 05:19:40 +02:00
|
|
|
updateQueryParameters();
|
2017-11-26 03:03:53 +01:00
|
|
|
});
|
|
|
|
})();
|