dist/styleguide/js/patternlab-viewer.js
function () {

		// make sure the listener for checkpanels is set-up
		Dispatcher.addListener('insertPanels', modalViewer.insert);

		// add the info/code panel onclick handler
		$('.pl-js-pattern-info-toggle').click(function (e) {
			modalViewer.toggle();
		});

		// make sure the close button handles the click
		$('.pl-js-modal-close-btn').on('click', function (e) {

			// hide any open annotations
			obj = JSON.stringify({
				'event': 'patternLab.annotationsHighlightHide'
			});
			document.querySelector('.pl-js-iframe').contentWindow.postMessage(obj, modalViewer.targetOrigin);

			// hide the viewer
			modalViewer.close();

		});

		// see if the modal is already active, if so update attributes as appropriate
		if (DataSaver.findValue('modalActive') === 'true') {
			modalViewer.active = true;
			$('.pl-js-pattern-info-toggle').html("Hide Pattern Info");
		}

		// make sure the modal viewer is not viewable, it's always hidden by default. the pageLoad event determines when it actually opens
		modalViewer.hide();

		// review the query strings in case there is something the modal viewer is supposed to handle by default
		var queryStringVars = urlHandler.getRequestVars();

		// show the modal if code view is called via query string
		if ((queryStringVars.view !== undefined) && ((queryStringVars.view === 'code') || (queryStringVars.view === 'c'))) {
			modalViewer.queryPattern();
		}

		// show the modal if the old annotations view is called via query string
		if ((queryStringVars.view !== undefined) && ((queryStringVars.view === 'annotations') || (queryStringVars.view === 'a'))) {
			modalViewer.queryPattern();
		}

	}
function () {

		// make sure the listener for checkpanels is set-up
		Dispatcher.addListener('insertPanels', modalViewer.insert);

		// add the info/code panel onclick handler
		$('.pl-js-pattern-info-toggle').click(function (e) {
			modalViewer.toggle();
		});

		// make sure the close button handles the click
		$('.pl-js-modal-close-btn').on('click', function (e) {

			// hide any open annotations
			obj = JSON.stringify({
				'event': 'patternLab.annotationsHighlightHide'
			});
			document.querySelector('.pl-js-iframe').contentWindow.postMessage(obj, modalViewer.targetOrigin);

			// hide the viewer
			modalViewer.close();

		});

		// see if the modal is already active, if so update attributes as appropriate
		if (DataSaver.findValue('modalActive') === 'true') {
			modalViewer.active = true;
			$('.pl-js-pattern-info-toggle').html("Hide Pattern Info");
		}

		// make sure the modal viewer is not viewable, it's always hidden by default. the pageLoad event determines when it actually opens
		modalViewer.hide();

		// review the query strings in case there is something the modal viewer is supposed to handle by default
		var queryStringVars = urlHandler.getRequestVars();

		// show the modal if code view is called via query string
		if ((queryStringVars.view !== undefined) && ((queryStringVars.view === 'code') || (queryStringVars.view === 'c'))) {
			modalViewer.queryPattern();
		}

		// show the modal if the old annotations view is called via query string
		if ((queryStringVars.view !== undefined) && ((queryStringVars.view === 'annotations') || (queryStringVars.view === 'a'))) {
			modalViewer.queryPattern();
		}

	}
function ( ) { // make sure the listener for checkpanels is set-up Dispatcher . addListener ( 'insertPanels' , modalViewer . insert ) ; // add the info/code panel onclick handler $ ( '.pl-js-pattern-info-toggle' ) . click ( function ( e ) { modalViewer . toggle ( ) ; } ) ; // make sure the close button handles the click $ ( '.pl-js-modal-close-btn' ) . on ( 'click' , function ( e ) { // hide any open annotations obj = JSON . stringify ( { 'event' : 'patternLab.annotationsHighlightHide' } ) ; document . querySelector ( '.pl-js-iframe' ) . contentWindow . postMessage ( obj , modalViewer . targetOrigin ) ; // hide the viewer modalViewer . close ( ) ; } ) ; // see if the modal is already active, if so update attributes as appropriate if ( DataSaver . findValue ( 'modalActive' ) === 'true' ) { modalViewer . active = true ; $ ( '.pl-js-pattern-info-toggle' ) . html ( "Hide Pattern Info" ) ; } // make sure the modal viewer is not viewable, it's always hidden by default. the pageLoad event determines when it actually opens modalViewer . hide ( ) ; // review the query strings in case there is something the modal viewer is supposed to handle by default var queryStringVars = urlHandler . getRequestVars ( ) ; // show the modal if code view is called via query string if ( ( queryStringVars . view !== undefined ) && ( ( queryStringVars . view === 'code' ) || ( queryStringVars . view === 'c' ) ) ) { modalViewer . queryPattern ( ) ; } // show the modal if the old annotations view is called via query string if ( ( queryStringVars . view !== undefined ) && ( ( queryStringVars . view === 'annotations' ) || ( queryStringVars . view === 'a' ) ) ) { modalViewer . queryPattern ( ) ; } }
initialize the modal window
initialize the modal window