Sha256: 33699fbe680aa09d5c5a38cf078c7fc8f60105f30f03fc6b8c1da967998a7816

Contents?: true

Size: 1.59 KB

Versions: 11

Compression:

Stored size: 1.59 KB

Contents

// ==========================================================================
// Project:   Greenhouse.WebView
// Copyright: ©2010 Mike Ball
// ==========================================================================
/*globals Greenhouse */
/**

  provides access to the iframes memoryspace
  @extends SC.WebView
*/
Greenhouse.WebView = SC.WebView.extend(
/** @scope Greenhouse.WebView.prototype */ {

  iframeDidLoad: function() {
    //fit the iframe to size of the contents.
    if (this.get('shouldAutoResize') === YES){
      var contentWindow;
      var iframeElt = this.$('iframe')[0];
      if(iframeElt && iframeElt.contentWindow){
        contentWindow = iframeElt.contentWindow;
        this.contentWindow = contentWindow;
        if(contentWindow && contentWindow.document && contentWindow.document.documentElement){
          var docElement = contentWindow.document.documentElement;
          // setting the width before the height gives more accurate results..
          // at least for the test iframe content i'm using.
          //TODO: try out document flows other than top to bottom.
          if (!SC.browser.isIE){
            this.$().width(docElement.scrollWidth);
            this.$().height(docElement.scrollHeight);
          } else {
            this.$().width(docElement.scrollWidth + 12);
            this.$().height(docElement.scrollHeight + 5);
          }
        }
      }
    }
    else{
      var iframe = this.$('iframe')[0];
      if(iframe) this.contentWindow = iframe.contentWindow;
    }
    Greenhouse.set('iframe', this.contentWindow);
    Greenhouse.sendAction('iframeLoaded');
  }
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.10.2 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.10.1 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.10.0 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/apps/greenhouse/views/web.js