mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
adjust context menus to "all" context. cleanup autofill in current
This commit is contained in:
parent
a27f1f5850
commit
2fcf3ff129
@ -11,28 +11,33 @@ function buildContextMenu() {
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'autofill',
|
||||
contexts: ['all'],
|
||||
title: 'Auto-fill'
|
||||
});
|
||||
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'copy-username',
|
||||
contexts: ['all'],
|
||||
title: 'Copy Username'
|
||||
});
|
||||
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'copy-password',
|
||||
contexts: ['all'],
|
||||
title: 'Copy Password'
|
||||
});
|
||||
|
||||
chrome.contextMenus.create({
|
||||
type: 'separator'
|
||||
type: 'separator',
|
||||
contexts: ['all']
|
||||
});
|
||||
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'generate-password',
|
||||
contexts: ['all'],
|
||||
title: 'Generate Password'
|
||||
});
|
||||
}
|
||||
@ -156,6 +161,7 @@ function loadContextMenuOptions(site) {
|
||||
type: 'normal',
|
||||
id: 'autofill_' + site.id,
|
||||
parentId: 'autofill',
|
||||
contexts: ['all'],
|
||||
title: title
|
||||
});
|
||||
|
||||
@ -163,6 +169,7 @@ function loadContextMenuOptions(site) {
|
||||
type: 'normal',
|
||||
id: 'copy-username_' + site.id,
|
||||
parentId: 'copy-username',
|
||||
contexts: ['all'],
|
||||
title: title
|
||||
});
|
||||
|
||||
@ -170,6 +177,7 @@ function loadContextMenuOptions(site) {
|
||||
type: 'normal',
|
||||
id: 'copy-password_' + site.id,
|
||||
parentId: 'copy-password',
|
||||
contexts: ['all'],
|
||||
title: title
|
||||
});
|
||||
}
|
||||
|
@ -5,9 +5,8 @@ angular
|
||||
var pageDetails = null,
|
||||
tabId = null,
|
||||
url = null,
|
||||
domain = null;
|
||||
|
||||
$scope.canAutofill = false;
|
||||
domain = null,
|
||||
canAutofill = false;
|
||||
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
||||
if (tabs.length > 0) {
|
||||
@ -26,7 +25,7 @@ angular
|
||||
|
||||
chrome.tabs.sendMessage(tabId, { command: 'collectPageDetails' }, function (details) {
|
||||
pageDetails = details;
|
||||
$scope.canAutofill = true;
|
||||
canAutofill = true;
|
||||
});
|
||||
|
||||
var filteredSites = [];
|
||||
@ -61,7 +60,7 @@ angular
|
||||
|
||||
$scope.fillSite = function (site) {
|
||||
var fillScript = null;
|
||||
if (site && $scope.canAutofill && pageDetails) {
|
||||
if (site && canAutofill && pageDetails) {
|
||||
fillScript = makeFillScript(site.username, site.password);
|
||||
}
|
||||
|
||||
@ -94,7 +93,7 @@ angular
|
||||
|
||||
var passwordFields = [];
|
||||
for (var i = 0; i < pageDetails.fields.length; i++) {
|
||||
if (pageDetails.fields[i].type == 'password') {
|
||||
if (pageDetails.fields[i].type === 'password') {
|
||||
passwordFields.push(pageDetails.fields[i]);
|
||||
}
|
||||
}
|
||||
@ -102,7 +101,7 @@ angular
|
||||
var passwordForms = [];
|
||||
for (var formKey in pageDetails.forms) {
|
||||
for (var j = 0; j < passwordFields.length; j++) {
|
||||
if (formKey == passwordFields[j].form) {
|
||||
if (formKey === passwordFields[j].form) {
|
||||
passwordForms.push(pageDetails.forms[formKey]);
|
||||
break;
|
||||
}
|
||||
@ -139,8 +138,8 @@ angular
|
||||
for (i = 0; i < passwordForms.length; i++) {
|
||||
var passwordFieldCount = 0;
|
||||
|
||||
for (var j = 0; j < passwordFields.length; j++) {
|
||||
if (passwordForms[i].opid == passwordFields[j].form) {
|
||||
for (j = 0; j < passwordFields.length; j++) {
|
||||
if (passwordForms[i].opid === passwordFields[j].form) {
|
||||
passwordFieldCount++;
|
||||
}
|
||||
}
|
||||
@ -160,7 +159,7 @@ angular
|
||||
var password = null;
|
||||
for (i = 0; i < pageDetails.fields.length; i++) {
|
||||
var f = pageDetails.fields[i];
|
||||
if (f.form == loginForm.opid && f.type == 'password') {
|
||||
if (f.form === loginForm.opid && f.type === 'password') {
|
||||
password = f;
|
||||
break;
|
||||
}
|
||||
@ -168,8 +167,8 @@ angular
|
||||
|
||||
var username = null;
|
||||
for (i = 0; i < pageDetails.fields.length; i++) {
|
||||
var f = pageDetails.fields[i];
|
||||
if (f.form == loginForm.opid && (f.type == 'text' || f.type == 'email')
|
||||
f = pageDetails.fields[i];
|
||||
if (f.form === loginForm.opid && (f.type === 'text' || f.type === 'email')
|
||||
&& f.elementNumber < password.elementNumber) {
|
||||
username = f;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user