v1.6.4/add and fix

-fix chat bug
-add viki
-fix apple tv+
This commit is contained in:
2020-08-28 12:18:35 -04:00
parent f779c1fc90
commit b5a9c8db64
7 changed files with 76 additions and 25 deletions
+4 -2
View File
@@ -20,7 +20,8 @@
"https://*.peacocktv.com/*",
"https://play.google.com/movies/*",
"https://*.crunchyroll.com/*",
"https://tv.apple.com/*"
"https://tv.apple.com/*",
"https://*.viki.com/*"
],
"content_security_policy": "script-src 'self' https://unpkg.com/ https://www.gstatic.com/ https://*.firebaseio.com https://www.googleapis.com; object-src 'self'",
"content_scripts": [
@@ -36,7 +37,8 @@
"https://*.peacocktv.com/*",
"https://play.google.com/*",
"https://*.crunchyroll.com/*",
"https://tv.apple.com/*"
"https://tv.apple.com/*",
"https://*.viki.com/*"
],
"run_at": "document_idle",
"js": ["/static/js/content.js"],
+2
View File
@@ -31,6 +31,7 @@ export const PLAYER_SOURCE = {
GOOGLEPLAY: 'play.google.',
CRUNCHYROLL: 'crunchyroll.',
APPLE: 'tv.apple.',
VIKI: 'viki.',
LOCAL: 'localhost',
};
@@ -47,6 +48,7 @@ export const getPlayerSource = () => {
if (HREF.includes(PLAYER_SOURCE.GOOGLEPLAY)) return PLAYER_SOURCE.GOOGLEPLAY;
if (HREF.includes(PLAYER_SOURCE.CRUNCHYROLL)) return PLAYER_SOURCE.CRUNCHYROLL;
if (HREF.includes(PLAYER_SOURCE.APPLE)) return PLAYER_SOURCE.APPLE;
if (HREF.includes(PLAYER_SOURCE.VIKI)) return PLAYER_SOURCE.VIKI;
if (HREF.includes(PLAYER_SOURCE.LOCAL)) return PLAYER_SOURCE.LOCAL;
};
+26 -16
View File
@@ -110,24 +110,34 @@ 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();
}
},
{ capture: true }
);
hasAttached = true;
if (getPlayerSource() === PLAYER_SOURCE.HBOMAX || getPlayerSource() === PLAYER_SOURCE.HBONOW) {
setTutorialComplete(true);
if (!hasAttached) {
document.addEventListener(
'mousedown',
function (ev) {
if (document.body.querySelector('body.visible')) {
ev.preventDefault();
ev.stopPropagation();
ev.stopImmediatePropagation();
}
},
{ capture: true }
);
hasAttached = true;
}
}
if (getPlayerSource() === PLAYER_SOURCE.APPLE) {
const appleTvPlayer = document.querySelector('apple-tv-plus-player');
const takeoverContainer = appleTvPlayer.shadowRoot.querySelector('.takeover.container.show');
if (takeoverContainer) takeoverContainer.style.maxWidth = 'var(--body-width)';
}
} else {
if (getPlayerSource() === PLAYER_SOURCE.APPLE) {
const appleTvPlayer = document.querySelector('apple-tv-plus-player');
const takeoverContainer = appleTvPlayer.shadowRoot.querySelector('.takeover.container.show');
if (takeoverContainer) takeoverContainer.style.maxWidth = 'none';
}
document.body.classList.remove('visible');
PartyRoutesWrapper && PartyRoutesWrapper.classList.remove('visible');
}
+1 -1
View File
@@ -195,7 +195,7 @@ export default class Thread extends Component {
return (
<AutoSizer style={{ flex: 1 }}>
{({ height, width }) => {
if (autoSizeWidth && autoSizeWidth !== width) {
if (autoSizeWidth !== width) {
cache.clearAll();
this.listRef.current.recomputeRowHeights();
this.setState({ autoSizeWidth: width });
+39 -5
View File
@@ -134,6 +134,9 @@ export default class VideoListener {
case PLAYER_SOURCE.APPLE:
this.video.element.currentTime = serverPlayer.time;
break;
case PLAYER_SOURCE.VIKI:
this.video.element.currentTime = serverPlayer.time;
break;
default:
break;
}
@@ -276,11 +279,19 @@ export default class VideoListener {
const appleTvPlayer = document.querySelector('apple-tv-plus-player');
const appleTvInternal = appleTvPlayer.shadowRoot.querySelector('amp-video-player-internal');
const appleTvVideoContainer = appleTvInternal.shadowRoot.querySelector('amp-video-player');
const appleTvShow = appleTvVideoContainer.querySelector(nS.show).innerText || '';
const appleTvEpisode = appleTvVideoContainer.querySelector(nS.episode).innerText || '';
const appleTvShowContainer = appleTvVideoContainer.querySelector(nS.show);
const appleTvEpisodeContainer = appleTvVideoContainer.querySelector(nS.episode);
const appleTvShow = appleTvShowContainer ? appleTvShowContainer.innerText : '';
const appleTvEpisode = appleTvEpisodeContainer ? appleTvEpisodeContainer.innerText : '';
return appleTvShow === '' && appleTvEpisode === ''
? null
: appleTvShow + '\n' + appleTvEpisode;
case PLAYER_SOURCE.VIKI:
const docTitleSplit = document.title.split('|');
if (docTitleSplit.length > 1) return docTitleSplit[0].trim();
else return null;
default:
break;
}
@@ -599,9 +610,14 @@ export default class VideoListener {
const ati = atp.shadowRoot.querySelector('amp-video-player-internal');
const atv = ati.shadowRoot.querySelector('amp-video-player');
const atve = atv.shadowRoot.querySelector(this.selectors[PLAYER_SOURCE.APPLE]);
if (atve) {
const tc = atp.shadowRoot.querySelector('.takeover.container.show');
if (tc) tc.style.maxWidth = 'var(--body-width)';
const tc = atp.shadowRoot.querySelector('.takeover.container.show');
const visible = document.querySelector('body.visible');
if (tc && visible) tc.style.maxWidth = 'var(--body-width)';
else if (tc && !visible) tc.style.maxWidth = 'none';
if (
!!atve === true &&
(!!this.video.element === false || atve !== this.video.element)
) {
this.firstTimeSync(atve);
}
},
@@ -609,6 +625,24 @@ export default class VideoListener {
);
}
break;
case PLAYER_SOURCE.VIKI:
const vikiVideoElement = document.querySelector(this.selectors[PLAYER_SOURCE.VIKI]);
if (vikiVideoElement) {
this.firstTimeSync(vikiVideoElement);
} else {
setInterval(
this.video.element
? null
: () => {
var vve = document.querySelector(this.selectors[PLAYER_SOURCE.VIKI]);
if (vve !== null && (this.video.element !== vve || this.video.element === null)) {
this.firstTimeSync(vve);
}
},
1000
);
}
break;
case PLAYER_SOURCE.LOCAL:
const localVideoElement = document.getElementsByTagName('video')[0];
if (localVideoElement) {
+1 -1
View File
@@ -77,7 +77,7 @@ body.disney.visible #hudson-wrapper, /* DISNEY */
body.youtube.visible #content.ytd-app, /* YOUTUBE */
body.youtube.visible #masthead-container, /* YOUTUBE HEADER */
body.googleplay.visible div.llhEMd.bYEzqc.LAhoGb.iWO5td, /* GOOGLE PLAY MOVIES */
body.apple.visible .container.takeover.show /* APPLE TV */ {
body.viki.visible div.video-player /* VIKI */ {
max-width: var(--body-width) !important;
}
/* HULU MINIMIZED VIDEO */
+3
View File
@@ -97,6 +97,9 @@ switch (getPlayerSource()) {
case PLAYER_SOURCE.APPLE:
document.body.classList.add('apple');
break;
case PLAYER_SOURCE.VIKI:
document.body.classList.add('viki');
break;
case PLAYER_SOURCE.LOCAL:
document.body.classList.add('local');
break;