|
@@ -17,7 +17,7 @@
|
|
|
// @license AGPL-3.0-only
|
|
|
// @author Sv443
|
|
|
// @copyright Sv443 (https://github.com/Sv443)
|
|
|
-// @icon https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/images/logo/logo_48.png
|
|
|
+// @icon https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/images/logo/logo_48.png
|
|
|
// @match https://music.youtube.com/*
|
|
|
// @match https://www.youtube.com/*
|
|
|
// @run-at document-start
|
|
@@ -35,46 +35,46 @@
|
|
|
// @grant GM.openInTab
|
|
|
// @grant unsafeWindow
|
|
|
// @noframes
|
|
|
-// @resource css-bundle https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/dist/BetterYTM.css
|
|
|
-// @resource css-above_queue_btns https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/style/aboveQueueBtns.css
|
|
|
-// @resource css-anchor_improvements https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/style/anchorImprovements.css
|
|
|
-// @resource css-fix_hdr https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/style/fixHDR.css
|
|
|
-// @resource css-fix_spacing https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/style/fixSpacing.css
|
|
|
-// @resource css-vol_slider_size https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/style/volSliderSize.css
|
|
|
-// @resource doc-changelog https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/changelog.md
|
|
|
-// @resource icon-advanced_mode https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/plus_circle_small.svg
|
|
|
-// @resource icon-arrow_down https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/arrow_down.svg
|
|
|
-// @resource icon-auto_like_disabled https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/auto_like_disabled.svg
|
|
|
-// @resource icon-auto_like_enabled https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/auto_like_enabled.svg
|
|
|
-// @resource icon-clear_list https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/clear_list.svg
|
|
|
-// @resource icon-delete https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/delete.svg
|
|
|
-// @resource icon-error https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/error.svg
|
|
|
-// @resource icon-experimental https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/beaker_small.svg
|
|
|
-// @resource icon-globe_small https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/globe_small.svg
|
|
|
-// @resource icon-globe https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/globe.svg
|
|
|
-// @resource icon-help https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/help.svg
|
|
|
-// @resource icon-image_filled https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/image_filled.svg
|
|
|
-// @resource icon-image https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/image.svg
|
|
|
-// @resource icon-link https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/link.svg
|
|
|
-// @resource icon-lyrics https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/lyrics.svg
|
|
|
-// @resource icon-reload https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/refresh.svg
|
|
|
-// @resource icon-skip_to https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/skip_to.svg
|
|
|
-// @resource icon-spinner https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/icons/spinner.svg
|
|
|
-// @resource img-logo https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/images/logo/logo_48.png
|
|
|
-// @resource img-close https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/images/close.png
|
|
|
-// @resource img-discord https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/images/external/discord.png
|
|
|
-// @resource img-github https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/images/external/github.png
|
|
|
-// @resource img-greasyfork https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/images/external/greasyfork.png
|
|
|
-// @resource img-openuserjs https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/images/external/openuserjs.png
|
|
|
-// @resource trans-de_DE https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/translations/de_DE.json
|
|
|
-// @resource trans-en_US https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/translations/en_US.json
|
|
|
-// @resource trans-en_UK https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/translations/en_UK.json
|
|
|
-// @resource trans-es_ES https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/translations/es_ES.json
|
|
|
-// @resource trans-fr_FR https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/translations/fr_FR.json
|
|
|
-// @resource trans-hi_IN https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/translations/hi_IN.json
|
|
|
-// @resource trans-ja_JA https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/translations/ja_JA.json
|
|
|
-// @resource trans-pt_BR https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/translations/pt_BR.json
|
|
|
-// @resource trans-zh_CN https://raw.githubusercontent.com/Sv443/BetterYTM/21072f93/assets/translations/zh_CN.json
|
|
|
+// @resource css-bundle https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/dist/BetterYTM.css
|
|
|
+// @resource css-above_queue_btns https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/style/aboveQueueBtns.css
|
|
|
+// @resource css-anchor_improvements https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/style/anchorImprovements.css
|
|
|
+// @resource css-fix_hdr https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/style/fixHDR.css
|
|
|
+// @resource css-fix_spacing https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/style/fixSpacing.css
|
|
|
+// @resource css-vol_slider_size https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/style/volSliderSize.css
|
|
|
+// @resource doc-changelog https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/changelog.md
|
|
|
+// @resource icon-advanced_mode https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/plus_circle_small.svg
|
|
|
+// @resource icon-arrow_down https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/arrow_down.svg
|
|
|
+// @resource icon-auto_like https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/auto_like.svg
|
|
|
+// @resource icon-auto_like_enabled https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/auto_like_enabled.svg
|
|
|
+// @resource icon-clear_list https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/clear_list.svg
|
|
|
+// @resource icon-delete https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/delete.svg
|
|
|
+// @resource icon-error https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/error.svg
|
|
|
+// @resource icon-experimental https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/beaker_small.svg
|
|
|
+// @resource icon-globe_small https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/globe_small.svg
|
|
|
+// @resource icon-globe https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/globe.svg
|
|
|
+// @resource icon-help https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/help.svg
|
|
|
+// @resource icon-image_filled https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/image_filled.svg
|
|
|
+// @resource icon-image https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/image.svg
|
|
|
+// @resource icon-link https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/link.svg
|
|
|
+// @resource icon-lyrics https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/lyrics.svg
|
|
|
+// @resource icon-reload https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/refresh.svg
|
|
|
+// @resource icon-skip_to https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/skip_to.svg
|
|
|
+// @resource icon-spinner https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/icons/spinner.svg
|
|
|
+// @resource img-logo https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/images/logo/logo_48.png
|
|
|
+// @resource img-close https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/images/close.png
|
|
|
+// @resource img-discord https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/images/external/discord.png
|
|
|
+// @resource img-github https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/images/external/github.png
|
|
|
+// @resource img-greasyfork https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/images/external/greasyfork.png
|
|
|
+// @resource img-openuserjs https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/images/external/openuserjs.png
|
|
|
+// @resource trans-de_DE https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/translations/de_DE.json
|
|
|
+// @resource trans-en_US https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/translations/en_US.json
|
|
|
+// @resource trans-en_UK https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/translations/en_UK.json
|
|
|
+// @resource trans-es_ES https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/translations/es_ES.json
|
|
|
+// @resource trans-fr_FR https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/translations/fr_FR.json
|
|
|
+// @resource trans-hi_IN https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/translations/hi_IN.json
|
|
|
+// @resource trans-ja_JA https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/translations/ja_JA.json
|
|
|
+// @resource trans-pt_BR https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/translations/pt_BR.json
|
|
|
+// @resource trans-zh_CN https://raw.githubusercontent.com/Sv443/BetterYTM/4261f335/assets/translations/zh_CN.json
|
|
|
// @require https://cdn.jsdelivr.net/npm/@sv443-network/[email protected]/dist/index.global.js
|
|
|
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/fuse.basic.js
|
|
|
// @require https://cdn.jsdelivr.net/npm/[email protected]/lib/marked.umd.js
|
|
@@ -204,7 +204,7 @@ var PluginIntent;
|
|
|
})(PluginIntent || (PluginIntent = {}));const modeRaw = "development";
|
|
|
const branchRaw = "develop";
|
|
|
const hostRaw = "github";
|
|
|
-const buildNumberRaw = "21072f93";
|
|
|
+const buildNumberRaw = "4261f335";
|
|
|
/** The mode in which the script was built (production or development) */
|
|
|
const mode = (modeRaw.match(/^#{{.+}}$/) ? "production" : modeRaw);
|
|
|
/** The branch to use in various URLs that point to the GitHub repo */
|
|
@@ -1105,6 +1105,7 @@ function getAutoLikeChannelsDialog() {
|
|
|
closeBtnEnabled: true,
|
|
|
closeOnBgClick: true,
|
|
|
closeOnEscPress: true,
|
|
|
+ destroyOnClose: true,
|
|
|
small: true,
|
|
|
renderHeader: renderHeader$6,
|
|
|
renderBody: renderBody$6,
|
|
@@ -1127,7 +1128,7 @@ function renderHeader$6() {
|
|
|
headerEl.classList.add("bytm-dialog-title");
|
|
|
headerEl.role = "heading";
|
|
|
headerEl.ariaLevel = "1";
|
|
|
- headerEl.textContent = t("auto_like_channels_dialog_title"); // TODO
|
|
|
+ headerEl.textContent = t("auto_like_channels_dialog_title");
|
|
|
return headerEl;
|
|
|
});
|
|
|
}
|
|
@@ -1136,26 +1137,32 @@ function renderBody$6() {
|
|
|
const contElem = document.createElement("div");
|
|
|
const descriptionEl = document.createElement("p");
|
|
|
descriptionEl.classList.add("bytm-auto-like-channels-desc");
|
|
|
- descriptionEl.textContent = t("auto_like_channels_dialog_desc"); // TODO
|
|
|
+ descriptionEl.textContent = t("auto_like_channels_dialog_desc");
|
|
|
+ descriptionEl.tabIndex = 0;
|
|
|
contElem.appendChild(descriptionEl);
|
|
|
- const addNewEl = document.createElement("div");
|
|
|
+ const addNewWrapper = document.createElement("div");
|
|
|
+ const addNewEl = document.createElement("span");
|
|
|
addNewEl.id = "bytm-auto-like-channels-add-new";
|
|
|
addNewEl.role = "button";
|
|
|
addNewEl.tabIndex = 0;
|
|
|
- addNewEl.textContent = `+ ${t("add_new")}`;
|
|
|
- addNewEl.classList.add("bytm-link");
|
|
|
+ addNewEl.textContent = `+ ${t("create_new_entry")}`;
|
|
|
+ addNewEl.classList.add("bytm-link", "bytm-no-select");
|
|
|
+ addNewWrapper.appendChild(addNewEl);
|
|
|
onInteraction(addNewEl, () => __awaiter(this, void 0, void 0, function* () {
|
|
|
- const id = prompt(t("add_auto_like_channel_id_prompt")); // TODO
|
|
|
+ var _a, _b;
|
|
|
+ const id = (_a = prompt(t("add_auto_like_channel_id_prompt"))) === null || _a === void 0 ? void 0 : _a.trim();
|
|
|
if (!id)
|
|
|
return;
|
|
|
+ if (!id.match(/^[a-zA-Z0-9_-]{20,}$/))
|
|
|
+ return alert(t("add_auto_like_channel_invalid_id"));
|
|
|
let overwriteName = false;
|
|
|
if (autoLikeChannelsStore.getData().channels.some((ch) => ch.id === id)) {
|
|
|
- if (!confirm(t("add_auto_like_channel_already_exists_prompt_new_name"))) // TODO
|
|
|
+ if (!confirm(t("add_auto_like_channel_already_exists_prompt_new_name")))
|
|
|
return;
|
|
|
overwriteName = true;
|
|
|
}
|
|
|
- const name = prompt(t("add_auto_like_channel_name_prompt")); // TODO
|
|
|
- if (!name)
|
|
|
+ const name = (_b = prompt(t("add_auto_like_channel_name_prompt"))) === null || _b === void 0 ? void 0 : _b.trim();
|
|
|
+ if (!name || name.length === 0)
|
|
|
return;
|
|
|
yield autoLikeChannelsStore.setData(overwriteName
|
|
|
? {
|
|
@@ -1174,7 +1181,7 @@ function renderBody$6() {
|
|
|
}));
|
|
|
autoLikeChannelsDialog === null || autoLikeChannelsDialog === void 0 ? void 0 : autoLikeChannelsDialog.unmount();
|
|
|
}));
|
|
|
- contElem.appendChild(addNewEl);
|
|
|
+ contElem.appendChild(addNewWrapper);
|
|
|
const channelListCont = document.createElement("div");
|
|
|
channelListCont.id = "bytm-auto-like-channels-list";
|
|
|
const removeChannel = (id) => autoLikeChannelsStore.setData({
|
|
@@ -3639,7 +3646,7 @@ function disableDarkReader() {
|
|
|
function createLongBtn(_a) {
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
var _b;
|
|
|
- var { title } = _a, rest = __rest(_a, ["title"]);
|
|
|
+ var { title, text, iconPosition } = _a, rest = __rest(_a, ["title", "text", "iconPosition"]);
|
|
|
if (["href", "onClick", "onToggle"].every((key) => !(key in rest)))
|
|
|
throw new TypeError("Either 'href', 'onClick' or 'onToggle' must be provided");
|
|
|
let btnElem;
|
|
@@ -3653,6 +3660,7 @@ function createLongBtn(_a) {
|
|
|
else
|
|
|
btnElem = document.createElement("div");
|
|
|
if ("toggle" in rest && rest.toggle) {
|
|
|
+ btnElem.classList.add("bytm-toggle");
|
|
|
if ("toggleInitialState" in rest && rest.toggleInitialState)
|
|
|
btnElem.classList.add("toggled");
|
|
|
}
|
|
@@ -3667,13 +3675,14 @@ function createLongBtn(_a) {
|
|
|
btnElem.tabIndex = 0;
|
|
|
btnElem.role = "button";
|
|
|
const imgElem = document.createElement("div");
|
|
|
- imgElem.classList.add("bytm-generic-btn-img");
|
|
|
+ imgElem.classList.add("bytm-generic-btn-img", iconPosition !== null && iconPosition !== void 0 ? iconPosition : "left");
|
|
|
imgElem.innerHTML = "src" in rest ? rest.src : (_b = yield resourceToHTMLString(rest.resourceName)) !== null && _b !== void 0 ? _b : "";
|
|
|
const txtElem = document.createElement("span");
|
|
|
txtElem.classList.add("bytm-generic-long-btn-txt", "bytm-no-select");
|
|
|
- txtElem.textContent = txtElem.ariaLabel = rest.text;
|
|
|
- btnElem.appendChild(imgElem);
|
|
|
+ txtElem.textContent = txtElem.ariaLabel = text;
|
|
|
+ iconPosition === "left" || !iconPosition && btnElem.appendChild(imgElem);
|
|
|
btnElem.appendChild(txtElem);
|
|
|
+ iconPosition === "right" && btnElem.appendChild(imgElem);
|
|
|
return btnElem;
|
|
|
});
|
|
|
}const inputIgnoreTagNames = ["INPUT", "TEXTAREA", "SELECT", "BUTTON", "A"];
|
|
@@ -3861,32 +3870,35 @@ function initAutoLikeChannels() {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-function addAutoLikeToggleBtn(sibling, chanId, chanName) {
|
|
|
+function addAutoLikeToggleBtn(siblingEl, channelId, channelName) {
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
var _a;
|
|
|
- const chan = autoLikeChannelsStore.getData().channels.find((ch) => ch.id === chanId);
|
|
|
+ const chan = autoLikeChannelsStore.getData().channels.find((ch) => ch.id === channelId);
|
|
|
const buttonEl = yield createLongBtn({
|
|
|
- resourceName: `icon-auto_like${(chan === null || chan === void 0 ? void 0 : chan.enabled) ? "_enabled" : "_disabled"}`,
|
|
|
+ resourceName: `icon-auto_like${(chan === null || chan === void 0 ? void 0 : chan.enabled) ? "_enabled" : ""}`,
|
|
|
text: t("auto_like"),
|
|
|
- title: t("auto_like_channel_toggle"),
|
|
|
+ title: t(`auto_like_button_tooltip${(chan === null || chan === void 0 ? void 0 : chan.enabled) ? "_enabled" : "_disabled"}`),
|
|
|
toggle: true,
|
|
|
toggleInitialState: (_a = chan === null || chan === void 0 ? void 0 : chan.enabled) !== null && _a !== void 0 ? _a : false,
|
|
|
onToggle(toggled, evt) {
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
+ var _a;
|
|
|
if (evt.shiftKey) {
|
|
|
buttonEl.classList.toggle("toggled");
|
|
|
getAutoLikeChannelsDialog().then((dlg) => dlg.open());
|
|
|
return;
|
|
|
}
|
|
|
+ buttonEl.title = buttonEl.ariaLabel = t(`auto_like_button_tooltip${toggled ? "_enabled" : "_disabled"}`);
|
|
|
+ const chanId = (_a = buttonEl.dataset.channelId) !== null && _a !== void 0 ? _a : channelId;
|
|
|
const imgEl = buttonEl.querySelector(".bytm-generic-btn-img");
|
|
|
- const imgHtml = yield resourceToHTMLString(`icon-auto_like_${toggled ? "enabled" : "disabled"}`);
|
|
|
+ const imgHtml = yield resourceToHTMLString(`icon-auto_like${toggled ? "_enabled" : ""}`);
|
|
|
if (imgEl && imgHtml)
|
|
|
imgEl.innerHTML = imgHtml;
|
|
|
if (autoLikeChannelsStore.getData().channels.find((ch) => ch.id === chanId) === undefined) {
|
|
|
yield autoLikeChannelsStore.setData({
|
|
|
channels: [
|
|
|
...autoLikeChannelsStore.getData().channels,
|
|
|
- { id: chanId, name: chanName !== null && chanName !== void 0 ? chanName : "", enabled: toggled },
|
|
|
+ { id: chanId, name: channelName !== null && channelName !== void 0 ? channelName : "", enabled: toggled },
|
|
|
],
|
|
|
});
|
|
|
}
|
|
@@ -3900,8 +3912,8 @@ function addAutoLikeToggleBtn(sibling, chanId, chanName) {
|
|
|
}
|
|
|
});
|
|
|
buttonEl.classList.add("bytm-auto-like-toggle-btn");
|
|
|
- buttonEl.dataset.channelId = chanId;
|
|
|
- sibling.insertAdjacentElement("afterend", buttonEl);
|
|
|
+ buttonEl.dataset.channelId = channelId;
|
|
|
+ siblingEl.insertAdjacentElement("afterend", buttonEl);
|
|
|
});
|
|
|
}/** Ratelimit budget timeframe in seconds - should reflect what's in geniURL's docs */
|
|
|
const geniUrlRatelimitTimeframe = 30;
|
|
@@ -5167,6 +5179,17 @@ const featInfo = {
|
|
|
default: 1,
|
|
|
textAdornment: adornments.reloadRequired,
|
|
|
},
|
|
|
+ initTimeout: {
|
|
|
+ type: "number",
|
|
|
+ category: "general",
|
|
|
+ min: 1,
|
|
|
+ max: 30,
|
|
|
+ default: 8,
|
|
|
+ step: 0.1,
|
|
|
+ unit: "s",
|
|
|
+ advanced: true,
|
|
|
+ textAdornment: () => combineAdornments([adornments.advanced, adornments.reloadRequired]),
|
|
|
+ },
|
|
|
advancedMode: {
|
|
|
type: "toggle",
|
|
|
category: "general",
|
|
@@ -6168,7 +6191,7 @@ function init() {
|
|
|
yield initLyricsCache();
|
|
|
yield initTranslations((_a = features.locale) !== null && _a !== void 0 ? _a : "en_US");
|
|
|
setLocale((_b = features.locale) !== null && _b !== void 0 ? _b : "en_US");
|
|
|
- emitInterface("bytm:initPlugins");
|
|
|
+ emitInterface("bytm:registerPlugins");
|
|
|
if (features.disableBeforeUnloadPopup && domain === "ytm")
|
|
|
disableBeforeUnload();
|
|
|
if (!domLoaded)
|
|
@@ -6272,14 +6295,7 @@ function onDomLoad() {
|
|
|
if (getFeatures().autoLikeChannels)
|
|
|
ftInit.push(["initAutoLikeChannels", initAutoLikeChannels()]);
|
|
|
}
|
|
|
- const initStartTs = Date.now();
|
|
|
- // wait for feature init or timeout (in case an init function is hung up on a promise)
|
|
|
- yield Promise.race([
|
|
|
- UserUtils.pauseFor(10000),
|
|
|
- Promise.allSettled(ftInit.map(([, p]) => p)),
|
|
|
- ]);
|
|
|
- emitInterface("bytm:ready");
|
|
|
- info(`Done initializing all ${ftInit.length} features after ${Math.floor(Date.now() - initStartTs)}ms`);
|
|
|
+ emitInterface("bytm:featureInitStarted");
|
|
|
try {
|
|
|
initPlugins();
|
|
|
}
|
|
@@ -6287,6 +6303,18 @@ function onDomLoad() {
|
|
|
error("Plugin loading error:", err);
|
|
|
emitInterface("bytm:fatalError", "Error while loading plugins");
|
|
|
}
|
|
|
+ const initStartTs = Date.now();
|
|
|
+ // wait for feature init or timeout (in case an init function is hung up on a promise)
|
|
|
+ yield Promise.race([
|
|
|
+ UserUtils.pauseFor(getFeatures().initTimeout > 0 ? getFeatures().initTimeout * 1000 : 8000),
|
|
|
+ Promise.allSettled(ftInit.map(([name, prom]) => new Promise((res) => __awaiter(this, void 0, void 0, function* () {
|
|
|
+ const v = yield prom;
|
|
|
+ emitInterface("bytm:featureInitialized", name);
|
|
|
+ res(v);
|
|
|
+ })))),
|
|
|
+ ]);
|
|
|
+ emitInterface("bytm:ready");
|
|
|
+ info(`Done initializing all ${ftInit.length} features after ${Math.floor(Date.now() - initStartTs)}ms`);
|
|
|
try {
|
|
|
registerDevMenuCommands();
|
|
|
}
|