Skip to content

Commit

Permalink
Fix miniplayer on some websites
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrews54757 committed Jan 26, 2024
1 parent 46c3cb5 commit e881bf7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions chrome/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ window.addEventListener('message', (e) => {
isMini: false,
isFullscreen: false,
placeholder: null,
oldStyle: '',
});
break;
}
Expand Down Expand Up @@ -269,12 +270,12 @@ function makeMiniPlayer(iframeObj) {
iframeObj.isMini = true;

const element = iframeObj.iframe;
const placeholder = document.createElement('div');
const placeholder = document.createElement(element.tagName);

transferId(element, placeholder);

iframeObj.placeholder = placeholder;
iframeObj.oldStyle = element.getAttribute('style');
iframeObj.oldStyle = element.getAttribute('style') || '';
placeholder.setAttribute('style', iframeObj.oldStyle);
placeholder.style.setProperty('background-color', 'black', 'important');
placeholder.classList = element.classList;
Expand All @@ -297,6 +298,10 @@ function makeMiniPlayer(iframeObj) {
z-index: 2147483647 !important;
border: 1px solid rgba(0, 0, 0, 0.2) !important;
outline: none !important;
top: auto !important;
left: auto !important;
right: auto !important;
bottom: auto !important;
`);
updateMiniPlayer(iframeObj);
}
Expand Down

0 comments on commit e881bf7

Please sign in to comment.