Add skip intro button

No fucking clue whether this works, can't even test it...
This commit is contained in:
GhtGhoster 2024-05-12 21:50:59 +02:00
parent 9d4c561fbb
commit b7b94ab432
4 changed files with 77 additions and 0 deletions

View File

@ -1482,6 +1482,10 @@ define(
player = player || this._currentPlayer;
var offsetTicks = 1e4 * _usersettings.default.skipForwardLength();
this.seekRelative(offsetTicks, player)
}, PlaybackManager.prototype.fastForwardSkipIntro = function (player) {
player = player || this._currentPlayer;
var offsetTicks = 1e4 * 9e4;
this.seekRelative(offsetTicks, player)
}, PlaybackManager.prototype.rewind = function (player) {
player = player || this._currentPlayer;
var offsetTicks = 0 - 1e4 * _usersettings.default.skipBackLength();

14
videoosd/thingy.txt Normal file
View File

@ -0,0 +1,14 @@
Button class is defined in videoosd.html
Button class is queried for in videoosd.js - view.querySelectorAll(".btnOsdFastForward")
Event listener is added to all found dom elements - onFastForwardButtonClick = fastForward(self, !0);
function fastForward(instance, animate) {
var player = instance.currentPlayer;
animate &&
(((animate = instance.view.querySelector(
".osd-ff-animationtext",
)).innerHTML =
"+" + parseInt(_usersettings.default.skipForwardLength() / 1e3)),
fadeInAndOut(animate)),
_playbackmanager.default.fastForward(player);
}

View File

@ -163,6 +163,10 @@
<button is="paper-icon-button-light" class="osdIconButton btnOsdFastForward hide" title="${FastForward}" aria-label="${FastForward}">
<i class="md-icon osdIconButton-icon btnOsdFastForwardIcon">&#xE042;</i>
</button>
<button is="paper-icon-button-light" class="osdIconButton btnOsdFastForwardSkipIntro hide" title="${FastForward}" aria-label="${FastForward}">
<i class="md-icon osdIconButton-icon btnOsdFastForwardIcon">&#xE042;</i>
</button>
</div>
<button is="paper-icon-button-light" class="osdIconButton btnNextTrack hide" title="${HeaderNextItem}" aria-label="${HeaderNextItem}">

View File

@ -264,6 +264,16 @@ define([
fadeInAndOut(animate)),
_playbackmanager.default.fastForward(player);
}
function fastForwardSkipIntro(instance, animate) {
var player = instance.currentPlayer;
animate &&
(((animate = instance.view.querySelector(
".osd-ff-animationtext",
)).innerHTML =
"+" + parseInt(9e4 / 1e3)),
fadeInAndOut(animate)),
_playbackmanager.default.fastForwardSkipIntro(player);
}
function onOsdClick(e, instance, elementToFocusIfShowing, showOsdIfNoEvent) {
var target = e.target;
if (target.closest(".videoOsdBottom"))
@ -439,6 +449,7 @@ define([
videoOsdDurationText = view.querySelector(".videoOsdDurationText"),
rewindButtons = view.querySelectorAll(".btnRewind"),
fastForwardButtons = view.querySelectorAll(".btnOsdFastForward"),
fastForwardSkipIntroButtons = view.querySelectorAll(".btnOsdFastForwardSkipIntro"),
stopButtons =
((this.btnPause = view.querySelector(".videoOsd-btnPause")),
view.querySelectorAll(".btnVideoOsd-stop")),
@ -521,6 +532,7 @@ define([
skipIntroContainer.classList.add("videoOsd-customFont-x2"),
this.upNextContainer.classList.add("videoOsd-customFont-x2"),
this.osdBottomElement.classList.add("videoOsd-nobuttonmargin"));
// I don't know what this does but it doesn't seem important for skipping intro
for (var i = 0, length = fastForwardButtons.length; i < length; i++) {
icon = btnFastForward = void 0;
var btnFastForward = fastForwardButtons[i],
@ -954,6 +966,14 @@ define([
fastForwardButtons[_i9].classList.remove("hide"),
(fastForwardButtons[_i9].disabled =
!0 === state.IsInitialRequest);
for (
var _i9si = 0, _length9si = fastForwardSkipIntroButtons.length;
_i9si < _length9si;
_i9si++
)
fastForwardSkipIntroButtons[_i9si].classList.remove("hide"),
(fastForwardSkipIntroButtons[_i9si].disabled =
!0 === state.IsInitialRequest);
for (
var _i10 = 0, _length10 = rewindButtons.length;
_i10 < _length10;
@ -968,6 +988,12 @@ define([
_i11++
)
fastForwardButtons[_i11].classList.add("hide");
for (
var _i11si = 0, _length11si = fastForwardSkipIntroButtons.length;
_i11si < _length11si;
_i11si++
)
fastForwardSkipIntroButtons[_i11si].classList.add("hide");
for (
var _i12 = 0, _length12 = rewindButtons.length;
_i12 < _length12;
@ -1005,6 +1031,12 @@ define([
_i7++
)
fastForwardButtons[_i7].classList.add("hide");
for (
var _i7si = 0, _length7si = fastForwardSkipIntroButtons.length;
_i7si < _length7si;
_i7si++
)
fastForwardSkipIntroButtons[_i7si].classList.add("hide");
for (
var _i8 = 0, _length8 = rewindButtons.length;
_i8 < _length8;
@ -1570,6 +1602,12 @@ define([
_i13++
)
fastForwardButtons[_i13].disabled = !playState.CanSeek;
for (
var _i13si = 0, _length13si = fastForwardSkipIntroButtons.length;
_i13si < _length13si;
_i13si++
)
fastForwardSkipIntroButtons[_i13si].disabled = !playState.CanSeek;
for (
var _i14 = 0, _length14 = rewindButtons.length;
_i14 < _length14;
@ -2661,6 +2699,7 @@ define([
onRewindButtonClick,
{ passive: !0 },
);
function onFastForwardButtonClick() {
fastForward(self, !0);
}
@ -2675,6 +2714,22 @@ define([
onFastForwardButtonClick,
{ passive: !0 },
);
function onFastForwardSkipIntroButtonClick() {
fastForwardSkipIntro(self, !0);
}
for (
var _i20si = 0, _length20si = fastForwardSkipIntroButtons.length;
_i20si < _length20si;
_i20si++
)
_dom.default.addEventListener(
fastForwardButtons[_i20si],
"click",
onFastForwardSkipIntroButtonClick,
{ passive: !0 },
);
function onMoreClick() {
showMoreMenu(self.currentItem, this);
}