mirror of
https://github.com/mue/mue.git
synced 2026-07-14 04:24:01 +02:00
add custom search engine back
This commit is contained in:
@@ -68,6 +68,7 @@ export default class Settings extends React.PureComponent {
|
||||
document.getElementById('searchEngine').style.color = 'white';
|
||||
document.getElementById('language').style.color = 'white';
|
||||
document.getElementById('greetingName').style.color = 'white';
|
||||
document.getElementById('customSearchEngine').style.color = 'white';
|
||||
const choices = document.getElementsByClassName('choices');
|
||||
for (let i = 0; i < choices.length; i++) choices[i].style.backgroundColor = '#2f3542';
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ export default class BackgroundSettings extends React.PureComponent {
|
||||
localStorage.setItem('customBackground', e.target.result);
|
||||
document.getElementById('customBackground').src = e.target.result;
|
||||
document.getElementById('customBackground').value = e.target.result;
|
||||
document.getElementById('backgroundImage').setAttribute('style', `-webkit-filter:blur(${localStorage.getItem('blur')}px); background-image: url(${localStorage.getItem('customBackground')}`);
|
||||
document.getElementById('backgroundImage').style.backgroundImage = `url(${localStorage.getItem('customBackground')})`;
|
||||
});
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
@@ -2,10 +2,19 @@ import React from 'react';
|
||||
import SettingsFunctions from '../../../../modules/settingsFunctions';
|
||||
|
||||
export default class SearchSettings extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
if (localStorage.getItem('searchEngine') === 'custom') {
|
||||
const input = document.getElementById('searchEngineInput');
|
||||
input.style.display = 'block';
|
||||
input.enabled = 'true';
|
||||
document.getElementById('customSearchEngine').value = localStorage.getItem('customSearchEngine');
|
||||
} else localStorage.removeItem('customSearchEngine');
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<ul>
|
||||
<ul>
|
||||
<label htmlFor='4'>{this.props.language.searchbar.searchengine} </label>
|
||||
<select className='select-css' name='4' id='searchEngine' onChange={() => SettingsFunctions.setSearchEngine(document.getElementById('searchEngine').value)}>
|
||||
<option className='choices' value='duckduckgo'>DuckDuckGo</option>
|
||||
@@ -17,11 +26,11 @@ export default class SearchSettings extends React.PureComponent {
|
||||
<option className='choices' value='qwant'>Qwant</option>
|
||||
<option className='choices' value='ask'>Ask</option>
|
||||
<option className='choices' value='startpage'>Startpage</option>
|
||||
{/* <option value='custom'>Custom</option> */}
|
||||
<option className='choices' value='custom'>Custom</option>
|
||||
</select>
|
||||
</ul>
|
||||
<ul id='searchEngineInput' style={{ display: 'none' }}>
|
||||
<p style={{"marginTop": "0px"}}>Custom Search URL <span className='modalLink' onClick={() => this.props.resetItem('customSearchEngine')}>Reset</span></p>
|
||||
<p style={{"marginTop": "0px"}}>Custom Search URL <span className='modalLink' onClick={() => this.props.resetItem('customSearchEngine')}>{this.props.language.reset}</span></p>
|
||||
<input type='text' id='customSearchEngine'></input>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -21,6 +21,9 @@ export default class Search extends React.PureComponent {
|
||||
default: url = 'https://duckduckgo.com'; break;
|
||||
}
|
||||
|
||||
const custom = localStorage.getItem('customSearchEngine');
|
||||
if (custom) url = custom;
|
||||
|
||||
const searchButton = () => {
|
||||
let value = document.getElementById('searchtext').value;
|
||||
if (!value) value = 'mue fast';
|
||||
|
||||
Reference in New Issue
Block a user