# leadin/11.0.52/scripts/feedback/ThickBoxModal.ts

HubSpot All-In-One Marketing – Forms, Popups, Live Chat, version 11.0.52. 51 lines.

- Page: https://pluginprobe.com/plugins/leadin/11.0.52/code/scripts/feedback/ThickBoxModal.ts
- Raw: https://pluginprobe.com/plugins/leadin/11.0.52/raw/scripts/feedback/ThickBoxModal.ts
- Modified: 2024-04-11T14:35:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/leadin/11.0.52/code/scripts/feedback/ThickBoxModal.ts#L10-L20`.

```typescript
import $ from 'jquery';
import { domElements } from '../constants/selectors';

export default class ThickBoxModal {
  openTriggerSelector: string;
  inlineContentId: string;
  windowCssClass: string;
  contentCssClass: string;

  constructor(
    openTriggerSelector: string,
    inlineContentId: string,
    windowCssClass: string,
    contentCssClass: string
  ) {
    this.openTriggerSelector = openTriggerSelector;
    this.inlineContentId = inlineContentId;
    this.windowCssClass = windowCssClass;
    this.contentCssClass = contentCssClass;

    $(openTriggerSelector).on('click', this.init.bind(this));
  }

  close() {
    //@ts-expect-error global
    window.tb_remove();
  }

  init(e: Event) {
    //@ts-expect-error global
    window.tb_show(
      '',
      `#TB_inline?inlineId=${this.inlineContentId}&modal=true`
    );
    // thickbox doesn't respect the width and height url parameters https://core.trac.wordpress.org/ticket/17249
    // We override thickboxes css with !important in the css
    $(domElements.thickboxModalWindow).addClass(this.windowCssClass);

    // have to modify the css of the thickbox content container as well
    $(domElements.thickboxModalContent).addClass(this.contentCssClass);

    // we unbind previous handlers because a thickbox modal is a single global object.
    // Everytime it is re-opened, it still has old handlers bound
    $(domElements.thickboxModalClose)
      .off('click')
      .on('click', this.close);

    e.preventDefault();
  }
}

```
