blob: e1ef59f83525bfaff83220df2d0cf438fdad2b94 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001import {Injectable} from "@angular/core";
Yoav Schneiderman51d97842020-01-01 10:23:16 +02002import {DialogService} from "ng2-bootstrap-modal";
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03003
4@Injectable()
5export class IframeService {
6
7 addClassOpenModal(elementClassName: string) {
Yoav Schneiderman51d97842020-01-01 10:23:16 +02008 const parentBodyElement = parent.document.getElementsByClassName(elementClassName)[0];
Yoav Schneidermanb51ac2c2020-01-02 14:37:13 +02009 if (parentBodyElement) {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030010 parentBodyElement.classList.add("modal-open");
11 }
12 }
13
14 removeClassCloseModal(elementClassName: string) {
Yoav Schneiderman51d97842020-01-01 10:23:16 +020015 const parentBodyElement = parent.document.getElementsByClassName(elementClassName)[0];
Yoav Schneidermanb51ac2c2020-01-02 14:37:13 +020016 if (parentBodyElement) {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030017 parentBodyElement.classList.remove("modal-open");
18 }
19 }
Ittay Sternf7926712019-07-07 19:23:03 +030020
Yoav Schneidermanb51ac2c2020-01-02 14:37:13 +020021 closeIframe(dialogService: DialogService, that) {
Yoav Schneiderman51d97842020-01-01 10:23:16 +020022 this.removeClassCloseModal('content');
23 dialogService.removeDialog(that);
24 setTimeout(() => {
25 window.parent.postMessage("closeIframe", "*");
26 }, 15);
27 }
28
Ittay Sternf7926712019-07-07 19:23:03 +030029
Yoav Schneidermanb51ac2c2020-01-02 14:37:13 +020030
31 addFullScreen() {
32 let parentBodyElement = parent.document.getElementsByClassName('service-model-content')[0];
33 if (parentBodyElement) {
Ittay Sternf7926712019-07-07 19:23:03 +030034 parentBodyElement.classList.add("full-screen");
35 }
36 }
37
Yoav Schneidermanb51ac2c2020-01-02 14:37:13 +020038 removeFullScreen() {
39 let parentBodyElement = parent.document.getElementsByClassName('service-model-content')[0];
40 if (parentBodyElement) {
Ittay Sternf7926712019-07-07 19:23:03 +030041 parentBodyElement.classList.remove("full-screen");
42 }
43 }
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030044}