mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
cleanup webpack
This commit is contained in:
parent
6d29acb7eb
commit
ecbe543b15
10 changed files with 44 additions and 68 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import progressJs from 'progressJs';
|
|
||||||
|
|
||||||
import { root } from 'Common/Links';
|
import { root } from 'Common/Links';
|
||||||
import { getNotification } from 'Common/Translator';
|
import { getNotification } from 'Common/Translator';
|
||||||
|
|
@ -182,8 +181,8 @@ class AdminApp extends AbstractApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
bootend(bootendCallback = null) {
|
bootend(bootendCallback = null) {
|
||||||
if (progressJs) {
|
if (window.progressJs) {
|
||||||
progressJs.end();
|
window.progressJs.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootendCallback) {
|
if (bootendCallback) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import progressJs from 'progressJs';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
log,
|
log,
|
||||||
|
|
@ -1039,8 +1038,8 @@ class AppUser extends AbstractApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
bootend() {
|
bootend() {
|
||||||
if (progressJs) {
|
if (window.progressJs) {
|
||||||
progressJs.set(100).end();
|
window.progressJs.set(100).end();
|
||||||
}
|
}
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
|
|
@ -1058,8 +1057,8 @@ class AppUser extends AbstractApp {
|
||||||
|
|
||||||
const startupUrl = pString(Settings.settingsGet('StartupUrl'));
|
const startupUrl = pString(Settings.settingsGet('StartupUrl'));
|
||||||
|
|
||||||
if (progressJs) {
|
if (window.progressJs) {
|
||||||
progressJs.set(90);
|
window.progressJs.set(90);
|
||||||
}
|
}
|
||||||
|
|
||||||
leftPanelDisabled.subscribe((value) => {
|
leftPanelDisabled.subscribe((value) => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import { bMobileDevice, bSafari } from 'Common/Globals';
|
|
||||||
import * as Links from 'Common/Links';
|
import * as Links from 'Common/Links';
|
||||||
import * as Events from 'Common/Events';
|
import * as Events from 'Common/Events';
|
||||||
|
|
||||||
|
|
@ -16,7 +15,8 @@ class Audio {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.player = this.createNewObject();
|
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) {
|
if (this.supported && this.player && this.player.canPlayType) {
|
||||||
this.supportedMp3 = !!this.player.canPlayType('audio/mpeg;').replace(/no/, '');
|
this.supportedMp3 = !!this.player.canPlayType('audio/mpeg;').replace(/no/, '');
|
||||||
this.supportedWav = !!this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, '');
|
this.supportedWav = !!this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, '');
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import progressJs from 'progressJs';
|
|
||||||
|
|
||||||
import { jassl } from 'Common/Jassl';
|
import { jassl } from 'Common/Jassl';
|
||||||
import { getHash, setHash, clearHash } from 'Storage/RainLoop';
|
import { getHash, setHash, clearHash } from 'Storage/RainLoop';
|
||||||
|
|
@ -27,8 +26,8 @@ function showError() {
|
||||||
oL.style.display = 'block';
|
oL.style.display = 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progressJs) {
|
if (window.progressJs) {
|
||||||
progressJs.set(100).end();
|
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 (
|
if (
|
||||||
p &&
|
p &&
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,6 @@ export { $win };
|
||||||
export const $html = $('html');
|
export const $html = $('html');
|
||||||
export const $htmlCL = window.document.documentElement.classList;
|
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}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
|
|
@ -40,14 +30,9 @@ export const useKeyboardShortcuts = ko.observable(true);
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
export const sUserAgent =
|
const sUserAgent =
|
||||||
('navigator' in window && 'userAgent' in window.navigator && window.navigator.userAgent.toLowerCase()) || '';
|
('navigator' in window && 'userAgent' in window.navigator && window.navigator.userAgent.toLowerCase()) || '';
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
export const bSafari = !sUserAgent.includes('chrome') && sUserAgent.includes('safari');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import $ from '$';
|
import $ from '$';
|
||||||
import ko from 'ko';
|
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 { ComposeType, SaveSettingsStep, FolderType } from 'Common/Enums';
|
||||||
import { Mime } from 'Common/Mime';
|
import { Mime } from 'Common/Mime';
|
||||||
|
|
||||||
const isArray = Array.isArray;
|
const
|
||||||
const decodeURIComponent = component => window.decodeURIComponent(component);
|
$div = $('<div></div>'),
|
||||||
|
isArray = Array.isArray,
|
||||||
|
decodeURIComponent = component => window.decodeURIComponent(component);
|
||||||
|
|
||||||
var htmlspecialchars = ((de,se,gt,lt,sq,dq,bt) => {
|
var htmlspecialchars = ((de,se,gt,lt,sq,dq,bt) => {
|
||||||
return (str, quote_style = 3, double_encode = true) => {
|
return (str, quote_style = 3, double_encode = true) => {
|
||||||
|
|
@ -533,8 +534,8 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function findEmailAndLinks(html) {
|
export function findEmailAndLinks(html) {
|
||||||
return Autolinker
|
return window.Autolinker
|
||||||
? Autolinker.link(html, {
|
? window.Autolinker.link(html, {
|
||||||
newWindow: true,
|
newWindow: true,
|
||||||
stripPrefix: false,
|
stripPrefix: false,
|
||||||
urls: true,
|
urls: true,
|
||||||
|
|
@ -1156,20 +1157,6 @@ export function isTransparent(color) {
|
||||||
return 'rgba(0, 0, 0, 0)' === color || 'transparent' === 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 {string} url
|
||||||
* @param {number} value
|
* @param {number} value
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,7 @@ import {
|
||||||
pString,
|
pString,
|
||||||
plainToHtml,
|
plainToHtml,
|
||||||
windowResize,
|
windowResize,
|
||||||
findEmailAndLinks,
|
findEmailAndLinks
|
||||||
getRealHeight
|
|
||||||
} from 'Common/Utils';
|
} from 'Common/Utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -29,7 +28,7 @@ import {
|
||||||
} from 'Common/Cache';
|
} from 'Common/Cache';
|
||||||
|
|
||||||
import { MESSAGE_BODY_CACHE_LIMIT } from 'Common/Consts';
|
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 { mailBox, notificationMailIcon } from 'Common/Links';
|
||||||
import { i18n, getNotification } from 'Common/Translator';
|
import { i18n, getNotification } from 'Common/Translator';
|
||||||
import { momentNowUnix } from 'Common/Momentor';
|
import { momentNowUnix } from 'Common/Momentor';
|
||||||
|
|
@ -50,6 +49,23 @@ import { getApp } from 'Helper/Apps/User';
|
||||||
|
|
||||||
import Remote from 'Remote/User/Ajax';
|
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 {
|
class MessageUserStore {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.staticMessage = new MessageModel();
|
this.staticMessage = new MessageModel();
|
||||||
|
|
@ -452,10 +468,7 @@ class MessageUserStore {
|
||||||
$oList.each(function() {
|
$oList.each(function() {
|
||||||
const $this = $(this); // eslint-disable-line no-invalid-this
|
const $this = $(this); // eslint-disable-line no-invalid-this
|
||||||
|
|
||||||
let h = $this.height();
|
let h = $this.height() || getRealHeight($this);
|
||||||
if (0 === h) {
|
|
||||||
h = getRealHeight($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this.text().trim() && (0 === h || 100 < h)) {
|
if ($this.text().trim() && (0 === h || 100 < h)) {
|
||||||
$this.addClass('rl-bq-switcher hidden-bq');
|
$this.addClass('rl-bq-switcher hidden-bq');
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import qr from 'qr';
|
|
||||||
|
|
||||||
import { Capa, StorageResultType } from 'Common/Enums';
|
import { Capa, StorageResultType } from 'Common/Enums';
|
||||||
import { pString } from 'Common/Utils';
|
import { pString } from 'Common/Utils';
|
||||||
|
|
@ -167,7 +166,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
||||||
this.viewBackupCodes(pString(oData.Result.BackupCodes).replace(/[\s]+/g, ' '));
|
this.viewBackupCodes(pString(oData.Result.BackupCodes).replace(/[\s]+/g, ' '));
|
||||||
|
|
||||||
this.viewUrlTitle(pString(oData.Result.UrlTitle));
|
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 {
|
} else {
|
||||||
this.viewUser('');
|
this.viewUser('');
|
||||||
this.viewEnable_(false);
|
this.viewEnable_(false);
|
||||||
|
|
@ -187,7 +186,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
||||||
if (StorageResultType.Success === result && data && data.Result) {
|
if (StorageResultType.Success === result && data && data.Result) {
|
||||||
this.viewSecret(pString(data.Result.Secret));
|
this.viewSecret(pString(data.Result.Secret));
|
||||||
this.viewUrlTitle(pString(data.Result.UrlTitle));
|
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 {
|
} else {
|
||||||
this.viewSecret('');
|
this.viewSecret('');
|
||||||
this.viewUrlTitle('');
|
this.viewUrlTitle('');
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import $ from '$';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
import key from 'key';
|
||||||
import Jua from 'Jua';
|
import Jua from 'Jua';
|
||||||
import ifvisible from 'ifvisible';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Capa,
|
Capa,
|
||||||
|
|
@ -50,7 +49,9 @@ import { getApp } from 'Helper/Apps/User';
|
||||||
import { view, command, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
|
import { view, command, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
const canBeMovedHelper = (self) => self.canBeMoved();
|
const
|
||||||
|
canBeMovedHelper = (self) => self.canBeMoved(),
|
||||||
|
ifvisible = window.ifvisible;
|
||||||
|
|
||||||
@view({
|
@view({
|
||||||
name: 'View/User/MailBox/MessageList',
|
name: 'View/User/MailBox/MessageList',
|
||||||
|
|
|
||||||
|
|
@ -115,17 +115,11 @@ module.exports = function(publicPath, pro, mode) {
|
||||||
},
|
},
|
||||||
externals: {
|
externals: {
|
||||||
'window': 'window',
|
'window': 'window',
|
||||||
'progressJs': 'window.progressJs',
|
|
||||||
'moment': 'window.moment',
|
|
||||||
'ifvisible': 'window.ifvisible',
|
|
||||||
'crossroads': 'window.crossroads',
|
'crossroads': 'window.crossroads',
|
||||||
'hasher': 'window.hasher',
|
'hasher': 'window.hasher',
|
||||||
'Jua': 'window.Jua',
|
'Jua': 'window.Jua',
|
||||||
'Autolinker': 'window.Autolinker',
|
|
||||||
'ssm': 'window.ssm',
|
'ssm': 'window.ssm',
|
||||||
'key': 'window.key',
|
'key': 'window.key',
|
||||||
'_': 'window._',
|
|
||||||
'qr': 'window.qr',
|
|
||||||
'$': 'window.jQuery'
|
'$': 'window.jQuery'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue