web-manager 3.2.9 → 3.2.10
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/utilities.js +23 -0
- package/package.json +1 -1
package/lib/utilities.js
CHANGED
@@ -95,4 +95,27 @@ Utilities.escapeHTML = function (str) {
|
|
95
95
|
});
|
96
96
|
}
|
97
97
|
|
98
|
+
Utilities.getContext = function () {
|
99
|
+
// Check mobile
|
100
|
+
function mobile() {
|
101
|
+
try {
|
102
|
+
var m = navigator.userAgentData.mobile;
|
103
|
+
return typeof m === 'undefined' ? _THROW : m === true;
|
104
|
+
} catch (e) {
|
105
|
+
try {
|
106
|
+
return window.matchMedia('only screen and (max-width: 760px)').matches
|
107
|
+
} catch (e) {
|
108
|
+
return false;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
// Return findings
|
114
|
+
return {
|
115
|
+
client: {
|
116
|
+
mobile: mobile(),
|
117
|
+
},
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
98
121
|
module.exports = Utilities;
|
package/package.json
CHANGED