aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/utils/iframe.service.ts
blob: e1ef59f83525bfaff83220df2d0cf438fdad2b94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import {Injectable} from "@angular/core";
import {DialogService} from "ng2-bootstrap-modal";

@Injectable()
export class IframeService {

  addClassOpenModal(elementClassName: string) {
    const parentBodyElement = parent.document.getElementsByClassName(elementClassName)[0];
    if (parentBodyElement) {
      parentBodyElement.classList.add("modal-open");
    }
  }

  removeClassCloseModal(elementClassName: string) {
    const parentBodyElement = parent.document.getElementsByClassName(elementClassName)[0];
    if (parentBodyElement) {
      parentBodyElement.classList.remove("modal-open");
    }
  }

  closeIframe(dialogService: DialogService, that) {
    this.removeClassCloseModal('content');
    dialogService.removeDialog(that);
    setTimeout(() => {
      window.parent.postMessage("closeIframe", "*");
    }, 15);
  }



  addFullScreen() {
    let parentBodyElement = parent.document.getElementsByClassName('service-model-content')[0];
    if (parentBodyElement) {
      parentBodyElement.classList.add("full-screen");
    }
  }

  removeFullScreen() {
    let parentBodyElement = parent.document.getElementsByClassName('service-model-content')[0];
    if (parentBodyElement) {
      parentBodyElement.classList.remove("full-screen");
    }
  }
}