Skip to content

Attempt to fix outdated banner #7959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion material/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.5090c770.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.f13b1293.min.js' | url }}"></script>
{% for script in config.extra_javascript %}
{{ script | script_tag }}
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion material/templates/partials/javascripts/outdated.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{#-
This file was automatically generated - do not edit
-#}
<script>var el=document.querySelector("[data-md-component=outdated]"),outdated=__md_get("__outdated",sessionStorage);!0===outdated&&el&&(el.hidden=!1)</script>
<script>var el=document.querySelector("[data-md-component=outdated]"),base=new URL("{{ base_url }}"),outdated=__md_get("__outdated",sessionStorage,base);!0===outdated&&el&&(el.hidden=!1)</script>
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ export function setupVersionSelector(
document$.pipe(switchMap(() => current$))
.subscribe(current => {

// Always scope outdate version banner to the base URL of the site
const base = new URL(config.base)

/* Check if version state was already determined */
let outdated = __md_get("__outdated", sessionStorage)
let outdated = __md_get("__outdated", sessionStorage, base)
if (outdated === null) {
outdated = true

Expand All @@ -177,7 +180,7 @@ export function setupVersionSelector(
}

/* Persist version state in session storage */
__md_set("__outdated", outdated, sessionStorage)
__md_set("__outdated", outdated, sessionStorage, base)
}

/* Unhide outdated version banner */
Expand Down
3 changes: 2 additions & 1 deletion src/templates/partials/javascripts/outdated.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
<!-- Version warning -->
<script>
var el = document.querySelector("[data-md-component=outdated]")
var outdated = __md_get("__outdated", sessionStorage)
var base = new URL("{{ base_url }}");
var outdated = __md_get("__outdated", sessionStorage, base)
if (outdated === true && el)
el.hidden = false
</script>