Skip to content

Commit 45a150e

Browse files
committed
chore: build
1 parent 1d2bc5a commit 45a150e

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

dist/BetterYTM.user.js

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// @license AGPL-3.0-only
99
// @author Sv443
1010
// @copyright Sv443 (https://github.com/Sv443)
11-
// @icon https://cdn.jsdelivr.net/gh/Sv443/BetterYTM@bc5f4bcc/assets/images/logo/logo_dev_48.png
11+
// @icon https://cdn.jsdelivr.net/gh/Sv443/BetterYTM@1d2bc5a5/assets/images/logo/logo_dev_48.png
1212
// @match https://music.youtube.com/*
1313
// @match https://www.youtube.com/*
1414
// @run-at document-start
@@ -335,7 +335,7 @@ const rawConsts = {
335335
mode: "development",
336336
branch: "develop",
337337
host: "github",
338-
buildNumber: "bc5f4bcc",
338+
buildNumber: "1d2bc5a5",
339339
assetSource: "jsdelivr",
340340
devServerPort: "8710",
341341
};
@@ -1976,6 +1976,7 @@ async function getAutoLikeDialog() {
19761976
error("Couldn't refresh auto-like channels dialog:", err);
19771977
}
19781978
});
1979+
autoLikeDialog.on("open", () => { var _a; return (_a = document.querySelector(".bytm-auto-like-channels-searchbar")) === null || _a === void 0 ? void 0 : _a.focus(); });
19791980
autoLikeDialog.on("close", () => emitSiteEvent("autoLikeChannelsUpdated"));
19801981
}
19811982
if (!autoLikeExImDialog) {
@@ -2028,7 +2029,7 @@ async function renderBody$4() {
20282029
const contElem = document.createElement("div");
20292030
const descriptionEl = document.createElement("p");
20302031
descriptionEl.classList.add("bytm-auto-like-channels-desc");
2031-
descriptionEl.textContent = t("auto_like_channels_dialog_desc");
2032+
descriptionEl.textContent = descriptionEl.ariaLabel = t("auto_like_channels_dialog_desc");
20322033
descriptionEl.tabIndex = 0;
20332034
contElem.appendChild(descriptionEl);
20342035
const searchCont = document.createElement("div");
@@ -2038,6 +2039,7 @@ async function renderBody$4() {
20382039
searchContLeftSideEl.classList.add("left-side");
20392040
searchCont.appendChild(searchContLeftSideEl);
20402041
const searchContRightSideEl = document.createElement("div");
2042+
searchContRightSideEl.tabIndex = 0;
20412043
searchContRightSideEl.classList.add("right-side");
20422044
searchCont.appendChild(searchContRightSideEl);
20432045
const updateCountElem = () => {
@@ -2048,7 +2050,7 @@ async function renderBody$4() {
20482050
updateCountElem();
20492051
const searchbarEl = document.createElement("input");
20502052
searchbarEl.classList.add("bytm-auto-like-channels-searchbar");
2051-
searchbarEl.placeholder = t("search_placeholder");
2053+
searchbarEl.placeholder = searchbarEl.ariaDescription = t("search_placeholder");
20522054
searchbarEl.type = searchbarEl.role = "search";
20532055
searchbarEl.tabIndex = 0;
20542056
searchbarEl.autofocus = true;
@@ -5130,7 +5132,7 @@ async function initAboveQueueBtns() {
51305132
});
51315133
}
51325134
//#region thumb.overlay
5133-
// TODO:FIXME: re-grab video ID on thumbnail overlay toggle to ensure eventual consistency
5135+
// TODO:FIXME: rewrite this whole chonker cause it doesn't wanna behave at all
51345136
/** Changed when the toggle button is pressed - used to invert the state of "showOverlay" */
51355137
let invertOverlay = false;
51365138
/** List of video IDs that have already been applied to the thumbnail overlay */
@@ -5213,8 +5215,7 @@ async function initThumbnailOverlay() {
52135215
if (thumbImgElem) {
52145216
thumbImgElem.dataset.videoId = videoID;
52155217
thumbImgElem.src = thumbUrl;
5216-
// crop horizontal bezels on songs:
5217-
thumbImgElem.style.objectFit = getCurrentMediaType() === "video" ? "contain" : "cover";
5218+
thumbImgElem.dataset.mediaType = getCurrentMediaType();
52185219
}
52195220
log("Applied thumbnail URL to overlay:", thumbUrl);
52205221
};
@@ -5521,19 +5522,19 @@ async function initWatchPageFullSize() {
55215522
else
55225523
log("Made watch page full size");
55235524
}//#region utils
5524-
const ignoreTagNamesInput = ["INPUT", "TEXTAREA", "SELECT", "BUTTON", "A"];
5525-
const ignoreIdsInput = [
5525+
const ignoreInputTagNames = ["INPUT", "TEXTAREA", "SELECT", "BUTTON", "A"];
5526+
const ignoreInputIds = [
55265527
"contenteditable-root", // comment field on YT
55275528
"volume-slider", // volume slider on YTM
55285529
];
5529-
const ignoreClassNamesInput = [];
5530-
/** Returns true, if the given element (document.activeElement by default) is an input element that should make BYTM ignore keypresses */
5530+
const ignoreInputClassNames = [];
5531+
/** Returns true, if the given element (`document.activeElement` by default) is an input element that should make BYTM ignore keypresses */
55315532
function isIgnoredInputElement(el = document.activeElement) {
55325533
if (!el)
55335534
return false;
5534-
return ignoreTagNamesInput.includes(el.tagName.toUpperCase())
5535-
|| ignoreClassNamesInput.some((cls) => el.classList.contains(cls))
5536-
|| ignoreIdsInput.includes(el.id);
5535+
return document.activeElement !== document.body && (ignoreInputTagNames.includes(el.tagName.toUpperCase())
5536+
|| ignoreInputClassNames.some((cls) => el.classList.contains(cls))
5537+
|| ignoreInputIds.includes(el.id));
55375538
}
55385539
//#region arrow key skip
55395540
let sliderEl;
@@ -5543,7 +5544,7 @@ async function initArrowKeySkip() {
55435544
});
55445545
document.addEventListener("keydown", (evt) => {
55455546
var _a, _b;
5546-
if (!getFeature("arrowKeySupport"))
5547+
if (!getFeature("arrowKeySupport") || isIgnoredInputElement())
55475548
return;
55485549
if (["ArrowUp", "ArrowDown"].includes(evt.code) && getDomain() === "ytm")
55495550
return handleVolumeKeyPress(evt);
@@ -5587,9 +5588,7 @@ function handleVolumeKeyPress(evt) {
55875588
/** Initializes the feature that lets users skip by a frame with the period and comma keys while the video is paused */
55885589
async function initFrameSkip() {
55895590
document.addEventListener("keydown", async (evt) => {
5590-
if (!getFeature("frameSkip"))
5591-
return;
5592-
if (!["Comma", "Period"].includes(evt.code))
5591+
if (!getFeature("frameSkip") || isIgnoredInputElement() || !["Comma", "Period"].includes(evt.code))
55935592
return;
55945593
const vid = getVideoElement();
55955594
if (!vid || vid.readyState === 0)
@@ -5608,14 +5607,10 @@ async function initFrameSkip() {
56085607
/** Adds the ability to skip to a certain time in the video by pressing a number key (0-9) */
56095608
async function initNumKeysSkip() {
56105609
document.addEventListener("keydown", (e) => {
5611-
if (!getFeature("numKeysSkipToTime"))
5610+
if (!getFeature("numKeysSkipToTime") || isIgnoredInputElement())
56125611
return;
56135612
if (!e.key.trim().match(/^[0-9]$/))
56145613
return;
5615-
// discard the event when an unexpected element is currently active or in focus, like when editing a playlist or when the search bar is focused
5616-
const ignoreElement = isIgnoredInputElement();
5617-
if ((document.activeElement !== document.body && ignoreElement) || ignoreElement)
5618-
return info("Captured valid key to skip video to, but ignored it since this element is currently active:", document.activeElement);
56195614
const vidElem = getVideoElement();
56205615
if (!vidElem || vidElem.readyState === 0)
56215616
return warn("Could not find video element, so the keypress is ignored");

0 commit comments

Comments
 (0)