github.com/hobbeswalsh/terraform@v0.3.7-0.20150619183303-ad17cf55a0fa/website/source/assets/javascripts/docs.js (about)

     1  (function(){
     2  
     3  var Init = {
     4  
     5    start: function(){ 
     6      var classname = this.hasClass(document.body, 'page-sub');
     7  
     8      if (classname) {
     9        this.addEventListeners();
    10      }
    11    },
    12  
    13    hasClass: function (elem, className) {
    14      return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');
    15    },
    16  
    17    addEventListeners: function(){
    18      var _this = this;
    19      //console.log(document.querySelectorAll('.navbar-static-top')[0]);
    20      window.addEventListener('resize', _this.resizeImage, false);
    21  
    22      this.resizeImage();
    23    },
    24  
    25    resizeImage: function(){
    26  
    27      var header = document.getElementById('header'),
    28          footer = document.getElementById('footer-wrap'),
    29          main = document.getElementById('main-content'),
    30          vp = window.innerHeight,
    31          bodyHeight = document.body.clientHeight,
    32          hHeight = header.clientHeight,
    33          fHeight = footer.clientHeight,
    34          withMinHeight = hHeight + fHeight + 830;
    35  
    36      if(withMinHeight >  bodyHeight ){
    37        var newHeight = (vp - (hHeight+fHeight)) + 'px';
    38        main.style.height = newHeight;
    39      }    
    40    }
    41  
    42  };
    43  
    44  Init.start();
    45  
    46  })();