webstaff: Only make the iframe bigger, never smaller
authorMike Rylander <mrylander@gmail.com>
Mon, 27 Apr 2015 16:18:40 +0000 (12:18 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 17:39:17 +0000 (13:39 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/web/js/ui/default/staff/services/eframe.js

index 5ef6fec..e312ba6 100644 (file)
@@ -79,7 +79,8 @@ angular.module('egCoreMod')
                 $scope.iframe = iframe;
 
                 // Reset the iframe height to the final content height.
-                $scope.height = $scope.iframe.contentWindow.document.body.scrollHeight;
+                if ($scope.height < $scope.iframe.contentWindow.document.body.scrollHeight)
+                    $scope.height = $scope.iframe.contentWindow.document.body.scrollHeight;
 
                 var page = $scope.iframe.contentWindow.location.href;
                 console.debug('egEmbedFrameLoader(): ' + page);
@@ -122,11 +123,13 @@ angular.module('egCoreMod')
                             extra = 0;
                         }
 
-                        $scope.iframe.contentWindow.openils.Util.addOnLoad( function() {
-                            var old_height = $scope.height;
-                            $scope.height = e.scrollHeight + extra;
-                            $scope.$apply();
-                        });
+                        if ($scope.height < e.scrollHeight + extra) {
+                            $scope.iframe.contentWindow.openils.Util.addOnLoad( function() {
+                                var old_height = $scope.height;
+                                $scope.height = e.scrollHeight + extra;
+                                $scope.$apply();
+                            });
+                        }
                     }
                 });