From 2699dddc4e39374b93c092e9ea471b4916aa0944 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 29 May 2015 11:04:09 +0000 Subject: [PATCH] fix selector for Mailvelope iframe under Firefox --- mail/js/app.js | 8 ++++---- phpgwapi/js/jsapi/app_base.js | 11 +++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index eb1a4618d6..1936ecbdf1 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -184,7 +184,7 @@ app.classes.mail = AppJS.extend( // Prepare display dialog for printing // copies iframe content to a DIV, as iframe causes // trouble for multipage printing - + jQuery('iframe#mail-display_mailDisplayBodySrc').one('load', function(e) { // encrypt body if mailvelope is available @@ -194,7 +194,7 @@ app.classes.mail = AppJS.extend( this.mail_isMainWindow = false; this.mail_display(); - + // Register attachments for drag this.register_for_drag( this.et2.getArrayMgr("content").getEntry('mail_id'), @@ -883,7 +883,7 @@ app.classes.mail = AppJS.extend( // show iframe, in case we hide it from mailvelopes one and remove that jQuery(IframeHandle.getDOMNode()).show() - .next('iframe[src^=chrome-extension]').remove(); + .next(this.mailvelope_iframe_selector).remove(); // Set up additional content that can be expanded. // We add a new URL widget for each address, so they get all the UI @@ -4534,7 +4534,7 @@ app.classes.mail = AppJS.extend( { self.et2.getWidgetById('mimeType').set_readonly(false); self.et2.getWidgetById('mail_plaintext').set_disabled(false); - jQuery('iframe[src^=chrome-extension]').remove(); + jQuery(self.mailvelope_iframe_selector).remove(); } else { diff --git a/phpgwapi/js/jsapi/app_base.js b/phpgwapi/js/jsapi/app_base.js index 070148c955..ef8cece435 100644 --- a/phpgwapi/js/jsapi/app_base.js +++ b/phpgwapi/js/jsapi/app_base.js @@ -881,6 +881,11 @@ var AppJS = Class.extend( */ mailvelope_keyring: undefined, + /** + * jQuery selector for Mailvelope iframes in all browsers + */ + mailvelope_iframe_selector: 'iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]', + /** * Open (or create) "egroupware" keyring and call callback with it * @@ -908,6 +913,8 @@ var AppJS = Class.extend( mailvelope.createKeyring('egroupware').then(function(_keyring) { self.mailvelope_keyring = _keyring; + var mvelo_settings_selector = self.mailvelope_iframe_selector + .split(',').map(function(_val){return 'body>'+_val;}).join(','); mailvelope.createSettingsContainer('body', _keyring, { email: self.egw.user('account_email'), @@ -915,7 +922,7 @@ var AppJS = Class.extend( }).then(function() { // make only Mailvelope settings dialog visible - jQuery('body > iframe[src^=chrome]').css({position: 'absolute', top: 0}); + jQuery(mvelo_settings_selector).css({position: 'absolute', top: 0}); // add a close button, so we know when to offer storing public key to AB jQuery('') .css({position: 'absolute', top: 8, right: 8}) @@ -925,7 +932,7 @@ var AppJS = Class.extend( self.mailvelope_keyring.exportOwnPublicKey(self.egw.user('account_email')).then(function(_pubKey) { // if yes, hide settings dialog - jQuery('body > iframe[src^=chrome]').remove(); + jQuery(mvelo_settings_selector).remove(); jQuery('button#mailvelope_close_settings').remove(); // offer user to store his public key to AB for other users to find var buttons = [