-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
39 lines (36 loc) · 1.26 KB
/
Copy pathscript.js
File metadata and controls
39 lines (36 loc) · 1.26 KB
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
function manual_hash_block() {
if (document.querySelector('[value="set-short-manually"]').checked) {
document.getElementById("manual-hash-block").style.display = "block";
} else {
document.getElementById("manual-hash-block").style.display = "none";
}
}
jQuery(document).ready(function () {
manual_hash_block();
});
document.querySelector('[value="set-short-manually"]').onclick = manual_hash_block;
jQuery("form").submit(function (event) {
event.preventDefault();
jQuery.get(
"/generate.php",
{
url: jQuery(this).find("#inputURL").val(),
setShort: jQuery(this).find("#inputSetShort").is(":checked"),
short: jQuery(this).find("#inputShort").val(),
}
)
.always(function () {
jQuery("#answer div").hide();
})
.done(function (data) {
let answer = JSON.parse(data);
if (answer.type === "error") {
jQuery("#answer div.alert-danger").html(answer.text).show();
} else {
jQuery("#answer div.alert-success").html(answer.text).show();
}
})
.fail(function () {
jQuery("#answer div.alert-danger").html("Unknown network error").show();
});
});