mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-23 04:35:02 +08:00
refactor(views/login): simplify userAgent matching
- there is no need to have the Regexp check done in 2 separate tests – just do it once - I also have ordered the userAgents by order of "popularity", so (in theory) it should match faster for most people this way (although realistically you will not notice this at all)
This commit is contained in:
parent
b44397a6bf
commit
15faf161b5
@ -66,9 +66,8 @@
|
||||
if (mQ?.media === '(pointer:coarse)') return !!mQ.matches;
|
||||
|
||||
if ('orientation' in window) return true;
|
||||
|
||||
return /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(navigator.userAgent) ||
|
||||
/\b(Android|Windows Phone|iPad|iPod)\b/i.test(navigator.userAgent);
|
||||
const userAgentsRegEx = /\b(Android|iPhone|iPad|iPod|Windows Phone|BlackBerry|webOS|IEMobile)\b/i
|
||||
return userAgentsRegEx.test(navigator.userAgent)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user