mirror of
https://github.com/mue/mue.git
synced 2026-07-22 08:17:28 +02:00
feat: add work in progress 7.0 code
Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
@@ -9,14 +9,18 @@ export default class Maximise extends PureComponent {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
hidden: false
|
||||
hidden: false,
|
||||
};
|
||||
}
|
||||
|
||||
setAttribute(blur, brightness, filter) {
|
||||
// don't attempt to modify the background if it isn't an image
|
||||
const backgroundType = localStorage.getItem('backgroundType');
|
||||
if (backgroundType === 'colour' || backgroundType === 'random_colour' || backgroundType === 'random_gradient') {
|
||||
if (
|
||||
backgroundType === 'colour' ||
|
||||
backgroundType === 'random_colour' ||
|
||||
backgroundType === 'random_gradient'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,36 +33,51 @@ export default class Maximise extends PureComponent {
|
||||
|
||||
element.setAttribute(
|
||||
'style',
|
||||
`background-image: url(${element.style.backgroundImage.replace('url("', '').replace('")', '')}); -webkit-filter: blur(${blur}px) brightness(${brightness}%) ${backgroundFilter ? backgroundFilter + '(' + localStorage.getItem('backgroundFilterAmount') + '%)' : ''};`
|
||||
`background-image: url(${element.style.backgroundImage
|
||||
.replace('url("', '')
|
||||
.replace('")', '')}); -webkit-filter: blur(${blur}px) brightness(${brightness}%) ${
|
||||
backgroundFilter
|
||||
? backgroundFilter + '(' + localStorage.getItem('backgroundFilterAmount') + '%)'
|
||||
: ''
|
||||
};`,
|
||||
);
|
||||
}
|
||||
|
||||
maximise = () => {
|
||||
// hide widgets
|
||||
const widgets = document.getElementById('widgets');
|
||||
(this.state.hidden === false) ? widgets.style.display = 'none' : widgets.style.display = 'block';
|
||||
this.state.hidden === false
|
||||
? (widgets.style.display = 'none')
|
||||
: (widgets.style.display = 'flex');
|
||||
|
||||
if (this.state.hidden === false) {
|
||||
this.setState({
|
||||
hidden: true
|
||||
hidden: true,
|
||||
});
|
||||
|
||||
this.setAttribute(0, 100);
|
||||
variables.stats.postEvent('feature', 'Background maximise');
|
||||
} else {
|
||||
this.setState({
|
||||
hidden: false
|
||||
hidden: false,
|
||||
});
|
||||
|
||||
this.setAttribute(localStorage.getItem('blur'), localStorage.getItem('brightness'), true);
|
||||
variables.stats.postEvent('feature', 'Background unmaximise');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Tooltip title={variables.language.getMessage(variables.languagecode, 'modals.main.settings.sections.background.buttons.view')}>
|
||||
<MdCropFree onClick={this.maximise} className='topicons' />
|
||||
<Tooltip
|
||||
title={variables.language.getMessage(
|
||||
variables.languagecode,
|
||||
'modals.main.settings.sections.background.buttons.view',
|
||||
)}
|
||||
>
|
||||
<button>
|
||||
<MdCropFree onClick={this.maximise} className="topicons" />
|
||||
</button>
|
||||
{/*variables.keybinds.maximiseBackground && variables.keybinds.maximiseBackground !== '' ? <Hotkeys keyName={variables.keybinds.maximiseBackground} onKeyDown={this.maximise} /> : null*/}
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user