From 5297b573916313453abfc16db9200a6a2be71464 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 17 Jun 2015 11:26:56 +0800 Subject: Bug 1149593: Hovering over "Copy Summary" changes the button to a grey box --- extensions/BugModal/web/bug_modal.js | 42 +++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'extensions/BugModal/web') diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index a0f83803f..8ff4b2921 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -163,19 +163,37 @@ $(function() { // copy summary to clipboard if ($('#copy-summary').length) { - var zero = new ZeroClipboard($('#copy-summary')); - zero.on({ - 'error': function(event) { - console.log(event.message); - zero.destroy(); - $('#copy-summary').hide(); - }, - 'copy': function(event) { - var clipboard = event.clipboardData; - clipboard.setData('text/plain', 'Bug ' + BUGZILLA.bug_id + ' - ' + $('#field-value-short_desc').text()); - } - }); + // we don't know if flash is enabled without waiting for load to timeout + // remember the flash enabled state between pages + var hasFlash = true; + if (localStorage.getItem('hasFlash') === null) { + $('#copy-summary').hide(); + } + else { + hasFlash = localStorage.getItem('hasFlash'); + } + if (hasFlash) { + ZeroClipboard.config({ flashLoadTimeout: 5000 }); + var zero = new ZeroClipboard($('#copy-summary')); + zero.on({ + 'ready': function(event) { + $('#copy-summary').show(); + localStorage.setItem('hasFlash', true); + }, + 'error': function(event) { + console.log(event.message); + zero.destroy(); + $('#global-zeroclipboard-html-bridge').remove(); + $('#copy-summary').hide(); + localStorage.removeItem('hasFlash'); + }, + 'copy': function(event) { + var clipboard = event.clipboardData; + clipboard.setData('text/plain', 'Bug ' + BUGZILLA.bug_id + ' - ' + $('#field-value-short_desc').text()); + } + }); + } } // lightboxes -- cgit v1.2.3-24-g4f1b