diff options
author | Lauri Ojansivu <x@xet7.org> | 2020-02-07 03:16:16 +0200 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2020-02-07 03:16:16 +0200 |
commit | bf78b093bad7d463ee325ad96e8b485264d4a3be (patch) | |
tree | 3e427789351bd5b45117c30b3a494b8db568613a /client/lib/utils.js | |
parent | 8384d68a060ef8f2c202ce2fa6064c5c823d28dc (diff) | |
download | wekan-bf78b093bad7d463ee325ad96e8b485264d4a3be.tar.gz wekan-bf78b093bad7d463ee325ad96e8b485264d4a3be.tar.bz2 wekan-bf78b093bad7d463ee325ad96e8b485264d4a3be.zip |
Try to disable dragging Swimlanes/Lists/Cards/Checklists/Subtasks on small mobile smartphones webbrowsers, and hide drag handles on mobile web.
Thanks to xet7 !
Diffstat (limited to 'client/lib/utils.js')
-rw-r--r-- | client/lib/utils.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/client/lib/utils.js b/client/lib/utils.js index 39457208..c921fddc 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -147,8 +147,38 @@ Utils = { // in a small window (even on desktop), Wekan run in compact mode. // we can easily debug with a small window of desktop browser. :-) isMiniScreen() { + // OLD WINDOW WIDTH DETECTION: this.windowResizeDep.depend(); return $(window).width() <= 800; + + // NEW TOUCH DEVICE DETECTION: + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent + + /* + var hasTouchScreen = false; + if ("maxTouchPoints" in navigator) { + hasTouchScreen = navigator.maxTouchPoints > 0; + } else if ("msMaxTouchPoints" in navigator) { + hasTouchScreen = navigator.msMaxTouchPoints > 0; + } else { + var mQ = window.matchMedia && matchMedia("(pointer:coarse)"); + if (mQ && mQ.media === "(pointer:coarse)") { + hasTouchScreen = !!mQ.matches; + } else if ('orientation' in window) { + hasTouchScreen = true; // deprecated, but good fallback + } else { + // Only as a last resort, fall back to user agent sniffing + var UA = navigator.userAgent; + hasTouchScreen = ( + /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || + /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA) + ); + } + } + */ + //if (hasTouchScreen) + // document.getElementById("exampleButton").style.padding="1em"; + //return false; }, calculateIndexData(prevData, nextData, nItems = 1) { |