(function() { var NATURAL_WIDTH = 1600; var NATURAL_HEIGHT = 1620; var MOBILE_THRESHOLD = 768; function applyPyxisGameLayout() { var container = document.getElementById('pyxis-container'); if(container == null) { return; } var mobile = document.getElementById('pyxis-mobile'); var iframe = document.getElementById('pyxis-frame'); var width = container.offsetWidth; if (width < MOBILE_THRESHOLD) { iframe.style.display = 'none'; mobile.style.display = 'flex'; return; } iframe.style.display = 'block'; mobile.style.display = 'none'; var scale = Math.min(1, width / NATURAL_WIDTH); iframe.style.transform = 'scale(' + scale + ')'; iframe.width = NATURAL_WIDTH; iframe.height = NATURAL_HEIGHT; container.style.height = Math.ceil(NATURAL_HEIGHT * scale) + 'px'; } window.addEventListener('resize', applyPyxisGameLayout); applyPyxisGameLayout(); })();