astro-accelerator 0.0.102 → 0.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/css/main.css +25 -3
- package/public/js/search.js +20 -15
package/package.json
CHANGED
package/public/css/main.css
CHANGED
|
@@ -14,11 +14,11 @@ html {
|
|
|
14
14
|
outline: 0;
|
|
15
15
|
padding: 0;
|
|
16
16
|
vertical-align: baseline;
|
|
17
|
-
|
|
17
|
+
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
html {
|
|
20
20
|
scroll-padding-top: 5em;
|
|
21
|
-
|
|
21
|
+
}
|
|
22
22
|
|
|
23
23
|
body {
|
|
24
24
|
background-color: var(--aft);
|
|
@@ -642,6 +642,28 @@ form.site-search button {
|
|
|
642
642
|
font-family: var(--code-font);
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
.result-headings li {
|
|
646
|
+
display: none;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.result-headings li:nth-child(-n+3) {
|
|
650
|
+
display: block;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.result-headings:has(li:nth-child(n+4))::after {
|
|
654
|
+
content: 'See more >';
|
|
655
|
+
color: var(--fore-link);
|
|
656
|
+
text-decoration: underline;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.result-headings:focus-within li {
|
|
660
|
+
display: block;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
.result-headings:focus-within::after {
|
|
664
|
+
display: none;
|
|
665
|
+
}
|
|
666
|
+
|
|
645
667
|
.show-more {
|
|
646
668
|
padding: 0.5em 1em;
|
|
647
669
|
background-color: var(--fore-link);
|
package/public/js/search.js
CHANGED
|
@@ -188,25 +188,30 @@ function search(s, r) {
|
|
|
188
188
|
markers.className = 'result-text';
|
|
189
189
|
markers.innerHTML = highlight(needle.description, queryTerms);
|
|
190
190
|
|
|
191
|
-
const headings = document.createElement('ul');
|
|
192
|
-
markers.className = 'result-headings';
|
|
193
|
-
|
|
194
|
-
needle.matchedHeadings
|
|
195
|
-
.forEach(h => {
|
|
196
|
-
const item = document.createElement('li');
|
|
197
|
-
const link = document.createElement('a');
|
|
198
|
-
link.href = url + '#' + h.slug;
|
|
199
|
-
link.innerHTML = highlight(h.text, queryTerms);
|
|
200
|
-
item.appendChild(link);
|
|
201
|
-
headings.append(item);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
191
|
const li = document.createElement('li');
|
|
192
|
+
li.dataset.score = (Math.round((needle.score/ total) * 100)).toString();
|
|
205
193
|
li.appendChild(a);
|
|
206
194
|
li.appendChild(path);
|
|
207
195
|
li.appendChild(markers);
|
|
208
|
-
|
|
209
|
-
|
|
196
|
+
|
|
197
|
+
if (needle.matchedHeadings.length > 0) {
|
|
198
|
+
const headings = document.createElement('ul');
|
|
199
|
+
headings.className = 'result-headings';
|
|
200
|
+
|
|
201
|
+
headings.tabIndex = 0;
|
|
202
|
+
|
|
203
|
+
needle.matchedHeadings
|
|
204
|
+
.forEach(h => {
|
|
205
|
+
const item = document.createElement('li');
|
|
206
|
+
const link = document.createElement('a');
|
|
207
|
+
link.href = url + '#' + h.slug;
|
|
208
|
+
link.innerHTML = highlight(h.text, queryTerms);
|
|
209
|
+
item.appendChild(link);
|
|
210
|
+
headings.append(item);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
li.appendChild(headings);
|
|
214
|
+
}
|
|
210
215
|
|
|
211
216
|
ol.appendChild(li);
|
|
212
217
|
}
|