Skip to content

Commit

Permalink
Fix windowed fullscreen getting stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrews54757 committed Sep 23, 2024
1 parent 223daee commit 459bd19
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions chrome/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@
if (oldFrameObj.windowedFullscreenState.active) {
windowedFullscreenToggle(oldFrameObj);
}

if (oldFrameObj.iframe !== iframeElement) {
iframeElement.addEventListener('load', frameLoadListener);
}
} else {
iframeElement.addEventListener('load', frameLoadListener);
}

iframeMap.set(request.frameId, newFrameObj);
Expand All @@ -139,6 +145,29 @@
}
});

function frameLoadListener(e) {
// Find match in iframeMap
const iframeElement = e.target;
let frameObj = null;
iframeMap.forEach((value) => {
if (value.iframe === iframeElement) {
frameObj = value;
}
});

if (!frameObj) {
return;
}

if (frameObj.miniplayerState.active) {
unmakeMiniPlayer(frameObj);
}

if (frameObj.windowedFullscreenState.active) {
windowedFullscreenToggle(frameObj);
}
}

async function sendToOtherContents(message) {
chrome.runtime.sendMessage({
type: 'SEND_TO_CONTENT',
Expand Down

0 comments on commit 459bd19

Please sign in to comment.