mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 20:52:06 +00:00
fixed 'repeatChanged' modes being different depending on selected youtube music language
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ node_modules
|
|||||||
/assets/generated
|
/assets/generated
|
||||||
electron-builder.yml
|
electron-builder.yml
|
||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
|
.idea
|
||||||
|
|||||||
@ -68,12 +68,49 @@ function setupTimeChangeListener() {
|
|||||||
|
|
||||||
function setupRepeatChangeListener() {
|
function setupRepeatChangeListener() {
|
||||||
const repeatObserver = new MutationObserver(mutations => {
|
const repeatObserver = new MutationObserver(mutations => {
|
||||||
ipcRenderer.send('repeatChanged', mutations[0].target.title);
|
document.cookie.split(';').forEach((cookie) => {
|
||||||
|
let cookieName = cookie.substring(0, cookie.indexOf("=")).replaceAll(" ", "");
|
||||||
|
if (cookieName === 'PREF') {
|
||||||
|
let value = cookie.replace(cookieName + "=", "").replaceAll(" ", "");
|
||||||
|
value.split('&').forEach((pair) => {
|
||||||
|
if (pair !== '') {
|
||||||
|
let splitpair = pair.split('=');
|
||||||
|
if (splitpair[0] === "repeat") {
|
||||||
|
if (splitpair[1] === "NONE")
|
||||||
|
ipcRenderer.send('repeatChanged', "Repeat off");
|
||||||
|
else if (splitpair[1] === "ONE") //MPRIS Playlist and Track Codes are switched to look the same as yt-music icons
|
||||||
|
ipcRenderer.send('repeatChanged', "Repeat one");
|
||||||
|
else if (splitpair[1] === "ALL")
|
||||||
|
ipcRenderer.send('repeatChanged', "Repeat all");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
repeatObserver.observe($('#right-controls .repeat'), {attributeFilter: ["title"]});
|
repeatObserver.observe($('#right-controls .repeat'), {attributeFilter: ["title"]});
|
||||||
|
|
||||||
// Emit the initial value as well; as it's persistent between launches.
|
// Emit the initial value as well; as it's persistent between launches.
|
||||||
ipcRenderer.send('repeatChanged', $('#right-controls .repeat').title);
|
// ipcRenderer.send('repeatChanged', $('#right-controls .repeat').title);
|
||||||
|
document.cookie.split(';').forEach((cookie) => {
|
||||||
|
let cookieName = cookie.substring(0, cookie.indexOf("=")).replaceAll(" ", "");
|
||||||
|
if (cookieName === 'PREF') {
|
||||||
|
let value = cookie.replace(cookieName + "=", "").replaceAll(" ", "");
|
||||||
|
value.split('&').forEach((pair) => {
|
||||||
|
if (pair !== '') {
|
||||||
|
let splitpair = pair.split('=');
|
||||||
|
if (splitpair[0] === "repeat") {
|
||||||
|
if (splitpair[1] === "NONE")
|
||||||
|
ipcRenderer.send('repeatChanged', "Repeat off");
|
||||||
|
else if (splitpair[1] === "ONE") //MPRIS Playlist and Track Codes are switched to look the same as yt-music icons
|
||||||
|
ipcRenderer.send('repeatChanged', "Repeat one");
|
||||||
|
else if (splitpair[1] === "ALL")
|
||||||
|
ipcRenderer.send('repeatChanged', "Repeat all");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupVolumeChangeListener(api) {
|
function setupVolumeChangeListener(api) {
|
||||||
|
|||||||
Reference in New Issue
Block a user