mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-11 01:59:58 +00:00
Misc popup refactoring/documentation
This commit is contained in:
@@ -79,38 +79,6 @@ export function getMediaTypesForPageUrl(
|
||||
return availableMediaTypes;
|
||||
}
|
||||
|
||||
export interface WindowCenteredProps {
|
||||
width: number;
|
||||
height: number;
|
||||
left: number;
|
||||
top: number;
|
||||
}
|
||||
|
||||
export function getWindowCenteredProps(
|
||||
refWin: browser.windows.Window,
|
||||
width: number,
|
||||
height: number
|
||||
): WindowCenteredProps {
|
||||
if (
|
||||
refWin.left === undefined ||
|
||||
refWin.width === undefined ||
|
||||
refWin.top === undefined ||
|
||||
refWin.height === undefined
|
||||
) {
|
||||
throw logger.error("refWin missing positional attributes.");
|
||||
}
|
||||
|
||||
const centerX = refWin.left + refWin.width / 2;
|
||||
const centerY = refWin.top + refWin.height / 3;
|
||||
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
left: Math.floor(centerX - width / 2),
|
||||
top: Math.floor(centerY - height / 2)
|
||||
};
|
||||
}
|
||||
|
||||
export function loadScript(
|
||||
scriptUrl: string,
|
||||
doc: Document = document
|
||||
|
||||
Reference in New Issue
Block a user