Merge branch 'develop'

This commit is contained in:
varjolintu 2017-11-18 08:08:13 +02:00
commit 45d0ed84da
11 changed files with 103 additions and 48 deletions

View file

@ -1,3 +1,9 @@
0.4.1 (18-11-2017)
=========================
- Added support for the credentials dropdown menu with only password field visible
- Fixed jQuery overriding with custom scoped CSS
- Fixed non-necessary destroying of autocomplete on autofill
0.4.0 (13-11-2017)
=========================
- Fixed showing context menu on password fields with Firefox

View file

@ -1,4 +1,4 @@
var browserAction = {};
const browserAction = {};
const BLINK_TIMEOUT_DEFAULT = 7500;
const BLINK_TIMEOUT_REDIRECT_THRESHOLD_TIME_DEFAULT = -1;

View file

@ -1,4 +1,4 @@
var kpxcEvent = {};
const kpxcEvent = {};
kpxcEvent.onMessage = function(request, sender, callback) {
if (request.action in kpxcEvent.messageHandlers) {
@ -124,7 +124,7 @@ kpxcEvent.onLoadKeyRing = function(callback, tab) {
kpxcEvent.onSaveSettings = function(callback, tab, settings) {
browser.storage.local.set({'settings': settings}).then(function() {
kpxcEvent.onLoadSettings();
kpxcEvent.onLoadSettings(callback, tab);
});
};

View file

@ -1,4 +1,4 @@
var httpAuth = httpAuth || {};
const httpAuth = {};
httpAuth.requests = [];
httpAuth.pendingCallbacks = [];

View file

@ -11,7 +11,7 @@ keepass.migrateKeyRing().then(() => {
});
// Milliseconds for intervall (e.g. to update browserAction)
let _interval = 250;
const _interval = 250;
/**

View file

@ -1,6 +1,6 @@
'use strict';
var keepass = {};
const keepass = {};
keepass.associated = {'value': false, 'hash': null};
keepass.keyPair = {publicKey: null, secretKey: null};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,38 +1,47 @@
.cip-ui-autocomplete li.cip-ui-menu-item {
.kpxc .ui-autocomplete li.ui-menu-item {
text-align: left !important;
font-size: 12px !important;
font-size: .9em !important;
font-weight: normal !important;
font-style: normal !important;
font-family: Verdana, Arial, sans-serif !important;
color: #222222 !important;
}
.ui-dialog-titlebar-close {
.ui-helper-hidden-accessible {
display: none !important;
}
.kpxc .ui-dialog-titlebar-close {
visibility: hidden !important;
}
.ui-dialog {
.kpxc .ui-dialog {
font-size: 12px !important;
}
.dialog-form .ui-dialog-content .ui-widget-content {
.kpxc .ui-widget-overlay {
opacity: 0.0 !important;
}
.kpxc .dialog-form .ui-dialog-content .ui-widget-content {
max-height: 80px !important;
}
.ui-dialog-titlebar {
.kpxc .ui-dialog-titlebar {
background-color: #3a8233;
color: #fff;
}
.ui-dialog .ui-dialog-buttonpane {
.kpxc .ui-dialog .ui-dialog-buttonpane {
text-align: center !important;
}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
.kpxc .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
float: none !important;
}
.ui-button .ui-button-text .ui-button {
font-size: .10em !important;
.kpxc .ui-button .ui-button-text .ui-button {
font-size: .10em !important;
}
input.genpw-text {
@ -44,6 +53,7 @@ input.genpw-text {
border-collapse: separate;
width: 100%;
}
.genpw-input-group-addon {
font-size: inherit !important;
background-color: #eee;
@ -69,10 +79,12 @@ input.genpw-text {
position: absolute;
cursor: pointer;
}
.cip-genpw-icon.key {
background: url('chrome-extension://__MSG_@@extension_id__/icons/key.png') right no-repeat;
background-size: contain;
}
.cip-genpw-icon.key-moz {
background: url('moz-extension://__MSG_@@extension_id__/icons/key.png') right no-repeat;
background-size: contain;
@ -90,6 +102,7 @@ input.genpw-text {
left: 0;
z-index: 2147483645;
}
.b2c-modal-backdrop:after {
content:'';
position: fixed;
@ -101,9 +114,11 @@ input.genpw-text {
opacity: 0.8;
filter: alpha(opacity=80);
}
#b2c-cipDefine-fields {
z-index: 2147483646;
}
#b2c-cipDefine-description {
z-index: 2147483646;
color: #efefef;
@ -117,6 +132,7 @@ input.genpw-text {
background-color:rgba(255,255,255,0.3);
font-size: 15px;
}
#b2c-cipDefine-description div:first-of-type {
margin-top: 0;
padding-top: 0;
@ -126,6 +142,7 @@ input.genpw-text {
font-weight: bold;
font-size: 160%;
}
#b2c-cipDefine-description p {
margin-top: 10px;
padding-top: 10px;
@ -133,9 +150,11 @@ input.genpw-text {
border-top: 2px solid #666666;
line-height: 110%;
}
#b2c-help {
margin-bottom: 3px;
}
.b2c-fixed-field {
position: absolute;
border: 2px solid #efefef;
@ -145,27 +164,30 @@ input.genpw-text {
font-weight: bold;
background-color:rgba(239,239,239,0.4);
}
.b2c-fixed-hover-field {
border: 2px solid orange;
background-color:rgba(255,165,239,0.4);
}
.b2c-fixed-password-field {
border: 2px solid red;
color: #efefef;
background-color:rgba(255,0,0,0.4);
}
.b2c-fixed-username-field {
border: 2px solid limegreen;
color: #efefef;
background-color:rgba(50,205,50,0.4);
}
.b2c-fixed-string-field {
border: 2px solid deepskyblue;
color: #efefef;
background-color:rgba(30,144,255,0.4);
}
.b2c-input-append {
display: inline-block;
margin-bottom: 10px;
@ -197,4 +219,4 @@ input.genpw-text {
.b2c-input-append select:focus,
.b2c-input-append .b2c-b2c-uneditable-input:focus {
z-index: 2;
}
}

View file

@ -4,6 +4,9 @@ $(this.target).find('input').autocomplete();
// contains already called method names
var _called = {};
// Count of detected form fields on the page
var _detectedFields = 0;
browser.runtime.onMessage.addListener(function(req, sender, callback) {
if ('action' in req) {
if (req.action === 'fill_user_pass_with_specific_login') {
@ -80,13 +83,19 @@ var cipAutocomplete = {};
cipAutocomplete.elements = [];
cipAutocomplete.init = function(field) {
if (field.hasClass('ui-autocomplete-input')) {
//_f(credentialInputs[i].username).autocomplete('source', autocompleteSource);
if (cip.settings.autoFillSingleEntry && cip.credentials.length === 1 && field.hasClass('ui-autocomplete-input')) {
field.autocomplete('destroy');
}
let acMenu = jQuery('#kpxc-ac-menu');
if (acMenu.length == 0) {
jQuery('<div id="kpxc-ac-menu" class="kpxc"></div>').appendTo('body');
}
field
.addClass('kpxc')
.autocomplete({
appendTo: '#kpxc-ac-menu',
minLength: 0,
source: cipAutocomplete.onSource,
select: cipAutocomplete.onSelect,
@ -103,12 +112,10 @@ cipAutocomplete.onClick = function() {
};
cipAutocomplete.onOpen = function(event, ui) {
// NOT BEAUTIFUL!
// modifies ALL ui-autocomplete menus of class .cip-ui-menu
jQuery('ul.ui-autocomplete.ui-menu').css('z-index', 2147483636);
};
cipAutocomplete.onSource = function (request, callback) {
cipAutocomplete.onSource = function(request, callback) {
const matches = jQuery.map(cipAutocomplete.elements, (tag) => {
if (tag.label.toUpperCase().indexOf(request.term.toUpperCase()) === 0) {
return tag;
@ -117,7 +124,7 @@ cipAutocomplete.onSource = function (request, callback) {
callback(matches);
};
cipAutocomplete.onSelect = function (e, ui) {
cipAutocomplete.onSelect = function(e, ui) {
e.preventDefault();
cip.setValueWithChange(jQuery(this), ui.item.value);
const fieldId = cipFields.prepareId(jQuery(this).attr('data-cip-id'));
@ -239,6 +246,7 @@ cipPassword.createDialog = function() {
$dialog.hide();
jQuery('body').append($dialog);
$dialog.dialog({
autoOpen: false,
modal: true,
@ -306,14 +314,20 @@ cipPassword.createDialog = function() {
}
},
open: function(event, ui) {
// Dirty hacks for overlay and custom CSS
jQuery('.ui-widget-overlay').wrap('<span class="kpxc"></span>');
jQuery('.ui-widget-overlay').click(function() {
jQuery('#cip-genpw-dialog:first').dialog('close');
jQuery('span').remove('.kpxc');
});
if (jQuery('input#cip-genpw-textfield-password:first').val() === '') {
jQuery('button#cip-genpw-btn-generate:first').click();
}
}
},
create: function(event, ui) {
jQuery('.ui-dialog').wrap('<div class="kpxc"></span>');
}
});
};
@ -806,6 +820,7 @@ cipFields.getAllFields = function() {
}
});
_detectedFields = fields.length;
return fields;
};
@ -1075,7 +1090,7 @@ cipFields.useDefinedCredentialFields = function() {
}
if ($found) {
var fields = {
let fields = {
username: creds.username,
password: creds.password,
fields: creds.fields
@ -1111,16 +1126,20 @@ cip.init = function() {
action: 'load_settings',
}).then((response) => {
cip.settings = response;
cip.initCredentialFields();
cip.initCredentialFields(true);
});
};
cip.detectNewActiveFields = function() {
const divDetect = setInterval(function() {
const fields = cipFields.getAllFields();
if (fields.length > 1) {
cip.initCredentialFields(true);
clearInterval(divDetect);
if (document.visibilityState !== 'hidden') {
const fields = cipFields.getAllFields();
// If only password field is shown it's enough to have one field visible for initCredentialFields
if (fields.length > (_detectedFields == 1 ? 0 : 1)) {
cip.initCredentialFields(true);
clearInterval(divDetect);
}
}
}, 1000);
};
@ -1290,8 +1309,16 @@ cip.preparePageForMultipleCredentials = function(credentials) {
// initialize autocomplete for username fields
if (cip.settings.autoCompleteUsernames) {
for (const i of cipFields.combinations) {
if (_f(i.username)) {
cipAutocomplete.init(_f(i.username));
// Both username and password fields are visible
if (_detectedFields >= 2) {
if (_f(i.username)) {
cipAutocomplete.init(_f(i.username));
}
} else if (_detectedFields == 1) {
// If only password field is the visible one
if (_f(i.password)) {
cipAutocomplete.init(_f(i.password));
}
}
}
}

View file

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "keepassxc-browser",
"version": "0.4.0",
"version": "0.4.1",
"description": "KeePassXC integration for modern web browsers",
"author": "Sami Vänttinen",
"icons": {