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

Enable copy, tweak icon (#676)

This commit is contained in:
Barry vd. Heuvel 2024-09-10 17:59:08 +02:00 committed by GitHub
parent 4eb7fd73a1
commit ce4762b069
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -57,6 +57,10 @@ div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id:before {
} }
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before { div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before {
content: "\f0c5"; content: "\f0c5";
line-height: 1.5;
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard-check:before {
content: "\f46c";
} }
div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-editor-link:before { div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-editor-link:before {
content: "\f08e"; content: "\f08e";

View File

@ -21,7 +21,10 @@
var copy = function () { var copy = function () {
try { try {
document.execCommand('copy'); document.execCommand('copy');
alert('Query copied to the clipboard'); $(el).addClass(csscls('copy-clipboard-check'));
setTimeout(function(){
$(el).removeClass(csscls('copy-clipboard-check'));
}, 2000)
} catch (err) { } catch (err) {
console.log('Oops, unable to copy'); console.log('Oops, unable to copy');
} }
@ -116,7 +119,7 @@
li.addClass(csscls('error')); li.addClass(csscls('error'));
li.append($('<span />').addClass(csscls('error')).text("[" + stmt.error_code + "] " + stmt.error_message)); li.append($('<span />').addClass(csscls('error')).text("[" + stmt.error_code + "] " + stmt.error_message));
} }
if ((!stmt.type || stmt.type === 'query') && stmt.show_copy !== false) { if ((!stmt.type || stmt.type === 'query')) {
$('<span title="Copy to clipboard" />') $('<span title="Copy to clipboard" />')
.addClass(csscls('copy-clipboard')) .addClass(csscls('copy-clipboard'))
.css('cursor', 'pointer') .css('cursor', 'pointer')