Upgraded some old JavaScript to ECMAScript 1.6

Removed some jQuery references
Added JavaScript Globals.$htmlCL for frequently used window.document.documentElement.classList
This commit is contained in:
djmaze 2020-07-15 14:25:51 +02:00
parent a6a337e5ce
commit 0b0747b8dc
19 changed files with 142 additions and 151 deletions

View file

@ -1,8 +1,9 @@
import ko from 'ko';
import window from 'window';
import { delegateRun, inFocus } from 'Common/Utils';
import { KeyState, EventKeyCode } from 'Common/Enums';
import { $win, keyScope } from 'Common/Globals';
import { keyScope } from 'Common/Globals';
export class AbstractViewNext {
bDisabeCloseOnEsc = false;
@ -35,7 +36,7 @@ export class AbstractViewNext {
* @returns {void}
*/
registerPopupKeyDown() {
$win.on('keydown', (event) => {
window.addEventListener('keydown', (event) => {
if (event && this.modalVisibility && this.modalVisibility()) {
if (!this.bDisabeCloseOnEsc && EventKeyCode.Esc === event.keyCode) {
delegateRun(this, 'cancelCommand');

View file

@ -6,7 +6,7 @@ import crossroads from 'crossroads';
import { Magics } from 'Common/Enums';
import { runHook } from 'Common/Plugins';
import { $html, VIEW_MODELS, popupVisibilityNames } from 'Common/Globals';
import { $htmlCL, VIEW_MODELS, popupVisibilityNames } from 'Common/Globals';
import { isArray, isUnd, pString, log, isFunc, createCommandLegacy, delegateRun, isNonEmptyArray } from 'Common/Utils';
@ -432,8 +432,11 @@ export function startScreens(screensClasses) {
hasher.changed.add(cross.parse, cross);
hasher.init();
_.delay(() => $html.removeClass('rl-started-trigger').addClass('rl-started'), 100);
_.delay(() => $html.addClass('rl-started-delay'), 200);
_.delay(() => {
$htmlCL.remove('rl-started-trigger');
$htmlCL.add('rl-started');
}, 100);
_.delay(() => $htmlCL.add('rl-started-delay'), 200);
}
/**