cleanup webpack

This commit is contained in:
djmaze 2020-08-07 16:28:30 +02:00
parent 6d29acb7eb
commit ecbe543b15
10 changed files with 44 additions and 68 deletions

View file

@ -1,6 +1,5 @@
import window from 'window';
import ko from 'ko';
import progressJs from 'progressJs';
import { root } from 'Common/Links';
import { getNotification } from 'Common/Translator';
@ -182,8 +181,8 @@ class AdminApp extends AbstractApp {
}
bootend(bootendCallback = null) {
if (progressJs) {
progressJs.end();
if (window.progressJs) {
window.progressJs.end();
}
if (bootendCallback) {

View file

@ -1,5 +1,4 @@
import window from 'window';
import progressJs from 'progressJs';
import {
log,
@ -1039,8 +1038,8 @@ class AppUser extends AbstractApp {
}
bootend() {
if (progressJs) {
progressJs.set(100).end();
if (window.progressJs) {
window.progressJs.set(100).end();
}
hideLoading();
}
@ -1058,8 +1057,8 @@ class AppUser extends AbstractApp {
const startupUrl = pString(Settings.settingsGet('StartupUrl'));
if (progressJs) {
progressJs.set(90);
if (window.progressJs) {
window.progressJs.set(90);
}
leftPanelDisabled.subscribe((value) => {

View file

@ -1,5 +1,4 @@
import window from 'window';
import { bMobileDevice, bSafari } from 'Common/Globals';
import * as Links from 'Common/Links';
import * as Events from 'Common/Events';
@ -16,7 +15,8 @@ class Audio {
constructor() {
this.player = this.createNewObject();
this.supported = !bMobileDevice && !bSafari && !!this.player && !!this.player.play;
// Safari can't play without user interaction
this.supported = !!this.player && !!this.player.play;
if (this.supported && this.player && this.player.canPlayType) {
this.supportedMp3 = !!this.player.canPlayType('audio/mpeg;').replace(/no/, '');
this.supportedWav = !!this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, '');

View file

@ -1,5 +1,4 @@
import window from 'window';
import progressJs from 'progressJs';
import { jassl } from 'Common/Jassl';
import { getHash, setHash, clearHash } from 'Storage/RainLoop';
@ -27,8 +26,8 @@ function showError() {
oL.style.display = 'block';
}
if (progressJs) {
progressJs.set(100).end();
if (window.progressJs) {
window.progressJs.set(100).end();
}
}
@ -85,7 +84,7 @@ window.__initAppData = data => {
}
}
const appData = window.__rlah_data(), p = progressJs;
const appData = window.__rlah_data(), p = window.progressJs;
if (
p &&

View file

@ -12,16 +12,6 @@ export { $win };
export const $html = $('html');
export const $htmlCL = window.document.documentElement.classList;
export const $body = $('body');
export const $div = $('<div></div>');
export const $hcont = $('<div></div>');
$hcont
.attr('area', 'hidden')
.css({ position: 'absolute', left: -5000 })
.appendTo($body);
/**
* @type {boolean}
*/
@ -40,14 +30,9 @@ export const useKeyboardShortcuts = ko.observable(true);
/**
* @type {string}
*/
export const sUserAgent =
const sUserAgent =
('navigator' in window && 'userAgent' in window.navigator && window.navigator.userAgent.toLowerCase()) || '';
/**
* @type {boolean}
*/
export const bSafari = !sUserAgent.includes('chrome') && sUserAgent.includes('safari');
/**
* @type {boolean}
*/

View file

@ -1,14 +1,15 @@
import window from 'window';
import $ from '$';
import ko from 'ko';
import Autolinker from 'Autolinker';
import { $win, $div, $hcont, dropdownVisibility, data as GlobalsData } from 'Common/Globals';
import { $win, dropdownVisibility, data as GlobalsData } from 'Common/Globals';
import { ComposeType, SaveSettingsStep, FolderType } from 'Common/Enums';
import { Mime } from 'Common/Mime';
const isArray = Array.isArray;
const decodeURIComponent = component => window.decodeURIComponent(component);
const
$div = $('<div></div>'),
isArray = Array.isArray,
decodeURIComponent = component => window.decodeURIComponent(component);
var htmlspecialchars = ((de,se,gt,lt,sq,dq,bt) => {
return (str, quote_style = 3, double_encode = true) => {
@ -533,8 +534,8 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
* @returns {string}
*/
export function findEmailAndLinks(html) {
return Autolinker
? Autolinker.link(html, {
return window.Autolinker
? window.Autolinker.link(html, {
newWindow: true,
stripPrefix: false,
urls: true,
@ -1156,20 +1157,6 @@ export function isTransparent(color) {
return 'rgba(0, 0, 0, 0)' === color || 'transparent' === color;
}
/**
* @param {Object} $el
* @returns {number}
*/
export function getRealHeight($el) {
$el
.clone()
.show()
.appendTo($hcont);
const result = $hcont.height();
$hcont.empty();
return result;
}
/**
* @param {string} url
* @param {number} value

View file

@ -10,8 +10,7 @@ import {
pString,
plainToHtml,
windowResize,
findEmailAndLinks,
getRealHeight
findEmailAndLinks
} from 'Common/Utils';
import {
@ -29,7 +28,7 @@ import {
} from 'Common/Cache';
import { MESSAGE_BODY_CACHE_LIMIT } from 'Common/Consts';
import { data as GlobalsData, $div } from 'Common/Globals';
import { data as GlobalsData } from 'Common/Globals';
import { mailBox, notificationMailIcon } from 'Common/Links';
import { i18n, getNotification } from 'Common/Translator';
import { momentNowUnix } from 'Common/Momentor';
@ -50,6 +49,23 @@ import { getApp } from 'Helper/Apps/User';
import Remote from 'Remote/User/Ajax';
const
$div = $('<div></div>'),
$hcont = $('<div></div>'),
getRealHeight = $el => {
$el
.clone()
.show()
.appendTo($hcont);
const result = $hcont.height();
$hcont.empty();
return result;
};
$hcont
.attr('area', 'hidden')
.css({ position: 'absolute', left: -5000 })
.appendTo($('body'));
class MessageUserStore {
constructor() {
this.staticMessage = new MessageModel();
@ -452,10 +468,7 @@ class MessageUserStore {
$oList.each(function() {
const $this = $(this); // eslint-disable-line no-invalid-this
let h = $this.height();
if (0 === h) {
h = getRealHeight($this);
}
let h = $this.height() || getRealHeight($this);
if ($this.text().trim() && (0 === h || 100 < h)) {
$this.addClass('rl-bq-switcher hidden-bq');

View file

@ -1,6 +1,5 @@
import window from 'window';
import ko from 'ko';
import qr from 'qr';
import { Capa, StorageResultType } from 'Common/Enums';
import { pString } from 'Common/Utils';
@ -167,7 +166,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
this.viewBackupCodes(pString(oData.Result.BackupCodes).replace(/[\s]+/g, ' '));
this.viewUrlTitle(pString(oData.Result.UrlTitle));
this.viewUrl(qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
this.viewUrl(window.qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
} else {
this.viewUser('');
this.viewEnable_(false);
@ -187,7 +186,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(qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
this.viewUrl(window.qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
} else {
this.viewSecret('');
this.viewUrlTitle('');

View file

@ -3,7 +3,6 @@ import $ from '$';
import ko from 'ko';
import key from 'key';
import Jua from 'Jua';
import ifvisible from 'ifvisible';
import {
Capa,
@ -50,7 +49,9 @@ import { getApp } from 'Helper/Apps/User';
import { view, command, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
const canBeMovedHelper = (self) => self.canBeMoved();
const
canBeMovedHelper = (self) => self.canBeMoved(),
ifvisible = window.ifvisible;
@view({
name: 'View/User/MailBox/MessageList',

View file

@ -115,17 +115,11 @@ module.exports = function(publicPath, pro, mode) {
},
externals: {
'window': 'window',
'progressJs': 'window.progressJs',
'moment': 'window.moment',
'ifvisible': 'window.ifvisible',
'crossroads': 'window.crossroads',
'hasher': 'window.hasher',
'Jua': 'window.Jua',
'Autolinker': 'window.Autolinker',
'ssm': 'window.ssm',
'key': 'window.key',
'_': 'window._',
'qr': 'window.qr',
'$': 'window.jQuery'
}
};