增加禁用弹幕热力图开关
This commit is contained in:
@@ -4965,8 +4965,8 @@ function PlayPageClient() {
|
||||
return '打开设置';
|
||||
},
|
||||
},
|
||||
// 热力图开关(始终显示,不再依赖 danmakuHeatmapDisabled)
|
||||
{
|
||||
// 热力图开关(仅在未禁用时显示)
|
||||
...(!danmakuHeatmapDisabledRef.current ? [{
|
||||
name: '弹幕热力',
|
||||
html: '弹幕热力',
|
||||
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z" fill="#ffffff"/></svg>',
|
||||
@@ -4982,7 +4982,7 @@ function PlayPageClient() {
|
||||
}
|
||||
return newVal;
|
||||
},
|
||||
},
|
||||
}] : []),
|
||||
...(webGPUSupported ? [
|
||||
{
|
||||
name: 'Anime4K超分',
|
||||
|
||||
@@ -115,6 +115,7 @@ export const UserMenu: React.FC = () => {
|
||||
const [nextEpisodeDanmakuPreload, setNextEpisodeDanmakuPreload] = useState(true);
|
||||
const [disableAutoLoadDanmaku, setDisableAutoLoadDanmaku] = useState(false);
|
||||
const [danmakuMaxCount, setDanmakuMaxCount] = useState(0);
|
||||
const [danmakuHeatmapDisabled, setDanmakuHeatmapDisabled] = useState(false);
|
||||
const [searchTraditionalToSimplified, setSearchTraditionalToSimplified] = useState(false);
|
||||
|
||||
// 邮件通知设置
|
||||
@@ -411,15 +412,12 @@ export const UserMenu: React.FC = () => {
|
||||
|
||||
const savedDanmakuMaxCount = localStorage.getItem('danmakuMaxCount');
|
||||
if (savedDanmakuMaxCount !== null) {
|
||||
const value = parseInt(savedDanmakuMaxCount, 10);
|
||||
// 兼容旧版本的0-4映射值
|
||||
if (value <= 4) {
|
||||
const mappedValue = value === 0 ? 0 : value === 1 ? 1000 : value === 2 ? 3000 : value === 3 ? 5000 : 10000;
|
||||
setDanmakuMaxCount(mappedValue);
|
||||
localStorage.setItem('danmakuMaxCount', String(mappedValue));
|
||||
} else {
|
||||
setDanmakuMaxCount(value);
|
||||
}
|
||||
setDanmakuMaxCount(parseInt(savedDanmakuMaxCount, 10));
|
||||
}
|
||||
|
||||
const savedDanmakuHeatmapDisabled = localStorage.getItem('danmaku_heatmap_disabled');
|
||||
if (savedDanmakuHeatmapDisabled !== null) {
|
||||
setDanmakuHeatmapDisabled(savedDanmakuHeatmapDisabled === 'true');
|
||||
}
|
||||
|
||||
// 加载首页模块配置
|
||||
@@ -792,6 +790,13 @@ export const UserMenu: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleDanmakuHeatmapDisabledToggle = (value: boolean) => {
|
||||
setDanmakuHeatmapDisabled(value);
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.setItem('danmaku_heatmap_disabled', String(value));
|
||||
}
|
||||
};
|
||||
|
||||
const handleSearchTraditionalToSimplifiedToggle = (value: boolean) => {
|
||||
setSearchTraditionalToSimplified(value);
|
||||
if (typeof window !== 'undefined') {
|
||||
@@ -912,6 +917,7 @@ export const UserMenu: React.FC = () => {
|
||||
localStorage.setItem('nextEpisodeDanmakuPreload', 'true');
|
||||
localStorage.setItem('disableAutoLoadDanmaku', 'false');
|
||||
localStorage.setItem('danmakuMaxCount', '0');
|
||||
localStorage.setItem('danmaku_heatmap_disabled', 'false');
|
||||
localStorage.setItem('homeModules', JSON.stringify(defaultHomeModules));
|
||||
localStorage.setItem('searchTraditionalToSimplified', 'false');
|
||||
window.dispatchEvent(new CustomEvent('homeModulesUpdated'));
|
||||
@@ -1900,6 +1906,30 @@ export const UserMenu: React.FC = () => {
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{/* 禁用弹幕热力图 */}
|
||||
<div className='flex items-center justify-between'>
|
||||
<div>
|
||||
<h4 className='text-sm font-medium text-gray-700 dark:text-gray-300'>
|
||||
禁用弹幕热力图
|
||||
</h4>
|
||||
<p className='text-xs text-gray-500 dark:text-gray-400 mt-1'>
|
||||
开启后不显示弹幕热力图和热力图开关
|
||||
</p>
|
||||
</div>
|
||||
<label className='flex items-center cursor-pointer'>
|
||||
<div className='relative'>
|
||||
<input
|
||||
type='checkbox'
|
||||
className='sr-only peer'
|
||||
checked={danmakuHeatmapDisabled}
|
||||
onChange={(e) => handleDanmakuHeatmapDisabledToggle(e.target.checked)}
|
||||
/>
|
||||
<div className='w-11 h-6 bg-gray-300 rounded-full peer-checked:bg-green-500 transition-colors dark:bg-gray-600'></div>
|
||||
<div className='absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform peer-checked:translate-x-5'></div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{/* 弹幕加载上限 */}
|
||||
<div className='space-y-2'>
|
||||
<div className='flex items-center justify-between'>
|
||||
|
||||
Reference in New Issue
Block a user