summaryrefslogtreecommitdiffstats
path: root/projecttemplates/MvcRelyingParty/Scripts/LoginLink.js
diff options
context:
space:
mode:
Diffstat (limited to 'projecttemplates/MvcRelyingParty/Scripts/LoginLink.js')
-rw-r--r--projecttemplates/MvcRelyingParty/Scripts/LoginLink.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/projecttemplates/MvcRelyingParty/Scripts/LoginLink.js b/projecttemplates/MvcRelyingParty/Scripts/LoginLink.js
new file mode 100644
index 0000000..1f22a50
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Scripts/LoginLink.js
@@ -0,0 +1,61 @@
+$(function() {
+ var loginContent = '/Auth/LogOnPopup';
+ var popupWindowName = 'openidlogin';
+ var popupWidth = 355;
+ var popupHeight = 205; // use 205 for 1 row of OP buttons, or 273 for 2 rows
+ var iframe;
+
+ {
+ var div = window.document.createElement('div');
+ div.style.padding = 0;
+ div.id = 'loginDialog';
+
+ iframe = window.document.createElement('iframe');
+ iframe.src = "about:blank"; // don't set the actual page yet, since FireFox & Chrome will refresh it when the iframe is moved in the DOM anyway.
+ iframe.frameBorder = 0;
+ iframe.width = popupWidth;
+ iframe.height = popupHeight;
+ div.appendChild(iframe);
+
+ window.document.body.appendChild(div);
+ }
+
+ $(document).ready(function() {
+ $("#loginDialog").dialog({
+ bgiframe: true,
+ modal: true,
+ title: 'Login or register',
+ resizable: false,
+ hide: 'clip',
+ width: popupWidth,
+ height: popupHeight + 50,
+ buttons: {},
+ closeOnEscape: true,
+ autoOpen: false,
+ close: function(event, ui) {
+ // Clear the URL so Chrome/Firefox don't refresh the iframe when it's hidden.
+ iframe.src = "about:blank";
+ },
+ open: function(event, ui) {
+ iframe.src = loginContent;
+ },
+ focus: function(event, ui) {
+ // var box = $('#openid_identifier')[0];
+ // if (box.style.display != 'none') {
+ // box.focus();
+ // }
+ }
+ });
+
+ $('.loginPopupLink').click(function() {
+ $("#loginDialog").dialog('open');
+ });
+ $('.loginWindowLink').click(function() {
+ if (window.showModalDialog) {
+ window.showModalDialog(loginContent, popupWindowName, 'status:0;resizable:1;scroll:1;center:1;dialogHeight:' + popupHeight + 'px;dialogWidth:' + popupWidth + 'px');
+ } else {
+ window.open(loginContent, popupWindowName, 'modal=yes,status=0,location=1,toolbar=0,menubar=0,resizable=0,scrollbars=0,height=' + popupHeight + 'px,width=' + popupWidth + 'px');
+ }
+ });
+ });
+});