forked from devadvance/terminalcheatsheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copier.html
64 lines (58 loc) · 1.47 KB
/
copier.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
<!DOCTYPE html>
<html>
<head>
<style>
/* so button can go to edge */
body {
margin: 0;
font-family: Sans-Serif;
}
button#copy {
position: relative;
font-family: "Roboto", sans-serif;
font-weight: 600;
font-size: 110%;
background: #ffccbc;
color: #212121;
display: block;
text-transform: uppercase;
border: none;
border-radius: 2px;
cursor: pointer;
}
button span:after {
content: "Copied!";
right: 10px;
background: #ffccbc;
position: absolute;
opacity: 0;
}
button span:active:after {
margin-left: -20px;
padding: 0;
margin: 0;
opacity: 1;
transition: 0s
}
/* cursor/size for within iframe */
button#copy {
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<button id="copy"><span></span>Copy</button>
<input type="text" id="_i" hidden />
<script>
copy.onclick = function () {
_i.value = window.decodeURIComponent(window.location.hash.substr(1));
_i.hidden = false;
_i.select();
_i.focus();
document.execCommand('copy');
_i.hidden = true;
_i.value = '';
};
</script>
</body>