Sha256: 98b0c6ef51a3d8ba6bb727b258eab7815af073b7f78aa08b0fe543599843952f

Contents?: true

Size: 1.56 KB

Versions: 3

Compression:

Stored size: 1.56 KB

Contents

$(document).on("hidden.bs.modal shown.bs.modal shown.bs.tab", resize_iframe);

function resizeIframe(height) {
  //console.log('Resize for AppInstance');
  $('iframe#app_iframe').height(height);
}

let height_prev;
function resize_iframe() {
  if (typeof(hallwayPrefix) !== "undefined" && hallwayPrefix == "") {
    return;
  }
  var height = 0;
  if ($(".modal-dialog").height() + 100 > $("body").height()) {
    height = $(".modal-dialog").height() + 100;
  } else if (
    $(".dropdown-menu.table_visiblity.ui-sortable:visible").height() + 150 >
    $("body").height()
  ) {
    height =
      $(".dropdown-menu.table_visiblity.ui-sortable:visible").height() + 150;
  } else if ($("#canvas").is(":visible")) {
    var canvas_height =
      window.innerHeight -
      ($("#breadcrumbs").height() + $(".green-header").height() + 20);
    $("#canvas").css("height", "500px");
    height = $("body").height();
  } else if ($("#canvas-swimlane").is(":visible")) {
    $("#canvas-swimlane").css("height", "300px");
    height = $("body").height() + $("#task_data").height() - 160;
  } else {
    height = $("body").height() + 25;
  }
  if (height_prev != height) {
    window.parent.postMessage({ func: "resizeIframe", height: height }, "*");
  }
  height_prev = height;
}

// Function to be called from iframe
function receiveMessage(event) {
  if (event.origin !== window.location.origin) return;
  var data = event.data;
  if (typeof window[data.func] == "function") {
    window[data.func].call(null, data.type, data.url);
  } else {
    console.log("Function not found: " + data.func);
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zuora_connect_ui-0.3.1d app/assets/javascripts/zuora_connect_ui/iframe.js
zuora_connect_ui-0.3.1c app/assets/javascripts/zuora_connect_ui/iframe.js
zuora_connect_ui-0.3.1b app/assets/javascripts/zuora_connect_ui/iframe.js