diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-05-19 20:20:49 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-05-19 20:21:43 -0700 |
commit | 21718f6acb378ebe83c8373df56f457e0e7d43df (patch) | |
tree | c78c45059f45e909b305c86d7a65cf7731baa006 | |
parent | ffbb4906e0db3faf37fd41f0ce91da3c97bf9e3f (diff) | |
download | DotNetOpenAuth-21718f6acb378ebe83c8373df56f457e0e7d43df.zip DotNetOpenAuth-21718f6acb378ebe83c8373df56f457e0e7d43df.tar.gz DotNetOpenAuth-21718f6acb378ebe83c8373df56f457e0e7d43df.tar.bz2 |
OpenIdAjaxTextBox popup window is now modal and centered.
-rw-r--r-- | src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js index 340e792..ee9bcdc 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js @@ -528,7 +528,28 @@ function initAjaxOpenId(box, openid_logo_url, dotnetopenid_logo_url, spinner_url height = 500; } - self.popup = window.open(self.setup, 'opLogin', 'status=0,toolbar=0,location=1,resizable=1,scrollbars=1,width=' + width + ',height=' + height); + if (window.showModalDialog) { + self.popup = window.showModalDialog(self.setup, 'opLogin', 'status:0;resizable:1;scroll:1;center:1;dialogWidth:' + width + 'px; dialogHeight:' + height + 'px'); + } else { + var left = (screen.width - width) / 2; + var top = (screen.height - height) / 2; + self.popup = window.open(self.setup, 'opLogin', 'status=0,toolbar=0,location=1,resizable=1,scrollbars=1,left=' + left + ',top=' + top + ',width=' + width + ',height=' + height); + } + + // If the OP supports the UI extension it MAY close its own window + // for a negative assertion. We must be able to recover from that scenario. + var localSelf = self; + self.popupCloseChecker = window.setInterval(function() { + if (localSelf.popup && localSelf.popup.closed) { + // So the user canceled and the window closed. + // It turns out we hae nothing special to do. + // If we were graying out the entire page while the child window was up, + // we would probably revert that here. + trace('User or OP canceled by closing the window.'); + window.clearInterval(localSelf.popupCloseChecker); + localSelf.popup = null; + } + }, 250); }; }; |