fix: use fresh settings in dark-mode observer and storage listener
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,16 +3,16 @@
|
|||||||
|
|
||||||
function startDarkModeObserver(settings) {
|
function startDarkModeObserver(settings) {
|
||||||
var observer = new MutationObserver(function () {
|
var observer = new MutationObserver(function () {
|
||||||
if (settings.darkMode === "auto") {
|
window.RedditTweaks.loadSettings().then(function (updated) {
|
||||||
window.RedditTweaks.loadSettings().then(function (updated) {
|
if (updated.darkMode === "auto") {
|
||||||
if (settings.badgeLayout) {
|
if (updated.badgeLayout) {
|
||||||
window.RedditTweaks.badgeTweak.updateColors(updated);
|
window.RedditTweaks.badgeTweak.updateColors(updated);
|
||||||
}
|
}
|
||||||
if (settings.cardLayout) {
|
if (updated.cardLayout) {
|
||||||
window.RedditTweaks.cardTweak.updateSettings(updated);
|
window.RedditTweaks.cardTweak.updateSettings(updated);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
observer.observe(document.body, {
|
observer.observe(document.body, {
|
||||||
@@ -86,10 +86,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.RedditTweaks.loadSettings().then(function (updated) {
|
window.RedditTweaks.loadSettings().then(function (updated) {
|
||||||
if (settings.badgeLayout) {
|
if (updated.badgeLayout) {
|
||||||
window.RedditTweaks.badgeTweak.updateColors(updated);
|
window.RedditTweaks.badgeTweak.updateColors(updated);
|
||||||
}
|
}
|
||||||
if (settings.cardLayout) {
|
if (updated.cardLayout) {
|
||||||
window.RedditTweaks.cardTweak.updateSettings(updated);
|
window.RedditTweaks.cardTweak.updateSettings(updated);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user