mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-23 23:21:00 +01:00
Improve support for instant loading with keyboard navigation
This commit is contained in:
parent
ea9446e6cb
commit
405dfce64c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
8
material/assets/javascripts/bundle.7825f8c2.min.js.map
Normal file
8
material/assets/javascripts/bundle.7825f8c2.min.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -240,7 +240,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.220ee61c.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.7825f8c2.min.js' | url }}"></script>
|
||||
{% for script in config.extra_javascript %}
|
||||
{% if script.path %}
|
||||
{{ script | script_tag }}
|
||||
|
@ -10,7 +10,7 @@
|
||||
<nav class="md-footer__inner md-grid" aria-label="{{ lang.t('footer') }}" {{ hidden }}>
|
||||
{% if page.previous_page %}
|
||||
{% set direction = lang.t("footer.previous") %}
|
||||
<a href="{{ page.previous_page.url | url }}" class="md-footer__link md-footer__link--prev" aria-label="{{ direction }}: {{ page.previous_page.title | e }}" rel="prev">
|
||||
<a href="{{ page.previous_page.url | url }}" class="md-footer__link md-footer__link--prev" aria-label="{{ direction }}: {{ page.previous_page.title | e }}">
|
||||
<div class="md-footer__button md-icon">
|
||||
{% include ".icons/material/arrow-left.svg" %}
|
||||
</div>
|
||||
@ -26,7 +26,7 @@
|
||||
{% endif %}
|
||||
{% if page.next_page %}
|
||||
{% set direction = lang.t("footer.next") %}
|
||||
<a href="{{ page.next_page.url | url }}" class="md-footer__link md-footer__link--next" aria-label="{{ direction }}: {{ page.next_page.title | e }}" rel="next">
|
||||
<a href="{{ page.next_page.url | url }}" class="md-footer__link md-footer__link--next" aria-label="{{ direction }}: {{ page.next_page.title | e }}">
|
||||
<div class="md-footer__title">
|
||||
<span class="md-footer__direction">
|
||||
{{ direction }}
|
||||
|
@ -33,23 +33,23 @@
|
||||
"rss.updated": "आरएसएस सेवातः नवीनतमं अद्यतनम्",
|
||||
"search": "अन्वेषण",
|
||||
"search.placeholder": "अन्वेषण",
|
||||
"search.share": "साझां कुर्वन्तु",
|
||||
"search.share": "भजतु",
|
||||
"search.reset": "तत् स्वच्छं कुर्वन्तु",
|
||||
"search.result.initializer": "अन्वेषणस्य आरम्भः",
|
||||
"search.result.placeholder": "अन्वेषणं आरभ्य लिखन्तु",
|
||||
"search.result.none": "मेलयुक्ताः दस्तावेजाः नास्ति",
|
||||
"search.result.one": "१ मेलकर्ता दस्तावेजः अस्ति",
|
||||
"search.result.other": "# मेलनदस्तावेजाः सन्ति",
|
||||
"search.result.more.one": "अस्मिन् पृष्ठे १ अधिकं अस्ति",
|
||||
"search.result.more.other": "अस्मिन् पृष्ठे # अधिकाः सन्ति",
|
||||
"search.result.term.missing": "असमेत",
|
||||
"search.result.none": "अभिलेखाः नास्ति",
|
||||
"search.result.one": "१ अभिलेखः अस्ति",
|
||||
"search.result.other": "# अभिलेखाः सन्ति",
|
||||
"search.result.more.one": "अस्मिन् पृष्ठे १ अन्यः अस्ति",
|
||||
"search.result.more.other": "अस्मिन् पृष्ठे # अन्ये सन्ति",
|
||||
"search.result.term.missing": "शून्य",
|
||||
"select.language": "भाषां चिनोतु",
|
||||
"select.version": "संस्करणं चिनोतु",
|
||||
"source": "भण्डारं गच्छन्तु",
|
||||
"source.file.contributors": "अंशदाता",
|
||||
"source.file.date.created": "ननिर्माणस्य तिथिः",
|
||||
"source.file.date.updated": "परिवर्तनस्य तिथिः",
|
||||
"tabs": "दस्तावेजस्य प्रमुखः",
|
||||
"tabs": "पट्टाः",
|
||||
"toc": "सामग्रीसारणी",
|
||||
"top": "पुनः उपरिभागं प्रति गच्छन्तु"
|
||||
}[key] }}{% endmacro %}
|
||||
|
@ -178,7 +178,10 @@ keyboard$
|
||||
case ",":
|
||||
const prev = getOptionalElement<HTMLLinkElement>("link[rel=prev]")
|
||||
if (typeof prev !== "undefined")
|
||||
setLocation(prev)
|
||||
if (feature("navigation.instant"))
|
||||
location$.next(new URL(prev.href))
|
||||
else
|
||||
setLocation(prev)
|
||||
break
|
||||
|
||||
/* Go to next page */
|
||||
@ -186,7 +189,10 @@ keyboard$
|
||||
case ".":
|
||||
const next = getOptionalElement<HTMLLinkElement>("link[rel=next]")
|
||||
if (typeof next !== "undefined")
|
||||
setLocation(next)
|
||||
if (feature("navigation.instant"))
|
||||
location$.next(new URL(next.href))
|
||||
else
|
||||
setLocation(next)
|
||||
break
|
||||
|
||||
/* Expand navigation, see https://bit.ly/3ZjG5io */
|
||||
|
@ -227,6 +227,8 @@ export function setupInstantLoading(
|
||||
|
||||
// Meta tags
|
||||
"title",
|
||||
"link[rel=prev]",
|
||||
"link[rel=next]",
|
||||
"link[rel=canonical]",
|
||||
"meta[name=author]",
|
||||
"meta[name=description]",
|
||||
|
@ -42,7 +42,6 @@
|
||||
href="{{ page.previous_page.url | url }}"
|
||||
class="md-footer__link md-footer__link--prev"
|
||||
aria-label="{{ direction }}: {{ page.previous_page.title | e }}"
|
||||
rel="prev"
|
||||
>
|
||||
<div class="md-footer__button md-icon">
|
||||
{% include ".icons/material/arrow-left.svg" %}
|
||||
@ -65,7 +64,6 @@
|
||||
href="{{ page.next_page.url | url }}"
|
||||
class="md-footer__link md-footer__link--next"
|
||||
aria-label="{{ direction }}: {{ page.next_page.title | e }}"
|
||||
rel="next"
|
||||
>
|
||||
<div class="md-footer__title">
|
||||
<span class="md-footer__direction">
|
||||
|
Loading…
Reference in New Issue
Block a user