More various fixes

This commit is contained in:
varjolintu 2017-09-11 18:04:39 +03:00
parent b1b5e3642e
commit 971d5e5e42
3 changed files with 32 additions and 36 deletions

View file

@ -6,18 +6,12 @@ keepass.migrateKeyRing().then(() => {
keepass.connectToNative();
keepass.generateNewKeyPair();
keepass.changePublicKeys(null, (pkRes) => {
keepass.getDatabaseHash((gdRes) => {
// create tab information structure for every opened tab
page.initOpenedTabs();
// set initial tab-ID
browser.tabs.query({"active": true, "currentWindow": true}).then((tabs) => {
if (tabs.length === 0)
return; // For example: only the background devtools or a popup are opened
page.currentTabId = tabs[0].id;
browserAction.show(null, tabs[0]);
});
}, null);
// create tab information structure for every opened tab
page.initOpenedTabs().then(() => {
keepass.getDatabaseHash((gdRes) => {
}, null);
});
});
});
});

View file

@ -12,7 +12,6 @@ var page = {};
page.tabs = {};
page.currentTabId = -1;
page.settings = (typeof(localStorage.settings) === 'undefined') ? {} : JSON.parse(localStorage.settings);
page.blockedTabs = {};
page.migrateSettings = () => {
@ -64,10 +63,23 @@ page.initSettings = function() {
}
page.initOpenedTabs = function() {
browser.tabs.query({}).then((tabs) => {
for (const i of tabs) {
page.createTabEntry(i.id);
}
return new Promise((resolve, reject) => {
browser.tabs.query({}).then(function (tabs) {
for (var i = 0; i < tabs.length; i++) {
page.createTabEntry(tabs[i].id);
}
// set initial tab-ID
browser.tabs.query({ "active": true, "currentWindow": true }).then(function (tabs) {
if (tabs.length === 0) {
resolve();
return; // For example: only the background devtools or a popup are opened
}
page.currentTabId = tabs[0].id;
browserAction.show(null, tabs[0]);
resolve();
});
});
});
}

View file

@ -1098,6 +1098,15 @@ cip.credentials = [];
jQuery(function() {
cip.init();
// Detect div's that include forms and are visible
const divDetect = setInterval(function() {
const fields = cipFields.getAllFields();
if (fields.length > 0) {
cip.initCredentialFields(true);
clearInterval(divDetect);
}
}, 1000);
});
cip.init = function() {
@ -1697,22 +1706,3 @@ cipEvents.triggerActivatedTab = function() {
}).then(cip.retrieveCredentialsCallback);
}
}
// Detect div's that include forms and are visible
$(function() {
const divDetect = setInterval(function() {
/*browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => {
const fields = cipFields.getAllFields();
if (fields.length > 0) {
cip.initCredentialFields(true);
clearInterval(divDetect);
}
});*/
const fields = cipFields.getAllFields();
if (fields.length > 0) {
cip.initCredentialFields(true);
clearInterval(divDetect);
}
console.log("Check..");
}, 1000);
});