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:
djmaze 2020-07-29 21:49:41 +02:00
parent fa39c7ecba
commit ea48f5060b
72 changed files with 551 additions and 775 deletions

View file

@ -1,9 +1,8 @@
import _ from '_';
import $ from '$';
import ko from 'ko';
import { VIEW_MODELS } from 'Common/Globals';
import { delegateRun, windowResize, log, isUnd, pString } from 'Common/Utils';
import { delegateRun, windowResize, log, pString } from 'Common/Utils';
import { settings } from 'Common/Links';
import { setHash } from 'Knoin/Knoin';
@ -103,24 +102,25 @@ class AbstractSettingsScreen extends AbstractScreen {
}
if (settingsScreen) {
_.defer(() => {
const o = this;
setTimeout(() => {
// hide
if (this.oCurrentSubScreen) {
delegateRun(this.oCurrentSubScreen, 'onHide');
this.oCurrentSubScreen.viewModelDom.hide();
if (o.oCurrentSubScreen) {
delegateRun(o.oCurrentSubScreen, 'onHide');
o.oCurrentSubScreen.viewModelDom.hide();
}
// --
this.oCurrentSubScreen = settingsScreen;
o.oCurrentSubScreen = settingsScreen;
// show
if (this.oCurrentSubScreen) {
delegateRun(this.oCurrentSubScreen, 'onBeforeShow');
this.oCurrentSubScreen.viewModelDom.show();
delegateRun(this.oCurrentSubScreen, 'onShow');
delegateRun(this.oCurrentSubScreen, 'onShowWithDelay', [], 200);
if (o.oCurrentSubScreen) {
delegateRun(o.oCurrentSubScreen, 'onBeforeShow');
o.oCurrentSubScreen.viewModelDom.show();
delegateRun(o.oCurrentSubScreen, 'onShow');
delegateRun(o.oCurrentSubScreen, 'onShowWithDelay', [], 200);
this.menu().forEach(item => {
o.menu().forEach(item => {
item.selected(
settingsScreen &&
settingsScreen.__rlSettingsData &&
@ -133,7 +133,7 @@ class AbstractSettingsScreen extends AbstractScreen {
// --
windowResize();
});
}, 1);
}
} else {
setHash(settings(), false, true);
@ -180,7 +180,7 @@ class AbstractSettingsScreen extends AbstractScreen {
rules = {
subname: /^(.*)$/,
normalize_: (rquest, vals) => {
vals.subname = isUnd(vals.subname) ? defaultRoute : pString(vals.subname);
vals.subname = undefined === vals.subname ? defaultRoute : pString(vals.subname);
return [vals.subname];
}
};

View file

@ -1,8 +1,8 @@
import _ from '_';
import window from 'window';
import { Focused, Capa, ClientSideKeyName, Magics } from 'Common/Enums';
import { $html, leftPanelDisabled, leftPanelType, moveAction, bMobileDevice } from 'Common/Globals';
import { pString, pInt, decodeURI, windowResizeCallback } from 'Common/Utils';
import { pString, pInt, windowResizeCallback } from 'Common/Utils';
import { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache';
import { i18n } from 'Common/Translator';
@ -131,9 +131,9 @@ class MailBoxUserScreen extends AbstractScreen {
*/
onBuild() {
if (!bMobileDevice && !Settings.appSettingsGet('mobile')) {
_.defer(() => {
getApp().initHorizontalLayoutResizer(ClientSideKeyName.MessageListSize);
});
setTimeout(() =>
getApp().initHorizontalLayoutResizer(ClientSideKeyName.MessageListSize)
, 1);
}
$html.on('click', '#rl-right', () => {
@ -157,7 +157,7 @@ class MailBoxUserScreen extends AbstractScreen {
vals[1] = 1;
}
return [decodeURI(vals[0]), vals[1], decodeURI(vals[2])];
return [window.decodeURI(vals[0]), vals[1], window.decodeURI(vals[2])];
},
fNormD = (request, vals) => {
vals[0] = pString(vals[0]);
@ -167,7 +167,7 @@ class MailBoxUserScreen extends AbstractScreen {
vals[0] = inboxFolderName;
}
return [decodeURI(vals[0]), 1, decodeURI(vals[1])];
return [window.decodeURI(vals[0]), 1, window.decodeURI(vals[1])];
};
return [