1(function($) { 2 3 'use strict'; 4 5 var $dc = $(document), 6 $wd = $(window), 7 $ht = $('html'), 8 $bd = $('body'), 9 $hb = $('html, body'), 10 $hd = $('.header'), 11 $ft = $('footer'), 12 $tp = $('.top'), 13 $nv = $('#navicon'); 14 15 16 /** Utility vars **/ 17 var wdTop = $wd.scrollTop(), 18 wdWas = wdTop; 19 $wd.on('load resize scroll', function() { 20 wdWas = wdTop; 21 wdTop = $wd.scrollTop(); 22 }); 23 24 function goingDown() { 25 return wdTop > wdWas; 26 } 27 28 /** Scroll to **/ 29 var $scrollto = $('[data-scrollto]'); 30 $scrollto.each(function() { 31 var $this = $(this), 32 target = $this.data('scrollto') || body, 33 $target = $(target); 34 35 if ($target.length) { 36 $this.on('click', function (e) { 37 e.preventDefault(); 38 $hb.animate({ 39 scrollTop: $target.offset().top - 100 40 }, 500); 41 }); 42 } 43 }); 44 45 var wdScroll, 46 wdScrollNow = $wd.scrollTop(); 47 $wd.on('load scroll', function() { 48 wdScroll = $wd.scrollTop(); 49 50 if (!$hd.hasClass('sticky') && wdScroll > 50) { 51 $hd.addClass('sticky') 52 } else if ($hd.hasClass('sticky') && wdScroll <= 50) { 53 $hd.removeClass('sticky') 54 } 55 56 if (!$tp.hasClass('up') && wdScroll > 200) { 57 $tp.addClass('up'); 58 $tp.fadeIn(); 59 } else if ($tp.hasClass('up') && wdScroll <= 200) { 60 $tp.removeClass('up'); 61 $tp.fadeOut(); 62 } 63 64 wdScrollNow = wdScroll; 65 }); 66 67 $('#search_btn').click(function(es) { 68 es.preventDefault(); 69 if($('#search').hasClass("showsit")){ 70 $('#search').slideUp(200).removeClass("showsit"); 71 $('#search_btn').removeClass('shown'); 72 } else { 73 $('#search').slideDown(300).addClass("showsit"); 74 $('#search_btn').addClass('shown'); 75 $('#s').focus(); 76 } 77 return false; 78 }); 79 80 $('#menu_btn').on({click:function(e) { 81 e.preventDefault(); 82 //var docH = $(document).height(); 83 $('#mobile_menu .menu_flow').css({'overflow-y':'auto'}); 84 $('#mobile_menu').fadeIn(600); // ({height: docH}, 600); 85 $('#mobile_menu .closeMobileMenu').css({display:'block'}); 86 $('#menu_btn').fadeOut(300); 87 $('body').css({'overflow-y':'hidden','position':'fixed'}); 88 $('body').addClass('mm'); 89 } 90 }); 91 92 $('.menu-item-has-children > a').on({click:function(e) { 93 e.preventDefault(); 94 $(this).parent().find('.sub-menu').slideToggle(); 95 } 96 }); 97 98 $('#mobile_menu .closeMobileMenu').on({click:function(e) { 99 e.preventDefault(); 100 $('#mobile_menu').fadeOut(); 101 $('#mobile_menu .closeMobileMenu').fadeOut(); 102 $('#menu_btn').fadeIn(600); 103 $('#mobile_menu').fadeOut(400); // ({height:'0'}, 300); 104 $('body').css({'overflow-y':'auto','position':'static'}); 105 $('body').removeClass('mm'); 106 } 107 }); 108 109 $('.wp-block-image a').on({click:function(e) { 110 e.preventDefault(); 111 var img = $(this).attr('href'); 112 var alt = $(this).find('img').attr('alt'); 113 $('#lightbox .modal-content').append('<img src="'+img+'" alt="">'); 114 $('#lightbox').show(); 115 } 116 }); 117 118 $('#lightbox .close').on({click:function(e) { 119 e.preventDefault(); 120 $('#lightbox').hide(); 121 $('#lightbox .modal-content img').remove(); 122 } 123 }); 124 125 $('.latest_buzz .gfield.gfield_contains_required input').focus(function() { 126 $(this).closest('.gfield').find('label.gfield_label').addClass('focus'); 127 }); 128 129 $('.latest_buzz .gfield.gfield_contains_required input').blur(function() { 130 if ( !$(this).val() ) { 131 $(this).closest('.gfield').find('label.gfield_label').removeClass('focus'); 132 } 133 }); 134 135 $(document).on('click', '.whr-title a', function(e) { 136 e.preventDefault(); 137 var url = $(this).attr('href'); console.log(url); 138 window.open(url, '_blank'); 139 }); 140 141 /** Sticky social sharer **/ 142 var $sharer = $('.sticky-social-nav'), 143 $sharerParent = $('.sharer-parent'), 144 $stickyBottom = $('#sticky-end').length ? $('#sticky-end') : $sharerParent; 145 $(function() { 146 if ($sharer.length && $sharerParent.length) { 147 var sBottom = parseFloat($stickyBottom.offset().top + $stickyBottom.outerHeight(true)), 148 bSpacing = parseFloat(parseFloat($bd.outerHeight(true) + $ft.outerHeight()) - sBottom); 149 $wd.on('scroll resize', function() { 150 sBottom = parseFloat($stickyBottom.offset().top + $stickyBottom.outerHeight(true));
151 bSpacing = parseFloat($bd.outerHeight(true) - sBottom); 152 }); 153 154 $sharer.sticky({ 155 bottomSpacing: bSpacing + 100 156 }); 157 158 var stickyTimer; 159 $wd.on('resize', function() { 160 clearTimeout(stickyTimer); 161 stickyTimer = setTimeout(function() { 162 $sharer.unstick(); 163 setTimeout(function() { 164 $sharer.sticky({ 165 bottomSpacing: bSpacing + 100 166 }); 167 }, 50); 168 169 }, 100); 170 }); 171 } 172 }); 173 174 175 /** Navicon **/ 176 $nv.on('click keydown', function(e) { 177 e.preventDefault(); 178 if (e.keyCode === 13 || e.type === 'click') { 179 if (!$ht.hasClass('menu-mobile')) { 180 $ht.addClass('menu-mobile menu-styled'); 181 } else { 182 closeMobileMenu(); 183 } 184 } 185 }); 186 187 $dc.on('click', function(e) { 188 if ($ht.hasClass('menu-mobile')) { 189 if (e.target.id !== 'header' && !$(e.target).parents('#header').length) { 190 closeMobileMenu(); 191 } 192 } 193 }); 194 195 $wd.on('load resize', function() { 196 if (!$nv.is(':visible') && $ht.hasClass('menu-mobile')) { 197 closeMobileMenu(); 198 } 199 }); 200 201 202 function closeMobileMenu() { 203 $ht.addClass('header-fixed'); 204 $ht.removeClass('menu-styled'); 205 setTimeout(function() { 206 $ht.removeClass('menu-mobile'); 207 }, 300); 208 } 209 210 211 /** Modals **/ 212 var $contentModal = $('#content-modal'), 213 $contentModals = $('#content-modal .modal-items'); 214 215 var $currentContentModal = ''; 216 217 var $modalLinks = $('[data-modal]'), 218 $newsletterLink = $('.trigger-newsletter-form'); 219 $modalLinks.each(function() { 220 var $link = $(this), 221 type = 'content', 222 modal = $link.data('modal') || false; 223 224 if (modal !== false) { 225 226 $link.on('click', function() { 227 if (type !== 'content') { 228 229 } else { 230 openContentModal(modal); 231 } 232 }); 233 } 234 }); 235 236 $newsletterLink.on('click', function(e) { 237 e.preventDefault(); 238 openContentModal('newsletter-modal'); 239 }); 240 241 $dc.on('click', '#close-content-modal', function(e) { 242 e.preventDefault(); 243 closeContentModal(); 244 }); 245 246 $contentModal.on('click', function(e) { 247 if (!$(e.target).hasClass('modal-item') && !$(e.target).parents('.modal-item').length) { 248 closeContentModal(); 249 } 250 }); 251 252 function openContentModal(modal) { 253 $currentContentModal = $('#content-modal .modal-item#' + modal); 254 if (!$currentContentModal.length) return false; 255 $ht.addClass('open-content-modal'); 256 $currentContentModal.addClass('active'); 257 } 258 259 function closeContentModal() { 260 $ht.addClass('close-content-modal'); 261 setTimeout(function() { 262 $(this).attr('style', ''); 263 $ht.removeClass('open-content-modal close-content-modal'); 264 $contentModals.removeClass('active'); 265 }, 300); 266 } 267 268 269 /** Survey modal **/ 270 var $surveyLinks = $('.trigger-survey-form'), 271 $surveyModal = $('#survey-modal'), 272 $surveyForm = $('form'); 273 $surveyLinks.on('click', function(e) { 274 e.preventDefault(); 275 $ht.addClass('open-survey-modal'); 276 setTimeout(function() { 277 $ht.addClass('anim-survey-modal'); 278 }, 100); 279 }); 280 281 $dc.on('click', '#close-survey-modal', function(e) { 282 e.preventDefault(); 283 closeSurveyModal(); 284 }); 285 286 var $surveyQuestions = $('.survey-question:not(.survey-complete)'), 287 $surveyLabels = $('.survey-question label'), 288 $surveyOptions = $('.survey-question input[type="radio"]'); 289 $surveyOptions.each(function(i, e) { 290 var $this = $(this), 291 $parent = $this.parents('.survey-question') || false, 292 $sibling = $parent ? $parent.next() : false; 293 294 if ($sibling.length) { 295 $this.on('click keydown', function(e) { 296 if (e.which === 13 || e.type === 'click') { 297 $surveyQuestions.removeClass('active'); 298 $sibling.addClass('active'); 299 if ($sibling.hasClass('survey-complete')) { 300 $('form#aetna-survey-form').submit(); 301 } 302 } 303 }); 304 } 305 }); 306 307 $surveyLabels.on('click keydown', function(e) { 308 if (e.which === 13 || e.type === 'click') { 309 $(this).parents('.question-options').find('input[type="radio"]').prop('checked', false); 310 $(this).find('input[type="radio"]').prop('checked', true); 311 } 312 }); 313 314 $surveyQuestions.each(function(id, el) { 315 var $this = $(this); 316
317 var $counter = $('<div class="question-counter" />'), 318 $current = $('<span class="question-current" />'), 319 $total = $('<span class="question-total" />'); 320 321 322 var i = id + 1, 323 current = i < 10 ? '0' + i : i, 324 total = $surveyQuestions.length < 10 ? '0' + $surveyQuestions.length : $surveyQuestions.length; 325 326 $counter.html('<span class="question-title">Question</span>'); 327 $counter.append($current.html(current)); 328 $counter.append($total.html(total)); 329 330 $this.prepend($counter); 331 }); 332 333 $surveyForm.on('submit', function(e) { 334 // e.preventDefault(); 335 }); 336 337 function closeSurveyModal() { 338 $ht.addClass('close-survey-modal'); 339 setTimeout(function() { 340 $(this).attr('style', ''); 341 $ht.removeClass('open-survey-modal anim-survey-modal close-survey-modal'); 342 }, 300); 343 } 344 345})(jQuery); 346 347 348function lg( _msg, _txt ) { 349 var txt = _txt || 'Log'; 350 console.log( txt + ':', _msg ); 351}
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.