Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(() =>
{
// If Firefox trigger 'forcestreamsupdate' event due to bug:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1347578
if (browser.firefox || browser.gecko)
{
// Not sure, but it thinks that the timeout does the trick.
setTimeout(() => this.emit('forcestreamsupdate'), 500);
}
});
padSize: browser.ios ? 0 : 3,
// In order to prevent fallback tiles from overlapping their children, iOS
// requires smaller zoom levels to be placed below larger zoom levels in
// the CSS 3D coordinate space.
reverseLevelDepth: browser.ios,
// A null transform on the layer element is required so that transitions
// between layers work on iOS.
useNullTransform: browser.ios,
// On Webkit and Gecko browsers, some tiles become invisible at certain
// angles, usually non-floor tiles when looking straight down. Setting the
// translateZ following the perspective transform to a slightly larger value
// than the latter seems to work around this glitch.
perspectiveNudge: browser.webkit || browser.gecko ? 0.001 : 0
};
/**
* @class CssStage
* @extends Stage
* @classdesc
*
* A {@link Stage} implementation using CSS 3D Transforms.
*
* @param {Object} opts
*
* Also see the available {@link Stage} options.
*/
function CssStage(opts) {
hasWebRTC = true;
getUserMedia = virtNavigator.mozGetUserMedia.bind(virtNavigator);
mediaDevices = virtNavigator.mediaDevices;
RTCPeerConnection = virtGlobal.mozRTCPeerConnection;
RTCSessionDescription = virtGlobal.mozRTCSessionDescription;
RTCIceCandidate = virtGlobal.mozRTCIceCandidate;
MediaStreamTrack = virtGlobal.MediaStreamTrack;
attachMediaStream = function (element, stream) {
element.src = URL.createObjectURL(stream);
return element;
};
canRenegotiate = false;
oldSpecRTCOfferOptions = false;
// Modern Firefox desktop, modern Firefox Android.
} else if (
((browser.firefox || browser.gecko) && browserVersion >= 47)
) {
hasWebRTC = true;
getUserMedia = virtNavigator.mozGetUserMedia.bind(virtNavigator);
mediaDevices = virtNavigator.mediaDevices;
RTCPeerConnection = virtGlobal.RTCPeerConnection;
RTCSessionDescription = virtGlobal.RTCSessionDescription;
RTCIceCandidate = virtGlobal.RTCIceCandidate;
MediaStreamTrack = virtGlobal.MediaStreamTrack;
attachMediaStream = function (element, stream) {
element.src = URL.createObjectURL(stream);
return element;
};
canRenegotiate = false;
oldSpecRTCOfferOptions = false;
// WebRTC plugin required. For example IE or Safari with the Temasys plugin.
} else if (
hasWebRTC = true;
getUserMedia = virtNavigator.mozGetUserMedia.bind(virtNavigator);
mediaDevices = virtNavigator.mediaDevices;
RTCPeerConnection = virtGlobal.mozRTCPeerConnection;
RTCSessionDescription = virtGlobal.mozRTCSessionDescription;
RTCIceCandidate = virtGlobal.mozRTCIceCandidate;
MediaStreamTrack = virtGlobal.MediaStreamTrack;
attachMediaStream = function (element, stream) {
element.src = URL.createObjectURL(stream);
return element;
};
canRenegotiate = false;
oldSpecRTCOfferOptions = false;
// Modern Firefox desktop, modern Firefox Android.
} else if (
((browser.firefox || browser.gecko) && browserVersion >= 47)
) {
hasWebRTC = true;
getUserMedia = virtNavigator.mozGetUserMedia.bind(virtNavigator);
mediaDevices = virtNavigator.mediaDevices;
RTCPeerConnection = virtGlobal.RTCPeerConnection;
RTCSessionDescription = virtGlobal.RTCSessionDescription;
RTCIceCandidate = virtGlobal.RTCIceCandidate;
MediaStreamTrack = virtGlobal.MediaStreamTrack;
attachMediaStream = function (element, stream) {
element.src = URL.createObjectURL(stream);
return element;
};
canRenegotiate = false;
oldSpecRTCOfferOptions = false;
// WebRTC plugin required. For example IE or Safari with the Temasys plugin.
} else if (
// import offline runtime
if (process.env.NODE_ENV === "production") {
require("offline-plugin/runtime").install();
}
// import global styles
require("globalStyles/reset.css");
require("globalStyles/main.css");
// Add a warning to Firefox users due to a buggy AudioParam implementation
import browser from "bowser";
if (browser.gecko) {
window.alert(
"WARNING: Firefox currently has a buggy Web Audio API implementation which causes loud pops and clicks, continue at your own risk"
);
}
import React from "react";
import { render } from "react-dom";
import { Provider } from "react-redux";
import Loadable from "react-loadable";
import store from "store";
import AppLayout from "layouts/app";
// TODO: Figure out what to do with react-redux's decpricated lifecyles usage
const AsyncMode = React.unstable_AsyncMode;
function filterUnusedVendorRule (selector) {
if (!(bowser.msedge || bowser.msie) && selector.indexOf('-ms-') > -1) {
return false
}
if (!(bowser.webkit || bowser.msedge || bowser.blink) && selector.indexOf('-webkit-') > -1) {
return false
}
if (!bowser.gecko && selector.indexOf('-moz-') > -1) {
return false
}
return true
}
export default function () {
if (bowser.tablet) {
if ((bowser.webkit || bowser.blink) && document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen();
}
if (bowser.gecko && document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
}
}
}
constructor(props: GameWrapperProps, context: any) {
super(props, context);
let shouldWarn = false;
const ignoreWarning = !!+cookie.get("joust_ludicrous", "0");
if (!ignoreWarning) {
shouldWarn = !(
bowser.webkit ||
(bowser as any).blink ||
bowser.gecko
);
}
this.state = {
warnAboutBrowser: shouldWarn,
};
}