1jQuery(function($){ 2"use strict"; 3var NATIVE = window.NATIVE || {}; 4 5/* ================================================== 6 Contact Form Validations 7================================================== */ 8 NATIVE.ContactForm = function(){ 9 $('.contact-form').each(function(){ 10 var formInstance = $(this); 11 formInstance.submit(function(){ 12 13 var action = $(this).attr('action'); 14 15 $("#message").slideUp(750,function() { 16 $('#message').hide(); 17 18 $('#submit') 19 .after('<img src="images/assets/ajax-loader.gif" class="loader" />') 20 .attr('disabled','disabled'); 21 22 $.post(action, { 23 name: $('#name').val(), 24 email: $('#email').val(), 25 phone: $('#phone').val(), 26 comments: $('#comments').val() 27 }, 28 function(data){ 29 document.getElementById('message').innerHTML = data; 30 $('#message').slideDown('slow'); 31 $('.contact-form img.loader').fadeOut('slow',function(){$(this).remove();}); 32 $('#submit').removeAttr('disabled'); 33 if(data.match('success') !== null){ $('.contact-form').slideUp('slow');} 34 35 } 36 ); 37 }); 38 return false; 39 }); 40 }); 41 }; 42/* ================================================== 43 Responsive Nav Menu 44================================================== */ 45 NATIVE.navMenu = function() { 46 // Responsive Menu Events 47 $(".menu-toggle").on('click',function(){ 48 $(this).toggleClass("opened"); 49 $(".main-menu-wrapper").slideToggle(500); 50 return false; 51 }); 52 $(window).resize(function(){ 53 if($(".menu-toggle").hasClass("opened")){ 54 $(".main-menu-wrapper").css("display","block"); 55 } else { 56 $(".menu-toggle").css("display","none"); 57 } 58 }); 59 }; 60/* ================================================== 61 Scroll to Top 62================================================== */ 63 NATIVE.scrollToTop = function(){ 64 var didScroll = false; 65 66 var $arrow = $('#back-to-top'); 67 68 $arrow.on('click',function(e) { 69 $('body,html').animate({ scrollTop: "0" }, 750, 'easeOutExpo' ); 70 e.preventDefault(); 71 }); 72 73 $(window).scroll(function() { 74 didScroll = true; 75 }); 76 77 setInterval(function() { 78 if( didScroll ) { 79 didScroll = false; 80 81 if( $(window).scrollTop() > 200 ) { 82 $arrow.fadeIn(); 83 } else { 84 $arrow.fadeOut(); 85 } 86 } 87 }, 250); 88 }; 89/* ================================================== 90 Accordion 91================================================== */ 92 NATIVE.accordion = function(){ 93 var accordion_trigger = $('.accordion-heading.accordionize'); 94 95 accordion_trigger.delegate('.accordion-toggle','click', function(event){ 96 if($(this).hasClass('active')){ 97 $(this).removeClass('active'); 98 $(this).addClass('inactive'); 99 } 100 else{ 101 accordion_trigger.find('.active').addClass('inactive'); 102 accordion_trigger.find('.active').removeClass('active'); 103 $(this).removeClass('inactive'); 104 $(this).addClass('active'); 105 } 106 event.preventDefault(); 107 }); 108 }; 109/* ================================================== 110 Toggle 111================================================== */ 112 NATIVE.toggle = function(){ 113 var accordion_trigger_toggle = $('.accordion-heading.togglize'); 114 115 accordion_trigger_toggle.delegate('.accordion-toggle','click', function(event){ 116 if($(this).hasClass('active')){ 117 $(this).removeClass('active'); 118 $(this).addClass('inactive'); 119 } 120 else{ 121 $(this).removeClass('inactive'); 122 $(this).addClass('active'); 123 } 124 event.preventDefault(); 125 }); 126 }; 127/* ================================================== 128 Tooltip 129================================================== */ 130 NATIVE.toolTip = function(){ 131 $('a[data-toggle=tooltip]').tooltip(); 132 }; 133/* ================================================== 134 Twitter Widget 135================================================== */ 136 NATIVE.TwitterWidget = function() { 137 $('.twitter-widget').each(function(){ 138 var twitterInstance = $(this); 139 var twitterTweets = twitterInstance.attr("data-tweets-count") ? twitterInstance.attr("data-tweets-count") : "1"; 140 twitterInstance.twittie({ 141 dateFormat: '%b. %d, %Y', 142 template: '<li><i class="fa fa-twitter"></i> {{tweet}} <span class="date">{{date}}</span></li>', 143 count: twitterTweets, 144 hideReplies: true 145 }); 146 }); 147 }; 148/* ================================================== 149 Flex Slider 150================================================== */ 151 NATIVE.FlexSlider = function() { 152 $('.flexslider').each(function(){ 153 var carouselInstance = $(this); 154 var carouselAutoplay = carouselInstance.attr("data-autoplay") === 'yes' ? true : false, 155 carouselPagination = carouselInstance.attr("data-pagination") === 'yes' ? true : false, 156 carouselArrows = carouselInstance.attr("data-arrows") === 'yes' ? true : false, 157 carouselDirection = carouselInstance.attr("data-direction") ? carouselInstance.attr("data-direction") : "horizontal", 158 carouselStyle = carouselInstance.attr("data-style") ? carouselInstance.attr("data-style") : "fade", 159 carouselSpeed = carouselInstance.attr("data-speed") ? carouselInstance.attr("data-speed") : "5000", 160 carouselPause = carouselInstance.attr("data-pause") === 'yes' ? true : false;
161 162 carouselInstance.flexslider({ 163 animation: carouselStyle, 164 easing: "swing", 165 direction: carouselDirection, 166 slideshow: carouselAutoplay, 167 slideshowSpeed: carouselSpeed, 168 animationSpeed: 600, 169 initDelay: 0, 170 randomize: false, 171 pauseOnHover: carouselPause, 172 controlNav: carouselPagination, 173 directionNav: carouselArrows, 174 prevText: "", 175 nextText: "", 176 pauseOnAction: false 177 }); 178 }); 179 }; 180/* ================================================== 181 PrettyPhoto 182================================================== */ 183 NATIVE.PrettyPhoto = function() { 184 $("a[data-rel^='prettyPhoto']").prettyPhoto({ 185 opacity: 0.5, 186 social_tools: "", 187 deeplinking: false 188 }); 189 }; 190/* ================================================== 191 Nivo Slider 192================================================== */ 193 NATIVE.NivoSlider = function() { 194 $('.nivoslider').each(function(){ 195 var nivoInstance = $(this); 196 var nivoAutoplay = nivoInstance.attr("data-autoplay") === 'no' ? true : false, 197 nivoPagination = nivoInstance.attr("data-pagination") === 'yes' ? true : false, 198 nivoArrows = nivoInstance.attr("data-arrows") === 'yes' ? true : false, 199 nivoThumbs = nivoInstance.attr("data-thumbs") === 'yes' ? true : false, 200 nivoEffect = nivoInstance.attr("data-effect") ? nivoInstance.attr("data-effect") : "random", 201 nivoSlices = nivoInstance.attr("data-slices") ? nivoInstance.attr("data-slices") : "15", 202 nivoanimSpeed = nivoInstance.attr("data-animSpeed") ? nivoInstance.attr("data-animSpeed") : "500", 203 nivopauseTime = nivoInstance.attr("data-pauseTime") ? nivoInstance.attr("data-pauseTime") : "3000", 204 nivoPause = nivoInstance.attr("data-pauseonhover") === 'yes' ? true : false; 205 206 nivoInstance.nivoSlider({ 207 effect: nivoEffect, 208 slices: nivoSlices, 209 animSpeed: nivoanimSpeed, 210 pauseTime: nivopauseTime, 211 directionNav: nivoArrows, 212 controlNav: nivoPagination, 213 controlNavThumbs: nivoThumbs, 214 pauseOnHover: nivoPause, 215 manualAdvance: nivoAutoplay 216 }); 217 }); 218 }; 219/* ================================================== 220 PrettyPhoto 221================================================== */ 222 NATIVE.PrettyPhoto = function() { 223 $("a[data-rel^='prettyPhoto']").prettyPhoto({ 224 opacity: 0.5, 225 social_tools: "", 226 deeplinking: false 227 }); 228 }; 229/* ================================================== 230 Animated Counters 231================================================== */ 232 NATIVE.Counters = function() { 233 $('.counters').each(function () { 234 $(".timer .count").appear(function() { 235 var counter = $(this).html(); 236 $(this).countTo({ 237 from: 0, 238 to: counter, 239 speed: 2000, 240 refreshInterval: 60, 241 }); 242 }); 243 }); 244 }; 245/* ================================================== 246 SuperFish menu 247================================================== */ 248 NATIVE.SuperFish = function() { 249 $('.sf-menu').superfish({ 250 delay: 200, 251 animation: {opacity:'show', height:'show'}, 252 speed: 'fast',
253 cssArrows: false, 254 disableHI: true 255 }); 256 $(".navigation > ul > li:has(ul)").find("a:first").append(" <i class='fa fa-angle-down'></i>"); 257 $(".navigation > ul > li > ul > li:has(ul)").find("a:first").append(" <i class='fa fa-angle-right'></i>"); 258 }; 259/* ================================================== 260 IsoTope Portfolio 261================================================== */ 262 NATIVE.IsoTope = function() { 263 $("ul.sort-source").each(function() { 264 265 var source = $(this); 266 var destination = $("ul.sort-destination[data-sort-id=" + $(this).attr("data-sort-id") + "]"); 267 268 if(destination.get(0)) { 269 270 $(window).on('load',function() { 271 272 destination.isotope({ 273 itemSelector: ".grid-item", 274 layoutMode: 'sloppyMasonry' 275 }); 276 277 source.find("a").on('click',function(e) { 278 279 e.preventDefault(); 280 281 var $this = $(this), 282 filter = $this.parent().attr("data-option-value"); 283 284 source.find("li.active").removeClass("active"); 285 $this.parent().addClass("active"); 286 287 destination.isotope({ 288 filter: filter 289 }); 290 291 if(window.location.hash !== "" || filter.replace(".","") !== "*") { 292 self.location = "#" + filter.replace(".",""); 293 } 294 295 return false; 296 297 }); 298 299 $(window).bind("hashchange", function(e) { 300 301 var hashFilter = "." + location.hash.replace("#",""), 302 hash = (hashFilter === "." || hashFilter === ".*" ? "*" : hashFilter); 303 304 source.find("li.active").removeClass("active"); 305 source.find("li[data-option-value='" + hash + "']").addClass("active"); 306 307 destination.isotope({ 308 filter: hash 309 }); 310 311 }); 312 313 var hashFilter = "." + (location.hash.replace("#","") || "*"); 314 315 var initFilterEl = source.find("li[data-option-value='" + hashFilter + "'] a"); 316 317 if(initFilterEl.get(0)) { 318 source.find("li[data-option-value='" + hashFilter + "'] a").click(); 319 } else { 320 source.find("li:first-child a").click(); 321 } 322 323 }); 324 325 } 326 327 }); 328 $(window).on('load',function() { 329 var IsoTopeCont = $(".isotope-grid"); 330 IsoTopeCont.isotope({ 331 itemSelector: ".grid-item", 332 layoutMode: 'sloppyMasonry' 333 }); 334 if ($(".grid-holder").length > 0){ 335 var $container_blog = $('.grid-holder'); 336 $container_blog.isotope({ 337 itemSelector : '.grid-item' 338 }); 339 340 $(window).resize(function() { 341 var $container_blog = $('.grid-holder'); 342 $container_blog.isotope({ 343 itemSelector : '.grid-item' 344 }); 345 }); 346 } 347 }); 348 }; 349/* ================================================== 350 Sticky Navigation 351================================================== */ 352 NATIVE.StickyNav = function() { 353 if($("body").hasClass("boxed")){ 354 return false; 355 } 356 if ($(window).width() > 992){ 357 $(".main-menu-wrapper").sticky({topSpacing:0}); 358 } 359 360 var didScroll = false; 361 362 var $menu = $('.site-header'); 363 364 $(window).scroll(function() { 365 didScroll = true; 366 }); 367 368 setInterval(function() { 369 370 if( $(window).scrollTop() > 20 ) { 371 $menu.addClass('sticky-header'); 372 } else { 373 $menu.removeClass('sticky-header'); 374 } 375 }, 250); 376 }; 377/* ================================================== 378 Init Functions 379================================================== */ 380$(document).ready(function(){ 381 NATIVE.ContactForm(); 382 NATIVE.scrollToTop(); 383 NATIVE.accordion(); 384 NATIVE.toggle(); 385 NATIVE.toolTip(); 386 NATIVE.navMenu(); 387 NATIVE.TwitterWidget(); 388 NATIVE.FlexSlider(); 389 NATIVE.NivoSlider(); 390 NATIVE.PrettyPhoto(); 391 NATIVE.SuperFish(); 392 NATIVE.Counters(); 393 NATIVE.IsoTope(); 394 NATIVE.StickyNav(); 395}); 396 397 398// FITVIDS 399$(".container").fitVids(); 400 401// Pages Design Functions 402 403// Event Listing Height Calculation 404$(".events-listing .item").each(function(){ 405 var eventHeight = $(this).height(); 406 $(this).find(".to-event-url").css("height",eventHeight); 407}); 408$(window).resize(function(){ 409 $(".events-listing .item").each(function(){ 410 var eventHeight = $(this).height(); 411 $(this).find(".to-event-url").css("height",eventHeight); 412}); 413}); 414// Centering the dropdown menus 415$(".navigation ul li").mouseover(function() { 416 var the_width = $(this).find("a").width(), 417 child_width = $(this).find("ul").width(), 418 width = parseInt((child_width - the_width)/2); 419 $(this).find("ul").css('left', -width); 420}); 421// Image Hover icons for gallery items 422$(window).on('load',function(){ 423$(".format-image").each(function(){ 424 $(this).find(".media-box").append("<span class='zoom'><i class='fa fa-search'></i></span>"); 425}); 426$(".format-standard").each(function(){ 427 $(this).find(".media-box").append("<span class='zoom'><i class='fa fa-plus'></i></span>"); 428}); 429$(".format-video").each(function(){ 430 $(this).find(".media-box").append("<span class='zoom'><i class='fa fa-play'></i></span>"); 431}); 432$(".format-link").each(function(){ 433 $(this).find(".media-box").append("<span class='zoom'><i class='fa fa-link'></i></span>"); 434}); 435$(".media-box .zoom").each(function(){ 436 var mpwidth = $(this).parent().width(), 437 mpheight = $(this).parent().find("img").height(); 438 439 $(this).css("width", mpwidth); 440 $(this).css("height", mpheight); 441 $(this).css("line-height", mpheight+"px"); 442}); 443}); 444$(window).resize(function(){ 445 $(".media-box .zoom").each(function(){ 446 var mpwidth = $(this).parent().width(), 447 mpheight = $(this).parent().find("img").height(); 448 449 $(this).css("width", mpwidth); 450 $(this).css("height", mpheight); 451 $(this).css("line-height", mpheight+"px"); 452 }); 453 if ($(window).width() > 992){ 454 $(".main-menu-wrapper").css("display","block"); 455 } else { 456 $(".main-menu-wrapper").css("display","none"); 457 } 458}); 459// List Styles 460$('ul.checks li').prepend('<i class="fa fa-check"></i> '); 461$('ul.angles li, .nav-list-primary li a, .widget ul > li > a:first-child').prepend('<i class="fa fa-angle-right"></i> '); 462$('ul.inline li').prepend('<i class="fa fa-check-circle-o"></i> '); 463$('ul.chevrons li').prepend('<i class="fa fa-chevron-right"></i> '); 464$('ul.carets li').prepend('<i class="fa fa-caret-right"></i> '); 465$('a.external').prepend('<i class="fa fa-external-link"></i> '); 466 467// Featured Event Widget 468$(".featured_event_widget").find(".sidebar-widget-title h3").prepend("<span class='featured-star'><i class='fa fa-star'></i></span>"); 469$(".featured_event_widget").find("h4.featured-event-title a").append(" <i class='fa fa-caret-right'></i>"); 470$(".featured_event_widget").has("img.featured-event-image").find(".featured-event-time").css("position","absolute"); 471 472//Donation Modal 473$(".donate-paypal").on('click',function(){ 474 var CauseName = $(this).parents(".cause-item").find("h3").html(); 475 $(".payment-to-cause").html(CauseName); 476}); 477$('select[name="donation amount"]').change(function(){ 478 if ($(this).val() === "Custom") 479 { 480 $('.custom-donate-amount').show(); 481 $('input[name="Custom Donation Amount"]').focus(); 482 } 483 else 484 { 485 $('.custom-donate-amount').hide(); 486 } 487}); 488 489// Initialize Audio Player (MediaElement.js) 490if ($('.audio-player').length) { 491 // Initialize audio player 492 var audio_player = new MediaElementPlayer( '.audio-player' ); 493 // Make player responsive 494 $( ".audio-player" ).css( 'max-width', '100%' ); 495 // Hide after delay keeps progress bar showing when switch from video 496 setTimeout( function() { 497 // Snap volume into place on first load 498 $(window).trigger('resize'); 499 if ($('.video-container').length) { 500 $('.audio-container').hide(); 501 } 502 // Show audio player if #play-audio has in URL 503 if (window.location.hash === '#play-audio') { 504 $('.video-container').hide(); // hide video 505 $('.audio-container').show(); 506 } 507 }, 500 ); 508 // Snap volume control back into place after resize 509 $(window).bind('load debouncedresize', function() { 510 $('.mejs-time-rail').width( $('.mejs-time-rail').width() - 2 ); 511 }); 512} 513// Play Video Link 514$('.play-video-link').on('click',function(event) { 515 event.preventDefault(); 516 var video_url = $(this).attr('href'); 517 var video_container = $('.video-container'); 518 // have video URL and place to stick it 519 if (video_url && video_container) { 520 // get video embed code and change autoplay to 1 521 var embed_code = video_container 522 .html() 523 .replace('autoplay=0', 'autoplay=1'); 524 // have good code 525 if (embed_code) { 526 // stop and hide audio player 527 var audio_container = $('.audio-container'); 528 if (audio_container.length) { // if there is audio 529 audio_player.pause(); 530 audio_container.hide(); 531 } 532 // replace embed code and show 533 video_container 534 .html(embed_code) 535 .show(); 536 } 537 } 538}); 539// Play Audio Link 540$('.play-audio-link').on('click',function(event) { 541 event.preventDefault(); 542 // hide video player 543 $('.video-container').hide(); 544 // stop video player 545 // get embed code and replace autoplay=1 with 0, then overwrite the HTML (this effectively stops video without API) 546 var video_container = $('.video-container'); 547 if (video_container.length) { // if there is video 548 var embed_code = video_container 549 .html().replace('autoplay=1', 'autoplay=0'); // same for YouTube and Vimeo 550 video_container.html(embed_code); 551 } 552 // show and play audio player 553 $('.audio-container').show(); 554 audio_player.pause(); 555 audio_player.play(); 556 // Snap volume into place on first load 557 $(window).trigger('resize'); 558}); 559 560// FrontPage Time Counter 561var expiryDate = $('#counter').data('date'); 562var target = new Date(expiryDate),
563finished = false, 564availiableExamples = { 565 set15daysFromNow: 15 * 24 * 60 * 60 * 1000, 566 set5minFromNow : 5 * 60 * 1000, 567 set1minFromNow : 1 * 60 * 1000 568}; 569function callback(event) { 570 var $this = $(this); 571 switch(event.type) { 572 case "seconds": 573 case "minutes": 574 case "hours": 575 case "days": 576 case "weeks": 577 case "daysLeft": 578 $this.find('div span#'+event.type).html(event.value); 579 if(finished) { 580 $this.fadeTo(0, 1); 581 finished = false; 582 } 583 584 break; 585 case "finished": 586 $this.fadeTo('slow', .5); 587 finished = true; 588 break; 589 } 590} 591$('#counter').countdown(target.valueOf(), callback); 592 593// Animation Appear 594$("[data-appear-animation]").each(function() { 595 596 var $this = $(this); 597 598 $this.addClass("appear-animation"); 599 600 if(!$("html").hasClass("no-csstransitions") && $(window).width() > 767) { 601 602 $this.appear(function() { 603 604 var delay = ($this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1); 605 606 if(delay > 1){ $this.css("animation-delay", delay + "ms");} 607 $this.addClass($this.attr("data-appear-animation")); 608 609 setTimeout(function() { 610 $this.addClass("appear-animation-visible"); 611 }, delay); 612 613 }, {accX: 0, accY: -150}); 614 615 } else { 616 617 $this.addClass("appear-animation-visible"); 618 } 619}); 620// Animation Progress Bars 621$("[data-appear-progress-animation]").each(function() { 622 623 var $this = $(this); 624 625 $this.appear(function() { 626 627 var delay = ($this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1); 628 629 if(delay > 1){ $this.css("animation-delay", delay + "ms");} 630 $this.addClass($this.attr("data-appear-animation")); 631 632 setTimeout(function() { 633 634 $this.animate({ 635 width: $this.attr("data-appear-progress-animation") 636 }, 1500, "easeOutQuad", function() { 637 $this.find(".progress-bar-tooltip").animate({ 638 opacity: 1 639 }, 500, "easeOutQuad"); 640 }); 641 642 }, delay); 643 644 }, {accX: 0, accY: -50}); 645 646}
646); 647 648// Parallax Jquery Callings 649if(!Modernizr.touch) { 650 $(window).bind('load', function () { 651 parallaxInit(); 652 }); 653} 654function parallaxInit() { 655 $('.parallax1').parallax("50%", 0.1); 656 $('.parallax2').parallax("50%", 0.1); 657 $('.parallax3').parallax("50%", 0.1); 658 $('.parallax4').parallax("50%", 0.1); 659 $('.parallax5').parallax("50%", 0.1); 660 $('.parallax6').parallax("50%", 0.1); 661 $('.parallax7').parallax("50%", 0.1); 662 $('.parallax8').parallax("50%", 0.1); 663 /*add as necessary*/ 664} 665 666// Window height/Width Getter Classes 667var wheighter = $(window).height(), 668wwidth = $(window).width(); 669$(".wheighter").css("height",wheighter); 670$(".wwidth").css("width",wwidth); 671$(window).resize(function(){ 672 wheighter = $(window).height(); 673 wwidth = $(window).width(); 674 $(".wheighter").css("height",wheighter); 675 $(".wwidth").css("width",wwidth); 676}); 677});
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.