From 993a8b8deca262de6abdc6802981c75e50d828eb Mon Sep 17 00:00:00 2001 From: Ayushya Amitabh Date: Tue, 8 Sep 2020 11:08:49 -0400 Subject: [PATCH] v1.7.1/add stan --- app/public/manifest.json | 6 ++++-- app/src/Api.js | 2 ++ app/src/VideoListener.js | 23 +++++++++++++++++++++++ app/src/index.css | 9 +++++++-- app/src/index.js | 3 +++ 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/app/public/manifest.json b/app/public/manifest.json index f8f8436..1dd0503 100644 --- a/app/public/manifest.json +++ b/app/public/manifest.json @@ -24,7 +24,8 @@ "https://tv.apple.com/*", "https://*.viki.com/*", "https://*.funimation.com/*", - "https://*.roosterteeth.com/*" + "https://*.roosterteeth.com/*", + "https://*.stan.com.au/*" ], "content_scripts": [ { @@ -43,7 +44,8 @@ "https://tv.apple.com/*", "https://*.viki.com/*", "https://*.funimation.com/*", - "https://*.roosterteeth.com/*" + "https://*.roosterteeth.com/*", + "https://*.stan.com.au/*" ], "run_at": "document_idle", "js": ["/static/js/content.js"], diff --git a/app/src/Api.js b/app/src/Api.js index 1577146..e56cb28 100644 --- a/app/src/Api.js +++ b/app/src/Api.js @@ -35,6 +35,7 @@ export const PLAYER_SOURCE = { VIKI: 'viki.', FUNIMATION: 'funimation.', ROOSTERTEETH: 'roosterteeth.', + STAN: 'stan.', LOCAL: 'localhost', }; @@ -55,6 +56,7 @@ export const getPlayerSource = () => { if (HREF.includes(PLAYER_SOURCE.VIKI)) return PLAYER_SOURCE.VIKI; if (HREF.includes(PLAYER_SOURCE.FUNIMATION)) return PLAYER_SOURCE.FUNIMATION; if (HREF.includes(PLAYER_SOURCE.ROOSTERTEETH)) return PLAYER_SOURCE.ROOSTERTEETH; + if (HREF.includes(PLAYER_SOURCE.STAN)) return PLAYER_SOURCE.STAN; if (HREF.includes(PLAYER_SOURCE.LOCAL)) return PLAYER_SOURCE.LOCAL; }; diff --git a/app/src/VideoListener.js b/app/src/VideoListener.js index 5e497bf..cac63d8 100644 --- a/app/src/VideoListener.js +++ b/app/src/VideoListener.js @@ -168,6 +168,10 @@ export default class VideoListener { time: serverPlayer.time, }) ); + break; + case PLAYER_SOURCE.STAN: + this.video.element.currentTime = serverPlayer.time; + break; default: break; } @@ -352,6 +356,12 @@ export default class VideoListener { return roosterTeethShow === '' && roosterTeethEpisode === '' ? null : roosterTeethShow + '\n' + roosterTeethEpisode; + case PLAYER_SOURCE.STAN: + const stanShowContainer = document.querySelector(nS.show); + const stanEpisodeContainer = document.querySelector(nS.episode); + const stanShow = stanShowContainer ? stanShowContainer.innerHTML : ''; + const stanEpisode = stanEpisodeContainer ? stanEpisodeContainer.innerHTML : ''; + return stanShow === '' && stanEpisode === '' ? null : stanShow + '\n' + stanEpisode; default: break; } @@ -754,6 +764,19 @@ export default class VideoListener { ); } break; + case PLAYER_SOURCE.STAN: + const stanVideoElement = document.querySelector(this.selectors[PLAYER_SOURCE.STAN]); + if (stanVideoElement) { + this.firstTimeSync(stanVideoElement); + } else { + setInterval(() => { + var sve = document.querySelector(this.selectors[PLAYER_SOURCE.STAN]); + if (sve && !this.video.element && this.video.element !== sve) { + this.firstTimeSync(sve); + } + }, 1000); + } + break; default: break; } diff --git a/app/src/index.css b/app/src/index.css index fe15792..edee014 100644 --- a/app/src/index.css +++ b/app/src/index.css @@ -282,14 +282,12 @@ body.roosterteeth.visible .party-content-wrapper textarea:focus { box-shadow: none !important; } /* VIKI */ - body.viki .party-content-wrapper input, body.viki .party-content-wrapper input:focus { padding: 18.5px 14px !important; padding-top: 10.5px !important; padding-bottom: 10.5px !important; } - body.viki .party-content-wrapper input, body.viki .party-content-wrapper input:focus, body.viki .party-content-wrapper textarea, @@ -298,6 +296,13 @@ body.viki .party-content-wrapper textarea:focus { box-shadow: none !important; margin: 0 !important; } +/* STAN */ +body.stan.visible #playercontainer { + max-width: var(--body-width); +} +body.stan.visible header.site-header { + max-width: var(--body-width); +} #party-loading { position: absolute; diff --git a/app/src/index.js b/app/src/index.js index a062eb5..3b2d455 100644 --- a/app/src/index.js +++ b/app/src/index.js @@ -131,6 +131,9 @@ switch (getPlayerSource()) { case PLAYER_SOURCE.ROOSTERTEETH: document.body.classList.add('roosterteeth'); break; + case PLAYER_SOURCE.STAN: + document.body.classList.add('stan'); + break; case PLAYER_SOURCE.LOCAL: document.body.classList.add('local'); break;