You've already forked bilibili-subtitle
去除是否自动展开配置
This commit is contained in:
@@ -368,10 +368,10 @@ const Body = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* recommend */}
|
{/* recommend */}
|
||||||
<div className='' style={{
|
<div className='p-0.5' style={{
|
||||||
height: `${RECOMMEND_HEIGHT}px`
|
height: `${RECOMMEND_HEIGHT}px`
|
||||||
}}>
|
}}>
|
||||||
{recommendIdx === 0 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10 m-0.5'>
|
{recommendIdx === 0 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10'>
|
||||||
<a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => {
|
<a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
openUrl('https://bibigpt.co/r/bilibili')
|
openUrl('https://bibigpt.co/r/bilibili')
|
||||||
@@ -380,7 +380,7 @@ const Body = () => {
|
|||||||
className='w-8 h-8'/>✨ BibiGPT ✨</a>
|
className='w-8 h-8'/>✨ BibiGPT ✨</a>
|
||||||
<span className='text-sm desc'>支持任意视频的网页版总结。</span>
|
<span className='text-sm desc'>支持任意视频的网页版总结。</span>
|
||||||
</div>}
|
</div>}
|
||||||
{recommendIdx === 1 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10 m-1'>
|
{recommendIdx === 1 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10'>
|
||||||
<a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => {
|
<a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
openUrl('https://chromewebstore.google.com/detail/fiaeclpicddpifeflpmlgmbjgaedladf')
|
openUrl('https://chromewebstore.google.com/detail/fiaeclpicddpifeflpmlgmbjgaedladf')
|
||||||
@@ -389,7 +389,7 @@ const Body = () => {
|
|||||||
className='w-8 h-8'/>YouTube Caption</a>
|
className='w-8 h-8'/>YouTube Caption</a>
|
||||||
<span className='text-sm desc'>YouTube版的字幕列表。</span>
|
<span className='text-sm desc'>YouTube版的字幕列表。</span>
|
||||||
</div>}
|
</div>}
|
||||||
{recommendIdx === 2 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10 m-1'>
|
{recommendIdx === 2 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10'>
|
||||||
<a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => {
|
<a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
openUrl('https://chromewebstore.google.com/detail/mcijpllinkhflgpkggimnafkbmpiijah')
|
openUrl('https://chromewebstore.google.com/detail/mcijpllinkhflgpkggimnafkbmpiijah')
|
||||||
|
@@ -57,7 +57,7 @@ const FormItem = (props: {
|
|||||||
const Settings = () => {
|
const Settings = () => {
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
const envData = useAppSelector(state => state.env.envData)
|
const envData = useAppSelector(state => state.env.envData)
|
||||||
const {value: autoExpandValue, onChange: setAutoExpandValue} = useEventChecked(envData.autoExpand)
|
// const {value: autoExpandValue, onChange: setAutoExpandValue} = useEventChecked(envData.autoExpand)
|
||||||
// const {value: autoScrollValue, onChange: setAutoScrollValue} = useEventChecked(envData.autoScroll)
|
// const {value: autoScrollValue, onChange: setAutoScrollValue} = useEventChecked(envData.autoScroll)
|
||||||
const {value: translateEnableValue, onChange: setTranslateEnableValue} = useEventChecked(envData.translateEnable)
|
const {value: translateEnableValue, onChange: setTranslateEnableValue} = useEventChecked(envData.translateEnable)
|
||||||
const {value: summarizeEnableValue, onChange: setSummarizeEnableValue} = useEventChecked(envData.summarizeEnable)
|
const {value: summarizeEnableValue, onChange: setSummarizeEnableValue} = useEventChecked(envData.summarizeEnable)
|
||||||
@@ -110,7 +110,7 @@ const Settings = () => {
|
|||||||
|
|
||||||
const onSave = useCallback(() => {
|
const onSave = useCallback(() => {
|
||||||
dispatch(setEnvData({
|
dispatch(setEnvData({
|
||||||
autoExpand: autoExpandValue,
|
// autoExpand: autoExpandValue,
|
||||||
aiType: aiTypeValue,
|
aiType: aiTypeValue,
|
||||||
apiKey: apiKeyValue,
|
apiKey: apiKeyValue,
|
||||||
serverUrl: serverUrlValue,
|
serverUrl: serverUrlValue,
|
||||||
@@ -134,7 +134,7 @@ const Settings = () => {
|
|||||||
}))
|
}))
|
||||||
dispatch(setPage(PAGE_MAIN))
|
dispatch(setPage(PAGE_MAIN))
|
||||||
toast.success('保存成功')
|
toast.success('保存成功')
|
||||||
}, [dispatch, autoExpandValue, aiTypeValue, apiKeyValue, serverUrlValue, modelValue, geminiApiKeyValue, translateEnableValue, languageValue, hideOnDisableAutoTranslateValue, themeValue, transDisplayValue, summarizeEnableValue, summarizeFloatValue, summarizeLanguageValue, wordsValue, fetchAmountValue, fontSizeValue, promptsValue, searchEnabledValue, cnSearchEnabledValue, askEnabledValue])
|
}, [dispatch, aiTypeValue, apiKeyValue, serverUrlValue, modelValue, geminiApiKeyValue, translateEnableValue, languageValue, hideOnDisableAutoTranslateValue, themeValue, transDisplayValue, summarizeEnableValue, summarizeFloatValue, summarizeLanguageValue, wordsValue, fetchAmountValue, fontSizeValue, promptsValue, searchEnabledValue, cnSearchEnabledValue, askEnabledValue])
|
||||||
|
|
||||||
const onCancel = useCallback(() => {
|
const onCancel = useCallback(() => {
|
||||||
dispatch(setPage(PAGE_MAIN))
|
dispatch(setPage(PAGE_MAIN))
|
||||||
@@ -193,10 +193,10 @@ const Settings = () => {
|
|||||||
}}>
|
}}>
|
||||||
<div className="flex flex-col gap-3 p-2">
|
<div className="flex flex-col gap-3 p-2">
|
||||||
<Section title='通用配置'>
|
<Section title='通用配置'>
|
||||||
<FormItem title='自动展开' htmlFor='autoExpand' tip='是否视频有字幕时自动展开字幕列表'>
|
{/* <FormItem title='自动展开' htmlFor='autoExpand' tip='是否视频有字幕时自动展开字幕列表'> */}
|
||||||
<input id='autoExpand' type='checkbox' className='toggle toggle-primary' checked={autoExpandValue}
|
{/* <input id='autoExpand' type='checkbox' className='toggle toggle-primary' checked={autoExpandValue} */}
|
||||||
onChange={setAutoExpandValue}/>
|
{/* onChange={setAutoExpandValue}/> */}
|
||||||
</FormItem>
|
{/* </FormItem> */}
|
||||||
<FormItem title='主题'>
|
<FormItem title='主题'>
|
||||||
<div className="btn-group">
|
<div className="btn-group">
|
||||||
<button onClick={onSelTheme1} className={classNames('btn btn-xs no-animation', (!themeValue || themeValue === 'system')?'btn-active':'')}>系统</button>
|
<button onClick={onSelTheme1} className={classNames('btn btn-xs no-animation', (!themeValue || themeValue === 'system')?'btn-active':'')}>系统</button>
|
||||||
|
@@ -106,13 +106,13 @@ const useSubtitleService = () => {
|
|||||||
}
|
}
|
||||||
}, [eventBus, infos])
|
}, [eventBus, infos])
|
||||||
|
|
||||||
// 当前未展示 & (未折叠 | 自动展开) & 有列表 => 展示第一个
|
// 当前未展示 & 未折叠 & 有列表 => 展示第一个
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!curInfo && (!fold || (envReady && envData.autoExpand)) && (infos != null) && infos.length > 0) {
|
if (!curInfo && !fold && (infos != null) && infos.length > 0) {
|
||||||
dispatch(setCurInfo(infos[0]))
|
dispatch(setCurInfo(infos[0]))
|
||||||
dispatch(setCurFetched(false))
|
dispatch(setCurFetched(false))
|
||||||
}
|
}
|
||||||
}, [curInfo, dispatch, envData.autoExpand, envReady, fold, infos])
|
}, [curInfo, dispatch, envReady, fold, infos])
|
||||||
// 获取
|
// 获取
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (curInfo && !curFetched) {
|
if (curInfo && !curFetched) {
|
||||||
|
@@ -53,7 +53,7 @@ const initialState: EnvState = {
|
|||||||
serverUrl: SERVER_URL_OPENAI,
|
serverUrl: SERVER_URL_OPENAI,
|
||||||
translateEnable: true,
|
translateEnable: true,
|
||||||
summarizeEnable: true,
|
summarizeEnable: true,
|
||||||
autoExpand: true,
|
// autoExpand: true,
|
||||||
theme: 'light',
|
theme: 'light',
|
||||||
searchEnabled: true,
|
searchEnabled: true,
|
||||||
},
|
},
|
||||||
|
2
src/typings.d.ts
vendored
2
src/typings.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
interface EnvData {
|
interface EnvData {
|
||||||
autoExpand?: boolean
|
// autoExpand?: boolean
|
||||||
flagDot?: boolean
|
flagDot?: boolean
|
||||||
|
|
||||||
aiType?: 'openai' | 'gemini'
|
aiType?: 'openai' | 'gemini'
|
||||||
|
Reference in New Issue
Block a user