style: auto-fix linting issues

This commit is contained in:
JulienMaille 2026-01-28 23:04:47 +00:00 committed by github-actions[bot]
parent 30865d2632
commit a6f94a8385
6 changed files with 2782 additions and 1989 deletions

4689
index.html

File diff suppressed because one or more lines are too long

View file

@ -480,7 +480,7 @@ export function initializeSettings(scrobbler, player, api, ui) {
const val = e.target.value;
visualizerSettings.setPreset(val);
// Assuming 'ui' has access to 'visualizer' instance or we need to find it
// 'ui' is passed to initializeSettings.
// 'ui' is passed to initializeSettings.
// In ui.js, 'visualizer' is a property of UIRenderer.
if (ui && ui.visualizer) {
ui.visualizer.setPreset(val);

View file

@ -18,9 +18,9 @@ export class Visualizer {
this.animationId = null;
this.presets = {
'lcd': new LCDPreset(),
'particles': new ParticlesPreset(),
'unknown-pleasures': new UnknownPleasuresPreset()
lcd: new LCDPreset(),
particles: new ParticlesPreset(),
'unknown-pleasures': new UnknownPleasuresPreset(),
};
this.activePresetKey = visualizerSettings.getPreset();
@ -39,7 +39,7 @@ export class Visualizer {
upbeatSmoother: 0,
sensitivity: 0.5,
primaryColor: '#ffffff',
mode: ''
mode: '',
};
// ---- CACHED STATE ----
@ -145,12 +145,7 @@ export class Visualizer {
this.analyser.getByteFrequencyData(this.dataArray);
// Bass (first bins only — cheap)
let bass =
(this.dataArray[0] +
this.dataArray[1] +
this.dataArray[2] +
this.dataArray[3]) *
0.000980392; // 1 / (4 * 255)
let bass = (this.dataArray[0] + this.dataArray[1] + this.dataArray[2] + this.dataArray[3]) * 0.000980392; // 1 / (4 * 255)
const intensity = bass * bass;
const stats = this.stats;
@ -164,8 +159,7 @@ export class Visualizer {
if (stats.energyAverage > 0.4) {
sensitivity = 0.7;
} else if (stats.energyAverage > 0.2) {
sensitivity =
0.1 + ((stats.energyAverage - 0.2) / 0.2) * 0.6;
sensitivity = 0.1 + ((stats.energyAverage - 0.2) / 0.2) * 0.6;
} else {
sensitivity = 0.1;
}
@ -173,15 +167,10 @@ export class Visualizer {
// ===== KICK DETECTION =====
const now = performance.now();
let threshold = stats.energyAverage < 0.3
? 0.5 + (0.3 - stats.energyAverage) * 2
: 0.5;
let threshold = stats.energyAverage < 0.3 ? 0.5 + (0.3 - stats.energyAverage) * 2 : 0.5;
if (intensity > threshold) {
if (
intensity > stats.lastIntensity + 0.05 &&
now - stats.lastBeatTime > 50
) {
if (intensity > stats.lastIntensity + 0.05 && now - stats.lastBeatTime > 50) {
stats.kick = 1.0;
stats.lastBeatTime = now;
} else {
@ -205,10 +194,7 @@ export class Visualizer {
stats.sensitivity = sensitivity;
// ===== COLORS (CACHED) =====
const color =
getComputedStyle(document.documentElement)
.getPropertyValue('--primary')
.trim() || '#ffffff';
const color = getComputedStyle(document.documentElement).getPropertyValue('--primary').trim() || '#ffffff';
if (color !== this._lastPrimaryColor) {
stats.primaryColor = color;
@ -218,13 +204,7 @@ export class Visualizer {
stats.mode = visualizerSettings.getMode();
// ===== DRAW =====
this.activePreset.draw(
this.ctx,
this.canvas,
this.analyser,
this.dataArray,
stats
);
this.activePreset.draw(this.ctx, this.canvas, this.analyser, this.dataArray, stats);
};
setPreset(key) {

View file

@ -183,7 +183,7 @@ export class LCDPreset {
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
}
resize() { }
resize() {}
draw(ctx, canvas, analyser, dataArray, params) {
const { width, height } = canvas;
@ -209,13 +209,13 @@ export class LCDPreset {
const endX = width * 0.95;
const totalW = endX - startX;
const maxBarH = height;
const startScale = 2.0; // Left (near) - increased
const endScale = 0.05; // Right (far) - decreased
const startScale = 2.0; // Left (near) - increased
const endScale = 0.05; // Right (far) - decreased
// --- Apply Global Skew Transform ---
ctx.save();
ctx.translate(centerX, centerY);
ctx.transform(1, -0.08, 0.20, 1, 0, 0);
ctx.transform(1, -0.08, 0.2, 1, 0, 0);
ctx.translate(-centerX, -centerY);
// Shake on kick
@ -225,7 +225,7 @@ export class LCDPreset {
}
// --- Draw Bars ---
const baseBarW = totalW / this.gridCols * 0.7; // Base width
const baseBarW = (totalW / this.gridCols) * 0.7; // Base width
for (let c = 0; c < this.gridCols; c++) {
const p = c / (this.gridCols - 1);
@ -294,7 +294,8 @@ export class LCDPreset {
const startBin = Math.floor(minBin * Math.pow(maxBin / minBin, p));
const endBin = Math.max(startBin + 1, Math.floor(minBin * Math.pow(maxBin / minBin, p + 1 / center)));
let sum = 0, count = 0;
let sum = 0,
count = 0;
for (let k = startBin; k < endBin && k < totalBins; k++) {
sum += dataArray[k];
count++;
@ -322,14 +323,14 @@ export class LCDPreset {
// Auto-gain with more headroom
this.maxVol = Math.max(this.maxVol * this.volDecay, peakVal, 40);
const normFactor = (200 / this.maxVol);
const normFactor = 200 / this.maxVol;
// Normalize and apply contrast curve
for (let c = 0; c < this.gridCols; c++) {
let v = (this.prevData[c] * normFactor) / 255;
// Noise gate: important to scale the bars
const gate = 0.50
const gate = 0.5;
if (v < gate) v = 0;
else v = (v - gate) / (1 - gate);
@ -365,7 +366,7 @@ export class LCDPreset {
const r = parseInt(hex.slice(1, 3), 16);
const g = parseInt(hex.slice(3, 5), 16);
const b = parseInt(hex.slice(5, 7), 16);
const clamp = v => Math.min(255, Math.max(0, Math.round(v * factor)));
const clamp = (v) => Math.min(255, Math.max(0, Math.round(v * factor)));
return `rgb(${clamp(r)},${clamp(g)},${clamp(b)})`;
}

View file

@ -26,8 +26,10 @@ export class UnknownPleasuresPreset {
this.writeIndex = 0;
}
resize() { }
destroy() { this.history.length = 0; }
resize() {}
destroy() {
this.history.length = 0;
}
_precompute() {
const pts = this.dataPoints;
@ -71,7 +73,7 @@ export class UnknownPleasuresPreset {
}
const pts = this.dataPoints;
const len = (dataArray.length) | 0;
const len = dataArray.length | 0;
const line = this.history[this.writeIndex];
if (line) {
@ -129,10 +131,7 @@ export class UnknownPleasuresPreset {
ctx.moveTo(margin, y);
for (let j = 0; j < pts; j++) {
ctx.lineTo(
margin + this.xLookup[j] * lw,
y - data[j] * amp
);
ctx.lineTo(margin + this.xLookup[j] * lw, y - data[j] * amp);
}
ctx.stroke();
}

View file

@ -719,7 +719,6 @@ input[type='search']::-webkit-search-cancel-button {
}
@keyframes pulse {
0%,
100% {
opacity: 1;
@ -1038,7 +1037,6 @@ input[type='search']::-webkit-search-cancel-button {
}
@media (max-width: 1100px) {
#home-recommended-songs,
#artist-detail-tracks,
#playlist-detail-recommended {
@ -1638,11 +1636,11 @@ input[type='search']::-webkit-search-cancel-button {
border-radius: 50%;
}
input:checked+.slider {
input:checked + .slider {
background-color: var(--primary);
}
input:checked+.slider::before {
input:checked + .slider::before {
transform: translateX(16px);
background-color: var(--primary-foreground);
}
@ -4795,4 +4793,4 @@ body:has(#side-panel.active) #close-fullscreen-cover-btn {
width: 25px;
height: 25px;
}
}
}