1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-16 21:08:34 +01:00

Check copy result (#678)

This commit is contained in:
Barry vd. Heuvel 2024-09-10 19:39:33 +02:00 committed by GitHub
parent 0143b7c17d
commit 0b40a63e63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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