42 lines
1.2 KiB
HTML
42 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8" />
|
|
|
|
<h1>Build a webhook!</h1>
|
|
|
|
<form>
|
|
<input type="text" name="k1" placeholder="k1" />
|
|
<textarea name="v1" placeholder="v1"></textarea><br />
|
|
<input type="text" name="k2" placeholder="k2" />
|
|
<textarea name="v2" placeholder="v2"></textarea><br />
|
|
<input type="text" name="k3" placeholder="k3" />
|
|
<textarea name="v3" placeholder="v3"></textarea><br />
|
|
<input type="text" name="k4" placeholder="k4" />
|
|
<textarea name="v4" placeholder="v4"></textarea><br />
|
|
<input type="text" name="k5" placeholder="k5" />
|
|
<textarea name="v5" placeholder="v5"></textarea><br />
|
|
<button>Build URL</button>
|
|
</form>
|
|
|
|
<input id="output" readonly />
|
|
|
|
<script>
|
|
const form = document.querySelector("form");
|
|
const output = document.querySelector("#output");
|
|
form.addEventListener("submit", (event) => {
|
|
event.preventDefault();
|
|
|
|
let url = new URL(location.href);
|
|
url.pathname = "/webhook";
|
|
for (let i = 1; i < 6; i++) {
|
|
const [key, value] = [
|
|
event.target[`k${i}`].value,
|
|
event.target[`v${i}`].value,
|
|
];
|
|
if (key) url.searchParams.set(key, value);
|
|
}
|
|
|
|
output.value = url;
|
|
|
|
return false;
|
|
});
|
|
</script>
|