mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
isArray to native Array.isArray
isUnd(*) to native undefined === *
isFunc to native typeof * === 'function'
isObject to native typeof * === 'object'
microtime() to native Date().getTime();
noop to native ()=>{}
noopFalse to native ()=>false
noopTrue to native ()=>true
boolToAjax to native *?'1':'0'
Underscore.js to native
This commit is contained in:
parent
fa39c7ecba
commit
ea48f5060b
72 changed files with 551 additions and 775 deletions
|
|
@ -6,7 +6,7 @@ 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 { trim } from 'Common/Utils';
|
||||
import { settings } from 'Common/Links';
|
||||
|
||||
import * as Events from 'Common/Events';
|
||||
|
|
@ -51,7 +51,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
accountClick(account, event) {
|
||||
if (account && event && !isUnd(event.which) && 1 === event.which) {
|
||||
if (account && event && undefined !== event.which && 1 === event.which) {
|
||||
AccountStore.accounts.loading(true);
|
||||
setTimeout(() => AccountStore.accounts.loading(false), Magics.Time1s);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import $ from '$';
|
|||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import { trim, isNormal, isArray, windowResize } from 'Common/Utils';
|
||||
import { trim, isNormal, windowResize } from 'Common/Utils';
|
||||
import { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
|
||||
import { $htmlCL, leftPanelDisabled, moveAction } from 'Common/Globals';
|
||||
import { mailBox, settings } from 'Common/Links';
|
||||
|
|
@ -245,7 +245,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
|||
copy = $htmlCL.contains('rl-ctrl-key-pressed'),
|
||||
uids = ui.helper.data('rl-uids');
|
||||
|
||||
if (fromFolderFullNameRaw && isNormal(fromFolderFullNameRaw) && isArray(uids)) {
|
||||
if (fromFolderFullNameRaw && isNormal(fromFolderFullNameRaw) && Array.isArray(uids)) {
|
||||
getApp().moveMessagesToFolder(fromFolderFullNameRaw, uids, toFolder.fullNameRaw, copy);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import window from 'window';
|
||||
import _ from '_';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
|
@ -22,7 +21,7 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
|||
|
||||
import { bMobileDevice, popupVisibility, leftPanelDisabled, moveAction } from 'Common/Globals';
|
||||
|
||||
import { noop, noopFalse, computedPagenatorHelper, draggablePlace, friendlySize, isUnd } from 'Common/Utils';
|
||||
import { computedPagenatorHelper, draggablePlace, friendlySize } from 'Common/Utils';
|
||||
|
||||
import { mailBox, append } from 'Common/Links';
|
||||
import { Selector } from 'Common/Selector';
|
||||
|
|
@ -401,7 +400,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
window.clearTimeout(this.iGoToUpUpOrDownDownTimeout);
|
||||
this.iGoToUpUpOrDownDownTimeout = window.setTimeout(() => {
|
||||
this.iGoToUpUpOrDownDownTimeout = setTimeout(() => {
|
||||
let prev = null,
|
||||
next = null,
|
||||
temp = null,
|
||||
|
|
@ -516,7 +515,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
el.data('rl-folder', FolderStore.currentFolderFullNameRaw());
|
||||
|
||||
updateUidsInfo();
|
||||
_.defer(updateUidsInfo);
|
||||
setTimeout(updateUidsInfo,1);
|
||||
|
||||
return el;
|
||||
}
|
||||
|
|
@ -569,7 +568,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
clearMessageFlagsFromCacheByFolder(sFolderFullNameRaw);
|
||||
}
|
||||
|
||||
Remote.messageSetSeenToAll(noop, sFolderFullNameRaw, true, sThreadUid ? uids : null);
|
||||
Remote.messageSetSeenToAll(()=>{}, sFolderFullNameRaw, true, sThreadUid ? uids : null);
|
||||
break;
|
||||
case MessageSetAction.UnsetSeen:
|
||||
folder = getFolderFromCacheList(sFolderFullNameRaw);
|
||||
|
|
@ -595,7 +594,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
clearMessageFlagsFromCacheByFolder(sFolderFullNameRaw);
|
||||
}
|
||||
|
||||
Remote.messageSetSeenToAll(noop, sFolderFullNameRaw, false, sThreadUid ? uids : null);
|
||||
Remote.messageSetSeenToAll(()=>{}, sFolderFullNameRaw, false, sThreadUid ? uids : null);
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
|
@ -668,7 +667,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
flagMessagesFast(bFlag) {
|
||||
const checked = this.messageListCheckedOrSelected();
|
||||
if (checked.length) {
|
||||
if (isUnd(bFlag)) {
|
||||
if (undefined === bFlag) {
|
||||
const flagged = checked.filter(message => message.flagged());
|
||||
this.setAction(
|
||||
checked[0].folderFullNameRaw,
|
||||
|
|
@ -688,7 +687,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
seenMessagesFast(seen) {
|
||||
const checked = this.messageListCheckedOrSelected();
|
||||
if (checked.length) {
|
||||
if (isUnd(seen)) {
|
||||
if (undefined === seen) {
|
||||
const unseen = checked.filter(message => message.unseen());
|
||||
this.setAction(
|
||||
checked[0].folderFullNameRaw,
|
||||
|
|
@ -932,8 +931,8 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
return false;
|
||||
});
|
||||
|
||||
key('ctrl+left, command+left', KeyState.MessageView, noopFalse);
|
||||
key('ctrl+right, command+right', KeyState.MessageView, noopFalse);
|
||||
key('ctrl+left, command+left', KeyState.MessageView, ()=>false);
|
||||
key('ctrl+right, command+right', KeyState.MessageView, ()=>false);
|
||||
}
|
||||
|
||||
prefetchNextTick() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import _ from '_';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
|
@ -22,7 +21,6 @@ import { $htmlCL, leftPanelDisabled, keyScopeReal, useKeyboardShortcuts, moveAct
|
|||
import {
|
||||
isNonEmptyArray,
|
||||
trim,
|
||||
noop,
|
||||
windowResize,
|
||||
windowResizeCallback,
|
||||
inFocus,
|
||||
|
|
@ -542,13 +540,20 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
this.showFullInfo.subscribe(fCheckHeaderHeight);
|
||||
this.message.subscribe(fCheckHeaderHeight);
|
||||
|
||||
var t;
|
||||
Events.sub(
|
||||
'window.resize',
|
||||
_.throttle(() => {
|
||||
setTimeout(fCheckHeaderHeight, 1);
|
||||
setTimeout(fCheckHeaderHeight, Magics.Time200ms);
|
||||
setTimeout(fCheckHeaderHeight, Magics.Time500ms);
|
||||
}, Magics.Time50ms)
|
||||
()=>{
|
||||
// throttle
|
||||
if (!t) {
|
||||
t = setTimeout(()=>{
|
||||
setTimeout(fCheckHeaderHeight, 1);
|
||||
setTimeout(fCheckHeaderHeight, Magics.Time200ms);
|
||||
setTimeout(fCheckHeaderHeight, Magics.Time500ms);
|
||||
t = 0;
|
||||
}, Magics.Time50ms);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
this.showFullInfo.subscribe((value) => {
|
||||
|
|
@ -932,7 +937,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
readReceipt(oMessage) {
|
||||
if (oMessage && oMessage.readReceipt()) {
|
||||
Remote.sendReadReceiptMessage(
|
||||
noop,
|
||||
()=>{},
|
||||
oMessage.folderFullNameRaw,
|
||||
oMessage.uid,
|
||||
oMessage.readReceipt(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue