this repo has no description
1export default function openCompose(opts) {
2 const url = new URL('/compose/', window.location);
3 const { width: screenWidth, height: screenHeight } = window.screen;
4 const left = Math.max(0, (screenWidth - 600) / 2);
5 const top = Math.max(0, (screenHeight - 450) / 2);
6 const width = Math.min(screenWidth, 600);
7 const height = Math.min(screenHeight, 450);
8 const winUID = opts?.uid || Math.random();
9 const newWin = window.open(
10 url,
11 'compose' + winUID,
12 `width=${width},height=${height},left=${left},top=${top}`,
13 );
14
15 if (newWin) {
16 // if (masto) {
17 // newWin.masto = masto;
18 // }
19
20 newWin.__COMPOSE__ = opts;
21 } else {
22 alert('Looks like your browser is blocking popups.');
23 }
24
25 return newWin;
26}