mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Made eslint using 'browser' environment and added globals, because RainLoop is used in browsers.
This also allowed to remove all webpack 'externals' overhead.
This commit is contained in:
parent
c3a213802d
commit
e7180a86ce
81 changed files with 1857 additions and 1259 deletions
|
|
@ -1,6 +1,3 @@
|
|||
import $ from '$';
|
||||
import key from 'key';
|
||||
|
||||
import { leftPanelDisabled } from 'Common/Globals';
|
||||
import { KeyState } from 'Common/Enums';
|
||||
|
||||
|
|
@ -29,7 +26,7 @@ class MenuSettingsAdminView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
onBuild(dom) {
|
||||
key('up, down', KeyState.Settings, settingsMenuKeysHandler($('.b-admin-menu .e-item', dom)));
|
||||
key('up, down', KeyState.Settings, settingsMenuKeysHandler(jQuery('.b-admin-menu .e-item', dom)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { delegateRun, log } from 'Common/Utils';
|
||||
import { delegateRun } from 'Common/Utils';
|
||||
|
||||
import PgpStore from 'Stores/User/Pgp';
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext {
|
|||
if (err) {
|
||||
this.key.error(true);
|
||||
this.key.errorMessage(err && err[0] ? '' + err[0] : '');
|
||||
log(err);
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
import Jua from 'Jua';
|
||||
|
||||
import {
|
||||
Capa,
|
||||
|
|
@ -943,7 +940,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
sSubject = message.subject();
|
||||
aDraftInfo = message.aDraftInfo;
|
||||
|
||||
const clonedText = $(message.body).clone();
|
||||
const clonedText = jQuery(message.body).clone();
|
||||
if (clonedText) {
|
||||
clearBqSwitcher(clonedText);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import { pString, log, defautOptionsAfterRender } from 'Common/Utils';
|
||||
import { pString, defautOptionsAfterRender } from 'Common/Utils';
|
||||
|
||||
import { Magics, KeyState } from 'Common/Enums';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
|
@ -103,7 +101,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
|||
this.defautOptionsAfterRender(domOption, item);
|
||||
|
||||
if (item && undefined !== item.class && domOption) {
|
||||
$(domOption).addClass(item.class);
|
||||
jQuery(domOption).addClass(item.class);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -203,7 +201,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
|||
});
|
||||
}
|
||||
} catch (e) {
|
||||
log(e);
|
||||
console.log(e);
|
||||
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
import window from 'window';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
import Jua from 'Jua';
|
||||
|
||||
import {
|
||||
SaveSettingsStep,
|
||||
|
|
@ -80,7 +76,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
|
||||
this.contactsPage = ko.observable(1);
|
||||
this.contactsPageCount = ko.computed(() => {
|
||||
const iPage = window.Math.ceil(this.contactsCount() / CONTACTS_PER_PAGE);
|
||||
const iPage = Math.ceil(this.contactsCount() / CONTACTS_PER_PAGE);
|
||||
return 0 >= iPage ? 1 : iPage;
|
||||
});
|
||||
|
||||
|
|
@ -349,7 +345,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
syncCommand() {
|
||||
getApp().contactsSync((result, data) => {
|
||||
if (StorageResultType.Success !== result || !data || !data.Result) {
|
||||
window.alert(getNotification(data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
|
||||
alert(getNotification(data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
|
||||
}
|
||||
|
||||
this.reloadContactList(true);
|
||||
|
|
@ -441,7 +437,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
this.contacts.importing(false);
|
||||
this.reloadContactList();
|
||||
if (!id || !result || !data || !data.Result) {
|
||||
window.alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
|
||||
alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -618,7 +614,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
onBuild(dom) {
|
||||
this.oContentVisible = $('.b-list-content', dom);
|
||||
this.oContentVisible = jQuery('.b-list-content', dom);
|
||||
|
||||
this.selector.init(this.oContentVisible, this.oContentVisible, KeyState.ContactList);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import key from 'key';
|
||||
|
||||
import { KeyState, Magics } from 'Common/Enums';
|
||||
|
||||
import { popup } from 'Knoin/Knoin';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
import $ from '$';
|
||||
|
||||
import { pString, log } from 'Common/Utils';
|
||||
import { pString } from 'Common/Utils';
|
||||
import { KeyState, Magics } from 'Common/Enums';
|
||||
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
|
|
@ -47,19 +45,19 @@ class MessageOpenPgpPopupView extends AbstractViewNext {
|
|||
if (privateKey) {
|
||||
try {
|
||||
if (!privateKey.decrypt(pString(this.password()))) {
|
||||
log('Error: Private key cannot be decrypted');
|
||||
console.log('Error: Private key cannot be decrypted');
|
||||
privateKey = null;
|
||||
}
|
||||
} catch (e) {
|
||||
log(e);
|
||||
console.log(e);
|
||||
privateKey = null;
|
||||
}
|
||||
} else {
|
||||
log('Error: Private key cannot be found');
|
||||
console.log('Error: Private key cannot be found');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
log(e);
|
||||
console.log(e);
|
||||
privateKey = null;
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +107,7 @@ class MessageOpenPgpPopupView extends AbstractViewNext {
|
|||
.addClass('icon-radio-unchecked')
|
||||
.removeClass('icon-radio-checked');
|
||||
|
||||
$(this)
|
||||
jQuery(this)
|
||||
.find('.key-list__item__radio') // eslint-disable-line no-invalid-this
|
||||
.removeClass('icon-radio-unchecked')
|
||||
.addClass('icon-radio-checked');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Magics } from 'Common/Enums';
|
||||
import { log, delegateRun, pInt } from 'Common/Utils';
|
||||
import { delegateRun, pInt } from 'Common/Utils';
|
||||
|
||||
import PgpStore from 'Stores/User/Pgp';
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
showError(e) {
|
||||
log(e);
|
||||
console.log(e);
|
||||
if (e && e.message) {
|
||||
this.submitError(e.message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import { KeyState, Magics, StorageResultType, Notification } from 'Common/Enums';
|
||||
import { isNonEmptyArray, delegateRun } from 'Common/Utils';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import window from 'window';
|
||||
import ko from 'ko';
|
||||
|
||||
import { Capa, StorageResultType } from 'Common/Enums';
|
||||
|
|
@ -137,18 +136,18 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
|||
|
||||
onHide() {
|
||||
if (this.lock()) {
|
||||
window.location.reload();
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
getQr() {
|
||||
return (
|
||||
'otpauth://totp/' +
|
||||
window.encodeURIComponent(this.viewUser()) +
|
||||
encodeURIComponent(this.viewUser()) +
|
||||
'?secret=' +
|
||||
window.encodeURIComponent(this.viewSecret()) +
|
||||
encodeURIComponent(this.viewSecret()) +
|
||||
'&issuer=' +
|
||||
window.encodeURIComponent('')
|
||||
encodeURIComponent('')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +165,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
|||
this.viewBackupCodes(pString(oData.Result.BackupCodes).replace(/[\s]+/g, ' '));
|
||||
|
||||
this.viewUrlTitle(pString(oData.Result.UrlTitle));
|
||||
this.viewUrl(window.qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
|
||||
this.viewUrl(qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
|
||||
} else {
|
||||
this.viewUser('');
|
||||
this.viewEnable_(false);
|
||||
|
|
@ -186,7 +185,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
|||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
this.viewSecret(pString(data.Result.Secret));
|
||||
this.viewUrlTitle(pString(data.Result.UrlTitle));
|
||||
this.viewUrl(window.qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
|
||||
this.viewUrl(qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
|
||||
} else {
|
||||
this.viewSecret('');
|
||||
this.viewUrlTitle('');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { selectElement } from 'Common/Utils';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import AppStore from 'Stores/User/App';
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
import window from 'window';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import { isNormal, windowResize } from 'Common/Utils';
|
||||
import { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
|
||||
|
|
@ -21,6 +18,8 @@ import { getApp } from 'Helper/Apps/User';
|
|||
import { view, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
const $ = jQuery;
|
||||
|
||||
@view({
|
||||
name: 'View/User/MailBox/FolderList',
|
||||
type: ViewType.Left,
|
||||
|
|
@ -194,9 +193,9 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
messagesDropOver(folder) {
|
||||
window.clearTimeout(this.iDropOverTimer);
|
||||
clearTimeout(this.iDropOverTimer);
|
||||
if (folder && folder.collapsed()) {
|
||||
this.iDropOverTimer = window.setTimeout(() => {
|
||||
this.iDropOverTimer = setTimeout(() => {
|
||||
folder.collapsed(false);
|
||||
getApp().setExpandedFolder(folder.fullNameHash, true);
|
||||
windowResize();
|
||||
|
|
@ -205,7 +204,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
messagesDropOut() {
|
||||
window.clearTimeout(this.iDropOverTimer);
|
||||
clearTimeout(this.iDropOverTimer);
|
||||
}
|
||||
|
||||
scrollToFocused() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
import window from 'window';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
import Jua from 'Jua';
|
||||
|
||||
import {
|
||||
Capa,
|
||||
|
|
@ -400,7 +396,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
return false;
|
||||
}
|
||||
|
||||
window.clearTimeout(this.iGoToUpUpOrDownDownTimeout);
|
||||
clearTimeout(this.iGoToUpUpOrDownDownTimeout);
|
||||
this.iGoToUpUpOrDownDownTimeout = setTimeout(() => {
|
||||
let prev = null,
|
||||
next = null,
|
||||
|
|
@ -739,7 +735,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
onBuild(dom) {
|
||||
const self = this;
|
||||
|
||||
this.oContentVisible = $('.b-content', dom);
|
||||
this.oContentVisible = jQuery('.b-content', dom);
|
||||
|
||||
this.selector.init(this.oContentVisible, this.oContentVisible, KeyState.MessageList);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import { DATA_IMAGE_USER_DOT_PIC, UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
|
||||
|
|
@ -450,7 +448,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
// aTo = [],
|
||||
// EmailModel = require('Model/Email').default,
|
||||
// fParseEmailLine = function(sLine) {
|
||||
// return sLine ? [window.decodeURIComponent(sLine)].map(sItem => {
|
||||
// return sLine ? [decodeURIComponent(sLine)].map(sItem => {
|
||||
// var oEmailModel = new EmailModel();
|
||||
// oEmailModel.parse(sItem);
|
||||
// return oEmailModel.email ? oEmailModel : null;
|
||||
|
|
@ -473,7 +471,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
let index = 0,
|
||||
listIndex = 0;
|
||||
|
||||
const div = $('<div>'),
|
||||
const div = jQuery('<div>'),
|
||||
dynamicEls = this.message().attachments().map(item => {
|
||||
if (item && !item.isLinked && item.isImage()) {
|
||||
if (item === attachment) {
|
||||
|
|
@ -561,7 +559,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0');
|
||||
});
|
||||
|
||||
this.oHeaderDom = $('.messageItemHeader', dom);
|
||||
this.oHeaderDom = jQuery('.messageItemHeader', dom);
|
||||
this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null;
|
||||
|
||||
if (this.mobile) {
|
||||
|
|
@ -578,7 +576,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
!!event &&
|
||||
Magics.EventWhichMouseMiddle !== event.which &&
|
||||
mailToHelper(
|
||||
$(this).attr('href'),
|
||||
jQuery(this).attr('href'),
|
||||
Settings.capa(Capa.Composer) ? require('View/Popup/Compose') : null // eslint-disable-line no-invalid-this
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
import $ from '$';
|
||||
import key from 'key';
|
||||
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { leftPanelDisabled } from 'Common/Globals';
|
||||
import { settings, inbox } from 'Common/Links';
|
||||
|
|
@ -37,7 +34,7 @@ class MenuSettingsUserView extends AbstractViewNext {
|
|||
});
|
||||
}
|
||||
|
||||
key('up, down', KeyState.Settings, settingsMenuKeysHandler($('.b-settings-menu .e-item', dom)));
|
||||
key('up, down', KeyState.Settings, settingsMenuKeysHandler(jQuery('.b-settings-menu .e-item', dom)));
|
||||
}
|
||||
|
||||
link(route) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue