Skip to content
Snippets Groups Projects
Commit 2fa25864 authored by alexisben's avatar alexisben
Browse files

tiny fixes : wip

parent b93621dc
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,9 @@
class Search {
constructor(button, pageFind) {
this.state = {
isOpened: false
};
this.button = button;
this.element = document.querySelector('.search__modal');
this.closeButton = this.element.querySelector('.search__close');
......@@ -16,9 +19,8 @@ class Search {
if (!this.element) {
return;
}
this.state = {
isOpened: false
};
this.input = this.element.querySelector('input');
this.listen();
}
......@@ -28,16 +30,14 @@ class Search {
this.button.classList.add('in-page-with-toc');
}
this.button.addEventListener('click', () => {
this.toggle(true);
this.toggle(true);
this.removedItems = this.element.querySelector('.pagefind-ui__suppressed', '.pagefind-ui__search-clear');
if (this.removedItems) {
this.removedItems.remove();
}
});
this.closeButton.addEventListener('click', () => {
this.input = this.element.querySelector('input');
this.input.value = "";
this.searchInstance.triggerSearch(" ");
this.clearSearch();
this.toggle(false);
});
......@@ -51,6 +51,17 @@ class Search {
});
}
clearSearch() {
const button = this.element.querySelector('.pagefind-ui__button');
this.input.value = "";
this.searchInstance.triggerSearch(false);
this.element.querySelector('.pagefind-ui__message').innerText = "";
this.element.querySelector('.pagefind-ui__results').innerHTML = "";
if (button) {
button.parentElement.removeChild(button);
}
}
innerFocus(event) {
const focusables = 'a, button, input, textarea, select, details, [tabindex], [contenteditable="true"]';
const elements = this.element.querySelectorAll(focusables);
......
......@@ -32,6 +32,7 @@
{{- end -}}
{{- $ogImage := $seoImage -}}
{{- $twitterImage := $seoImage -}}
{{- $pagefindImage := $seoImage -}}
{{- with .Params.image -}}
{{- $id := . -}}
{{ if isset . "id" -}}
......@@ -46,6 +47,10 @@
"media" $image
"size" "1200"
) -}}
{{- $pagefindImage = partial "GetImageUrl" (dict
"media" $image
"size" "244"
) -}}
{{- end -}}
{{- $seoUrl := .Permalink -}}
......@@ -75,6 +80,11 @@
<meta name="twitter:site" content="@{{ site.Data.journal.twitter }}" />
{{ end -}}
{{/* Rajouter la condition si pagefind actif */}}
{{ with $pagefindImage }}
<meta property="pagefind:image" content="" data-pagefind-meta='image:{{ . }}'>
{{ end }}
{{/*
Limiter le tracking par le CDN
https://framagit.org/chatons/CHATONS/-/issues/200#note_1987024
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment