Skip to content

Commit 1625db4

Browse files
authored
Merge pull request #6494 from plotly/stackgl-is-mobile-v3
Use identical version of `is-mobile` in `stackgl` modules and src code
2 parents 66e4d01 + a35692e commit 1625db4

File tree

4 files changed

+43
-87
lines changed

4 files changed

+43
-87
lines changed

stackgl_modules/index.js

+30-44
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,35 @@ function BufferBigIntNotDefined() {
18101810

18111811
/***/ }),
18121812

1813+
/***/ 2321:
1814+
/***/ (function(module) {
1815+
1816+
"use strict";
1817+
1818+
1819+
module.exports = isMobile;
1820+
module.exports.isMobile = isMobile;
1821+
module.exports["default"] = isMobile;
1822+
var mobileRE = /(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i;
1823+
var notMobileRE = /CrOS/;
1824+
var tabletRE = /android|ipad|playbook|silk/i;
1825+
function isMobile(opts) {
1826+
if (!opts) opts = {};
1827+
var ua = opts.ua;
1828+
if (!ua && typeof navigator !== 'undefined') ua = navigator.userAgent;
1829+
if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {
1830+
ua = ua.headers['user-agent'];
1831+
}
1832+
if (typeof ua !== 'string') return false;
1833+
var result = mobileRE.test(ua) && !notMobileRE.test(ua) || !!opts.tablet && tabletRE.test(ua);
1834+
if (!result && opts.tablet && opts.featureDetect && navigator && navigator.maxTouchPoints > 1 && ua.indexOf('Macintosh') !== -1 && ua.indexOf('Safari') !== -1) {
1835+
result = true;
1836+
}
1837+
return result;
1838+
}
1839+
1840+
/***/ }),
1841+
18131842
/***/ 3910:
18141843
/***/ (function(__unused_webpack_module, exports) {
18151844

@@ -20314,7 +20343,7 @@ var mouseChange = __webpack_require__(6145)
2031420343
var perspective = __webpack_require__(1120)
2031520344
var ortho = __webpack_require__(5268)
2031620345
var createShader = __webpack_require__(8245)
20317-
var isMobile = __webpack_require__(2861)({ tablet: true, featureDetect: true })
20346+
var isMobile = __webpack_require__(2321)({ tablet: true, featureDetect: true })
2031820347

2031920348
module.exports = {
2032020349
createScene: createScene,
@@ -30623,49 +30652,6 @@ function isSlowBuffer (obj) {
3062330652
}
3062430653

3062530654

30626-
/***/ }),
30627-
30628-
/***/ 2861:
30629-
/***/ (function(module) {
30630-
30631-
"use strict";
30632-
30633-
30634-
module.exports = isMobile
30635-
module.exports.isMobile = isMobile
30636-
module.exports["default"] = isMobile
30637-
30638-
var mobileRE = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i
30639-
30640-
var tabletRE = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i
30641-
30642-
function isMobile (opts) {
30643-
if (!opts) opts = {}
30644-
var ua = opts.ua
30645-
if (!ua && typeof navigator !== 'undefined') ua = navigator.userAgent
30646-
if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {
30647-
ua = ua.headers['user-agent']
30648-
}
30649-
if (typeof ua !== 'string') return false
30650-
30651-
var result = opts.tablet ? tabletRE.test(ua) : mobileRE.test(ua)
30652-
30653-
if (
30654-
!result &&
30655-
opts.tablet &&
30656-
opts.featureDetect &&
30657-
navigator &&
30658-
navigator.maxTouchPoints > 1 &&
30659-
ua.indexOf('Macintosh') !== -1 &&
30660-
ua.indexOf('Safari') !== -1
30661-
) {
30662-
result = true
30663-
}
30664-
30665-
return result
30666-
}
30667-
30668-
3066930655
/***/ }),
3067030656

3067130657
/***/ 3596:

stackgl_modules/package-lock.json

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stackgl_modules/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"gl-surface3d": "^1.6.0",
3131
"glslify": "^7.1.1",
3232
"incremental-convex-hull": "plotly/incremental-convex-hull#v1.1.0",
33+
"is-mobile": "^3.1.1",
3334
"matrix-camera-controller": "^2.1.4",
3435
"ndarray": "plotly/ndarray#v1.1.0",
3536
"ndarray-extract-contour": "plotly/ndarray-extract-contour#v1.1.0",

stackgl_modules/webpack.config.js

+3-34
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var path = require('path');
2-
var NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
2+
3+
var plotlyjsConfig = require('../webpack.config');
34

45
module.exports = {
56
target: ['web', 'es5'],
@@ -15,37 +16,5 @@ module.exports = {
1516
optimization: {
1617
minimize: false
1718
},
18-
module: {
19-
rules: [{
20-
test: /\.js$/,
21-
exclude: /node_modules/,
22-
use: {
23-
loader: 'babel-loader'
24-
}
25-
}, {
26-
test: /\.js$/,
27-
include: /node_modules[\\\/]buffer[\\\/]/,
28-
use: {
29-
loader: 'babel-loader',
30-
options: {
31-
babelrc: false,
32-
configFile: false,
33-
presets: [
34-
'@babel/preset-env'
35-
]
36-
}
37-
},
38-
}, {
39-
test: /\.glsl$/,
40-
include: /node_modules/,
41-
use: {
42-
loader: 'raw-loader'
43-
}
44-
}, {
45-
test: /\.(js|glsl)$/,
46-
use: [
47-
'ify-loader'
48-
]
49-
}]
50-
}
19+
module: plotlyjsConfig.module
5120
};

0 commit comments

Comments
 (0)