No use optimizing conditionally
If a specific platform is broken and we'd need to check for that platform and not optimize, then it takes away what little gain everyone else had by checking.
This commit is contained in:
parent
e177919630
commit
9e7d0a74f0
@ -6,15 +6,15 @@ let introSkipper = {
|
||||
};
|
||||
introSkipper.d = function (msg) {
|
||||
console.debug("[intro skipper] ", msg);
|
||||
}
|
||||
/** Setup event listeners */
|
||||
introSkipper.setup = function () {
|
||||
}
|
||||
/** Setup event listeners */
|
||||
introSkipper.setup = function () {
|
||||
document.addEventListener("viewshow", introSkipper.viewShow);
|
||||
window.fetch = introSkipper.fetchWrapper;
|
||||
introSkipper.d("Registered hooks");
|
||||
}
|
||||
/** Wrapper around fetch() that retrieves skip segments for the currently playing item. */
|
||||
introSkipper.fetchWrapper = async function (...args) {
|
||||
}
|
||||
/** Wrapper around fetch() that retrieves skip segments for the currently playing item. */
|
||||
introSkipper.fetchWrapper = async function (...args) {
|
||||
// Based on JellyScrub's trickplay.js
|
||||
let [resource, options] = args;
|
||||
let response = await introSkipper.originalFetch(resource, options);
|
||||
@ -33,12 +33,12 @@ introSkipper.fetchWrapper = async function (...args) {
|
||||
console.error("Unable to get skip segments from", resource, e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* Event handler that runs whenever the current view changes.
|
||||
* Used to detect the start of video playback.
|
||||
*/
|
||||
introSkipper.viewShow = function () {
|
||||
introSkipper.viewShow = function () {
|
||||
const location = window.location.hash;
|
||||
introSkipper.d("Location changed to " + location);
|
||||
if (location !== "#!/video") {
|
||||
@ -52,12 +52,12 @@ introSkipper.viewShow = function () {
|
||||
introSkipper.d("Hooking video timeupdate");
|
||||
introSkipper.videoPlayer.addEventListener("timeupdate", introSkipper.videoPositionChanged);
|
||||
}
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* Injects the CSS used by the skip intro button.
|
||||
* Calling this function is a no-op if the CSS has already been injected.
|
||||
*/
|
||||
introSkipper.injectCss = function () {
|
||||
introSkipper.injectCss = function () {
|
||||
if (introSkipper.testElement("style#introSkipperCss")) {
|
||||
introSkipper.d("CSS already added");
|
||||
return;
|
||||
@ -66,6 +66,18 @@ introSkipper.injectCss = function () {
|
||||
let styleElement = document.createElement("style");
|
||||
styleElement.id = "introSkipperCss";
|
||||
styleElement.innerText = `
|
||||
@media (hover:hover) and (pointer:fine) {
|
||||
#skipIntro .paper-icon-button-light:hover:not(:disabled) {
|
||||
color: black !important;
|
||||
background-color: rgba(47, 93, 98, 0) !important;
|
||||
}
|
||||
}
|
||||
#skipIntro .paper-icon-button-light.show-focus:focus {
|
||||
transform: scale(1.04) !important;
|
||||
}
|
||||
#skipIntro.upNextContainer {
|
||||
width: unset;
|
||||
}
|
||||
#skipIntro {
|
||||
padding: 0 1px;
|
||||
position: absolute;
|
||||
@ -80,32 +92,22 @@ introSkipper.injectCss = function () {
|
||||
-webkit-transition: ease-out 0.4s;
|
||||
-moz-transition: ease-out 0.4s;
|
||||
transition: ease-out 0.4s;
|
||||
}
|
||||
#skipIntro #btnSkipSegmentText {
|
||||
padding-right: 3px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
@media (max-width: 1080px) {
|
||||
#skipIntro {
|
||||
right: 10%;
|
||||
}
|
||||
&:hover {
|
||||
}
|
||||
#skipIntro:hover {
|
||||
box-shadow: inset 400px 0 0 0 #f9f9f9;
|
||||
-webkit-transition: ease-in 1s;
|
||||
-moz-transition: ease-in 1s;
|
||||
transition: ease-in 1s;
|
||||
}
|
||||
&.upNextContainer {
|
||||
width: unset;
|
||||
}
|
||||
@media (hover:hover) and (pointer:fine) {
|
||||
.paper-icon-button-light:hover:not(:disabled) {
|
||||
color: black !important;
|
||||
background-color: rgba(47, 93, 98, 0) !important;
|
||||
}
|
||||
}
|
||||
.paper-icon-button-light.show-focus:focus {
|
||||
transform: scale(1.04) !important;
|
||||
}
|
||||
#btnSkipSegmentText {
|
||||
padding-right: 3px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
}
|
||||
`;
|
||||
document.querySelector("head").appendChild(styleElement);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user