fix: remove xo, migration to eslint

This commit is contained in:
JellyBrick
2023-08-29 17:22:38 +09:00
parent 31a7588cee
commit c722896a73
142 changed files with 17210 additions and 18409 deletions

View File

@ -1,18 +1,19 @@
const { TouchBar } = require("electron");
const { TouchBar } = require('electron');
const {
TouchBarButton,
TouchBarLabel,
TouchBarSpacer,
TouchBarSegmentedControl,
TouchBarScrubber,
TouchBarButton,
TouchBarLabel,
TouchBarSpacer,
TouchBarSegmentedControl,
TouchBarScrubber,
} = TouchBar;
const registerCallback = require("../../providers/song-info");
const getSongControls = require("../../providers/song-controls");
const registerCallback = require('../../providers/song-info');
const getSongControls = require('../../providers/song-controls');
// Songtitle label
const songTitle = new TouchBarLabel({
label: "",
label: '',
});
// This will store the song controls once available
let controls = [];
@ -25,62 +26,62 @@ const pausePlayButton = new TouchBarButton();
// The song control buttons (control functions are in the same order)
const buttons = new TouchBarSegmentedControl({
mode: "buttons",
segments: [
new TouchBarButton({
label: "⏮",
}),
pausePlayButton,
new TouchBarButton({
label: "⏭",
}),
new TouchBarButton({
label: "👎",
}),
new TouchBarButton({
label: "👍",
}),
],
change: (i) => controls[i](),
mode: 'buttons',
segments: [
new TouchBarButton({
label: '⏮',
}),
pausePlayButton,
new TouchBarButton({
label: '⏭',
}),
new TouchBarButton({
label: '👎',
}),
new TouchBarButton({
label: '👍',
}),
],
change: (i) => controls[i](),
});
// This is the touchbar object, this combines everything with proper layout
const touchBar = new TouchBar({
items: [
new TouchBarScrubber({
items: [songImage, songTitle],
continuous: false,
}),
new TouchBarSpacer({
size: "flexible",
}),
buttons,
],
items: [
new TouchBarScrubber({
items: [songImage, songTitle],
continuous: false,
}),
new TouchBarSpacer({
size: 'flexible',
}),
buttons,
],
});
module.exports = (win) => {
const { playPause, next, previous, dislike, like } = getSongControls(win);
const { playPause, next, previous, dislike, like } = getSongControls(win);
// If the page is ready, register the callback
win.once("ready-to-show", () => {
controls = [previous, playPause, next, dislike, like];
// If the page is ready, register the callback
win.once('ready-to-show', () => {
controls = [previous, playPause, next, dislike, like];
// Register the callback
registerCallback((songInfo) => {
// Song information changed, so lets update the touchBar
// Register the callback
registerCallback((songInfo) => {
// Song information changed, so lets update the touchBar
// Set the song title
songTitle.label = songInfo.title;
// Set the song title
songTitle.label = songInfo.title;
// Changes the pause button if paused
pausePlayButton.label = songInfo.isPaused ? "▶️" : "⏸";
// Changes the pause button if paused
pausePlayButton.label = songInfo.isPaused ? '▶️' : '⏸';
// Get image source
songImage.icon = songInfo.image
? songInfo.image.resize({ height: 23 })
: null;
// Get image source
songImage.icon = songInfo.image
? songInfo.image.resize({ height: 23 })
: null;
win.setTouchBar(touchBar);
});
});
win.setTouchBar(touchBar);
});
});
};