mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved js minification
This commit is contained in:
parent
8884adcb72
commit
b31bf3d7f5
16 changed files with 99 additions and 150 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import ko from 'External/Admin/ko';
|
import 'External/Admin/ko';
|
||||||
|
import ko from 'ko';
|
||||||
|
|
||||||
import { StorageResultType } from 'Common/Enums';
|
import { StorageResultType } from 'Common/Enums';
|
||||||
|
|
||||||
|
|
@ -93,9 +94,7 @@ class AdminApp extends AbstractApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
bootend() {
|
bootend() {
|
||||||
if (window.progressJs) {
|
progressJs.end();
|
||||||
progressJs.end();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstart() {
|
bootstart() {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import ko from 'External/User/ko'; // eslint-disable-line no-unused-vars
|
import 'External/User/ko';
|
||||||
|
|
||||||
import { pInt, pString } from 'Common/Utils';
|
import { pInt, pString } from 'Common/Utils';
|
||||||
import { isPosNumeric, delegateRunOnDestroy, mailToHelper } from 'Common/UtilsUser';
|
import { isPosNumeric, delegateRunOnDestroy, mailToHelper } from 'Common/UtilsUser';
|
||||||
|
|
@ -892,9 +892,7 @@ class AppUser extends AbstractApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
bootend() {
|
bootend() {
|
||||||
if (window.progressJs) {
|
progressJs.end();
|
||||||
progressJs.end();
|
|
||||||
}
|
|
||||||
this.hideLoading();
|
this.hideLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -911,9 +909,7 @@ class AppUser extends AbstractApp {
|
||||||
|
|
||||||
const startupUrl = pString(Settings.get('StartupUrl'));
|
const startupUrl = pString(Settings.get('StartupUrl'));
|
||||||
|
|
||||||
if (window.progressJs) {
|
progressJs.set(90);
|
||||||
progressJs.set(90);
|
|
||||||
}
|
|
||||||
|
|
||||||
rl.setWindowTitle();
|
rl.setWindowTitle();
|
||||||
if (Settings.get('Auth')) {
|
if (Settings.get('Auth')) {
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,6 @@ export const $htmlCL = $html.classList;
|
||||||
*/
|
*/
|
||||||
export const dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
export const dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
||||||
|
|
||||||
export const VIEW_MODELS = {
|
|
||||||
settings: [],
|
|
||||||
'settings-removed': [],
|
|
||||||
'settings-disabled': []
|
|
||||||
};
|
|
||||||
|
|
||||||
export const moveAction = ko.observable(false);
|
export const moveAction = ko.observable(false);
|
||||||
export const leftPanelDisabled = ko.observable(false);
|
export const leftPanelDisabled = ko.observable(false);
|
||||||
export const leftPanelType = ko.observable('');
|
export const leftPanelType = ko.observable('');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as Knoin from 'Knoin/Knoin';
|
import { settingsAddViewModel } from 'Screen/AbstractSettings';
|
||||||
|
|
||||||
const USER_VIEW_MODELS_HOOKS = [],
|
const USER_VIEW_MODELS_HOOKS = [],
|
||||||
ADMIN_VIEW_MODELS_HOOKS = [];
|
ADMIN_VIEW_MODELS_HOOKS = [];
|
||||||
|
|
@ -48,7 +48,7 @@ export function addSettingsViewModelForAdmin(SettingsViewModelClass, template, l
|
||||||
*/
|
*/
|
||||||
export function runSettingsViewModelHooks(admin) {
|
export function runSettingsViewModelHooks(admin) {
|
||||||
(admin ? ADMIN_VIEW_MODELS_HOOKS : USER_VIEW_MODELS_HOOKS).forEach(view => {
|
(admin ? ADMIN_VIEW_MODELS_HOOKS : USER_VIEW_MODELS_HOOKS).forEach(view => {
|
||||||
Knoin.settingsAddViewModel(view[0], view[1], view[2], view[3]);
|
settingsAddViewModel(view[0], view[1], view[2], view[3]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
5
dev/External/Admin/ko.js
vendored
5
dev/External/Admin/ko.js
vendored
|
|
@ -1,6 +1,7 @@
|
||||||
|
import 'External/ko';
|
||||||
|
import ko from 'ko';
|
||||||
import { SaveSettingsStep } from 'Common/Enums';
|
import { SaveSettingsStep } from 'Common/Enums';
|
||||||
import { pInt } from 'Common/Utils';
|
import { pInt } from 'Common/Utils';
|
||||||
import ko from 'External/ko';
|
|
||||||
|
|
||||||
ko.bindingHandlers.saveTrigger = {
|
ko.bindingHandlers.saveTrigger = {
|
||||||
init: (element) => {
|
init: (element) => {
|
||||||
|
|
@ -63,5 +64,3 @@ ko.extenders.posInterer = (target, defaultVal) => {
|
||||||
ko.observable.fn.idleTrigger = function() {
|
ko.observable.fn.idleTrigger = function() {
|
||||||
return this.extend({ 'idleTrigger': true });
|
return this.extend({ 'idleTrigger': true });
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ko;
|
|
||||||
|
|
|
||||||
5
dev/External/User/ko.js
vendored
5
dev/External/User/ko.js
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
import ko from 'External/ko';
|
import 'External/ko';
|
||||||
|
import ko from 'ko';
|
||||||
import { HtmlEditor } from 'Common/Html';
|
import { HtmlEditor } from 'Common/Html';
|
||||||
import { timeToNode } from 'Common/Momentor';
|
import { timeToNode } from 'Common/Momentor';
|
||||||
import { EmailModel } from 'Model/Email';
|
import { EmailModel } from 'Model/Email';
|
||||||
|
|
@ -287,5 +288,3 @@ ko.extenders.specialThrottle = (target, timeout) => {
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ko;
|
|
||||||
|
|
|
||||||
2
dev/External/ko.js
vendored
2
dev/External/ko.js
vendored
|
|
@ -273,5 +273,3 @@ ko.addComputablesTo = (target, computables) =>
|
||||||
|
|
||||||
ko.addSubscribablesTo = (target, subscribables) =>
|
ko.addSubscribablesTo = (target, subscribables) =>
|
||||||
Object.entries(subscribables).forEach(([key, fn]) => target[key].subscribe(fn));
|
Object.entries(subscribables).forEach(([key, fn]) => target[key].subscribe(fn));
|
||||||
|
|
||||||
export default ko;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { $htmlCL, VIEW_MODELS } from 'Common/Globals';
|
import { $htmlCL } from 'Common/Globals';
|
||||||
|
|
||||||
let currentScreen = null,
|
let currentScreen = null,
|
||||||
defaultScreenName = '',
|
defaultScreenName = '',
|
||||||
|
|
@ -50,25 +50,6 @@ export function createCommand(fExecute, fCanExecute = true) {
|
||||||
return fResult;
|
return fResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Function} SettingsViewModelClass
|
|
||||||
* @param {string} template
|
|
||||||
* @param {string} labelName
|
|
||||||
* @param {string} route
|
|
||||||
* @param {boolean=} isDefault = false
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
export function settingsAddViewModel(SettingsViewModelClass, template, labelName, route, isDefault = false) {
|
|
||||||
SettingsViewModelClass.__rlSettingsData = {
|
|
||||||
Label: labelName,
|
|
||||||
Template: template,
|
|
||||||
Route: route,
|
|
||||||
IsDefault: !!isDefault
|
|
||||||
};
|
|
||||||
|
|
||||||
VIEW_MODELS.settings.push(SettingsViewModelClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} screenName
|
* @param {string} screenName
|
||||||
* @returns {?Object}
|
* @returns {?Object}
|
||||||
|
|
@ -77,22 +58,13 @@ export function screen(screenName) {
|
||||||
return screenName && null != SCREENS[screenName] ? SCREENS[screenName] : null;
|
return screenName && null != SCREENS[screenName] ? SCREENS[screenName] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Function} ViewModelClassToShow
|
|
||||||
* @returns {Function|null}
|
|
||||||
*/
|
|
||||||
function getScreenPopup(PopuViewModelClass) {
|
|
||||||
return PopuViewModelClass ? PopuViewModelClass.default || PopuViewModelClass : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} ViewModelClassToHide
|
* @param {Function} ViewModelClassToHide
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function hideScreenPopup(ViewModelClassToHide) {
|
export function hideScreenPopup(ViewModelClassToHide) {
|
||||||
const ModalView = getScreenPopup(ViewModelClassToHide);
|
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom) {
|
||||||
if (ModalView && ModalView.__vm && ModalView.__dom) {
|
ViewModelClassToHide.__vm.modalVisibility(false);
|
||||||
ModalView.__vm.modalVisibility(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -184,8 +156,7 @@ function buildViewModel(ViewModelClass, vmScreen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getScreenPopupViewModel(ViewModelClassToShow) {
|
function getScreenPopupViewModel(ViewModelClassToShow) {
|
||||||
const ModalView = getScreenPopup(ViewModelClassToShow);
|
return (buildViewModel(ViewModelClassToShow) && ViewModelClassToShow.__dom) && ViewModelClassToShow.__vm;
|
||||||
return (buildViewModel(ModalView) && ModalView.__dom) && ModalView.__vm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -220,8 +191,7 @@ export function warmUpScreenPopup(ViewModelClassToShow) {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isPopupVisible(ViewModelClassToShow) {
|
export function isPopupVisible(ViewModelClassToShow) {
|
||||||
const ModalView = getScreenPopup(ViewModelClassToShow);
|
return ViewModelClassToShow && ViewModelClassToShow.__vm && ViewModelClassToShow.__vm.modalVisibility();
|
||||||
return ModalView && ModalView.__vm && ModalView.__vm.modalVisibility();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { VIEW_MODELS } from 'Common/Globals';
|
|
||||||
import { pString } from 'Common/Utils';
|
import { pString } from 'Common/Utils';
|
||||||
import { settings } from 'Common/Links';
|
import { settings } from 'Common/Links';
|
||||||
|
|
||||||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||||
|
|
||||||
|
const VIEW_MODELS = [];
|
||||||
|
|
||||||
export class AbstractSettingsScreen extends AbstractScreen {
|
export class AbstractSettingsScreen extends AbstractScreen {
|
||||||
/**
|
/**
|
||||||
* @param {Array} viewModels
|
* @param {Array} viewModels
|
||||||
|
|
@ -34,32 +35,11 @@ export class AbstractSettingsScreen extends AbstractScreen {
|
||||||
RoutedSettingsViewModel = null,
|
RoutedSettingsViewModel = null,
|
||||||
viewModelDom = null;
|
viewModelDom = null;
|
||||||
|
|
||||||
RoutedSettingsViewModel = VIEW_MODELS.settings.find(
|
RoutedSettingsViewModel = VIEW_MODELS.find(
|
||||||
SettingsViewModel =>
|
SettingsViewModel =>
|
||||||
SettingsViewModel && SettingsViewModel.__rlSettingsData && subName === SettingsViewModel.__rlSettingsData.Route
|
SettingsViewModel && SettingsViewModel.__rlSettingsData && subName === SettingsViewModel.__rlSettingsData.Route
|
||||||
);
|
);
|
||||||
|
|
||||||
if (RoutedSettingsViewModel) {
|
|
||||||
if (
|
|
||||||
VIEW_MODELS['settings-removed'].find(
|
|
||||||
DisabledSettingsViewModel =>
|
|
||||||
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
RoutedSettingsViewModel = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
RoutedSettingsViewModel &&
|
|
||||||
VIEW_MODELS['settings-disabled'].find(
|
|
||||||
DisabledSettingsViewModel =>
|
|
||||||
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
RoutedSettingsViewModel = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RoutedSettingsViewModel) {
|
if (RoutedSettingsViewModel) {
|
||||||
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm) {
|
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm) {
|
||||||
settingsScreen = RoutedSettingsViewModel.__vm;
|
settingsScreen = RoutedSettingsViewModel.__vm;
|
||||||
|
|
@ -139,28 +119,23 @@ export class AbstractSettingsScreen extends AbstractScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild() {
|
onBuild() {
|
||||||
VIEW_MODELS.settings.forEach(SettingsViewModel => {
|
VIEW_MODELS.forEach(SettingsViewModel => {
|
||||||
if (
|
if (
|
||||||
SettingsViewModel &&
|
SettingsViewModel &&
|
||||||
SettingsViewModel.__rlSettingsData &&
|
SettingsViewModel.__rlSettingsData
|
||||||
!VIEW_MODELS['settings-removed'].find(
|
|
||||||
RemoveSettingsViewModel => RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
this.menu.push({
|
this.menu.push({
|
||||||
route: SettingsViewModel.__rlSettingsData.Route,
|
route: SettingsViewModel.__rlSettingsData.Route,
|
||||||
label: SettingsViewModel.__rlSettingsData.Label,
|
label: SettingsViewModel.__rlSettingsData.Label,
|
||||||
selected: ko.observable(false),
|
selected: ko.observable(false),
|
||||||
disabled: !!VIEW_MODELS['settings-disabled'].find(
|
disabled: false
|
||||||
DisabledSettingsViewModel => DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
routes() {
|
routes() {
|
||||||
const DefaultViewModel = VIEW_MODELS.settings.find(
|
const DefaultViewModel = VIEW_MODELS.find(
|
||||||
SettingsViewModel =>
|
SettingsViewModel =>
|
||||||
SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault
|
SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault
|
||||||
),
|
),
|
||||||
|
|
@ -181,3 +156,22 @@ export class AbstractSettingsScreen extends AbstractScreen {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Function} SettingsViewModelClass
|
||||||
|
* @param {string} template
|
||||||
|
* @param {string} labelName
|
||||||
|
* @param {string} route
|
||||||
|
* @param {boolean=} isDefault = false
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
export function settingsAddViewModel(SettingsViewModelClass, template, labelName, route, isDefault = false) {
|
||||||
|
SettingsViewModelClass.__rlSettingsData = {
|
||||||
|
Label: labelName,
|
||||||
|
Template: template,
|
||||||
|
Route: route,
|
||||||
|
IsDefault: !!isDefault
|
||||||
|
};
|
||||||
|
|
||||||
|
VIEW_MODELS.push(SettingsViewModelClass);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { settingsAddViewModel } from 'Knoin/Knoin';
|
|
||||||
import { runSettingsViewModelHooks } from 'Common/Plugins';
|
import { runSettingsViewModelHooks } from 'Common/Plugins';
|
||||||
|
|
||||||
import { AbstractSettingsScreen } from 'Screen/AbstractSettings';
|
import { AbstractSettingsScreen, settingsAddViewModel } from 'Screen/AbstractSettings';
|
||||||
|
|
||||||
import { GeneralAdminSettings } from 'Settings/Admin/General';
|
import { GeneralAdminSettings } from 'Settings/Admin/General';
|
||||||
import { DomainsAdminSettings } from 'Settings/Admin/Domains';
|
import { DomainsAdminSettings } from 'Settings/Admin/Domains';
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@ import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
||||||
import AppStore from 'Stores/User/App';
|
import AppStore from 'Stores/User/App';
|
||||||
import AccountStore from 'Stores/User/Account';
|
import AccountStore from 'Stores/User/Account';
|
||||||
|
|
||||||
import { settingsAddViewModel } from 'Knoin/Knoin';
|
import { AbstractSettingsScreen, settingsAddViewModel } from 'Screen/AbstractSettings';
|
||||||
|
|
||||||
import { AbstractSettingsScreen } from 'Screen/AbstractSettings';
|
|
||||||
|
|
||||||
import { GeneralUserSettings } from 'Settings/User/General';
|
import { GeneralUserSettings } from 'Settings/User/General';
|
||||||
import { ContactsUserSettings } from 'Settings/User/Contacts';
|
import { ContactsUserSettings } from 'Settings/User/Contacts';
|
||||||
|
|
|
||||||
|
|
@ -20,17 +20,18 @@ export class SecurityUserSettings {
|
||||||
this.autoLogout = SettinsStore.autoLogout;
|
this.autoLogout = SettinsStore.autoLogout;
|
||||||
this.autoLogout.trigger = ko.observable(SaveSettingsStep.Idle);
|
this.autoLogout.trigger = ko.observable(SaveSettingsStep.Idle);
|
||||||
|
|
||||||
|
let i18nLogout = (key, params) => i18n('SETTINGS_SECURITY/AUTOLOGIN_' + key, params);
|
||||||
this.autoLogoutOptions = ko.computed(() => {
|
this.autoLogoutOptions = ko.computed(() => {
|
||||||
translatorTrigger();
|
translatorTrigger();
|
||||||
return [
|
return [
|
||||||
{ 'id': 0, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_NEVER_OPTION_NAME') },
|
{ 'id': 0, 'name': i18nLogout('NEVER_OPTION_NAME') },
|
||||||
{ 'id': 5, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 5 }) },
|
{ 'id': 5, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 5 }) },
|
||||||
{ 'id': 10, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 10 }) },
|
{ 'id': 10, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 10 }) },
|
||||||
{ 'id': 30, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 30 }) },
|
{ 'id': 30, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 30 }) },
|
||||||
{ 'id': 60, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 60 }) },
|
{ 'id': 60, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 60 }) },
|
||||||
{ 'id': 60 * 2, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', { 'HOURS': 2 }) },
|
{ 'id': 60 * 2, 'name': i18nLogout('HOURS_OPTION_NAME', { 'HOURS': 2 }) },
|
||||||
{ 'id': 60 * 5, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', { 'HOURS': 5 }) },
|
{ 'id': 60 * 5, 'name': i18nLogout('HOURS_OPTION_NAME', { 'HOURS': 5 }) },
|
||||||
{ 'id': 60 * 10, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', { 'HOURS': 10 }) }
|
{ 'id': 60 * 10, 'name': i18nLogout('HOURS_OPTION_NAME', { 'HOURS': 10 }) }
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,16 +25,17 @@ class AdvancedSearchPopupView extends AbstractViewPopup {
|
||||||
unseen: false
|
unseen: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let prefix = 'SEARCH/LABEL_ADV_DATE_';
|
||||||
this.selectedDates = ko.computed(() => {
|
this.selectedDates = ko.computed(() => {
|
||||||
translatorTrigger();
|
translatorTrigger();
|
||||||
return [
|
return [
|
||||||
{ id: -1, name: i18n('SEARCH/LABEL_ADV_DATE_ALL') },
|
{ id: -1, name: i18n(prefix + 'ALL') },
|
||||||
{ id: 3, name: i18n('SEARCH/LABEL_ADV_DATE_3_DAYS') },
|
{ id: 3, name: i18n(prefix + '3_DAYS') },
|
||||||
{ id: 7, name: i18n('SEARCH/LABEL_ADV_DATE_7_DAYS') },
|
{ id: 7, name: i18n(prefix + '7_DAYS') },
|
||||||
{ id: 30, name: i18n('SEARCH/LABEL_ADV_DATE_MONTH') },
|
{ id: 30, name: i18n(prefix + 'MONTH') },
|
||||||
{ id: 90, name: i18n('SEARCH/LABEL_ADV_DATE_3_MONTHS') },
|
{ id: 90, name: i18n(prefix + '3_MONTHS') },
|
||||||
{ id: 180, name: i18n('SEARCH/LABEL_ADV_DATE_6_MONTHS') },
|
{ id: 180, name: i18n(prefix + '6_MONTHS') },
|
||||||
{ id: 365, name: i18n('SEARCH/LABEL_ADV_DATE_YEAR') }
|
{ id: 365, name: i18n(prefix + 'YEAR') }
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,15 @@ import { EmailModel } from 'Model/Email';
|
||||||
import { command } from 'Knoin/Knoin';
|
import { command } from 'Knoin/Knoin';
|
||||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||||
|
|
||||||
const KEY_NAME_SUBSTR = -8;
|
const KEY_NAME_SUBSTR = -8,
|
||||||
|
i18nPGP = (key, params) => i18n('PGP_NOTIFICATIONS/' + key, params);
|
||||||
|
|
||||||
class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('ComposeOpenPgp');
|
super('ComposeOpenPgp');
|
||||||
|
|
||||||
this.publicKeysOptionsCaption = i18n('PGP_NOTIFICATIONS/ADD_A_PUBLICK_KEY');
|
this.publicKeysOptionsCaption = i18nPGP('ADD_A_PUBLICK_KEY');
|
||||||
this.privateKeysOptionsCaption = i18n('PGP_NOTIFICATIONS/SELECT_A_PRIVATE_KEY');
|
this.privateKeysOptionsCaption = i18nPGP('SELECT_A_PRIVATE_KEY');
|
||||||
|
|
||||||
this.addObservables({
|
this.addObservables({
|
||||||
notification: '',
|
notification: '',
|
||||||
|
|
@ -114,11 +115,11 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
||||||
|
|
||||||
if (result && this.sign()) {
|
if (result && this.sign()) {
|
||||||
if (!this.signKey()) {
|
if (!this.signKey()) {
|
||||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'));
|
this.notification(i18nPGP('NO_PRIVATE_KEY_FOUND'));
|
||||||
result = false;
|
result = false;
|
||||||
} else if (!this.signKey().key) {
|
} else if (!this.signKey().key) {
|
||||||
this.notification(
|
this.notification(
|
||||||
i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
|
i18nPGP('NO_PRIVATE_KEY_FOUND_FOR', {
|
||||||
'EMAIL': this.signKey().email
|
'EMAIL': this.signKey().email
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -139,7 +140,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!privateKey) {
|
if (!privateKey) {
|
||||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'));
|
this.notification(i18nPGP('NO_PRIVATE_KEY_FOUND'));
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +155,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
||||||
aPublicKeys = aPublicKeys.concat(oKey.key.getNativeKeys().flat(Infinity).filter(v => v));
|
aPublicKeys = aPublicKeys.concat(oKey.key.getNativeKeys().flat(Infinity).filter(v => v));
|
||||||
} else if (oKey && oKey.email) {
|
} else if (oKey && oKey.email) {
|
||||||
this.notification(
|
this.notification(
|
||||||
i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
|
i18nPGP('NO_PUBLIC_KEYS_FOUND_FOR', {
|
||||||
'EMAIL': oKey.email
|
'EMAIL': oKey.email
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -167,7 +168,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND'));
|
this.notification(i18nPGP('NO_PUBLIC_KEYS_FOUND'));
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +201,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
||||||
this.notification(
|
this.notification(
|
||||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
i18nPGP('PGP_ERROR', {
|
||||||
'ERROR': '' + e
|
'ERROR': '' + e
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -215,16 +216,14 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
this.notification(
|
this.notification(
|
||||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
i18nPGP('PGP_ERROR', {
|
||||||
'ERROR': '' + e
|
'ERROR': '' + e
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.notification(
|
this.notification(
|
||||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
i18nPGP('PGP_ERROR', {'ERROR': '' + e})
|
||||||
'ERROR': '' + e
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,19 +60,21 @@ class FilterPopupView extends AbstractViewPopup {
|
||||||
populateOptions() {
|
populateOptions() {
|
||||||
this.actionTypeOptions([]);
|
this.actionTypeOptions([]);
|
||||||
|
|
||||||
|
let i18nFilter = key => i18n('POPUPS_FILTER/SELECT_' + key);
|
||||||
|
|
||||||
this.fieldOptions([
|
this.fieldOptions([
|
||||||
{ 'id': FilterConditionField.From, 'name': i18n('GLOBAL/FROM') },
|
{ 'id': FilterConditionField.From, 'name': i18n('GLOBAL/FROM') },
|
||||||
{ 'id': FilterConditionField.Recipient, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS') },
|
{ 'id': FilterConditionField.Recipient, 'name': i18nFilter('FIELD_RECIPIENTS') },
|
||||||
{ 'id': FilterConditionField.Subject, 'name': i18n('GLOBAL/SUBJECT') },
|
{ 'id': FilterConditionField.Subject, 'name': i18n('GLOBAL/SUBJECT') },
|
||||||
{ 'id': FilterConditionField.Size, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_SIZE') },
|
{ 'id': FilterConditionField.Size, 'name': i18nFilter('FIELD_SIZE') },
|
||||||
{ 'id': FilterConditionField.Header, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_HEADER') }
|
{ 'id': FilterConditionField.Header, 'name': i18nFilter('FIELD_HEADER') }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.typeOptions([
|
this.typeOptions([
|
||||||
{ 'id': FilterConditionType.Contains, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS') },
|
{ 'id': FilterConditionType.Contains, 'name': i18nFilter('TYPE_CONTAINS') },
|
||||||
{ 'id': FilterConditionType.NotContains, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS') },
|
{ 'id': FilterConditionType.NotContains, 'name': i18nFilter('TYPE_NOT_CONTAINS') },
|
||||||
{ 'id': FilterConditionType.EqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO') },
|
{ 'id': FilterConditionType.EqualTo, 'name': i18nFilter('TYPE_EQUAL_TO') },
|
||||||
{ 'id': FilterConditionType.NotEqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO') }
|
{ 'id': FilterConditionType.NotEqualTo, 'name': i18nFilter('TYPE_NOT_EQUAL_TO') }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// this.actionTypeOptions.push({'id': FilterAction.None,
|
// this.actionTypeOptions.push({'id': FilterAction.None,
|
||||||
|
|
@ -86,27 +88,27 @@ class FilterPopupView extends AbstractViewPopup {
|
||||||
if (modules.includes('fileinto')) {
|
if (modules.includes('fileinto')) {
|
||||||
this.actionTypeOptions.push({
|
this.actionTypeOptions.push({
|
||||||
'id': FilterAction.MoveTo,
|
'id': FilterAction.MoveTo,
|
||||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')
|
'name': i18nFilter('ACTION_MOVE_TO')
|
||||||
});
|
});
|
||||||
this.actionTypeOptions.push({
|
this.actionTypeOptions.push({
|
||||||
'id': FilterAction.Forward,
|
'id': FilterAction.Forward,
|
||||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')
|
'name': i18nFilter('ACTION_FORWARD_TO')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modules.includes('reject')) {
|
if (modules.includes('reject')) {
|
||||||
this.actionTypeOptions.push({ 'id': FilterAction.Reject, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_REJECT') });
|
this.actionTypeOptions.push({ 'id': FilterAction.Reject, 'name': i18nFilter('ACTION_REJECT') });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modules.includes('vacation')) {
|
if (modules.includes('vacation')) {
|
||||||
this.actionTypeOptions.push({
|
this.actionTypeOptions.push({
|
||||||
'id': FilterAction.Vacation,
|
'id': FilterAction.Vacation,
|
||||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')
|
'name': i18nFilter('ACTION_VACATION_MESSAGE')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modules.includes('body')) {
|
if (modules.includes('body')) {
|
||||||
this.fieldOptions.push({ 'id': FilterConditionField.Body, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_BODY') });
|
this.fieldOptions.push({ 'id': FilterConditionField.Body, 'name': i18nFilter('FIELD_BODY') });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modules.includes('regex')) {
|
if (modules.includes('regex')) {
|
||||||
|
|
@ -114,16 +116,16 @@ class FilterPopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.actionTypeOptions.push({ 'id': FilterAction.Discard, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD') });
|
this.actionTypeOptions.push({ 'id': FilterAction.Discard, 'name': i18nFilter('ACTION_DISCARD') });
|
||||||
|
|
||||||
this.typeOptionsSize([
|
this.typeOptionsSize([
|
||||||
{ 'id': FilterConditionType.Over, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_OVER') },
|
{ 'id': FilterConditionType.Over, 'name': i18nFilter('TYPE_OVER') },
|
||||||
{ 'id': FilterConditionType.Under, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_UNDER') }
|
{ 'id': FilterConditionType.Under, 'name': i18nFilter('TYPE_UNDER') }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.typeOptionsBody([
|
this.typeOptionsBody([
|
||||||
{ 'id': FilterConditionType.Text, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_TEXT') },
|
{ 'id': FilterConditionType.Text, 'name': i18nFilter('TYPE_TEXT') },
|
||||||
{ 'id': FilterConditionType.Raw, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_RAW') }
|
{ 'id': FilterConditionType.Raw, 'name': i18nFilter('TYPE_RAW') }
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,22 +89,22 @@ class FolderSystemPopupView extends AbstractViewPopup {
|
||||||
* @param {number=} notificationType = SetSystemFoldersNotification.None
|
* @param {number=} notificationType = SetSystemFoldersNotification.None
|
||||||
*/
|
*/
|
||||||
onShow(notificationType = SetSystemFoldersNotification.None) {
|
onShow(notificationType = SetSystemFoldersNotification.None) {
|
||||||
let notification = '';
|
let notification = '', prefix = 'POPUPS_SYSTEM_FOLDERS/NOTIFICATION_';
|
||||||
switch (notificationType) {
|
switch (notificationType) {
|
||||||
case SetSystemFoldersNotification.Sent:
|
case SetSystemFoldersNotification.Sent:
|
||||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT');
|
notification = i18n(prefix + 'SENT');
|
||||||
break;
|
break;
|
||||||
case SetSystemFoldersNotification.Draft:
|
case SetSystemFoldersNotification.Draft:
|
||||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS');
|
notification = i18n(prefix + 'DRAFTS');
|
||||||
break;
|
break;
|
||||||
case SetSystemFoldersNotification.Spam:
|
case SetSystemFoldersNotification.Spam:
|
||||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM');
|
notification = i18n(prefix + 'SPAM');
|
||||||
break;
|
break;
|
||||||
case SetSystemFoldersNotification.Trash:
|
case SetSystemFoldersNotification.Trash:
|
||||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH');
|
notification = i18n(prefix + 'TRASH');
|
||||||
break;
|
break;
|
||||||
case SetSystemFoldersNotification.Archive:
|
case SetSystemFoldersNotification.Archive:
|
||||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE');
|
notification = i18n(prefix + 'ARCHIVE');
|
||||||
break;
|
break;
|
||||||
// no default
|
// no default
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue