Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* global document */
import browser from 'detect-browser';
if (browser.name === 'ie' && parseInt(browser.version, 10) <= 10) {
const warning = document.getElementById('browser-warning-wrapper');
if (warning) {
warning.className = `${warning.className} browser-warning-wrapper--incompatible`;
}
}
'use strict';
var browser = require('detect-browser');
var compareVersions = require('compare-versions')
var capabilities = module.exports = {
moz: typeof navigator != 'undefined' && !!navigator.mozGetUserMedia,
browser: browser.name,
browserVersion: browser.version
};
// Mozilla constraings handling
if (capabilities.moz) {
capabilities.constraintsType = (compareVersions(browser.version, '38.0.0') >= 0 ? 'standard' : 'legacy');
}
// Chrome constraints handling
else if (browser.name === 'chrome') {
capabilities.constraintsType = (compareVersions(browser.version, '53.0.0') >= 0 ? 'standard' : 'legacy');
}
// Safari constraints handling
else if (browser.name === 'safari') {
capabilities.constraintsType = (compareVersions(browser.version, '605.1.15') >= 0 ? 'standard' : 'legacy');
}
// Default constraints handling
else {
moz: typeof navigator != 'undefined' && !!navigator.mozGetUserMedia,
browser: browser.name,
browserVersion: browser.version
};
// Mozilla constraings handling
if (capabilities.moz) {
capabilities.constraintsType = (compareVersions(browser.version, '38.0.0') >= 0 ? 'standard' : 'legacy');
}
// Chrome constraints handling
else if (browser.name === 'chrome') {
capabilities.constraintsType = (compareVersions(browser.version, '53.0.0') >= 0 ? 'standard' : 'legacy');
}
// Safari constraints handling
else if (browser.name === 'safari') {
capabilities.constraintsType = (compareVersions(browser.version, '605.1.15') >= 0 ? 'standard' : 'legacy');
}
// Default constraints handling
else {
capabilities.constraintsType = 'legacy';
}
export function isIELowerEquals(version) {
// browserが定義されていないときは未知のブラウザ
if (!browser) return false;
return browser.name === 'ie' && parseInteger(browser.version.substr(0, browser.version.indexOf('.'))) <= version;
}
function isSupportedBrowser () {
if (isBrowser) {
var browser = require('detect-browser')
if (browser.name === 'ie' && parseInt(browser.version.match(/(\d+)./)[1]) <= 10) {
return false
}
return true
}
}
import browser from 'detect-browser'
import MobileDetect from 'mobile-detect'
import { version } from '../../package.json'
const platform = new MobileDetect(window.navigator.userAgent)
const locale = navigator.language || navigator.userLanguage || 'en-us'
const currentLanguage = (() => {
return head(locale.split('-'))
})()
export default {
version,
browser: `${browser.name}:${browser.version}`,
platform: (platform.tablet() || platform.mobile()) ? 'mobile' : 'desktop',
language: currentLanguage,
locale
}
componentDidMount() {
this.setState({
browser: browser.name,
usingExtension: window.self !== window.top,
version: parseFloat(browser.version)
});
this.getStories();
window.addEventListener("offline", this.toggleConnection);
window.addEventListener("online", this.toggleConnection);
if (window.location.hostname !== "localhost") {
ReactGA.initialize("UA-43808769-9");
ReactGA.pageview("pageview");
}
}
export const deviceDetect = function ({ dispatch, state }) {
function getDeviceType () {
var useragent = window.navigator.userAgent;
var mobileDetect = new MobileDetect(useragent);
if (mobileDetect.tablet()) {
return 'tablet';
} else if (mobileDetect.mobile()) {
return 'mobile';
} else {
return 'desktop';
}
}
let device = {
browser: Browser.name,
version: Browser.version,
type: getDeviceType()
};
dispatch('DEVICE', device);
};