1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00

double click to launch website from vault

This commit is contained in:
Kyle Spearrin 2017-10-04 17:01:22 -04:00
parent 79deb5633a
commit 09f47c0e59
2 changed files with 66 additions and 22 deletions

View File

@ -127,12 +127,32 @@
}; };
$scope.viewLogin = function (login) { $scope.viewLogin = function (login) {
if (login.clicked) {
login.cancelClick = true;
$scope.launchWebsite(login);
return;
}
login.clicked = true;
$timeout(function () {
if (login.cancelClick) {
login.cancelClick = false;
login.clicked = false;
return;
}
storeState(); storeState();
$state.go('viewLogin', { $state.go('viewLogin', {
loginId: login.id, loginId: login.id,
animation: 'in-slide-up', animation: 'in-slide-up',
from: 'vault' from: 'vault'
}); });
// clean up
login.cancelClick = false;
login.clicked = false;
}, 200);
}; };
$scope.viewFolder = function (folder) { $scope.viewFolder = function (folder) {
@ -154,10 +174,12 @@
}; };
$scope.launchWebsite = function (login) { $scope.launchWebsite = function (login) {
$timeout(function () {
if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) { if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) {
$analytics.eventTrack('Launched Website From Listing'); $analytics.eventTrack('Launched Website From Listing');
chrome.tabs.create({ url: login.uri }); chrome.tabs.create({ url: login.uri });
} }
});
}; };
$scope.$on('syncCompleted', function (event, successfully) { $scope.$on('syncCompleted', function (event, successfully) {

View File

@ -2,7 +2,7 @@
.module('bit.vault') .module('bit.vault')
.controller('vaultViewFolderController', function ($scope, loginService, folderService, $q, $state, $stateParams, toastr, .controller('vaultViewFolderController', function ($scope, loginService, folderService, $q, $state, $stateParams, toastr,
syncService, $analytics, i18nService, stateService, utilsService) { syncService, $analytics, i18nService, stateService, utilsService, $timeout) {
var stateKey = 'viewFolder', var stateKey = 'viewFolder',
state = stateService.getState(stateKey) || {}; state = stateService.getState(stateKey) || {};
@ -64,7 +64,7 @@
$scope.searchLogins(); $scope.searchLogins();
} }
setTimeout(setScrollY, 200); $timeout(setScrollY, 200);
}); });
} }
@ -132,10 +132,12 @@
}; };
$scope.launchWebsite = function (login) { $scope.launchWebsite = function (login) {
$timeout(function () {
if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) { if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) {
$analytics.eventTrack('Launched Website From Listing'); $analytics.eventTrack('Launched Website From Listing');
chrome.tabs.create({ url: login.uri }); chrome.tabs.create({ url: login.uri });
} }
});
}; };
function resetList(logins) { function resetList(logins) {
@ -169,12 +171,32 @@
}; };
$scope.viewLogin = function (login) { $scope.viewLogin = function (login) {
if (login.clicked) {
login.cancelClick = true;
$scope.launchWebsite(login);
return;
}
login.clicked = true;
$timeout(function () {
if (login.cancelClick) {
login.cancelClick = false;
login.clicked = false;
return;
}
storeState(); storeState();
$state.go('viewLogin', { $state.go('viewLogin', {
loginId: login.id, loginId: login.id,
animation: 'in-slide-up', animation: 'in-slide-up',
from: 'folder' from: 'folder'
}); });
// clean up
login.cancelClick = false;
login.clicked = false;
}, 200);
}; };
$scope.clipboardError = function (e) { $scope.clipboardError = function (e) {