1/*global jQuery,google,G_vmlCanvasManager:false */ 2 3/* ================================================== 4 5Custom jQuery functions. 6 7================================================== */ 8 9(function(){ 10 11 12 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('.blog-items:not(.carousel-items),article.type-post,article.type-team,.wpb_video_widget,.infocus-item,.recent-posts,.sidebar').fitVids(); 30 jQuery('.article-body-wrap').fitVids(); 31 var vidsrc = jQuery('.wpb_wrapper iframe').attr('src'); 32 jQuery('.wpb_wrapper iframe').attr('src', vidsrc+'&showinfo=0&rel=0'); 33 34 // FOOTER BEAM ME UP LINK 35 jQuery('.beam-me-up').on('click', 'a', function(e) { 36 e.preventDefault(); 37 jQuery('body,html').animate({scrollTop: 0}, 800); 38 }); 39 40 //mostpopular hide/show 41 jQuery('.emwidget_popular .widget-heading').on('click', 'a', function(e) { 42 43 jQuery('.postSort').removeClass('currentTab'); 44 jQuery(this).addClass('currentTab'); 45 46 var showSet = this.id; 47 console.log(showSet); 48 e.preventDefault(); 49 if (showSet == 'sortAll') { 50 jQuery('#thisMonth').hide('fast'); 51 jQuery('#allTime').show('fast'); 52 } else { 53 jQuery('#allTime').hide('fast'); 54 jQuery('#thisMonth').show('fast'); 55 } 56 }); 57 58 jQuery('.modal .close').click(function () { 59 var modal = jQuery(this).parent().parent(), 60 video = modal.find('.modal-body iframe'), 61 videoSource = video.attr("src"); 62 63 video.attr("src",""); 64 video.attr("src",videoSource); 65 }); 66 //$('#nav-search .search-form input').focus(function() { 67 // $('.search-form input').animate({'width': '270px'}, 500); 68 //}); 69 //$('#nav-search .search-form input').blur(function() { 70 // $('.search-form input').animate({'width': '110px'}, 500); 71 //}); 72 //jQuery('body').on('click', '#nav-search .search-form', function (e) { 73 // alert('superbook'); 74 //}); 75 76 jQuery('iframe').each(function(){ 77 var url = $(this).attr("src"); 78 var char = "?"; 79 80 /* 81 if(url.indexOf("?") != -1){ 82 var char = "&"; 83 } 84 85 jQuery(this).attr("src",url+char+"wmode=transparent"); 86 */ 87 }); 88 } 89 90 }; 91 92 93 ///////////////////////////////////////////// 94 // HEADER 95 ///////////////////////////////////////////// 96 97 var navSearch = jQuery('#nav-search').find('input'), 98 navSearchLink = jQuery('.nav-search-link'), 99 miniHeader = jQuery('#mini-header'), 100 miniHeaderSearch = jQuery('#mini-search').find('input'), 101 miniHeaderSearchLink = jQuery('.mini-search-link'), 102 topBarMenu = jQuery('#top-bar-menu'); 103 104 var header = { 105 init: function() { 106 107 header.miniHeaderInit(); 108 109 navSearchLink.on('click', function(e) { 110 if (jQuery('#container').width() > 767 ) { 111 e.preventDefault(); 112 navSearch.animate({ 113 opacity: 1, 114 width: 140 115 }, 200); 116 navSearch.focus(); 117 } 118 }); 119 120 navSearch.focus(function() { 121 if (jQuery('#container').width() > 767 ) { 122 navSearch.css('display', 'inline-block').animate({ 123 opacity: 1, 124 width: 140 125 }, 200); 126 } 127 }); 128 129 navSearch.blur(function() { 130 if (jQuery('#container').width() > 767 ) { 131 jQuery(this).animate({ 132 opacity: 0, 133 width: 1 134 }, 200); 135 setTimeout(function() { 136 navSearch.css('display', 'none'); 137 }, 300); 138 } 139 }); 140 141 miniHeaderSearchLink.on('click', function(e) { 142 e.preventDefault(); 143 miniHeaderSearch.animate({ 144 opacity: 1, 145 width: 140 146 }, 200); 147 miniHeaderSearch.focus(); 148 }); 149 150 miniHeaderSearch.focus(function() { 151 jQuery(this).animate({ 152 opacity: 1, 153 width: 140 154 }, 200); 155 }); 156 157 miniHeaderSearch.blur(function() { 158 jQuery(this).animate({ 159 opacity: 0, 160 width: 1 161 }, 200); 162 }); 163 164 if (topBarMenu.find('#aux-nav .menu').children('li').length === 0 && topBarMenu.find('div[class*=menu-] ul').children('li').length === 0) { 165 topBarMenu.remove(); 166 jQuery('#top-bar').find('.show-menu').remove(); 167 } 168 169 jQuery(window).scroll(function() { 170 if ((jQuery(this).scrollTop() >
170 300) && !jQuery('body').hasClass('has-mini-header')) { 171 header.miniHeaderShow(); 172 } else if ((jQuery(this).scrollTop() < 250) && jQuery('body').hasClass('has-mini-header')) { 173 header.miniHeaderHide(); 174 } 175 }); 176 177 }, 178 miniHeaderInit: function() { 179 miniHeader.find('a[title="home"]').html('<i class="icon-home"></i>'); 180 }, 181 miniHeaderShow: function() { 182 jQuery('body').addClass('has-mini-header'); 183 miniHeader.animate({ 184 "top": "0" 185 }, 400); 186 }, 187 miniHeaderHide: function() { 188 jQuery('body').removeClass('has-mini-header'); 189 miniHeader.animate({ 190 "top": "-80" 191 }, 400); 192 } 193 }; 194 195 196 ///////////////////////////////////////////// 197 // NAVIGATION 198 ///////////////////////////////////////////// 199 200 201 var nav = { 202 init: function() { 203 204 // Add parent class to items with sub-menus 205 jQuery("ul.sub-menu").parent().addClass('parent'); 206 207 // Enable hover dropdowns for window size above tablet width 208 jQuery("nav").find(".menu li.parent").hoverIntent({ 209 over: function() { 210 if (jQuery('#container').width() > 767) { 211 212 // Setup menuLeft variable, with main menu value 213 214 var subMenuWidth = jQuery(this).find('ul.sub-menu:first').outerWidth(true); 215 var mainMenuItemWidth = jQuery(this).outerWidth(true); 216 var menuLeft = '-' + (Math.round(subMenuWidth / 1) - Math.round(mainMenuItemWidth / 1)) + 'px'; 217 var menuContainer = jQuery(this).parent().parent().parent(); 218 219 220 221 222 // Check if second level dropdown 223 if (jQuery(this).find('ul.sub-menu:first').parent().parent().hasClass("sub-menu")) { 224 menuLeft = jQuery(this).find('ul.sub-menu:first').parent().parent().outerWidth(true) - 2; 225 } 226 227 jQuery(this).find('ul.sub-menu:first').css("left", menuLeft); 228 jQuery(this).find('ul.sub-menu:first').css('opacity', 0).slideDown(300).animate({ 229 opacity: 1 230 }, { 231 queue: false, 232 duration: 300 233 }); 234 } 235 }, 236 out:function() { 237 if (jQuery('#container').width() > 767 ) { 238 jQuery(this).find('ul.sub-menu:first').slideUp(300); 239 nav.hideNav(jQuery(this).find('ul.sub-menu:first')); 240 } 241 } 242 }); 243 244 245 // Set the current page for each nav if exists 246 var mobileNavToggle = jQuery('.show-menu'); 247 mobileNavToggle.each(function() { 248 var mobileMenu = jQuery(this).next('nav').find('ul.menu'); 249 var menuSelectedText = mobileMenu.find('.current-menu-item:last > a').text(); 250 if (menuSelectedText !== "") { 251 jQuery(this).html(menuSelectedText + '<i class="icon-angle-down"></i>'); 252 } 253 }); 254 255 // Toggle Mobile Nav show/hide 256 mobileNavToggle.on('click', function(e) { 257 e.preventDefault(); 258 jQuery(this).next('nav').find('ul.menu').slideToggle(400); 259 }); 260 261 jQuery(window).smartresize(function(){ 262 if (jQuery('#container').width() > 767) { 263 var menus = jQuery('nav').find('ul.menu'); 264 menus.each(function() { 265 jQuery(this).css("display", ""); 266 }); 267 } 268 }); 269 270 271 272 }, 273 hideNav: function(subnav) { 274 setTimeout(function() { 275 if (subnav.css("opacity") === "0") { 276 subnav.css("display", "none"); 277 } 278 }, 300); 279 } 280 }; 281 282 283 284 ///////////////////////////////////////////// 285 // BLOG 286 ///////////////////////////////////////////// 287 288 var blogItems = jQuery('.blog-wrap').find('.blog-items'), 289 masonryPagination = jQuery('.blog-wrap').find('.masonry-pagination'); 290 291 var blog = { 292 init: function() { 293 294 // BLOG ITEM SETUP 295 if (blogItems.hasClass('masonry-items')) { 296 jQuery('.masonry-items').fitVids(); 297 blog.masonrySetup(); 298 blogItems.imagesLoaded(function () { 299 blogItems.animate({opacity: 1}, 800); 300 masonryPagination.fadeIn(1000); 301 blog.masonrySetup(); 302 }), flexSlider.thumb(), blogItems.isotope("reLayout"); 303 304 // BLOG WINDOW RESIZE 305 jQuery(window).smartresize(function(){ 306 blog.windowResized(); 307 }); 308 } else { 309 flexSlider.thumb(); 310 } 311 312 313 // BLOG AUX SLIDEOUT 314 jQuery('.blog-slideout-trigger').on('click', function(e) { 315 e.preventDefault(); 316 317 // VARIABLES 318 var blogWrap = jQuery(this).parent().parent().parent().parent(); 319 var filterPanel = blogWrap.find('.filter-wrap .filter-slide-wrap'); 320 var auxType = jQuery(this).attr('data-aux'); 321 322 // IF SELECTING AN OPTION THAT IS OPEN, CLOSE THE PANEL 323 if (jQuery(this).parent().hasClass('selected') && !filterPanel.is(':animated')) { 324 blogWrap.find('.blog-aux-options li').removeClass('selected'); 325 filterPanel.slideUp(400); 326 return; 327 } 328 329 // AUX BUTTON SELECTED STATE 330 blogWrap.find('.blog-aux-options li').removeClass('selected'); 331 jQuery(this).parent().addClass('selected'); 332 333 // IF SLIDEOUT IS OPEN 334 if (filterPanel.is(':visible')) { 335 336 filterPanel.slideUp(400); 337 setTimeout(function() { 338 blogWrap.find('.aux-list').css('display', 'none');
339 blogWrap.find('.aux-'+auxType).css('display', 'block'); 340 filterPanel.slideDown(); 341 }, 600); 342 343 // IF SLIDEOUT IS CLOSED 344 } else { 345 346 blogWrap.find('.aux-list').css('display', 'none'); 347 blogWrap.find('.aux-'+auxType).css('display', 'block'); 348 filterPanel.slideDown(); 349 350 } 351 }); 352 353 }, 354 masonrySetup: function() { 355 blogItems.isotope({ 356 itemSelector : '.blog-item', 357 masonry : { 358 columnWidth : 0 359 }, 360 animationEngine: 'best-available', 361 animationOptions: { 362 duration: 300, 363 easing: 'easeInOutQuad', 364 queue: false 365 }, 366 transformsEnabled: false, 367 resizable: true 368 }); 369 }, 370 windowResized: function() { 371 blogItems.isotope("reLayout"); 372 } 373 }; 374 375 376 ///////////////////////////////////////////// 377 // CAROUSEL FUNCTIONS 378 ///////////////////////////////////////////// 379 380 var carouselWidgets = { 381 init: function() { 382 }, 383 resizeCarousels: function() { 384 var carousel = jQuery('.carousel-items'); 385 386 jQuery(window).smartresize(function() { 387 carousel.each(function() { 388 var carouselItem = jQuery(this).find('.carousel-item'); 389 var itemWidth = carouselItem.width() + carouselItem.css('margin-left'); 390 391 carousel.trigger("configuration", { 392 items : { 393 width : itemWidth 394 } 395 }); 396 397 if (carousel.is(':visible')) { 398 if (jQuery(this).parent().hasClass('caroufredsel_wrapper')) { 399 jQuery(this).parent().css('height', jQuery(this).children().first().outerHeight(true) + 1 + 'px'); 400 } 401 } 402 }); 403 }).trigger('resize'); 404 } 405 }; 406 407 408 ///////////////////////////////////////////// 409 // WIDGET FUNCTIONS 410 ///////////////////////////////////////////// 411 412 var widgets = { 413 init: function() { 414 415 // CHARTS 416 if (sfIncluded.hasClass('has-chart')) { 417 jQuery('.chart-shortcode').each(function(){ 418 jQuery(this).easyPieChart({ 419 animate: 1000, 420 lineCap: 'square', 421 lineWidth: jQuery(this).attr('data-linewidth'), 422 size: jQuery(this).attr('data-size'), 423 barColor: jQuery(this).attr('data-barcolor'), 424 trackColor: jQuery(this).attr('data-trackcolor'), 425 scaleColor: 'transparent' 426 }); 427 }); 428 } 429 430 // ASSET EQUAL HEIGHTS 431 jQuery('.team-members').equalHeights(); 432 433 // RESIZE ASSETS 434 widgets.resizeAssets(); 435 jQuery(window).on("debouncedresize", function( event ) { 436 widgets.resizeAssets(); 437 jQuery('.team-members').children().css('min-height','0'); 438 jQuery('.team-members').equalHeights(); 439 }); 440 441 // SF TOOLTIPS 442 jQuery('[rel=tooltip]').tooltip(); 443 444 }, 445 resizeAssets: function() { 446 var carousels = jQuery('.carousel-items'); 447 var assets = jQuery('.alt-bg'); 448 var assetWidth = 0; 449 450 if (jQuery('#container').width() < 460 && jQuery('body').hasClass('responsive-fluid')) { 451 assetWidth = jQuery('#container').width() - 40; 452 carousels.find('.carousel-item').each(function() { 453 jQuery(this).css("width", assetWidth + "px"); 454 455 }); 456 } else if (jQuery('#container').width() < 768 && jQuery('body').hasClass('responsive-fluid')) { 457 if (carousels.hasClass('testimonials')) { 458 assetWidth = jQuery('#container').width() - 40; 459 } else { 460 assetWidth = Math.floor(jQuery('#container').width() / 2) - 35; 461 } 462 carousels.find('.carousel-item').each(function() { 463 jQuery(this).css("width", assetWidth + "px"); 464 }); 465 } else if (jQuery('body').hasClass('responsive-fluid')) { 466 carousels.find('.carousel-item').each(function() { 467 jQuery(this).css("width", ""); 468 }); 469 } 470 471 if (jQuery('#container').width() < 768 && jQuery('body').hasClass('responsive-fluid')) { 472 assetWidth = jQuery('#container').width(); 473 assets.each(function() { 474 jQuery(this).css("width", assetWidth + "px"); 475 }); 476 } else { 477 assets.each(function() { 478 jQuery(this).css("width", ""); 479 }); 480 } 481 }, 482 initSkillBars: function() { 483 // SKILL BARS 484 widgets.animateSkillBars(); 485 jQuery(window).scroll(function() { 486 widgets.animateSkillBars(); 487 }); 488 }, 489 animateSkillBars: function() { 490 jQuery('.progress:in-viewport').each(function(){ 491 var progressBar = jQuery(this), 492 progressValue = progressBar.find('.bar').attr('data-value'); 493 if (!progressBar.hasClass('animated')) { 494 progressBar.addClass('animated'); 495 progressBar.find('.bar').animate({ 496 width: progressValue + "%" 497 }, 600, function() { 498 progressBar.find('.bar-text').fadeIn(400); 499 }); 500 } 501 }); 502 }, 503 charts: function() { 504 widgets.animateCharts(); 505 jQuery(window).scroll(function() { 506 widgets.animateCharts(); 507 }); 508 }, 509 animateCharts: function() {
510 jQuery('.chart-shortcode:in-viewport').each(function(){ 511 if (!jQuery(this).hasClass('animated')) { 512 jQuery(this).addClass('animated'); 513 var animatePercentage = parseInt(jQuery(this).attr('data-animatepercent'), 10); 514 jQuery(this).data('easyPieChart').update(animatePercentage); 515 } 516 }); 517 } 518 }; 519 520 521 ///////////////////////////////////////////// 522 // PRETTYPHOTO FUNCTION 523 ///////////////////////////////////////////// 524 525 var prettyPhoto = { 526 init: function() { 527 jQuery(".fancybox").fancybox({ 528 wrapCSS : 'fancybox-custom', 529 helpers : { 530 title : { 531 type : 'inside' 532 } 533 }, 534 overlay : { 535 css : { 536 'background' : 'rgba(0, 0, 0, 0.8)' 537 } 538 539 }, 540 closeClick : true 541 }); 542 } 543 }; 544 545 546 ///////////////////////////////////////////// 547 // MAP FUNCTIONS 548 ///////////////////////////////////////////// 549 550 var map = { 551 init:function() { 552 553 var maps = jQuery('.map-canvas'); 554 maps.each(function(index, element) { 555 var mapContainer = element, 556 mapAddress = mapContainer.getAttribute('data-address'), 557 mapLat = mapContainer.getAttribute('data-lat'), 558 mapLong = mapContainer.getAttribute('data-long'), 559 mapZoom = mapContainer.getAttribute('data-zoom'), 560 mapType = mapContainer.getAttribute('data-maptype'), 561 pinLogoURL = mapContainer.getAttribute('data-pinimage'), 562 mapTypeIdentifier = ""; 563 564 if (mapType === "satellite") { 565 mapTypeIdentifier = google.maps.MapTypeId.SATELLITE; 566 } else if (mapType === "terrain") { 567 mapTypeIdentifier = google.maps.MapTypeId.TERRAIN; 568 } else if (mapType === "hybrid") { 569 mapTypeIdentifier = google.maps.MapTypeId.HYBRID; 570 } else { 571 mapTypeIdentifier = google.maps.MapTypeId.ROADMAP; 572 } 573 574 var latlng = new google.maps.LatLng(mapLat, mapLong); 575 var settings = { 576 zoom: parseInt(mapZoom, 10), 577 scrollwheel: false, 578 center: latlng, 579 mapTypeControl: true, 580 mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, 581 navigationControl: true, 582 navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, 583 mapTypeId: mapTypeIdentifier 584 }; 585 var mapInstance = new google.maps.Map(mapContainer, settings); 586 var companyPos = ""; 587 var companyMarker = ""; 588 if (pinLogoURL) { 589 var companyLogo = new google.maps.MarkerImage(pinLogoURL, 590 new google.maps.Size(150,75), 591 new google.maps.Point(0,0), 592 new google.maps.Point(75,75) 593 ); 594 companyPos = new google.maps.LatLng(mapLat, mapLong); 595 companyMarker = new google.maps.Marker({ 596 position: companyPos, 597 map: mapInstance, 598 icon: companyLogo 599 }); 600 } else { 601 companyPos = new google.maps.LatLng(mapLat, mapLong); 602 companyMarker = new google.maps.Marker({ 603 position: companyPos, 604 map: mapInstance 605 }); 606 } 607 google.maps.event.addListener(companyMarker, 'click', function() { 608 window.location.href = 'http://maps.google.com/maps?q='+mapAddress; 609 }); 610 611 google.maps.event.addDomListener(window, 'resize', function() { 612 mapInstance.setCenter(companyPos); 613 }); 614 }); 615 616 map.fullscreenMap(); 617 jQuery(window).smartresize(function(){ 618 map.fullscreenMap(); 619 }); 620 621 }, 622 fullscreenMap: function() { 623 var fullscreenMap = jQuery('.fullscreen-map'), 624 container = jQuery('#page-wrap'), 625 mapOffset = container.offset().left, 626 windowWidth = jQuery(window).width(); 627 628 if (windowWidth > 768) { 629 mapOffset = mapOffset; 630 } else { 631 mapOffset = 20; 632 } 633 634 fullscreenMap.find('.map-canvas').css('width', windowWidth); 635 fullscreenMap.css('margin-left', '-' + mapOffset + 'px'); 636 637 } 638 }; 639 640 641 ///////////////////////////////////////////// 642 // NAV ARROW INDICATOR FUNCTION 643 ///////////////////////////////////////////// 644 645 var navArrow = { 646 init:function() { 647 var navSection = jQuery("#nav-section"); 648 var mainNav = jQuery("#main-navigation"); 649 mainNav.append("<div id='nav-pointer'></div>"); 650 var magicLine = jQuery("#nav-pointer"); 651 var currentMenuItem = mainNav.find('>div>ul>.current-menu-item, >div>ul>.current_page_item'); 652 if(!currentMenuItem.length){ currentMenuItem = mainNav.find('.current-menu-ancestor:eq(0), .current_page_ancestor:eq(0)'); } 653 654 if (navSection.hasClass('nav-indicator') && currentMenuItem.length > 0) { 655 656 magicLine 657 .width(currentMenuItem.find('a').width()) 658 .css("left", currentMenuItem.position().left + parseInt(currentMenuItem.find('a').css("margin-left"), 10)) 659 .data("origLeft", magicLine.position().left); 660 661 var originalWidth = currentMenuItem.find('a').width(); 662 663 jQuery("#main-navigation > div > ul > li").hover(function() { 664 var hoverMenuItem = jQuery(this).find('a'); 665 var leftPos = hoverMenuItem.parent().position().left + parseInt(hoverMenuItem.css("margin-left"), 10); 666 var newWidth = hoverMenuItem.width(); 667 magicLine.stop().animate({ 668 left: leftPos, 669 width: newWidth 670 }); 671 }, function() { 672 magicLine.stop().animate({ 673 left: magicLine.data("origLeft"), 674 width: originalWidth 675 }); 676 }); 677 678 } else { 679 680 magicLine.hide(); 681 682 } 683 } 684 }; 685 686 687 ///////////////////////////////////////////// 688 // RELOAD FUNCTIONS 689 ///////////////////////////////////////////// 690 691 var reloadFunctions = { 692 init:function() { 693 694 var deviceAgent = navigator.userAgent.toLowerCase(),
695 appleAgentID = deviceAgent.match(/(iphone|ipod|ipad)/); 696 697 // Remove title attributes from images to avoid showing on hover 698 jQuery('img[title]').each(function() { 699 jQuery(this).removeAttr('title'); 700 }); 701 702 jQuery('.ui-tabs-nav').on('click', 'a', function() { 703 jQuery(this).blur(); 704 }); 705 706 if (!appleAgentID) { 707 jQuery('embed').show(); 708 } 709 710 // Animate Top Links 711 jQuery('.animate-top').on('click', function(e) { 712 e.preventDefault(); 713 jQuery('body,html').animate({scrollTop: 0}, 800); 714 }); 715 }, 716 load:function() { 717 var deviceAgent = navigator.userAgent.toLowerCase(), 718 agentID = deviceAgent.match(/(iphone|ipod|ipad|android|iemobile)/); 719 720 if (!agentID) { 721 722 // Button hover tooltips 723 jQuery('.tooltip').each( function() { 724 jQuery(this).css( 'marginLeft', '-' + Math.round( (jQuery(this).outerWidth(true) / 2) ) + 'px' ); 725 }); 726 727 jQuery('.comment-avatar').hover( function() { 728 jQuery(this).find('.tooltip' ).stop().animate({ 729 bottom: '44px', 730 opacity: 1 731 }, 500, 'easeInOutExpo'); 732 }, function() { 733 jQuery(this).find('.tooltip').stop().animate({ 734 bottom: '25px', 735 opacity: 0 736 }, 400, 'easeInOutExpo'); 737 }); 738 739 jQuery('.grid-image').hover( function() { 740 jQuery(this).find('.tooltip' ).stop().animate({ 741 bottom: '85px', 742 opacity: 1 743 }, 500, 'easeInOutExpo'); 744 }, function() { 745 jQuery(this).find('.tooltip').stop().animate({ 746 bottom: '65px', 747 opacity: 0 748 }, 400, 'easeInOutExpo'); 749 }); 750 751 } 752 } 753 }; 754 755 756 ///////////////////////////////////////////// 757 // LOAD + READY FUNCTION 758 ///////////////////////////////////////////// 759 760 var sfIncluded = jQuery('#sf-included'); 761 762 var onReady = { 763 init: function(){ 764 page.init(); 765 header.init(); 766 nav.init(); 767 widgets.init(); 768 prettyPhoto.init(); 769 if (sfIncluded.hasClass('has-carousel')) { 770 carouselWidgets.init(); 771 } 772 if (sfIncluded.hasClass('has-map')) { 773 map.init(); 774 } 775 reloadFunctions.init(); 776 } 777 }; 778 var onLoad = { 779 init: function(){ 780 if (sfIncluded.hasClass('has-blog')) { 781 blog.init(); 782 } 783 navArrow.init(); 784 if (sfIncluded.hasClass('has-chart')) { 785 widgets.charts(); 786 } 787 if (sfIncluded.hasClass('has-progress-bar')) { 788 widgets.initSkillBars(); 789 } 790 reloadFunctions.load(); 791 } 792 }; 793 794 jQuery(document).ready(onReady.init); 795 jQuery(window).load(onLoad.init); 796 797})(jQuery); 798 799 800///////////////////////////////////////////// 801// SMARTRESIZE PLUGIN 802///////////////////////////////////////////// 803 804(function($,sr){ 805 806 // USE STRICT 807 "use strict"; 808 809 // debouncing function from John Hann 810 // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 811 var debounce = function (func, threshold, execAsap) { 812 var timeout; 813 814 return function debounced () { 815 var obj = this, args = arguments; 816 function delayed () { 817 if (!execAsap) { 818 func.apply(obj, args); 819 timeout = null; 820 } 821 } 822 823 if (timeout) { 824 clearTimeout(timeout); 825 } else if (execAsap) { 826 func.apply(obj, args); 827 } 828 829 timeout = setTimeout(delayed, threshold || 100); 830 }; 831 }; 832 833 // smartresize 834 jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); }; 835 836})(jQuery,'smartresize'); 837 838
839///////////////////////////////////////////// 840// DEBOUNCEDRESIZE PLUGIN 841///////////////////////////////////////////// 842 843(function($) { 844 845 // USE STRICT 846 "use strict"; 847 848 var $event = $.event, 849 $special, 850 resizeTimeout; 851 852 $special = $event.special.debouncedresize = { 853 setup: function() { 854 $( this ).on( "resize", $special.handler ); 855 }, 856 teardown: function() { 857 $( this ).off( "resize", $special.handler ); 858 }, 859 handler: function( event, execAsap ) { 860 // Save the context 861 var context = this, 862 args = arguments, 863 dispatch = function() { 864 // set correct event type 865 event.type = "debouncedresize"; 866 $event.dispatch.apply( context, args ); 867 }; 868 869 if ( resizeTimeout ) { 870 clearTimeout( resizeTimeout ); 871 } 872 873 execAsap ? 874 dispatch() : 875 resizeTimeout = setTimeout( dispatch, $special.threshold ); 876 }, 877 threshold: 150 878 }; 879 880})(jQuery); 881 882 883///////////////////////////////////////////// 884// EQUALHEIGHTS PLUGIN 885///////////////////////////////////////////// 886 887(function($) { 888 889 // USE STRICT 890 "use strict"; 891 892 $.fn.equalHeights = function(px) { 893 $(this).each(function(){ 894 var currentTallest = 0; 895 $(this).children().each(function(){ 896 if ($(this).height() > currentTallest) { currentTallest = $(this).height(); } 897 }); 898 if (!px && Number.prototype.pxToEm) { 899 currentTallest = currentTallest.pxToEm(); //use ems unless px is specified 900 } 901 $(this).children().css({'min-height': currentTallest}); 902 }); 903 return this; 904 }; 905})(jQuery); 906 907 908///////////////////////////////////////////// 909// EASYPIECHART PLUGIN 910///////////////////////////////////////////// 911 912(function($) { 913 // USE STRICT 914 "use strict"; 915 $.easyPieChart = function(el, options) { 916 var addScaleLine, animateLine, drawLine, easeInOutQuad, renderBackground, renderScale, renderTrack, 917 _this = this; 918 this.el = el; 919 this.$el = $(el); 920 this.$el.data("easyPieChart", this); 921 this.init = function() { 922 var percent; 923 _this.options = $.extend({}, $.easyPieChart.defaultOptions, options); 924 percent = parseInt(_this.$el.data('percent'), 10); 925 _this.percentage = 0; 926 _this.canvas = $("<canvas width='" + _this.options.size + "' height='" + _this.options.size + "'></canvas>").get(0); 927 _this.$el.append(_this.canvas); 928 if (typeof G_vmlCanvasManager !== "undefined" && G_vmlCanvasManager !== null) { 929 G_vmlCanvasManager.initElement(_this.canvas); 930 } 931 _this.ctx = _this.canvas.getContext('2d'); 932 if (window.devicePixelRatio > 1.5) { 933 $(_this.canvas).css({ 934 width: _this.options.size, 935 height: _this.options.size 936 }); 937 _this.canvas.width *= 2; 938 _this.canvas.height *= 2; 939 _this.ctx.scale(2, 2); 940 } 941 _this.ctx.translate(_this.options.size / 2, _this.options.size / 2); 942 _this.$el.addClass('easyPieChart'); 943 _this.$el.css({ 944 width: _this.options.size, 945 height: _this.options.size, 946 lineHeight: "" + _this.options.size + "px" 947 }); 948 _this.update(percent); 949 return _this; 950 }; 951 this.update = function(percent) { 952 if (_this.options.animate === false) { 953 return drawLine(percent); 954 } else { 955 if (percent === 0) { 956 return animateLine(0, 0); 957 } else { 958 return animateLine(_this.percentage, percent); 959 } 960 } 961 }; 962 renderScale = function() { 963 var i, _i, _results; 964 _this.ctx.fillStyle = _this.options.scaleColor; 965 _this.ctx.lineWidth = 1; 966 _results = []; 967 for (i = _i = 0; _i <= 24; i = ++_i) { 968 _results.push(addScaleLine(i)); 969 } 970 return _results; 971 }; 972 addScaleLine = function(i) { 973 var offset; 974 offset = i % 6 === 0 ? 0 : _this.options.size * 0.017; 975 _this.ctx.save(); 976 _this.ctx.rotate(i * Math.PI / 12); 977 _this.ctx.fillRect(_this.options.size / 2 - offset, 0, -_this.options.size * 0.05 + offset, 1); 978 return _this.ctx.restore(); 979 }; 980 renderTrack = function() { 981 var offset; 982 offset = _this.options.size / 2 - _this.options.lineWidth / 2; 983 if (_this.options.scaleColor !== false) { 984 offset -= _this.options.size * 0.08; 985 } 986 _this.ctx.beginPath(); 987 _this.ctx.arc(0, 0, offset, 0, Math.PI * 2, true); 988 _this.ctx.closePath(); 989 _this.ctx.strokeStyle = _this.options.trackColor; 990 _this.ctx.lineWidth = _this.options.lineWidth; 991 return _this.ctx.stroke(); 992 };
993 renderBackground = function() { 994 if (_this.options.scaleColor !== false) { 995 renderScale(); 996 } 997 if (_this.options.trackColor !== false) { 998 return renderTrack(); 999 } 1000 }; 1001 drawLine = function(percent) { 1002 var offset; 1003 renderBackground(); 1004 _this.ctx.strokeStyle = $.isFunction(_this.options.barColor) ? _this.options.barColor(percent) : _this.options.barColor; 1005 _this.ctx.lineCap = _this.options.lineCap; 1006 _this.ctx.lineWidth = _this.options.lineWidth; 1007 offset = _this.options.size / 2 - _this.options.lineWidth / 2; 1008 if (_this.options.scaleColor !== false) { 1009 offset -= _this.options.size * 0.08; 1010 } 1011 _this.ctx.save(); 1012 _this.ctx.rotate(-Math.PI / 2); 1013 _this.ctx.beginPath(); 1014 _this.ctx.arc(0, 0, offset, 0, Math.PI * 2 * percent / 100, false); 1015 _this.ctx.stroke(); 1016 return _this.ctx.restore(); 1017 }; 1018 animateLine = function(from, to) { 1019 var currentStep, fps, steps; 1020 fps = 30; 1021 steps = fps * _this.options.animate / 1000; 1022 currentStep = 0; 1023 _this.options.onStart.call(_this); 1024 _this.percentage = to; 1025 if (_this.animation) { 1026 clearInterval(_this.animation); 1027 _this.animation = false; 1028 } 1029 _this.animation = setInterval(function() { 1030 _this.ctx.clearRect(-_this.options.size / 2, -_this.options.size / 2, _this.options.size, _this.options.size); 1031 renderBackground.call(_this); 1032 drawLine.call(_this, [easeInOutQuad(currentStep, from, to - from, steps)]); 1033 currentStep++; 1034 if ((currentStep / steps) > 1) { 1035 clearInterval(_this.animation); 1036 _this.animation = false; 1037 return _this.options.onStop.call(_this); 1038 } 1039 }, 1000 / fps); 1040 return _this.animation; 1041 }; 1042 easeInOutQuad = function(t, b, c, d) { 1043 var easeIn, easing; 1044 easeIn = function(t) { 1045 return Math.pow(t, 2); 1046 }; 1047 easing = function(t) { 1048 if (t < 1) { 1049 return easeIn(t); 1050 } else { 1051 return 2 - easeIn((t / 2) * -2 + 2); 1052 } 1053 }; 1054 t /= d / 2; 1055 return c / 2 * easing(t) + b; 1056 }; 1057 return this.init(); 1058 }; 1059 $.easyPieChart.defaultOptions = { 1060 barColor: '#ef1e25', 1061 trackColor: '#f2f2f2', 1062 scaleColor: '#dfe0e0', 1063 lineCap: 'round', 1064 size: 110, 1065 lineWidth: 3, 1066 animate: false, 1067 onStart: $.noop, 1068 onStop: $.noop 1069 }; 1070 $.fn.easyPieChart = function(options) { 1071 return $.each(this, function(i, el) { 1072 var $el; 1073 $el = $(el); 1074 if (!$el.data('easyPieChart')) { 1075 return $el.data('easyPieChart', new $.easyPieChart(el, options)); 1076 } 1077 }); 1078 }; 1079 return void 0; 1080})(jQuery); 1081 1082 1083///////////////////////////////////////////// 1084// ANIMATE NUMBER PLUGIN 1085///////////////////////////////////////////// 1086 1087(function($) { 1088 1089 // USE STRICT 1090 "use strict"; 1091 1092 $.fn.animateNumber = function(to) { 1093 var $ele = $(this), 1094 num = parseInt($ele.html(), 10), 1095 up = to > num, 1096 num_interval = Math.abs(num - to) / 90; 1097 1098 var loop = function() { 1099 num = up ? Math.ceil(num+num_interval) : Math.floor(num-num_interval); 1100 if ( (up && num > to) || (!up && num < to) ) { 1101 num = to; 1102 clearInterval(animation); 1103 } 1104 $ele.html(num); 1105 }; 1106 1107 var intervalTime = to <= 5 ? intervalTime = 100 : to <= 25 ? intervalTime = 50 : to <= 50 ? intervalTime = 25 : 10; 1108 1109 var animation = setInterval(loop, intervalTime); 1110 }; 1111})(jQuery); 1112 1113 1114///////////////////////////////////////////// 1115// VIEWPORT PLUGIN 1116///////////////////////////////////////////// 1117 1118/* 1119 * Viewport - jQuery selectors for finding elements in viewport 1120 * 1121 * Copyright (c) 2008-2009 Mika Tuupola 1122 * 1123 * Licensed under the MIT license: 1124 * http://www.opensource.org/licenses/mit-license.php 1125 * 1126 * Project home: 1127 * http://www.appelsiini.net/projects/viewport 1128 * 1129 */ 1130 1131 1132(function($) { 1133 1134 // USE STRICT 1135 "use strict"; 1136 1137 $.belowthefold = function(element, settings) { 1138 var fold = $(window).height() + $(window).scrollTop(); 1139 return fold <= $(element).offset().top - settings.threshold; 1140 }; 1141 1142 $.abovethetop = function(element, settings) { 1143 var top = $(window).scrollTop(); 1144 return top >= $(element).offset().top + $(element).height() - settings.threshold; 1145 }; 1146 1147 $.rightofscreen = function(element, settings) { 1148 var fold = $(window).width() + $(window).scrollLeft(); 1149 return fold <= $(element).offset().left - settings.threshold; 1150 }; 1151 1152 $.leftofscreen = function(element, settings) { 1153 var left = $(window).scrollLeft(); 1154 return left >= $(element).offset().left + $(element).width() - settings.threshold; 1155 }; 1156 1157 $.inviewport = function(element, settings) { 1158 return !$.rightofscreen(element, settings) && !$.leftofscreen(element, settings) && !$.belowthefold(element, settings) && !$.abovethetop(element, settings); 1159 }; 1160 1161 $.extend($.expr[':'], { 1162 "below-the-fold": function(a) { 1163 return $.belowthefold(a, {threshold : 0}); 1164 }, 1165 "above-the-top": function(a) { 1166 return $.abovethetop(a, {threshold : 0}); 1167 }, 1168 "left-of-screen": function(a) { 1169 return $.leftofscreen(a, {threshold : 0}); 1170 }, 1171 "right-of-screen": function(a) { 1172 return $.rightofscreen(a, {threshold : 0}); 1173 }, 1174 "in-viewport": function(a) { 1175 return $.inviewport(a, {threshold : 0}); 1176 } 1177 }); 1178 1179 1180})(jQuery); 1181 1182(function($) { 1183 jQuery(document).ready(function() { 1184 jQuery('#menu-main-nav-bar-1').change(function(event) { 1185 var menuChoice = $(this).val(); 1186 location.href = menuChoice; 1187 event.preventDefault(); 1188 }); 1189 }); 1190})(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.