mirror of
https://github.com/mue/mue.git
synced 2026-06-12 03:28:46 +02:00
fix: baidu search bug
- reported via google chrome store reviews Co-authored-by: David Ralph <me@davidcralph.co.uk>
This commit is contained in:
@@ -2,7 +2,7 @@ import { useState } from 'react';
|
||||
import { useFloating, flip, offset, shift } from '@floating-ui/react-dom';
|
||||
import './tooltip.scss';
|
||||
|
||||
export default function Tooltip({ children, title, style, placement }) {
|
||||
export default function Tooltip({ children, title, style, placement, subtitle }) {
|
||||
const [showTooltip, setShowTooltip] = useState(false);
|
||||
const { x, y, reference, floating, strategy } = useFloating({
|
||||
placement: placement || 'bottom',
|
||||
@@ -27,10 +27,13 @@ export default function Tooltip({ children, title, style, placement }) {
|
||||
position: strategy,
|
||||
top: y ?? '',
|
||||
left: x ?? '',
|
||||
display: 'flex',
|
||||
flexFlow: 'column',
|
||||
}}
|
||||
className="tooltipTitle"
|
||||
>
|
||||
{title}
|
||||
<span style={{ fontSize: '8px'}}>{subtitle}</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -19,13 +19,14 @@ export default class Navbar extends PureComponent {
|
||||
this.refreshValue = localStorage.getItem('refreshOption');
|
||||
this.state = {
|
||||
classList: localStorage.getItem('widgetStyle') === 'legacy' ? 'navbar old' : 'navbar new',
|
||||
refreshText: '',
|
||||
};
|
||||
}
|
||||
|
||||
setZoom() {
|
||||
this.setState({
|
||||
zoomFontSize: Number(((localStorage.getItem('zoomNavbar') || 100) / 100) * 1.2) + "rem"
|
||||
})
|
||||
zoomFontSize: Number(((localStorage.getItem('zoomNavbar') || 100) / 100) * 1.2) + 'rem',
|
||||
});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -40,6 +41,29 @@ export default class Navbar extends PureComponent {
|
||||
}
|
||||
});
|
||||
|
||||
if (localStorage.getItem('refreshOption') === 'background') {
|
||||
this.setState({
|
||||
refreshText: variables.getMessage('modals.main.settings.sections.background.title'),
|
||||
});
|
||||
} else if (localStorage.getItem('refreshOption') === 'quote') {
|
||||
this.setState({
|
||||
refreshText: variables.getMessage('modals.main.settings.sections.quote.title'),
|
||||
});
|
||||
} else if (localStorage.getItem('refreshOption') === 'quotebackground') {
|
||||
this.setState({
|
||||
refreshText:
|
||||
variables.getMessage('modals.main.settings.sections.quote.title') +
|
||||
' ' +
|
||||
variables.getMessage('modals.main.settings.sections.background.title'),
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
refreshText: variables.getMessage(
|
||||
'modals.main.settings.sections.appearance.navbar.refresh_options.page',
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
this.setZoom();
|
||||
}
|
||||
|
||||
@@ -61,14 +85,23 @@ export default class Navbar extends PureComponent {
|
||||
const backgroundEnabled = localStorage.getItem('background') === 'true';
|
||||
|
||||
const navbar = (
|
||||
<div className="navbar-container" >
|
||||
<div className={this.state.classList} >
|
||||
{localStorage.getItem('view') === 'true' && backgroundEnabled ? <Maximise fontSize={this.state.zoomFontSize} /> : null}
|
||||
{localStorage.getItem('notesEnabled') === 'true' ? <Notes fontSize={this.state.zoomFontSize} /> : null}
|
||||
{localStorage.getItem('todo') === 'true' ? <Todo fontSize={this.state.zoomFontSize} /> : null}
|
||||
<div className="navbar-container">
|
||||
<div className={this.state.classList}>
|
||||
{localStorage.getItem('view') === 'true' && backgroundEnabled ? (
|
||||
<Maximise fontSize={this.state.zoomFontSize} />
|
||||
) : null}
|
||||
{localStorage.getItem('notesEnabled') === 'true' ? (
|
||||
<Notes fontSize={this.state.zoomFontSize} />
|
||||
) : null}
|
||||
{localStorage.getItem('todo') === 'true' ? (
|
||||
<Todo fontSize={this.state.zoomFontSize} />
|
||||
) : null}
|
||||
|
||||
{this.refreshEnabled !== 'false' ? (
|
||||
<Tooltip title={variables.getMessage('widgets.navbar.tooltips.refresh')}>
|
||||
<Tooltip
|
||||
title={variables.getMessage('widgets.navbar.tooltips.refresh')}
|
||||
subtitle={this.state.refreshText}
|
||||
>
|
||||
<button onClick={() => this.refresh()} style={{ fontSize: this.state.zoomFontSize }}>
|
||||
<MdRefresh className="refreshicon topicons" />
|
||||
</button>
|
||||
@@ -81,7 +114,10 @@ export default class Navbar extends PureComponent {
|
||||
),
|
||||
})}
|
||||
>
|
||||
<button onClick={() => this.props.openModal('mainModal')} style={{ fontSize: this.state.zoomFontSize }}>
|
||||
<button
|
||||
onClick={() => this.props.openModal('mainModal')}
|
||||
style={{ fontSize: this.state.zoomFontSize }}
|
||||
>
|
||||
<MdSettings className="settings-icon topicons" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
{
|
||||
"name": "百度",
|
||||
"settingsName": "baidu",
|
||||
"url": "https://www.baidu.com/s?wd="
|
||||
"url": "https://www.baidu.com/s",
|
||||
"query": "wd"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user