diff --git a/README.md b/README.md index 48f1645..6e671a8 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/out/PiPer-chrome.zip b/out/PiPer-chrome.zip index e9f01f8..34e62c3 100644 Binary files a/out/PiPer-chrome.zip and b/out/PiPer-chrome.zip differ diff --git a/out/PiPer-safari-legacy.safariextz b/out/PiPer-safari-legacy.safariextz index ac3d6ac..76f9463 100644 Binary files a/out/PiPer-safari-legacy.safariextz and b/out/PiPer-safari-legacy.safariextz differ diff --git a/out/PiPer-safari.pkg b/out/PiPer-safari.pkg index 310aee9..a175223 100644 Binary files a/out/PiPer-safari.pkg and b/out/PiPer-safari.pkg differ diff --git a/src/common/scripts/resources/apple.js b/src/common/scripts/resources/apple.js new file mode 100644 index 0000000..e4362c5 --- /dev/null +++ b/src/common/scripts/resources/apple.js @@ -0,0 +1,46 @@ +export const domain = 'apple'; + +/** + * Returns nested shadow root + * + * @param {!Array} 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'); + }, +}; \ No newline at end of file diff --git a/src/safari-legacy/update.plist b/src/safari-legacy/update.plist index 64add83..947c234 100644 --- a/src/safari-legacy/update.plist +++ b/src/safari-legacy/update.plist @@ -8,9 +8,9 @@ CFBundleIdentifier com.amarcus.safari.piper CFBundleShortVersionString - 1.0.3 + 1.0.4 CFBundleVersion - 233 + 234 Developer Identifier BQ6Q24MF9X URL