use hostname, add close button to frame

This commit is contained in:
Evert Prants 2022-08-28 10:16:36 +03:00
parent e227f9aaf7
commit caea4f90fd
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 22 additions and 1 deletions

View File

@ -82,7 +82,7 @@ async function injectForeground() {
const parsed = new URL(tab.url); const parsed = new URL(tab.url);
askNative({ askNative({
domain: parsed.host, domain: parsed.hostname,
}).then(({ results }) => { }).then(({ results }) => {
if (results && results.length) { if (results && results.length) {
currentPageMatches = results; currentPageMatches = results;

View File

@ -161,6 +161,27 @@
}); });
}); });
autoFillContainer.appendChild(select); autoFillContainer.appendChild(select);
const close = document.createElement('button');
close.innerText = 'close';
Object.assign(close.style, {
right: '0',
border: '0',
position: 'absolute',
padding: '0 4px',
appearance: 'none',
background: 'transparent',
fontWeight: 'bold',
fontSize: '12px',
pointerEvents: 'all'
});
autoFillContainer.appendChild(close);
close.addEventListener('click', () => {
autoFillContainer.parentElement.removeChild(autoFillContainer);
window.removeEventListener('resize', reposition);
window.removeEventListener('scroll', reposition);
});
} }
function init() { function init() {