-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
51 lines (45 loc) · 1.62 KB
/
script.js
File metadata and controls
51 lines (45 loc) · 1.62 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
updateBorderRadius()
function updateBoxText() {
if (mode.innerHTML == 'Compact') {
boxText.innerHTML = `{\n border-radius: ${box.style.borderRadius};\n}`
} else {
boxText.innerHTML =
`{\n border-top-left-radius: ${box.style.borderTopLeftRadius};
border-top-right-radius: ${box.style.borderTopRightRadius};
border-bottom-right-radius: ${box.style.borderBottomRightRadius};
border-bottom-left-radius: ${box.style.borderBottomLeftRadius};
}`
}
}
function updateBorderRadius() {
if (simple.classList.contains("active")) {
box.style.borderRadius = `${topLeft.value}% ${topRight.value}% ${bottomRight.value}% ${bottomLeft.value}%`
} else {
box.style.borderRadius = `${topLeft.value}% ${topRight.value}% ${bottomRight.value}% ${bottomLeft.value}%/${topLeft2.value}% ${topRight2.value}% ${bottomRight2.value}% ${bottomLeft2.value}% `
}
updateBoxText()
}
function changeActive(element) {
if (element.classList.contains("active")) { return }
simple.classList.toggle("active")
complex.classList.toggle("active")
topLeft2.hidden = !topLeft2.hidden
topRight2.hidden = !topRight2.hidden
bottomRight2.hidden = !bottomRight2.hidden
bottomLeft2.hidden = !bottomLeft2.hidden
updateBorderRadius()
}
function copyToClipboard() {
var copyText = document.getElementById("boxText");
copyText.select();
copyText.setSelectionRange(0, 99999);
document.execCommand("copy");
}
function changeMode(){
if (mode.innerHTML == 'Detailed'){
mode.innerHTML = 'Compact'
} else {
mode.innerHTML = 'Detailed'
}
updateBoxText()
}