mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 22:17:03 +03:00
prettier --write
This commit is contained in:
parent
450528ff00
commit
8a0be3212d
164 changed files with 7053 additions and 9008 deletions
|
|
@ -1,23 +1,21 @@
|
|||
|
||||
import _ from '_';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
|
||||
import Jua from 'Jua';
|
||||
|
||||
import {SaveSettingsStep, UploadErrorCode, Capa, Magics} from 'Common/Enums';
|
||||
import {changeTheme, convertThemeName} from 'Common/Utils';
|
||||
import {userBackground, themePreviewLink, uploadBackground} from 'Common/Links';
|
||||
import {i18n} from 'Common/Translator';
|
||||
import { SaveSettingsStep, UploadErrorCode, Capa, Magics } from 'Common/Enums';
|
||||
import { changeTheme, convertThemeName } from 'Common/Utils';
|
||||
import { userBackground, themePreviewLink, uploadBackground } from 'Common/Links';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
||||
import {capa} from 'Storage/Settings';
|
||||
import { capa } from 'Storage/Settings';
|
||||
|
||||
import ThemeStore from 'Stores/Theme';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
class ThemesUserSettings
|
||||
{
|
||||
class ThemesUserSettings {
|
||||
constructor() {
|
||||
this.theme = ThemeStore.theme;
|
||||
this.themes = ThemeStore.themes;
|
||||
|
|
@ -32,7 +30,7 @@ class ThemesUserSettings
|
|||
|
||||
this.capaUserBackground = ko.observable(capa(Capa.UserBackground));
|
||||
|
||||
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({throttle: Magics.Time100ms});
|
||||
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: Magics.Time100ms });
|
||||
|
||||
this.iTimer = 0;
|
||||
this.oThemeAjaxRequest = null;
|
||||
|
|
@ -51,18 +49,19 @@ class ThemesUserSettings
|
|||
|
||||
this.background.hash.subscribe((value) => {
|
||||
const $bg = $('#rl-bg');
|
||||
if (!value)
|
||||
{
|
||||
if ($bg.data('backstretch'))
|
||||
{
|
||||
if (!value) {
|
||||
if ($bg.data('backstretch')) {
|
||||
$bg.backstretch('destroy').attr('style', '');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$bg.attr('style', 'background-image: none !important;').backstretch(userBackground(value), {
|
||||
fade: Magics.Time1s, centeredX: true, centeredY: true
|
||||
}).removeAttr('style');
|
||||
} else {
|
||||
$bg
|
||||
.attr('style', 'background-image: none !important;')
|
||||
.backstretch(userBackground(value), {
|
||||
fade: Magics.Time1s,
|
||||
centeredX: true,
|
||||
centeredY: true
|
||||
})
|
||||
.removeAttr('style');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -70,12 +69,14 @@ class ThemesUserSettings
|
|||
onBuild() {
|
||||
const currentTheme = this.theme();
|
||||
|
||||
this.themesObjects(_.map(this.themes(), (theme) => ({
|
||||
name: theme,
|
||||
nameDisplay: convertThemeName(theme),
|
||||
selected: ko.observable(theme === currentTheme),
|
||||
themePreviewSrc: themePreviewLink(theme)
|
||||
})));
|
||||
this.themesObjects(
|
||||
_.map(this.themes(), (theme) => ({
|
||||
name: theme,
|
||||
nameDisplay: convertThemeName(theme),
|
||||
selected: ko.observable(theme === currentTheme),
|
||||
themePreviewSrc: themePreviewLink(theme)
|
||||
}))
|
||||
);
|
||||
|
||||
this.initUploader();
|
||||
}
|
||||
|
|
@ -85,8 +86,7 @@ class ThemesUserSettings
|
|||
}
|
||||
|
||||
clearBackground() {
|
||||
if (this.capaUserBackground())
|
||||
{
|
||||
if (this.capaUserBackground()) {
|
||||
Remote.clearUserBackground(() => {
|
||||
this.background.name('');
|
||||
this.background.hash('');
|
||||
|
|
@ -95,18 +95,16 @@ class ThemesUserSettings
|
|||
}
|
||||
|
||||
initUploader() {
|
||||
if (this.background.uploaderButton() && this.capaUserBackground())
|
||||
{
|
||||
const
|
||||
oJua = new Jua({
|
||||
'action': uploadBackground(),
|
||||
'name': 'uploader',
|
||||
'queueSize': 1,
|
||||
'multipleSizeLimit': 1,
|
||||
'disableDragAndDrop': true,
|
||||
'disableMultiple': true,
|
||||
'clickElement': this.background.uploaderButton()
|
||||
});
|
||||
if (this.background.uploaderButton() && this.capaUserBackground()) {
|
||||
const oJua = new Jua({
|
||||
'action': uploadBackground(),
|
||||
'name': 'uploader',
|
||||
'queueSize': 1,
|
||||
'multipleSizeLimit': 1,
|
||||
'disableDragAndDrop': true,
|
||||
'disableMultiple': true,
|
||||
'clickElement': this.background.uploaderButton()
|
||||
});
|
||||
|
||||
oJua
|
||||
.on('onStart', () => {
|
||||
|
|
@ -117,21 +115,16 @@ class ThemesUserSettings
|
|||
.on('onComplete', (id, result, data) => {
|
||||
this.background.loading(false);
|
||||
|
||||
if (result && id && data && data.Result && data.Result.Name && data.Result.Hash)
|
||||
{
|
||||
if (result && id && data && data.Result && data.Result.Name && data.Result.Hash) {
|
||||
this.background.name(data.Result.Name);
|
||||
this.background.hash(data.Result.Hash);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.background.name('');
|
||||
this.background.hash('');
|
||||
|
||||
let errorMsg = '';
|
||||
if (data.ErrorCode)
|
||||
{
|
||||
switch (data.ErrorCode)
|
||||
{
|
||||
if (data.ErrorCode) {
|
||||
switch (data.ErrorCode) {
|
||||
case UploadErrorCode.FileIsTooBig:
|
||||
errorMsg = i18n('SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG');
|
||||
break;
|
||||
|
|
@ -142,8 +135,7 @@ class ThemesUserSettings
|
|||
}
|
||||
}
|
||||
|
||||
if (!errorMsg && data.ErrorMessage)
|
||||
{
|
||||
if (!errorMsg && data.ErrorMessage) {
|
||||
errorMsg = data.ErrorMessage;
|
||||
}
|
||||
|
||||
|
|
@ -156,4 +148,4 @@ class ThemesUserSettings
|
|||
}
|
||||
}
|
||||
|
||||
export {ThemesUserSettings, ThemesUserSettings as default};
|
||||
export { ThemesUserSettings, ThemesUserSettings as default };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue