diff --git a/package-lock.json b/package-lock.json index 8eb1cb8..c28d8da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "NflxMultiSubs", - "version": "1.6.4", + "version": "1.6.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a9ec3f2..a0dd063 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/nflxmultisubs.js b/src/nflxmultisubs.js index e57fc15..dacafbf 100644 --- a/src/nflxmultisubs.js +++ b/src/nflxmultisubs.js @@ -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'); } @@ -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); });