v1.4.1-beta/HBO Fixes

This commit is contained in:
Ayushya Amitabh
2020-06-16 14:40:32 -04:00
parent 03afbfb8bd
commit 59843834d6
6 changed files with 38 additions and 5 deletions
+30 -1
View File
@@ -6,7 +6,7 @@ import Loading from './Loading';
import firebase from 'firebase/app';
import 'firebase/firestore';
import Inactive from './Inactive';
import { getUserUid } from './Api';
import { getUserUid, getPlayerSource, PLAYER_SOURCE } from './Api';
const APP_VERSION = '1.4.0';
@@ -22,6 +22,15 @@ const darkTheme = createMuiTheme({
},
});
function hboClickFix(ev) {
if (document.querySelector('body.visible')) {
ev.preventDefault();
ev.stopPropagation();
ev.stopImmediatePropagation();
console.log('cc');
}
}
const Routes = (props) => (
<Router>
<Create {...props} />
@@ -40,6 +49,8 @@ const App = () => {
const [loading, setLoading] = useState(false);
const [notification, setNotification] = useState(closedNotification);
let hasAttached = false;
useEffect(() => {
setLoading(true);
getUserUid();
@@ -58,6 +69,24 @@ const App = () => {
if (visible) {
document.body.classList.add('visible');
PartyRoutesWrapper && PartyRoutesWrapper.classList.add('visible');
if (
!hasAttached &&
(getPlayerSource() === PLAYER_SOURCE.HBOMAX || getPlayerSource() === PLAYER_SOURCE.HBONOW)
) {
document.addEventListener(
'mousedown',
function (ev) {
if (document.body.querySelector('body.visible')) {
ev.preventDefault();
ev.stopPropagation();
ev.stopImmediatePropagation();
console.log('cc');
}
},
{ capture: true }
);
hasAttached = true;
}
} else {
document.body.classList.remove('visible');
PartyRoutesWrapper && PartyRoutesWrapper.classList.remove('visible');
+4
View File
@@ -55,6 +55,10 @@ switch (getPlayerSource()) {
break;
case PLAYER_SOURCE.HBONOW:
case PLAYER_SOURCE.HBOMAX:
const hboClickInject = `var hboInputFix=function(ev){if(ev.target.tagName==='INPUT'||ev.target.tagName==='TEXTAREA'){ev.target.focus();}ev.stopImmediatePropagation();ev.stopPropagation();};document.addEventListener('keydown',hboInputFix,{capture:true});var hboClickFix=function(ev){if(document.querySelector('body.visible')){if(ev.clientX > window.innerWidth - 400){if(ev.target.tagName==='INPUT'||ev.target.tagName==='TEXTAREA'){ev.target.focus();}ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();}}};document.addEventListener("mousedown",hboClickFix,{capture:true});`;
const hboClickInjectScript = document.createElement('script');
hboClickInjectScript.text = hboClickInject;
document.head.appendChild(hboClickInjectScript);
document.body.classList.add('hbo');
break;
case PLAYER_SOURCE.LOCAL: