Skip to content

Commit

Permalink
[Components/DarkModeWidget]: Add compatibility with the IFrame mode (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dfsmania authored Jan 19, 2024
1 parent a7d16fc commit 4791979
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,20 @@
widget.addEventListener('click', () => {
// Toggle dark-mode class on the body tag.
// Toggle dark-mode class on the main body tag.
body.classList.toggle('dark-mode');
// Support to IFrame mode: toggle dark-mode class on the body of
// any present iframe.
let iframes = document.querySelectorAll('div.iframe-mode iframe');
iframes.forEach((f) => {
b = f.contentDocument.querySelector('body');
b.classList.toggle('dark-mode');
});
// Toggle the classes on the widget icon.
iconClasses.forEach((c) => widgetIcon.classList.toggle(c));
Expand Down

0 comments on commit 4791979

Please sign in to comment.