open the modal window
777125
function() {
    
    // make sure the modal viewer and other options are off just in case
    modalViewer.close();

    // note it's turned on in the viewer
    DataSaver.updateValue('modalActive', 'true');
    modalViewer.active = true;

    // add an active class to the button that matches this template
    $('#sg-t-'+modalViewer.template+' .sg-checkbox').addClass('active');

    //Add active class to modal
    $('#sg-modal-container').addClass('active');
    
    // show the modal
    modalViewer.show();
    
  }
911177
public function init()
	{
		if (!isset($this->htmlOptions['id'])) {
			$this->htmlOptions['id'] = $this->getId();
		}

		if ($this->autoOpen === false && !isset($this->options['show'])) {
			$this->options['show'] = false;
		}

		$classes = array('modal');

		if ($this->fade === true) {
			$classes[] = 'fade';
		}

		if (!empty($classes)) {
			$classes = implode(' ', $classes);
			if (isset($this->htmlOptions['class'])) {
				$this->htmlOptions['class'] .= ' ' . $classes;
			} else {
				$this->htmlOptions['class'] = $classes;
			}
		}
		echo CHtml::openTag('div', $this->htmlOptions);
	}
480769
public function run()
    {
        $options = array_merge([
            'value' => $this->url,
            'data-modal-id' => $this->modalId,
        ], $this->options);

        ModalButtonAsset::register(Yii::$app->controller->getView());
        Html::addCssClass($options, ['class' => 'show-modal-button']);

        if ('button' == $this->type) {
            return Html::button($this->label, $options);
        }

        if ('link' == $this->type) {
            return Html::a($this->label, false, $options);
        }
    }
482012
function() {
			var self = this;
			var modal_wrapper = $( '#' + self.scope.id );

			// CB: before_close
			self.options.before_close.call(self, modal_wrapper);

			if (self.xhr !== null){
				self.xhr.abort();
				self.xhr = null;
			}

			// Now we close the modal
			if (self.options.animation === 'none' ){
				modal_wrapper.addClass('modaal-start_none');
			}

			// Close with fade
			if (self.options.animation === 'fade') {
				modal_wrapper.addClass('modaal-start_fade');
			}

			// Close with slide up (using initial slide down)
			if (self.options.animation === 'slide-down') {
				modal_wrapper.addClass('modaal-start_slide_down');
			}

			// CB: after_close and remove
			setTimeout(function() {
				// clone inline content back to origin place
				if (self.options.type == 'inline') {
					$('#' + self.scope.id + ' .modaal-content-container').contents().detach().appendTo( self.scope.source )
				}
				// remove markup from dom
				modal_wrapper.remove();
				// CB: after_close
				self.options.after_close.call(self);
				// scope is now closed
				self.scope.is_open = false;

			}, self.options.after_callback_delay);

			// Call overlay hide
			self.modaal_overlay('hide');

			// Roll back to last focus state before modal open. If was closed programmatically, this might not be set
			if (self.lastFocus != null) {
				self.lastFocus.focus();
			}
		}
355077
public function loadModalContent()
	{
		global $objPage;

		$id = \Input::get('modal');

		if($id == '')
		{
			return;
		}

		$page = \Input::get('page');

		// load layout because we need to initiate bootstrap
		/** @var \PageModel $objPage */
		$objPage = \PageModel::findByPk($page);
		$objPage->loadDetails();

		if($objPage === null)
		{
			$this->log(sprintf('Page ID %s not found', $page), 'Netzmacht\Bootstrap\Ajax::loadModalContent', TL_ERROR);
			exit;
		}

		$objLayout = $this->getPageLayout($objPage);

		// Set the layout template and template group
		$objPage->template = $objLayout->template ?: 'fe_page';
		$objPage->templateGroup = $objLayout->getRelated('pid')->templates;

		// trigger getPageLayout hook so
		if(isset($GLOBALS['TL_HOOKS']['getPageLayout']) && is_array($GLOBALS['TL_HOOKS']['getPageLayout']))
		{
			foreach($GLOBALS['TL_HOOKS']['getPageLayout'] as $hook)
			{
				$this->import($hook[0]);
				$this->{$hook[0]}->{$hook[1]}($objPage, $objLayout, $this);
			}
		}

		$model = \ModuleModel::findOneBy('type="bootstrap_modal" AND tl_module.id', $id);

		if($model === null)
		{
			exit;
		}

		$model->isAjax = true;
		$this->output($this->getFrontendModule($model));
	}
