mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
prettier --write
This commit is contained in:
parent
450528ff00
commit
8a0be3212d
164 changed files with 7053 additions and 9008 deletions
|
|
@ -1,22 +1,20 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {view, ViewType} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/User/About',
|
||||
type: ViewType.Center,
|
||||
templateID: 'About'
|
||||
})
|
||||
class AboutUserView extends AbstractViewNext
|
||||
{
|
||||
class AboutUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
}
|
||||
}
|
||||
|
||||
export {AboutUserView, AboutUserView as default};
|
||||
export { AboutUserView, AboutUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
|
@ -7,20 +6,19 @@ import AppStore from 'Stores/User/App';
|
|||
import AccountStore from 'Stores/User/Account';
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import {Capa, Magics, KeyState} from 'Common/Enums';
|
||||
import {trim, isUnd} from 'Common/Utils';
|
||||
import {settings} from 'Common/Links';
|
||||
import { Capa, Magics, KeyState } from 'Common/Enums';
|
||||
import { trim, isUnd } from 'Common/Utils';
|
||||
import { settings } from 'Common/Links';
|
||||
|
||||
import * as Events from 'Common/Events';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {showScreenPopup, setHash} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { showScreenPopup, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
class AbstractSystemDropDownUserView extends AbstractViewNext
|
||||
{
|
||||
class AbstractSystemDropDownUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -54,8 +52,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
accountClick(account, event) {
|
||||
if (account && event && !isUnd(event.which) && 1 === event.which)
|
||||
{
|
||||
if (account && event && !isUnd(event.which) && 1 === event.which) {
|
||||
AccountStore.accounts.loading(true);
|
||||
_.delay(() => AccountStore.accounts.loading(false), Magics.Time1s);
|
||||
}
|
||||
|
|
@ -68,23 +65,19 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
settingsClick() {
|
||||
if (Settings.capa(Capa.Settings))
|
||||
{
|
||||
if (Settings.capa(Capa.Settings)) {
|
||||
setHash(settings());
|
||||
}
|
||||
}
|
||||
|
||||
settingsHelp()
|
||||
{
|
||||
if (Settings.capa(Capa.Help))
|
||||
{
|
||||
settingsHelp() {
|
||||
if (Settings.capa(Capa.Help)) {
|
||||
showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
|
||||
}
|
||||
}
|
||||
|
||||
addAccountClick() {
|
||||
if (this.capaAdditionalAccounts())
|
||||
{
|
||||
if (this.capaAdditionalAccounts()) {
|
||||
showScreenPopup(require('View/Popup/Account'));
|
||||
}
|
||||
}
|
||||
|
|
@ -95,8 +88,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
|
||||
onBuild() {
|
||||
key('`', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
||||
if (this.viewModelVisibility())
|
||||
{
|
||||
if (this.viewModelVisibility()) {
|
||||
MessageStore.messageFullScreenMode(false);
|
||||
this.accountMenuDropdownTrigger(true);
|
||||
}
|
||||
|
|
@ -104,8 +96,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
|
||||
// shortcuts help
|
||||
key('shift+/', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
||||
if (this.viewModelVisibility())
|
||||
{
|
||||
if (this.viewModelVisibility()) {
|
||||
showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
|
||||
return false;
|
||||
}
|
||||
|
|
@ -114,4 +105,4 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {AbstractSystemDropDownUserView, AbstractSystemDropDownUserView as default};
|
||||
export { AbstractSystemDropDownUserView, AbstractSystemDropDownUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import window from 'window';
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
|
@ -12,14 +11,11 @@ import {
|
|||
Notification
|
||||
} from 'Common/Enums';
|
||||
|
||||
import {
|
||||
trim, inArray, pInt,
|
||||
convertLangName, triggerAutocompleteInputChange
|
||||
} from 'Common/Utils';
|
||||
import { trim, inArray, pInt, convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
|
||||
|
||||
import {$win} from 'Common/Globals';
|
||||
import {socialFacebook, socialGoogle, socialTwitter} from 'Common/Links';
|
||||
import {getNotification, getNotificationFromResponse, reload as translatorReload} from 'Common/Translator';
|
||||
import { $win } from 'Common/Globals';
|
||||
import { socialFacebook, socialGoogle, socialTwitter } from 'Common/Links';
|
||||
import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator';
|
||||
|
||||
import * as Plugins from 'Common/Plugins';
|
||||
|
||||
|
|
@ -31,18 +27,17 @@ import * as Local from 'Storage/Client';
|
|||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {view, command, ViewType, routeOff, showScreenPopup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, command, ViewType, routeOff, showScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: ['View/App/Login', 'View/User/Login'],
|
||||
type: ViewType.Center,
|
||||
templateID: 'Login'
|
||||
})
|
||||
class LoginUserView extends AbstractViewNext
|
||||
{
|
||||
class LoginUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -56,7 +51,7 @@ class LoginUserView extends AbstractViewNext
|
|||
|
||||
this.additionalCode = ko.observable('');
|
||||
this.additionalCode.error = ko.observable(false);
|
||||
this.additionalCode.errorAnimation = ko.observable(false).extend({falseTimeout: 500});
|
||||
this.additionalCode.errorAnimation = ko.observable(false).extend({ falseTimeout: 500 });
|
||||
this.additionalCode.focused = ko.observable(false);
|
||||
this.additionalCode.visibility = ko.observable(false);
|
||||
this.additionalCodeSignMe = ko.observable(false);
|
||||
|
|
@ -74,13 +69,15 @@ class LoginUserView extends AbstractViewNext
|
|||
this.emailError = ko.observable(false);
|
||||
this.passwordError = ko.observable(false);
|
||||
|
||||
this.emailErrorAnimation = ko.observable(false).extend({falseTimeout: 500});
|
||||
this.passwordErrorAnimation = ko.observable(false).extend({falseTimeout: 500});
|
||||
this.emailErrorAnimation = ko.observable(false).extend({ falseTimeout: 500 });
|
||||
this.passwordErrorAnimation = ko.observable(false).extend({ falseTimeout: 500 });
|
||||
|
||||
this.formHidden = ko.observable(false);
|
||||
|
||||
this.formError = ko.computed(
|
||||
() => this.emailErrorAnimation() || this.passwordErrorAnimation() ||
|
||||
() =>
|
||||
this.emailErrorAnimation() ||
|
||||
this.passwordErrorAnimation() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.errorAnimation())
|
||||
);
|
||||
|
||||
|
|
@ -122,8 +119,7 @@ class LoginUserView extends AbstractViewNext
|
|||
this.submitErrorAddidional = ko.observable('');
|
||||
|
||||
this.submitError.subscribe((value) => {
|
||||
if ('' === value)
|
||||
{
|
||||
if ('' === value) {
|
||||
this.submitErrorAddidional('');
|
||||
}
|
||||
});
|
||||
|
|
@ -136,9 +132,7 @@ class LoginUserView extends AbstractViewNext
|
|||
|
||||
this.bSendLanguage = false;
|
||||
|
||||
this.languageFullName = ko.computed(
|
||||
() => convertLangName(this.language())
|
||||
);
|
||||
this.languageFullName = ko.computed(() => convertLangName(this.language()));
|
||||
|
||||
this.signMeType = ko.observable(LoginSignMeType.Unused);
|
||||
|
||||
|
|
@ -146,9 +140,7 @@ class LoginUserView extends AbstractViewNext
|
|||
this.signMe(LoginSignMeType.DefaultOn === iValue);
|
||||
});
|
||||
|
||||
this.signMeVisibility = ko.computed(
|
||||
() => LoginSignMeType.Unused !== this.signMeType()
|
||||
);
|
||||
this.signMeVisibility = ko.computed(() => LoginSignMeType.Unused !== this.signMeType());
|
||||
|
||||
this.facebookLoginEnabled = ko.observable(false);
|
||||
this.googleLoginEnabled = ko.observable(false);
|
||||
|
|
@ -156,16 +148,14 @@ class LoginUserView extends AbstractViewNext
|
|||
this.twitterLoginEnabled = ko.observable(false);
|
||||
|
||||
this.socialLoginEnabled = ko.computed(() => {
|
||||
const
|
||||
bF = this.facebookLoginEnabled(),
|
||||
const bF = this.facebookLoginEnabled(),
|
||||
bG = this.googleLoginEnabled(),
|
||||
bT = this.twitterLoginEnabled();
|
||||
|
||||
return bF || bG || bT;
|
||||
});
|
||||
|
||||
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError())
|
||||
{
|
||||
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError()) {
|
||||
this.submitError(Settings.settingsGet('AdditionalLoginError'));
|
||||
}
|
||||
}
|
||||
|
|
@ -200,7 +190,6 @@ class LoginUserView extends AbstractViewNext
|
|||
|
||||
@command((self) => !self.submitRequest())
|
||||
submitCommand() {
|
||||
|
||||
triggerAutocompleteInputChange();
|
||||
|
||||
this.emailError(false);
|
||||
|
|
@ -209,17 +198,17 @@ class LoginUserView extends AbstractViewNext
|
|||
this.emailError('' === trim(this.email()));
|
||||
this.passwordError('' === trim(this.password()));
|
||||
|
||||
if (this.additionalCode.visibility())
|
||||
{
|
||||
if (this.additionalCode.visibility()) {
|
||||
this.additionalCode.error(false);
|
||||
this.additionalCode.error('' === trim(this.additionalCode()));
|
||||
}
|
||||
|
||||
if (this.emailError() || this.passwordError() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.error()))
|
||||
{
|
||||
switch (true)
|
||||
{
|
||||
if (
|
||||
this.emailError() ||
|
||||
this.passwordError() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.error())
|
||||
) {
|
||||
switch (true) {
|
||||
case this.emailError():
|
||||
this.emailFocus(true);
|
||||
break;
|
||||
|
|
@ -235,24 +224,19 @@ class LoginUserView extends AbstractViewNext
|
|||
return false;
|
||||
}
|
||||
|
||||
let
|
||||
pluginResultCode = 0,
|
||||
let pluginResultCode = 0,
|
||||
pluginResultMessage = '';
|
||||
|
||||
const
|
||||
fSubmitResult = (iResultCode, sResultMessage) => {
|
||||
pluginResultCode = iResultCode || 0;
|
||||
pluginResultMessage = sResultMessage || '';
|
||||
};
|
||||
const fSubmitResult = (iResultCode, sResultMessage) => {
|
||||
pluginResultCode = iResultCode || 0;
|
||||
pluginResultMessage = sResultMessage || '';
|
||||
};
|
||||
|
||||
Plugins.runHook('user-login-submit', [fSubmitResult]);
|
||||
if (0 < pluginResultCode)
|
||||
{
|
||||
if (0 < pluginResultCode) {
|
||||
this.submitError(getNotification(pluginResultCode));
|
||||
return false;
|
||||
}
|
||||
else if ('' !== pluginResultMessage)
|
||||
{
|
||||
} else if ('' !== pluginResultMessage) {
|
||||
this.submitError(pluginResultMessage);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -260,79 +244,57 @@ class LoginUserView extends AbstractViewNext
|
|||
this.submitRequest(true);
|
||||
$win.trigger('rl.tooltips.diactivate');
|
||||
|
||||
const
|
||||
fLoginRequest = (sLoginPassword) => {
|
||||
const fLoginRequest = (sLoginPassword) => {
|
||||
Remote.login(
|
||||
(sResult, oData) => {
|
||||
$win.trigger('rl.tooltips.diactivate');
|
||||
$win.trigger('rl.tooltips.activate');
|
||||
|
||||
Remote.login(
|
||||
(sResult, oData) => {
|
||||
|
||||
$win.trigger('rl.tooltips.diactivate');
|
||||
$win.trigger('rl.tooltips.activate');
|
||||
|
||||
if (StorageResultType.Success === sResult && oData && 'Login' === oData.Action)
|
||||
{
|
||||
if (oData.Result)
|
||||
{
|
||||
if (oData.TwoFactorAuth)
|
||||
{
|
||||
this.additionalCode('');
|
||||
this.additionalCode.visibility(true);
|
||||
this.submitRequest(false);
|
||||
|
||||
_.delay(() => this.additionalCode.focused(true), Magics.Time100ms);
|
||||
}
|
||||
else if (oData.Admin)
|
||||
{
|
||||
getApp().redirectToAdminPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
getApp().loginAndLogoutReload(false);
|
||||
}
|
||||
}
|
||||
else if (oData.ErrorCode)
|
||||
{
|
||||
if (StorageResultType.Success === sResult && oData && 'Login' === oData.Action) {
|
||||
if (oData.Result) {
|
||||
if (oData.TwoFactorAuth) {
|
||||
this.additionalCode('');
|
||||
this.additionalCode.visibility(true);
|
||||
this.submitRequest(false);
|
||||
if (-1 < inArray(oData.ErrorCode, [Notification.InvalidInputArgument]))
|
||||
{
|
||||
oData.ErrorCode = Notification.AuthError;
|
||||
}
|
||||
|
||||
this.submitError(getNotificationFromResponse(oData));
|
||||
|
||||
if ('' === this.submitError())
|
||||
{
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
else if (oData.ErrorMessageAdditional)
|
||||
{
|
||||
this.submitErrorAddidional(oData.ErrorMessageAdditional);
|
||||
}
|
||||
_.delay(() => this.additionalCode.focused(true), Magics.Time100ms);
|
||||
} else if (oData.Admin) {
|
||||
getApp().redirectToAdminPanel();
|
||||
} else {
|
||||
getApp().loginAndLogoutReload(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitRequest(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else if (oData.ErrorCode) {
|
||||
this.submitRequest(false);
|
||||
if (-1 < inArray(oData.ErrorCode, [Notification.InvalidInputArgument])) {
|
||||
oData.ErrorCode = Notification.AuthError;
|
||||
}
|
||||
|
||||
this.submitError(getNotificationFromResponse(oData));
|
||||
|
||||
if ('' === this.submitError()) {
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
} else if (oData.ErrorMessageAdditional) {
|
||||
this.submitErrorAddidional(oData.ErrorMessageAdditional);
|
||||
}
|
||||
} else {
|
||||
this.submitRequest(false);
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
} else {
|
||||
this.submitRequest(false);
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
},
|
||||
this.email(),
|
||||
'',
|
||||
sLoginPassword,
|
||||
!!this.signMe(),
|
||||
this.bSendLanguage ? this.language() : '',
|
||||
this.additionalCode.visibility() ? this.additionalCode() : '',
|
||||
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
|
||||
);
|
||||
|
||||
},
|
||||
this.email(),
|
||||
'',
|
||||
sLoginPassword,
|
||||
!!this.signMe(),
|
||||
this.bSendLanguage ? this.language() : '',
|
||||
this.additionalCode.visibility() ? this.additionalCode() : '',
|
||||
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
|
||||
);
|
||||
|
||||
Local.set(ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');
|
||||
|
||||
};
|
||||
Local.set(ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');
|
||||
};
|
||||
|
||||
fLoginRequest(this.password());
|
||||
|
||||
|
|
@ -348,20 +310,13 @@ class LoginUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if ('' !== this.email() && '' !== this.password())
|
||||
{
|
||||
if ('' !== this.email() && '' !== this.password()) {
|
||||
this.passwordFocus(true);
|
||||
}
|
||||
else if ('' === this.email())
|
||||
{
|
||||
} else if ('' === this.email()) {
|
||||
this.emailFocus(true);
|
||||
}
|
||||
else if ('' === this.password())
|
||||
{
|
||||
} else if ('' === this.password()) {
|
||||
this.passwordFocus(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.emailFocus(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -372,38 +327,36 @@ class LoginUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
const
|
||||
signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
|
||||
const signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
|
||||
signMe = (Settings.settingsGet('SignMe') || 'unused').toLowerCase(),
|
||||
jsHash = Settings.appSettingsGet('jsHash'),
|
||||
fSocial = (iErrorCode) => {
|
||||
iErrorCode = pInt(iErrorCode);
|
||||
if (0 === iErrorCode)
|
||||
{
|
||||
if (0 === iErrorCode) {
|
||||
this.submitRequest(true);
|
||||
getApp().loginAndLogoutReload(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.submitError(getNotification(iErrorCode));
|
||||
}
|
||||
};
|
||||
|
||||
this.facebookLoginEnabled(!!Settings.settingsGet('AllowFacebookSocial'));
|
||||
this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
|
||||
this.googleLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuth'));
|
||||
this.googleFastLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuthFast'));
|
||||
this.googleLoginEnabled(
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuth')
|
||||
);
|
||||
this.googleFastLoginEnabled(
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuthFast')
|
||||
);
|
||||
|
||||
switch (signMe)
|
||||
{
|
||||
switch (signMe) {
|
||||
case LoginSignMeTypeAsString.DefaultOff:
|
||||
case LoginSignMeTypeAsString.DefaultOn:
|
||||
this.signMeType(
|
||||
LoginSignMeTypeAsString.DefaultOn === signMe ? LoginSignMeType.DefaultOn : LoginSignMeType.DefaultOff
|
||||
);
|
||||
|
||||
this.signMeType(LoginSignMeTypeAsString.DefaultOn === signMe ?
|
||||
LoginSignMeType.DefaultOn : LoginSignMeType.DefaultOff);
|
||||
|
||||
switch (signMeLocal)
|
||||
{
|
||||
switch (signMeLocal) {
|
||||
case '-1-':
|
||||
this.signMeType(LoginSignMeType.DefaultOn);
|
||||
break;
|
||||
|
|
@ -423,36 +376,32 @@ class LoginUserView extends AbstractViewNext
|
|||
this.email(AppStore.devEmail);
|
||||
this.password(AppStore.devPassword);
|
||||
|
||||
if (this.googleLoginEnabled() || this.googleFastLoginEnabled())
|
||||
{
|
||||
if (this.googleLoginEnabled() || this.googleFastLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_google_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.facebookLoginEnabled())
|
||||
{
|
||||
if (this.facebookLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_facebook_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.twitterLoginEnabled())
|
||||
{
|
||||
if (this.twitterLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_twitter_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
_.delay(() => {
|
||||
|
||||
LanguageStore.language.subscribe((value) => {
|
||||
|
||||
this.langRequest(true);
|
||||
|
||||
translatorReload(false, value).then(() => {
|
||||
this.langRequest(false);
|
||||
this.bSendLanguage = true;
|
||||
}, () => {
|
||||
this.langRequest(false);
|
||||
});
|
||||
|
||||
translatorReload(false, value).then(
|
||||
() => {
|
||||
this.langRequest(false);
|
||||
this.bSendLanguage = true;
|
||||
},
|
||||
() => {
|
||||
this.langRequest(false);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
}, Magics.Time50ms);
|
||||
|
||||
triggerAutocompleteInputChange(true);
|
||||
|
|
@ -463,14 +412,11 @@ class LoginUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
selectLanguage() {
|
||||
showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
showScreenPopup(require('View/Popup/Languages'), [this.language, this.languages(), LanguageStore.userLanguage()]);
|
||||
}
|
||||
|
||||
selectLanguageOnTab(bShift) {
|
||||
if (!bShift)
|
||||
{
|
||||
if (!bShift) {
|
||||
_.delay(() => {
|
||||
this.emailFocus(true);
|
||||
}, Magics.Time50ms);
|
||||
|
|
@ -482,4 +428,4 @@ class LoginUserView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {LoginUserView, LoginUserView as default};
|
||||
export { LoginUserView, LoginUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
import window from 'window';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import {trim, isNormal, isArray, windowResize} from 'Common/Utils';
|
||||
import {Capa, Focused, Layout, KeyState, EventKeyCode, Magics} from 'Common/Enums';
|
||||
import {$html, leftPanelDisabled, moveAction} from 'Common/Globals';
|
||||
import {mailBox, settings} from 'Common/Links';
|
||||
import {setFolderHash} from 'Common/Cache';
|
||||
import { trim, isNormal, isArray, windowResize } from 'Common/Utils';
|
||||
import { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
|
||||
import { $html, leftPanelDisabled, moveAction } from 'Common/Globals';
|
||||
import { mailBox, settings } from 'Common/Links';
|
||||
import { setFolderHash } from 'Common/Cache';
|
||||
|
||||
import AppStore from 'Stores/User/App';
|
||||
import SettingsStore from 'Stores/User/Settings';
|
||||
|
|
@ -17,18 +16,17 @@ import MessageStore from 'Stores/User/Message';
|
|||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {view, ViewType, showScreenPopup, setHash} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/User/MailBox/FolderList',
|
||||
type: ViewType.Left,
|
||||
templateID: 'MailFolderList'
|
||||
})
|
||||
class FolderListMailBoxUserView extends AbstractViewNext
|
||||
{
|
||||
class FolderListMailBoxUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -57,40 +55,34 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
this.folderListFocused = ko.computed(() => Focused.FolderList === AppStore.focusedState());
|
||||
|
||||
this.isInboxStarred = ko.computed(
|
||||
() => FolderStore.currentFolder() &&
|
||||
() =>
|
||||
FolderStore.currentFolder() &&
|
||||
FolderStore.currentFolder().isInbox() &&
|
||||
-1 < trim(MessageStore.messageListSearch()).indexOf('is:flagged')
|
||||
);
|
||||
}
|
||||
|
||||
onBuild(dom) {
|
||||
|
||||
this.oContentVisible = $('.b-content', dom);
|
||||
this.oContentScrollable = $('.content', this.oContentVisible);
|
||||
|
||||
const
|
||||
self = this,
|
||||
const self = this,
|
||||
isMobile = Settings.appSettingsGet('mobile'),
|
||||
fSelectFolder = (el, event, starred) => {
|
||||
|
||||
const isMove = moveAction();
|
||||
if (isMobile)
|
||||
{
|
||||
if (isMobile) {
|
||||
leftPanelDisabled(true);
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (starred)
|
||||
{
|
||||
if (starred) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
const folder = ko.dataFor(el);
|
||||
if (folder)
|
||||
{
|
||||
if (isMove)
|
||||
{
|
||||
if (folder) {
|
||||
if (isMove) {
|
||||
moveAction(false);
|
||||
getApp().moveMessagesToFolder(
|
||||
FolderStore.currentFolderFullNameRaw(),
|
||||
|
|
@ -98,25 +90,18 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
folder.fullNameRaw,
|
||||
false
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Layout.NoPreview === SettingsStore.layout())
|
||||
{
|
||||
} else {
|
||||
if (Layout.NoPreview === SettingsStore.layout()) {
|
||||
MessageStore.message(null);
|
||||
}
|
||||
|
||||
if (folder.fullNameRaw === FolderStore.currentFolderFullNameRaw())
|
||||
{
|
||||
if (folder.fullNameRaw === FolderStore.currentFolderFullNameRaw()) {
|
||||
setFolderHash(folder.fullNameRaw, '');
|
||||
}
|
||||
|
||||
if (starred)
|
||||
{
|
||||
if (starred) {
|
||||
setHash(mailBox(folder.fullNameHash, 1, 'is:flagged'));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setHash(mailBox(folder.fullNameHash));
|
||||
}
|
||||
}
|
||||
|
|
@ -126,10 +111,10 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
};
|
||||
|
||||
dom
|
||||
.on('click', '.b-folders .e-item .e-link .e-collapsed-sign', function(event) { // eslint-disable-line prefer-arrow-callback
|
||||
.on('click', '.b-folders .e-item .e-link .e-collapsed-sign', function(event) {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
const folder = ko.dataFor(this); // eslint-disable-line no-invalid-this
|
||||
if (folder && event)
|
||||
{
|
||||
if (folder && event) {
|
||||
const collapsed = folder.collapsed();
|
||||
getApp().setExpandedFolder(folder.fullNameHash, collapsed);
|
||||
|
||||
|
|
@ -138,33 +123,28 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
.on('click', '.b-folders .e-item .e-link.selectable .inbox-star-icon', function(event) { // eslint-disable-line prefer-arrow-callback
|
||||
.on('click', '.b-folders .e-item .e-link.selectable .inbox-star-icon', function(event) {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
fSelectFolder(this, event, !self.isInboxStarred()); // eslint-disable-line no-invalid-this
|
||||
})
|
||||
.on('click', '.b-folders .e-item .e-link.selectable', function(event) { // eslint-disable-line prefer-arrow-callback
|
||||
.on('click', '.b-folders .e-item .e-link.selectable', function(event) {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
fSelectFolder(this, event, false); // eslint-disable-line no-invalid-this
|
||||
});
|
||||
|
||||
key('up, down', KeyState.FolderList, (event, handler) => {
|
||||
|
||||
const
|
||||
keyCode = handler && 'up' === handler.shortcut ? EventKeyCode.Up : EventKeyCode.Down,
|
||||
const keyCode = handler && 'up' === handler.shortcut ? EventKeyCode.Up : EventKeyCode.Down,
|
||||
$items = $('.b-folders .e-item .e-link:not(.hidden):visible', dom);
|
||||
|
||||
if (event && $items.length)
|
||||
{
|
||||
if (event && $items.length) {
|
||||
let index = $items.index($items.filter('.focused'));
|
||||
if (-1 < index)
|
||||
{
|
||||
if (-1 < index) {
|
||||
$items.eq(index).removeClass('focused');
|
||||
}
|
||||
|
||||
if (EventKeyCode.Up === keyCode && 0 < index)
|
||||
{
|
||||
if (EventKeyCode.Up === keyCode && 0 < index) {
|
||||
index -= 1;
|
||||
}
|
||||
else if (EventKeyCode.Down === keyCode && index < $items.length - 1)
|
||||
{
|
||||
} else if (EventKeyCode.Down === keyCode && index < $items.length - 1) {
|
||||
index += 1;
|
||||
}
|
||||
|
||||
|
|
@ -177,8 +157,7 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
|
||||
key('enter', KeyState.FolderList, () => {
|
||||
const $items = $('.b-folders .e-item .e-link:not(.hidden).focused', dom);
|
||||
if ($items.length && $items[0])
|
||||
{
|
||||
if ($items.length && $items[0]) {
|
||||
AppStore.focusedState(Focused.MessageList);
|
||||
$items.click();
|
||||
}
|
||||
|
|
@ -188,11 +167,9 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
|
||||
key('space', KeyState.FolderList, () => {
|
||||
const $items = $('.b-folders .e-item .e-link:not(.hidden).focused', dom);
|
||||
if ($items.length && $items[0])
|
||||
{
|
||||
if ($items.length && $items[0]) {
|
||||
const folder = ko.dataFor($items[0]);
|
||||
if (folder)
|
||||
{
|
||||
if (folder) {
|
||||
const collapsed = folder.collapsed();
|
||||
getApp().setExpandedFolder(folder.fullNameHash, collapsed);
|
||||
folder.collapsed(!collapsed);
|
||||
|
|
@ -210,8 +187,7 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
|
||||
AppStore.focusedState.subscribe((value) => {
|
||||
$('.b-folders .e-item .e-link.focused', dom).removeClass('focused');
|
||||
if (Focused.FolderList === value)
|
||||
{
|
||||
if (Focused.FolderList === value) {
|
||||
$('.b-folders .e-item .e-link.selected', dom).addClass('focused');
|
||||
}
|
||||
});
|
||||
|
|
@ -219,8 +195,7 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
|
||||
messagesDropOver(folder) {
|
||||
window.clearTimeout(this.iDropOverTimer);
|
||||
if (folder && folder.collapsed())
|
||||
{
|
||||
if (folder && folder.collapsed()) {
|
||||
this.iDropOverTimer = window.setTimeout(() => {
|
||||
folder.collapsed(false);
|
||||
getApp().setExpandedFolder(folder.fullNameHash, true);
|
||||
|
|
@ -234,27 +209,23 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
scrollToFocused() {
|
||||
if (!this.oContentVisible || !this.oContentScrollable)
|
||||
{
|
||||
if (!this.oContentVisible || !this.oContentScrollable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const
|
||||
offset = 20,
|
||||
const offset = 20,
|
||||
focused = $('.e-item .e-link.focused', this.oContentScrollable),
|
||||
pos = focused.position(),
|
||||
visibleHeight = this.oContentVisible.height(),
|
||||
focusedHeight = focused.outerHeight();
|
||||
|
||||
if (pos && (0 > pos.top || pos.top + focusedHeight > visibleHeight))
|
||||
{
|
||||
if (0 > pos.top)
|
||||
{
|
||||
if (pos && (0 > pos.top || pos.top + focusedHeight > visibleHeight)) {
|
||||
if (0 > pos.top) {
|
||||
this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + pos.top - offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + pos.top - visibleHeight + focusedHeight + offset);
|
||||
} else {
|
||||
this.oContentScrollable.scrollTop(
|
||||
this.oContentScrollable.scrollTop() + pos.top - visibleHeight + focusedHeight + offset
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -269,23 +240,19 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
* @returns {void}
|
||||
*/
|
||||
messagesDrop(toFolder, ui) {
|
||||
if (toFolder && ui && ui.helper)
|
||||
{
|
||||
const
|
||||
fromFolderFullNameRaw = ui.helper.data('rl-folder'),
|
||||
if (toFolder && ui && ui.helper) {
|
||||
const fromFolderFullNameRaw = ui.helper.data('rl-folder'),
|
||||
copy = $html.hasClass('rl-ctrl-key-pressed'),
|
||||
uids = ui.helper.data('rl-uids');
|
||||
|
||||
if (isNormal(fromFolderFullNameRaw) && '' !== fromFolderFullNameRaw && isArray(uids))
|
||||
{
|
||||
if (isNormal(fromFolderFullNameRaw) && '' !== fromFolderFullNameRaw && isArray(uids)) {
|
||||
getApp().moveMessagesToFolder(fromFolderFullNameRaw, uids, toFolder.fullNameRaw, copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
composeClick() {
|
||||
if (Settings.capa(Capa.Composer))
|
||||
{
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
showScreenPopup(require('View/Popup/Compose'));
|
||||
}
|
||||
}
|
||||
|
|
@ -299,11 +266,10 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
contactsClick() {
|
||||
if (this.allowContacts)
|
||||
{
|
||||
if (this.allowContacts) {
|
||||
showScreenPopup(require('View/Popup/Contacts'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {FolderListMailBoxUserView, FolderListMailBoxUserView as default};
|
||||
export { FolderListMailBoxUserView, FolderListMailBoxUserView as default };
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
import {view, ViewType} from 'Knoin/Knoin';
|
||||
import {AbstractSystemDropDownUserView} from 'View/User/AbstractSystemDropDown';
|
||||
import { view, ViewType } from 'Knoin/Knoin';
|
||||
import { AbstractSystemDropDownUserView } from 'View/User/AbstractSystemDropDown';
|
||||
|
||||
@view({
|
||||
name: 'View/User/MailBox/SystemDropDown',
|
||||
|
|
@ -9,4 +8,4 @@ import {AbstractSystemDropDownUserView} from 'View/User/AbstractSystemDropDown';
|
|||
})
|
||||
class SystemDropDownMailBoxUserView extends AbstractSystemDropDownUserView {}
|
||||
|
||||
export {SystemDropDownMailBoxUserView, SystemDropDownMailBoxUserView as default};
|
||||
export { SystemDropDownMailBoxUserView, SystemDropDownMailBoxUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
|
||||
import $ from '$';
|
||||
import key from 'key';
|
||||
|
||||
import {KeyState} from 'Common/Enums';
|
||||
import {leftPanelDisabled} from 'Common/Globals';
|
||||
import {settings, inbox} from 'Common/Links';
|
||||
import {getFolderInboxName} from 'Common/Cache';
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { leftPanelDisabled } from 'Common/Globals';
|
||||
import { settings, inbox } from 'Common/Links';
|
||||
import { getFolderInboxName } from 'Common/Cache';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {view, ViewType, setHash, settingsMenuKeysHandler} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType, setHash, settingsMenuKeysHandler } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/User/Settings/Menu',
|
||||
type: ViewType.Left,
|
||||
templateID: 'SettingsMenu'
|
||||
})
|
||||
class MenuSettingsUserView extends AbstractViewNext
|
||||
{
|
||||
class MenuSettingsUserView extends AbstractViewNext {
|
||||
/**
|
||||
* @param {Object} screen
|
||||
*/
|
||||
|
|
@ -33,8 +31,7 @@ class MenuSettingsUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onBuild(dom) {
|
||||
if (this.mobile)
|
||||
{
|
||||
if (this.mobile) {
|
||||
dom.on('click', '.b-settings-menu .e-item.selectable', () => {
|
||||
leftPanelDisabled(true);
|
||||
});
|
||||
|
|
@ -52,4 +49,4 @@ class MenuSettingsUserView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {MenuSettingsUserView, MenuSettingsUserView as default};
|
||||
export { MenuSettingsUserView, MenuSettingsUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
|
||||
import {inbox} from 'Common/Links';
|
||||
import {getFolderInboxName} from 'Common/Cache';
|
||||
import {leftPanelDisabled} from 'Common/Globals';
|
||||
import { inbox } from 'Common/Links';
|
||||
import { getFolderInboxName } from 'Common/Cache';
|
||||
import { leftPanelDisabled } from 'Common/Globals';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import {view, ViewType, setHash} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/User/Settings/Pane',
|
||||
type: ViewType.Right,
|
||||
templateID: 'SettingsPane'
|
||||
})
|
||||
class PaneSettingsUserView extends AbstractViewNext
|
||||
{
|
||||
class PaneSettingsUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -44,8 +42,7 @@ class PaneSettingsUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onBuild(dom) {
|
||||
if (this.mobile)
|
||||
{
|
||||
if (this.mobile) {
|
||||
dom.on('click', () => {
|
||||
leftPanelDisabled(true);
|
||||
});
|
||||
|
|
@ -57,4 +54,4 @@ class PaneSettingsUserView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {PaneSettingsUserView, PaneSettingsUserView as default};
|
||||
export { PaneSettingsUserView, PaneSettingsUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
import {view, ViewType} from 'Knoin/Knoin';
|
||||
import {AbstractSystemDropDownUserView} from 'View/User/AbstractSystemDropDown';
|
||||
import { view, ViewType } from 'Knoin/Knoin';
|
||||
import { AbstractSystemDropDownUserView } from 'View/User/AbstractSystemDropDown';
|
||||
|
||||
@view({
|
||||
name: 'View/User/Settings/SystemDropDown',
|
||||
|
|
@ -9,4 +8,4 @@ import {AbstractSystemDropDownUserView} from 'View/User/AbstractSystemDropDown';
|
|||
})
|
||||
class SystemDropDownSettingsUserView extends AbstractSystemDropDownUserView {}
|
||||
|
||||
export {SystemDropDownSettingsUserView, SystemDropDownSettingsUserView as default};
|
||||
export { SystemDropDownSettingsUserView, SystemDropDownSettingsUserView as default };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue