Index: firstRun.js |
=================================================================== |
--- a/firstRun.js |
+++ b/firstRun.js |
@@ -7,6 +7,8 @@ |
{ |
var iframe = document.getElementById("share-popup"); |
var glassPane = document.getElementById("glass-pane"); |
+ var popupMessageReceived = false; |
+ var popupVisible = false; |
var popupMessageListener = function(event) |
{ |
@@ -15,26 +17,37 @@ |
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"; |
+ popupVisible = true; |
- 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); |
+ } |
iframe.removeEventListener("load", popupLoadListener); |
}; |
iframe.addEventListener("load", popupLoadListener, false); |
iframe.src = url; |
glassPane.className = "visible"; |
+ |
+ setTimeout(function() |
+ { |
+ if (!popupVisible) |
+ glassPane.className = ""; |
+ }, 2000); |
Wladimir Palant
2012/10/25 15:32:51
This timeout should be 20 seconds at least, otherw
Felix Dahlke
2012/10/25 15:39:27
You're right, the load event will even arrive even
|
} |
function initSocialLinks(variant) |