mirror of
https://github.com/mue/mue.git
synced 2026-07-10 14:04:32 +02:00
fix: custom js, reminder on reset button etc
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import React from 'react';
|
||||
|
||||
import LocalMallIcon from '@material-ui/icons/LocalMall';
|
||||
|
||||
import FileUpload from '../../settings/FileUpload';
|
||||
|
||||
@@ -41,18 +41,23 @@ export default class Slider extends React.PureComponent {
|
||||
numberWidth: ((value.length + 1) * this.widthCalculation)
|
||||
});
|
||||
|
||||
if (this.props.element) {
|
||||
if (!document.querySelector(this.props.element)) {
|
||||
document.querySelector('.reminder-info').style.display = 'block';
|
||||
return localStorage.setItem('showReminder', true);
|
||||
}
|
||||
}
|
||||
|
||||
EventBus.dispatch('refresh', this.props.category);
|
||||
}
|
||||
|
||||
resetItem = () => {
|
||||
localStorage.setItem(this.props.name, this.props.default);
|
||||
this.setState({
|
||||
value: this.props.default,
|
||||
numberWidth: ((this.props.default.length + 1) * this.widthCalculation)
|
||||
this.handleChange({
|
||||
target: {
|
||||
value: this.props.default || ''
|
||||
}
|
||||
});
|
||||
|
||||
toast(window.language.toasts.reset);
|
||||
EventBus.dispatch('refresh', this.props.category);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -37,13 +37,12 @@ export default class Text extends React.PureComponent {
|
||||
}
|
||||
|
||||
resetItem = () => {
|
||||
localStorage.setItem(this.props.name, this.props.default || '');
|
||||
this.setState({
|
||||
value: this.props.default || ''
|
||||
this.handleChange({
|
||||
target: {
|
||||
value: this.props.default || ''
|
||||
}
|
||||
});
|
||||
|
||||
toast(window.language.toasts.reset);
|
||||
EventBus.dispatch('refresh', this.props.category);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -46,7 +46,7 @@ export default class AdvancedSettings extends React.PureComponent {
|
||||
|
||||
<h3>{advanced.customisation}</h3>
|
||||
<Text title={advanced.tab_name} name='tabName' default={window.language.tabname} category='other'/>
|
||||
<Text title={advanced.custom_js} name='customjs' textarea={true} category='other'/>
|
||||
<Text title={advanced.custom_js} name='customjs' textarea={true} category='other' element='other'/>
|
||||
<Text title={advanced.custom_css} name='customcss' textarea={true} category='other'/>
|
||||
|
||||
<h3>{this.language.sections.experimental.title}</h3>
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class BackgroundSettings extends React.PureComponent {
|
||||
}
|
||||
|
||||
let array = [];
|
||||
data.forEach(item => {
|
||||
data.forEach((item) => {
|
||||
array.push({
|
||||
name: item,
|
||||
value: item
|
||||
@@ -45,6 +45,7 @@ export default class BackgroundSettings extends React.PureComponent {
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
this.getQuoteLanguages();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-useless-escape */
|
||||
import React from 'react';
|
||||
|
||||
import EventBus from '../../../modules/helpers/eventbus';
|
||||
@@ -44,6 +43,7 @@ export default class QuickLinks extends React.PureComponent {
|
||||
}
|
||||
|
||||
// regex: https://ihateregex.io/expr/url/
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
if (url.length <= 0 || /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/.test(url) === false) {
|
||||
urlError = this.language.url_error;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,12 @@
|
||||
"settingsName": "startpage",
|
||||
"url": "https://www.startpage.com/sp/search"
|
||||
},
|
||||
{
|
||||
"name": "Yahoo! JAPAN",
|
||||
"settingsName": "yahoojp",
|
||||
"url": "https://search.yahoo.co.jp/search",
|
||||
"query": "p"
|
||||
},
|
||||
{
|
||||
"name": "Яндекс",
|
||||
"settingsName": "yandex",
|
||||
|
||||
Reference in New Issue
Block a user