873842
function (id, width)
        {
            ModalDialog.id    = id;
            ModalDialog.width = width;
    
            ModalDialog.ShowBackground();
            ModalDialog.ShowDialog();
    
            // Install the event handlers
            window.onresize = ModalDialog.Resize;
    
            
            // Call them initially
            ModalDialog.Resize();
            
            if (typeof(ModalDialog.onmodaldialog) == 'function') {
                ModalDialog.onmodaldialog();
            }
            ModalDialog.FireCustomEvent('onmodaldialog');
        }
1371027
function () {
            // --------------------------------------------------- destructuring

            var cfg = this._cfg;

            var modal = cfg.modal;
            var waiAria = cfg.waiAria;

            // ------------------------------------------------------ processing

            // refreshParams ---------------------------------------------------

            var refreshParams = {
                section : "__dialog_" + this._domId,
                writerCallback : {
                    fn : this._writerCallback,
                    scope : this
                }
            };

            // popupContainer --------------------------------------------------

            var popupContainer = PopupContainerManager.createPopupContainer(cfg.container);
            this._popupContainer = popupContainer;

            // previouslyFocusedElement ----------------------------------------

            if (modal) {
                this._previouslyFocusedElement = Aria.$window.document.activeElement;
            }

            // optionsBeforeMaximize -------------------------------------------
            // store current options to reapply them when unmaximized

            this._optionsBeforeMaximize = this._createOptionsBeforeMaximize(cfg);

            // section ---------------------------------------------------------

            var section = this._context.getRefreshedSection(refreshParams);

            // popup -----------------------------------------------------------

            var popup = new ariaPopupsPopup();

            this._popup = popup;

            popup.$on({
                "onAfterOpen" : this._onAfterPopupOpen,
                "onEscape" : this._onEscape,
                "onAfterClose" : this._onAfterPopupClose,
                scope : this
            });

            if (cfg.closeOnMouseClick) {
                popup.$on({
                    "onMouseClickClose" : this._onMouseClickClose,
                    scope : this
                });
            }

            popup.open({
                section : section,
                keepSection : true,
                absolutePosition : {
                    left : cfg.xpos,
                    top : cfg.ypos
                },
                center : cfg.center,
                maximized : cfg.maximized,
                offset : cfg.maximized ? this._shadows : this._shadowsZero,
                modal : modal,
                maskCssClass : "xDialogMask",
                popupContainer : popupContainer,
                closeOnMouseClick : cfg.closeOnMouseClick,
                closeOnMouseScroll : false,
                parentDialog : this,
                zIndexKeepOpenOrder : false, // allows to re-order dialogs (dynamic z-index)
                role: modal ? "dialog" : null,
                labelId: modal ? this.__getLabelId() : null,
                waiAria: waiAria
            });

            // hiddenElements --------------------------------------------------

            if (modal && waiAria) {
                var container = popupContainer.getContainerElt();
                this._showBack = DomNavigationManager.hidingManager.hideOthers(popup.domElement, function (element) {
                     return element != null && element !== container;
                });
            }

            // -----------------------------------------------------------------

            // must be registered before we check for _cfg.maximized, to fire the event correctly after overflow change
            ariaTemplatesLayout.$on({
                "viewportResized" : this._onViewportResized,
                scope : this
            });

            // -----------------------------------------------------------------

            // in case when bound "maximized" was toggled while Dialog was not visible
            if (cfg.maximized) {
                this._setContainerOverflow("hidden");
                this._setMaximizedHeightAndWidth();
            }

            this._firstEscapeTime = null;
        }
684607
protected void open() {

        if (!m_enabled) {
            return;
        }
        m_openClose.setDown(true);
        if (m_maxCellWidth == 0) {
            initMaxCellWidth();
        }
        int selectorWidth = m_maxCellWidth;
        // should not be any wider than the actual window
        int windowWidth = Window.getClientWidth();
        if (m_maxCellWidth > windowWidth) {
            selectorWidth = windowWidth - 10;
        }
        // if the resize option is deactivated the popup should not be wider than the selectbox.
        // Default its true.
        if (!m_resizePopup) {
            selectorWidth = m_opener.getOffsetWidth() - 2;
        }
        m_popup.setWidth(selectorWidth + "px");
        m_popup.setWidget(m_selector);
        m_popup.show();

        positionPopup();
    }
