$scope.egEmbedFrameLoader = function(iframe) {
$scope.frame = {dom:iframe};
+ $scope.iframe = iframe;
// Reset the iframe height to the final content height.
- $scope.height = $scope.frame.dom.contentWindow.document.body.scrollHeight;
+ $scope.height = $scope.iframe.contentWindow.document.body.scrollHeight;
- var page = iframe.contentWindow.location.href;
+ var page = $scope.iframe.contentWindow.location.href;
console.debug('egEmbedFrameLoader(): ' + page);
// reload ifram page w/o reloading the entire UI
$scope.reload = function() {
- iframe.contentWindow.location.replace(
- iframe.contentWindow.location);
+ $scope.iframe.contentWindow.location.replace(
+ $scope.iframe.contentWindow.location);
}
// tell the iframe'd window its inside the staff client
- iframe.contentWindow.IAMXUL = true;
+ $scope.iframe.contentWindow.IAMXUL = true;
// also tell it it's inside the browser client, which
// may be needed in a few special cases.
- iframe.contentWindow.IAMBROWSER /* hear me roar */ = true;
+ $scope.iframe.contentWindow.IAMBROWSER /* hear me roar */ = true;
// XUL has a dump() function which is occasinally called
// from embedded browsers.
- iframe.contentWindow.dump = function(msg) {
+ $scope.iframe.contentWindow.dump = function(msg) {
console.debug('egEmbedFrame:dump(): ' + msg);
}
+ // Adjust the height again if the iframe loads the openils.Util Dojo module
+ $timeout(function () {
+ if ($scope.iframe.contentWindow.openils && $scope.iframe.contentWindow.openils.Util) {
+
+ // HACK! for patron reg page
+ var e = $scope.iframe.contentWindow.document.getElementById('myForm');
+ var extra = 50;
+
+ // HACK! for vandelay
+ if (!e) {
+ e = $scope.iframe.contentWindow.document.getElementById('vl-body-wrapper');
+ extra = 50;
+ }
+
+ if (!e) {
+ e = $scope.iframe.contentWindow.document.body;
+ extra = 0;
+ }
+
+ $scope.iframe.contentWindow.openils.Util.addOnLoad( function() {
+ var old_height = $scope.height;
+ $scope.height = e.scrollHeight + extra;
+ $scope.$apply();
+ });
+ }
+ });
+
// define a few commonly used stock xulG handlers.
- iframe.contentWindow.xulG = {
+ $scope.iframe.contentWindow.xulG = {
// patron search
spawn_search : function(search) {
open_tab('/circ/patron/search?search='
if ($scope.handlers) {
$scope.handlers.reload = $scope.reload;
angular.forEach($scope.handlers, function(val, key) {
- iframe.contentWindow.xulG[key] = val;
+ $scope.iframe.contentWindow.xulG[key] = val;
});
}