1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-24 02:01:30 +02:00

Check copy result

This commit is contained in:
Barry vd. Heuvel
2024-09-10 19:38:41 +02:00
parent 0143b7c17d
commit ae8ec7f251

View File

@@ -20,11 +20,12 @@
var code = $(el).parent('li').find('code').get(0);
var copy = function () {
try {
document.execCommand('copy');
$(el).addClass(csscls('copy-clipboard-check'));
setTimeout(function(){
$(el).removeClass(csscls('copy-clipboard-check'));
}, 2000)
if (document.execCommand('copy')) {
$(el).addClass(csscls('copy-clipboard-check'));
setTimeout(function(){
$(el).removeClass(csscls('copy-clipboard-check'));
}, 2000)
}
} catch (err) {
console.log('Oops, unable to copy');
}