-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
90 lines (84 loc) · 2.41 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>RatioBar</title>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<style>
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
.copied {
transform: translateY(100%);
transition: all 300ms;
}
.copied.show {
transform: translateY(0);
}
</style>
</head>
<body class="overflow-hidden">
<div id="app">
<div class="flex h-screen">
<div class="m-3">
<input type="number"
class="w-full h-full bg-gray-200 rounded text-center outline-none focus:shadow-outline focus:bg-blue-100"
@dblclick="copyToClipboard" v-model="a">
</div>
<div class="flex items-center">:</div>
<div class="m-3">
<input type="number"
class="w-full h-full bg-gray-200 rounded text-center outline-none focus:shadow-outline focus:bg-blue-100"
@dblclick="copyToClipboard" v-model="b">
</div>
<div class="flex items-center">=</div>
<div class="m-3">
<input type="number"
class="w-full h-full bg-gray-200 rounded text-center outline-none focus:shadow-outline focus:bg-blue-100"
@dblclick="copyToClipboard" v-model="c">
</div>
<div class="flex items-center">:</div>
<div class="m-3">
<input type="number"
class="w-full h-full bg-gray-200 rounded text-center outline-none focus:shadow-outline focus:bg-blue-100"
@dblclick="copyToClipboard" v-model="d">
</div>
</div>
<div ref="copied"
class="copied absolute top-0 left-0 h-screen w-screen bg-green-500 flex items-center justify-center">
<p class="text-white">
Copied to Clipboard!
</p>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script>
new Vue({
el: '#app',
data() {
return {
a: 16,
b: 9,
c: 1280
}
},
computed: {
d() {
return (this.c * this.b) / this.a
}
},
methods: {
copyToClipboard() {
document.execCommand('copy')
this.$refs.copied.classList.add('show')
setTimeout(() => {
this.$refs.copied.classList.remove('show')
}, 1500)
}
}
})
</script>
</body>
</html>