-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebscript.js
More file actions
63 lines (58 loc) · 1.65 KB
/
Copy pathwebscript.js
File metadata and controls
63 lines (58 loc) · 1.65 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
$(document).ready(function () {
refresh();
});
$(function () {
$('[data-bs-toggle="tooltip"]').tooltip();
});
$(function () {
$("#announcementbox").on("keyup", function () {
refresh();
});
$("#generator").on("click", function () {
$("#dataurl").val(
`<img src="${$("#outputimg").attr("src")}" style="width: 100%;"></img>`
);
});
$("#copybtn").on("click", function () {
navigator.clipboard.writeText($("#dataurl").val());
document.getElementById("dataurl").select();
$("#textappend").append(
`<p style="color: #41D274;" id="text">Copied to clipboard</p>`
);
});
$("#close").on("click", function () {
$("#text").remove();
});
});
$(function () {
$(
"#color1, #color2, #color3, #color4, #color5, #color6, #color7, #color8"
).on("click", function () {
$("#colorbox").val($(this).text().toLowerCase());
refresh();
});
$("#type1, #type2").on("click", function () {
if ($(this).text() == "Vertical") {
$("#outputimg").height("16rem").width("16rem");
} else {
$("#outputimg").width("100%");
}
$("#typebox").val($(this).text().toLowerCase());
refresh();
});
$("#bg1, #bg2").on("click", function () {
$("#bgbox").val($(this).text().toLowerCase());
refresh();
});
});
function refresh() {
$(function () {
let textv = $("#announcementbox").val(),
color = $("#colorbox").val(),
bg = $("#bgbox").val(),
type = $("#typebox").val();
textv = textv.replaceAll(" ", "%20");
var output = `http://md-announcements.vercel.app/api?type=${type}&theme=${color}&text=${textv}&background=${bg}`;
$("#outputimg").attr("src", output);
});
}