File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 243
243
button {
244
244
padding :5px ;
245
245
}
246
-
247
246
@media only screen and (min-width : 500px ) {
248
247
.action { @include flex (2 ); display : block ; }
249
248
code { @include flex (8 ); }
250
249
}
251
250
}
251
+ .copy-result {
252
+ text-align :right ;
253
+
254
+ span {
255
+ font-size :80% ;
256
+ font-weight :bold ;
257
+ }
258
+ .copy-success {
259
+ color :$link-color ;
260
+ }
261
+ .copy-failure {
262
+ color :red ;
263
+ }
252
264
265
+ }
253
266
.last-update {
254
267
color : $main-color-light ;
255
268
font-size : 90% ;
Original file line number Diff line number Diff line change 62
62
<img src =" /assets/copy.svg" alt =" Copy to clipboard" height =" 25px" />
63
63
</button >
64
64
</div >
65
+ <div class =" copy-result" >
66
+ <span id =" copy-notification" ></span >
67
+ </div >
65
68
</div >
66
69
<div class =' authorship' >
67
70
<div class =' top' >
281
284
}
282
285
283
286
var clipboard = new Clipboard (' #crate-download-button' );
287
+ var notificationElement = document .getElementById (' copy-notification' );
284
288
clipboard .on (' success' , function (e ) {
289
+ var successText = ' Copied !' ;
290
+
285
291
e .clearSelection ();
286
- // TODO : Add a tooltip to notify the user that it's copied
292
+ notificationElement .classList .add (' copy-success' )
293
+ notificationElement .textContent = successText;
287
294
});
288
295
clipboard .on (' error' , function (e ) {
289
- // TODO : Add a tooltip to notify the user that the copy failed, so he will have to use CTRL+C
296
+ var failureText = ' An error occured. Please use CTRL+C.' ;
297
+
298
+ notificationElement .classList .add (' copy-failure' )
299
+ notificationElement .textContent = failureText;
290
300
});
291
301
302
+ window .setTimeout (function () {
303
+ notificationElement .innerHTML = ' ' ;
304
+ }, 2000 );
305
+
292
306
</script >
You can’t perform that action at this time.
0 commit comments