mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 18:21:47 +00:00
xo lint --fix
This commit is contained in:
@ -1,56 +1,58 @@
|
|||||||
const getSongControls = require("../../providers/song-controls");
|
const getSongControls = require('../../providers/song-controls');
|
||||||
const getSongInfo = require("../../providers/song-info");
|
const getSongInfo = require('../../providers/song-info');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = win => {
|
module.exports = win => {
|
||||||
win.hide = function () {
|
win.hide = function () {
|
||||||
win.minimize()
|
win.minimize();
|
||||||
win.setSkipTaskbar(true);}
|
win.setSkipTaskbar(true);
|
||||||
|
};
|
||||||
|
|
||||||
var show = win.show;
|
const {show} = win;
|
||||||
win.show = function () {
|
win.show = function () {
|
||||||
win.restore();
|
win.restore();
|
||||||
win.focus();
|
win.focus();
|
||||||
win.setSkipTaskbar(false);
|
win.setSkipTaskbar(false);
|
||||||
show.apply(win)
|
show.apply(win);
|
||||||
}
|
};
|
||||||
|
|
||||||
win.isVisible = function () {
|
win.isVisible = function () {
|
||||||
return !win.isMinimized();
|
return !win.isMinimized();
|
||||||
}
|
};
|
||||||
|
|
||||||
const registerCallback = getSongInfo(win);
|
const registerCallback = getSongInfo(win);
|
||||||
const { playPause, next, previous} = getSongControls(win);
|
const {playPause, next, previous} = getSongControls(win);
|
||||||
|
|
||||||
// If the page is ready, register the callback
|
// If the page is ready, register the callback
|
||||||
win.on("ready-to-show", () => {
|
win.on('ready-to-show', () => {
|
||||||
registerCallback((songInfo) => {
|
registerCallback(songInfo => {
|
||||||
//wait for song to start before setting thumbar
|
// Wait for song to start before setting thumbar
|
||||||
if(songInfo.title === '') {
|
if (songInfo.title === '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// win32 require full rewrite of components
|
|
||||||
win.setThumbarButtons([
|
// Win32 require full rewrite of components
|
||||||
{
|
win.setThumbarButtons([
|
||||||
tooltip: 'Previous',
|
{
|
||||||
icon: get('backward.png'),
|
tooltip: 'Previous',
|
||||||
click () { previous(win.webContents) }
|
icon: get('backward.png'),
|
||||||
}, {
|
click() {previous(win.webContents);}
|
||||||
tooltip: 'Play/Pause',
|
}, {
|
||||||
//update icon based on play state
|
tooltip: 'Play/Pause',
|
||||||
icon: songInfo.isPaused ? get('play.png') : get('pause.png'),
|
// Update icon based on play state
|
||||||
click () { playPause(win.webContents) }
|
icon: songInfo.isPaused ? get('play.png') : get('pause.png'),
|
||||||
} , {
|
click() {playPause(win.webContents);}
|
||||||
tooltip: 'Next',
|
}, {
|
||||||
icon: get('forward.png'),
|
tooltip: 'Next',
|
||||||
click () { next(win.webContents) }
|
icon: get('forward.png'),
|
||||||
}
|
click() {next(win.webContents);}
|
||||||
])
|
}
|
||||||
});
|
]);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//util
|
// Util
|
||||||
function get (address) {
|
function get(address) {
|
||||||
return path.join(__dirname,address);
|
return path.join(__dirname, address);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user