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

Function onPiPEnter

src/inject/dynamic-theme/index.ts:855–877  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

853 }
854
855 function onPiPEnter(): void {
856 const pipDoc = getPipDoc();
857 if (!pipDoc || pipDoc.querySelector('meta[name="darkreader-lock"]')) {
858 return;
859 }
860 const fontCSS = collectFontSheetCSS();
861 if (!fontCSS) {
862 return;
863 }
864 injectFontCSS(fontCSS);
865 const observer = new MutationObserver(() => {
866 if (pipDoc.querySelector('meta[name="darkreader-lock"]')) {
867 observer.disconnect();
868 docPiP.removeEventListener('enter', onPiPEnter);
869 removeFontCSS();
870 return;
871 }
872 injectFontCSS(fontCSS);
873 });
874 observer.observe(pipDoc, {childList: true, subtree: true})
875 cleaners.push(() => observer.disconnect());
876 (docPiP.window as Window).addEventListener('unload', () => observer.disconnect());
877 }
878
879 docPiP.addEventListener('enter', onPiPEnter);
880 cleaners.push(() => {

Callers

nothing calls this directly

Calls 5

getPipDocFunction · 0.85
collectFontSheetCSSFunction · 0.85
injectFontCSSFunction · 0.85
removeFontCSSFunction · 0.85
disconnectMethod · 0.80

Tested by

no test coverage detected