|
@@ -17,7 +17,7 @@
|
|
// @license AGPL-3.0-or-later
|
|
// @license AGPL-3.0-or-later
|
|
// @author Sv443
|
|
// @author Sv443
|
|
// @copyright Sv443 (https://github.com/Sv443)
|
|
// @copyright Sv443 (https://github.com/Sv443)
|
|
-// @icon https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/logo/logo_48.png?b=ac081e6
|
|
|
|
|
|
+// @icon https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/logo/logo_48.png?b=791ad8d
|
|
// @match https://music.youtube.com/*
|
|
// @match https://music.youtube.com/*
|
|
// @match https://www.youtube.com/*
|
|
// @match https://www.youtube.com/*
|
|
// @run-at document-start
|
|
// @run-at document-start
|
|
@@ -35,42 +35,42 @@
|
|
// @grant GM.openInTab
|
|
// @grant GM.openInTab
|
|
// @grant unsafeWindow
|
|
// @grant unsafeWindow
|
|
// @noframes
|
|
// @noframes
|
|
-// @resource css-bundle https://raw.githubusercontent.com/Sv443/BetterYTM/develop/dist/BetterYTM.css?b=ac081e6
|
|
|
|
-// @resource css-above_queue_btns https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/style/aboveQueueBtns.css?b=ac081e6
|
|
|
|
-// @resource css-anchor_improvements https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/style/anchorImprovements.css?b=ac081e6
|
|
|
|
-// @resource css-fix_hdr https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/style/fixHDR.css?b=ac081e6
|
|
|
|
-// @resource css-fix_spacing https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/style/fixSpacing.css?b=ac081e6
|
|
|
|
-// @resource doc-changelog https://raw.githubusercontent.com/Sv443/BetterYTM/develop/changelog.md?b=ac081e6
|
|
|
|
-// @resource icon-advanced_mode https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/plus_circle_small.svg?b=ac081e6
|
|
|
|
-// @resource icon-arrow_down https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/arrow_down.svg?b=ac081e6
|
|
|
|
-// @resource icon-clear_list https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/clear_list.svg?b=ac081e6
|
|
|
|
-// @resource icon-delete https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/delete.svg?b=ac081e6
|
|
|
|
-// @resource icon-error https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/error.svg?b=ac081e6
|
|
|
|
-// @resource icon-experimental https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/beaker_small.svg?b=ac081e6
|
|
|
|
-// @resource icon-globe https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/globe.svg?b=ac081e6
|
|
|
|
-// @resource icon-help https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/help.svg?b=ac081e6
|
|
|
|
-// @resource icon-image_filled https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/image_filled.svg?b=ac081e6
|
|
|
|
-// @resource icon-image https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/image.svg?b=ac081e6
|
|
|
|
-// @resource icon-link https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/link.svg?b=ac081e6
|
|
|
|
-// @resource icon-lyrics https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/lyrics.svg?b=ac081e6
|
|
|
|
-// @resource icon-reload https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/refresh.svg?b=ac081e6
|
|
|
|
-// @resource icon-skip_to https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/skip_to.svg?b=ac081e6
|
|
|
|
-// @resource icon-spinner https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/spinner.svg?b=ac081e6
|
|
|
|
-// @resource img-logo https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/logo/logo_48.png?b=ac081e6
|
|
|
|
-// @resource img-close https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/close.png?b=ac081e6
|
|
|
|
-// @resource img-discord https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/external/discord.png?b=ac081e6
|
|
|
|
-// @resource img-github https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/external/github.png?b=ac081e6
|
|
|
|
-// @resource img-greasyfork https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/external/greasyfork.png?b=ac081e6
|
|
|
|
-// @resource img-openuserjs https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/external/openuserjs.png?b=ac081e6
|
|
|
|
-// @resource trans-de_DE https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/de_DE.json?b=ac081e6
|
|
|
|
-// @resource trans-en_US https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/en_US.json?b=ac081e6
|
|
|
|
-// @resource trans-en_UK https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/en_UK.json?b=ac081e6
|
|
|
|
-// @resource trans-es_ES https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/es_ES.json?b=ac081e6
|
|
|
|
-// @resource trans-fr_FR https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/fr_FR.json?b=ac081e6
|
|
|
|
-// @resource trans-hi_IN https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/hi_IN.json?b=ac081e6
|
|
|
|
-// @resource trans-ja_JA https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/ja_JA.json?b=ac081e6
|
|
|
|
-// @resource trans-pt_BR https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/pt_BR.json?b=ac081e6
|
|
|
|
-// @resource trans-zh_CN https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/zh_CN.json?b=ac081e6
|
|
|
|
|
|
+// @resource css-bundle https://raw.githubusercontent.com/Sv443/BetterYTM/develop/dist/BetterYTM.css?b=791ad8d
|
|
|
|
+// @resource css-above_queue_btns https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/style/aboveQueueBtns.css?b=791ad8d
|
|
|
|
+// @resource css-anchor_improvements https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/style/anchorImprovements.css?b=791ad8d
|
|
|
|
+// @resource css-fix_hdr https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/style/fixHDR.css?b=791ad8d
|
|
|
|
+// @resource css-fix_spacing https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/style/fixSpacing.css?b=791ad8d
|
|
|
|
+// @resource doc-changelog https://raw.githubusercontent.com/Sv443/BetterYTM/develop/changelog.md?b=791ad8d
|
|
|
|
+// @resource icon-advanced_mode https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/plus_circle_small.svg?b=791ad8d
|
|
|
|
+// @resource icon-arrow_down https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/arrow_down.svg?b=791ad8d
|
|
|
|
+// @resource icon-clear_list https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/clear_list.svg?b=791ad8d
|
|
|
|
+// @resource icon-delete https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/delete.svg?b=791ad8d
|
|
|
|
+// @resource icon-error https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/error.svg?b=791ad8d
|
|
|
|
+// @resource icon-experimental https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/beaker_small.svg?b=791ad8d
|
|
|
|
+// @resource icon-globe https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/globe.svg?b=791ad8d
|
|
|
|
+// @resource icon-help https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/help.svg?b=791ad8d
|
|
|
|
+// @resource icon-image_filled https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/image_filled.svg?b=791ad8d
|
|
|
|
+// @resource icon-image https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/image.svg?b=791ad8d
|
|
|
|
+// @resource icon-link https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/link.svg?b=791ad8d
|
|
|
|
+// @resource icon-lyrics https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/lyrics.svg?b=791ad8d
|
|
|
|
+// @resource icon-reload https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/refresh.svg?b=791ad8d
|
|
|
|
+// @resource icon-skip_to https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/skip_to.svg?b=791ad8d
|
|
|
|
+// @resource icon-spinner https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icons/spinner.svg?b=791ad8d
|
|
|
|
+// @resource img-logo https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/logo/logo_48.png?b=791ad8d
|
|
|
|
+// @resource img-close https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/close.png?b=791ad8d
|
|
|
|
+// @resource img-discord https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/external/discord.png?b=791ad8d
|
|
|
|
+// @resource img-github https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/external/github.png?b=791ad8d
|
|
|
|
+// @resource img-greasyfork https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/external/greasyfork.png?b=791ad8d
|
|
|
|
+// @resource img-openuserjs https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/images/external/openuserjs.png?b=791ad8d
|
|
|
|
+// @resource trans-de_DE https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/de_DE.json?b=791ad8d
|
|
|
|
+// @resource trans-en_US https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/en_US.json?b=791ad8d
|
|
|
|
+// @resource trans-en_UK https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/en_UK.json?b=791ad8d
|
|
|
|
+// @resource trans-es_ES https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/es_ES.json?b=791ad8d
|
|
|
|
+// @resource trans-fr_FR https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/fr_FR.json?b=791ad8d
|
|
|
|
+// @resource trans-hi_IN https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/hi_IN.json?b=791ad8d
|
|
|
|
+// @resource trans-ja_JA https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/ja_JA.json?b=791ad8d
|
|
|
|
+// @resource trans-pt_BR https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/pt_BR.json?b=791ad8d
|
|
|
|
+// @resource trans-zh_CN https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/translations/zh_CN.json?b=791ad8d
|
|
// @require https://cdn.jsdelivr.net/npm/@sv443-network/[email protected]/dist/index.global.js
|
|
// @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]/dist/fuse.basic.js
|
|
// @require https://cdn.jsdelivr.net/npm/[email protected]/lib/marked.umd.js
|
|
// @require https://cdn.jsdelivr.net/npm/[email protected]/lib/marked.umd.js
|
|
@@ -198,7 +198,7 @@ var PluginIntent;
|
|
})(PluginIntent || (PluginIntent = {}));const modeRaw = "development";
|
|
})(PluginIntent || (PluginIntent = {}));const modeRaw = "development";
|
|
const branchRaw = "develop";
|
|
const branchRaw = "develop";
|
|
const hostRaw = "github";
|
|
const hostRaw = "github";
|
|
-const buildNumberRaw = "ac081e6";
|
|
|
|
|
|
+const buildNumberRaw = "791ad8d";
|
|
/** The mode in which the script was built (production or development) */
|
|
/** The mode in which the script was built (production or development) */
|
|
const mode = (modeRaw.match(/^#{{.+}}$/) ? "production" : modeRaw);
|
|
const mode = (modeRaw.match(/^#{{.+}}$/) ? "production" : modeRaw);
|
|
/** The branch to use in various URLs that point to the GitHub repo */
|
|
/** The branch to use in various URLs that point to the GitHub repo */
|
|
@@ -488,6 +488,8 @@ function tp(key, num, ...values) {
|
|
return trans;
|
|
return trans;
|
|
}/** ID of the last opened (top-most) dialog */
|
|
}/** ID of the last opened (top-most) dialog */
|
|
let currentDialogId = null;
|
|
let currentDialogId = null;
|
|
|
|
+/** IDs of all currently open dialogs, top-most first */
|
|
|
|
+const openDialogs = [];
|
|
/** Creates and manages a modal dialog element */
|
|
/** Creates and manages a modal dialog element */
|
|
class BytmDialog extends NanoEmitter {
|
|
class BytmDialog extends NanoEmitter {
|
|
constructor(options) {
|
|
constructor(options) {
|
|
@@ -580,6 +582,8 @@ class BytmDialog extends NanoEmitter {
|
|
if (this.isOpen())
|
|
if (this.isOpen())
|
|
return;
|
|
return;
|
|
this.dialogOpen = true;
|
|
this.dialogOpen = true;
|
|
|
|
+ if (openDialogs.includes(this.id))
|
|
|
|
+ throw new Error(`A dialog with the same ID of '${this.id}' already exists and is open!`);
|
|
if (!this.isMounted())
|
|
if (!this.isMounted())
|
|
yield this.mount();
|
|
yield this.mount();
|
|
document.body.classList.add("bytm-disable-scroll");
|
|
document.body.classList.add("bytm-disable-scroll");
|
|
@@ -591,6 +595,7 @@ class BytmDialog extends NanoEmitter {
|
|
dialogBg.style.display = "block";
|
|
dialogBg.style.display = "block";
|
|
dialogBg.inert = false;
|
|
dialogBg.inert = false;
|
|
currentDialogId = this.id;
|
|
currentDialogId = this.id;
|
|
|
|
+ openDialogs.unshift(this.id);
|
|
this.events.emit("open");
|
|
this.events.emit("open");
|
|
emitInterface("bytm:dialogOpened", this);
|
|
emitInterface("bytm:dialogOpened", this);
|
|
emitInterface(`bytm:dialogOpened:${this.id}`, this);
|
|
emitInterface(`bytm:dialogOpened:${this.id}`, this);
|
|
@@ -605,8 +610,6 @@ class BytmDialog extends NanoEmitter {
|
|
if (!this.isOpen())
|
|
if (!this.isOpen())
|
|
return;
|
|
return;
|
|
this.dialogOpen = false;
|
|
this.dialogOpen = false;
|
|
- document.body.classList.remove("bytm-disable-scroll");
|
|
|
|
- (_a = document.querySelector(getDomain() === "ytm" ? "ytmusic-app" : "ytd-app")) === null || _a === void 0 ? void 0 : _a.removeAttribute("inert");
|
|
|
|
const dialogBg = document.querySelector(`#bytm-${this.id}-dialog-bg`);
|
|
const dialogBg = document.querySelector(`#bytm-${this.id}-dialog-bg`);
|
|
if (!dialogBg)
|
|
if (!dialogBg)
|
|
return warn(`Couldn't find background element for dialog with ID '${this.id}'`);
|
|
return warn(`Couldn't find background element for dialog with ID '${this.id}'`);
|
|
@@ -615,6 +618,11 @@ class BytmDialog extends NanoEmitter {
|
|
dialogBg.inert = true;
|
|
dialogBg.inert = true;
|
|
if (BytmDialog.getCurrentDialogId() === this.id)
|
|
if (BytmDialog.getCurrentDialogId() === this.id)
|
|
currentDialogId = null;
|
|
currentDialogId = null;
|
|
|
|
+ openDialogs.splice(openDialogs.indexOf(this.id), 1);
|
|
|
|
+ if (openDialogs.length === 0) {
|
|
|
|
+ document.body.classList.remove("bytm-disable-scroll");
|
|
|
|
+ (_a = document.querySelector(getDomain() === "ytm" ? "ytmusic-app" : "ytd-app")) === null || _a === void 0 ? void 0 : _a.removeAttribute("inert");
|
|
|
|
+ }
|
|
this.events.emit("close");
|
|
this.events.emit("close");
|
|
if (this.options.destroyOnClose)
|
|
if (this.options.destroyOnClose)
|
|
this.destroy();
|
|
this.destroy();
|
|
@@ -641,6 +649,10 @@ class BytmDialog extends NanoEmitter {
|
|
static getCurrentDialogId() {
|
|
static getCurrentDialogId() {
|
|
return currentDialogId;
|
|
return currentDialogId;
|
|
}
|
|
}
|
|
|
|
+ /** Returns the IDs of all currently open dialogs, top-most first */
|
|
|
|
+ static getOpenDialogs() {
|
|
|
|
+ return openDialogs;
|
|
|
|
+ }
|
|
//#region protected
|
|
//#region protected
|
|
/** Called once to attach all generic event listeners */
|
|
/** Called once to attach all generic event listeners */
|
|
attachListeners(bgElem) {
|
|
attachListeners(bgElem) {
|
|
@@ -1234,7 +1246,7 @@ function renderFooter$2() {
|
|
});
|
|
});
|
|
}let featHelpDialog = null;
|
|
}let featHelpDialog = null;
|
|
let curFeatKey = null;
|
|
let curFeatKey = null;
|
|
-/** Creates and/or returns the help dialog for a specific feature */
|
|
|
|
|
|
+/** Creates or modifies the help dialog for a specific feature and returns it */
|
|
function getFeatHelpDialog(_a) {
|
|
function getFeatHelpDialog(_a) {
|
|
return __awaiter(this, arguments, void 0, function* ({ featKey, }) {
|
|
return __awaiter(this, arguments, void 0, function* ({ featKey, }) {
|
|
curFeatKey = featKey;
|
|
curFeatKey = featKey;
|
|
@@ -4822,9 +4834,7 @@ const featInfo = {
|
|
type: "toggle",
|
|
type: "toggle",
|
|
category: "general",
|
|
category: "general",
|
|
default: mode === "development",
|
|
default: mode === "development",
|
|
- textAdornment: () => getFeatures().advancedMode
|
|
|
|
- ? combineAdornments([adornments.advanced, adornments.reloadRequired])
|
|
|
|
- : undefined,
|
|
|
|
|
|
+ textAdornment: () => getFeatures().advancedMode ? adornments.advanced() : undefined,
|
|
change: (_key, prevValue, newValue) => prevValue !== newValue &&
|
|
change: (_key, prevValue, newValue) => prevValue !== newValue &&
|
|
emitSiteEvent("recreateCfgMenu"),
|
|
emitSiteEvent("recreateCfgMenu"),
|
|
},
|
|
},
|