diff --git a/ckan/public/base/javascript/modules/data-viewer.js b/ckan/public/base/javascript/modules/data-viewer.js index dedf1e24d39..f928ed1c0d3 100644 --- a/ckan/public/base/javascript/modules/data-viewer.js +++ b/ckan/public/base/javascript/modules/data-viewer.js @@ -5,7 +5,7 @@ this.ckan.module('data-viewer', function (jQuery) { options: { timeout: 200, minHeight: 400, - padding: 42 + padding: 30 }, initialize: function () { @@ -21,37 +21,17 @@ this.ckan.module('data-viewer', function (jQuery) { if (this.el.attr('src').substring(0, loc.length) === loc) { this._recalibrate(); setInterval(function() { - if (!self.el.is(':animated')) { - self._recalibrate(); - } + self._recalibrate(); }, this.options.timeout); } else { - this.el.animate({height: 600}, 600); + this.el.css('height', 600); } }, - _showDebugInfo: function() { - var iframe = this.el; - console.log('================='); - console.log($(iframe.get(0), window.top.document).contents().find('body')[0].scrollHeight); - console.log($(iframe.get(0).contentWindow.document).height()); - console.log($(iframe.get(0).contentWindow.document.body).height()); - console.log($(iframe.contents().height())); - console.log($(iframe.contents().innerHeight())); - console.log($(iframe.contents().find('html').height())); - console.log($(iframe.contents().find('body').height())); - console.log($(iframe.contents().find('body').innerHeight())); - }, - _recalibrate: function() { - // save reference to this to use in timeout - var self = this; - var height = self.el.contents().find('body').height(); - height = Math.max(height, self.options.minHeight); - var deltaHeight = height - (self.el.height() - self.options.padding); - if (deltaHeight > 1 || deltaHeight < -10) { - self.el.animate({height: height+self.options.padding}, Math.min(700, height*2)); - } + var height = this.el.contents().find('body').outerHeight(true); + height = Math.max(height, this.options.minHeight); + this.el.css('height', height + this.options.padding); }, // firefox caches iframes so force it to get fresh content