1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-02 04:48:57 +02:00

launch website on double click

This commit is contained in:
Kyle Spearrin 2017-11-22 22:15:17 -05:00
parent 2e9b3d0943
commit 56c1ca7d2f
2 changed files with 24 additions and 2 deletions

View File

@ -144,13 +144,17 @@ angular
}; };
$scope.viewCipher = function (cipher) { $scope.viewCipher = function (cipher) {
if (cipher.clicked) { var canLaunch = cipher.login && cipher.login.uri &&
(cipher.login.uri.startsWith('http://') || cipher.login.uri.startsWith('https://'));
if (canLaunch && cipher.clicked) {
cipher.cancelClick = true; cipher.cancelClick = true;
cipher.clicked = false;
$scope.launchWebsite(cipher); $scope.launchWebsite(cipher);
return; return;
} }
cipher.clicked = true; cipher.clicked = true;
cipher.cancelClick = false;
$timeout(function () { $timeout(function () {
if (cipher.cancelClick) { if (cipher.cancelClick) {
@ -172,6 +176,13 @@ angular
}, 200); }, 200);
}; };
$scope.launchWebsite = function (cipher) {
if (cipher.login && cipher.login.uri) {
$analytics.eventTrack('Launched Website');
chrome.tabs.create({ url: cipher.login.uri });
}
};
$scope.viewGrouping = function (grouping, folder) { $scope.viewGrouping = function (grouping, folder) {
storeState(); storeState();
$state.go('viewGrouping', { $state.go('viewGrouping', {

View File

@ -181,13 +181,17 @@ angular
}; };
$scope.viewCipher = function (cipher) { $scope.viewCipher = function (cipher) {
if (cipher.clicked) { var canLaunch = cipher.login && cipher.login.uri &&
(cipher.login.uri.startsWith('http://') || cipher.login.uri.startsWith('https://'));
if (canLaunch && cipher.clicked) {
cipher.cancelClick = true; cipher.cancelClick = true;
cipher.clicked = false;
$scope.launchWebsite(cipher); $scope.launchWebsite(cipher);
return; return;
} }
cipher.clicked = true; cipher.clicked = true;
cipher.cancelClick = false;
$timeout(function () { $timeout(function () {
if (cipher.cancelClick) { if (cipher.cancelClick) {
@ -209,6 +213,13 @@ angular
}, 200); }, 200);
}; };
$scope.launchWebsite = function (cipher) {
if (cipher.login && cipher.login.uri) {
$analytics.eventTrack('Launched Website');
chrome.tabs.create({ url: cipher.login.uri });
}
};
function storeState() { function storeState() {
angular.extend(state, { angular.extend(state, {
scrollY: getScrollY(), scrollY: getScrollY(),