mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 11:21:46 +00:00
Merge branch 'local-upstream/master' into add-crossfade-menu-options
This commit is contained in:
@ -11,28 +11,32 @@ module.exports = (options) => {
|
||||
document.addEventListener('apiLoaded', (event) => setup(event, options), { once: true, passive: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* If captions are disabled by default,
|
||||
* unload "captions" module when video changes.
|
||||
*/
|
||||
const videoChanged = (api, options) => {
|
||||
if (options.disableCaptions) {
|
||||
setTimeout(() => api.unloadModule("captions"), 100);
|
||||
}
|
||||
}
|
||||
|
||||
function setup(event, options) {
|
||||
const api = event.detail;
|
||||
|
||||
$("video").addEventListener("srcChanged", () => videoChanged(api, options));
|
||||
|
||||
$(".right-controls-buttons").append(captionsSettingsButton);
|
||||
|
||||
let captionTrackList = api.getOption("captions", "tracklist");
|
||||
|
||||
$("video").addEventListener("srcChanged", () => {
|
||||
if (options.disableCaptions) {
|
||||
setTimeout(() => api.unloadModule("captions"), 100);
|
||||
captionsSettingsButton.style.display = "none";
|
||||
return;
|
||||
}
|
||||
|
||||
api.loadModule("captions");
|
||||
|
||||
setTimeout(() => {
|
||||
captionTrackList = api.getOption("captions", "tracklist");
|
||||
|
||||
captionsSettingsButton.style.display = captionTrackList?.length
|
||||
? "inline-block"
|
||||
: "none";
|
||||
}, 250);
|
||||
});
|
||||
|
||||
captionsSettingsButton.onclick = async () => {
|
||||
api.loadModule("captions");
|
||||
|
||||
const captionTrackList = api.getOption("captions", "tracklist");
|
||||
|
||||
if (captionTrackList?.length) {
|
||||
const currentCaptionTrack = api.getOption("captions", "track");
|
||||
let currentIndex = !currentCaptionTrack ?
|
||||
|
||||
@ -7,7 +7,7 @@ const fetch = require("node-fetch");
|
||||
|
||||
const { cleanupName } = require("../../providers/song-info");
|
||||
const { injectCSS } = require("../utils");
|
||||
let eastAsianChars = new RegExp("[\u{3040}-\u{30ff}\u{3400}-\u{4dbf}\u{4e00}-\u{9fff}\u{f900}-\u{faff}\u{ff66}-\u{ff9f}]");
|
||||
let eastAsianChars = /\p{Script=Han}|\p{Script=Katakana}|\p{Script=Hiragana}|\p{Script=Hangul}|\p{Script=Han}/u;
|
||||
let revRomanized = false;
|
||||
|
||||
module.exports = async (win, options) => {
|
||||
|
||||
@ -39,7 +39,6 @@ const setup = () => {
|
||||
|
||||
/** @param {Electron.BrowserWindow} win */
|
||||
module.exports = (win, options) => {
|
||||
config.init(options);
|
||||
// Register the callback for new song information
|
||||
is.windows() && options.interactive ?
|
||||
require("./interactive")(win) :
|
||||
|
||||
@ -1,23 +1,5 @@
|
||||
const { setOptions, setMenuOptions } = require("../../config/plugins");
|
||||
const defaultConfig = require("../../config/defaults");
|
||||
const { PluginConfig } = require("../../config/dynamic");
|
||||
|
||||
let config = defaultConfig.plugins["notifications"];
|
||||
const config = new PluginConfig("notifications");
|
||||
|
||||
module.exports.init = (options) => {
|
||||
config = { ...config, ...options };
|
||||
};
|
||||
|
||||
module.exports.setAndMaybeRestart = (option, value) => {
|
||||
config[option] = value;
|
||||
setMenuOptions("notifications", config);
|
||||
};
|
||||
|
||||
module.exports.set = (option, value) => {
|
||||
config[option] = value;
|
||||
setOptions("notifications", config);
|
||||
};
|
||||
|
||||
module.exports.get = (option) => {
|
||||
let res = config[option];
|
||||
return res;
|
||||
};
|
||||
module.exports = { ...config };
|
||||
|
||||
Reference in New Issue
Block a user