parent
b2541606e4
commit
99a028a64f
6 changed files with 14 additions and 11 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@ayco/cozy",
|
"name": "@ayco/cozy",
|
||||||
"version": "0.1.21",
|
"version": "0.1.22",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@ayco/cozy",
|
"name": "@ayco/cozy",
|
||||||
"version": "0.1.21",
|
"version": "0.1.22",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/netlify": "^2.2.2",
|
"@astrojs/netlify": "^2.2.2",
|
||||||
"@extractus/article-extractor": "^7.2.15",
|
"@extractus/article-extractor": "^7.2.15",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ayco/cozy",
|
"name": "@ayco/cozy",
|
||||||
"version": "0.1.21",
|
"version": "0.1.22",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "astro dev",
|
"start": "astro dev",
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
|
|
|
@ -9,7 +9,7 @@ const placeholder = 'Type the URL of an article here';
|
||||||
|
|
||||||
<div class="address-bar">
|
<div class="address-bar">
|
||||||
<form>
|
<form>
|
||||||
<button aria-label="Home" title="Home" class="left-button" type="button" id="app-home" name="app-home" onclick="history.back();" hidden>
|
<button aria-label="Home" title="Home" class="left-button" type="button" id="app-home" name="app-home" onclick="history.go(-1); return false;" hidden>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M17.51 3.87L15.73 2.1L5.84 12l9.9 9.9l1.77-1.77L9.38 12l8.13-8.13z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M17.51 3.87L15.73 2.1L5.84 12l9.9 9.9l1.77-1.77L9.38 12l8.13-8.13z"/></svg>
|
||||||
</button>
|
</button>
|
||||||
<input type="text" id="app-url" name="url" value={url} placeholder={placeholder} />
|
<input type="text" id="app-url" name="url" value={url} placeholder={placeholder} />
|
||||||
|
|
|
@ -75,7 +75,7 @@ const {postDivSelector, skipSave = false} = Astro.props;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
window.onpopstate = async (data) => {
|
window.addEventListener('popstate', async (data) => {
|
||||||
let url = data.state?.url;
|
let url = data.state?.url;
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
|
@ -87,7 +87,7 @@ const {postDivSelector, skipSave = false} = Astro.props;
|
||||||
const responseText = data;
|
const responseText = data;
|
||||||
renderPost(responseText, url, postDivSelector?.value, true);
|
renderPost(responseText, url, postDivSelector?.value, true);
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ if (url === '') {
|
||||||
content: "<p>Enter a URL above to get started.</p>",
|
content: "<p>Enter a URL above to get started.</p>",
|
||||||
url: '/'
|
url: '/'
|
||||||
};
|
};
|
||||||
|
skipSave = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -77,6 +77,8 @@ export function renderPost(responseText, url, postDivSelector: string, preventPu
|
||||||
const cozyUrl = html.querySelector('meta[property="cozy:url"]')?.getAttribute('content');
|
const cozyUrl = html.querySelector('meta[property="cozy:url"]')?.getAttribute('content');
|
||||||
if(cozyUrl !== '/') {
|
if(cozyUrl !== '/') {
|
||||||
appUrl.value = cozyUrl || '';
|
appUrl.value = cozyUrl || '';
|
||||||
|
} else {
|
||||||
|
appUrl.value = '';
|
||||||
}
|
}
|
||||||
if(!preventPushState) {
|
if(!preventPushState) {
|
||||||
window.history.pushState({url}, '', url);
|
window.history.pushState({url}, '', url);
|
||||||
|
|
Loading…
Reference in a new issue