1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-18 11:05:41 +01:00

expand vault uses a popup instead of a new tab

This commit is contained in:
Kyle Spearrin 2017-10-10 12:42:24 -04:00
parent 22e1c7d58d
commit 41c3007821
3 changed files with 28 additions and 5 deletions

View File

@ -175,9 +175,8 @@
params = providers[constants.twoFactorProvider.email];
$scope.twoFactorEmail = params.Email;
if (chrome.extension.getViews({ type: 'popup' }).length > 0 &&
!utilsService.inSidebar($window) &&
!utilsService.inTab($window)) {
if (chrome.extension.getViews({ type: 'popup' }).length > 0 && !utilsService.inSidebar($window) &&
!utilsService.inTab($window) && !utilsService.inPopout($window)) {
SweetAlert.swal({
title: i18nService.twoStepLogin,
text: i18nService.popup2faCloseMessage,

View File

@ -33,8 +33,28 @@ angular
}
}
href = href.replace('uilocation=popup', 'uilocation=tab').replace('uilocation=sidebar', 'uilocation=tab');
chrome.tabs.create({ url: href });
if (chrome.windows.create) {
href = href.replace('uilocation=popup', 'uilocation=popout').replace('uilocation=tab', 'uilocation=popout')
.replace('uilocation=sidebar', 'uilocation=popout');
chrome.windows.create({
url: href,
type: 'popup',
width: $('body').width() + 60,
height: $('body').height()
});
if (utilsService.inPopup($window)) {
$window.close();
}
}
else {
href = href.replace('uilocation=popup', 'uilocation=tab').replace('uilocation=popout', 'uilocation=tab')
.replace('uilocation=sidebar', 'uilocation=tab');
chrome.tabs.create({
url: href
});
}
};
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {

View File

@ -236,6 +236,10 @@ function initUtilsService() {
return theWindow.location.search && theWindow.location.search.indexOf('uilocation=tab') > -1;
};
UtilsService.prototype.inPopout = function (theWindow) {
return theWindow.location.search && theWindow.location.search.indexOf('uilocation=popout') > -1;
};
UtilsService.prototype.inPopup = function (theWindow) {
return theWindow.location.search && theWindow.location.search.indexOf('uilocation=popup') > -1;
};