Skip to content

Commit cdf8ec0

Browse files
committed
refactoring
1 parent 3e35306 commit cdf8ec0

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

contentScript.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ const observer = new MutationObserver((mutations) => {
6868
}
6969
});
7070
});
71-
observer.observe(document.body, {
72-
childList: true,
73-
subtree: true,
74-
});
7571

7672
const darkModeMappingBackground = {
7773
'white': 'rgb(31,32,35)',
@@ -151,9 +147,9 @@ async function applyDarkMode() {
151147
} else if (typeof chrome !== 'undefined') {
152148
result = await new Promise(resolve => chrome.storage.local.get('darkMode', resolve));
153149
}
154-
150+
155151
const darkMode = result.darkMode || false;
156-
152+
157153
if (document.title !== 'RabbitMQ Management') {
158154
console.log('Not on RabbitMQ Management page, skipping dark mode');
159155
return;
@@ -215,4 +211,18 @@ async function applyDarkMode() {
215211
});
216212
}
217213

218-
applyDarkMode();
214+
function bunnyPackSetup() {
215+
if (document.title !== 'RabbitMQ Management') {
216+
console.log('Not on RabbitMQ Management page, skipping dark mode');
217+
return;
218+
}
219+
220+
observer.observe(document.body, {
221+
childList: true,
222+
subtree: true,
223+
});
224+
225+
applyDarkMode();
226+
}
227+
228+
bunnyPackSetup();

0 commit comments

Comments
 (0)