-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into opentherm-next-docs
- Loading branch information
Showing
21 changed files
with
266 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!-- docs/_templates/search.html --> | ||
{% extends "page.html" %} | ||
|
||
{%- block htmltitle -%} | ||
<title>{{ _("Search") }} - {{ docstitle }}</title> | ||
{%- endblock htmltitle -%} | ||
|
||
{% block content %} | ||
<h1>{{ _("Search") }}</h1> | ||
<div id="search"></div> | ||
{% endblock %} | ||
|
||
{% block scripts -%} | ||
{{ super() }} | ||
{%- endblock scripts %} | ||
|
||
{% block extra_styles -%} | ||
{{ super() }} | ||
<style type="text/css"> | ||
#search form input[type="text"] { | ||
box-sizing: border-box; | ||
width: 100%; | ||
line-height: 2em; | ||
padding-inline: 0.6em; | ||
font-size: 1.2rem; | ||
border-radius: 0.05rem; | ||
border: 2px solid var(--color-foreground-border); | ||
border-bottom-color: 2px solid var(--color-foreground-secondary); | ||
transition: border-color 20ms ease; | ||
} | ||
#search form input[type="text"]:focus { | ||
border-color: var(--color-foreground-primary); | ||
} | ||
</style> | ||
{%- endblock extra_styles %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<script src="/pagefind/pagefind-modular-ui.js"></script> | ||
<div class="pagefind-ui__form" id="search"></div> | ||
<div class="search-results" id="mobile-search-results"></div> | ||
<script> | ||
let callbackAdded = null; | ||
|
||
window.addEventListener('DOMContentLoaded', (event) => { | ||
const std_target = document.getElementById("search-results"); | ||
const mobile_target = document.getElementById("mobile-search-results"); | ||
const inpel = document.getElementById("search"); | ||
|
||
function showTarget() { | ||
var target = std_target; | ||
if (window.innerWidth <= 875) { | ||
target = mobile_target; | ||
std_target.style.display = "none"; | ||
} else { | ||
mobile_target.style.display = "none"; | ||
} | ||
target.style.display = "block"; | ||
const rect = target.getBoundingClientRect(); | ||
const height = window.innerHeight; | ||
target.style.width = "100%"; | ||
target.style.height = "fit-content"; | ||
target.style.maxHeight = (height - rect.top - 10) + "px"; | ||
if (!callbackAdded) { | ||
callbackAdded = true; | ||
document.addEventListener('click', clickCallback); | ||
} | ||
} | ||
|
||
function hideTargets() { | ||
std_target.style.display = "none"; | ||
mobile_target.style.display = "none"; | ||
std_target.style.height = "0"; | ||
mobile_target.style.height = "0"; | ||
if (callbackAdded) { | ||
document.removeEventListener('click', clickCallback); | ||
callbackAdded = false; | ||
} | ||
} | ||
|
||
|
||
const instance = new PagefindModularUI.Instance({ | ||
showSubResults: true, | ||
showImages: false, | ||
ranking: { | ||
pageLength: 0.0, | ||
termSaturation: 1.6, | ||
termFrequency: 0.4, | ||
termSimilarity: 6.0 | ||
} | ||
}); | ||
|
||
instance.add(new PagefindModularUI.Input({ | ||
containerElement: "#search" | ||
})); | ||
|
||
instance.add(new PagefindModularUI.ResultList({ | ||
containerElement: "#search-results" | ||
})); | ||
instance.add(new PagefindModularUI.ResultList({ | ||
containerElement: "#mobile-search-results" | ||
})); | ||
|
||
const clickCallback = (event) => { | ||
const path = event.composedPath(); | ||
if (path.includes(std_target) || path.includes(mobile_target) || path.includes(inpel)) | ||
return; | ||
hideTargets(); | ||
}; | ||
if (std_target && mobile_target) { | ||
instance.on("results", (results) => { | ||
if (results.results.length) { | ||
showTarget(); | ||
} else { | ||
hideTargets(); | ||
} | ||
}); | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.