MCPcopy Index your code
hub / github.com/darkreader/darkreader / canCheckForStyle

Function canCheckForStyle

src/inject/detector.ts:131–147  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129let readyStateListener: (() => void) | null;
130
131function canCheckForStyle() {
132 if (!(
133 document.body &&
134 document.body.scrollHeight > 0 &&
135 document.body.clientHeight > 0 &&
136 document.body.childElementCount > 0 &&
137 hasSomeStyle()
138 )) {
139 return false;
140 }
141 for (const child of document.body.children) {
142 if (child.tagName !== 'SCRIPT' && child.tagName !== 'STYLE' && child.tagName !== 'LINK') {
143 return true;
144 }
145 }
146 return false;
147}
148
149export function runDarkThemeDetector(callback: (hasDarkTheme: boolean) => void, hints: DetectorHint[]): void {
150 stopDarkThemeDetector();

Callers 1

runDarkThemeDetectorFunction · 0.85

Calls 1

hasSomeStyleFunction · 0.85

Tested by

no test coverage detected