Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

remove ie11 related unused pollyfills, remove legacy feedback, trim down unused browser util.

Ed Plato99d1189c7412
diff --git a/doc/testing.md b/doc/testing.md
index 49e4842f3..1dd4888f9 100644
--- a/doc/testing.md
+++ b/doc/testing.md
@@ -30,7 +30,7 @@ To run the end-to-end tests using Firefox in a docker container, create an image
### Browserstack
-Run `npm run browserstack` to test the app in `Chrome(OS X and Windows)`, `Firefox(Windows)`, `Internet Explorer(windows)`, and `Safari(OS X)` on BrowserStack. The tests run the `nightwatch.js` features found in `./e2e/features` using Selenium.
+Run `npm run browserstack` to test the app in `Chrome(OS X and Windows)`, `Firefox(Windows)`, and `Safari(OS X)` on BrowserStack. The tests run the `nightwatch.js` features found in `./e2e/features` using Selenium.
To run tests in BrowserStack from your local machine:
diff --git a/e2e/browserstack.conf.js b/e2e/browserstack.conf.js
index 02e0a171e..cba0d7a31 100644
--- a/e2e/browserstack.conf.js
+++ b/e2e/browserstack.conf.js
@@ -57,13 +57,6 @@ const nightwatchConfig = {
'browserstack.geckodriver': '0.24.0',
},
},
- ie: {
- desiredCapabilities: {
- browser: 'internet explorer',
- 'browserstack.selenium_version': '2.53.0',
- },
- },
-
},
};
diff --git a/package-lock.json b/package-lock.json
index 1ee1d648d..3769371fc 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -25030,11 +25030,6 @@
"defaults": "^1.0.3"
}
},
- "web-streams-polyfill": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-2.0.6.tgz",
- "integrity": "sha512-nXOi4fBykO4LzyQhZX3MAGib635KGZBoNTkNXrNIkz0zthEf2QokEWxRb0H632xNLDWtHFb1R6dFGzksjYMSDw=="
- },
"webfont-matcher": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/webfont-matcher/-/webfont-matcher-1.1.0.tgz",
@@ -25598,11 +25593,6 @@
"iconv-lite": "0.4.24"
}
},
- "whatwg-fetch": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz",
- "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q=="
- },
"whatwg-mimetype": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz",
diff --git a/package.json b/package.json
index 4fac6a3b0..64f0a25c8 100644
--- a/package.json
+++ b/package.json
@@ -181,7 +181,6 @@
"compression": "^1.7.4",
"coordinate-parser": "^1.0.4",
"copy-to-clipboard": "^3.3.1",
- "core-js": "^3.6.4",
"elm-pep": "^1.0.6",
"file-saver": "^2.0.2",
"geographiclib": "^1.50.0",
@@ -225,17 +224,13 @@
"shp-write": "^0.3.2",
"simplebar-react": "^2.1.0",
"supercluster": "7.0.0",
- "web-streams-polyfill": "^2.0.6",
- "what-input": "^5.2.7",
- "whatwg-fetch": "^3.0.0"
+ "what-input": "^5.2.7"
},
"browserslist": [
- "last 4 versions",
- "not ie < 11",
- "not edge < 17",
- "not IE_Mob 11",
+ "last 2 versions",
+ "not IE 11",
"not dead",
- "> 2%"
+ "> 1%"
],
"jest": {
"setupFiles": [
diff --git a/web/css/alert.css b/web/css/alert.css
index 04cea5078..257726d1f 100644
--- a/web/css/alert.css
+++ b/web/css/alert.css
@@ -47,13 +47,6 @@
width: 100%;
}
-/* IE11 align-items center fix */
-.alert-content::after {
- content: '';
- min-height: inherit;
- font-size: 0;
-}
-
/* ErrorBoundary */
.error-icon {
margin-right: 10px;
diff --git a/web/css/events.css b/web/css/events.css
index 7e6431eb1..18a6293df 100644
--- a/web/css/events.css
+++ b/web/css/events.css
@@ -310,17 +310,6 @@
width: 26px;
}
-/* @media (max-width: 768px) {
- .event-scroll-list .event-icon {
- height: 40px;
- width: 40px;
- }
- .wv-map .event-icon {
- height: 36px;
- width: 36px;
- }
-} */
-
.event-icon-dust-and-haze {
background: url("../images/natural-events/icon-dust-and-haze.svg");
}
diff --git a/web/js/components/layer/product-picker/search/search-layers-list.js b/web/js/components/layer/product-picker/search/search-layers-list.js
index 2c3feabbb..6e1fbddc7 100644
--- a/web/js/components/layer/product-picker/search/search-layers-list.js
+++ b/web/js/components/layer/product-picker/search/search-layers-list.js
@@ -6,7 +6,6 @@ import InfiniteScroll from 'react-infinite-scroller';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import SwipeToDelete from 'react-swipe-to-delete-component';
import SearchLayerRow from './search-layer-row';
-import 'whatwg-fetch'; // fetch() polyfill for IE
import {
selectLayer as selectLayerAction,
clearSingleRecentLayer as clearSingleRecentLayerAction,
diff --git a/web/js/containers/info.js b/web/js/containers/info.js
index e40161630..fb5603608 100644
--- a/web/js/containers/info.js
+++ b/web/js/containers/info.js
@@ -89,7 +89,7 @@ function InfoList (props) {
? { href: 'mailto:@MAIL@?subject=Feedback for @LONG_NAME@ tool' }
: {
onClick: () => {
- sendFeedback(feedbackIsInitiated);
+ sendFeedback(feedbackIsInitiated, isMobile);
},
};
const arr = [
@@ -165,8 +165,8 @@ const mapDispatchToProps = (dispatch) => ({
toggleDistractionFreeMode: () => {
dispatch(toggleDistractionFreeModeAction());
},
- sendFeedback: (isInitiated) => {
- onClickFeedback(isInitiated);
+ sendFeedback: (isInitiated, isMobile) => {
+ onClickFeedback(isInitiated, isMobile);
if (!isInitiated) {
dispatch(initFeedback());
}
diff --git a/web/js/containers/sidebar/sidebar.js b/web/js/containers/sidebar/sidebar.js
index aba9a1e97..aeb57f1c3 100644
--- a/web/js/containers/sidebar/sidebar.js
+++ b/web/js/containers/sidebar/sidebar.js
@@ -30,7 +30,6 @@ import {
import { getAllActiveLayers } from '../../modules/layers/selectors';
import { getFilteredEvents } from '../../modules/natural-events/selectors';
import ErrorBoundary from '../error-boundary';
-import util from '../../util/util';
import {
changeTab as changeTabAction,
toggleSidebarCollapse as toggleSidebarCollapseAction,
@@ -82,16 +81,6 @@ class Sidebar extends React.Component {
if (isEmbedModeActive && activeTab === 'layers') {
this.setState({ isEventsTabDisabledEmbed: true });
}
-
- // prevent browser zooming in safari
- if (util.browser.safari) {
- const onGestureCallback = (e) => {
- e.preventDefault();
- e.stopPropagation();
- };
- this.iconElement.addEventListener('gesturestart', onGestureCallback);
- this.sideBarCase.addEventListener('gesturestart', onGestureCallback);
- }
}
componentDidUpdate(prevProps) {
@@ -203,7 +192,6 @@ class Sidebar extends React.Component {
isEmbedModeActive,
selectedDate,
} = this.props;
- const wheelCallBack = util.browser.chrome ? util.preventPinch : null;
const permalink = getPermalink(history.location.search, selectedDate);
const WVLogoTitle = isEmbedModeActive
? 'Click to Open This Worldview Map in a New Tab'
@@ -217,8 +205,6 @@ class Sidebar extends React.Component {
id="wv-logo"
className={isDistractionFreeModeActive ? 'wv-logo-distraction-free-mode' : ''}
onClick={(e) => this.handleWorldviewLogoClick(e, permalink)}
- ref={(iconElement) => { this.iconElement = iconElement; }}
- onWheel={wheelCallBack}
/>
);
}
@@ -248,7 +234,6 @@ class Sidebar extends React.Component {
tabTypes,
} = this.props;
if ((isMobile || isEmbedModeActive) && activeTab === 'download') changeTab('layers');
- const wheelCallBack = util.browser.chrome ? util.preventPinch : null;
const { naturalEvents } = config.features;
const { smartHandoffs } = config.features;
@@ -272,14 +257,10 @@ class Sidebar extends React.Component {
<div
id="productsHolder"
className="products-holder-case"
- ref={(el) => {
- this.sideBarCase = el;
- }}
style={{
maxHeight,
display: isDistractionFreeModeActive ? 'none' : 'block',
}}
- onWheel={wheelCallBack}
>
{!isCollapsed && (
<>
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index bb9621002..d21015800 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -137,12 +137,6 @@ class Timeline extends React.Component {
// change timescale
this.debounceWheelTime = 60;
-
- // IE11 specific - increase wheel timing to handle performance issues
- if (window.navigator.userAgent.match(/Trident\/7\./)) {
- this.debounceWheelTime = 2500;
- }
-
this.debounceChangeTimeScaleWheel = lodashDebounce(this.throttleChangeTimeScaleWheel, this.debounceWheelTime, throttleSettings);
this.throttleChangeTimeScaleWheelFire = lodashThrottle(this.changeTimeScaleScroll, 200, throttleSettings);
diff --git a/web/js/feedback.js b/web/js/feedback.js
deleted file mode 100644
index e9afb833c..000000000
--- a/web/js/feedback.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/* global feedback */
-
-/* The feedback global variable is defined by
- * https://fbm.earthdata.nasa.gov/for/worldview/feedback.js
- * which is included via config.scripts in web/config/wv.json
-*/
-import util from './util/util';
-
-export default function feedbackUi() {
- const self = {};
- let feedbackInit = false;
-
- self.showFeedback = function() {
- if (!util.browser.small && window.feedback) {
- if (!feedbackInit) {
- feedback.init({
- showIcon: false,
- });
- }
- feedback.showForm();
- feedbackInit = true;
- } else {
- window.location.href = 'mailto:@MAIL@?subject=Feedback for @LONG_NAME@ tool';
- }
- };
- return self;
-}
diff --git a/web/js/main.js b/web/js/main.js
index ad4cf050a..9522be9d7 100644
--- a/web/js/main.js
+++ b/web/js/main.js
@@ -1,10 +1,8 @@
/* global DEBUG */
-// IE11 corejs polyfills container
-import 'core-js/stable';
+// polyfills
import 'elm-pep';
import 'regenerator-runtime/runtime';
-// IE11 corejs polyfills container
-import 'whatwg-fetch';
+// polyfills
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
diff --git a/web/js/map/util.js b/web/js/map/util.js
index 3bf10188c..dc46c0fab 100644
--- a/web/js/map/util.js
+++ b/web/js/map/util.js
@@ -12,7 +12,7 @@ const ZOOM_DURATION = 250;
* @param {Object} map - OpenLayers Map Object
* @param {number} amount - Direction and
* amount to zoom
- * @param {number} duation - length of animation
+ * @param {number} duration - length of animation
* @param {array} center - point to center zoom
*
* @returns {void}
diff --git a/web/js/modules/feedback/util.js b/web/js/modules/feedback/util.js
index 6c8d6f862..b15c1415b 100644
--- a/web/js/modules/feedback/util.js
+++ b/web/js/modules/feedback/util.js
@@ -1,16 +1,11 @@
/* global feedback */
-
/* The feedback global variable is defined by
* https://fbm.earthdata.nasa.gov/for/worldview/feedback.js
* which is included via config.scripts in web/config/wv.json
*/
-import util from '../../util/util';
-
-export default function onClickFeedback(wasInitiated) {
- if (!util.browser.small && window.feedback) {
- // eslint-disable-next-line no-restricted-globals
- event.preventDefault();
+export default function onClickFeedback(wasInitiated, isMobile) {
+ if (!isMobile && window.feedback) {
if (!wasInitiated) {
feedback.init({
showIcon: false,
diff --git a/web/js/modules/palettes/reducers.js b/web/js/modules/palettes/reducers.js
index 8ed3fdbca..8bd01dc40 100644
--- a/web/js/modules/palettes/reducers.js
+++ b/web/js/modules/palettes/reducers.js
@@ -16,16 +16,13 @@ import {
SET_DISABLED_CLASSIFICATION,
} from './constants';
import { INIT_SECOND_LAYER_GROUP } from '../layers/constants';
-import util from '../../util/util';
-const { browser } = util;
export const defaultPaletteState = {
rendered: {},
custom: {},
active: {},
activeB: {},
isLoading: {},
- supported: !(browser.ie || !browser.webWorkers || !browser.cors),
};
export function getInitialPaletteState(config) {
const rendered = lodashGet(config, 'palettes.rendered') || {};
diff --git a/web/js/modules/palettes/selectors.js b/web/js/modules/palettes/selectors.js
index cf610ba3b..d5276b8cc 100644
--- a/web/js/modules/palettes/selectors.js
+++ b/web/js/modules/palettes/selectors.js
@@ -7,7 +7,7 @@ import {
cloneDeep as lodashCloneDeep,
} from 'lodash';
import update from 'immutability-helper';
-import { getMinValue, getMaxValue, isSupported } from './util';
+import { getMinValue, getMaxValue } from './util';
/**
* Gets a single colormap (entries / legend combo)
@@ -498,9 +498,6 @@ function prepare(layerId, palettesObj, state) {
}
export function isPaletteAllowed(layerId, config) {
- if (!isSupported()) {
- return false;
- }
const { palette } = config.layers[layerId];
if (!palette || palette.immutable) {
return false;
diff --git a/web/js/modules/palettes/util.js b/web/js/modules/palettes/util.js
index e090c1c20..16d0075c3 100644
--- a/web/js/modules/palettes/util.js
+++ b/web/js/modules/palettes/util.js
@@ -221,11 +221,6 @@ export function parseLegacyPalettes(
return stateFromLocation;
}
-export function isSupported() {
- const { browser } = util;
- return !(browser.ie || !browser.webWorkers || !browser.cors);
-}
-
/**
* Serialize palette info for layer
*
@@ -339,9 +334,6 @@ const createPaletteAttributeObject = function(def, value, attrObj, count) {
*/
export function loadPalettes(permlinkState, state) {
let stateArray = [{ stateStr: 'l', groupStr: 'active' }];
- if (!isSupported()) {
- return state;
- }
if (permlinkState.l1) {
stateArray = [
{ stateStr: 'l', groupStr: 'active' },
diff --git a/web/js/modules/palettes/util.test.js b/web/js/modules/palettes/util.test.js
index afd328c8f..96d3f9d62 100644
--- a/web/js/modules/palettes/util.test.js
+++ b/web/js/modules/palettes/util.test.js
@@ -5,7 +5,6 @@ import {
loadPalettes,
mapLocationToPaletteState,
} from './util';
-import util from '../../util/util';
import fixtures from '../../fixtures';
const state = fixtures.getState();
@@ -29,11 +28,6 @@ test('hasCustomTypePalette func determines if custom palette is in string', () =
});
test('loadPalettes func updates state with correct palette attributes', () => {
- util.browser = jest.fn(() => ({
- webWorkers: true,
- ie: false,
- cors: true,
- }))();
const updatedState = update(state, {
layers: {
active: {
diff --git a/web/js/util/browser.js b/web/js/util/browser.js
index 04b2910de..93266844b 100644
--- a/web/js/util/browser.js
+++ b/web/js/util/browser.js
@@ -1,177 +1,13 @@
export default (function() {
const self = {};
-
- /**
- * True if Internet Explorer was detected in the user-agent string.
- *
- * @attribute ie
- * @type Boolean
- */
- self.ie = false;
-
- /**
- * True if Safari was detected in the user-agent string.
- *
- * @attribute safari
- * @type Boolean
- */
- self.safari = false;
-
- self.firefox = false;
- self.chrome = false;
-
- /**
- * Major version number of the browser detected in the user-agent string.
- * If the version is not important for Worldview at the moment, this
- * value will be null.
- *
- * @attribute version
- * @type Number
- */
- self.version = null;
-
- /**
- * True if the screen size is small enough (width less than 740px) to
- * require special mobile device behavior.
- *
- * @attribute small
- * @type Boolean
- */
- self.small = false;
- self.constrained = false;
-
- /**
- * True if this browser properly supports cross-origin resource
- * sharing.
- *
- * @attribute cors
- * @type Boolean
- */
- self.cors = true;
-
- /**
- * True if this browser properly supports web workers.
- *
- * @attribute webWorkers
- * @type Boolean
- */
- self.webWorkers = true;
- self.history = true;
- self.touchDevice = false;
- self.mobileDevice = false;
self.mobileAndTabletDevice = false;
- self.mobileWidth = 768;
- self.constrainedHeight = 320;
const init = function() {
- const { tests } = self;
-
- if (tests.safari()) {
- self.safari = true;
- self.version = tests.safariVersion();
- } else if (tests.ie()) {
- self.ie = true;
- self.version = tests.ieVersion();
- } else if (tests.firefox()) {
- self.firefox = true;
- } else if (tests.chrome()) {
- self.chrome = true;
- }
-
- self.cors = tests.cors();
- self.webWorkers = tests.webWorkers();
- self.small = tests.small();
+ self.mobileAndTabletDevice = self.tests.mobileAndTabletDevice();
self.dimensions = self.tests.getWindowDimensions();
- self.history = tests.history();
- self.touchDevice = tests.touchDevice();
- self.mobileDevice = tests.mobileDevice();
- self.mobileAndTabletDevice = tests.mobileAndTabletDevice();
-
- const onResize = function() {
- self.small = tests.small();
- self.constrained = tests.constrained();
- self.dimensions = self.tests.getWindowDimensions();
- };
- window.addEventListener('resize', onResize);
- onResize();
};
- // The following functions should not be used directly. Use the values
- // set in the init function. These functions are useful for testing.
self.tests = {};
-
- self.tests.navigator = function() {
- return navigator;
- };
-
- self.tests.window = function(property) {
- // Some browsers throw an error when attempting to access restricted Window objects
- try {
- return window[property];
- } catch (error) {
- return false;
- }
- };
-
- self.tests.safari = function() {
- const navigator = self.tests.navigator();
- if (/ Chrome\//.test(navigator.userAgent)) {
- return false;
- }
- return / Safari\//.test(navigator.userAgent);
- };
- self.tests.chrome = function() {
- // https://stackoverflow.com/a/9851769
- return !!window.chrome && !!window.chrome.webstore;
- };
-
- self.tests.safariVersion = function() {
- const navigator = self.tests.navigator();
- const version = navigator.userAgent.match(/ Version\/([^ ]+)/);
- if (version) {
- return parseInt(version[1].split('.')[0], 10);
- }
- };
-
- self.tests.ie = function() {
- const navigator = self.tests.navigator();
- if (/MSIE /.test(navigator.userAgent)) {
- return true;
- }
- // IE 11
- return (
- navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)
- );
- };
-
- self.tests.firefox = function() {
- return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
- };
-
- self.tests.touchDevice = function() {
- const el = document.createElement('div');
- el.setAttribute('ontouchstart', 'return;');
- return typeof el.ontouchstart === 'function';
- };
-
- // Detect mobile devices. Based on script here: https://stackoverflow.com/questions/11381673/detecting-a-mobile-browser#answer-11381730
- self.tests.mobileDevice = function() {
- let check = false;
- (function(a) {
- if (
- /(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(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(
- a,
- )
- || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(
- a.substr(0, 4),
- )
- ) {
- check = true;
- }
- }(navigator.userAgent || navigator.vendor || window.opera));
- return check;
- };
-
// Detect mobile and tablet devices. Based on script here: https://stackoverflow.com/questions/11381673/detecting-a-mobile-browser#answer-11381730
self.tests.mobileAndTabletDevice = function() {
let check = false;
@@ -190,50 +26,10 @@ export default (function() {
return check;
};
- self.tests.ieVersion = function() {
- const navigator = self.tests.navigator();
- // FIXME: linter says that the backslash in \d is unnessary which means
- // that this regex is probably wrong.
- var version = navigator.userAgent.match(/MSIE ([\d\.]+)/); //eslint-disable-line
- if (version) {
- return parseInt(version[1].split('.')[0], 10);
- }
- };
-
- self.tests.cors = function() {
- if (self.tests.safari() && self.tests.safariVersion() <= 6) {
- return false;
- }
- return !self.tests.ie();
- };
-
- // TODO: Probably can be removecd
- self.tests.webWorkers = function() {
- return self.tests.window('Worker');
- };
-
- self.tests.small = function() {
- const dim = self.tests.getWindowDimensions();
- // If the dimensions are (0,0), this is not being run in a real browser
- // so assume desktop mode unless otherwise changed.
- if (dim[0] === 0 && dim[1] === 0) {
- return false;
- }
- return self.tests.getWindowDimensions()[0] < self.mobileWidth;
- };
-
self.tests.getWindowDimensions = function() {
return [window.innerWidth, window.innerHeight];
};
- self.tests.constrained = function() {
- return self.tests.getWindowDimensions()[1] < self.constrainedHeight;
- };
-
- self.tests.history = function() {
- return window.history && window.history.replaceState;
- };
-
init();
return self;
}({}));
diff --git a/web/js/util/browser.test.js b/web/js/util/browser.test.js
deleted file mode 100644
index 04bffdce4..000000000
--- a/web/js/util/browser.test.js
+++ /dev/null
@@ -1,87 +0,0 @@
-import browser from './browser';
-
-const unmocked = {};
-
-beforeAll(() => {
- unmocked.navigator = browser.tests.navigator;
- unmocked.safari = browser.tests.safari;
- unmocked.safariVersion = browser.tests.safariVersion;
- unmocked.window = browser.tests.window;
- unmocked.getWindowDimensions = browser.tests.getWindowDimensions;
-});
-afterEach(() => {
- browser.tests.navigator = unmocked.navigator;
- browser.tests.safari = unmocked.safari;
- browser.tests.safariVersion = unmocked.safariVersion;
- browser.tests.window = unmocked.window;
- browser.tests.getWindowDimensions = unmocked.getWindowDimensions;
-});
-
-describe('browser', () => {
- const tests = [{
- name: 'safari',
- fn: 'safari',
- answer: true,
- userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10',
- }, {
- name: 'not safari',
- fn: 'safari',
- answer: false,
- userAgent: 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36',
- }, {
- name: 'safari version',
- fn: 'safariVersion',
- answer: 5,
- userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10',
- }, {
- name: 'internet explorer',
- fn: 'ie',
- answer: true,
- userAgent: 'Mozilla/5.0 (MSIE 9.0; Windows NT 6.1; Trident/5.0)',
- }, {
- name: 'not internet explorer',
- fn: 'ie',
- answer: false,
- userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:26.0) Gecko/20100101 Firefox/26.0',
- }];
-
- tests.forEach((t) => {
- test(t.name, () => {
- browser.tests.navigator = () => ({ userAgent: t.userAgent });
- expect(browser.tests[t.fn]()).toEqual(t.answer);
- });
- });
-});
-
-test('cors', () => {
- browser.tests.safari = () => true;
- browser.tests.safariVersion = () => 7;
- expect(browser.tests.cors()).toBe(true);
-});
-
-test('non-working cors on Safari <= 6', () => {
- browser.tests.safari = () => true;
- browser.tests.safariVersion = () => 6;
- expect(browser.tests.cors()).toBe(false);
-});
-
-describe('device sizes', () => {
- const tests = [
- {
- size: [1000, 1000], small: false, constrained: false, name: 'large',
- },
- {
- size: [200, 200], small: true, constrained: true, name: 'small',
- },
- {
- size: [1000, 300], small: false, constrained: true, name: 'constrained',
- },
- ];
- tests.forEach((t) => {
- test(t.name, () => {
- browser.tests.getWindowDimensions = () => t.size;
- expect(browser.tests.small()).toBe(t.small);
- expect(browser.tests.constrained()).toBe(t.constrained);
- });
- });
-});
diff --git a/web/js/util/util.js b/web/js/util/util.js
index 177c7c07d..8088bfd0e 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -34,12 +34,6 @@ export default (function(self) {
}
return value;
};
- self.preventPinch = function(e) {
- if (e.deltaY && !Number.isInteger(e.deltaY)) {
- e.stopPropagation();
- e.preventDefault();
- }
- };
/**
* Creates an object representation of a query string.
*