export default {
  getJs: function() {
    return `
      function detectOS() {
        if (navigator.appVersion.indexOf('Win') != -1) return 'Windows';
        else if (navigator.appVersion.indexOf('Mac') != -1) return 'MacOS';
        else if (navigator.appVersion.indexOf('X11') != -1) return 'UNIX';
        else if (navigator.appVersion.indexOf('Linux') != -1) return 'Linux';
        return 'Unknown OS';
      }

      function getBodyScale() {
        var scale = window.innerWidth / document.body.clientWidth;
        if (document.body.clientHeight * scale > window.innerHeight || document.querySelector('html').offsetHeight > window.innerHeight) {
          var osName = detectOS();

          scale = parseFloat(((window.innerWidth - 20) / document.body.clientWidth).toFixed(3));
        }

        return scale;
      }

      function transformPage() {
        var scale = getBodyScale();
        document.body.style.transform = 'scale(' + scale + ')';
        document.body.style.transformOrigin = 'left top';
      }

      window.addEventListener('load', transformPage);
      window.addEventListener('resize', transformPage);

      setTimeout(transformPage, 500);
    `
  }
}
