From 5d168aa4d8512b16aa40716040aeba1fc8a69984 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 15 Jan 2012 18:05:07 +0100 Subject: [PATCH] Only enable copy icon when there is actually a selection --- php-console.js | 6 +++++- styles.css | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/php-console.js b/php-console.js index f25e2c4..995a43d 100644 --- a/php-console.js +++ b/php-console.js @@ -33,9 +33,13 @@ */ prepareClippyButton = function(e) { var selection = editor.getSession().doc.getTextRange(editor.getSelectionRange()); + if (!selection) { + $('.statusbar .copy').hide(); + return; + } $('#clippy embed').attr('FlashVars', 'text=' + selection); $('#clippy param[name="FlashVars"]').attr('value', 'text=' + selection); - $('.statusbar .copy').html($('.statusbar .copy').html()); + $('.statusbar .copy').html($('.statusbar .copy').html()).show(); }; /** diff --git a/styles.css b/styles.css index b58526d..ba1f2c1 100644 --- a/styles.css +++ b/styles.css @@ -48,6 +48,7 @@ a { .statusbar .copy { margin-left: 50px; + display: none; } #clippy { position: relative;