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) {
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.clicked = false;
$scope.launchWebsite(cipher);
return;
}
cipher.clicked = true;
cipher.cancelClick = false;
$timeout(function () {
if (cipher.cancelClick) {
@ -172,6 +176,13 @@ angular
}, 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) {
storeState();
$state.go('viewGrouping', {

View File

@ -181,13 +181,17 @@ angular
};
$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.clicked = false;
$scope.launchWebsite(cipher);
return;
}
cipher.clicked = true;
cipher.cancelClick = false;
$timeout(function () {
if (cipher.cancelClick) {
@ -209,6 +213,13 @@ angular
}, 200);
};
$scope.launchWebsite = function (cipher) {
if (cipher.login && cipher.login.uri) {
$analytics.eventTrack('Launched Website');
chrome.tabs.create({ url: cipher.login.uri });
}
};
function storeState() {
angular.extend(state, {
scrollY: getScrollY(),