Index: firstRun.js |
=================================================================== |
--- a/firstRun.js |
+++ b/firstRun.js |
@@ -7,6 +7,7 @@ |
{ |
var iframe = document.getElementById("share-popup"); |
var glassPane = document.getElementById("glass-pane"); |
+ var popupMessageReceived = false; |
var popupMessageListener = function(event) |
{ |
@@ -15,20 +16,27 @@ |
iframe.width = event.data.width; |
iframe.height = event.data.height; |
+ popupMessageReceived = true; |
window.removeEventListener("message", popupMessageListener); |
}; |
window.addEventListener("message", popupMessageListener, false); |
var popupLoadListener = function() |
{ |
- iframe.className = "visible"; |
+ if (popupMessageReceived) |
+ { |
+ iframe.className = "visible"; |
- var popupCloseListener = function() |
- { |
- iframe.className = glassPane.className = ""; |
- document.removeEventListener("click", popupCloseListener); |
- }; |
- document.addEventListener("click", popupCloseListener, false); |
+ var popupCloseListener = function() |
+ { |
+ iframe.className = glassPane.className = ""; |
+ document.removeEventListener("click", popupCloseListener); |
+ }; |
+ document.addEventListener("click", popupCloseListener, false); |
+ } |
+ else |
+ glassPane.className = ""; |
Wladimir Palant
2012/10/25 15:54:15
Also remove message listener here?
Felix Dahlke
2012/10/25 15:57:11
Done.
|
+ |
iframe.removeEventListener("load", popupLoadListener); |
}; |
iframe.addEventListener("load", popupLoadListener, false); |