-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslyp.html
More file actions
126 lines (102 loc) · 6.2 KB
/
Copy pathslyp.html
File metadata and controls
126 lines (102 loc) · 6.2 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html lang="en">
<head>
<title>Slyp</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"></script>
<link rel="icon" href="./img/favicon.png" type="image/x-icon" />
<link rel="stylesheet" href="./css/spotify.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body style="background-color:#23252E;">
<div class="container" >
<h2 style="font-size: 70px;color:white;" class="spotifytext">Lyrics Card Maker</h2>
<div class="main-div" >
<!-- -------------------CANVAS------------------ -->
<div class="rect-default" id="rect" style="border-radius:20px; width: 500px; height: fit-content;">
<div class="content-rect">
<div class="songs-info">
<p id="output2"><img src="https://via.placeholder.com/80"id="output"style="width:80px;
height:80px; object-fit: cover;";/> </p>
<div style="display: flex; flex-direction: column; margin-left: 20px">
<h1 id="text-name" spellcheck="false" contenteditable="true" style="width: 350px; outline: 0px solid transparent;">Insert Name Song</h1>
<h3 contenteditable="true" spellcheck="false" id="text-author" style="font-size: 15px; width: 360px; outline: 0px solid transparent;">Insert Author</h3>
</div>
</div>
<h2 id="text-lyric" spellcheck="false" style="width: 480px; margin-bottom: 20px; outline: 0px solid transparent;"contenteditable="true">
Click to edit<br>
Press enter to insert new lines<br>
Or just paste some text</h2>
</div>
</div>
<!-- -------------------OPZIONI------------------ -->
<div class="parent">
<div class="div1">
<p style="height:fit-content;color:white;"><input id="pick-file" type="file" accept="image/*" name="image" id="file"
onchange="loadFile(event)""></p>
</div>
<div class=" div2">
<h3 style="font-size: 20px;color:white;">Change border radius: </h3>
<input type="range" class="form-range" value="20" min="0" max="20" step="1" id="border">
</div>
<div class="div3">
<h3 style="font-size: 20px;color:white;">Change text color: </h3>
<input id="color-text" type="color" value="#FFFFFF" />
</div>
<div class="div4">
<button type="button" id="download" class="btn btn-info" style="height: fit-content;background-color:#277EE2;">Save as Image</button>
</div>
<div class="div5">
<h3 style="font-size: 20px;color:white;">Change card color: </h3>
<input id="color-card" type="color" value="#277EE2" />
</div>
</div>
</div>
</div>
</div>
<!-- -------------------SCRIPT------------------ -->
<script>
document.getElementById("color-card").addEventListener("input", function ()
{
document.getElementById("rect").style.backgroundColor = this.value;
})
document.getElementById("color-text").addEventListener("input", function ()
{
document.getElementById("text-name").style.color = this.value;
document.getElementById("text-lyric").style.color = this.value;
document.getElementById("text-author").style.color = this.value;
})
</script>
<script>
var loadFile = function (event) {
var image = document.getElementById('output');
image.src = URL.createObjectURL(event.target.files[0]);
image.hidden = false
};
</script>
<script>
$("#download").on("click", function () {
html2canvas(document.querySelector("#rect"), { backgroundColor: null }, { scale: window.devicePixelRatio }).then(canvas => {
canvas.toBlob(function (blob) {
// Generate file download
var h1content = document.getElementById("text-name").innerHTML;
var newTitle = h1content.replace(/(<([^>]+)>)/ig, "");
newTitle += ".png";
window.saveAs(blob, newTitle);
});
});
});
</script>
<script>
document.getElementById("border").addEventListener("input", function ()
{
document.getElementById("rect").style.borderRadius = this.value +"px"
console.log(this.value)
console.log(document.getElementById("rect").style.borderRadius)
document.getElementById("canvas").style.borderRadius = this.value + "px"
})
</script>
</body>
</html>