791701
function open()
    {
        if (!$this->_opened) {
            $win = $this->_name;
            $styles = $this->_styles;

            if (!empty($this->_ident)) {
                $identHeader = "$win.document.writeln('<th>Ident</th>')";
            } else {
                $identHeader = '';
            }

            echo <<< EOT
<script language="JavaScript">
$win = window.open('', '{$this->_name}', 'toolbar=no,scrollbars,width=600,height=400');
$win.document.writeln('<html>');
$win.document.writeln('<head>');
$win.document.writeln('<title>{$this->_title}</title>');
$win.document.writeln('<style type="text/css">');
$win.document.writeln('body { font-family: monospace; font-size: 8pt; }');
$win.document.writeln('td,th { font-size: 8pt; }');
$win.document.writeln('td,th { border-bottom: #999999 solid 1px; }');
$win.document.writeln('td,th { border-right: #999999 solid 1px; }');
$win.document.writeln('tr { text-align: left; vertical-align: top; }');
$win.document.writeln('td.l0 { $styles[0] }');
$win.document.writeln('td.l1 { $styles[1] }');
$win.document.writeln('td.l2 { $styles[2] }');
$win.document.writeln('td.l3 { $styles[3] }');
$win.document.writeln('td.l4 { $styles[4] }');
$win.document.writeln('td.l5 { $styles[5] }');
$win.document.writeln('td.l6 { $styles[6] }');
$win.document.writeln('td.l7 { $styles[7] }');
$win.document.writeln('</style>');
$win.document.writeln('<script type="text/javascript">');
$win.document.writeln('function scroll() {');
$win.document.writeln(' body = document.getElementById("{$this->_name}");');
$win.document.writeln(' body.scrollTop = body.scrollHeight;');
$win.document.writeln('}');
$win.document.writeln('<\/script>');
$win.document.writeln('</head>');
$win.document.writeln('<body id="{$this->_name}" onclick="scroll()">');
$win.document.writeln('<table border="0" cellpadding="2" cellspacing="0">');
$win.document.writeln('<tr><th>Time</th>');
$identHeader
$win.document.writeln('<th>Priority</th><th width="100%">Message</th></tr>');
</script>
EOT;
            $this->_opened = true;
        }

        return $this->_opened;
    }
1307861
public function bootModal()
    {
        Response::macro('modal', function($title, $body = '', $actions  = [])
        {
            if ($title instanceof FrenchFrogs\Modal\Modal\Modal) {
                $modal = $title->enableRemote();
            } elseif($title instanceof FrenchFrogs\Form\Form\Form) {
                $renderer = configurator()->get('form.renderer.modal.class');
                $modal = $title->setRenderer(new $renderer());
            } else {
                $modal = modal($title, $body, $actions)->enableRemote();
            }

            $modal .= '<script>jQuery(function() {'.js('onload').'});</script>';

            return $modal;
        });
    }
221175
public void show(boolean modal) {
    if (modal) {
      dialog.initModality(Modality.APPLICATION_MODAL);
      dialog.showAndWait();
    } else {
      dialog.initModality(Modality.NONE);
      dialog.show();
    }
  }
122049
function () {
            // --------------------------------------------------- destructuring

            var conf = this.conf;

            var waiAria = conf.waiAria;
            var animateIn = conf.animateIn;

            var domElement = this.domElement;
            var modalMaskDomElement = this.modalMaskDomElement;
            var popupContainer = this.popupContainer;

            // ------------------------------------------------------ processing

            // Ensure that the top left corner is visible
            if (modalMaskDomElement) {
                if (this._containerOverflow == -1) {
                    this._containerOverflow = popupContainer.changeContainerOverflow("hidden");
                }

                // temporarily hides the modal mask so that it does not have an influence on the size of the container
                modalMaskDomElement.style.display = "none";

                // Compute the style after scrollbars are removed from the
                // container. Thus the dialog can be properly centered.
                this._computeAndApplyStyle();

                // only get the container size after having applied the new position of the dialog:
                var containerSize = popupContainer.getScrollSize();

                var modalMaskZIndex = this.modalMaskZIndex;
                if (!modalMaskZIndex) {
                    modalMaskZIndex = this.modalMaskZIndex = this.computedStyle.zIndex;
                } else if (modalMaskZIndex > this.computedStyle.zIndex) {
                    // safety check to not block the full application
                    // this should never happen in normal circumstances
                    this.$logError(this.WRONG_MODALMASK_ZINDEX, [modalMaskZIndex, this.computedStyle.zIndex]);
                    modalMaskZIndex = this.computedStyle.zIndex;
                }

                modalMaskDomElement.style.cssText = [
                    'left:0px;',
                    'top:0px;',
                    'width:', containerSize.width, 'px;',
                    'height:', containerSize.height, 'px;',
                    'z-index:', modalMaskZIndex, ';',
                    'position:absolute;',
                    'display:block;'
                ].join('');

                if (waiAria) {
                    modalMaskDomElement.setAttribute('aria-hidden', 'true');
                }

                if (animateIn) {
                    this._getMaskAnimator().start("fade", {
                        to : modalMaskDomElement,
                        type : 1
                    });
                }

            } else {
                this._computeAndApplyStyle();
            }

            if (animateIn) {
                this._startAnimation(animateIn, {
                    to : domElement,
                    type : 1
                }, false);
            }

            if (ariaCoreBrowser.isIE7 && !this.isOpen) {
                // Without the following line, the autocomplete does not initially display its content on IE7:
                popupContainer.getContainerElt().appendChild(domElement);
            }

            if (modalMaskDomElement && waiAria && popupContainer.getContainerRef() === ariaUtilsDom.VIEWPORT) {
                this._modalNavigationInterceptor.ensureElements();
            }
        }
