Skip to content

Commit

Permalink
Added Apple TV+ support
Browse files Browse the repository at this point in the history
  • Loading branch information
amarcu5 committed Nov 13, 2019
1 parent caaeeb0 commit 51d585d
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file modified out/PiPer-chrome.zip
Binary file not shown.
Binary file modified out/PiPer-safari-legacy.safariextz
Binary file not shown.
Binary file modified out/PiPer-safari.pkg
Binary file not shown.
46 changes: 46 additions & 0 deletions src/common/scripts/resources/apple.js
Original file line number Diff line number Diff line change
@@ -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');
},
};
4 changes: 2 additions & 2 deletions src/safari-legacy/update.plist
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 51d585d

Please sign in to comment.