diff --git a/copyparty/web/md.js b/copyparty/web/md.js index d8901a9a..0109d453 100644 --- a/copyparty/web/md.js +++ b/copyparty/web/md.js @@ -23,8 +23,7 @@ var dbg = function () { }; // dodge browser issues (function () { - var ua = navigator.userAgent; - if (ua.indexOf(') Gecko/') !== -1 && /Linux| Mac /.exec(ua)) { + if (UA.indexOf(') Gecko/') !== -1 && /Linux| Mac /.exec(UA)) { // necessary on ff-68.7 at least var s = mknod('style'); s.innerHTML = '@page { margin: .5in .6in .8in .6in; }'; diff --git a/copyparty/web/md2.js b/copyparty/web/md2.js index c59fa056..6df62b13 100644 --- a/copyparty/web/md2.js +++ b/copyparty/web/md2.js @@ -450,7 +450,7 @@ function savechk_cb() { // firefox bug: initial selection offset isn't cleared properly through js var ff_clearsel = (function () { - if (navigator.userAgent.indexOf(') Gecko/') === -1) + if (UA.indexOf(') Gecko/') === -1) return function () { } return function () { diff --git a/copyparty/web/svcs.js b/copyparty/web/svcs.js index 505b16ac..7f251c35 100644 --- a/copyparty/web/svcs.js +++ b/copyparty/web/svcs.js @@ -1,9 +1,9 @@ function QSA(x) { return document.querySelectorAll(x); } -var LINUX = /Linux/.test(navigator.userAgent), - MACOS = /[^a-z]mac ?os/i.test(navigator.userAgent), - WINDOWS = /Windows/.test(navigator.userAgent); +var LINUX = /Linux/.test(UA), + MACOS = /[^a-z]mac ?os/i.test(UA), + WINDOWS = /Windows/.test(UA); var oa = QSA('pre'); diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 107a06ec..c44e07a4 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -969,7 +969,7 @@ function up2k_init(subtle) { ud = function () { ebi('dir' + fdom_ctr).click(); }; // too buggy on chrome <= 72 - var m = / Chrome\/([0-9]+)\./.exec(navigator.userAgent); + var m = / Chrome\/([0-9]+)\./.exec(UA); if (m && parseInt(m[1]) < 73) return uf(); diff --git a/copyparty/web/util.js b/copyparty/web/util.js index d53bc496..53a5d76d 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -31,12 +31,13 @@ var wah = '', MOBILE = TOUCH, CHROME = !!window.chrome, // safari=false VCHROME = CHROME ? 1 : 0, - IE = /Trident\//.test(navigator.userAgent), - FIREFOX = ('netscape' in window) && / rv:/.test(navigator.userAgent), - IPHONE = TOUCH && /iPhone|iPad|iPod/i.test(navigator.userAgent), - LINUX = /Linux/.test(navigator.userAgent), - MACOS = /[^a-z]mac ?os/i.test(navigator.userAgent), - WINDOWS = /Windows/.test(navigator.userAgent); + UA = '' + navigator.userAgent, + IE = /Trident\//.test(UA), + FIREFOX = ('netscape' in window) && / rv:/.test(UA), + IPHONE = TOUCH && /iPhone|iPad|iPod/i.test(UA), + LINUX = /Linux/.test(UA), + MACOS = /[^a-z]mac ?os/i.test(UA), + WINDOWS = /Windows/.test(UA); if (!window.WebAssembly || !WebAssembly.Memory) window.WebAssembly = false; @@ -196,7 +197,7 @@ function vis_exh(msg, url, lineNo, columnNo, error) { '
try to reset copyparty settings if you are stuck here, or ignore this / ignore all / basic
', 'please send me a screenshot arigathanks gozaimuch: new github issue
', '' + esc(url + ' @' + lineNo + ':' + columnNo), '
' + esc(msg).replace(/\n/g, '
') + '
UA: ' + esc(navigator.userAgent + '') + '
UA: ' + esc(UA) ]; try {