1/*global jQuery,google,G_vmlCanvasManager:false */ 2 3/* ================================================== 4 5Custom jQuery functions. 6 7================================================== */ 8 9(function(){ 10 11 // USE STRICT 12 "use strict"; 13 14 ///////////////////////////////////////////// 15 // PAGE FUNCTIONS 16 ///////////////////////////////////////////// 17 18 var page = { 19 init: function () { 20 21 var deviceAgent = navigator.userAgent.toLowerCase(), 22 agentID = deviceAgent.match(/(iphone|ipod|ipad|android|iemobile)/); 23 24 if (agentID) { 25 jQuery('body').addClass("mobile-browser"); 26 } 27 28 // FITVIDS 29 jQuery('.portfolio-items:not(.carousel-items),.blog-items:not(.carousel-items),.single-portfolio,article.type-post,article.type-team,.wpb_video_widget,.infocus-item,.recent-posts,.sidebar,.full-width-detail').fitVids({ ignore: '.no-resize'}); 30 31 // FOOTER BEAM ME UP LINK 32 jQuery('.beam-me-up').on('click', 'a', function(e) { 33 e.preventDefault(); 34 jQuery('body,html').animate({scrollTop: 0}, 800); 35 }); 36 37 jQuery('.modal .close').click(function () { 38 var modal = jQuery(this).parent().parent(), 39 video = modal.find('.modal-body iframe'), 40 videoSource = video.attr("src"); 41 42 video.attr("src",""); 43 video.attr("src",videoSource); 44 }); 45 46 // SMOOTH SCROLL LINKS 47 jQuery('a.smooth-scroll-link').on('click', function(e) { 48 49 var linkHref = jQuery(this).attr('href'); 50 51 if (linkHref.indexOf('#') === 0) { 52 var headerHeight = 0; 53 54 if (jQuery('#mini-header').length > 0) { 55 headerHeight = jQuery('#mini-header').height(); 56 } 57 if (jQuery('#wpadminbar').length > 0) { 58 headerHeight = headerHeight + 28; 59 } 60 61 jQuery('html, body').stop().animate({ 62 scrollTop: jQuery(linkHref).offset().top + spacerHeight - headerHeight - 30 63 }, 1000, 'easeInOutExpo'); 64 65 e.preventDefault(); 66 67 } else { 68 return e; 69 } 70 71 }); 72 73 } 74 }; 75 76 77 ///////////////////////////////////////////// 78 // HEADER 79 ///////////////////////////////////////////// 80 81 var navSearch = jQuery('#nav-search').find('input'), 82 navSearchLink = jQuery('.nav-search-link'), 83 miniHeader = jQuery('#mini-header'), 84 topBarMenu = jQuery('#top-bar-menu'); 85 86 var header = { 87 init: function() { 88 89 header.miniHeaderInit(); 90 91 navSearchLink.on('click', function(e) { 92 if (jQuery('#container').width() > 767 || jQuery('body').hasClass('responsive-fixed')) { 93 e.preventDefault(); 94 navSearch.css('display', 'inline-block').animate({ 95 opacity: 1, 96 width: 140 97 }, 200); 98 navSearch.focus(); 99 } 100 }); 101 102 navSearch.focus(function() { 103 if (jQuery('#container').width() > 767 || jQuery('body').hasClass('responsive-fixed')) { 104 navSearch.css('display', 'inline-block').animate({ 105 opacity: 1, 106 width: 140 107 }, 200); 108 } 109 }); 110 111 navSearch.blur(function() { 112 if (jQuery('#container').width() > 767 || jQuery('body').hasClass('responsive-fixed')) { 113 jQuery(this).animate({ 114 opacity: 0, 115 width: 1 116 }, 200); 117 setTimeout(function() { 118 navSearch.css('display', 'none'); 119 }, 300); 120 } 121 }); 122 123 if (topBarMenu.find('#aux-nav .menu').children('li').length === 0 && topBarMenu.find('div[class*=menu-] ul').children('li').length === 0) { 124 topBarMenu.remove(); 125 jQuery('#top-bar').find('.show-menu').remove(); 126 } 127 128 jQuery(window).scroll(function() { 129 if ((jQuery(this).scrollTop() > 260) && !jQuery('body').hasClass('has-mini-header')) { 130 header.miniHeaderShow(); 131 } else if ((jQuery(this).scrollTop() < 250) && jQuery('body').hasClass('has-mini-header')) { 132 header.miniHeaderHide(); 133 } 134 }); 135 136 }, 137 miniHeaderInit: function() { 138 miniHeader.find('a[title="home"]').html('<i class="icon-home"></i>'); 139 }, 140 miniHeaderShow: function() { 141 jQuery('body').addClass('has-mini-header'); 142 miniHeader.animate({ 143 "top": "0" 144 }, 400); 145 }, 146 miniHeaderHide: function() { 147 jQuery('body').removeClass('has-mini-header'); 148 miniHeader.animate({ 149 "top": "-120" 150 }, 400); 151 } 152 }; 153 154 155 ///////////////////////////////////////////// 156 // NAVIGATION 157 ///////////////////////////////////////////// 158 159 var nav = { 160 init: function() { 161 162 // Add parent class to items with sub-menus 163 jQuery("ul.sub-menu").parent().addClass('parent'); 164 165 // Enable hover dropdowns for window size above tablet width 166 jQuery("nav").find(".menu li.parent").hoverIntent({ 167 over: function() { 168 if (jQuery('#container').width() > 767 || jQuery('body').hasClass('responsive-fixed')) { 169 170 // Setup menuLeft variable, with main menu value 171 var subMenuWidth = jQuery(this).find('ul.sub-menu:first').outerWidth(true); 172 var mainMenuItemWidth = jQuery(this).outerWidth(true); 173 var menuLeft = '-' + (Math.round(subMenuWidth / 2) - Math.round(mainMenuItemWidth / 2)) + 'px'; 174 var menuContainer = jQuery(this).parent().parent().parent(); 175 176 // Check if this is the top bar menu 177 if (menuContainer.hasClass("top-menu")) { 178 if (menuContainer.parent().parent().parent().hasClass("top-bar-menu-right")) { 179 menuLeft = ""; 180 } else { 181 menuLeft = "-1px"; 182 } 183 } 184 185 // Check if second level dropdown 186 if (jQuery(this).find('ul.sub-menu:first').parent().parent().hasClass("sub-menu")) { 187 menuLeft = jQuery(this).find('ul.sub-menu:first').parent().parent().outerWidth(true) - 2; 188 } 189 190 jQuery(this).find('ul.sub-menu:first').css("left", menuLeft); 191 jQuery(this).find('ul.sub-menu:first').css('opacity', 0).slideDown(300).animate({ 192 opacity: 1 193 }, {
194 queue: false, 195 duration: 300 196 }); 197 } 198 }, 199 out:function() { 200 if (jQuery('#container').width() > 767 || jQuery('body').hasClass('responsive-fixed')) { 201 jQuery(this).find('ul.sub-menu:first').slideUp(300); 202 nav.hideNav(jQuery(this).find('ul.sub-menu:first')); 203 } 204 } 205 }); 206 207 208 // Set the current page for each nav if exists 209 var mobileNavToggle = jQuery('.show-menu'); 210 mobileNavToggle.each(function() { 211 var mobileMenu = jQuery(this).next('nav').find('ul.menu'); 212 var menuSelectedText = mobileMenu.find('.current-menu-item:last > a').text(); 213 if (menuSelectedText !== "") { 214 jQuery(this).html(menuSelectedText + '<i class="icon-angle-down"></i>'); 215 } 216 }); 217 218 // Toggle Mobile Nav show/hide 219 mobileNavToggle.on('click', function(e) { 220 e.preventDefault(); 221 jQuery(this).next('nav').find('ul.menu').slideToggle(400); 222 }); 223 224 jQuery(window).smartresize(function(){ 225 if (jQuery('#container').width() > 767 || jQuery('body').hasClass('responsive-fixed')) { 226 var menus = jQuery('nav').find('ul.menu'); 227 menus.each(function() { 228 jQuery(this).css("display", ""); 229 }); 230 } 231 }); 232 233 // Set current language to top bar item 234 var currentLanguage = jQuery('.languages-menu-item').parent().find('.current-language').html(); 235 if (currentLanguage !== "") { 236 jQuery('.languages-menu-item').html(currentLanguage); 237 } 238 239 }, 240 hideNav: function(subnav) { 241 setTimeout(function() { 242 if (subnav.css("opacity") === "0") { 243 subnav.css("display", "none"); 244 } 245 }, 300); 246 } 247 }; 248 249 250 ///////////////////////////////////////////// 251 // FLEXSLIDER FUNCTION 252 ///////////////////////////////////////////// 253 254 var flexSlider = { 255 init: function() { 256 257 jQuery('.item-slider').flexslider({ 258 animation: "slide", //String: Select your animation type, "fade" or "slide" 259 slideDirection: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical" 260 slideshow: true, //Boolean: Animate slider automatically 261 slideshowSpeed: 6000, //Integer: Set the speed of the slideshow cycling, in milliseconds 262 animationDuration: 500, //Integer: Set the speed of animations, in milliseconds 263 smoothHeight: true, 264 directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) 265 controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage 266 keyboardNav: false, //Boolean: Allow slider navigating via keyboard left/right keys 267 mousewheel: false, //Boolean: Allow slider navigating via mousewheel 268 prevText: "Prev", //String: Set the text for the "previous" directionNav item 269 nextText: "Next", //String: Set the text for the "next" directionNav item 270 pausePlay: true, //Boolean: Create pause/play dynamic element 271 pauseText: '', //String: Set the text for the "pause" pausePlay item 272 playText: '', //String: Set the text for the "play" pausePlay item 273 randomize: false, //Boolean: Randomize slide order 274 slideToStart: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide) 275 animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end 276 pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended. 277 pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering 278 controlsContainer: "", //Selector: Declare which container the navigation elements should be appended too. Default container is the flexSlider element. Example use would be ".flexslider-container", "#container", etc. If the given element is not found, the default action will be taken. 279 manualControls: "", //Selector: Declare custom control navigation. Example would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs. 280 start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide 281 before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation 282 after: function(){}, //Callback: function(slider) - Fires after each slider animation completes 283 end: function(){} //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous) 284 }); 285 jQuery('#swift-slider').flexslider({ 286 animation: "slide", //String: Select your animation type, "fade" or "slide" 287 slideDirection: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical" 288 slideshow: true, //Boolean: Animate slider automatically 289 slideshowSpeed: 8000, //Integer: Set the speed of the slideshow cycling, in milliseconds 290 animationDuration: 600, //Integer: Set the speed of animations, in milliseconds 291 directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) 292 controlNav: false, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage 293 keyboardNav: false, //Boolean: Allow slider navigating via keyboard left/right keys 294 mousewheel: false, //Boolean: Allow slider navigating via mousewheel 295 prevText: "Prev", //String: Set the text for the "previous" directionNav item 296 nextText: "Next", //String: Set the text for the "next" directionNav item
297 pausePlay: false, //Boolean: Create pause/play dynamic element 298 animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end 299 pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended. 300 pauseOnHover: true, 301 start: function(postsSlider) { 302 jQuery('.swift-slider-loading').fadeOut(200); 303 postsSlider.slides.eq(postsSlider.currentSlide).addClass('flex-active-slide'); 304 if (postsSlider.slides.eq(postsSlider.currentSlide).has('.flex-caption-large')) { 305 var chart = postsSlider.slides.eq(postsSlider.currentSlide).find('.fw-chart'); 306 if (jQuery('body').hasClass("browser-ie")) { 307 chart = postsSlider.slides.eq(postsSlider.currentSlide).find('.chart'); 308 } 309 chart.each( function() { 310 var countValue = parseInt(jQuery(this).attr('data-count'), 10); 311 jQuery(this).data('easyPieChart').update(80); 312 jQuery(this).find('span').replaceWith("<span>0</span>"); 313 jQuery(this).find('span').animateNumber(countValue); 314 }); 315 } 316 postsSlider.slides.eq(postsSlider.currentSlide).find('.comment-chart:not(.fw-chart) span').replaceWith("<span>0</span>"); 317 }, 318 before: function(postsSlider) { 319 if (postsSlider.slides.eq(postsSlider.currentSlide).has('.flex-caption-large')) { 320 var chart = postsSlider.slides.eq(postsSlider.currentSlide).find('.fw-chart'); 321 if (jQuery('body').hasClass("browser-ie")) { 322 chart = postsSlider.slides.eq(postsSlider.currentSlide).find('.chart'); 323 } 324 chart.each( function() { 325 jQuery(this).data('easyPieChart').update(0); 326 jQuery(this).find('span').replaceWith("<span>0</span>"); 327 }); 328 } 329 setTimeout( function() { 330 postsSlider.slides.eq(postsSlider.currentSlide).addClass('flex-active-slide'); 331 if (postsSlider.slides.eq(postsSlider.currentSlide).has('.flex-caption-large')) { 332 var chart = postsSlider.slides.eq(postsSlider.currentSlide).find('.fw-chart'); 333 if (jQuery('body').hasClass("browser-ie")) { 334 chart = postsSlider.slides.eq(postsSlider.currentSlide).find('.chart'); 335 } 336 chart.each( function() { 337 var countValue = parseInt(jQuery(this).attr('data-count'), 10); 338 jQuery(this).data('easyPieChart').update(80); 339 jQuery(this).find('span').animateNumber(countValue); 340 }); 341 } 342 }, 1000); 343 } 344 }); 345 jQuery('.content-slider').each(function() { 346 var sliderAnimation = jQuery(this).attr('data-animation'); 347 var autoplay = jQuery(this).attr('data-autoplay'); 348 autoplay = ((autoplay === "yes") ? true : false); 349 350 jQuery(this).flexslider({ 351 animation: sliderAnimation, //String: Select your animation type, "fade" or "slide" 352 slideshow: autoplay, //Boolean: Animate slider automatically 353 slideshowSpeed: 6000, //Integer: Set the speed of the slideshow cycling, in milliseconds 354 animationDuration: 1000, //Integer: Set the speed of animations, in milliseconds 355 smoothHeight: true, 356 directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) 357 controlNav: false //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage 358 }); 359 }); 360 361 // LOAD THE LOVE-IT CHARTS 362 jQuery('#swift-slider li').each( function() { 363 jQuery(this).find('.chart').each( function() { 364 jQuery(this).easyPieChart({ 365 animate: 1000, 366 size: 70, 367 barColor: jQuery(this).attr('data-barcolor'), 368 trackColor: 'transparent', 369 scaleColor: false 370 }); 371 jQuery(this).find('span').replaceWith("<span>0</span>"); 372 }); 373 }); 374 375 // CAPTION HOVER ADD/REMOVE CLASSES 376 jQuery('#swift-slider li').hover(function() { 377 jQuery(this).find('.flex-caption-details').removeClass('closing'); 378 jQuery(this).find('.flex-caption-details').addClass('open'); 379 }, function() { 380 jQuery(this).find('.flex-caption-details').addClass('closing');
381 jQuery(this).find('.flex-caption-details').removeClass('open'); 382 }); 383 384 // CAPTION TRANSITION LISTENERS 385 jQuery('.caption-details-inner').on('transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd', function() { 386 var chart = jQuery(this).find('.chart'); 387 if (jQuery(this).parent().hasClass('closing')) { 388 chart.each( function() { 389 jQuery(this).data('easyPieChart').update(0); 390 jQuery(this).find('span').replaceWith("<span>0</span>"); 391 }); 392 jQuery(this).parent().removeClass('closing'); 393 } else if (jQuery(this).parent().hasClass('open')) { 394 chart.each( function() { 395 var countValue = parseInt(jQuery(this).attr('data-count'), 10); 396 jQuery(this).data('easyPieChart').update(80); 397 jQuery(this).find('span').animateNumber(countValue); 398 }); 399 } 400 }); 401 402 }, 403 thumb: function() { 404 jQuery('.thumb-slider').flexslider({ 405 animation: "fade", //String: Select your animation type, "fade" or "slide" 406 slideDirection: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical" 407 slideshow: true, //Boolean: Animate slider automatically 408 slideshowSpeed: 6000, //Integer: Set the speed of the slideshow cycling, in milliseconds 409 animationDuration: 600, //Integer: Set the speed of animations, in milliseconds 410 smoothHeight: true, 411 directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) 412 controlNav: false, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage 413 keyboardNav: false //Boolean: Allow slider navigating via keyboard left/right keys 414 }); 415 } 416 }; 417 418 ///////////////////////////////////////////// 419 // PORTFOLIO 420 ///////////////////////////////////////////// 421 422 var portfolioContainer = jQuery('.portfolio-wrap').find('.filterable-items'); 423 424 var portfolio = { 425 init: function() { 426 427 428 portfolio.standardSetup(); 429 430 // SET ITEM HEIGHTS 431 portfolio.setItemHeight(); 432 433 // PORTFOLIO WINDOW RESIZE 434 jQuery(window).on("debouncedresize", function() { 435 portfolio.windowResized(); 436 }); 437 438 // Enable filter options on when there are items from that skill 439 jQuery('.filtering li').each( function() { 440 var itemCount = 0; 441 var filter = jQuery(this), 442 filterName = jQuery(this).find('a').attr('class'), 443 portfolioItems = jQuery(this).parent().parent().parent().next('.filterable-items'); 444 445 portfolioItems.find('li').each( function() { 446 if ( jQuery(this).hasClass(filterName) ) { 447 filter.addClass('has-items'); 448 itemCount++; 449 } 450 }); 451 452 if (jQuery(this).hasClass('all')) { 453 itemCount = portfolioItems.children('li').length; 454 jQuery(this).find('.item-count').text(itemCount); 455 } else { 456 jQuery(this).find('.item-count').text(itemCount); 457 } 458 }); 459 460 // filter items when filter link is clicked 461 jQuery('.filtering li').on('click', 'a', function(e) { 462 e.preventDefault(); 463 jQuery(this).parent().parent().find('li').removeClass('selected'); 464 jQuery(this).parent().addClass('selected'); 465 var selector = jQuery(this).attr('data-filter'); 466 var portfolioItems = jQuery(this).parent().parent().parent().parent().next('.filterable-items'); 467 portfolioItems.isotope({ filter: selector }); 468 }); 469 470 jQuery('.filter-wrap > a').on('click', function(e) { 471 e.preventDefault(); 472 jQuery(this).parent().find('.filter-slide-wrap').slideToggle(); 473 }); 474 }, 475 standardSetup: function() { 476 portfolioContainer.isotope({ 477 animationEngine: 'best-available', 478 animationOptions: { 479 duration: 300, 480 easing: 'easeInOutQuad', 481 queue: false 482 }, 483 resizable: true, 484 layoutMode: 'fitRows' 485 }); 486 flexSlider.thumb(); 487 portfolioContainer.isotope("reLayout"); 488 }, 489 setItemHeight: function() { 490 if (!portfolioContainer.hasClass('single-column')) { 491 portfolioContainer.children().css('min-height','0'); 492 portfolioContainer.equalHeights(); 493 portfolioContainer.isotope("reLayout"); 494 } 495 }, 496 windowResized: function() { 497 if (!portfolioContainer.hasClass('single-column')) { 498 portfolio.setItemHeight(); 499 } 500 } 501 }; 502 503 504 ///////////////////////////////////////////// 505 // BLOG 506 ///////////////////////////////////////////// 507 508 var blogItems = jQuery('.blog-wrap').find('.blog-items'), 509 masonryPagination = jQuery('.blog-wrap').find('.masonry-pagination'); 510 511 var blog = { 512 init: function() { 513 514 // BLOG ITEM SETUP 515 if (blogItems.hasClass('masonry-items')) { 516 jQuery('.masonry-items').fitVids(); 517 blog.masonrySetup(); 518 blogItems.imagesLoaded(function () { 519 blogItems.animate({opacity: 1}, 800); 520 masonryPagination.fadeIn(1000); 521 blog.masonrySetup(); 522 }); 523 flexSlider.thumb(); 524 blogItems.isotope("reLayout"); 525 526 // BLOG WINDOW RESIZE 527 jQuery(window).smartresize(function(){ 528 blog.windowResized(); 529 }); 530 } else { 531 flexSlider.thumb(); 532 } 533 534 535 // BLOG AUX SLIDEOUT 536 jQuery('.blog-slideout-trigger').on('click', function(e) { 537 e.preventDefault(); 538 539 // VARIABLES 540 var blogWrap = jQuery(this).parent().parent().parent().parent(); 541 var filterPanel = blogWrap.find('.filter-wrap .filter-slide-wrap'); 542 var auxType = jQuery(this).attr('data-aux'); 543 544 // ADD COLUMN SIZE AND REMOVE BRACKETS FROM COUNT 545 blogWrap.find('.aux-list li').addClass('span2'); 546 blogWrap.find('.aux-list li a span').each(function() { 547 jQuery(this).html(jQuery(this).html().replace("(","").replace(")","")); 548 }); 549 550 // IF SELECTING AN OPTION THAT IS OPEN, CLOSE THE PANEL 551 if (jQuery(this).parent().hasClass('selected') && !filterPanel.is(':animated')) { 552 blogWrap.find('.blog-aux-options li').removeClass('selected'); 553 filterPanel.slideUp(400); 554 return; 555 } 556 557 // AUX BUTTON SELECTED STATE 558 blogWrap.find('.blog-aux-options li').removeClass('selected'); 559 jQuery(this).parent().addClass('selected'); 560 561 // IF SLIDEOUT IS OPEN 562 if (filterPanel.is(':visible')) { 563 564 filterPanel.slideUp(400); 565 setTimeout(function() { 566 blogWrap.find('.aux-list').css('display', 'none');
567 blogWrap.find('.aux-'+auxType).css('display', 'block'); 568 filterPanel.slideDown(); 569 }, 600); 570 571 // IF SLIDEOUT IS CLOSED 572 } else { 573 574 blogWrap.find('.aux-list').css('display', 'none'); 575 blogWrap.find('.aux-'+auxType).css('display', 'block'); 576 filterPanel.slideDown(); 577 578 } 579 }); 580 581 }, 582 masonrySetup: function() { 583 blogItems.isotope({ 584 itemSelector : '.blog-item', 585 masonry : { 586 columnWidth : 0 587 }, 588 animationEngine: 'best-available', 589 animationOptions: { 590 duration: 300, 591 easing: 'easeInOutQuad', 592 queue: false 593 }, 594 transformsEnabled: false, 595 resizable: true 596 }); 597 }, 598 windowResized: function() { 599 blogItems.isotope("reLayout"); 600 } 601 }; 602 603 604 ///////////////////////////////////////////// 605 // CAROUSEL FUNCTIONS 606 ///////////////////////////////////////////// 607 608 var carouselWidgets = { 609 init: function() { 610 611 // CAROUSELS 612 var carousel = jQuery('.carousel-items'); 613 614 carousel.each(function() { 615 var carouselInstance = jQuery('#'+jQuery(this).attr('id')); 616 var carouselPrev = carouselInstance.parent().find('.prev'); 617 var carouselNext = carouselInstance.parent().find('.next'); 618 var carouselColumns = parseInt(carouselInstance.attr("data-columns"), 10); 619 620 if (jQuery(window).width() <= 768) { 621 carouselColumns = 2; 622 } 623 624 if (jQuery(window).width() <= 320) { 625 carouselColumns = 1; 626 } 627 628 carouselInstance.imagesLoaded(function () { 629 jQuery(this).carouFredSel({ 630 items : carouselColumns, 631 scroll : { 632 items : 1, 633 easing : "easeOutQuart", 634 duration : 1000, 635 pauseOnHover : true 636 }, 637 auto : { 638 play : false 639 }, 640 prev : { 641 button : carouselPrev, 642 key : "left" 643 }, 644 next : { 645 button : carouselNext, 646 key : "right" 647 }, 648 onCreate : function() { 649 jQuery(this).fadeIn(400, function() { 650 jQuery(this).fitVids(); 651 }); 652 flexSlider.thumb(); 653 carouselWidgets.resizeCarousels(); 654 } 655 }); 656 }); 657 }); 658 659 jQuery(window).smartresize(function() { 660 var carousel = jQuery('.carousel-items'); 661 carousel.trigger("updateSizes"); 662 }); 663 }, 664 resizeCarousels: function() { 665 var carousel = jQuery('.carousel-items'); 666 667 jQuery(window).smartresize(function() { 668 carousel.each(function() { 669 var carouselItem = jQuery(this).find('.carousel-item'); 670 var itemWidth = carouselItem.width() + carouselItem.css('margin-left'); 671 672 carousel.trigger("configuration", { 673 items : { 674 width : itemWidth 675 } 676 }); 677 678 if (carousel.is(':visible')) { 679 if (jQuery(this).parent().hasClass('caroufredsel_wrapper')) { 680 jQuery(this).parent().css('height', jQuery(this).children().first().outerHeight(true) + 1 + 'px'); 681 } 682 } 683 }); 684 }).trigger('resize'); 685 } 686 }; 687 688 689 ///////////////////////////////////////////// 690 // WIDGET FUNCTIONS 691 ///////////////////////////////////////////// 692 693 var widgets = { 694 init: function() { 695 696 // CHARTS 697 if (sfIncluded.hasClass('has-chart')) { 698 jQuery('.chart-shortcode').each(function(){ 699 jQuery(this).easyPieChart({ 700 animate: 1000, 701 lineCap: 'square', 702 lineWidth: jQuery(this).attr('data-linewidth'), 703 size: jQuery(this).attr('data-size'), 704 barColor: jQuery(this).attr('data-barcolor'), 705 trackColor: jQuery(this).attr('data-trackcolor'), 706 scaleColor: false 707 }); 708 }); 709 } 710 711 jQuery('.recent-posts').equalHeights(); 712 713 // RESIZE ASSETS 714 widgets.resizeAssets(); 715 jQuery(window).on("debouncedresize", function() { 716 widgets.resizeAssets(); 717 }); 718 719 // SF TOOLTIPS 720 jQuery('[rel=tooltip]').tooltip(); 721 722 }, 723 resizeAssets: function() { 724 var carousels = jQuery('.carousel-items'); 725 var assets = jQuery('.alt-bg'); 726 var assetWidth = 0; 727 728 if (jQuery('#container').width() < 460 && jQuery('body').hasClass('responsive-fluid')) { 729 assetWidth = jQuery('#container').width() - 40; 730 carousels.find('.carousel-item').each(function() { 731 jQuery(this).css("width", assetWidth + "px"); 732 733 }); 734 } else if (jQuery('#container').width() < 768 && jQuery('body').hasClass('responsive-fluid')) { 735 if (carousels.hasClass('testimonials')) { 736 assetWidth = jQuery('#container').width() - 40; 737 } else { 738 assetWidth = Math.floor(jQuery('#container').width() / 2) - 35; 739 } 740 carousels.find('.carousel-item').each(function() { 741 jQuery(this).css("width", assetWidth + "px"); 742 }); 743 } else if (jQuery('body').hasClass('responsive-fluid')) { 744 carousels.find('.carousel-item').each(function() { 745 jQuery(this).css("width", ""); 746 }); 747 } 748 749 if (jQuery('#container').width() < 768 && jQuery('body').hasClass('responsive-fluid')) { 750 assetWidth = jQuery('#container').width(); 751 assets.each(function() { 752 jQuery(this).css("width", assetWidth + "px"); 753 }); 754 } else { 755 assets.each(function() { 756 jQuery(this).css("width", ""); 757 }); 758 } 759 }, 760 initSkillBars: function() { 761 // SKILL BARS 762 widgets.animateSkillBars(); 763 jQuery(window).scroll(function() { 764 widgets.animateSkillBars(); 765 }); 766 }, 767 animateSkillBars: function() { 768 jQuery('.progress:in-viewport').each(function(){ 769 var progressBar = jQuery(this), 770 progressValue = progressBar.find('.bar').attr('data-value'); 771 if (!progressBar.hasClass('animated')) { 772 progressBar.addClass('animated'); 773 progressBar.find('.bar').animate({ 774 width: progressValue + "%" 775 }, 600, function() { 776 progressBar.find('.bar-text').fadeIn(400); 777 }); 778 } 779 }); 780 }, 781 charts: function() { 782 widgets.animateCharts(); 783 jQuery(window).scroll(function() { 784 widgets.animateCharts(); 785 }); 786 }, 787 animateCharts: function() {
788 jQuery('.chart-shortcode:in-viewport').each(function(){ 789 if (!jQuery(this).hasClass('animated')) { 790 jQuery(this).addClass('animated'); 791 var animatePercentage = parseInt(jQuery(this).attr('data-animatepercent'), 10); 792 jQuery(this).data('easyPieChart').update(animatePercentage); 793 } 794 }); 795 } 796 }; 797 798 799 ///////////////////////////////////////////// 800 // TEAM MEMBERS FUNCTION 801 ///////////////////////////////////////////// 802 803 var teamMembers = { 804 init: function() { 805 // TEAM EQUAL HEIGHTS 806 var team = jQuery('.team-members'); 807 team.imagesLoaded(function () { 808 jQuery('.team-members').equalHeights(); 809 }); 810 811 // TEAM ASSETS 812 jQuery(window).on("debouncedresize", function() { 813 jQuery('.team-members').children().css('min-height','0'); 814 jQuery('.team-members').equalHeights(); 815 }); 816 } 817 }; 818 819 820 ///////////////////////////////////////////// 821 // PRETTYPHOTO FUNCTION 822 ///////////////////////////////////////////// 823 824 var prettyPhoto = { 825 init: function() { 826 jQuery("a[rel^='prettyPhoto']").prettyPhoto({ 827 //theme: 'light_square' 828 }); 829 } 830 }; 831 832 833 ///////////////////////////////////////////// 834 // MAP FUNCTIONS 835 ///////////////////////////////////////////// 836 837 var map = { 838 init:function() { 839 840 var maps = jQuery('.map-canvas'); 841 maps.each(function(index, element) { 842 var mapContainer = element, 843 mapAddress = mapContainer.getAttribute('data-address'), 844 mapZoom = mapContainer.getAttribute('data-zoom'), 845 mapType = mapContainer.getAttribute('data-maptype'), 846 pinLogoURL = mapContainer.getAttribute('data-pinimage'), 847 pinLink = mapContainer.getAttribute('data-pinlink'); 848 849 map.getCoordinates(mapAddress, mapContainer, mapZoom, mapType, pinLogoURL, pinLink); 850 851 }); 852 853 map.fullscreenMap(); 854 jQuery(window).smartresize(function(){ 855 map.fullscreenMap(); 856 }); 857 858 }, 859 getCoordinates: function(address, mapContainer, mapZoom, mapType, pinLogoURL, pinLink) { 860 var geocoder; 861 geocoder = new google.maps.Geocoder(); 862 geocoder.geocode({ 863 'address': address 864 }, function(results, status) { 865 if (status === google.maps.GeocoderStatus.OK) { 866 867 var mapTypeIdentifier = "", 868 companyPos = "", 869 mapCoordinates = results[0].geometry.location, 870 latitude = results[0].geometry.location.lat(), 871 longitude = results[0].geometry.location.lng(); 872 873 if (mapType === "satellite") { 874 mapTypeIdentifier = google.maps.MapTypeId.SATELLITE; 875 } else if (mapType === "terrain") { 876 mapTypeIdentifier = google.maps.MapTypeId.TERRAIN; 877 } else if (mapType === "hybrid") { 878 mapTypeIdentifier = google.maps.MapTypeId.HYBRID; 879 } else { 880 mapTypeIdentifier = google.maps.MapTypeId.ROADMAP; 881 } 882 883 var latlng = new google.maps.LatLng(latitude, longitude); 884 var settings = { 885 zoom: parseInt(mapZoom, 10), 886 scrollwheel: false, 887 center: latlng, 888 mapTypeControl: true, 889 mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, 890 navigationControl: true, 891 navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, 892 mapTypeId: mapTypeIdentifier 893 }; 894 var mapInstance = new google.maps.Map(mapContainer, settings); 895 var companyMarker = ""; 896 if (pinLogoURL) { 897 var companyLogo = new google.maps.MarkerImage(pinLogoURL, 898 new google.maps.Size(150,75), 899 new google.maps.Point(0,0), 900 new google.maps.Point(75,75) 901 ); 902 companyPos = new google.maps.LatLng(latitude, longitude); 903 companyMarker = new google.maps.Marker({ 904 position: mapCoordinates, 905 map: mapInstance, 906 icon: companyLogo 907 }); 908 } else { 909 companyPos = new google.maps.LatLng(latitude, longitude); 910 companyMarker = new google.maps.Marker({ 911 position: mapCoordinates, 912 map: mapInstance 913 }); 914 } 915 google.maps.event.addListener(companyMarker, 'click', function() { 916 if (pinLink == "") { 917 pinLink = 'http://maps.google.com/maps?q='+companyPos, '_blank'; 918 } 919 window.open(pinLink); 920 }); 921 922 google.maps.event.addDomListener(window, 'resize', function() { 923 mapInstance.setCenter(companyPos); 924 }); 925 } else { 926 var alert; 927 alert('Geocode was not successful for the following reason: ' + status); 928 } 929 }); 930 }, 931 fullscreenMap: function() { 932 var fullscreenMap = jQuery('.fullscreen-map'), 933 container = jQuery('#page-wrap'), 934 mapOffset = container.offset().left, 935 windowWidth = jQuery('#main-container').width(); 936 937 if (windowWidth > 768) { 938 mapOffset = mapOffset; 939 } else { 940 mapOffset = 20; 941 } 942 943 fullscreenMap.find('.map-canvas').css('width', windowWidth); 944 if (jQuery('#container').hasClass('boxed-layout')) { 945 fullscreenMap.css('margin-left', '-' + 30 + 'px'); 946 } else { 947 fullscreenMap.css('margin-left', '-' + mapOffset + 'px'); 948 } 949 } 950 }; 951 952 953 ///////////////////////////////////////////// 954 // NAV ARROW INDICATOR FUNCTION 955 ///////////////////////////////////////////// 956 957 var navArrow = { 958 init:function() { 959 960 if ( jQuery('body').hasClass('mobile-browser') ) { 961 return; 962 } 963 964 var navSection = jQuery("#nav-section"); 965 var mainNav = jQuery("#main-navigation"); 966 mainNav.append("<div id='nav-pointer'></div>"); 967 var magicLine = jQuery("#nav-pointer"); 968 var currentMenuItem = mainNav.find('>div>ul>.current-menu-item, >div>ul>.current_page_item'); 969 if(!currentMenuItem.length){ currentMenuItem = mainNav.find('.current-menu-ancestor:eq(0), .current-page-ancestor:eq(0)'); } 970 971 if (navSection.hasClass('nav-indicator') && currentMenuItem.length > 0) { 972 973 magicLine 974 .width(currentMenuItem.find('a').width()) 975 .css("left", currentMenuItem.position().left + parseInt(currentMenuItem.find('a').css("margin-left"), 10)) 976 .data("origLeft", magicLine.position().left); 977 978 var originalWidth = currentMenuItem.find('a').width(); 979 980 jQuery("#main-navigation > div > ul > li").hover(function() { 981 var hoverMenuItem = jQuery(this).find('a'); 982 var leftPos = hoverMenuItem.parent().position().left + parseInt(hoverMenuItem.css("margin-left"), 10); 983 var newWidth = hoverMenuItem.width(); 984 magicLine.stop().animate({ 985 left: leftPos, 986 width: newWidth 987 }); 988 }, function() { 989 magicLine.stop().animate({ 990 left: magicLine.data("origLeft"), 991 width: originalWidth 992 }); 993 }); 994 995 } else { 996 997 magicLine.hide(); 998 999 } 1000 } 1001 }; 1002 1003 1004 ///////////////////////////////////////////// 1005 // RELOAD FUNCTIONS 1006 ///////////////////////////////////////////// 1007 1008 var reloadFunctions = { 1009 init:function() { 1010 1011 var deviceAgent = navigator.userAgent.toLowerCase(),
1012 appleAgentID = deviceAgent.match(/(iphone|ipod|ipad)/); 1013 1014 // Remove title attributes from images to avoid showing on hover 1015 jQuery('img[title]').each(function() { 1016 //jQuery(this).removeAttr('title'); 1017 }); 1018 1019 jQuery('.ui-tabs-nav').on('click', 'a', function() { 1020 jQuery(this).blur(); 1021 }); 1022 1023 if (!appleAgentID) { 1024 jQuery('embed').show(); 1025 } 1026 1027 // Animate Top Links 1028 jQuery('.animate-top').on('click', function(e) { 1029 e.preventDefault(); 1030 jQuery('body,html').animate({scrollTop: 0}, 800); 1031 }); 1032 }, 1033 load:function() { 1034 var deviceAgent = navigator.userAgent.toLowerCase(), 1035 agentID = deviceAgent.match(/(iphone|ipod|ipad|android|iemobile)/); 1036 1037 if (!agentID) { 1038 1039 // Button hover tooltips 1040 jQuery('.tooltip').each( function() { 1041 jQuery(this).css( 'marginLeft', '-' + Math.round( (jQuery(this).outerWidth(true) / 2) ) + 'px' ); 1042 }); 1043 1044 jQuery('.comment-avatar').hover( function() { 1045 jQuery(this).find('.tooltip' ).stop().animate({ 1046 bottom: '44px', 1047 opacity: 1 1048 }, 500, 'easeInOutExpo'); 1049 }, function() { 1050 jQuery(this).find('.tooltip').stop().animate({ 1051 bottom: '25px', 1052 opacity: 0 1053 }, 400, 'easeInOutExpo'); 1054 }); 1055 1056 jQuery('.grid-image').hover( function() { 1057 jQuery(this).find('.tooltip' ).stop().animate({ 1058 bottom: '85px', 1059 opacity: 1 1060 }, 500, 'easeInOutExpo'); 1061 }, function() { 1062 jQuery(this).find('.tooltip').stop().animate({ 1063 bottom: '65px', 1064 opacity: 0 1065 }, 400, 'easeInOutExpo'); 1066 }); 1067 1068 } 1069 } 1070 }; 1071 1072 1073 ///////////////////////////////////////////// 1074 // LOAD + READY FUNCTION 1075 ///////////////////////////////////////////// 1076 1077 var sfIncluded = jQuery('#sf-included'); 1078 1079 var onReady = { 1080 init: function(){ 1081 page.init(); 1082 header.init(); 1083 nav.init(); 1084 widgets.init(); 1085 prettyPhoto.init(); 1086 if (sfIncluded.hasClass('has-carousel')) { 1087 carouselWidgets.init(); 1088 } 1089 if (sfIncluded.hasClass('has-team')) { 1090 teamMembers.init(); 1091 } 1092 if (sfIncluded.hasClass('has-map')) { 1093 map.init(); 1094 } 1095 reloadFunctions.init(); 1096 } 1097 }; 1098 var onLoad = { 1099 init: function(){ 1100 flexSlider.init(); 1101 if (sfIncluded.hasClass('has-portfolio')) { 1102 portfolio.init(); 1103 } 1104 if (sfIncluded.hasClass('has-blog')) { 1105 blog.init(); 1106 } 1107 navArrow.init(); 1108 if (sfIncluded.hasClass('has-chart')) { 1109 widgets.charts(); 1110 } 1111 if (sfIncluded.hasClass('has-progress-bar')) { 1112 widgets.initSkillBars(); 1113 } 1114 reloadFunctions.load(); 1115 } 1116 }; 1117 1118 jQuery(document).ready(onReady.init); 1119 jQuery(window).on('load', onLoad.init); 1120 1121})(jQuery); 1122 1123 1124///////////////////////////////////////////// 1125// SMARTRESIZE PLUGIN 1126///////////////////////////////////////////// 1127 1128(function($,sr){ 1129 1130 // USE STRICT 1131 "use strict"; 1132 1133 // debouncing function from John Hann 1134 // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 1135 var debounce = function (func, threshold, execAsap) { 1136 var timeout; 1137 1138 return function debounced () { 1139 var obj = this, args = arguments; 1140 function delayed () { 1141 if (!execAsap) { 1142 func.apply(obj, args); 1143 timeout = null; 1144 } 1145 } 1146 1147 if (timeout) { 1148 clearTimeout(timeout); 1149 } else if (execAsap) { 1150 func.apply(obj, args); 1151 } 1152 1153 timeout = setTimeout(delayed, threshold || 100); 1154 }; 1155 }; 1156 1157 // smartresize 1158 jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); }; 1159 1160})(jQuery,'smartresize'); 1161 1162
1163///////////////////////////////////////////// 1164// DEBOUNCEDRESIZE PLUGIN 1165///////////////////////////////////////////// 1166 1167(function($) { 1168 1169 // USE STRICT 1170 "use strict"; 1171 1172 var $event = $.event, 1173 $special, 1174 resizeTimeout; 1175 1176 $special = $event.special.debouncedresize = { 1177 setup: function() { 1178 $( this ).on( "resize", $special.handler ); 1179 }, 1180 teardown: function() { 1181 $( this ).off( "resize", $special.handler ); 1182 }, 1183 handler: function( event, execAsap ) { 1184 // Save the context 1185 var context = this, 1186 args = arguments, 1187 dispatch = function() { 1188 // set correct event type 1189 event.type = "debouncedresize"; 1190 $event.dispatch.apply( context, args ); 1191 }; 1192 1193 if ( resizeTimeout ) { 1194 clearTimeout( resizeTimeout ); 1195 } 1196 1197 execAsap ? 1198 dispatch() : 1199 resizeTimeout = setTimeout( dispatch, $special.threshold ); 1200 }, 1201 threshold: 150 1202 }; 1203 1204})(jQuery); 1205 1206 1207///////////////////////////////////////////// 1208// EQUALHEIGHTS PLUGIN 1209///////////////////////////////////////////// 1210 1211(function($) { 1212 1213 // USE STRICT 1214 "use strict"; 1215 1216 $.fn.equalHeights = function(px) { 1217 $(this).each(function(){ 1218 var currentTallest = 0; 1219 $(this).children().each(function(){ 1220 if ($(this).height() > currentTallest) { currentTallest = $(this).height(); } 1221 }); 1222 if (!px && Number.prototype.pxToEm) { 1223 currentTallest = currentTallest.pxToEm(); //use ems unless px is specified 1224 } 1225 $(this).children().css({'min-height': currentTallest}); 1226 }); 1227 return this; 1228 }; 1229})(jQuery); 1230 1231 1232///////////////////////////////////////////// 1233// EASYPIECHART PLUGIN 1234///////////////////////////////////////////// 1235 1236(function($) { 1237 // USE STRICT 1238 "use strict"; 1239 $.easyPieChart = function(el, options) { 1240 var addScaleLine, animateLine, drawLine, easeInOutQuad, renderBackground, renderScale, renderTrack, 1241 _this = this; 1242 this.el = el; 1243 this.$el = $(el); 1244 this.$el.data("easyPieChart", this); 1245 this.init = function() { 1246 var percent; 1247 _this.options = $.extend({}, $.easyPieChart.defaultOptions, options); 1248 percent = parseInt(_this.$el.data('percent'), 10); 1249 _this.percentage = 0; 1250 _this.canvas = $("<canvas width='" + _this.options.size + "' height='" + _this.options.size + "'></canvas>").get(0); 1251 _this.$el.append(_this.canvas); 1252 if (typeof G_vmlCanvasManager !== "undefined" && G_vmlCanvasManager !== null) { 1253 G_vmlCanvasManager.initElement(_this.canvas); 1254 } 1255 _this.ctx = _this.canvas.getContext('2d'); 1256 if (window.devicePixelRatio > 1.5) { 1257 $(_this.canvas).css({ 1258 width: _this.options.size, 1259 height: _this.options.size 1260 }); 1261 _this.canvas.width *= 2; 1262 _this.canvas.height *= 2; 1263 _this.ctx.scale(2, 2); 1264 } 1265 _this.ctx.translate(_this.options.size / 2, _this.options.size / 2); 1266 _this.$el.addClass('easyPieChart'); 1267 _this.$el.css({ 1268 width: _this.options.size, 1269 height: _this.options.size, 1270 lineHeight: "" + _this.options.size + "px" 1271 }); 1272 _this.update(percent); 1273 return _this; 1274 }; 1275 this.update = function(percent) { 1276 if (_this.options.animate === false) { 1277 return drawLine(percent); 1278 } else { 1279 if (percent === 0) { 1280 return animateLine(0, 0); 1281 } else { 1282 return animateLine(_this.percentage, percent); 1283 } 1284 } 1285 }; 1286 renderScale = function() { 1287 var i, _i, _results; 1288 _this.ctx.fillStyle = _this.options.scaleColor; 1289 _this.ctx.lineWidth = 1; 1290 _results = []; 1291 for (i = _i = 0; _i <= 24; i = ++_i) { 1292 _results.push(addScaleLine(i)); 1293 } 1294 return _results; 1295 }; 1296 addScaleLine = function(i) { 1297 var offset; 1298 offset = i % 6 === 0 ? 0 : _this.options.size * 0.017; 1299 _this.ctx.save(); 1300 _this.ctx.rotate(i * Math.PI / 12); 1301 _this.ctx.fillRect(_this.options.size / 2 - offset, 0, -_this.options.size * 0.05 + offset, 1); 1302 return _this.ctx.restore(); 1303 }; 1304 renderTrack = function() { 1305 var offset; 1306 offset = _this.options.size / 2 - _this.options.lineWidth / 2; 1307 if (_this.options.scaleColor !== false) { 1308 offset -= _this.options.size * 0.08; 1309 } 1310 _this.ctx.beginPath(); 1311 _this.ctx.arc(0, 0, offset, 0, Math.PI * 2, true); 1312 _this.ctx.closePath(); 1313 _this.ctx.strokeStyle = _this.options.trackColor; 1314 _this.ctx.lineWidth = _this.options.lineWidth; 1315 return _this.ctx.stroke(); 1316 };
1317 renderBackground = function() { 1318 if (_this.options.scaleColor !== false) { 1319 renderScale(); 1320 } 1321 if (_this.options.trackColor !== false) { 1322 return renderTrack(); 1323 } 1324 }; 1325 drawLine = function(percent) { 1326 var offset; 1327 renderBackground(); 1328 _this.ctx.strokeStyle = $.isFunction(_this.options.barColor) ? _this.options.barColor(percent) : _this.options.barColor; 1329 _this.ctx.lineCap = _this.options.lineCap; 1330 _this.ctx.lineWidth = _this.options.lineWidth; 1331 offset = _this.options.size / 2 - _this.options.lineWidth / 2; 1332 if (_this.options.scaleColor !== false) { 1333 offset -= _this.options.size * 0.08; 1334 } 1335 _this.ctx.save(); 1336 _this.ctx.rotate(-Math.PI / 2); 1337 _this.ctx.beginPath(); 1338 _this.ctx.arc(0, 0, offset, 0, Math.PI * 2 * percent / 100, false); 1339 _this.ctx.stroke(); 1340 return _this.ctx.restore(); 1341 }; 1342 animateLine = function(from, to) { 1343 var currentStep, fps, steps; 1344 fps = 30; 1345 steps = fps * _this.options.animate / 1000; 1346 currentStep = 0; 1347 _this.options.onStart.call(_this); 1348 _this.percentage = to; 1349 if (_this.animation) { 1350 clearInterval(_this.animation); 1351 _this.animation = false; 1352 } 1353 _this.animation = setInterval(function() { 1354 _this.ctx.clearRect(-_this.options.size / 2, -_this.options.size / 2, _this.options.size, _this.options.size); 1355 renderBackground.call(_this); 1356 drawLine.call(_this, [easeInOutQuad(currentStep, from, to - from, steps)]); 1357 currentStep++; 1358 if ((currentStep / steps) > 1) { 1359 clearInterval(_this.animation); 1360 _this.animation = false; 1361 return _this.options.onStop.call(_this); 1362 } 1363 }, 1000 / fps); 1364 return _this.animation; 1365 }; 1366 easeInOutQuad = function(t, b, c, d) { 1367 var easeIn, easing; 1368 easeIn = function(t) { 1369 return Math.pow(t, 2); 1370 }; 1371 easing = function(t) { 1372 if (t < 1) { 1373 return easeIn(t); 1374 } else { 1375 return 2 - easeIn((t / 2) * -2 + 2); 1376 } 1377 }; 1378 t /= d / 2; 1379 return c / 2 * easing(t) + b; 1380 }; 1381 return this.init(); 1382 }; 1383 $.easyPieChart.defaultOptions = { 1384 barColor: '#ef1e25', 1385 trackColor: '#f2f2f2', 1386 scaleColor: false, 1387 lineCap: 'round', 1388 size: 110, 1389 lineWidth: 3, 1390 animate: false, 1391 onStart: $.noop, 1392 onStop: $.noop 1393 }; 1394 $.fn.easyPieChart = function(options) { 1395 return $.each(this, function(i, el) { 1396 var $el; 1397 $el = $(el); 1398 if (!$el.data('easyPieChart')) { 1399 return $el.data('easyPieChart', new $.easyPieChart(el, options)); 1400 } 1401 }); 1402 }; 1403 return void 0; 1404})(jQuery); 1405 1406 1407///////////////////////////////////////////// 1408// ANIMATE NUMBER PLUGIN 1409///////////////////////////////////////////// 1410 1411(function($) { 1412 1413 // USE STRICT 1414 "use strict"; 1415 1416 $.fn.animateNumber = function(to) { 1417 var $ele = $(this), 1418 num = parseInt($ele.html(), 10), 1419 up = to > num, 1420 num_interval = Math.abs(num - to) / 90; 1421 1422 var loop = function() { 1423 num = up ? Math.ceil(num+num_interval) : Math.floor(num-num_interval); 1424 if ( (up && num > to) || (!up && num < to) ) { 1425 num = to; 1426 clearInterval(animation); 1427 } 1428 $ele.html(num); 1429 }; 1430 1431 var intervalTime = to <= 5 ? intervalTime = 100 : to <= 25 ? intervalTime = 50 : to <= 50 ? intervalTime = 25 : 10; 1432 1433 var animation = setInterval(loop, intervalTime); 1434 }; 1435})(jQuery); 1436 1437 1438///////////////////////////////////////////// 1439// VIEWPORT PLUGIN 1440///////////////////////////////////////////// 1441 1442/* 1443 * Viewport - jQuery selectors for finding elements in viewport 1444 * 1445 * Copyright (c) 2008-2009 Mika Tuupola 1446 * 1447 * Licensed under the MIT license: 1448 * http://www.opensource.org/licenses/mit-license.php 1449 * 1450 * Project home: 1451 * http://www.appelsiini.net/projects/viewport 1452 * 1453 */ 1454 1455 1456(function($) { 1457 1458 // USE STRICT 1459 "use strict"; 1460 1461 $.belowthefold = function(element, settings) { 1462 var fold = $(window).height() + $(window).scrollTop(); 1463 return fold <= $(element).offset().top - settings.threshold; 1464 }; 1465 1466 $.abovethetop = function(element, settings) { 1467 var top = $(window).scrollTop(); 1468 return top >= $(element).offset().top + $(element).height() - settings.threshold; 1469 }; 1470 1471 $.rightofscreen = function(element, settings) { 1472 var fold = $(window).width() + $(window).scrollLeft(); 1473 return fold <= $(element).offset().left - settings.threshold; 1474 }; 1475 1476 $.leftofscreen = function(element, settings) { 1477 var left = $(window).scrollLeft(); 1478 return left >= $(element).offset().left + $(element).width() - settings.threshold; 1479 }; 1480 1481 $.inviewport = function(element, settings) { 1482 return !$.rightofscreen(element, settings) && !$.leftofscreen(element, settings) && !$.belowthefold(element, settings) && !$.abovethetop(element, settings); 1483 }; 1484 1485 $.extend($.expr[':'], { 1486 "below-the-fold": function(a) { 1487 return $.belowthefold(a, {threshold : 0}); 1488 }, 1489 "above-the-top": function(a) { 1490 return $.abovethetop(a, {threshold : 0}); 1491 }, 1492 "left-of-screen": function(a) { 1493 return $.leftofscreen(a, {threshold : 0}); 1494 }, 1495 "right-of-screen": function(a) { 1496 return $.rightofscreen(a, {threshold : 0}); 1497 }, 1498 "in-viewport": function(a) { 1499 return $.inviewport(a, {threshold : 0}); 1500 } 1501 }); 1502 1503 1504})(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.