|
1 | | -import { createSignal } from 'solid-js'; |
| 1 | +import { createSignal, type Component, For, Show } from 'solid-js'; |
2 | 2 | import { render } from 'solid-js/web'; |
3 | | -import { request, toast, type LoadImgFn } from 'main'; |
4 | | -import { type MangaProps, imgList as MangaImgList } from 'components/Manga'; |
| 3 | +import { request, toast, useSpeedDial, type LoadImgFn } from 'main'; |
| 4 | +import { |
| 5 | + type MangaProps, |
| 6 | + imgList as MangaImgList, |
| 7 | + SettingsItemSwitch, |
| 8 | + SettingHotkeys, |
| 9 | + SettingBlockSubtitle, |
| 10 | +} from 'components/Manga'; |
5 | 11 | import { |
6 | 12 | t, |
7 | 13 | querySelector, |
@@ -74,8 +80,56 @@ import { expandTagList } from './expandTagList'; |
74 | 80 | setImgList, |
75 | 81 | setFab, |
76 | 82 | setManga, |
| 83 | + setOptions, |
77 | 84 | } = context; |
78 | 85 |
|
| 86 | + const SiteSettings: Component = () => ( |
| 87 | + <> |
| 88 | + <For |
| 89 | + each={[ |
| 90 | + 'float_tag_list', // 悬浮标签列表 |
| 91 | + 'expand_tag_list', // 展开标签列表 |
| 92 | + 'tag_lint', // 标签检查 |
| 93 | + 'colorize_tag', // 标签染色 |
| 94 | + '', |
| 95 | + 'quick_favorite', // 快捷收藏 |
| 96 | + 'quick_rating', // 快捷评分 |
| 97 | + 'quick_tag_define', // 快捷查看标签定义 |
| 98 | + '', |
| 99 | + 'cross_site_link', // 关联外站 |
| 100 | + 'detect_ad', // 识别广告页 |
| 101 | + 'auto_adjust_option', // 自动调整配置 |
| 102 | + ]} |
| 103 | + > |
| 104 | + {(name) => ( |
| 105 | + <Show when={name} fallback={<hr />}> |
| 106 | + <SettingsItemSwitch |
| 107 | + name={t(`site.add_feature.${name}`)} |
| 108 | + value={options[name]} |
| 109 | + onChange={(v) => setOptions({ [name]: v })} |
| 110 | + /> |
| 111 | + </Show> |
| 112 | + )} |
| 113 | + </For> |
| 114 | + <hr /> |
| 115 | + <SettingBlockSubtitle>{t('other.hotkeys')}</SettingBlockSubtitle> |
| 116 | + <SettingHotkeys keys={['float_tag_list']} /> |
| 117 | + </> |
| 118 | + ); |
| 119 | + setManga({ |
| 120 | + editSettingList: (list) => [...list, ['E-Hentai', SiteSettings]], |
| 121 | + }); |
| 122 | + setFab({ |
| 123 | + speedDial: [ |
| 124 | + ...useSpeedDial(options, setOptions, context.placement, [ |
| 125 | + 'tag_lint', |
| 126 | + 'colorize_tag', |
| 127 | + 'cross_site_link', |
| 128 | + 'detect_ad', |
| 129 | + ]), |
| 130 | + ], |
| 131 | + }); |
| 132 | + |
79 | 133 | if (context.type === 'mpv') { |
80 | 134 | return setComicLoad(() => { |
81 | 135 | const imgEleList = querySelectorAll('.mimg[id]'); |
|
0 commit comments