summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/BugModal/web/bug_modal.js42
1 files changed, 30 insertions, 12 deletions
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