439133
function(action) {
			var self = this;

			if (action == 'show') {
				// Modal is open so update scope
				self.scope.is_open = true;

				// set body to overflow hidden if background_scroll is false
				if (! self.options.background_scroll) {
					self.dom.addClass('modaal-noscroll');
				}

				// append modaal overlay
				if ($('#' + self.scope.id + '_overlay').length < 1) {
					self.dom.append('<div class="modaal-overlay" id="' + self.scope.id + '_overlay"></div>');
				}

				// now show
				$('#' + self.scope.id + '_overlay').css('background', self.options.background).stop().animate({
					opacity: self.options.overlay_opacity
				}, self.options.animation_speed, function(){
					// now open the modal
					self.modaal_open();
				});

			} else if (action == 'hide') {

				// now hide the overlay
				$('#' + self.scope.id + '_overlay').stop().animate({
					opacity: 0
				}, self.options.animation_speed, function(){
					// remove overlay from dom
					$(this).remove();

					// remove body overflow lock
					self.dom.removeClass('modaal-noscroll');
				});
			}
		}
1039363
public function renderModal()
    {
        $this->_modal = '
        <div class="tooltabmodal modal fade" id="'.$this->getModalId().'" aria-hidden="true" style="display: none; " '. $this->getAttributes() . '>
        	<div class="modal-dialog">
        		<div class="modal-content">
        			<div class="modal-body padding-none">
        				<div class="wizard">
        					<div class="widget widget-tabs widget-tabs-double widget-tabs-responsive margin-none border-none">
                                '. $this->getTabs() .'
                                '. $this->getContents() .'
        					</div>
        				</div>
        			</div>
                    '.$this->getCloseButton().'
        		</div>
        	</div>
        </div>';
        
        return $this->_modal;
    }
895520
protected void open(Element e, boolean fireEvent) {
        this.open = true;
        options.complete = () -> onNativeClose(true, true);
        options.ready = () -> onNativeOpen(fireEvent);
        $(e).openModal(options);
    }
1027333
private static Modal getModal(RootPaneContainer rootPane) {
	synchronized (modals) {
	  Modal modal = modals.get(rootPane);
	  if (modal == null) {
		modal = new Modal(rootPane);
		modals.put(rootPane, modal);
	  }
	  return modal;
	}
  }
269227
public function modal(Modal\Modal $modal)
    {

        $html = '';

        // header
        if ($modal->hasCloseButton()) {
            $html .= html('button', ['type' => 'button', 'class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => $modal->getCloseButtonLabel()], '<span aria-hidden="true">&times;</span>');
        }

        if ($modal->hasTitle()) {
            $html .= html('h4', ['class' => Style::MODAL_HEADER_TITLE_CLASS], $modal->getTitle());
            $html = html('div', ['class' => Style::MODAL_HEADER_CLASS], $html);
        }

        // body
        $html .= html('div', ['class' => Style::MODAL_BODY_CLASS], $modal->getBody());

        // footer
        if ($modal->hasActions()) {

            $actions = '';

            if ($modal->hasCloseButton()) {
                $actions .= html('button', ['type' => 'button', 'class' => 'btn btn-default', 'data-dismiss' => 'modal'], $modal->getCloseButtonLabel());
            }

            foreach ($modal->getActions() as $action) {
                /** @var Element\Button $action */
                $actions .= $this->render('action', $action);
            }

            $html .= html('div', ['class' => Style::MODAL_FOOTER_CLASS], $actions);
        }

        // container
        if (!$modal->isRemote()) {
            $html = html('div', ['class' => Style::MODAL_CONTENT_CLASS, ], $html);
            $html = html('div', ['class' => Style::MODAL_DIALOG_CLASS, 'role' => 'document'], $html);
            $html = html('div', ['class' => Style::MODAL_CLASS,'role' => 'dialog'], $html);
        }

        $html .= html('script', ['type' => 'text/javascript'],js('onload'));

        return $html;
    }