-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
240 lines (219 loc) · 8.12 KB
/
demo.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<!doctype html>
<html>
<head>
<title>cp-clipboard Demo</title>
<script src="../platform/platform.js"></script>
<link rel="import" href="cp-clipboard.html">
<style>
.global-zeroclipboard-container embed {
outline: none;
}
/* Example 3 (button) */
#ex3 button {
border-radius: 3px;
border: 0;
cursor: pointer;
padding: 10px;
background: #eee;
}
#ex3.hover button {
background: #777;
color: white;
}
#ex3.active button {
background: green;
}
/* Example 5 (cube) */
/* http://desandro.github.io/3dtransforms/docs/cube.html */
#ex5 {
margin-left: 10px;
}
.cube-container {
width: 200px;
height: 200px;
position: relative;
border: none;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
-o-perspective: 1000px;
perspective: 1000px;
}
.cube {
width: 100%;
height: 100%;
position: absolute;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transition: -webkit-transform 1s;
-moz-transition: -moz-transform 1s;
-o-transition: -o-transform 1s;
transition: transform 1s;
}
.cube figure {
display: block;
position: absolute;
width: 196px;
height: 196px;
border: 2px solid black;
line-height: 196px;
font-weight: bold;
color: white;
text-align: center;
margin: 0;
}
.cube.panels-backface-invisible figure {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
.cube .front { background: hsla( 0, 100%, 50%, 0.7 ); }
.cube .back { background: hsla( 60, 100%, 50%, 0.7 ); color: black;}
.cube .right { background: hsla( 120, 100%, 50%, 0.7 ); }
.cube .left { background: hsla( 180, 100%, 50%, 0.7 ); color: black;}
.cube .top { background: hsla( 240, 100%, 50%, 0.7 ); }
.cube .bottom { background: hsla( 300, 100%, 50%, 0.7 ); }
.cube .front {
-webkit-transform: translateZ( 100px );
-moz-transform: translateZ( 100px );
-o-transform: translateZ( 100px );
transform: translateZ( 100px );
}
.cube .back {
-webkit-transform: rotateX( -180deg ) translateZ( 100px );
-moz-transform: rotateX( -180deg ) translateZ( 100px );
-o-transform: rotateX( -180deg ) translateZ( 100px );
transform: rotateX( -180deg ) translateZ( 100px );
}
.cube .right {
-webkit-transform: rotateY( 90deg ) translateZ( 100px );
-moz-transform: rotateY( 90deg ) translateZ( 100px );
-o-transform: rotateY( 90deg ) translateZ( 100px );
transform: rotateY( 90deg ) translateZ( 100px );
}
.cube .left {
-webkit-transform: rotateY( -90deg ) translateZ( 100px );
-moz-transform: rotateY( -90deg ) translateZ( 100px );
-o-transform: rotateY( -90deg ) translateZ( 100px );
transform: rotateY( -90deg ) translateZ( 100px );
}
.cube .top {
-webkit-transform: rotateX( 90deg ) translateZ( 100px );
-moz-transform: rotateX( 90deg ) translateZ( 100px );
-o-transform: rotateX( 90deg ) translateZ( 100px );
transform: rotateX( 90deg ) translateZ( 100px );
}
.cube .bottom {
-webkit-transform: rotateX( -90deg ) translateZ( 100px );
-moz-transform: rotateX( -90deg ) translateZ( 100px );
-o-transform: rotateX( -90deg ) translateZ( 100px );
transform: rotateX( -90deg ) translateZ( 100px );
}
.cube.show-front {
-webkit-transform: translateZ( -100px );
-moz-transform: translateZ( -100px );
-o-transform: translateZ( -100px );
transform: translateZ( -100px );
}
.cube.show-back {
-webkit-transform: translateZ( -100px ) rotateX( -180deg );
-moz-transform: translateZ( -100px ) rotateX( -180deg );
-o-transform: translateZ( -100px ) rotateX( -180deg );
transform: translateZ( -100px ) rotateX( -180deg );
}
.cube.show-right {
-webkit-transform: translateZ( -100px ) rotateY( -90deg );
-moz-transform: translateZ( -100px ) rotateY( -90deg );
-o-transform: translateZ( -100px ) rotateY( -90deg );
transform: translateZ( -100px ) rotateY( -90deg );
}
.cube.show-left {
-webkit-transform: translateZ( -100px ) rotateY( 90deg );
-moz-transform: translateZ( -100px ) rotateY( 90deg );
-o-transform: translateZ( -100px ) rotateY( 90deg );
transform: translateZ( -100px ) rotateY( 90deg );
}
.cube.show-top {
-webkit-transform: translateZ( -100px ) rotateX( -90deg );
-moz-transform: translateZ( -100px ) rotateX( -90deg );
-o-transform: translateZ( -100px ) rotateX( -90deg );
transform: translateZ( -100px ) rotateX( -90deg );
}
.cube.show-bottom {
-webkit-transform: translateZ( -100px ) rotateX( 90deg );
-moz-transform: translateZ( -100px ) rotateX( 90deg );
-o-transform: translateZ( -100px ) rotateX( 90deg );
transform: translateZ( -100px ) rotateX( 90deg );
}
.cube.panels-backface-invisible figure {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
</style>
</head>
<body unresolved>
<h1>A `cp-clipboard` looks like this:</h1>
<h2>Example 1 : Basic</h2>
<cp-clipboard id="ex1" value="Example 1">Click here to copy</cp-clipboard>
<h2>Example 2 : Custom content</h2>
<cp-clipboard id="ex2" value="Example 2"><img src="http://lorempixel.com/100/100/abstract/1/" alt="img" title="Click here to copy"></cp-clipboard>
<h2>Example 3 : Styling and mouse detection</h2>
<cp-clipboard id="ex3" value="Example 3"><button>Click here to copy</button></cp-clipboard>
<h2>Example 4 : Dynamically change value to copy</h2>
<p><input id="ex4-input" type="text"><button id="ex4-btn">Change to this value</button></p>
<cp-clipboard id="ex4" value="Example 4"><button>Click here to copy</button></cp-clipboard>
<script>
var ex4 = document.getElementById('ex4'),
input = document.getElementById('ex4-input'),
btn = document.getElementById('ex4-btn');
btn.addEventListener('click', function(e) {
ex4.value = input.value;
});
ex4.addEventListener('value-changed', function(e) {
console.log('ex4 value changed : ' + e.detail.value);
});
</script>
<h2>Example 5 : Events</h2>
<cp-clipboard id="ex5" value="Example 5">
<div class="cube-container">
<div id="cube" class="cube panels-backface-invisible">
<figure class="front">Hover here!</figure>
<figure class="back">Click to copy!</figure>
<figure class="right"></figure>
<figure class="left">Copied !</figure>
<figure class="top"></figure>
<figure class="bottom"></figure>
</div>
</div>
</cp-clipboard>
<script>
// Example 5 (cube)
var ex5 = document.getElementById('ex5'),
cube = document.getElementById('cube');
ex5.addEventListener('state-changed', function(e) {
var cls = 'cube panels-backface-invisible',
state = e.detail.state;
if (!state) {
console.log('ex5', 'mouseout')
cls += ' show-front';
}
else if (-1 !== cube.className.indexOf('show-left')) {
return; // Copied state handled in `copy-complete` event
}
else if (-1 !== state.indexOf('hover')) {
console.log('ex5', 'mouseover')
cls += ' show-back';
}
cube.className = cls;
});
ex5.addEventListener('copy-complete', function(e) {
console.log('ex5', 'copy-complete')
cube.className = 'cube panels-backface-invisible show-left';
});
</script>
</body>
</html>