Skip to content

Commit

Permalink
Open a popup window for desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreyaschorge committed Apr 10, 2024
1 parent 0be2829 commit f255cd0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion raw/1.2.0/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,20 @@
}

var authOrigin = new URL(neynarLoginUrl).origin;
authWindow = window.open(authUrl.toString(), "_blank");

var isDesktop = window.matchMedia("(min-width: 800px)").matches;

var width = 600,
height = 700;
var left = window.screen.width / 2 - width / 2;
var top = window.screen.height / 2 - height / 2;

// Define window features for the popup
var windowFeatures = `width=${width},height=${height},top=${top},left=${left}`;

var windowOptions = isDesktop ? windowFeatures : "fullscreen=yes";

authWindow = window.open(authUrl.toString(), "_blank", windowOptions);
window.addEventListener(
"message",
function (event) {
Expand Down

0 comments on commit f255cd0

Please sign in to comment.