mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 02:51:46 +00:00
Merge branch 'master' into snyk-upgrade-1b73c27fe4a98c0629769eba2ee53e6a
This commit is contained in:
4
index.js
4
index.js
@ -165,6 +165,10 @@ function createMainWindow() {
|
||||
win.maximize();
|
||||
}
|
||||
|
||||
if(config.get("options.alwaysOnTop")){
|
||||
win.setAlwaysOnTop(true);
|
||||
}
|
||||
|
||||
const urlToLoad = config.get("options.resumeOnStart")
|
||||
? config.get("url")
|
||||
: config.defaultConfig.url;
|
||||
|
||||
34
menu.js
34
menu.js
@ -80,12 +80,25 @@ const mainMenuTemplate = (win) => {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Remove upgrade button",
|
||||
type: "checkbox",
|
||||
checked: config.get("options.removeUpgradeButton"),
|
||||
click: (item) => {
|
||||
config.setMenuOption("options.removeUpgradeButton", item.checked);
|
||||
},
|
||||
label: "Visual Tweaks",
|
||||
submenu: [
|
||||
{
|
||||
label: "Remove upgrade button",
|
||||
type: "checkbox",
|
||||
checked: config.get("options.removeUpgradeButton"),
|
||||
click: (item) => {
|
||||
config.setMenuOption("options.removeUpgradeButton", item.checked);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Force show like buttons",
|
||||
type: "checkbox",
|
||||
checked: config.get("options.ForceShowLikeButtons"),
|
||||
click: (item) => {
|
||||
config.set("options.ForceShowLikeButtons", item.checked);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Single instance lock",
|
||||
@ -100,6 +113,15 @@ const mainMenuTemplate = (win) => {
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Always on top",
|
||||
type: "checkbox",
|
||||
checked: config.get("options.alwaysOnTop"),
|
||||
click: (item) => {
|
||||
config.setMenuOption("options.alwaysOnTop", item.checked);
|
||||
win.setAlwaysOnTop(item.checked);
|
||||
},
|
||||
},
|
||||
...(is.windows() || is.linux()
|
||||
? [
|
||||
{
|
||||
|
||||
@ -92,7 +92,7 @@
|
||||
"npm": "Please use yarn and not npm"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cliqz/adblocker-electron": "^1.23.4",
|
||||
"@cliqz/adblocker-electron": "^1.23.5",
|
||||
"@electron/remote": "^2.0.5",
|
||||
"@ffmpeg/core": "^0.10.0",
|
||||
"@ffmpeg/ffmpeg": "^0.10.1",
|
||||
|
||||
@ -36,15 +36,10 @@ module.exports = () => {
|
||||
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.innerHTML = html;
|
||||
const lyricsSelector1 = wrapper.querySelector(".lyrics");
|
||||
const lyricsSelector2 = wrapper.querySelector(
|
||||
'[class^="Lyrics__Container"]'
|
||||
);
|
||||
const lyrics = lyricsSelector1
|
||||
? lyricsSelector1.innerHTML
|
||||
: lyricsSelector2
|
||||
? lyricsSelector2.innerHTML
|
||||
: null;
|
||||
|
||||
const lyrics = [...wrapper.querySelectorAll('[class^="Lyrics__Container"]')].map(d => d.innerHTML).join('<br>')
|
||||
|| wrapper.querySelector(".lyrics")?.innerHTML;
|
||||
|
||||
if (!lyrics) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,9 +1,15 @@
|
||||
const { injectCSS } = require("../utils");
|
||||
const path = require("path");
|
||||
|
||||
/*
|
||||
This is used to determine if plugin is actually active
|
||||
(not if its only enabled in options)
|
||||
*/
|
||||
let enabled = false;
|
||||
|
||||
module.exports = () => enabled = true;
|
||||
module.exports = (win) => {
|
||||
enabled = true;
|
||||
injectCSS(win.webContents, path.join(__dirname, "volume-hud.css"));
|
||||
}
|
||||
|
||||
module.exports.enabled = () => enabled;
|
||||
|
||||
@ -45,23 +45,21 @@ function firstRun(options) {
|
||||
|
||||
// Change options from renderer to keep sync
|
||||
ipcRenderer.on("setOptions", (_event, newOptions = {}) => {
|
||||
for (option in newOptions) {
|
||||
options[option] = newOptions[option];
|
||||
}
|
||||
Object.assign(options, newOptions)
|
||||
setMenuOptions("precise-volume", options);
|
||||
});
|
||||
}
|
||||
|
||||
function injectVolumeHud(noVid) {
|
||||
if (noVid) {
|
||||
const position = "top: 18px; right: 60px; z-index: 999; position: absolute;";
|
||||
const mainStyle = "font-size: xx-large; padding: 10px; transition: opacity 1s; pointer-events: none;";
|
||||
const position = "top: 18px; right: 60px;";
|
||||
const mainStyle = "font-size: xx-large;";
|
||||
|
||||
$(".center-content.ytmusic-nav-bar").insertAdjacentHTML("beforeend",
|
||||
`<span id="volumeHud" style="${position + mainStyle}"></span>`)
|
||||
} else {
|
||||
const position = `top: 10px; left: 10px; z-index: 999; position: absolute;`;
|
||||
const mainStyle = "font-size: xxx-large; padding: 10px; transition: opacity 0.6s; webkit-text-stroke: 1px black; font-weight: 600; pointer-events: none;";
|
||||
const position = `top: 10px; left: 10px;`;
|
||||
const mainStyle = "font-size: xxx-large; webkit-text-stroke: 1px black; font-weight: 600;";
|
||||
|
||||
$("#song-video").insertAdjacentHTML('afterend',
|
||||
`<span id="volumeHud" style="${position + mainStyle}"></span>`)
|
||||
@ -189,8 +187,12 @@ function changeVolume(toIncrease, options) {
|
||||
|
||||
function updateVolumeSlider(options) {
|
||||
// Slider value automatically rounds to multiples of 5
|
||||
$("#volume-slider").value = options.savedVolume > 0 && options.savedVolume < 5 ?
|
||||
5 : options.savedVolume;
|
||||
for (const slider of ["#volume-slider", "#expand-volume-slider"]) {
|
||||
$(slider).value =
|
||||
options.savedVolume > 0 && options.savedVolume < 5
|
||||
? 5
|
||||
: options.savedVolume;
|
||||
}
|
||||
}
|
||||
|
||||
let volumeHoverTimeoutID;
|
||||
|
||||
11
plugins/precise-volume/volume-hud.css
Normal file
11
plugins/precise-volume/volume-hud.css
Normal file
@ -0,0 +1,11 @@
|
||||
#volumeHud {
|
||||
z-index: 999;
|
||||
position: absolute;
|
||||
transition: opacity 0.6s;
|
||||
pointer-events: none;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
ytmusic-player[player-ui-state_="MINIPLAYER"] #volumeHud {
|
||||
top: 0 !important;
|
||||
}
|
||||
14
preload.js
14
preload.js
@ -83,9 +83,17 @@ function onApiLoaded() {
|
||||
|
||||
// Remove upgrade button
|
||||
if (config.get("options.removeUpgradeButton")) {
|
||||
const upgradeButtton = document.querySelector('ytmusic-pivot-bar-item-renderer[tab-id="SPunlimited"]')
|
||||
if (upgradeButtton) {
|
||||
upgradeButtton.style.display = "none";
|
||||
const upgradeButton = document.querySelector('ytmusic-pivot-bar-item-renderer[tab-id="SPunlimited"]')
|
||||
if (upgradeButton) {
|
||||
upgradeButton.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
// Force show like buttons
|
||||
if (config.get("options.ForceShowLikeButtons")) {
|
||||
const likeButtons = document.querySelector('ytmusic-like-button-renderer')
|
||||
if (likeButtons) {
|
||||
likeButtons.style.display = 'inherit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
74
yarn.lock
74
yarn.lock
@ -650,45 +650,45 @@
|
||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@cliqz/adblocker-content@^1.23.4":
|
||||
version "1.23.4"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-content/-/adblocker-content-1.23.4.tgz#d7803ab5f3c998247100b3b29b89ce5b3442314e"
|
||||
integrity sha512-Ib8c8E8rnrDygUfO02hAkwD9qUmW+t0cq1MuKg9iEVGOJVZwZU27SpJDoWhHz9bninzcxthzJYlLGgBZzcqq0Q==
|
||||
"@cliqz/adblocker-content@^1.23.6":
|
||||
version "1.23.6"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-content/-/adblocker-content-1.23.6.tgz#649c32143b3338d1d2206540bb0ea307aa073d90"
|
||||
integrity sha512-rzFAtp8nGc6bbQoSjN6Xo0l1OHzqS9Z86nlyFD3yLsd9g2d/CLnx0WFDVsk6iE+N9yu2UpHbgWT+siShF0rHqw==
|
||||
dependencies:
|
||||
"@cliqz/adblocker-extended-selectors" "^1.23.4"
|
||||
"@cliqz/adblocker-extended-selectors" "^1.23.6"
|
||||
|
||||
"@cliqz/adblocker-electron-preload@^1.23.4":
|
||||
version "1.23.4"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron-preload/-/adblocker-electron-preload-1.23.4.tgz#41946642c52e1a51d0514cf5513dd9a11a020fae"
|
||||
integrity sha512-i1NMv5EeAB7T393zhBVwo+74qd082pCIIySRGDLrOqm8BAosCjXzXifq6p+14d68k1K+C8nDahHm/XvpgWMTCw==
|
||||
"@cliqz/adblocker-electron-preload@^1.23.6":
|
||||
version "1.23.6"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron-preload/-/adblocker-electron-preload-1.23.6.tgz#7f8db3df95afb385917df00ec5300847448437d1"
|
||||
integrity sha512-xVBrIqfvcuh2Y07ZkEogzgkyqJuZvOqhRoFnuTyW2q97AmWAGLT6IjEGjl/vX7vMP0Y1b8wubdjI3VHnKvNKDg==
|
||||
dependencies:
|
||||
"@cliqz/adblocker-content" "^1.23.4"
|
||||
"@cliqz/adblocker-content" "^1.23.6"
|
||||
|
||||
"@cliqz/adblocker-electron@^1.23.4":
|
||||
version "1.23.4"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron/-/adblocker-electron-1.23.4.tgz#6144199209aa9f1f73de5ee9d8b73c61deaf5945"
|
||||
integrity sha512-ld/2jdf8rIzNEHAG/ZFfapDISityA++Kxql1DqfsIUi0xcRlQdz6ijWQ0+xVOW4ZhTifGjlUvaq60MVn+R3OUQ==
|
||||
"@cliqz/adblocker-electron@^1.23.5":
|
||||
version "1.23.6"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron/-/adblocker-electron-1.23.6.tgz#e550f2ffa2b5d0404d0090c3870d0a849d3cd5d8"
|
||||
integrity sha512-wzkCfBCo5RvRanzsVOu65xHW9GAUDqsg+tP8GYld6/hgMMb96KJZJVpvrvwvsneAm9T55QE4ef1utZbIIwltqA==
|
||||
dependencies:
|
||||
"@cliqz/adblocker" "^1.23.4"
|
||||
"@cliqz/adblocker-electron-preload" "^1.23.4"
|
||||
"@cliqz/adblocker" "^1.23.6"
|
||||
"@cliqz/adblocker-electron-preload" "^1.23.6"
|
||||
tldts-experimental "^5.6.21"
|
||||
|
||||
"@cliqz/adblocker-extended-selectors@^1.23.4":
|
||||
version "1.23.4"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-extended-selectors/-/adblocker-extended-selectors-1.23.4.tgz#76e310ff6598ec76eacf402bd4733e7b8ab0ee98"
|
||||
integrity sha512-qDfeOwe1UK4fGQFFafQMftdPy7uLm5JwKiM8zcGiYzJqRxTvnquRTGzYLkQLri9L1Q4R9Tvtg1wZtWMIrQnO6Q==
|
||||
"@cliqz/adblocker-extended-selectors@^1.23.6":
|
||||
version "1.23.6"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-extended-selectors/-/adblocker-extended-selectors-1.23.6.tgz#fed9c3973553751f1ecae2397ceff60d364a6e11"
|
||||
integrity sha512-qnn2LrE/0YswjL4399M1ldKityLxDT9r/b9MUOPboz+4EiE/ew6hTl35yNg2g8nZU3tXSzrnvAYcqLw607kSYg==
|
||||
|
||||
"@cliqz/adblocker@^1.23.4":
|
||||
version "1.23.4"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker/-/adblocker-1.23.4.tgz#dbf2282e223ca1bf963bc34d9a5d2b7f506513b5"
|
||||
integrity sha512-IVP6L2on4SFCAk13hhH87MDbfXxvWv86LScKPoD7rOg+5f51HWp4meW+yFtv/VbLdpkKgORWXNA1KttVW0IuKA==
|
||||
"@cliqz/adblocker@^1.23.6":
|
||||
version "1.23.6"
|
||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker/-/adblocker-1.23.6.tgz#741ee9a1fde2e75920204c120200704252932e02"
|
||||
integrity sha512-+Ojm25XwIkiD0THvf+WHZ3+zq65DuES7B6XlsMpbYC0JD8J9crpswLHsAmj97o0KVN+vmK2fYrqa2DgOUnFzYg==
|
||||
dependencies:
|
||||
"@cliqz/adblocker-content" "^1.23.4"
|
||||
"@cliqz/adblocker-extended-selectors" "^1.23.4"
|
||||
"@cliqz/adblocker-content" "^1.23.6"
|
||||
"@cliqz/adblocker-extended-selectors" "^1.23.6"
|
||||
"@remusao/guess-url-type" "^1.1.2"
|
||||
"@remusao/small" "^1.1.2"
|
||||
"@remusao/smaz" "^1.7.1"
|
||||
"@types/chrome" "^0.0.176"
|
||||
"@types/chrome" "^0.0.178"
|
||||
"@types/firefox-webext-browser" "^94.0.0"
|
||||
tldts-experimental "^5.6.21"
|
||||
|
||||
@ -1419,10 +1419,10 @@
|
||||
dependencies:
|
||||
"@babel/types" "^7.3.0"
|
||||
|
||||
"@types/chrome@^0.0.176":
|
||||
version "0.0.176"
|
||||
resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.176.tgz#617fcbe41ea1d9c5d50c9e7fb8ebfe2d9aef853a"
|
||||
integrity sha512-LOveFOMIUhMJjvRzZv5whGBpncP/gdJ4hcxeAqg94wGi6CyKaCmLgFSofgItf85GuLTl/0BQ6J/Y1e8BqZWfEg==
|
||||
"@types/chrome@^0.0.178":
|
||||
version "0.0.178"
|
||||
resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.178.tgz#fba7969208cef79ae752dc1138ff05de39f5ffde"
|
||||
integrity sha512-U+G5YG2pH0qvLrYVJ9aT5VbPXYR3fAFyCuRBRAA14Pv7GrkFzDJuXPspgdeLYaKzGEp4rymUkuqUOuFz18LI1g==
|
||||
dependencies:
|
||||
"@types/filesystem" "*"
|
||||
"@types/har-format" "*"
|
||||
@ -6715,13 +6715,12 @@ playwright@^1.17.1:
|
||||
playwright-core "=1.17.1"
|
||||
|
||||
plist@^3.0.1:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.2.tgz#74bbf011124b90421c22d15779cee60060ba95bc"
|
||||
integrity sha512-MSrkwZBdQ6YapHy87/8hDU8MnIcyxBKjeF+McXnr5A9MtffPewTs7G3hlpodT5TacyfIyFTaJEhh3GGcmasTgQ==
|
||||
version "3.0.5"
|
||||
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.5.tgz#2cbeb52d10e3cdccccf0c11a63a85d830970a987"
|
||||
integrity sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==
|
||||
dependencies:
|
||||
base64-js "^1.5.1"
|
||||
xmlbuilder "^9.0.7"
|
||||
xmldom "^0.5.0"
|
||||
|
||||
plur@^4.0.0:
|
||||
version "4.0.0"
|
||||
@ -8321,11 +8320,6 @@ xmlchars@^2.2.0:
|
||||
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
|
||||
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
|
||||
|
||||
xmldom@^0.5.0:
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.5.0.tgz#193cb96b84aa3486127ea6272c4596354cb4962e"
|
||||
integrity sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==
|
||||
|
||||
xo@^0.45.0:
|
||||
version "0.45.0"
|
||||
resolved "https://registry.yarnpkg.com/xo/-/xo-0.45.0.tgz#a953ff5da208f1e4829866f89382f92fb382906b"
|
||||
|
||||
Reference in New Issue
Block a user