mirror of
https://github.com/mue/mue.git
synced 2026-07-27 10:41:08 +02:00
stuff
This commit is contained in:
@@ -27,7 +27,8 @@ export default class MainModal extends React.PureComponent {
|
|||||||
document.getElementById('center').classList.toggle('backgroundEffects');
|
document.getElementById('center').classList.toggle('backgroundEffects');
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
tab: this.tabs.settings, currentTab: 'settings'
|
tab: this.tabs.settings,
|
||||||
|
currentTab: 'settings'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export default class Checkbox extends React.PureComponent {
|
|||||||
|
|
||||||
handleChange(name) {
|
handleChange(name) {
|
||||||
SettingsFunctions.setItem(name);
|
SettingsFunctions.setItem(name);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
checked: (this.state.checked === true) ? false : true
|
checked: (this.state.checked === true) ? false : true
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default class Section extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let extraHTML, expandMore, slider, noDropdown;
|
let extraHTML, expandMore;
|
||||||
|
|
||||||
if (this.props.children) {
|
if (this.props.children) {
|
||||||
extraHTML = (
|
extraHTML = (
|
||||||
@@ -44,19 +44,11 @@ export default class Section extends React.PureComponent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.slider !== false) {
|
|
||||||
slider = <Slider name={this.props.name} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.props.dropdown === false) {
|
|
||||||
noDropdown = 'nodropdown';
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='section'>
|
<div className='section'>
|
||||||
<h4 className={noDropdown} onClick={() => this.toggleSection()}>{this.props.title}</h4>
|
<h4 className={(this.props.dropdown === false) ? 'nodropdown' : null} onClick={() => this.toggleSection()}>{this.props.title}</h4>
|
||||||
{expandMore}
|
{expandMore}
|
||||||
{slider}
|
{(this.props.slider !== false) ? <Slider name={this.props.name} /> : null}
|
||||||
{extraHTML}
|
{extraHTML}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ export default class Slider extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChange(name) {
|
handleChange() {
|
||||||
SettingsFunctions.setItem(name);
|
let setText = (this.props.override) ? this.props.override : this.props.name;
|
||||||
|
|
||||||
|
SettingsFunctions.setItem(setText);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
checked: (this.state.checked === true) ? false : true
|
checked: (this.state.checked === true) ? false : true
|
||||||
@@ -19,11 +21,9 @@ export default class Slider extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let setText = (this.props.override) ? this.props.override : this.props.name;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<label className='switch'>
|
<label className='switch'>
|
||||||
<input type='checkbox' checked={this.state.checked} onChange={() => this.handleChange(setText)} />
|
<input type='checkbox' checked={this.state.checked} onChange={() => this.handleChange()} />
|
||||||
<span className='slider'></span>
|
<span className='slider'></span>
|
||||||
</label>
|
</label>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export default class GreetingSettings extends React.PureComponent {
|
|||||||
this.setState({
|
this.setState({
|
||||||
greetingName: ''
|
greetingName: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
toast(this.props.toastLanguage.reset);
|
toast(this.props.toastLanguage.reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ export default class GreetingSettings extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
localStorage.setItem('birthday', data);
|
localStorage.setItem('birthday', data);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
birthday: data
|
birthday: data
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export default class SearchSettings extends React.PureComponent {
|
|||||||
resetSearch() {
|
resetSearch() {
|
||||||
localStorage.removeItem('customSearchEngine');
|
localStorage.removeItem('customSearchEngine');
|
||||||
document.getElementById('customSearchEngine').value = '';
|
document.getElementById('customSearchEngine').value = '';
|
||||||
|
|
||||||
toast(this.props.toastLanguage.reset);
|
toast(this.props.toastLanguage.reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,13 +56,22 @@ export default class Marketplace extends React.PureComponent {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'item':
|
case 'item':
|
||||||
let info;
|
let info; // get item info
|
||||||
try {
|
try {
|
||||||
info = await (await fetch(`${Constants.MARKETPLACE_URL}/item/${type2}/${data}`)).json();
|
info = await (await fetch(`${Constants.MARKETPLACE_URL}/item/${type2}/${data}`)).json();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return toast(this.props.toastLanguage.error);
|
return toast(this.props.toastLanguage.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if already installed
|
||||||
|
let button = this.buttons.install;
|
||||||
|
|
||||||
|
const installed = JSON.parse(localStorage.getItem('installed'));
|
||||||
|
|
||||||
|
if (installed.some(item => item.name === data)) {
|
||||||
|
button = this.buttons.uninstall;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
current_data: { type: type2, name: data, content: info },
|
current_data: { type: type2, name: data, content: info },
|
||||||
item_data: {
|
item_data: {
|
||||||
@@ -72,19 +81,8 @@ export default class Marketplace extends React.PureComponent {
|
|||||||
updated: info.updated,
|
updated: info.updated,
|
||||||
version: info.data.version,
|
version: info.data.version,
|
||||||
icon: info.data.screenshot_url
|
icon: info.data.screenshot_url
|
||||||
}
|
},
|
||||||
});
|
button: button
|
||||||
|
|
||||||
let button = this.buttons.install;
|
|
||||||
|
|
||||||
const installed = JSON.parse(localStorage.getItem('installed'));
|
|
||||||
|
|
||||||
if (installed.some(item => item.name === data)) {
|
|
||||||
button = this.buttons.uninstall;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
button: button
|
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('marketplace').style.display = 'none';
|
document.getElementById('marketplace').style.display = 'none';
|
||||||
@@ -101,7 +99,7 @@ export default class Marketplace extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getItems() {
|
async getItems() {
|
||||||
const { data }= await (await fetch(Constants.MARKETPLACE_URL + '/all')).json();
|
const { data } = await (await fetch(Constants.MARKETPLACE_URL + '/all')).json();
|
||||||
const featured = await (await fetch(Constants.MARKETPLACE_URL + '/featured')).json();
|
const featured = await (await fetch(Constants.MARKETPLACE_URL + '/featured')).json();
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ export default class Greeting extends React.PureComponent {
|
|||||||
const data = localStorage.getItem('greetingName');
|
const data = localStorage.getItem('greetingName');
|
||||||
|
|
||||||
if (typeof data === 'string') {
|
if (typeof data === 'string') {
|
||||||
if (data.replace(/\s/g, '').length > 0) name = `, ${data.trim()}`;
|
if (data.replace(/\s/g, '').length > 0) {
|
||||||
|
name = `, ${data.trim()}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (custom === 'false') {
|
if (custom === 'false') {
|
||||||
|
|||||||
@@ -121,30 +121,12 @@ export default class Quote extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (localStorage.getItem('favouriteQuote')) {
|
this.setState({
|
||||||
this.setState({
|
favourited: localStorage.getItem('favouriteQuote') ? <StarIcon className='copyButton' onClick={() => this.favourite()} /> : null, // todo: fix (localStorage.getItem('favouriteQuoteEnabled') === 'false')
|
||||||
favourited: <StarIcon className='copyButton' onClick={() => this.favourite()} />
|
copy: (localStorage.getItem('copyButton') === 'false') ? null : this.state.copy,
|
||||||
});
|
tweet: (localStorage.getItem('tweetButton') === 'false') ? null: this.state.tweet
|
||||||
}
|
});
|
||||||
|
|
||||||
if (localStorage.getItem('favouriteQuoteEnabled') === 'false') {
|
|
||||||
this.setState({
|
|
||||||
favourited: null
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localStorage.getItem('copyButton') === 'false') {
|
|
||||||
this.setState({
|
|
||||||
copy: null
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localStorage.getItem('tweetButton') === 'false') {
|
|
||||||
this.setState({
|
|
||||||
tweet: null
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getQuote();
|
this.getQuote();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user