File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 291
291
e .clearSelection ();
292
292
notificationElement .classList .add (' copy-success' )
293
293
notificationElement .textContent = successText;
294
+ fadeOffElement (notificationElement, 2000 );
294
295
});
295
296
clipboard .on (' error' , function (e ) {
296
297
var failureText = ' An error occured. Please use CTRL+C.' ;
297
298
298
299
notificationElement .classList .add (' copy-failure' )
299
300
notificationElement .textContent = failureText;
301
+ fadeOffElement (notificationElement, 2000 );
300
302
});
301
303
302
- window .setTimeout (function () {
303
- notificationElement .innerHTML = ' ' ;
304
- }, 2000 );
304
+ function fadeOffElement (element , delay ) {
305
+ setTimeout (function () {
306
+ resetElement (element);
307
+ }, delay);
308
+ }
309
+
310
+ function resetElement (element ) {
311
+ element .innerHTML = ' ' ;
312
+ element .className = ' ' ;
313
+ }
305
314
306
315
</script >
You can’t perform that action at this time.
0 commit comments