1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

convert initListSectionItemListeners to js

Removed jQuery from background
This commit is contained in:
Kyle Spearrin
2017-11-09 17:16:28 -05:00
parent bcf0f19aa2
commit 9fe4b29a1c
13 changed files with 132 additions and 95 deletions

View File

@@ -2,13 +2,15 @@ angular
.module('bit.accounts')
.controller('accountsHintController', function ($scope, $state, apiService, toastr, $q, utilsService,
$analytics, i18nService) {
$analytics, i18nService, $timeout) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
document.getElementById('email').focus();
}, 500);
$scope.i18n = i18nService;
$scope.model = {};
utilsService.initListSectionItemListeners($(document), angular);
$('#email').focus();
$scope.submitPromise = null;
$scope.submit = function (model) {
if (!model.email) {

View File

@@ -1,18 +1,19 @@
angular
angular
.module('bit.accounts')
.controller('accountsLoginController', function ($scope, $state, $stateParams, authService, userService, toastr,
utilsService, $analytics, i18nService) {
utilsService.initListSectionItemListeners($(document), angular);
utilsService, $analytics, i18nService, $timeout) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
if ($stateParams.email) {
document.getElementById('master-password').focus();
}
else {
document.getElementById('email').focus();
}
}, 500);
$scope.i18n = i18nService;
if ($stateParams.email) {
$('#master-password').focus();
}
else {
$('#email').focus();
}
$scope.model = {
email: $stateParams.email
};

View File

@@ -4,8 +4,11 @@ angular
.controller('accountsLoginTwoFactorController', function ($scope, $state, authService, toastr, utilsService, SweetAlert,
$analytics, i18nService, $stateParams, $filter, constantsService, $timeout, $window, cryptoService, apiService,
environmentService) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
}, 500);
$scope.i18n = i18nService;
utilsService.initListSectionItemListeners($(document), angular);
var customWebVaultUrl = null;
if (environmentService.baseUrl) {

View File

@@ -3,13 +3,14 @@ angular
.controller(
'accountsRegisterController',
function ($scope, $state, cryptoService, toastr, $q, apiService, utilsService, $analytics, i18nService) {
function ($scope, $state, cryptoService, toastr, $q, apiService, utilsService, $analytics, i18nService, $timeout) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
document.getElementById('email').focus();
}, 500);
$scope.i18n = i18nService;
$scope.model = {};
utilsService.initListSectionItemListeners($(document), angular);
$('#email').focus();
$scope.submitPromise = null;
$scope.submit = function (model) {
if (!model.email) {

View File

@@ -2,12 +2,14 @@ angular
.module('bit.settings')
.controller('settingsAddFolderController', function ($scope, $q, folderService, $state, toastr, utilsService,
$analytics, i18nService) {
$analytics, i18nService, $timeout) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
document.getElementById('name').focus();
}, 500);
$scope.i18n = i18nService;
$scope.folder = {};
utilsService.initListSectionItemListeners($(document), angular);
$('#name').focus();
$scope.savePromise = null;
$scope.save = function (model) {
if (!model.name) {

View File

@@ -2,8 +2,11 @@ angular
.module('bit.settings')
.controller('settingsController', function ($scope, $state, SweetAlert, utilsService, $analytics,
i18nService, constantsService, cryptoService, lockService) {
utilsService.initListSectionItemListeners($(document), angular);
i18nService, constantsService, cryptoService, lockService, $timeout) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
}, 500);
$scope.showOnLocked = !utilsService.isFirefox() && !utilsService.isEdge();
$scope.lockOption = '';
$scope.i18n = i18nService;

View File

@@ -1,12 +1,16 @@
angular
angular
.module('bit.settings')
.controller('settingsEditFolderController', function ($scope, $stateParams, folderService, toastr, $state, SweetAlert,
utilsService, $analytics, i18nService) {
utilsService, $analytics, i18nService, $timeout) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
document.getElementById('name').focus();
}, 500);
$scope.i18n = i18nService;
$scope.folder = {};
var folderId = $stateParams.folderId;
$('#name').focus();
folderService.get(folderId).then(function (folder) {
return folder.decrypt();
@@ -14,8 +18,6 @@
$scope.folder = model;
});
utilsService.initListSectionItemListeners($(document), angular);
$scope.savePromise = null;
$scope.save = function (model) {
if (!model.name) {

View File

@@ -3,10 +3,11 @@ angular
.controller('settingsEnvironmentController', function ($scope, i18nService, $analytics, utilsService,
environmentService, toastr, $timeout) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
}, 500);
$scope.i18n = i18nService;
utilsService.initListSectionItemListeners($(document), angular);
$scope.baseUrl = environmentService.baseUrl || '';
$scope.webVaultUrl = environmentService.webVaultUrl || '';
$scope.apiUrl = environmentService.apiUrl || '';

View File

@@ -1,8 +1,8 @@
angular
angular
.module('bit.vault')
.controller('vaultAddCipherController', function ($scope, $state, $stateParams, cipherService, folderService,
cryptoService, toastr, utilsService, $analytics, i18nService, constantsService) {
cryptoService, toastr, utilsService, $analytics, i18nService, constantsService, $timeout) {
$scope.i18n = i18nService;
$scope.constants = constantsService;
$scope.addFieldType = constantsService.fieldType.text.toString();
@@ -30,13 +30,16 @@
angular.extend($scope.cipher, $stateParams.cipher);
}
if (!$stateParams.cipher && $scope.cipher.name && $scope.cipher.login && $scope.cipher.login.uri) {
$('#username').focus();
}
else {
$('#name').focus();
}
utilsService.initListSectionItemListeners($(document), angular);
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
if (!$stateParams.cipher && $scope.cipher.name && $scope.cipher.login && $scope.cipher.login.uri) {
document.getElementById('loginUsername').focus();
}
else {
document.getElementById('name').focus();
}
}, 500);
folderService.getAllDecrypted().then(function (folders) {
$scope.folders = folders;

View File

@@ -2,10 +2,12 @@ angular
.module('bit.vault')
.controller('vaultAttachmentsController', function ($scope, $state, $stateParams, cipherService, toastr,
SweetAlert, utilsService, $analytics, i18nService, cryptoService, tokenService) {
$scope.i18n = i18nService;
utilsService.initListSectionItemListeners($(document), angular);
SweetAlert, utilsService, $analytics, i18nService, cryptoService, tokenService, $timeout) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
}, 500);
$scope.i18n = i18nService;
$scope.isPremium = tokenService.getPremium();
$scope.canAccessAttachments = $scope.isPremium;
$scope.hasUpdatedKey = false;

View File

@@ -2,7 +2,12 @@ angular
.module('bit.vault')
.controller('vaultEditCipherController', function ($scope, $state, $stateParams, cipherService, folderService,
cryptoService, toastr, SweetAlert, utilsService, $analytics, i18nService, constantsService) {
cryptoService, toastr, SweetAlert, utilsService, $analytics, i18nService, constantsService, $timeout) {
$timeout(function () {
utilsService.initListSectionItemListeners(document, angular);
document.getElementById('name').focus();
}, 500);
$scope.i18n = i18nService;
$scope.constants = constantsService;
$scope.showAttachments = !utilsService.isEdge();
@@ -16,8 +21,6 @@ angular
folderId: null
};
$('#name').focus();
if ($stateParams.cipher) {
angular.extend($scope.cipher, $stateParams.cipher);
}
@@ -33,8 +36,6 @@ angular
$scope.folders = folders;
});
utilsService.initListSectionItemListeners($(document), angular);
$scope.typeChanged = function () {
$scope.cipher.type = parseInt($scope.selectedType);
};