Sha256: 513bf1f6489a1708f60f8497dfb4d16f42608c7a6ccd55085d613af7831a4436

Contents?: true

Size: 1.62 KB

Versions: 42

Compression:

Stored size: 1.62 KB

Contents

// ==========================================================================
// Project:   Greenhouse.WebView
// Copyright: ©2010 Mike Ball
// ==========================================================================
/*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

42 entries across 42 versions & 2 rubygems

Version Path
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.1 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0-java lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.rc.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.rc.2 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.rc.2-java lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.rc.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.rc.1 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.rc.1-java lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.beta.3-x86-mingw32 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.beta.3-java lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.beta.3 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.beta.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.beta.2-java lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.beta.2 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js
sproutcore-1.6.0.beta.1 lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js