Skip to content

Commit b98a0da

Browse files
committed
feat: experimental captcha support
Open popup in center
1 parent 9dcc9e2 commit b98a0da

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/extension/lib/handle-tlink-api.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function handleTlinkApiViaTSViewerWindow(method: string, payload: any){
5050

5151
window.addEventListener("message", handleMessage);
5252

53-
popup = window.open(requestUrl, "", 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=250px,height=250px`');
53+
popup = popupCenter(requestUrl, "TLink Request", 400, 400);
5454

5555
if (!popup)
5656
reject(new Error("Failed to open the popup window"));
@@ -63,3 +63,9 @@ async function handleTlinkApiViaTSViewerWindow(method: string, payload: any){
6363

6464
});
6565
}
66+
67+
function popupCenter (url, title, w, h) {
68+
const left = (screen.width/2)-(w/2);
69+
const top = (screen.height/2)-(h/2);
70+
return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
71+
}

0 commit comments

Comments
 (0)