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