1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-20 16:07:45 +01:00

remove all jquery dependencies from popup

This commit is contained in:
Kyle Spearrin 2017-11-09 21:58:22 -05:00
parent 92192b4f6e
commit 7c3fec98d1
10 changed files with 26 additions and 24 deletions

View File

@ -146,7 +146,10 @@ angular
u2f.cleanup(); u2f.cleanup();
$timeout(function () { $timeout(function () {
$('#code').focus(); var codeInput = document.getElementById('code');
if (codeInput) {
codeInput.focus();
}
var params; var params;
if ($scope.providerType === constants.twoFactorProvider.duo) { if ($scope.providerType === constants.twoFactorProvider.duo) {
@ -156,8 +159,10 @@ angular
host: params.Host, host: params.Host,
sig_request: params.Signature, sig_request: params.Signature,
submit_callback: function (theForm) { submit_callback: function (theForm) {
var response = $(theForm).find('input[name="sig_response"]').val(); var sigElement = theForm.querySelector('input[name="sig_response"]');
$scope.login(response); if (sigElement) {
$scope.login(sigElement.value);
}
} }
}); });
} }

View File

@ -1,5 +1,3 @@
window.$ = window.jQuery = require('jquery');
require('bootstrap');
require('papaparse'); require('papaparse');
require('clipboard'); require('clipboard');

View File

@ -14,7 +14,7 @@ angular
$scope.otherCiphers = []; $scope.otherCiphers = [];
$scope.loaded = false; $scope.loaded = false;
$scope.searchText = null; $scope.searchText = null;
$('#search').focus(); document.getElementById('search').focus();
$scope.$on('$viewContentLoaded', function () { $scope.$on('$viewContentLoaded', function () {
$timeout(loadVault, 100); $timeout(loadVault, 100);

View File

@ -1,11 +1,10 @@
angular angular
.module('bit.directives') .module('bit.directives')
.directive('fallbackSrc', function () { .directive('fallbackSrc', function () {
return function (scope, element, attrs) { return function (scope, element, attrs) {
var el = $(element); element[0].addEventListener('error', function (e) {
el.bind('error', function (event) { e.target.src = attrs.fallbackSrc;
el.attr('src', attrs.fallbackSrc);
}); });
}; };
}); });

View File

@ -1,11 +1,11 @@
angular angular
.module('bit.directives') .module('bit.directives')
// ref: https://stackoverflow.com/a/14165848/1090359 // ref: https://stackoverflow.com/a/14165848/1090359
.directive('stopClick', function () { .directive('stopClick', function () {
return function (scope, element, attrs) { return function (scope, element, attrs) {
$(element).click(function (event) { element[0].addEventListener('click', function (e) {
event.preventDefault(); e.preventDefault();
}); });
}; };
}); });

View File

@ -1,10 +1,10 @@
angular angular
.module('bit.directives') .module('bit.directives')
.directive('stopProp', function () { .directive('stopProp', function () {
return function (scope, element, attrs) { return function (scope, element, attrs) {
$(element).click(function (event) { element[0].addEventListener('click', function (e) {
event.stopPropagation(); e.stopPropagation();
}); });
}; };
}); });

View File

@ -43,11 +43,12 @@ angular
href = hrefParts[0] + '?uilocation=popout' + (hrefParts.length > 0 ? '#' + hrefParts[1] : ''); href = hrefParts[0] + '?uilocation=popout' + (hrefParts.length > 0 ? '#' + hrefParts[1] : '');
} }
var bodyRect = document.querySelector('body').getBoundingClientRect();
chrome.windows.create({ chrome.windows.create({
url: href, url: href,
type: 'popup', type: 'popup',
width: $('body').width() + 60, width: bodyRect.width + 60,
height: $('body').height() height: bodyRect.height
}); });
if (utilsService.inPopup($window)) { if (utilsService.inPopup($window)) {

View File

@ -4,8 +4,7 @@ angular
.controller('toolsExportController', function ($scope, $state, toastr, $q, $analytics, .controller('toolsExportController', function ($scope, $state, toastr, $q, $analytics,
i18nService, cryptoService, userService, folderService, cipherService, $window, constantsService) { i18nService, cryptoService, userService, folderService, cipherService, $window, constantsService) {
$scope.i18n = i18nService; $scope.i18n = i18nService;
document.getElementById('master-password').focus();
$('#master-password').focus();
$scope.submitPromise = null; $scope.submitPromise = null;
$scope.submit = function () { $scope.submit = function () {

View File

@ -9,7 +9,7 @@ angular
$scope.i18n = i18nService; $scope.i18n = i18nService;
$scope.showFolderCounts = !utilsService.isEdge(); $scope.showFolderCounts = !utilsService.isEdge();
$scope.showOnlyFolderView = utilsService.isEdge(); $scope.showOnlyFolderView = utilsService.isEdge();
$('#search').focus(); document.getElementById('search').focus();
var syncOnLoad = $stateParams.syncOnLoad; var syncOnLoad = $stateParams.syncOnLoad;
if (syncOnLoad) { if (syncOnLoad) {

View File

@ -1,4 +1,4 @@
angular angular
.module('bit.vault') .module('bit.vault')
.controller('vaultViewFolderController', function ($scope, cipherService, folderService, $q, $state, $stateParams, toastr, .controller('vaultViewFolderController', function ($scope, cipherService, folderService, $q, $state, $stateParams, toastr,
@ -17,7 +17,7 @@
name: i18nService.noneFolder name: i18nService.noneFolder
}; };
$scope.i18n = i18nService; $scope.i18n = i18nService;
$('#search').focus(); document.getElementById('search').focus();
$scope.loaded = false; $scope.loaded = false;
$scope.vaultCiphers = []; $scope.vaultCiphers = [];