Skip to content

Commit

Permalink
Fix overlap (z-index) issue for new player UI (#19)
Browse files Browse the repository at this point in the history
After some users being upgraded to a version of web player with fancy controls
(codename: `Neo`), users' clicks on the control buttons are not effective
because we don't adjust the z-index of Neo controls.
  • Loading branch information
dannvix committed Jul 15, 2018
1 parent 5c34735 commit 937fd5c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "NflxMultiSubs",
"description": "Bilingual Subtitles & Enhanced Experiences for Netflix",
"author": "Dan Chen",
"version": "1.6.4",
"version": "1.6.5",
"license": "MIT",
"private": true,
"scripts": {
Expand Down
18 changes: 16 additions & 2 deletions src/nflxmultisubs.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,20 @@ class RendererLoop {
}

_getControlsActive() {
const controlsElem = document.querySelector('.controls');
if (!controlsElem) { return false; }
// FIXME: better solution to handle different versions of Netflix web player UI
// "Neo Style" refers to the newer version as in 2018/07
let controlsElem = document.querySelector('.controls'), neoStyle = false;
if (!controlsElem) {
controlsElem = document.querySelector('.PlayerControlsNeo__layout');
if (!controlsElem) { return false; }
neoStyle = true;
}
// elevate the navs' z-index (to be on top of our subtitles)
if (!controlsElem.style.zIndex) { controlsElem.style.zIndex = 3; }

if (neoStyle) {
return !controlsElem.classList.contains('PlayerControlsNeo__layout--inactive');
}
return controlsElem.classList.contains('active');
}

Expand Down Expand Up @@ -836,6 +846,10 @@ class NflxMultiSubsManager {
gRendererLoop.start();
console.log('Started: renderer loop');
}

// detect for newer version of Netflix web player UI
const hasNeoStyleControls = !!document.querySelector('[class*=PlayerControlsNeo]');
console.log(`hasNeoStyleControls: ${hasNeoStyleControls}`);
}).catch(err => {
console.error('Fatal: ', err);
});
Expand Down

0 comments on commit 937fd5c

Please sign in to comment.