1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

load add fields with current tab info

This commit is contained in:
Kyle Spearrin
2016-09-14 22:44:04 -04:00
parent 0a201ef887
commit 6bb8b28517
4 changed files with 40 additions and 12 deletions

View File

@@ -1,13 +1,15 @@
angular
.module('bit.current')
.controller('currentController', function ($scope, siteService, cipherService, tldjs, toastr, $q, $window) {
.controller('currentController', function ($scope, siteService, cipherService, tldjs, toastr, $q, $window, $state) {
var pageDetails = null,
tabId = null;
tabId = null,
url = null,
domain = null;
$scope.canAutofill = false;
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
var url = null;
if (tabs.length > 0) {
url = tabs[0].url;
tabId = tabs[0].id;
@@ -16,7 +18,7 @@ angular
return;
}
var domain = tldjs.getDomain(url);
domain = tldjs.getDomain(url);
$scope.sites = [];
if (!domain) {
return;
@@ -85,6 +87,14 @@ angular
});
});
$scope.addSite = function () {
$state.go('addSite', {
animation: 'in-slide-up',
name: domain,
uri: url
});
};
$scope.fillSite = function (site) {
var fillScript = null;
if (site && $scope.canAutofill && pageDetails) {