diff --git a/src/components/AddressBar.astro b/src/components/AddressBar.astro index c4af5b3..0f4c500 100644 --- a/src/components/AddressBar.astro +++ b/src/components/AddressBar.astro @@ -11,9 +11,6 @@ const placeholder = 'Type the article URL here';
- @@ -21,6 +18,9 @@ const placeholder = 'Type the article URL here'; + @@ -42,6 +42,7 @@ const placeholder = 'Type the article URL here'; if (urlInput.value === '') { backLink.setAttribute('disabled', 'true'); submitBtn.setAttribute('disabled', 'true'); + homeLink.setAttribute('disabled', 'true'); } urlInput.addEventListener('input', (e) => { diff --git a/src/utils/library.ts b/src/utils/library.ts index 8040475..b5b5fde 100644 --- a/src/utils/library.ts +++ b/src/utils/library.ts @@ -73,8 +73,9 @@ export function renderPost(responseText, url, postDivSelector: string, preventPu postDiv.innerHTML = newPost.innerHTML const appUrl = document.getElementById('app-url') as HTMLInputElement; const cozyUrl = html.querySelector('meta[property="cozy:url"]')?.getAttribute('content'); - const backBtn = document.getElementById('app-back') as HTMLButtonElement; - const submitBtn = document.getElementById('submit') as HTMLButtonElement; + const homeBtn = document.querySelector('#app-home'); + const backBtn = document.querySelector('#app-back'); + const submitBtn = document.querySelector('#app-submit'); const title = html.querySelector('meta[property="cozy:title"]')?.getAttribute('content'); @@ -82,12 +83,14 @@ export function renderPost(responseText, url, postDivSelector: string, preventPu if(cozyUrl !== '/') { appUrl.value = cozyUrl || ''; - backBtn.removeAttribute('disabled'); - submitBtn.removeAttribute('disabled'); + backBtn?.removeAttribute('disabled'); + submitBtn?.removeAttribute('disabled'); + homeBtn?.removeAttribute('disabled'); } else { appUrl.value = ''; - backBtn.setAttribute('disabled', 'true'); - submitBtn.setAttribute('disabled', 'true'); + backBtn?.setAttribute('disabled', 'true'); + submitBtn?.setAttribute('disabled', 'true'); + homeBtn?.setAttribute('disabled', 'true'); } if(!preventPushState) {