mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Calculate HTTP authentication popup height based on total credentials
This commit is contained in:
parent
65a13e3dcb
commit
6819844ae8
3 changed files with 10 additions and 14 deletions
|
|
@ -177,13 +177,14 @@ kpxcEvent.onHTTPAuthPopup = async function(tab, data) {
|
|||
|
||||
browserAction.stackUnshift(stackData, tab.id);
|
||||
page.tabs[tab.id].loginList = data;
|
||||
page.tabs[tab.id].titlePreface = `${data.details.realm} (${data.details.challenger.host}) - `;
|
||||
browserAction.show(tab);
|
||||
|
||||
const tabinfo = await browser.tabs.get(tab.id);
|
||||
const windowinfo = await browser.windows.get(tabinfo.windowId);
|
||||
|
||||
const width = 480;
|
||||
const height = 250;
|
||||
const height = 160 + (30 * Math.min(data.logins.length, 8));
|
||||
const dialogData = {
|
||||
width: width, height: height,
|
||||
left: Math.round(windowinfo.left + ((windowinfo.width/2) - (width/2))),
|
||||
|
|
@ -199,7 +200,6 @@ kpxcEvent.onHTTPAuthPopup = async function(tab, data) {
|
|||
|
||||
dialogData.type = 'popup';
|
||||
dialogData.url = `/popups/popup_httpauth.html?tab=${tab.id}`;
|
||||
dialogData.titlePreface = `${data.details.realm} (${data.details.challenger.host}) - `;
|
||||
const wnd = await browser.windows.create(dialogData);
|
||||
page.tabs[tab.id].httpAuthDialog = wnd.id;
|
||||
|
||||
|
|
|
|||
|
|
@ -109,11 +109,6 @@ body {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
#login-list {
|
||||
height: 100px;
|
||||
overflow: hidden auto;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark), (prefers-color-scheme: light) {
|
||||
body {
|
||||
background: var(--background-color) !important;
|
||||
|
|
|
|||
|
|
@ -6,20 +6,20 @@ const getLoginData = async () => {
|
|||
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
|
||||
tabid = parseInt(window.location.search.split('=')[1]) || tabs[0].id;
|
||||
global.page.currentTabId = tabid;
|
||||
document.title = global.page.tabs[tabid].titlePreface + tr('popupTitle');
|
||||
return global.page.tabs[tabid].loginList;
|
||||
};
|
||||
|
||||
$(async () => {
|
||||
await initColorTheme();
|
||||
const data = await getLoginData();
|
||||
const ll = document.getElementById('login-list');
|
||||
let resolve = true;
|
||||
for (let i = 0; i < data.logins.length; ++i) {
|
||||
const a = document.createElement('a');
|
||||
a.setAttribute('class', 'list-group-item');
|
||||
a.textContent = data.logins[i].login + ' (' + data.logins[i].name + ')';
|
||||
$(a).data('creds', data.logins[i]);
|
||||
$(a).click(function() {
|
||||
const a = $('<a/>');
|
||||
a.addClass('list-group-item');
|
||||
a.text(data.logins[i].login + ' (' + data.logins[i].name + ')');
|
||||
a.data('creds', data.logins[i]);
|
||||
a.click(function() {
|
||||
resolve = false;
|
||||
if (data.resolve) {
|
||||
const creds = $(this).data('creds');
|
||||
|
|
@ -32,7 +32,7 @@ $(async () => {
|
|||
}
|
||||
close();
|
||||
});
|
||||
ll.appendChild(a);
|
||||
a.appendTo('#login-list');
|
||||
}
|
||||
|
||||
$('#btn-dismiss').click(async () => {
|
||||
|
|
@ -41,6 +41,7 @@ $(async () => {
|
|||
close();
|
||||
});
|
||||
|
||||
|
||||
window.addEventListener('beforeunload', async () => {
|
||||
const global = await browser.runtime.getBackgroundPage();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue