Added Apple TV+ support

This commit is contained in:
amarcu5 2019-11-13 20:14:16 +00:00
parent caaeeb01d9
commit 51d585da9c
6 changed files with 49 additions and 2 deletions

View File

@ -51,6 +51,7 @@ Install from the [Chrome Web Store](https://chrome.google.com/webstore/detail/pi
## Supported sites
* [9Now](http://www.9now.com.au)
* [Apple TV+](http://tv.apple.com)
* [Amazon Video](http://www.amazon.com/PrimeVideo)
* [Česká televize](http://www.ceskatelevize.cz)
* [CollegeHumor](http://www.collegehumor.com)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,46 @@
export const domain = 'apple';
/**
* Returns nested shadow root
*
* @param {!Array<string>} selectors
* @return {?ShadowRoot}
*/
const getNestedShadowRoot = function(selectors) {
let dom = document;
for (const selector of selectors) {
dom = /** @type {HTMLElement} */ (dom.querySelector(selector));
dom = dom && dom.shadowRoot;
if (!dom) return null;
}
return /** @type {ShadowRoot} */ (dom);
}
export const resource = {
buttonClassName: 'footer__control hydrated',
buttonElementType: 'div',
buttonHoverStyle: /** CSS */ (`opacity: 0.8 !important`),
buttonInsertBefore: function(/** Element */ parent) {
return parent.lastChild;
},
buttonParent: function() {
const internal = getNestedShadowRoot(["apple-tv-plus-player",
"amp-video-player-internal"]);
if (!internal) return;
const fullscreenButton = internal.querySelector("amp-playback-controls-full-screen");
if (!fullscreenButton) return;
return fullscreenButton.parentElement;
},
buttonStyle: /** CSS */ (`
transition: opacity 0.15s;
cursor: pointer;
opacity: 0.9;
`),
videoElement: function() {
const video = getNestedShadowRoot(["apple-tv-plus-player",
"amp-video-player-internal",
"amp-video-player"]);
if (!video) return;
return video.querySelector('video');
},
};

View File

@ -8,9 +8,9 @@
<key>CFBundleIdentifier</key>
<string>com.amarcus.safari.piper</string>
<key>CFBundleShortVersionString</key>
<string>1.0.3</string>
<string>1.0.4</string>
<key>CFBundleVersion</key>
<string>233</string>
<string>234</string>
<key>Developer Identifier</key>
<string>BQ6Q24MF9X</string>
<key>URL</key>