1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-10 14:43:34 +01:00
bitwarden-browser/src/popup/main.ts

36 lines
1.1 KiB
TypeScript
Raw Normal View History

2018-04-04 04:14:54 +02:00
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2018-04-11 16:57:34 +02:00
import 'web-animations-js';
2018-04-04 04:14:54 +02:00
// tslint:disable-next-line
2018-04-11 04:20:50 +02:00
require('./scss/popup.scss');
2018-04-04 04:14:54 +02:00
import { BrowserApi } from '../browser/browserApi';
2018-04-04 04:14:54 +02:00
import { AppModule } from './app.module';
2018-04-13 21:14:04 +02:00
if (process.env.ENV === 'production') {
enableProdMode();
}
2018-04-04 04:14:54 +02:00
function init() {
if (BrowserApi.isEdge18) {
const inPopup = window.location.search === '' || window.location.search.indexOf('uilocation=') === -1 ||
window.location.search.indexOf('uilocation=popup') > -1;
if (inPopup) {
const bodyRect = document.querySelector('body').getBoundingClientRect();
chrome.windows.create({
url: 'popup/index.html?uilocation=popout',
type: 'popup',
width: bodyRect.width + 60,
height: bodyRect.height,
});
BrowserApi.closePopup(window);
return;
}
}
platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true });
}
init();