1// Foundation JavaScript 2// Documentation can be found at: http://foundation.zurb.com/docs 3jQuery(document).ready(function($){ 4 5 if ($(window).width() > 640) { 6 7 $('.grid-item__overlay-link').hover(function(){ 8 $(this).find('.grid-item__description').slideDown(); 9 }, function(){ 10 $(this).find('.grid-item__description').slideUp(); 11 }); 12 13 } 14 15 //prep menus before initializing Foundation 16 $("#mobilenav li ul").each(function() { 17 $(this).addClass("dropdown").css("display","inherit").parent("li").addClass("has-dropdown"); 18 }); 19 $("#primary.micronav li ul").each(function() { 20 $(this).addClass("dropdown").css("display","inherit").parent("li").addClass("has-dropdown"); 21 }); 22 23 24 $("div.buttons p.seeall a.secondary.watch.events.button, div.buttons p.seeall a.secondary.watch.calendar.button").each(function() { 25 // eventsUrl = $("#event-list a.events-button").first().attr("href"); 26 // console.log(eventsUrl); 27 var eventsUrl = $(this).attr("href"); 28 if ($(this).attr("title")) { 29 var eventsCtgy = slugify($(this).attr("title")); 30 if ($("body").data("group")) { 31 var eventsGrp = $("body").data("group"); 32 } else { 33 var eventsGrp = "church"; 34 } 35 eventsUrl = eventsUrl.replace("__categoryslug__",eventsCtgy); 36 eventsUrl = eventsUrl.replace("__groupslug__",eventsGrp); 37 } 38 $(this).attr("href", eventsUrl); 39 }) 40 41$(document).foundation(); 42 43 $('#megamenus li').not('#megamenus li li').each(function() { 44 var mid = $(this).attr("id").split("_"); 45 var children = $(this).find('ul:first > li').length; 46 //console.log(children); 47 $(this).children('ul').first().addClass("medium-block-grid-"+children).attr("data-equalizer","").wrap('<div class="megamenu" id="primary_'+mid[1]+'-menu"><div class="row collapse"><div class="medium-8 medium-offset-4 columns"></div></div></div>'); 48 }); 49 50 $(".full-height").height($(".main").parent().height()); 51 52 ddmegamenu.docinit({ 53 menuid:'primary', 54 fx:'none', 55 hidedelay:300 56 }); 57 58 function slugify(name) { 59 var slug = name.replace(/[^A-Za-z0-9 ]/, ''); 60 slug = slug.replace(" ", "-"); 61 slug = slug.toLowerCase(); 62 return slug; 63 } 64 65 function init() { 66 $('header nav ul li a[rel]').each(function() { 67 var mp = $(this).offset(); //menuposition 68 var tm = $(this).attr("rel"); //targetmenu 69 var mw = $(this).outerWidth(); //menuwidth 70 var bgpos = mp.left + (mw/2) - 33; 71 $('#'+tm).css("background-position",bgpos+"px -2px"); 72 }); 73//var headerheight = $('.header').outerHeight(); 74//$('.megawrapper').each(function() { 75// $(this).css('top',headerheight); 76//}); 77 78/** 79 $("#rotator").addClass("notsticky"); 80 $('.pagetabs').addClass("notsticky"); 81**/ 82 } 83 84 function headcalc() { 85/** 86 var headerheightstart = $('header').outerHeight(); 87 var rotatorheightstart = $('#rotator img').outerHeight(); 88 var tabsheight = $('.pagetabs').outerHeight(); 89 var headerheightnow = headerheightstart; 90 91 if ($(window).width() > 640) { 92 93 scroll = $(window).scrollTop(); 94 95 if (scroll >= 30) { 96 $('header').addClass('short'); 97 $('header').css({'padding-top':'15px','padding-bottom':'15px'}); 98 $('.megawrapper').css('margin-top','-30px'); 99 headerheightnow = $('header').outerHeight(); 100 if(!$('#rotator').length) $('#placeholder').height(headerheightnow); 101 } else { 102 $('header').removeClass('short'); 103 $('header').css('padding','40px 60px'); 104 $('.megawrapper').css('margin-top','0'); 105 if(!$('#rotator').length) $('#placeholder').height(headerheightstart); 106 } 107 108 if (rotatorheightstart) { 109 headerscrolltrigger = rotatorheightstart - headerheightnow; 110 rotatortopmargin = headerheightnow - rotatorheightstart; 111 } else { 112 headerscrolltrigger = headerheightnow; 113 rotatortopmargin = headerheightnow; 114 } 115 116 if (scroll >= (headerscrolltrigger)) { 117 $("#rotator").removeClass("notsticky"); 118 $('.pagetabs').removeClass("notsticky"); 119 } else { 120 $("#rotator").unstick().addClass("notsticky"); 121 $('.pagetabs').unstick().addClass("notsticky"); 122 } 123 124console.log("headerheightnow = "+headerheightnow); 125console.log("headerscrolltrigger = "+headerscrolltrigger); 126 127 if (rotatorheightstart > 0) { 128 if (scroll >= (headerscrolltrigger)) {
129 $('#rotator').css('margin-top',headerheightnow - rotatorheightstart); 130 $('#rotator').addClass('fixed'); 131// $('#placeholder').height(rotatorheightstart + tabsheight); 132 $('#placeholder').height(rotatorheightstart); 133 } 134 if (scroll < (headerscrolltrigger)) { 135 $('#rotator').css('margin-top','0'); 136 $('#rotator').removeClass('fixed'); 137 $('#placeholder').height('0'); 138 } 139 } else { 140 $('#placeholder').height(headerheightstart); 141 } 142 143 if (scroll >= (headerscrolltrigger)) { 144// $('.pagetabs').addClass('fixed'); 145// $('.pagetabs').css('margin-top',headerheightnow); 146 } 147 if (scroll < (headerscrolltrigger)) { 148// $('.pagetabs').css('margin-top', '0'); 149// $('.pagetabs').removeClass('fixed'); 150 } 151 152 } 153**/ 154 } 155 $('.footer-subscribe form input.email').css('width', '100%').css('width', '-=81px'); 156 $(window).on('resize', function(){ 157 $('.footer-subscribe form input.email').css('width', '100%').css('width', '-=81px'); 158 159 var headerheightstart = $('header').outerHeight(); 160 var rotatorheightstart = $('#rotator img').outerHeight(); 161 var tabsheight = $('.pagetabs').outerHeight(); 162 var headerheightnow = headerheightstart; 163 164 //$("#rotator").unstick(); 165 $('.pagetabs').unstick(); 166 167 if (rotatorheightstart) { 168 headerscrolltrigger = rotatorheightstart - headerheightnow; 169 rotatortopmargin = headerheightnow - rotatorheightstart; 170 } else { 171 headerscrolltrigger = headerheightnow; 172 rotatortopmargin = headerheightnow; 173 } 174 175 if ($(window).width() > 640) { 176 scroll = $(window).scrollTop(); 177 if (scroll >= 30) { 178 var rotator_neg_margin = rotatortopmargin; 179 var pagetabs_neg_margin = headerheightnow; 180 } else { 181 var rotator_neg_margin = rotatortopmargin - 50; 182 var pagetabs_neg_margin = headerheightnow - 50; 183 } 184 // $("#rotator").sticky(); 185 // $("#rotator").sticky({topSpacing:rotator_neg_margin}); 186 // $('.pagetabs').sticky({topSpacing:pagetabs_neg_margin}); 187 } 188 189 190 }); 191 $('.header-buttons .service-times-opener').sidr({ 192 name: 'service-times', 193 source: '#service-times', 194 side: 'right', 195 renaming: false, 196 displace:false 197 }); 198 $('.header-buttons .sf-hours-opener').sidr({ 199 name: 'sf-hours', 200 source: '#sf-hours', 201 side: 'right', 202 renaming: false, 203 displace:false 204 }); 205 206 $('.header-buttons .search-results-opener').sidr({ 207 name: 'search-results', 208 source: '#search-results', 209 side: 'right', 210 renaming: false, 211 displace:false 212 }); 213 $('#mobile-navbar-opener').sidr({ 214 name: 'mobile-navbar', 215 source: '#mobile-navbar', 216 side: 'right', 217 renaming: false, 218 displace: true, 219 displace:false 220 }); 221 $('#utility-navbar-opener').sidr({ 222 name: 'mobile-navbar', 223 source: '#mobile-navbar', 224 side: 'right', 225 renaming: false, 226 displace: true, 227 displace:false 228 }); 229 $('#utility-search-opener').sidr({ 230 name: 'mobile-navbar', 231 source: '#mobile-navbar', 232 side: 'right', 233 renaming: false, 234 displace: true, 235 displace:false 236 }); 237 $('#service-times-closer').click(function(e) { 238 e.preventDefault(); 239 $.sidr('close','service-times'); 240 }); 241 $('#sf-hours-closer').click(function(e) { 242 e.preventDefault(); 243 $.sidr('close','sf-hours'); 244 }); 245 $('#search-results-closer').click(function(e) { 246 e.preventDefault(); 247 $.sidr('close','search-results'); 248 }); 249 $('#mobile-navbar-closer').click(function(e) { 250 e.preventDefault(); 251 $.sidr('close','mobile-navbar'); 252 }); 253 $('#tier2 .html.section-title').each(function() { 254 $(this).siblings('.section-title').hide(); 255 $(this).show(); 256 }); 257 phtext = $('.footer-subscribe input.email').attr("placeholder"); 258 $('.footer-subscribe input.email').focus(function() { 259 $(this).attr("placeholder", "[email protected]"); 260 }); 261 $('.footer-subscribe input.email').blur(function() { 262 $(this).attr("placeholder", phtext); 263 }); 264 $('.click-overlay').click(function(e) { 265 e.preventDefault(); 266 $.sidr('close','mobile-navbar'); 267 }); 268 269 270/* 271 $('.sidr li.has-dropdown ul').not('.sidr li.has-dropdown ul ul').hide(); 272 $('.sidr li.has-dropdown a').not('.sidr ul.dropdown li a').on("click", function(e) { 273 $('li.open ul').not(this).slideUp(); 274 $('li.open').not(this).toggleClass('open'); 275 this_submenu = $(this).siblings("ul.dropdown"); 276 this_parentmenu = $(this).parent("li"); 277 if (!$(this_parentmenu).hasClass('open')) { 278 e.preventDefault(); 279 $(this_parentmenu).addClass('open'); 280 $(this_submenu).slideDown(); 281 } else { 282 e.preventDefault(); 283 $(this_parentmenu).removeClass('open'); 284 $(this_submenu).slideUp(); 285 } 286 }); 287*/ 288 289 290 $(window).load(function() { 291 var headerheightstart = $('header').outerHeight(); 292 var rotatorheightstart = $('#rotator img').outerHeight(); 293 var tabsheight = $('.pagetabs').outerHeight(); 294 var headerheightnow = headerheightstart; 295 296 if (rotatorheightstart) { 297 headerscrolltrigger = rotatorheightstart - headerheightnow; 298 rotatortopmargin = headerheightnow - rotatorheightstart; 299 } else { 300 headerscrolltrigger = headerheightnow; 301 rotatortopmargin = headerheightnow; 302 } 303 304 header_dimensions_small = "750-500-0-0."; 305 header_dimensions_med = "1024-450-0-0."; 306 header_dimensions_large = "2048-900-0-0."; 307 308 if ($(window).width() > 640) { 309 scroll = $(window).scrollTop(); 310 if (scroll >= 30) { 311 var rotator_neg_margin = rotatortopmargin; 312 var pagetabs_neg_margin = headerheightnow; 313 } else { 314 var rotator_neg_margin = rotatortopmargin - 50; 315 var pagetabs_neg_margin = headerheightnow - 50; 316 } 317 //$("#rotator").sticky({topSpacing:rotator_neg_margin}); 318 //$('.pagetabs').sticky({topSpacing:pagetabs_neg_margin}); 319 } 320 321 if ($(window).width() >= 1024) { 322 323 //large-up 324 325 $("#rotator .slick .slide img").each(function(e) { 326 var src = $(this).attr("src").replace(/[\d]+-[\d]+-[\d]+-[\d]+\./g, header_dimensions_large); 327 $(this).attr("src", src); 328 }); 329 330 /** 331 } else if ($(window).width() > 640) { 332 333 //medium 334 /** use this size for default 335 $("#rotator .slick .slide img").each(function(e) { 336 var src = $(this).attr("src").replace(/[\d]+-[\d]+-[\d]+-[\d]+\./g, header_dimensions_med); 337 $(this).attr("src", src); 338 }); 339 340 } else { 341 342 //small 343 344 $("#rotator .slick .slide img").each(function(e) { 345 var src = $(this).attr("src").replace(/[\d]+-[\d]+-[\d]+-[\d]+\./g, header_dimensions_small); 346 $(this).attr("src", src); 347 }); 348 **/ 349 } 350 351 $('.stafflist li.member-listing').hover(function() 352 { 353 $(this).addClass('hover'); 354 }, 355 function() 356 { 357 $(this).removeClass('hover'); 358 } 359 ); 360 361 /** 362 $('a[href*="#"]').click(function(e) { 363 //e.preventDefault(); 364 var hash = $(this).attr("href"); 365 var hashName = hash.split("#"); 366 var element; 367 //if element has this id then scroll to it 368 if ($("#"+hashName[1]).length != 0) { 369 element = $("#"+hashName[1]); 370 } 371 //catch cases of links that use anchor name 372 else if ($('a[name="' + hashName[1] + '"]').length != 0) 373 { 374 //just use the first one in case there are multiples 375 element = $('a[name="' + hashName[1] + '"]:first'); 376 } 377 //if we have a target then go to it 378 if (element != undefined) { 379 window.scrollTo(0, element.position().top - headerheightstart); 380 } 381 //unbind the scroll event 382 $(document).unbind("scroll"); 383 384 }); 385 **/ 386 387 $(window).scroll(function() { 388 //headcalc(); 389 }); 390 391 init(); 392 //headcalc(); 393 }); 394 395 window.onresize = init; 396 //$("header").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function() {headcalc()}); 397}); 398/** 399if (window.location.hash) { 400 //bind to scroll function
401 $(document).scroll( function() { 402 var hash = window.location.hash 403 var hashName = hash.substring(1, hash.length); 404 var element; 405 406 //if element has this id then scroll to it 407 if ($(hash).length != 0) { 408 element = $(hash); 409 } 410 //catch cases of links that use anchor name 411 else if ($('a[name="' + hashName + '"]').length != 0) 412 { 413 //just use the first one in case there are multiples 414 element = $('a[name="' + hashName + '"]:first'); 415 } 416 417 //if we have a target then go to it 418 if (element != undefined) { 419 window.scrollTo(0, element.position().top - headerheightstart); 420 } 421 //unbind the scroll event 422 $(document).unbind("scroll"); 423 }); 424} else { 425 426 window.scrollTo(0,0); 427 428} 429**/
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.