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,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