Sha256: 79a8435448e766f5c7b396825f7acf9eedb6d6f1d67ae89407e2d63841f37449

Contents?: true

Size: 1.63 KB

Versions: 7

Compression:

Stored size: 1.63 KB

Contents

// ==========================================================================
// Project:   Greenhouse.WebView
// Copyright: ©2009 My Company, Inc.
// ==========================================================================
/*globals Greenhouse */
/** @class

  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.. 
          // atleast 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

7 entries across 7 versions & 1 rubygems

Version Path
sproutcore-1.4.0.rc.5 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.4.0.rc.4 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.4.0.rc.3 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.4.0.rc.2 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.4.0.rc lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.0.1049.pre.2 lib/frameworks/sproutcore/apps/greenhouse/views/web.js
sproutcore-1.0.1049.pre.1 frameworks/sproutcore/apps/greenhouse/views/web.js