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