|
@@ -89,6 +89,9 @@ var messageHandler = (function(my) {
|
89
|
89
|
* @param h the height of the popup window
|
90
|
90
|
* @param onPopupClosed optional callback function called when popup window
|
91
|
91
|
* has been closed.
|
|
92
|
+ *
|
|
93
|
+ * @returns popup window object if opened successfully or undefined
|
|
94
|
+ * in case we failed to open it(popup blocked)
|
92
|
95
|
*/
|
93
|
96
|
my.openCenteredPopup = function (url, w, h, onPopupClosed) {
|
94
|
97
|
var l = window.screenX + (window.innerWidth / 2) - (w / 2);
|
|
@@ -96,7 +99,7 @@ var messageHandler = (function(my) {
|
96
|
99
|
var popup = window.open(
|
97
|
100
|
url, '_blank',
|
98
|
101
|
'top=' + t + ', left=' + l + ', width=' + w + ', height=' + h + '');
|
99
|
|
- if (onPopupClosed) {
|
|
102
|
+ if (popup && onPopupClosed) {
|
100
|
103
|
var pollTimer = window.setInterval(function () {
|
101
|
104
|
if (popup.closed !== false) {
|
102
|
105
|
window.clearInterval(pollTimer);
|
|
@@ -104,6 +107,7 @@ var messageHandler = (function(my) {
|
104
|
107
|
}
|
105
|
108
|
}, 200);
|
106
|
109
|
}
|
|
110
|
+ return popup;
|
107
|
111
|
};
|
108
|
112
|
|
109
|
113
|
/**
|