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({
|
chrome.contextMenus.create({
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
id: 'autofill',
|
id: 'autofill',
|
||||||
|
contexts: ['all'],
|
||||||
title: 'Auto-fill'
|
title: 'Auto-fill'
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.contextMenus.create({
|
chrome.contextMenus.create({
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
id: 'copy-username',
|
id: 'copy-username',
|
||||||
|
contexts: ['all'],
|
||||||
title: 'Copy Username'
|
title: 'Copy Username'
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.contextMenus.create({
|
chrome.contextMenus.create({
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
id: 'copy-password',
|
id: 'copy-password',
|
||||||
|
contexts: ['all'],
|
||||||
title: 'Copy Password'
|
title: 'Copy Password'
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.contextMenus.create({
|
chrome.contextMenus.create({
|
||||||
type: 'separator'
|
type: 'separator',
|
||||||
|
contexts: ['all']
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.contextMenus.create({
|
chrome.contextMenus.create({
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
id: 'generate-password',
|
id: 'generate-password',
|
||||||
|
contexts: ['all'],
|
||||||
title: 'Generate Password'
|
title: 'Generate Password'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -156,6 +161,7 @@ function loadContextMenuOptions(site) {
|
|||||||
type: 'normal',
|
type: 'normal',
|
||||||
id: 'autofill_' + site.id,
|
id: 'autofill_' + site.id,
|
||||||
parentId: 'autofill',
|
parentId: 'autofill',
|
||||||
|
contexts: ['all'],
|
||||||
title: title
|
title: title
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -163,6 +169,7 @@ function loadContextMenuOptions(site) {
|
|||||||
type: 'normal',
|
type: 'normal',
|
||||||
id: 'copy-username_' + site.id,
|
id: 'copy-username_' + site.id,
|
||||||
parentId: 'copy-username',
|
parentId: 'copy-username',
|
||||||
|
contexts: ['all'],
|
||||||
title: title
|
title: title
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -170,6 +177,7 @@ function loadContextMenuOptions(site) {
|
|||||||
type: 'normal',
|
type: 'normal',
|
||||||
id: 'copy-password_' + site.id,
|
id: 'copy-password_' + site.id,
|
||||||
parentId: 'copy-password',
|
parentId: 'copy-password',
|
||||||
|
contexts: ['all'],
|
||||||
title: title
|
title: title
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,8 @@ angular
|
|||||||
var pageDetails = null,
|
var pageDetails = null,
|
||||||
tabId = null,
|
tabId = null,
|
||||||
url = null,
|
url = null,
|
||||||
domain = null;
|
domain = null,
|
||||||
|
canAutofill = false;
|
||||||
$scope.canAutofill = false;
|
|
||||||
|
|
||||||
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
||||||
if (tabs.length > 0) {
|
if (tabs.length > 0) {
|
||||||
@ -26,7 +25,7 @@ angular
|
|||||||
|
|
||||||
chrome.tabs.sendMessage(tabId, { command: 'collectPageDetails' }, function (details) {
|
chrome.tabs.sendMessage(tabId, { command: 'collectPageDetails' }, function (details) {
|
||||||
pageDetails = details;
|
pageDetails = details;
|
||||||
$scope.canAutofill = true;
|
canAutofill = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
var filteredSites = [];
|
var filteredSites = [];
|
||||||
@ -61,7 +60,7 @@ angular
|
|||||||
|
|
||||||
$scope.fillSite = function (site) {
|
$scope.fillSite = function (site) {
|
||||||
var fillScript = null;
|
var fillScript = null;
|
||||||
if (site && $scope.canAutofill && pageDetails) {
|
if (site && canAutofill && pageDetails) {
|
||||||
fillScript = makeFillScript(site.username, site.password);
|
fillScript = makeFillScript(site.username, site.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +93,7 @@ angular
|
|||||||
|
|
||||||
var passwordFields = [];
|
var passwordFields = [];
|
||||||
for (var i = 0; i < pageDetails.fields.length; i++) {
|
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]);
|
passwordFields.push(pageDetails.fields[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +101,7 @@ angular
|
|||||||
var passwordForms = [];
|
var passwordForms = [];
|
||||||
for (var formKey in pageDetails.forms) {
|
for (var formKey in pageDetails.forms) {
|
||||||
for (var j = 0; j < passwordFields.length; j++) {
|
for (var j = 0; j < passwordFields.length; j++) {
|
||||||
if (formKey == passwordFields[j].form) {
|
if (formKey === passwordFields[j].form) {
|
||||||
passwordForms.push(pageDetails.forms[formKey]);
|
passwordForms.push(pageDetails.forms[formKey]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -139,8 +138,8 @@ angular
|
|||||||
for (i = 0; i < passwordForms.length; i++) {
|
for (i = 0; i < passwordForms.length; i++) {
|
||||||
var passwordFieldCount = 0;
|
var passwordFieldCount = 0;
|
||||||
|
|
||||||
for (var j = 0; j < passwordFields.length; j++) {
|
for (j = 0; j < passwordFields.length; j++) {
|
||||||
if (passwordForms[i].opid == passwordFields[j].form) {
|
if (passwordForms[i].opid === passwordFields[j].form) {
|
||||||
passwordFieldCount++;
|
passwordFieldCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,7 +159,7 @@ angular
|
|||||||
var password = null;
|
var password = null;
|
||||||
for (i = 0; i < pageDetails.fields.length; i++) {
|
for (i = 0; i < pageDetails.fields.length; i++) {
|
||||||
var f = pageDetails.fields[i];
|
var f = pageDetails.fields[i];
|
||||||
if (f.form == loginForm.opid && f.type == 'password') {
|
if (f.form === loginForm.opid && f.type === 'password') {
|
||||||
password = f;
|
password = f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -168,8 +167,8 @@ angular
|
|||||||
|
|
||||||
var username = null;
|
var username = null;
|
||||||
for (i = 0; i < pageDetails.fields.length; i++) {
|
for (i = 0; i < pageDetails.fields.length; i++) {
|
||||||
var f = pageDetails.fields[i];
|
f = pageDetails.fields[i];
|
||||||
if (f.form == loginForm.opid && (f.type == 'text' || f.type == 'email')
|
if (f.form === loginForm.opid && (f.type === 'text' || f.type === 'email')
|
||||||
&& f.elementNumber < password.elementNumber) {
|
&& f.elementNumber < password.elementNumber) {
|
||||||
username = f;
|
username = f;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user