From 7b451bae8673d9bb8130551c013ad023db1be513 Mon Sep 17 00:00:00 2001 From: luxick Date: Tue, 22 Sep 2026 21:24:29 +0200 Subject: [PATCH] Hide companion features on mobile --- assets/companion.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/assets/companion.js b/assets/companion.js index 18b96cc..81e54bc 100644 --- a/assets/companion.js +++ b/assets/companion.js @@ -186,7 +186,19 @@ }); } + function isMobileDevice() { + // The companion only ships for Windows and Linux desktops, so skip it + // on phones/tablets. Checks the UA and falls back to "touch is the only + // pointer" so narrow desktop windows still get the companion. + if (/Android|iPhone|iPad|iPod|Mobi/i.test(navigator.userAgent)) return true; + return window.matchMedia('(pointer: coarse)').matches && + !window.matchMedia('(any-pointer: fine)').matches; + } + function init() { + // Every companion element is rendered hidden, so bailing out here + // leaves the status icon and reveal buttons invisible on mobile. + if (isMobileDevice()) return; probeStatus().then(function () { updateFooterIcon(); wireFileLinks();