1(function( $ ) { 2 3/*This is used for the foundation based modal component*/ 4 5function openModal( modalElement, delayValue ) 6{ 7 console.log("in open modal"); 8 /*** check for slider element ***/ 9 var sliderElement = modalElement.find('.presentation-slider'); 10 11 /*** set timeout to load modal on delay if data-delay attr no equal to noDelay ***/ 12 if ( delayValue != 'noDelay' && delayValue != 0) 13 { 14 /*** delay modal opening ***/ 15 console.log("modal is delayed"); 16 delayValue += "000"; 17 setTimeout (function() { 18 modalElement.foundation('open'); 19 if (typeof sliderElement !== 'undefined' && sliderElement != null) { 20 sliderElement.slick("refresh"); 21 } 22 }, delayValue); 23 } 24 else { 25 /*** open modal now ***/ 26 console.log("modal opens now"); 27 modalElement.foundation('open'); 28 if (typeof sliderElement !== 'undefined' && sliderElement != null) { 29 sliderElement.slick("refresh"); 30 } 31 } 32 33} 34 35function createSliderModal( modalElement ) 36{ 37 console.log("in create slider modal"); 38 var sliderElement = modalElement.find('.presentation-slider'); 39 sliderElement.slick({ 40 dots: true, 41 infinite: true, 42 initialSlide: 0, 43 slidesToShow: 1, 44 slidesToScroll: 1, 45 autoplay: true, 46 autoplaySpeed: 3000, 47 arrows: true, 48 nextArrow: '<i class="slick-next fa fa-chevron-circle-right" aria-hidden="true"></i>', 49 prevArrow: '<i class="slick-prev fa fa-chevron-circle-left" aria-hidden="true"></i>' 50 }); 51} 52 53function modalManaged( dashboardModal ) 54{ 55 dashboardModal.foundation('open'); 56} 57 58$(document).ready(function() { 59 $('a[rel=modal]').on('click', function(event){ 60 event.preventDefault(); 61 }); 62 63 var modalLinks = $('a[rel=modal]'); 64 var autoModal = $('.autoModal'); 65 var customCloseModal = $('.customCloseModal'); 66 var customControlModal = $('.customControlModal'); 67 68 if( modalLinks.length > 0) 69 { 70 modalLinks.each(function( index, element ) { 71 72 /*** set needed vars ***/ 73 var linkName = $(this).attr('name'); 74 var modalID = $('#' + linkName); 75 var delayValue = modalID.data('delay'); 76 console.log("modalID = " + modalID.attr('id')); 77 console.log("delayValue = " + delayValue); 78 79 modalID.hasClass( "sliderComp" ) ? createSliderModal( modalID ) : ''; 80 81 /*** check delayValue to see if timeout or autoload needs to be set ***/ 82 if( delayValue != "noDelay") 83 { 84 openModal( modalID, delayValue ); 85 } 86 87 /*** always set click event for modal links - delay or auto opening ***/ 88 $(this).on('click', function(e) 89 { 90 console.log("modal opens on click - " + delayValue); 91 modalID.foundation('open'); 92 if (typeof sliderElement !== 'undefined' && sliderElement != null) { 93 sliderElement.slick("refresh"); 94 } 95 }); 96 97 }); 98 } /*** END modalLlinks check ***/ 99 /*** modals not attached to links ***/ 100 /*** these modals always load thru the delay mechanism even if delay is 0 ***/ 101 else if ( autoModal.length > 0) 102 { 103 var modalID = autoModal.prop('id'); 104 var delayValue = autoModal.data('delay'); 105 console.log("modalID = " + autoModal.prop('id')); 106 console.log("delayValue = " + delayValue); 107 108 autoModal.hasClass( "sliderComp" ) ? createSliderModal( autoModal ) : ''; 109 110 /*** check storage for modal hide params ***/ 111 if ( sessionStorage.getItem("noShowModal") == null || sessionStorage.getItem("noShowModal") == false ) 112 { 113 openModal( autoModal, delayValue ); 114 } 115 116 /*** check if checkbox is checked when modal close button is checked ***/ 117 autoModal.on('closed.zf.reveal', function() { 118 /*** silence modal after close by reseting the iframe src ***/ 119 var videoSrc = $('.videoComponent iframe').attr('src'); 120 $('.videoComponent iframe').attr('src', videoSrc); 121 122 if ( $('#noShow').is(":checked") ) 123 { 124 sessionStorage.setItem("noShowModal", "true"); 125 } 126 else 127 { 128 sessionStorage.removeItem("noShowModal"); 129 } 130 }); 131 132 //openModal( autoModal, delayValue ); 133 134 }/*** END autoModal check ***/ 135 /*** modals with do not display again checked - custom js control ***/ 136 else if ( customCloseModal.length > 0) 137 { 138 /*** DASHBOARD MODALS ***/ 139 var customCloseModal = $('.customCloseModal'); 140 141 /*** check storage for modal hide params ***/ 142 if ( sessionStorage.getItem("noShowModal") == null || sessionStorage.getItem("noShowModal") == false ) 143 { 144 modalManaged( customCloseModal ); 145 } 146 147 /*** check if checkbox is checked when modal close button is checked ***/ 148 customCloseModal.on('closed.zf.reveal', function() { 149 /*** silence modal after close by reseting the iframe src ***/ 150 var videoSrc = $('.videoComponent iframe').attr('src'); 151 $('.videoComponent iframe').attr('src', videoSrc); 152 153 if ( $('#noShow').is(":checked") ) 154 { 155 sessionStorage.setItem("noShowModal", "true"); 156 } 157 else 158 { 159 sessionStorage.removeItem("noShowModal"); 160 } 161 }); 162 }/*** END customCloseModal check ***/ 163 164 /*** modals with remote open custom js control ***/ 165 /*** remote open js must be added in another js file ***/ 166 if ( customControlModal.length > 0) 167 { 168 console.log("IN CUSTOM CONTROL MODAL"); 169 170 /*** DASHBOARD MODALS ***/ 171 var customControlModal = $('.customControlModal'); 172 173 /*** check storage for modal hide params ***/ 174 if ( sessionStorage.getItem("noShowModal") == null || sessionStorage.getItem("noShowModal") == false ) 175 { 176 modalManaged( customControlModal ); 177 } 178 179 /*** check if checkbox is checked when modal close button is checked ***/ 180 customControlModal.on('closed.zf.reveal', function() { 181 /*** silence modal after close by reseting the iframe src ***/ 182 var videoSrc = $('.videoComponent iframe').attr('src'); 183 $('.videoComponent iframe').attr('src', videoSrc); 184 185 if ( $('#noShow').is(":checked") ) 186 { 187 console.log("IN CUSTOM CONTROL NO SHOW"); 188 sessionStorage.setItem("noShowModal", "true"); 189 } 190 else 191 { 192 console.log("IN CUSTOM CONTROL NO SHOW DELETE"); 193 sessionStorage.removeItem("noShowModal"); 194 } 195 }); 196 }/*** END customControlModal check ***/ 197 198}); 199 200})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.