(callback)
| 11 | } |
| 12 | |
| 13 | export function openMinimal(callback) { |
| 14 | const width = getPixel(api.settings.get('miniMalWidth'), window.screen.width); |
| 15 | const height = getPixel(api.settings.get('miniMalHeight'), window.screen.height); |
| 16 | |
| 17 | let left; |
| 18 | if (api.settings.get('posLeft') === 'right') { |
| 19 | left = window.screen.width - width; |
| 20 | } else if (api.settings.get('posLeft') === 'left') { |
| 21 | left = 1; |
| 22 | } else { |
| 23 | left = 0; |
| 24 | } |
| 25 | |
| 26 | chrome.runtime.sendMessage({ name: 'minimalWindow', height, width, left }, callback); |
| 27 | } |
| 28 | |
| 29 | function getPixel(val: string, screenSize: number): number { |
| 30 | if (/^\d+px$/i.test(val)) { |
no test coverage detected