Skip to content

Commit

Permalink
fix: 多个左侧菜单可能同时具有 active 类名
Browse files Browse the repository at this point in the history
  • Loading branch information
XIAYM-gh committed Aug 18, 2024
1 parent f7434e7 commit f884683
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simmusic-ncm-ext",
"version": "0.0.5-alpha.1+for.0.1.0",
"version": "0.0.5-alpha.2+for.0.1.0",
"type": "module",
"scripts": {
"build": "vite build"
Expand Down
10 changes: 4 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,13 @@ ExtensionConfig.ncm = {

renderMusicList(Object.keys(entry.songs).map(it => 'ncm:' + it), 'ncm-list-' + id, false, false, '该歌单为空', [DownloadController.getMenuItems()], { name: entry.name });

Object.values<HTMLDivElement>(elements).forEach(it => {
if (it == elements[id]) {
return it.classList.add('active');
}

document.querySelectorAll(".left .leftBar div").forEach(it => {
if (it.classList.contains('active')) {
it.classList.remove('active');
}
});
})

elements[id].classList.add('active');
}
}
};
6 changes: 3 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readFileSync, writeFileSync } from "fs";
import { defineConfig } from "vite";
import { strToU8, zipSync } from "fflate";
import { readFileSync, writeFileSync } from 'fs';
import { defineConfig } from 'vite';
import { strToU8, zipSync } from 'fflate';

const VERSION = JSON.parse(readFileSync('package.json').toString()).version;
const SIMMUSIC_VERSION = '0.1.0';
Expand Down

0 comments on commit f884683

Please sign in to comment.