Sha256: d062bd96ce490b2c4f39e70cdf6b8ca9d45edfa12f926a97a3ab56b82e8c6545

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

<script>
  window.Cobot = window.Cobot || {};
  window.Cobot.iframeResize = function(height) {
    if(window.top != window) {
      window.parent.postMessage(JSON.stringify({frameHeight: height || window.Cobot.iframeHeight()}), '*');
    }
  };

  window.Cobot.iframeHeight = window.Cobot.iframeHeight || function() {
    return document.body.offsetHeight;
  };

  if(window.top != window) {
    window.addEventListener('load', function() {
      window.Cobot.iframeResize();
    });
  }

  window.Cobot.scrollTop = 0;
  window.addEventListener('message', function(message) {
    try {
      var data = JSON.parse(message.data);
      if(data.scrollTop) {
        window.Cobot.scrollTop = data.scrollTop;
      }
    } catch(e) {
      // invalid json, ignore
    }
  }, false);
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cobot_client-1.3.0 app/views/cobot_client/_resize_script.html.erb