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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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