Added search
This commit is contained in:
@@ -12,7 +12,7 @@ Any help is greatly appreciated!
|
||||
- [Bootswatch](https://bootswatch.com)
|
||||
|
||||
## TODO
|
||||
- Make search work
|
||||
- search form on submit
|
||||
- docs of all variables
|
||||
- use it in small project
|
||||
- make theme available
|
||||
|
||||
@@ -12,6 +12,8 @@ taxonomies = [
|
||||
{name = "authors", paginate_by = 5},
|
||||
]
|
||||
|
||||
build_search_index = true
|
||||
|
||||
[markdown]
|
||||
highlight_code = true
|
||||
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<p>This site provides a demo for the Zolastrap theme for
|
||||
<a href="https://www.getzola.org/">Zola</a> static site generator based on
|
||||
@@ -696,7 +702,7 @@
|
||||
<a href="https://github.com/marcodpt/zolastrap">GitHub repository</a>.</p>
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Aesonis quam leves senex artes tellus nam</h1>
|
||||
<p class="text-muted">
|
||||
@@ -793,7 +799,7 @@ tamen <a href="http://nunc-iam.com/">lacrimis</a>, quodque sidera Eurotan aether
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Alite quid bulla si fraudem sed nuper</h1>
|
||||
<p class="text-muted">
|
||||
@@ -856,7 +862,7 @@ saxa: quid malleus iubentque quae, <em>et semina</em>, Victoria.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Belli aera salutem et tanget facinusque Theti</h1>
|
||||
<p class="text-muted">
|
||||
@@ -800,7 +806,7 @@ ligavit, iaculantem pressus corpore fuerant magni!</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Colli desiluit cunctis</h1>
|
||||
<p class="text-muted">
|
||||
@@ -789,7 +795,7 @@ terrigenae respersit ergo miles velat, regia erat cingo, aut.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Corpore ventis sanguine Siculaeque quae dumosaque natum</h1>
|
||||
<p class="text-muted">
|
||||
@@ -864,7 +870,7 @@ ictibus moribunda. Sidera perosus.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Hanc sit loquuntur et atque</h1>
|
||||
<p class="text-muted">
|
||||
@@ -802,7 +808,7 @@ discors tam sed frater.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Hunc et corpus mihi Cephisias pater</h1>
|
||||
<p class="text-muted">
|
||||
@@ -803,7 +809,7 @@ arserunt luminis. Reor domus quas, illa praebet.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
|
||||
|
||||
@@ -1048,7 +1054,7 @@ odere. Cunas placidissime volucrem ora generumque...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Ipse aggere igne</h1>
|
||||
<p class="text-muted">
|
||||
@@ -792,7 +798,7 @@ tollens victor! Te <a href="http://iresine.net/haut">miserere mittit</a>!</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Loquaci ferarum substravit illa et flaventi manu</h1>
|
||||
<p class="text-muted">
|
||||
@@ -788,7 +794,7 @@ negarent</strong> altera violasse!</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Lumina populusque aquas subiectis superbus et repens</h1>
|
||||
<p class="text-muted">
|
||||
@@ -812,7 +818,7 @@ nefanda.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Manusque membra caput tenentes elue relevare succendit</h1>
|
||||
<p class="text-muted">
|
||||
@@ -792,7 +798,7 @@ verti septem inde vocalis, Indigetes flamina decreta per dea verba <em>puduit</e
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
|
||||
|
||||
@@ -1074,7 +1080,7 @@ Atlantis, sunt iter nubibus. Nemo surgit, ore puppe...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
|
||||
|
||||
@@ -991,7 +997,7 @@ falsaque non harenae, Pelasgos addunt Cerealia in mente quem...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Perseia nato est obruta astris experientis et</h1>
|
||||
<p class="text-muted">
|
||||
@@ -784,7 +790,7 @@ spatiosumque minimo fertur?</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Radices pennas dolor frigida regna parens muta</h1>
|
||||
<p class="text-muted">
|
||||
@@ -806,7 +812,7 @@ oculis</em> exilium regemque orbem.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Regibus solet qui</h1>
|
||||
<p class="text-muted">
|
||||
@@ -798,7 +804,7 @@ stramine <strong>paret</strong>, autem, mentem, sic partem sparsisque.</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
|
||||
|
||||
@@ -1079,7 +1085,7 @@ Merito crate...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
|
||||
|
||||
@@ -814,7 +820,7 @@ Actoriden rapidi numeroque orbem in pomaria docta, usus et...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
|
||||
|
||||
@@ -848,7 +854,7 @@ falsaque non harenae, Pelasgos addunt Cerealia in mente quem...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Authors</h1>
|
||||
|
||||
@@ -808,7 +814,7 @@
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
|
||||
|
||||
@@ -989,7 +995,7 @@ Atlantis, sunt iter nubibus. Nemo surgit, ore puppe...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
|
||||
|
||||
@@ -1049,7 +1055,7 @@ Atlantis, sunt iter nubibus. Nemo surgit, ore puppe...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
Vendored
+10
File diff suppressed because one or more lines are too long
+12
-6
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
|
||||
|
||||
@@ -2271,7 +2277,7 @@ Miseram perstas. Coluit excita;...</small>
|
||||
|
||||
|
||||
<div
|
||||
id="bs-carousel-116049249"
|
||||
id="bs-carousel-712376891"
|
||||
class="carousel slide"
|
||||
data-bs-ride="carousel"
|
||||
>
|
||||
@@ -2522,7 +2528,7 @@ Miseram perstas. Coluit excita;...</small>
|
||||
<button
|
||||
class="carousel-control-prev"
|
||||
type="button"
|
||||
data-bs-target="#bs-carousel-116049249"
|
||||
data-bs-target="#bs-carousel-712376891"
|
||||
data-bs-slide="prev"
|
||||
>
|
||||
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||
@@ -2531,7 +2537,7 @@ Miseram perstas. Coluit excita;...</small>
|
||||
<button
|
||||
class="carousel-control-next"
|
||||
type="button"
|
||||
data-bs-target="#bs-carousel-116049249"
|
||||
data-bs-target="#bs-carousel-712376891"
|
||||
data-bs-slide="next"
|
||||
>
|
||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||
@@ -3010,7 +3016,7 @@ Miseram perstas. Coluit excita;...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
function closeSearch() {
|
||||
const main = document.querySelector('main')
|
||||
main.innerHTML = window.main
|
||||
}
|
||||
|
||||
function goSearch(btn) {
|
||||
const term = btn
|
||||
.closest('form')
|
||||
.querySelector('input[type="text"]')
|
||||
.value.trim()
|
||||
const terms = term.split(" ")
|
||||
|
||||
const main = document.querySelector('main')
|
||||
if (!window.main) {
|
||||
window.main = main.innerHTML
|
||||
}
|
||||
|
||||
var index = elasticlunr.Index.load(window.searchIndex);
|
||||
var results = index.search(term, {
|
||||
bool: "AND",
|
||||
fields: {
|
||||
title: {
|
||||
boost: 2
|
||||
},
|
||||
body: {
|
||||
boost: 1
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
var info = ''
|
||||
var data = ''
|
||||
if (results.length) {
|
||||
info = `Results for: ${term}`
|
||||
data = `
|
||||
<ul class="list-group">${results.map(function (item) {
|
||||
return `
|
||||
<li class="list-group-item">
|
||||
<a href="${item.ref}">${item.doc.title}</a>
|
||||
<div>${makeTeaser(item.doc.body, terms)}</div>
|
||||
</li>
|
||||
`
|
||||
}).join("")}</ul>
|
||||
`
|
||||
} else {
|
||||
info = `No results for: ${term}`
|
||||
}
|
||||
|
||||
var html = `
|
||||
<h1>
|
||||
<button
|
||||
class="btn btn-link"
|
||||
type="button"
|
||||
onclick="closeSearch()"
|
||||
>
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
${info}
|
||||
</h1>
|
||||
${data}
|
||||
`
|
||||
|
||||
main.innerHTML = html
|
||||
}
|
||||
|
||||
function makeTeaser(body, terms) {
|
||||
var TERM_WEIGHT = 40;
|
||||
var NORMAL_WORD_WEIGHT = 2;
|
||||
var FIRST_WORD_WEIGHT = 8;
|
||||
var TEASER_MAX_WORDS = 30;
|
||||
|
||||
var stemmedTerms = terms.map(function (w) {
|
||||
return elasticlunr.stemmer(w.toLowerCase());
|
||||
});
|
||||
var termFound = false;
|
||||
var index = 0;
|
||||
var weighted = []; // contains elements of ["word", weight, index_in_document]
|
||||
|
||||
// split in sentences, then words
|
||||
var sentences = body.toLowerCase().split(". ");
|
||||
|
||||
for (var i in sentences) {
|
||||
var words = sentences[i].split(" ");
|
||||
var value = FIRST_WORD_WEIGHT;
|
||||
|
||||
for (var j in words) {
|
||||
var word = words[j];
|
||||
|
||||
if (word.length > 0) {
|
||||
for (var k in stemmedTerms) {
|
||||
if (elasticlunr.stemmer(word).startsWith(stemmedTerms[k])) {
|
||||
value = TERM_WEIGHT;
|
||||
termFound = true;
|
||||
}
|
||||
}
|
||||
weighted.push([word, value, index]);
|
||||
value = NORMAL_WORD_WEIGHT;
|
||||
}
|
||||
|
||||
index += word.length;
|
||||
index += 1; // ' ' or '.' if last word in sentence
|
||||
}
|
||||
|
||||
index += 1; // because we split at a two-char boundary '. '
|
||||
}
|
||||
|
||||
if (weighted.length === 0) {
|
||||
return body;
|
||||
}
|
||||
|
||||
var windowWeights = [];
|
||||
var windowSize = Math.min(weighted.length, TEASER_MAX_WORDS);
|
||||
// We add a window with all the weights first
|
||||
var curSum = 0;
|
||||
for (var i = 0; i < windowSize; i++) {
|
||||
curSum += weighted[i][1];
|
||||
}
|
||||
windowWeights.push(curSum);
|
||||
|
||||
for (var i = 0; i < weighted.length - windowSize; i++) {
|
||||
curSum -= weighted[i][1];
|
||||
curSum += weighted[i + windowSize][1];
|
||||
windowWeights.push(curSum);
|
||||
}
|
||||
|
||||
// If we didn't find the term, just pick the first window
|
||||
var maxSumIndex = 0;
|
||||
if (termFound) {
|
||||
var maxFound = 0;
|
||||
// backwards
|
||||
for (var i = windowWeights.length - 1; i >= 0; i--) {
|
||||
if (windowWeights[i] > maxFound) {
|
||||
maxFound = windowWeights[i];
|
||||
maxSumIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var teaser = [];
|
||||
var startIndex = weighted[maxSumIndex][2];
|
||||
for (var i = maxSumIndex; i < maxSumIndex + windowSize; i++) {
|
||||
var word = weighted[i];
|
||||
if (startIndex < word[2]) {
|
||||
// missing text from index to start of `word`
|
||||
teaser.push(body.substring(startIndex, word[2]));
|
||||
startIndex = word[2];
|
||||
}
|
||||
|
||||
// add <em/> around search terms
|
||||
if (word[1] === TERM_WEIGHT) {
|
||||
teaser.push("<b>");
|
||||
}
|
||||
startIndex = word[2] + word[0].length;
|
||||
teaser.push(body.substring(word[2], startIndex));
|
||||
|
||||
if (word[1] === TERM_WEIGHT) {
|
||||
teaser.push("</b>");
|
||||
}
|
||||
}
|
||||
teaser.push("…");
|
||||
return teaser.join("");
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: apple</h1>
|
||||
|
||||
@@ -765,7 +771,7 @@ if (copy == 5) {
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: blackberry</h1>
|
||||
|
||||
@@ -757,7 +763,7 @@ Miseram perstas. Coluit excita;...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: cherry</h1>
|
||||
|
||||
@@ -765,7 +771,7 @@ if (copy == 5) {
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: coconut</h1>
|
||||
|
||||
@@ -757,7 +763,7 @@ vultu praesagaque patruus contraria regia sagitta, saepe....</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: grape</h1>
|
||||
|
||||
@@ -758,7 +764,7 @@ fornacibus...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -680,14 +685,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics</h1>
|
||||
|
||||
@@ -812,7 +818,7 @@
|
||||
</a>
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: lemon</h1>
|
||||
|
||||
@@ -773,7 +779,7 @@ Atlantis, sunt iter nubibus. Nemo surgit, ore puppe...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: mango</h1>
|
||||
|
||||
@@ -881,7 +887,7 @@ Merito crate...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: orange</h1>
|
||||
|
||||
@@ -834,7 +840,7 @@ Atlantis, sunt iter nubibus. Nemo surgit, ore puppe...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: papaya</h1>
|
||||
|
||||
@@ -758,7 +764,7 @@ Actoriden rapidi numeroque orbem in pomaria docta, usus et...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: peach</h1>
|
||||
|
||||
@@ -822,7 +828,7 @@ vultu praesagaque patruus contraria regia sagitta, saepe....</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: pear</h1>
|
||||
|
||||
@@ -818,7 +824,7 @@ cupidine vastum fluctus? Ullis in cum adversum ferre. Saltus ut de...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: pineapple</h1>
|
||||
|
||||
@@ -758,7 +764,7 @@ Mihi euhoeque, aliquidque saxa. Opus...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: raspberry</h1>
|
||||
|
||||
@@ -875,7 +881,7 @@ cupidine vastum fluctus? Ullis in cum adversum ferre. Saltus ut de...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: strawberry</h1>
|
||||
|
||||
@@ -762,7 +768,7 @@ Merito crate...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/scheme.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/blockquote.js"></script>
|
||||
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/elasticlunr.min.js"></script>
|
||||
<script defer src="https://marcodpt.github.io/zolastrap/search_index.en.js"></script>
|
||||
<script src="https://marcodpt.github.io/zolastrap/js/search.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -682,14 +687,15 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
|
||||
<h1>Posts by Topics: tangerine</h1>
|
||||
|
||||
@@ -758,7 +764,7 @@ Actoriden rapidi numeroque orbem in pomaria docta, usus et...</small>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-dark
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
function closeSearch() {
|
||||
const main = document.querySelector('main')
|
||||
main.innerHTML = window.main
|
||||
}
|
||||
|
||||
function goSearch(btn) {
|
||||
const term = btn
|
||||
.closest('form')
|
||||
.querySelector('input[type="text"]')
|
||||
.value.trim()
|
||||
const terms = term.split(" ")
|
||||
|
||||
const main = document.querySelector('main')
|
||||
if (!window.main) {
|
||||
window.main = main.innerHTML
|
||||
}
|
||||
|
||||
var index = elasticlunr.Index.load(window.searchIndex);
|
||||
var results = index.search(term, {
|
||||
bool: "AND",
|
||||
fields: {
|
||||
title: {
|
||||
boost: 2
|
||||
},
|
||||
body: {
|
||||
boost: 1
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
var info = ''
|
||||
var data = ''
|
||||
if (results.length) {
|
||||
info = `Results for: ${term}`
|
||||
data = `
|
||||
<ul class="list-group">${results.map(function (item) {
|
||||
return `
|
||||
<li class="list-group-item">
|
||||
<a href="${item.ref}">${item.doc.title}</a>
|
||||
<div>${makeTeaser(item.doc.body, terms)}</div>
|
||||
</li>
|
||||
`
|
||||
}).join("")}</ul>
|
||||
`
|
||||
} else {
|
||||
info = `No results for: ${term}`
|
||||
}
|
||||
|
||||
var html = `
|
||||
<h1>
|
||||
<button
|
||||
class="btn btn-link"
|
||||
type="button"
|
||||
onclick="closeSearch()"
|
||||
>
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
${info}
|
||||
</h1>
|
||||
${data}
|
||||
`
|
||||
|
||||
main.innerHTML = html
|
||||
}
|
||||
|
||||
function makeTeaser(body, terms) {
|
||||
var TERM_WEIGHT = 40;
|
||||
var NORMAL_WORD_WEIGHT = 2;
|
||||
var FIRST_WORD_WEIGHT = 8;
|
||||
var TEASER_MAX_WORDS = 30;
|
||||
|
||||
var stemmedTerms = terms.map(function (w) {
|
||||
return elasticlunr.stemmer(w.toLowerCase());
|
||||
});
|
||||
var termFound = false;
|
||||
var index = 0;
|
||||
var weighted = []; // contains elements of ["word", weight, index_in_document]
|
||||
|
||||
// split in sentences, then words
|
||||
var sentences = body.toLowerCase().split(". ");
|
||||
|
||||
for (var i in sentences) {
|
||||
var words = sentences[i].split(" ");
|
||||
var value = FIRST_WORD_WEIGHT;
|
||||
|
||||
for (var j in words) {
|
||||
var word = words[j];
|
||||
|
||||
if (word.length > 0) {
|
||||
for (var k in stemmedTerms) {
|
||||
if (elasticlunr.stemmer(word).startsWith(stemmedTerms[k])) {
|
||||
value = TERM_WEIGHT;
|
||||
termFound = true;
|
||||
}
|
||||
}
|
||||
weighted.push([word, value, index]);
|
||||
value = NORMAL_WORD_WEIGHT;
|
||||
}
|
||||
|
||||
index += word.length;
|
||||
index += 1; // ' ' or '.' if last word in sentence
|
||||
}
|
||||
|
||||
index += 1; // because we split at a two-char boundary '. '
|
||||
}
|
||||
|
||||
if (weighted.length === 0) {
|
||||
return body;
|
||||
}
|
||||
|
||||
var windowWeights = [];
|
||||
var windowSize = Math.min(weighted.length, TEASER_MAX_WORDS);
|
||||
// We add a window with all the weights first
|
||||
var curSum = 0;
|
||||
for (var i = 0; i < windowSize; i++) {
|
||||
curSum += weighted[i][1];
|
||||
}
|
||||
windowWeights.push(curSum);
|
||||
|
||||
for (var i = 0; i < weighted.length - windowSize; i++) {
|
||||
curSum -= weighted[i][1];
|
||||
curSum += weighted[i + windowSize][1];
|
||||
windowWeights.push(curSum);
|
||||
}
|
||||
|
||||
// If we didn't find the term, just pick the first window
|
||||
var maxSumIndex = 0;
|
||||
if (termFound) {
|
||||
var maxFound = 0;
|
||||
// backwards
|
||||
for (var i = windowWeights.length - 1; i >= 0; i--) {
|
||||
if (windowWeights[i] > maxFound) {
|
||||
maxFound = windowWeights[i];
|
||||
maxSumIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var teaser = [];
|
||||
var startIndex = weighted[maxSumIndex][2];
|
||||
for (var i = maxSumIndex; i < maxSumIndex + windowSize; i++) {
|
||||
var word = weighted[i];
|
||||
if (startIndex < word[2]) {
|
||||
// missing text from index to start of `word`
|
||||
teaser.push(body.substring(startIndex, word[2]));
|
||||
startIndex = word[2];
|
||||
}
|
||||
|
||||
// add <em/> around search terms
|
||||
if (word[1] === TERM_WEIGHT) {
|
||||
teaser.push("<b>");
|
||||
}
|
||||
startIndex = word[2] + word[0].length;
|
||||
teaser.push(body.substring(word[2], startIndex));
|
||||
|
||||
if (word[1] === TERM_WEIGHT) {
|
||||
teaser.push("</b>");
|
||||
}
|
||||
}
|
||||
teaser.push("…");
|
||||
return teaser.join("");
|
||||
}
|
||||
+9
-3
@@ -32,6 +32,11 @@
|
||||
<script src="{{get_url(path="js/theme.js")}}"></script>
|
||||
<script src="{{get_url(path="js/scheme.js")}}"></script>
|
||||
<script src="{{get_url(path="js/blockquote.js")}}"></script>
|
||||
{% if config.build_search_index %}
|
||||
<script defer src="{{get_url(path="elasticlunr.min.js")}}"></script>
|
||||
<script defer src="{{get_url(path="search_index.en.js")}}"></script>
|
||||
<script src="{{get_url(path="js/search.js")}}"></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
@@ -132,17 +137,18 @@
|
||||
/>
|
||||
<button
|
||||
class="btn btn-secondary my-2 my-sm-0"
|
||||
type="submit"
|
||||
type="button"
|
||||
onclick="goSearch(this)"
|
||||
><i class="fas fa-search"></i></button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mx-auto my-5">
|
||||
<main class="container mx-auto my-5">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</main>
|
||||
<footer class="
|
||||
mt-auto p-5
|
||||
bg-{{config.extra.footer_bg}}
|
||||
|
||||
Reference in New Issue
Block a user