mirror of
https://github.com/mue/mue.git
synced 2026-07-14 12:34:03 +02:00
Remove webp setting and cleanup search widget
This commit is contained in:
@@ -15,13 +15,6 @@ export default class Update extends React.PureComponent {
|
||||
}
|
||||
|
||||
async getUpdate() {
|
||||
if (localStorage.getItem('offlineMode') === 'true') {
|
||||
return this.setState({
|
||||
title: this.props.language.offline.title,
|
||||
html: this.props.language.offline.description
|
||||
});
|
||||
}
|
||||
|
||||
const data = await (await fetch(Constants.API_URL + '/getUpdate')).json();
|
||||
|
||||
if (data.statusCode === 500 || data.title === null) {
|
||||
@@ -42,7 +35,14 @@ export default class Update extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getUpdate();
|
||||
if (localStorage.getItem('offlineMode') === 'true') {
|
||||
return this.setState({
|
||||
title: this.props.language.offline.title,
|
||||
html: this.props.language.offline.description
|
||||
});
|
||||
}
|
||||
|
||||
this.getUpdate();
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -230,7 +230,6 @@ export default class BackgroundSettings extends React.PureComponent {
|
||||
<Checkbox name='view' text={this.props.language.background.view} />
|
||||
<Checkbox name='favouriteEnabled' text={this.props.language.background.favourite} />
|
||||
<Checkbox name='refresh' text={this.props.language.background.refresh} />
|
||||
<Checkbox name='webp' text={this.props.language.experimental.webp} betaFeature={true} />
|
||||
</ul>
|
||||
<ul>
|
||||
<Dropdown
|
||||
|
||||
@@ -121,7 +121,6 @@ export default class Background extends React.PureComponent {
|
||||
}
|
||||
|
||||
try { // First we try and get an image from the API...
|
||||
const enabled = localStorage.getItem('webp');
|
||||
let requestURL;
|
||||
|
||||
switch (localStorage.getItem('backgroundAPI')) {
|
||||
@@ -129,8 +128,7 @@ export default class Background extends React.PureComponent {
|
||||
requestURL = `${Constants.UNSPLASH_URL}/getImage`;
|
||||
break;
|
||||
default: // Defaults to Mue
|
||||
if (localStorage.getItem('supportswebp') === 'true' && enabled === 'true') requestURL = `${Constants.API_URL}/getImage?webp=true`;
|
||||
else requestURL = `${Constants.API_URL}/getImage?category=Outdoors`;
|
||||
requestURL = `${Constants.API_URL}/getImage?category=Outdoors`;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,15 +12,21 @@ export default class Search extends React.PureComponent {
|
||||
super(...args);
|
||||
this.state = {
|
||||
url: '',
|
||||
query: ''
|
||||
query: '',
|
||||
microphone: null
|
||||
};
|
||||
}
|
||||
|
||||
startSpeechRecognition() {
|
||||
const voiceSearch = new window.webkitSpeechRecognition();
|
||||
voiceSearch.start();
|
||||
|
||||
const searchText = document.getElementById('searchtext');
|
||||
voiceSearch.onresult = (event) => searchText.value = event.results[0][0].transcript;
|
||||
|
||||
voiceSearch.onresult = (event) => {
|
||||
searchText.value = event.results[0][0].transcript;
|
||||
}
|
||||
|
||||
voiceSearch.onend = () =>{
|
||||
setTimeout(() => {
|
||||
window.location.href = this.state.url + `?${this.state.query}=` + searchText.value;
|
||||
@@ -28,9 +34,11 @@ export default class Search extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
componentDidMount() {
|
||||
let url;
|
||||
let query = 'q';
|
||||
let microphone = null;
|
||||
|
||||
const setting = localStorage.getItem('searchEngine');
|
||||
const info = searchEngines.find(i => i.settingsName === setting);
|
||||
@@ -44,27 +52,24 @@ export default class Search extends React.PureComponent {
|
||||
url = localStorage.getItem('customSearchEngine');
|
||||
}
|
||||
|
||||
const searchButton = () => {
|
||||
const value = document.getElementById('searchtext').value || 'mue fast';
|
||||
window.location.href = url + `?${query}=` + value;
|
||||
};
|
||||
|
||||
let microphone = null;
|
||||
if (localStorage.getItem('voiceSearch') === 'true') {
|
||||
this.setState({
|
||||
url: url,
|
||||
query: query
|
||||
});
|
||||
microphone = <MicIcon className='micIcon' onClick={() => this.startSpeechRecognition()}/>;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
url: url,
|
||||
query: query,
|
||||
microphone: microphone
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div id='searchBar'>
|
||||
<form action={url}>
|
||||
{microphone}
|
||||
<SearchIcon onClick={() => searchButton()} id='searchButton' />
|
||||
<input type='text' placeholder={this.props.language} name={query} id='searchtext' className='searchtext'/>
|
||||
<div className='blursearcbBG'/>
|
||||
<form action={this.state.url}>
|
||||
{this.state.microphone}
|
||||
<SearchIcon onClick={() => searchButton()} id='searchButton'/>
|
||||
<input type='text' placeholder={this.props.language} name={this.state.query} id='searchtext'/>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user