From 749c19c4bc4db1837770402afe5c6fe85fcffc12 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sun, 16 Jan 2022 12:34:51 +0100 Subject: [PATCH] Fixed endless redirect in palette change example --- docs/setup/adding-a-comment-system.md | 5 ++--- material/overrides/blog.html | 2 +- src/overrides/blog.html | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/setup/adding-a-comment-system.md b/docs/setup/adding-a-comment-system.md index 7f1f0b9dd..ee4898ecf 100644 --- a/docs/setup/adding-a-comment-system.md +++ b/docs/setup/adding-a-comment-system.md @@ -71,9 +71,8 @@ calling the `super()` function at the beginning of the block: /* Register event handlers after documented loaded */ document.addEventListener("DOMContentLoaded", function() { var ref = document.querySelector("[data-md-component=palette]") - component$.subscribe(function (component) { - if (component.ref === ref) - location.reload() + ref.addEventListener("change", function() { + location.reload() }) }) diff --git a/material/overrides/blog.html b/material/overrides/blog.html index da3d400aa..4b177e7e0 100644 --- a/material/overrides/blog.html +++ b/material/overrides/blog.html @@ -6,5 +6,5 @@ {{ super() }}

{{ lang.t("meta.comments") }}

- + {% endblock %} diff --git a/src/overrides/blog.html b/src/overrides/blog.html index c57dfdba7..32987668f 100644 --- a/src/overrides/blog.html +++ b/src/overrides/blog.html @@ -56,9 +56,8 @@ /* Register event handlers after documented loaded */ document.addEventListener("DOMContentLoaded", function() { var ref = document.querySelector("[data-md-component=palette]") - component$.subscribe(function (component) { - if (component.ref === ref) - location.reload() + ref.addEventListener("change", function() { + location.reload() }) })