1 2 3 4jQuery(document).ready(function($) { 5 6"use strict"; 7/*-----------------------------------------------------------------------------------*/ 8/* Scroll Animation 9/*===================================================================================*/ 10 11 12 if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ){ 13 var s = skrollr.init({ 14 smoothScrollingDuration:30, 15 forceHeight:false 16 }); 17 } 18 else{ 19 $('html').addClass('noSkrollr'); 20 } 21 22 23 24/*-----------------------------------------------------------------------------------*/ 25/* Skill Rating Bar 26/*===================================================================================*/ 27 var bar = $('.bar'); 28 //Check if Elements are visible 29 $.fn.visible = function(partial){ 30 var $t = $(this), 31 $w = $(window), 32 viewTop = $w.scrollTop(), 33 viewBottom = viewTop + $w.height(), 34 _top = $t.offset().top, 35 _bottom = _top + $t.height(), 36 compareTop = partial === true ? _bottom : _top, 37 compareBottom = partial === true ? _top : _bottom; 38 return ((compareBottom <= viewBottom) && (compareTop >= viewTop)); 39 }; 40 function animateBar(){ 41 42 bar.each(function() { 43 if( $(this).visible(true) ) { 44 $(this).addClass('enabled'); 45 } 46 else { $(this).removeClass('enabled'); } 47 }); 48 }; 49/*-----------------------------------------------------------------------------------*/ 50/* Superslides 51/*===================================================================================*/ 52 53 54 55 $('.slides-container .slide-caption img').addClass('preserve'); 56 $('.slide-caption').each(function(){ 57 $(this).children().not('.scrollanimation, .videobg').wrapAll('<div class="captioninner"></div>'); 58 59 }); 60 61 62 63 function captionPosition(){ 64 $('#superslider_home .captioninner').each(function(){ 65 var captionHeight = $(this).outerHeight() / 2, 66 captionMargin = '-' + (captionHeight + 25) + 'px'; 67 $(this).css('marginTop', captionMargin); 68 }); 69 } 70 71 72 if (typeof superslider_animation !== 'undefined') { 73 $('#superslider_home').superslides({ 74 animation: superslider_animation, 75 play: superslider_play, // Milliseconds for delay 76 slide_speed: 1000, 77 pagination: superslider_pagination, 78 hashchange: false, 79 scrollable: true // Allow scrollable content inside slide 80 }); 81 if(superslider_animation == 'fade'){ 82 setTimeout(function() { 83 if ( $('.slides-container').children().length > 1 ) { 84 $(".slides-container, .slides-navigation").addClass('loaded'); 85 86 } 87 else{ 88 $(".slides-container").addClass('loaded'); 89 $(".slides-navigation").remove(); 90 91 } 92 $("#superslider_loading").addClass('unloaded'); 93 captionPosition(); 94 }, 400); 95 } 96 } 97 else{ 98 $('#superslider_home').superslides({ 99 scrollable: false // Allow scrollable content inside slide 100 }); 101 } 102 103 $('body, html').on('init.slides', function() { 104 105 if ( $('.slides-container').children().length > 1 ) { 106 $(".slides-container, .slides-navigation").addClass('loaded'); 107 108 } 109 else{ 110 $(".slides-container").addClass('loaded'); 111 $(".slides-navigation").remove(); 112 } 113 114 115 $("#superslider_loading").addClass('unloaded'); 116 captionPosition(); 117 118 119 }); 120 121 122 /*Touch Swipe*/ 123 /*if ($('html').hasClass("noSkrollr")) { 124 $("#superslider_home").swipe( { 125 swipeLeft:function() { 126 $('.slides-navigation .next').trigger('click'); 127 }, 128 swipeRight:function() { 129 $('.slides-navigation .prev').trigger('click'); 130 }, 131 }); 132 }*/ 133 134 135 136/*-----------------------------------------------------------------------------------*/ 137/* Video Slides 138/*===================================================================================*/ 139 140 141 if( $('.youtubeplayer').length ){ 142 $('.videobg').each( function() { 143 var youtubeplayer = $(this).find('.youtubeplayer'), 144 tubelink = $(this).find('.tubelink').val(); 145 146 youtubeplayer.tubeplayer({ 147 width: '', 148 height: '', 149 initialVideo: tubelink, 150 preferredQuality: "default" 151 }); 152 }); 153 } 154 if( $('.vimeoplayer').length ){ 155 var vimeoid = 1; 156 $('.vimeoplayer').each( function() { 157 $(this).attr("id", "vimeoplayer" + vimeoid); 158 $(this).attr("src", $(this).attr("src").replace("vimeoplayer", "vimeoplayer" + vimeoid++)); 159 }); 160 } 161 162 function videoSlides(){ 163 164 if (!$('html').hasClass("noSkrollr")) { 165 var currentSlideIndex = $('#superslider_home').superslides('current'), 166 currentSlide = $('.slides-container > li')[currentSlideIndex]; 167 168 /*Local Video*/ 169 if (Modernizr.video) { 170 171 $("video").each(function () { this.pause() }); 172 173 var currentVid = $(currentSlide).find("video")[0]; 174 if ($(currentVid).length) { 175 $(currentVid)[0].oncanplaythrough = $(currentVid)[0].play() 176 } 177 } 178 else{ 179 $('video').hide; 180 } 181 182 /*Vimeo*/ 183 if( $('.vimeoplayer').length ){ 184 185 $('.vimeoplayer').each( function() { 186 187 var frameid = $(this).attr('id'), 188 vimeoframe = $('#'+ frameid)[0], 189 vimeoplayer = $f(vimeoframe); 190 191 vimeoplayer.addEvent('ready', function() { 192 vimeoplayer.api('pause'); 193 }); 194 195 var currentVimeo = $(currentSlide).find(vimeoframe)[0]; 196 if ($(currentVimeo).length) { 197 vimeoplayer.addEvent('ready', function() { vimeoplayer.api('play'); }); 198 } 199 }); 200 } 201 /*YouTube*/ 202 if( $('.youtubeplayer').length ){ 203 $.tubeplayer.defaults.afterReady = function($player) { 204 $('.videobg').each( function() { 205 var youtubeplayer = $(this).find('.youtubeplayer'); 206 youtubeplayer.tubeplayer("pause"); 207 var currentTube = $(currentSlide).find(youtubeplayer); 208 if ($(currentTube).length) { 209 youtubeplayer.tubeplayer("play"); 210 } 211 }); 212 }; 213 214 $('.videobg').each( function() { 215 var youtubeplayer = $(this).find('.youtubeplayer'); 216 youtubeplayer.tubeplayer("pause"); 217 var currentTube = $(currentSlide).find(youtubeplayer); 218 if ($(currentTube).length) { 219 youtubeplayer.tubeplayer("play"); 220 } 221 }); 222 } 223 } 224 else{ 225 $('.videobg').hide(); 226 } 227 } 228 229 $('body, html').on('animated.slides || init.slides', function() { 230 videoSlides(); 231 }); 232 if(superslider_animation == 'fade'){ 233 setTimeout(function() { 234 videoSlides(); 235 }, 600); 236 } 237 238 function videoPos(){ 239 $('.videobg .video').each(function(){ 240 var vidWidth = $(this).outerWidth() / 2 + 'px'; 241 $(this).css({'position':'absolute', 'left':'50%', 'margin-left':'-' + vidWidth}); 242 243 }); 244 } 245 videoPos(); 246 247/*-----------------------------------------------------------------------------------*/ 248/* Portfolio 249/*===================================================================================*/ 250 251 function riftHeight(){ 252 $('#portfolioinner li').each(function(){ 253 var height = $(this).outerWidth(); 254 $(this).css('height', height ); 255 }); 256 } 257 258 $('.rift').rift(); 259 $('#portfolioinner').mixitup({ 260 onMixEnd: function(){ 261 $('.mix:visible').removeClass('mixHidden'); 262 $('.mix:hidden').addClass('mixHidden'); 263 264 if (!$('html').hasClass("noSkrollr")) { s.refresh(); } 265 266 } 267 }); 268 riftHeight(); 269 $('.filter').click(function(){ 270 riftHeight(); 271 }); 272 $(".grid > div").fitVids(); 273 if( $('#main').length ){ 274 var main = $('#main, #primary-nav, .footer'); 275 } 276 else{ 277 var main = $('body').children().not( ".mfp-bg, .mfp-wrap" ); 278 } 279 280 var topbar = $('#topbar,#active-bar'), 281 activeBar = $('#active-bar'), 282 portfolio = $(".nav-links li a:contains('Portfolio') , .nav-links li a:contains('portfolio')"), 283 scrollY; 284 $('#portfolioinner').magnificPopup({
285 delegate: '.mix:not(.mixHidden) a', 286 closeMarkup:'<div class="loadernav"><button title="%title%" class="mfp-close"><i class="mfp-close-icn">×</i></button></div>', 287 closeBtnInside: false, 288 closeOnBgClick:false, 289 type: 'ajax', 290 fixedContentPos:false, 291 mainClass: 'mfp-fade', 292 midClick: true, 293 gallery: { 294 enabled: true, 295 preload: [0,2], 296 navigateByImgClick: true, 297 tCounter: '<span class="mfp-counter">%curr% of %total%</span>' // markup of counter 298 }, 299 callbacks: { 300 parseAjax: function(mfpResponse) { 301 mfpResponse.data = $(mfpResponse.data).siblings('.portfolios'); 302 }, 303 change: function() { 304 if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ){ 305 $.magnificPopup.instance.next = function () {return false}; 306 $.magnificPopup.instance.prev = function () {return false}; 307 } 308 }, 309 ajaxContentAdded: function() { 310 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ){ 311 $('.parallaxBackground').each(function(){ 312 if($(this).prev().html() == false){ 313 $(this).prev().remove(); 314 } 315 }); 316 $(".grid > div").fitVids(); 317 initFlexSliders(); 318 } 319 else{ 320 $('article').waitForImages(function() { 321 $(".grid > div").fitVids(); 322 initFlexSliders(); 323 var loadernav = $('.loadernav'); 324 $(window).scrollTop(0); 325 if (!$('html').hasClass("noSkrollr")) { s.refresh(); } 326 $('.parallaxBackground').each(function(){ 327 if($(this).prev().html() == false){ 328 $(this).prev().remove(); 329 } 330 }); 331 loadernav.animate({ marginTop: "0px" }, 200 ); 332 $.magnificPopup.instance.next = function () { 333 if (loadernav.is(':animated') || $('.mfp-container').hasClass('mfp-s-loading') ) { 334 return false; 335 }else{ 336 loadernav.animate({ marginTop: "-50px" }, 200 ); setTimeout(function(){ $.magnificPopup.proto.next.call(this); }, 200); }; 337 } 338 $.magnificPopup.instance.prev = function () { 339 if (loadernav.is(':animated') || $('.mfp-container').hasClass('mfp-s-loading') ) { 340 return false; 341 }else{ 342 loadernav.animate({ marginTop: "-50px" }, 200 ); setTimeout(function(){ $.magnificPopup.proto.prev.call(this); }, 200); }; 343 } 344 $.magnificPopup.instance.close = function () { loadernav.animate({ marginTop: "-50px" }, 100 ); setTimeout(function(){ $.magnificPopup.proto.close.call(this); }, 100); }; 345 }); 346 } 347 }, 348 open: function() { 349 if( $('#wpadminbar').length ){ 350 var wpadminbar = $('#wpadminbar').outerHeight() + 'px'; 351 $('.loadernav').css('top',wpadminbar); 352 } 353 if($('.mix:not(.mixHidden)').length > 1){ 354 $('.loadernav').append(this.arrowLeft.add(this.arrowRight)); 355 } 356 scrollY = window.pageYOffset || document.documentElement.scollTop; 357 $('.mfp-wrap').css('top','0'); 358 $('.lt-ie8 body').css('overflow','auto'); 359 main.addClass('hide'); 360 topbar.animate({ marginTop: "-1px" }, 200) 361 if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ){ $.magnificPopup.instance.close = function () {return false}; } 362 }, 363 close: function() { 364 main.removeClass('hide'); 365 topbar.css('marginTop','0'); 366 $('.lt-ie8 body').css('overflow','hidden'); 367 }, 368 afterClose: function() { 369 $(window).scrollTop(scrollY); 370 riftHeight(); 371 captionPosition(); 372 setTimeout(function(){ 373 if (!$('html').hasClass("noSkrollr")) { s.refresh(); } 374 portfolio.parent().addClass('nav-active').siblings().removeClass('nav-active'); 375 var xMove = $('.nav-active').offset().left; 376 var barWidth = $('.nav-active').outerWidth() + 'px'; 377 activeBar.css({ left: xMove, width: barWidth }); 378 }, 200); 379 } 380 } 381 }); 382/*-----------------------------------------------------------------------------------*/ 383/* Parallax Section 384/*===================================================================================*/ 385 var parallaxSection = 1; 386 $('.parallaxSection').each(function(){ 387 $(this).attr("id", "parallaxSection" + parallaxSection++); 388 }) 389 $('.scrollanimation').each(function(){ 390 if ($(this).parent().parent().hasClass('parallaxSection')){ 391 var parallaxSectionId = $(this).parent().parent().attr("id"); 392 $(this).attr("data-anchor-target", "#" + parallaxSectionId); 393 }
394 else if($(this).parent().hasClass('iconholder')){ 395 var parallaxSectionId = $(this).closest('.parallaxSection').attr("id"); 396 $(this).attr("data-anchor-target", "#" + parallaxSectionId); 397 } 398 }); 399/*-----------------------------------------------------------------------------------*/ 400/* Parallax Background 401/*===================================================================================*/ 402 $('.parallaxBackground').each(function(){ 403 if ($(this).parent().hasClass('page')){ 404 $(this).parent().addClass('nopadding'); 405 } 406 if($(this).next().hasClass('parallaxSection')){ 407 $(this).next().css('margin-top','0'); 408 } 409 if($(this).prev().html() == false){ 410 $(this).prev().remove(); 411 } 412 }); 413 $('#main > div:nth-child(2) .parallaxBackground').removeAttr("data-bottom-top"); 414 415/*-----------------------------------------------------------------------------------*/ 416/* Tabbed Page 417/*===================================================================================*/ 418 $('ul.tabs').each(function(){ 419 var $active, $content, $links = $(this).find('a'); 420 $active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]); 421 $active.addClass('active'); 422 $content = $($active.attr('href')); 423 $links.not($active).each(function () { 424 $($(this).attr('href')).hide(); 425 }); 426 $(this).on('click', 'a', function(e){ 427 $active.removeClass('active'); 428 $content.hide(); 429 $active = $(this); 430 $content = $($(this).attr('href')); 431 $active.addClass('active'); 432 $content.show(); 433 e.preventDefault(); 434 if (!$('html').hasClass("noSkrollr")) { s.refresh(); } 435 }); 436 }); 437 438/*-----------------------------------------------------------------------------------*/ 439/* Googlemap - slightly modified code from http://aquagraphite.com/ 440/*===================================================================================*/ 441 function googleMap(){ 442 $('.googlemap').each( function() { 443 var $map_id = $(this).attr('id'), 444 $title = $(this).find('.title').val(), 445 $location = $(this).find('.location').val(), 446 $zoom = parseInt( $(this).find('.zoom').val() ), 447 $hue = $(this).find('.hue').val(), 448 $saturation = $(this).find('.saturation').val(), 449 $lightness = $(this).find('.lightness').val(), 450 $iconLink = $(this).find('.iconLink').val(), 451 geocoder, map; 452 var styles = [ 453 { 454 stylers: [ 455 { hue: $hue }, 456 { saturation: $saturation }, 457 { lightness: $lightness} 458 ] 459 } 460 ]; 461 462 var mapOptions = { 463 zoom: $zoom, 464 scrollwheel: false, 465 mapTypeId: google.maps.MapTypeId.ROADMAP, 466 styles: styles 467 }; 468 geocoder = new google.maps.Geocoder(); 469 geocoder.geocode( { 'address': $location}, function(results, status) { 470 if (status == google.maps.GeocoderStatus.OK) { 471 var mapOptions = { 472 zoom: $zoom, 473 scrollwheel: false, 474 mapTypeId: google.maps.MapTypeId.ROADMAP, 475 styles: styles 476 }; 477 map = new google.maps.Map($('#'+ $map_id + ' .map_canvas')[0], mapOptions); 478 479 //MAP IN TAB 480 $('.tabs li a').click(function(){ 481 var content = $(this).attr('href'); 482 if($(content).find('.googlemap').length > 0){ 483 setTimeout(function() { 484 google.maps.event.trigger(map, 'resize'); 485 map.setCenter(results[0].geometry.location); 486 }, 0); 487 } 488 }); 489 490 491 492 map.setCenter(results[0].geometry.location); 493 var marker = new google.maps.Marker({ 494 map: map, 495 position: results[0].geometry.location, 496 title : $location, 497 icon: $iconLink 498 499 }); 500 var contentString = '<div class="map-infowindow">'+ 501 ( ($title) ? '<h3>' + $title + '</h3>' : '' ) + 502 $location + '<br/>' + 503 '<a href="https://maps.google.com/?q='+ $location +'" target="_blank">View on Google Map</a>' + 504 '</div>'; 505 var infowindow = new google.maps.InfoWindow({ 506 content: contentString 507 }); 508 google.maps.event.addListener(marker, 'click', function() { 509 infowindow.open(map,marker); 510 }); 511 } else { 512 $('#'+ $map_id).html("Geocode was not successful for the following reason: " + status); 513 } 514 }); 515 516 517 518 519 }); 520 }; 521/*-----------------------------------------------------------------------------------*/ 522/* Flex Slider 523/*===================================================================================*/ 524 525function initFlexSliders() { 526 if (typeof flex_slider_animation !== 'undefined') { 527 528 $('#testimonials').flexslider({ 529 animation: 'fade', 530 controlNav: false,
531 useCSS: false, 532 slideshowSpeed: 4000, 533 slideshow: testimonials_auto_play 534 535 }); 536 $('.flexslider:visible').flexslider({ 537 animation: flex_slider_animation, //String: Select your animation type, "fade" or "slide" 538 direction: flex_slider_direction, //String: Select the sliding direction, "horizontal" or "vertical" 539 startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide) 540 slideshow: flex_slider_auto_play, //Boolean: Animate slider automatically 541 slideshowSpeed: flex_slider_slideshowspeed, //Integer: Set the speed of the slideshow cycling, in milliseconds 542 initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds 543 useCSS: false, //{NEW} Boolean: Slider will use CSS3 transitions if available 544 touch: false, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices 545 video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches 546 controlNav: flex_slider_controlnav, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage 547 prevText: "Previous", //String: Set the text for the "previous" directionNav item 548 nextText: "Next", //String: Set the text for the "next" directionNav item 549 keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys 550 multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present. 551 mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel 552 pausePlay: false, //Boolean: Create pause/play dynamic element 553 pauseText: 'Pause', //String: Set the text for the "pause" pausePlay item 554 playText: 'Play', 555 start: function(){ 556 if (!$('html').hasClass("noSkrollr")) { s.refresh(); } 557 558 } 559 }); 560 } 561 else{ 562 $('.flexslider:visible, #testimonials').flexslider(); 563 } 564}; 565 566initFlexSliders(); 567$('.tabs li a').click(function(){ 568 setTimeout(function() { 569 initFlexSliders(); 570 }, 150); 571}); 572 573/*-----------------------------------------------------------------------------------*/ 574/* Events 575/*===================================================================================*/ 576 577 578 $(window).load(function(){ 579 if (!$('html').hasClass("noSkrollr")) { s.refresh(); } 580 googleMap(); 581 captionPosition(); 582 583 }); 584 585 $(window).scroll(function() { 586 animateBar(); 587 }); 588 589 590 $(window).resize(function() { 591 riftHeight(); 592 setTimeout(function() { 593 videoPos(); 594 captionPosition(); 595 if (!$('html').hasClass("noSkrollr")) { s.refresh(); } 596 }, 150); 597 }); 598 599 600});//End Document Ready 601 602 603 604 605
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.