mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed instant loading when used with use_directory_urls: false
This commit is contained in:
parent
d17c488b49
commit
1d790c9000
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -217,7 +217,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.8c3a7438.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.d1d4d62b.min.js' | url }}"></script>
|
||||||
{% for path in config["extra_javascript"] %}
|
{% for path in config["extra_javascript"] %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -104,15 +104,17 @@ function preprocess(urls: string[]): string[] {
|
|||||||
if (urls.length < 2)
|
if (urls.length < 2)
|
||||||
return urls
|
return urls
|
||||||
|
|
||||||
/* Compute references URLs */
|
/* Take the first two URLs and remove everything after the last slash */
|
||||||
const [root, next] = urls.sort((a, b) => a.length - b.length)
|
const [root, next] = urls.slice(0, 2).map(url => (
|
||||||
|
url.replace(/[^/]+$/, "")
|
||||||
|
))
|
||||||
|
|
||||||
/* Compute common prefix */
|
/* Compute common prefix */
|
||||||
let index = 0
|
let index = 0
|
||||||
if (root === next)
|
if (root === next)
|
||||||
index = root.length
|
index = root.length
|
||||||
else
|
else
|
||||||
while (root.charCodeAt(index) === root.charCodeAt(index))
|
while (root.charCodeAt(index) === next.charCodeAt(index))
|
||||||
index++
|
index++
|
||||||
|
|
||||||
/* Replace common prefix (i.e. base) with effective base */
|
/* Replace common prefix (i.e. base) with effective base */
|
||||||
|
Loading…
Reference in New Issue
Block a user