@osovitny/anatoly 3.19.15 → 3.19.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3742,6 +3742,26 @@ class Browser {
|
|
|
3742
3742
|
static isIframe() {
|
|
3743
3743
|
return window !== window.parent && !window.opener;
|
|
3744
3744
|
}
|
|
3745
|
+
/*
|
|
3746
|
+
https://getbootstrap.com/docs/5.3/layout/breakpoints
|
|
3747
|
+
|
|
3748
|
+
$grid-breakpoints: (
|
|
3749
|
+
xs: 0,
|
|
3750
|
+
|
|
3751
|
+
// Small devices (landscape phones, 576px and up)
|
|
3752
|
+
sm: 576px,
|
|
3753
|
+
|
|
3754
|
+
// Medium devices (tablets, 768px and up)
|
|
3755
|
+
md: 768px,
|
|
3756
|
+
|
|
3757
|
+
// Large devices (desktops, 992px and up)
|
|
3758
|
+
lg: 992px,
|
|
3759
|
+
|
|
3760
|
+
// X-Large devices (large desktops, 1200px and up)
|
|
3761
|
+
xl: 1200px,
|
|
3762
|
+
xxl: 1400px
|
|
3763
|
+
);
|
|
3764
|
+
*/
|
|
3745
3765
|
static isMobile() {
|
|
3746
3766
|
const userAgent = navigator.userAgent || navigator.vendor;
|
|
3747
3767
|
const mobileRegex = new RegExp("(android|bb\\d+|meego).+mobile|" +
|
|
@@ -3772,14 +3792,19 @@ class Browser {
|
|
|
3772
3792
|
"vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|" +
|
|
3773
3793
|
"wmlb|wonu|x700|yas-|your|zeto|zte-", "i");
|
|
3774
3794
|
const isMobileUserAgent = mobileRegex.test(userAgent);
|
|
3775
|
-
const
|
|
3776
|
-
return
|
|
3795
|
+
const isMobileScreen = window.innerWidth < 768;
|
|
3796
|
+
return isMobileUserAgent || isMobileScreen;
|
|
3777
3797
|
}
|
|
3778
3798
|
static isTablet() {
|
|
3779
3799
|
const userAgent = navigator.userAgent || navigator.vendor;
|
|
3780
|
-
const
|
|
3800
|
+
const tabletRegex = new RegExp("ipad|android(?!.*mobile)|tablet|kindle|playbook|silk|nexus 7|nexus 10|Macintosh|" +
|
|
3781
3801
|
"fire|sm-t|tab|gt-p|sch-i|xoom|tf101|kftt|kfot|kfjw|kfsowi|a500|rim\\w", "i");
|
|
3782
|
-
|
|
3802
|
+
const isTabletUserAgent = tabletRegex.test(userAgent);
|
|
3803
|
+
const isTabletScreen = window.innerWidth >= 768 && window.innerWidth < 992;
|
|
3804
|
+
return isTabletUserAgent || isTabletScreen;
|
|
3805
|
+
}
|
|
3806
|
+
static isMobileOrTablet() {
|
|
3807
|
+
return this.isMobile() || this.isTablet();
|
|
3783
3808
|
}
|
|
3784
3809
|
}
|
|
3785
3810
|
|