1 2/*3D slideshow*/ 3jQuery(document).ready(function($){ 4 5 $.fn.exists = function() { 6 if ($(this).length > 0) { 7 return true; 8 } else { 9 return false; 10 } 11 } 12 13 /* !- Check if element is loaded */ 14 $.fn.loaded = function(callback, jointCallback, ensureCallback){ 15 var len = this.length; 16 if (len > 0) { 17 return this.each(function() { 18 var el = this, 19 $el = $(el), 20 blank = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; 21 22 $el.on("load.dt", function(event) { 23 $(this).off("load.dt"); 24 if (typeof callback == "function") { 25 callback.call(this); 26 } 27 if (--len <= 0 && (typeof jointCallback == "function")){ 28 jointCallback.call(this); 29 } 30 }); 31 32 if (!el.complete || el.complete === undefined) { 33 el.src = el.src; 34 } else { 35 $el.trigger("load.dt") 36 } 37 }); 38 } else if (ensureCallback) { 39 if (typeof jointCallback == "function") { 40 jointCallback.call(this); 41 } 42 return this; 43 } 44 }; 45 46 var $body = $("body"), 47 $window = $(window), 48 $mainSlider = $('#main-slideshow'), 49 $3DSlider = $('.three-d-slider'), 50 adminH = $('#wpadminbar').height(), 51 header = $('.masthead:not(.side-header):not(.side-header-v-stroke)').height(); 52 53 if($body.hasClass("transparent")){ 54 var headerH = 0; 55 }else if($body.hasClass("overlap")){ 56 var headerH = ($('.masthead:not(.side-header):not(.side-header-v-stroke)').height() + (parseInt($mainSlider.css("marginTop")) + parseInt($mainSlider.css("marginBottom")) )); 57 }else{ 58 var headerH = $('.masthead:not(.side-header):not(.side-header-v-stroke)').height(); 59 } 60 61 62 63 64/*! 65 * 66 * jQuery collagePlus Plugin v0.3.2 67 * https://github.com/ed-lea/jquery-collagePlus 68 * 69 * Copyright 2012, Ed Lea twitter.com/ed_lea 70 * 71 * built for http://qiip.me 72 * 73 * Dual licensed under the MIT or GPL Version 2 licenses. 74 * http://www.opensource.org/licenses/mit-license.php 75 * http://www.opensource.org/licenses/GPL-2.0 76 * 77 * 78 * Heavily modified by Dream-Theme.com 79 */ 80 81 82 83 84 85 $.fn.collagePlus = function( options ) { 86 87 var defaults = { 88 // the ideal height you want your images to be 89 'targetHeight' : 400, 90 // width of the area the collage will be in 91 'albumWidth' : this.width(), 92 // padding between the images 93 'padding' : parseFloat( this.css('padding-left') ), 94 // object that contains the images to collage 95 'images' : this.children(), 96 // how quickly you want images to fade in once ready can be in ms, "slow" or "fast" 97 'fadeSpeed' : "fast", 98 // how the resized block should be displayed. inline-block by default so that it doesn't break the row 99 'display' : "inline-block", 100 // which effect you want to use for revealing the images (note CSS3 browsers only), 101 'effect' : 'default', 102 // effect delays can either be applied per row to give the impression of descending appearance 103 // or horizontally, so more like a flock of birds changing direction 104 'direction' : 'vertical', 105 // Sometimes there is just one image on the last row and it gets blown up to a huge size to fit the 106 // parent div width. To stop this behaviour, set this to true 107 'allowPartialLastRow' : false 108 }; 109 110 var settings = $.extend({}, defaults, options); 111 112 return this.each(function() { 113 114 /* 115 * 116 * set up vars 117 * 118 */ 119 120 // track row width by adding images, padding and css borders etc 121 var row = 0, 122 // collect elements to be re-sized in current row 123 elements = [], 124 // track the number of rows generated 125 rownum = 1; 126 127 128 settings.images.each( 129 function(index){ 130 /* 131 * 132 * Cache selector 133 * Even if first child is not an image the whole sizing is based on images 134 * so where we take measurements, we take them on the images 135 * 136 */ 137 var $this = $(this), 138 $img = ($this.is("img")) ? $this : $(this).find("img").not(".blur-effect").first(); 139 140 /* 141 * 142 * get the current image size. Get image size in this order 143 * 144 * 1. from <img> tag 145 * 2. from data set from initial calculation 146 * 3. after loading the image and checking it's actual size 147 * 148 */ 149 if ($img.attr("width") != 'undefined' && $img.attr("height") != 'undefined') { 150 var w = (typeof $img.data("width") != 'undefined') ? $img.data("width") : $img.attr("width"), 151 h = (typeof $img.data("height") != 'undefined') ? $img.data("height") : $img.attr("height"); 152 153 } 154 else { 155 var w = (typeof $img.data("width") != 'undefined') ? $img.data("width") : $img.width(), 156 h = (typeof $img.data("height") != 'undefined') ? $img.data("height") : $img.height(); 157 } 158 159 160 161 /* 162 * 163 * Get any current additional properties that may affect the width or height 164 * like css borders for example 165 * 166 */ 167 var imgParams = getImgProperty($img); 168 169 170 /* 171 * 172 * store the original size for resize events 173 * 174 */ 175 $img.data("width", w); 176 $img.data("height", h); 177 178 179 180 /* 181 * 182 * calculate the w/h based on target height 183 * this is our ideal size, but later we'll resize to make it fit 184 * 185 */ 186 var nw = Math.ceil(w/h*settings.targetHeight), 187 nh = Math.ceil(settings.targetHeight); 188 189 /* 190 * 191 * Keep track of which images are in our row so far 192 * 193 */ 194 elements.push([this, nw, nh, imgParams['w'], imgParams['h']]); 195 196 /* 197 * 198 * calculate the width of the element including extra properties 199 * like css borders 200 * 201 */ 202 row += nw + imgParams['w'] + settings.padding; 203 204 /* 205 * 206 * if the current row width is wider than the parent container 207 * it's time to make a row out of our images 208 * 209 */ 210 if( row > settings.albumWidth && elements.length != 0 ){ 211 212 // call the method that calculates the final image sizes 213 // remove one set of padding as it's not needed for the last image in the row 214 resizeRow(elements, row, settings, rownum); 215 216 // reset our row 217 delete row; 218 delete elements; 219 row = 0; 220 elements = []; 221 rownum += 1; 222 } 223 224 225 /* 226 * 227 * if the images left are not enough to make a row 228 * then we'll force them to make one anyway 229 * 230 */ 231 if ( settings.images.length-1 == index && elements.length != 0){ 232 resizeRow(elements, row, settings, rownum); 233 234 // reset our row 235 delete row; 236 delete elements; 237 row = 0; 238 elements = []; 239 rownum += 1; 240 } 241 } 242 ); 243 244 // trigger "jgDone" event when all is ready 245 $(this).trigger("jgDone"); 246 }); 247 248 function resizeRow(obj, row, settings, rownum) { 249 /* 250 *
251 * How much bigger is this row than the available space? 252 * At this point we have adjusted the images height to fit our target height 253 * so the image size will already be different from the original. 254 * The resizing we're doing here is to adjust it to the album width. 255 * 256 * We also need to change the album width (basically available space) by 257 * the amount of padding and css borders for the images otherwise 258 * this will skew the result. 259 * 260 * This is because padding and borders remain at a fixed size and we only 261 * need to scale the images. 262 * 263 */ 264 var imageExtras = (settings.padding * obj.length) + (obj.length * obj[0][3]), 265 albumWidthAdjusted = settings.albumWidth - imageExtras, 266 overPercent = albumWidthAdjusted / (row - imageExtras), 267 // start tracking our width with know values that will make up the total width 268 // like borders and padding 269 trackWidth = imageExtras, 270 // guess whether this is the last row in a set by checking if the width is less 271 // than the parent width. 272 lastRow = (row < settings.albumWidth ? true : false); 273 274 275 276 /* 277 * Resize the images by the above % so that they'll fit in the album space 278 */ 279 for (var i = 0; i < obj.length; i++) { 280 281 282 283 var $obj = $(obj[i][0]), 284 fw = Math.floor(obj[i][1] * overPercent), 285 fh = Math.floor(obj[i][2] * overPercent), 286 // if the element is the last in the row, 287 // don't apply right hand padding (this is our flag for later) 288 isNotLast = !!(( i < obj.length - 1 )); 289 290 /* 291 * Checking if the user wants to not stretch the images of the last row to fit the 292 * parent element size 293 */ 294 if(settings.allowPartialLastRow === true && lastRow === true){ 295 fw = obj[i][1]; 296 fh = obj[i][2]; 297 } 298 299 300 /* 301 * 302 * Because we use % to calculate the widths, it's possible that they are 303 * a few pixels out in which case we need to track this and adjust the 304 * last image accordingly 305 * 306 */ 307 trackWidth += fw; 308 309 310 /* 311 * 312 * here we check if the combined images are exactly the width 313 * of the parent. If not then we add a few pixels on to make 314 * up the difference. 315 * 316 * This will alter the aspect ratio of the image slightly, but 317 * by a noticable amount. 318 * 319 * If the user doesn't want full width last row, we check for that here 320 * 321 */ 322 /* 323 if(!isNotLast && trackWidth < settings.albumWidth){ 324 if(settings.allowPartialLastRow === true && lastRow === true){ 325 fw = fw; 326 }else{ 327 fw = fw + (settings.albumWidth - trackWidth); 328 } 329 } 330 */ 331 332 /* 333 * 334 * We'll be doing a few things to the image so here we cache the image selector 335 * 336 * 337 */ 338 var $img = ( $obj.is("img") ) ? $obj : $obj.find("img").not(".blur-effect").first(); 339 340 /* 341 * 342 * Set the width of the image and parent element 343 * if the resized element is not an image, we apply it to the child image also 344 * 345 * We need to check if it's an image as the css borders are only measured on 346 * images. If the parent is a div, we need make the contained image smaller 347 * to accommodate the css image borders. 348 * 349 */ 350 $img.width(fw); 351 if( !$obj.is("img") ){ 352 $obj.width(fw + obj[i][3]); 353 } 354 355 356 /* 357 * 358 * Set the height of the image 359 * if the resized element is not an image, we apply it to the child image also 360 * 361 */
362 $img.height(fh); 363 if( !$obj.is("img") ){ 364 $obj.height(fh + obj[i][4]); 365 } 366 367 368 /* 369 * 370 * Apply the css extras like padding 371 * 372 */ 373 if (settings.allowPartialLastRow === false && lastRow === true) { 374 applyModifications($obj, isNotLast, "none"); 375 } 376 else { 377 applyModifications($obj, isNotLast, settings.display); 378 }; 379 380 381 /* 382 * 383 * Assign the effect to show the image 384 * Default effect is using jquery and not CSS3 to support more browsers 385 * Wait until the image is loaded to do this 386 * 387 */ 388 /* 389 $img 390 .load(function(target) { 391 return function(){ 392 if( settings.effect == 'default'){ 393 target.animate({opacity: '1'},{duration: settings.fadeSpeed}); 394 } else { 395 if(settings.direction == 'vertical'){ 396 var sequence = (rownum <= 10 ? rownum : 10); 397 } else { 398 var sequence = (i <= 9 ? i+1 : 10); 399 } 400 401 target.addClass(settings.effect); 402 target.addClass("effect-duration-" + sequence); 403 } 404 } 405 }($obj)) 406 */ 407 /* 408 * fix for cached or loaded images 409 * For example if images are loaded in a "window.load" call we need to trigger 410 * the load call again 411 */ 412 /* 413 .each(function() { 414 if(this.complete) $(this).trigger('load'); 415 }); 416 */ 417 418 } 419 } 420 421 /* 422 * 423 * This private function applies the required css to space the image gallery 424 * It applies it to the parent element so if an image is wrapped in a <div> then 425 * the css is applied to the <div> 426 * 427 */ 428 function applyModifications($obj, isNotLast, settingsDisplay) { 429 var css = { 430 /* 431 // Applying padding to element for the grid gap effect 432 'margin-bottom' : settings.padding + "px", 433 'margin-right' : (isNotLast) ? settings.padding + "px" : "0px", 434 */ 435 // Set it to an inline-block by default so that it doesn't break the row 436 'display' : settingsDisplay, 437 // Set vertical alignment otherwise you get 4px extra padding 438 'vertical-align' : "bottom", 439 // Hide the overflow to hide the caption 440 'overflow' : "hidden" 441 }; 442 443 return $obj.css(css); 444 } 445 446 447 /* 448 * 449 * This private function calculates any extras like padding, border associated 450 * with the image that will impact on the width calculations 451 * 452 */ 453 function getImgProperty(img) { 454 $img = $(img); 455 var params = new Array(); 456 params["w"] = (parseFloat($img.css("border-left-width")) + parseFloat($img.css("border-right-width"))); 457 params["h"] = (parseFloat($img.css("border-top-width")) + parseFloat($img.css("border-bottom-width"))); 458 return params; 459 } 460 461 }; 462 463 464/* !- Justified Gallery Initialisation */ 465 466 467 var jgCounter = 0; 468 $(".jg-container").each(function() { 469 jgCounter++; 470 var $jgContainer = $(this), 471 $jgItemsPadding = $jgContainer.attr("data-padding"), 472 $jgItems = $jgContainer.find(".wf-cell"); 473 // .iso-item elements are hidden by default, so we show them. 474 475 $jgContainer.attr("id", "jg-container-" + jgCounter + ""); 476 477 $("<style type='text/css'>" + ' .content #jg-container-' + jgCounter + ' .wf-cell' + '{padding:' + $jgItemsPadding + ';}' + ' .content #jg-container-' + jgCounter + '.wf-container' + '{'+ 'margin:' + '-'+ $jgItemsPadding + ';}' + ' .content .full-width-wrap #jg-container-' + jgCounter + '.wf-container' + '{'+ 'margin-left:' + $jgItemsPadding + '; '+ 'margin-right:' + $jgItemsPadding + '; '+ 'margin-top:' + '-' + $jgItemsPadding + '; '+ 'margin-bottom:' + '-' + $jgItemsPadding + ';}' +"</style>").insertAfter($jgContainer); 478 479 $jgContainer.on("jgDone", function() {
480 // var layzrJGrid = new Layzr({ 481 // // container: ".jg-container", 482 // selector: '[data-layzr-jgrid]', 483 // attr: 'data-layzr-jgrid', 484 // retinaAttr: 'data-layzr-jgrid-retina', 485 // threshold: 0, 486 // callback: function() { 487 // $(this).velocity({ 488 // "opacity" : 1 489 // }, 350); 490 // } 491 // }); 492 var layzrJGrid = new Layzr({ 493 selector: '.jgrid-lazy-load', 494 attr: 'data-src', 495 attrSrcSet: 'data-srcset', 496 retinaAttr: 'data-src-retina', 497 threshold: 0, 498 before: function() { 499 500 // For fixed-size images with srcset; or have to be updated on window resize. 501 this.setAttribute("sizes", this.width+"px"); 502 }, 503 callback: function() { 504 505 this.classList.add("jgrid-layzr-loaded"); 506 var $this = $(this); 507 $this.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) { 508 setTimeout(function(){ 509 $this.parent().removeClass("layzr-bg"); 510 }, 200) 511 }); 512 } 513 }); 514 }); 515 }); 516 517 $.fn.collage = function(args) { 518 return this.each(function() { 519 var $this = $(this); 520 var $jgContainer = $(this), 521 $jgItemsPadding = $jgContainer.attr("data-padding"), 522 $jgItems = $jgContainer.find(".wf-cell"); 523 var jgPadding = parseFloat($jgItems.first().css('padding-left')) + parseFloat($jgItems.first().css('padding-right')), 524 jgTargetHeight = parseInt($jgContainer.attr("data-target-height")), 525 jdPartRow = true; 526 527 if ($jgContainer.attr("data-part-row") == "false") { 528 jdPartRow = false; 529 }; 530 531 532 if($jgContainer.parent(".full-width-wrap").length){ 533 var jgAlbumWidth = $jgContainer.parents(".full-width-wrap").width() - parseInt($jgItemsPadding)*2; 534 }else{ 535 var jgAlbumWidth = $jgContainer.parent().width() + parseInt($jgItemsPadding)*2; 536 } 537 538 var $jgCont = { 539 'albumWidth' : jgAlbumWidth, 540 'targetHeight' : jgTargetHeight, 541 'padding' : jgPadding, 542 'allowPartialLastRow' : jdPartRow, 543 'fadeSpeed' : 2000, 544 'effect' : 'effect-1', 545 'direction' : 'vertical' 546 }; 547 $.extend($jgCont, args); 548 549 dtGlobals.jGrid = $jgCont; 550 $jgContainer.collagePlus($jgCont); 551 $jgContainer.css({ 552 'width': jgAlbumWidth 553 }); 554 }); 555 }; 556 $(window).on("debouncedresize", function() { 557 $(".jg-container").not('.jgrid-shortcode').collage(); 558 $(".jgrid-shortcode").each(function() { 559 var $this = $(this); 560 var $visibleItems = $this.data('visibleItems'); 561 if ( $visibleItems ) { 562 $this.collage({ 'images': $visibleItems }); 563 } else { 564 $this.collage(); 565 } 566 }); 567 }).trigger( "debouncedresize" ); 568 569 570/** 571 * jquery.hoverdir.js v1.1.0 572 * http://www.codrops.com 573 * 574 * Licensed under the MIT license. 575 * http://www.opensource.org/licenses/mit-license.php 576 * 577 * Copyright 2012, Codrops 578 * http://www.codrops.com 579 */ 580 581 582 'use strict'; 583 584 $.HoverDir = function( options, element ) { 585 586 this.$el = $( element ); 587 this._init( options ); 588 589 }; 590 591 // the options 592 $.HoverDir.defaults = { 593 speed : 300, 594 easing : 'ease', 595 hoverDelay : 0, 596 inverse : false 597 }; 598 599 $.HoverDir.prototype = { 600 601 _init : function( options ) { 602 603 // options 604 this.options = $.extend( true, {}, $.HoverDir.defaults, options ); 605 // transition properties 606 this.transitionProp = 'all ' + this.options.speed + 'ms ' + this.options.easing; 607 // support for CSS transitions 608 this.support = Modernizr.csstransitions; 609 // load the events 610 this._loadEvents(); 611 612 }, 613 614 _loadEvents : function() { 615 616 var self = this; 617 618 this.$el.on( 'mouseenter.hoverdir, mouseleave.hoverdir', function( event ) { 619 620 var $el = $( this ), 621 $hoverElem = $el.find( '.rollover-content' ), 622 direction = self._getDir( $el, { x : event.pageX, y : event.pageY } ), 623 styleCSS = self._getStyle( direction ); 624 625 if( event.type === 'mouseenter' ) { 626 627 $hoverElem.hide().css( styleCSS.from ); 628 clearTimeout( self.tmhover ); 629 630 self.tmhover = setTimeout( function() { 631 632 $hoverElem.show( 0, function() { 633 634 var $el = $( this ); 635 if( self.support ) { 636 $el.css( 'transition', self.transitionProp ); 637 } 638 self._applyAnimation( $el, styleCSS.to, self.options.speed ); 639 640 } ); 641 642 643 }, self.options.hoverDelay ); 644 645 } 646 else { 647 648 if( self.support ) { 649 $hoverElem.css( 'transition', self.transitionProp ); 650 } 651 clearTimeout( self.tmhover ); 652 self._applyAnimation( $hoverElem, styleCSS.from, self.options.speed ); 653 654 } 655 656 } ); 657 658 }, 659 // credits : http://stackoverflow.com/a/3647634 660 _getDir : function( $el, coordinates ) { 661 662 // the width and height of the current div 663 var w = $el.width(), 664 h = $el.height(), 665 666 // calculate the x and y to get an angle to the center of the div from that x and y. 667 // gets the x value relative to the center of the DIV and "normalize" it 668 x = ( coordinates.x - $el.offset().left - ( w/2 )) * ( w > h ? ( h/w ) : 1 ), 669 y = ( coordinates.y - $el.offset().top - ( h/2 )) * ( h > w ? ( w/h ) : 1 ), 670 671 // the angle and the direction from where the mouse
671came in/went out clockwise (TRBL=0123); 672 // first calculate the angle of the point, 673 // add 180 deg to get rid of the negative values 674 // divide by 90 to get the quadrant 675 // add 3 and do a modulo by 4 to shift the quadrants to a proper clockwise TRBL (top/right/bottom/left) **/ 676 direction = Math.round( ( ( ( Math.atan2(y, x) * (180 / Math.PI) ) + 180 ) / 90 ) + 3 ) % 4; 677 678 return direction; 679 680 }, 681 _getStyle : function( direction ) { 682 683 var fromStyle, toStyle, 684 slideFromTop = { left : '0px', top : '-100%' }, 685 slideFromBottom = { left : '0px', top : '100%' }, 686 slideFromLeft = { left : '-100%', top : '0px' }, 687 slideFromRight = { left : '100%', top : '0px' }, 688 slideTop = { top : '0px' }, 689 slideLeft = { left : '0px' }; 690 691 switch( direction ) { 692 case 0: 693 // from top 694 fromStyle = !this.options.inverse ? slideFromTop : slideFromBottom; 695 toStyle = slideTop; 696 break; 697 case 1: 698 // from right 699 fromStyle = !this.options.inverse ? slideFromRight : slideFromLeft; 700 toStyle = slideLeft; 701 break; 702 case 2: 703 // from bottom 704 fromStyle = !this.options.inverse ? slideFromBottom : slideFromTop; 705 toStyle = slideTop; 706 break; 707 case 3: 708 // from left 709 fromStyle = !this.options.inverse ? slideFromLeft : slideFromRight; 710 toStyle = slideLeft; 711 break; 712 }; 713 714 return { from : fromStyle, to : toStyle }; 715 716 }, 717 // apply a transition or fallback to jquery animate based on Modernizr.csstransitions support 718 _applyAnimation : function( el, styleCSS, speed ) { 719 720 $.fn.applyStyle = this.support ? $.fn.css : $.fn.animate; 721 el.stop().applyStyle( styleCSS, $.extend( true, [], { duration : speed + 'ms' } ) ); 722 723 }, 724 725 }; 726 727 var logError = function( message ) { 728 729 if ( window.console ) { 730 731 window.console.error( message ); 732 733 } 734 735 }; 736 737 $.fn.hoverdir = function( options ) { 738 739 var instance = $.data( this, 'hoverdir' ); 740 741 if ( typeof options === 'string' ) { 742 743 var args = Array.prototype.slice.call( arguments, 1 ); 744 745 this.each(function() { 746 747 if ( !instance ) { 748 749 logError( "cannot call methods on hoverdir prior to initialization; " + 750 "attempted to call method '" + options + "'" ); 751 return; 752 753 } 754 755 if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) { 756 757 logError( "no such method '" + options + "' for hoverdir instance" ); 758 return; 759 760 } 761 762 instance[ options ].apply( instance, args ); 763 764 }); 765 766 } 767 else { 768 769 this.each(function() { 770 771 if ( instance ) { 772 773 instance._init(); 774 775 } 776 else { 777 778 instance = $.data( this, 'hoverdir', new $.HoverDir( options, this ) ); 779 780 } 781 782 }); 783 784 } 785 786 return instance; 787 788 }; 789 790 791 /*!-Hover Direction aware init*/ 792 $('.mobile-false .hover-grid .rollover-project').each( function() { $(this).hoverdir(); } ); 793 $('.mobile-false .hover-grid-reverse .rollover-project ').each( function() { $(this).hoverdir({ 794 inverse : true 795 }); } ); 796 797 /*!Append tag </span> for portfolio round links button*/ 798 $.fn.hoverLinks = function() { 799 if($(".semitransparent-portfolio-icons").length > 0 || $(".accent-portfolio-icons").length > 0){ 800 return this.each(function() { 801 var $img = $(this); 802 if ($img.hasClass("height-ready")) { 803 return; 804 } 805 $("<span/>").appendTo($(this)); 806 807 $img.on({ 808 mouseenter: function () { 809 if (0 === $(this).children("span").length) { 810 var a = $("<span/>").appendTo($(this)); 811 setTimeout(function () { 812 a.addClass("icon-hover") 813 }, 20) 814 } else $(this).children("span").addClass("icon-hover") 815 }, 816 mouseleave: function () { 817 $(this).children("span").removeClass("icon-hover") 818 } 819 }); 820 821 $img.addClass("height-ready"); 822 }); 823 } 824 }; 825 $(".links-container a").hoverLinks(); 826 /*!Trigger click (direct to post) */ 827 $.fn.forwardToPost = function() { 828 return this.each(function() { 829 var $this = $(this); 830 if ($this.hasClass("this-ready")) { 831 return; 832 }; 833 $this.on("click", function(){ 834 if ($this.parents(".ts-wrap").hasClass("ts-interceptClicks")) return; 835 window.location.href = $this.find("a").first().attr("href"); 836 return false;
837 }); 838 $this.addClass("this-ready"); 839 }); 840 }; 841 $(".mobile-false .rollover-project.forward-post").forwardToPost(); 842 843 $.fn.touchforwardToPost = function() { 844 return this.each(function() { 845 var $this = $(this); 846 if ($this.hasClass("touch-hover-ready")) { 847 return; 848 } 849 850 $body.on("touchend", function(e) { 851 $(".mobile-true .rollover-content").removeClass("is-clicked"); 852 $(".mobile-true .rollover-project").removeClass("is-clicked"); 853 }); 854 var $this = $(this).find(".rollover-content"); 855 $this.on("touchstart", function(e) { 856 origY = e.originalEvent.touches[0].pageY; 857 origX = e.originalEvent.touches[0].pageX; 858 }); 859 $this.on("touchend", function(e) { 860 var touchEX = e.originalEvent.changedTouches[0].pageX, 861 touchEY = e.originalEvent.changedTouches[0].pageY; 862 if( origY == touchEY || origX == touchEX ){ 863 if ($this.hasClass("is-clicked")) { 864 window.location.href = $this.prev("a").first().attr("href"); 865 } else { 866 e.preventDefault(); 867 $(".mobile-ture .rollover-content").removeClass("is-clicked"); 868 $(".mobile-true .rollover-project").removeClass("is-clicked"); 869 $this.addClass("is-clicked"); 870 $this.parent(".rollover-project").addClass("is-clicked"); 871 return false; 872 }; 873 }; 874 }); 875 876 $this.addClass("touch-hover-ready"); 877 }); 878 }; 879 $(".mobile-true .rollover-project.forward-post").touchforwardToPost(); 880 881 /*!Trigger click on portfolio hover buttons */ 882 $.fn.followCurentLink = function() { 883 return this.each(function() { 884 var $this = $(this); 885 if ($this.hasClass("this-ready")) { 886 return; 887 } 888 889 var $thisSingleLink = $this.find(".links-container > a"), 890 $thisCategory = $this.find(".portfolio-categories a"); 891 892 $this.on("click", function(){ 893 894 $thisSingleLink.each(function(){ 895 $thisTarget = $(this).attr("target") ? $(this).attr("target") : "_self"; 896 }); 897 898 if($thisSingleLink.hasClass("project-details") || $thisSingleLink.hasClass("link") || $thisSingleLink.hasClass("project-link")){ 899 window.open($thisSingleLink.attr("href"), $thisTarget); 900 return false; 901 902 }else{ 903 $thisSingleLink.trigger("click"); 904 return false; 905 } 906 }); 907 908 $this.find($thisCategory).click(function(e) { 909 e.stopPropagation(); 910 window.location.href = $thisCategory.attr('href'); 911 }); 912 $this.addClass("this-ready"); 913 }); 914 }; 915 $(".mobile-false .rollover-project.rollover-active, .mobile-false .buttons-on-img.rollover-active").followCurentLink(); 916 917 $.fn.touchHoverImage = function() { 918 return this.each(function() { 919 var $img = $(this); 920 if ($img.hasClass("hover-ready")) { 921 return; 922 } 923 924 $body.on("touchend", function(e) { 925 $(".mobile-true .rollover-content").removeClass("is-clicked"); 926 }); 927 var $this = $(this).find(".rollover-content"), 928 thisPar = $this.parents(".wf-cell"); 929 $this.on("touchstart", function(e) { 930 origY = e.originalEvent.touches[0].pageY; 931 origX = e.originalEvent.touches[0].pageX; 932 }); 933 $this.on("touchend", function(e) { 934 var touchEX = e.originalEvent.changedTouches[0].pageX, 935 touchEY = e.originalEvent.changedTouches[0].pageY; 936 if( origY == touchEY || origX == touchEX ){ 937 if ($this.hasClass("is-clicked")) { 938 } else { 939 940 $('.links-container > a', $this).on('touchend', function(e) { 941 e.stopPropagation(); 942 $this.addClass("is-clicked"); 943 }); 944 e.preventDefault(); 945 $(".mobile-true .buttons-on-img .rollover-content").removeClass("is-clicked"); 946 $this.addClass("is-clicked"); 947 return false;
948 }; 949 }; 950 }); 951 952 $img.addClass("hover-ready"); 953 }); 954 }; 955 $(".mobile-true .buttons-on-img").touchHoverImage(); 956 957 $.fn.touchScrollerImage = function() { 958 return this.each(function() { 959 var $img = $(this); 960 if ($img.hasClass("hover-ready")) { 961 return; 962 } 963 964 $body.on("touchend", function(e) { 965 $(".mobile-true .project-list-media").removeClass("is-clicked"); 966 }); 967 var $this = $(this), 968 $thisSingleLink = $this.find("a.rollover-click-target").first(), 969 $thisButtonLink = $this.find(".links-container"); 970 $this.on("touchstart", function(e) { 971 origY = e.originalEvent.touches[0].pageY; 972 origX = e.originalEvent.touches[0].pageX; 973 }); 974 $this.on("touchend", function(e) { 975 var touchEX = e.originalEvent.changedTouches[0].pageX, 976 touchEY = e.originalEvent.changedTouches[0].pageY; 977 if( origY == touchEY || origX == touchEX ){ 978 if ($this.hasClass("is-clicked")) { 979 980 } else { 981 if($thisSingleLink.length > 0){ 982 $thisSingleLink.on("click", function(event) { 983 event.stopPropagation(); 984 985 if ( $(this).hasClass('go-to') ) { 986 window.location.href = $(this).attr('href'); 987 } 988 }); 989 $thisSingleLink.trigger("click"); 990 }; 991 if($thisButtonLink.length > 0){ 992 $thisButtonLink.find(" > a ").each(function(){ 993 $(this).on("touchend", function(event) { 994 event.stopPropagation(); 995 $(this).trigger("click"); 996 }); 997 }); 998 } 999 e.preventDefault(); 1000 $(".mobile-true .fs-entry").removeClass("is-clicked"); 1001 $this.addClass("is-clicked"); 1002 return false; 1003 }; 1004 }; 1005 }); 1006 1007 $img.addClass("hover-ready"); 1008 }); 1009 }; 1010 $(".mobile-true .project-list-media").touchScrollerImage(); 1011 1012 $.fn.touchHoverLinks = function() { 1013 return this.each(function() { 1014 var $img = $(this); 1015 if ($img.hasClass("hover-ready")) { 1016 return; 1017 } 1018 1019 var $this = $(this); 1020 $this.on("touchend", function(e) { 1021 if ($this.hasClass("is-clicked")) { 1022 return; 1023 } else { 1024 1025 if( $this.hasClass("project-zoom") ) { 1026 $this.trigger("click"); 1027 }else { 1028 window.location.href = $this.attr("href"); 1029 return false; 1030 }; 1031 1032 $(".mobile-true .links-container > a").removeClass("is-clicked"); 1033 $this.addClass("is-clicked"); 1034 return false; 1035 }; 1036 }); 1037 1038 $img.addClass("hover-ready"); 1039 }); 1040 }; 1041 $(".mobile-true .fs-entry .links-container > a").touchHoverLinks(); 1042 1043 /*!Trigger albums click */ 1044 $.fn.triggerAlbumsClick = function() { 1045 return this.each(function() { 1046 var $this = $(this); 1047 if ($this.hasClass("this-ready")) { 1048 return; 1049 } 1050 1051 var $thisSingleLink = $this.find("a.rollover-click-target, .dt-mfp-item").first(), 1052 $thisCategory = $this.find(".portfolio-categories a"); 1053 1054 if( $thisSingleLink.length > 0 ){ 1055 $thisSingleLink.on("click", function(event) { 1056 event.stopPropagation(); 1057 1058 if ( $(this).hasClass('go-to') ) { 1059 window.location.href = $(this).attr('href'); 1060 } 1061 }); 1062 1063 var alreadyTriggered = false;
1064 1065 $this.on("click", function(){ 1066 1067 if ($this.parents(".ts-wrap").hasClass("ts-interceptClicks")) return; 1068 1069 if ( !alreadyTriggered ) { 1070 alreadyTriggered = true; 1071 $thisSingleLink.trigger("click"); 1072 1073 alreadyTriggered = false; 1074 } 1075 return false; 1076 }) 1077 $this.find($thisCategory).click(function(e) { 1078 e.stopPropagation(); 1079 window.location.href = $thisCategory.attr('href'); 1080 }); 1081 } 1082 $this.addClass("this-ready"); 1083 }); 1084 }; 1085 $(".dt-albums-template .rollover-project, .dt-albums-shortcode .rollover-project, .dt-albums-template .buttons-on-img, .dt-albums-shortcode .buttons-on-img, .archive .type-dt_gallery .buttons-on-img").triggerAlbumsClick(); 1086 1087 /*!Trigger rollover click*/ 1088 1089 $.fn.triggerHoverClick = function() { 1090 return this.each(function() { 1091 var $this = $(this); 1092 if ($this.hasClass("click-ready")) { 1093 return; 1094 } 1095 1096 var $thisSingleLink = $this.prev("a:not(.dt-single-mfp-popup):not(.dt-mfp-item)").first(), 1097 $thisCategory = $this.find(".portfolio-categories a"), 1098 $thisLink = $this.find(".project-link"), 1099 $thisTarget = $thisLink.attr("target") ? $thisLink.attr("target") : "_self", 1100 $targetClick; 1101 1102 1103 if( $thisSingleLink.length > 0 ){ 1104 1105 1106 var alreadyTriggered = false; 1107 1108 $this.on("click", function(e){ 1109 1110 if ($this.parents(".ts-wrap").hasClass("ts-interceptClicks")) return; 1111 1112 if($(".semitransparent-portfolio-icons").length > 0 || $(".accent-portfolio-icons").length > 0){ 1113 $targetClick = $(e.target).parent(); 1114 }else{ 1115 $targetClick = $(e.target); 1116 } 1117 if($targetClick.hasClass("project-zoom")){ 1118 1119 //console.log(( "clicked: " + $(e.target).parent().attr("class") ) 1120 $(this).find("a.dt-gallery-mfp-popup, .dt-trigger-first-mfp, .dt-single-mfp-popup, .dt-mfp-item").first().trigger('click'); 1121 }else{ 1122 if ( !alreadyTriggered ) { 1123 alreadyTriggered = true; 1124 $thisSingleLink.trigger("click"); 1125 window.location.href = $thisSingleLink.attr('href'); 1126 1127 alreadyTriggered = false; 1128 } 1129 } 1130 return false; 1131 }) 1132 $this.find($thisLink).click(function(e) { 1133 e.stopPropagation(); 1134 e.preventDefault(); 1135 window.open($thisLink.attr("href"), $thisTarget); 1136 }); 1137 1138 $this.find($thisCategory).click(function(e) { 1139 e.stopPropagation(); 1140 window.location.href = $thisCategory.attr('href'); 1141 }); 1142 } 1143 $this.addClass("click-ready"); 1144 }); 1145 }; 1146 $(".mobile-false .rollover-project:not(.rollover-active) .rollover-content, .buttons-on-img:not(.rollover-active) .rollover-content").triggerHoverClick(); 1147 1148 /* !-Smart benefits & logos resize */ 1149 $.fn.smartGrid = function() { 1150 return this.each(function() { 1151 var $this = $(this), 1152 colNum = parseInt($this.attr("data-columns")), 1153 colMinWidth = parseInt($this.attr("data-width")), 1154 contWidth = $this.width(); 1155 1156 for ( ; Math.floor(contWidth/colNum) < colMinWidth; ) { 1157 colNum--; 1158 if (colNum <= 1) break; 1159 } 1160 1161 $("> .wf-cell", $this).css({ 1162 width: (100/colNum).toFixed(6) + "%", 1163 display: "inline-block" 1164 }); 1165 }); 1166 }; 1167 1168 var $benLogColl = $(".benefits-grid, .logos-grid"); 1169 $benLogColl.smartGrid(); 1170 $window.on("debouncedresize", function () { 1171 $benLogColl.smartGrid(); 1172 }); 1173 1174 /*!Instagram style photos*/ 1175 1176 // $.fn.calcPics = function() { 1177 // var $collection = $(".instagram-photos"); 1178 // if ($collection.length < 1) return false;
1179 1180 // return this.each(function() { 1181 // var maxitemwidth = maxitemwidth ? maxitemwidth : parseInt($(this).attr("data-image-max-width")), 1182 // itemmarg = parseInt($(this).find("> a").css("margin-left")); 1183 // $(this).find(" > a").css({ 1184 // "max-width": maxitemwidth, 1185 // "opacity": 1 1186 // }); 1187 1188 // // Cahce everything 1189 // var $container = $(this), 1190 // containerwidth = $container.width(), 1191 // itemperc = (100/(Math.ceil(containerwidth/maxitemwidth))); 1192 1193 // $container.find("a").css({ "width": itemperc+'%' }); 1194 // }); 1195 // }; 1196 // $(".instagram-photos").calcPics(); 1197 1198 // /*!-Project floating content*/ 1199 // var $floatContent = $(".floating-content"), 1200 // projectPost = $(".project-post"); 1201 // var $parentHeight, 1202 // $floatContentHeight, 1203 // phantomHeight = 0; 1204 1205 //var $scrollHeight; 1206 1207 // function setFloatinProjectContent() { 1208 // $(".project-slider .preload-me").loaded(null, function() { 1209 // var $sidebar = $(".floating-content"); 1210 // if ($(".floating-content").length > 0) { 1211 // var offset = $sidebar.offset(); 1212 // if($(".top-bar").length > 0 && $(".phantom-sticky").length > 0){ 1213 // var topBarH = $(".top-bar").height(); 1214 // }else{ 1215 // var topBarH = 0; 1216 // } 1217 // //$scrollHeight = $(".project-post").height(); 1218 // var $scrollOffset = $(".project-post").offset(); 1219 // //var $headerHeight = $phantom.height(); 1220 // $window.on("scroll", function () { 1221 // if (window.innerWidth > 1050) { 1222 // if (dtGlobals.winScrollTop + $phantom.height() > offset.top) { 1223 // if (dtGlobals.winScrollTop + $phantom.height() + $floatContentHeight + 40 < $scrollOffset.top + $parentHeight) { 1224 // $sidebar.stop().velocity({ 1225 // translateY : dtGlobals.winScrollTop - offset.top + $phantom.height() - topBarH 1226 // }, 300); 1227 // } else { 1228 // $sidebar.stop().velocity({ 1229 // translateY: $parentHeight - $floatContentHeight - 40 - topBarH 1230 // }, 300) 1231 // } 1232 // } else { 1233 // $sidebar.stop().velocity({ 1234 // translateY: 0 1235 // }, 300) 1236 // } 1237 // } else { 1238 // $sidebar 1239 // .css({ 1240 // "transform": "translateY(0)", 1241 // "-webkit-transform" : "translateY(0)", 1242 // }); 1243 // } 1244 // }) 1245 // } 1246 // }, true); 1247 // } 1248 // setFloatinProjectContent(); 1249 1250 1251 1252/* #Photo slider initialisation 1253================================================== */ 1254// jQuery(document).ready(function($) { 1255 var $photoScroller = $(".photo-scroller"); 1256 if($photoScroller.length > 0){ 1257 /* !Set slider */ 1258 $.fn.photoSlider = function() { 1259 var $el = $(this), 1260 slides = {}, 1261 thumbs = ""; 1262 $elParent = $el.parents(".photo-scroller"); 1263 1264 slides.$items = $el.children("figure"); 1265 slides.count = slides.$items.length; 1266 1267 slides.$items.each(function(i) { 1268 var $this = $(this), 1269 $slide = $this.children().first().remove(), 1270 src = $slide.attr("href"), 1271 $thumbImg = $slide.children("img"), 1272 thumbSrc = $thumbImg.attr("src"), 1273 thumbDataSrc = $thumbImg.attr("data-src"), 1274 thumbDataSrcset = $thumbImg.attr("data-srcset"), 1275 thumbClass = $thumbImg.attr("class"); 1276 if($thumbImg.hasClass("lazy-load")){ 1277 var $layzrBg = "layzr-bg"; 1278 }else{ 1279 var $layzrBg = ""; 1280 } 1281 1282 // !Captions copying 1283 $this.find("figcaption").addClass("caption-" + (i+1) + ""); 1284 var $thisCaptionClone = $(this).find("figcaption").clone(true); 1285 $(".slide-caption").append($thisCaptionClone); 1286 if (parseInt($elParent.attr("data-thumb-width")) > 0) { 1287 var thisWidth = parseInt($elParent.attr("data-thumb-width")), 1288 thisHeight = parseInt($elParent.attr("data-thumb-height")); 1289 1290 $elParent.removeClass("proportional-thumbs"); 1291 } 1292 else { 1293 var thisWidth = parseInt($thumbImg.attr("width")), 1294 thisHeight = parseInt($thumbImg.attr("height")); 1295 1296 $elParent.addClass("proportional-thumbs"); 1297 }; 1298 1299 thumbs = thumbs + '<div class="ts-cell" data-width="'+(thisWidth+5)+'" data-height="'+(thisHeight+10)+'"><div class="ts-thumb-img ' + $layzrBg +'"><img class=" '+thumbClass+'" src="'+thumbSrc+'" data-src="'+thumbDataSrc+'" data-srcset="'+thumbDataSrc+'" width="'+thisWidth+'" height="'+thisHeight+'"></div></div>'; 1300 1301 $this.prepend('<div class="ts-slide-img"><img src="'+src+'" width="'+$this.attr("data-width")+'" height="'+$this.attr("data-height")+'"></div>'); 1302 1303 1304 }); 1305 1306 $elParent.append('<div class="scroller-arrow prev"><i></i><i></i></div><div class="scroller-arrow next"><i></i><i></i></div>') 1307 1308 $el.addClass("ts-cont"); 1309 $el.wrap('<div class="ts-wrap"><div class="ts-viewport"></div></div>'); 1310 1311 var $slider = $el.parents(".ts-wrap"), 1312 windowW = $window.width(), 1313 $sliderPar = $elParent, 1314 $sliderAutoslide = ($sliderPar.attr("data-autoslide") == "true") ? true : false, 1315 $sliderAutoslideDelay = ($sliderPar.attr("data-delay") && parseInt($sliderPar.attr("data-delay")) > 999) ? parseInt($sliderPar.attr("data-delay")) : 5000, 1316 $sliderLoop = ($sliderPar.attr("data-loop") === "true") ? true : false, 1317 $thumbHeight = $sliderPar.attr("data-thumb-height") ? parseInt($sliderPar.attr("data-thumb-height"))+10 : 80+10, 1318 $slideOpacity = $sliderPar.attr("data-transparency") ? $sliderPar.attr("data-transparency") : 0.5, 1319 $adminBarH = $("#wpadminbar").length > 0? $("#wpadminbar").height() : 0; 1320 1321 // !New settings for cells; 1322 var dataLsMin = $sliderPar.attr("data-ls-min") ? parseInt($sliderPar.attr("data-ls-min")) : 0, 1323 dataLsMax = $sliderPar.attr("data-ls-max") ? parseInt($sliderPar.attr("data-ls-max")) : 100, 1324 dataLsFillDt = $sliderPar.attr("data-ls-fill-dt") ? $sliderPar.attr("data-ls-fill-dt") : "fill", 1325 dataLsFillMob = $sliderPar.attr("data-ls-fill-mob") ? $sliderPar.attr("data-ls-fill-mob") : "fit", 1326 dataPtMin = $sliderPar.attr("data-pt-min") ? parseInt($sliderPar.attr("data-pt-min")) : 0, 1327 dataPtMax = $sliderPar.attr("data-pt-max") ? parseInt($sliderPar.attr("data-pt-max")) : 100, 1328 dataPtFillDt = $sliderPar.attr("data-pt-fill-dt") ? $sliderPar.attr("data-pt-fill-dt") : "fill", 1329 dataPtFillMob = $sliderPar.attr("data-pt-fill-mob") ? $sliderPar.attr("data-pt-fill-mob") : "fit", 1330 dataSidePaddings = $sliderPar.attr("data-padding-side") ? parseInt($sliderPar.attr("data-padding-side")) : 0; 1331 1332 // !Normalize new settings for cells; 1333 if (dataLsMax <= 0) dataLsMax = 100; 1334 if (dataPtMax <= 0) dataPtMax = 100; 1335 if (dataLsMax < dataLsMax) dataLsMax = dataLsMax; 1336 if (dataPtMax < dataPtMax) dataPtMax = dataPtMax; 1337 1338 $slider.addClass("ts-ls-"+dataLsFillDt).addClass("ts-ls-mob-"+dataLsFillMob); 1339 $slider.addClass("ts-pt-"+dataPtFillDt).addClass("ts-pt-mob-"+dataPtFillMob); 1340 1341 $slider.find(".ts-slide-img").css({ 1342 "opacity": $slideOpacity 1343 }); 1344 $slider.find(".video-icon").css({ 1345 "opacity": $slideOpacity 1346 }); 1347 1348 1349 var $slideTopPadding = ($sliderPar.attr("data-padding-top") && windowW > 760) ? $sliderPar.attr("data-padding-top") : 0, 1350 $slideBottomPadding = ($sliderPar.attr("data-padding-bottom") && windowW > 760) ? $sliderPar.attr("data-padding-bottom") : 0; 1351 1352 var $sliderVP = $slider.find(".ts-viewport"); 1353 $sliderVP.css({ 1354 "margin-top": $slideTopPadding+"px", 1355 "margin-bottom": $slideBottomPadding+"px" 1356 }); 1357 1358 $window.on("debouncedresize", function() { 1359 if ($sliderPar.attr("data-padding-top") && $window.width() > 760) { 1360 $slideTopPadding = $sliderPar.attr("data-padding-top"); 1361 } 1362 else { 1363 $slideTopPadding = 0; 1364 }; 1365 1366 if ($sliderPar.attr("data-padding-bottom") && $window.width() > 760) { 1367 $slideBottomPadding = $sliderPar.attr("data-padding-bottom"); 1368 } 1369 else { 1370 $slideBottomPadding = 0; 1371 }; 1372 1373 if ($window.width() > 760) { 1374 $sliderVP.css({ 1375 "margin-top": $slideTopPadding+"px", 1376 "margin-bottom": $slideBottomPadding+"px" 1377 }); 1378 } 1379 else { 1380 $sliderVP.css({ 1381 "margin-top": 0+"px", 1382 "margin-bottom": 0+"px" 1383 }); 1384 }; 1385 }); 1386 1387 /* !Initializinig the main slider */ 1388 var $sliderData = $slider.thePhotoSlider({ 1389 mode: { 1390 type: "centered", 1391 lsMinW: dataLsMin, 1392 lsMaxW: dataLsMax, 1393 ptMinW: dataPtMin, 1394 ptMaxW: dataPtMax, 1395 }, 1396 height: function() { 1397 // if ($(window).width() < 760) { 1398 // return (window.innerHeight); 1399 // }else 1400 var $windowH = $window.height(), 1401 $adminBarH = $("#wpadminbar").height(); 1402 if ($(".mixed-header").length > 0){ 1403 var $headerH = $(".mixed-header").height(); 1404 }else{ 1405 var $headerH = $(".masthead").height(); 1406 } 1407 if ($body.hasClass("transparent") || $slider.parents(".photo-scroller").hasClass("full-screen")) { 1408 1409 if(window.innerWidth < dtLocal.themeSettings.mobileHeader.secondSwitchPoint) { 1410 return ($windowH - $slideTopPadding - $slideBottomPadding - $headerH - $adminBarH); 1411 }else { 1412 return ($windowH - $slideTopPadding - $slideBottomPadding - $adminBarH); 1413 }; 1414 1415 }else if ($(".mixed-header").length > 0 || $slider.parents(".photo-scroller").hasClass("full-screen")) { 1416 1417 if(window.innerWidth < dtLocal.themeSettings.mobileHeader.firstSwitchPoint) { 1418 return ($windowH - $slideTopPadding - $slideBottomPadding - $headerH - $adminBarH); 1419 }else { 1420 if($(".side-header-h-stroke").length > 0){ 1421 return ($windowH - $slideTopPadding - $slideBottomPadding - $headerH - $adminBarH); 1422 }else{ 1423 return ($windowH - $slideTopPadding - $slideBottomPadding - $adminBarH); 1424 } 1425 }; 1426 1427 }else if ($(".side-header").length > 0 || $slider.parents(".photo-scroller").hasClass("full-screen")) { 1428 1429 if(window.innerWidth < dtLocal.themeSettings.mobileHeader.firstSwitchPoint) { 1430 return ($windowH - $slideTopPadding - $slideBottomPadding - $headerH - $adminBarH); 1431 }else { 1432 return ($windowH - $slideTopPadding - $slideBottomPadding - $adminBarH); 1433 }; 1434 1435 }else { 1436 1437 if(window.innerWidth < dtLocal.themeSettings.mobileHeader.firstSwitchPoint) { 1438 return ($windowH - $slideTopPadding - $slideBottomPadding - $headerH - $adminBarH); 1439 }else { 1440 return ($windowH - $slideTopPadding - $slideBottomPadding - $headerH - $adminBarH); 1441 }; 1442 1443 }; 1444 }, 1445 sidePaddings: dataSidePaddings, 1446 autoPlay: { 1447 enabled: $sliderAutoslide, 1448 delay: $sliderAutoslideDelay, 1449 loop: $sliderLoop 1450 } 1451 }).data("thePhotoSlider"); 1452 1453
1454 var $thumbsScroller = $('<div class="ts-wrap"><div class="ts-viewport"><div class="ts-cont ts-thumbs">'+thumbs+'</div></div></div>'); 1455 $slider.after($thumbsScroller); 1456 1457 /* !Initializinig the thumbnail stripe */ 1458 var $thumbsScrollerData = $thumbsScroller.thePhotoSlider({ 1459 mode: { 1460 type: "scroller" 1461 }, 1462 height: $thumbHeight 1463 }).data("thePhotoSlider"); 1464 1465 1466 $(".prev", $this_par).click(function() { 1467 if (!$sliderData.noSlide) $sliderData.slidePrev(); 1468 }); 1469 $(".next", $this_par).click(function() { 1470 if (!$sliderData.noSlide) $sliderData.slideNext(); 1471 }); 1472 1473 $sliderData.ev.on("updateNav sliderReady", function() { 1474 if ($sliderData.lockRight) { 1475 $(".next", $elParent).addClass("disabled"); 1476 } else { 1477 $(".next", $elParent).removeClass("disabled"); 1478 }; 1479 1480 if ($sliderData.lockLeft) { 1481 $(".prev", $elParent).addClass("disabled"); 1482 } else { 1483 $(".prev", $elParent).removeClass("disabled"); 1484 }; 1485 }); 1486 1487 /*keyboard navigation*/ 1488 window.addEventListener("keydown", checkKeyPressed, false); 1489 function checkKeyPressed(e) { 1490 if (e.keyCode == "37") { 1491 if (!$sliderData.noSlide) $sliderData.slidePrev(); 1492 } else if (e.keyCode == "39") { 1493 if (!$sliderData.noSlide) $sliderData.slideNext(); 1494 } 1495 } 1496 1497 1498 // !Active slide indication and thumbnail mechanics: begin */ 1499 $sliderData.ev.on("sliderReady beforeTransition", function() { 1500 $sliderData.slides.$items.removeClass("act"); 1501 $sliderData.slides.$items.eq($sliderData.currSlide).addClass("act"); 1502 1503 $thumbsScrollerData.slides.$items.removeClass("act"); 1504 $thumbsScrollerData.slides.$items.eq($sliderData.currSlide).addClass("act"); 1505 1506 if($sliderData.slides.$items.eq($sliderData.currSlide).hasClass("ts-video")){ 1507 $sliderData.slides.$items.parents(".ts-wrap ").addClass("hide-slider-overlay"); 1508 }else if($sliderData.slides.$items.eq($sliderData.currSlide).find(".ps-link").length > 0){ 1509 $sliderData.slides.$items.parents(".ts-wrap ").addClass("hide-slider-overlay"); 1510 }else{ 1511 $sliderData.slides.$items.parents(".ts-wrap ").removeClass("hide-slider-overlay"); 1512 }; 1513 1514 1515 var actCaption = $sliderData.slides.$items.eq($sliderData.currSlide).find("figcaption").attr("class"); 1516 1517 $('.slide-caption > figcaption').removeClass("actCaption"); 1518 $('.slide-caption > .'+actCaption).addClass("actCaption"); 1519 }); 1520 1521 $sliderData.ev.on("afterTransition", function() { 1522 var viewportLeft = -($thumbsScrollerData._unifiedX()), 1523 viewportRight = viewportLeft + $thumbsScrollerData.wrap.width, 1524 targetLeft = -$thumbsScrollerData.slides.position[$sliderData.currSlide], 1525 targetRight = targetLeft + $thumbsScrollerData.slides.width[$sliderData.currSlide]; 1526 1527 targetLeft = targetLeft - 50; 1528 targetRight = targetRight + 50; 1529 1530 if (targetLeft < viewportLeft) { 1531 1532 for (i = $thumbsScrollerData.currSlide; i >= 0; i--) { 1533 targetLeft = targetLeft + 50; 1534 targetRight = targetRight - 50; 1535 1536 var tempViewportLeft = -$thumbsScrollerData.slides.position[i], 1537 tempViewportRight = tempViewportLeft + $thumbsScrollerData.wrap.width; 1538 1539 if (targetRight > tempViewportRight) { 1540 $thumbsScrollerData.slideTo(i+1); 1541 break; 1542 } 1543 else if (i === 0) { 1544 $thumbsScrollerData.slideTo(0); 1545 } 1546 } 1547 } 1548 else if (targetRight > viewportRight) { 1549 $thumbsScrollerData.slideTo($sliderData.currSlide); 1550 }; 1551 }); 1552 1553 $thumbsScroller.addClass("scroller-thumbnails"); 1554 $thumbsScrollerData.slides.$items.each(function(i) { 1555 $(this).on("click", function(event) { 1556 var $this = $(this); 1557 1558 if ($this.parents(".ts-wrap").hasClass("ts-interceptClicks")) return; 1559 $sliderData.slideTo(i); 1560 }); 1561 }); 1562 1563 $(".scroller-thumbnails").layzrInitialisation(); 1564 $sliderData.slides.$items.each(function(i) { 1565 $(this).on("click", function(event) { 1566 var $this = $(this); 1567 1568 if ($this.parents(".ts-wrap").hasClass("ts-interceptClicks")) return; 1569 $sliderData.slideTo(i); 1570 }); 1571 }); 1572 // !Active slide indication and thumbnail mechanics: end */ 1573 1574 var $this_par = $slider.parents(".photo-scroller"); 1575 1576 /* !- Autoplay */ 1577 if( $sliderData.st.autoPlay.enabled ){ 1578 $(".auto-play-btn", $this_par).addClass("paused"); 1579 } 1580 1581 $(".auto-play-btn", $this_par).on("click", function(e){ 1582 e.preventDefault(); 1583 var $this = $(this); 1584 if( $this.hasClass("paused")){ 1585 $this.removeClass("paused"); 1586 if (!$sliderData.noSlide) $sliderData.pause(); 1587 $sliderData.st.autoPlay.enabled = false;
1588 }else{ 1589 $this.addClass("paused"); 1590 if (!$sliderData.noSlide) $sliderData.play(); 1591 $sliderData.st.autoPlay.enabled = true; 1592 } 1593 }); 1594 1595 }; 1596 1597 /* !- Initialize slider */ 1598 $(".photoSlider").photoSlider(); 1599 1600 1601 1602 /* !- Show slider*/ 1603 1604 $(".photoSlider").parents(".photo-scroller").css("visibility", "visible"); 1605 1606 1607 function launchFullscreen(element) { 1608 if(element.requestFullscreen) { 1609 element.requestFullscreen(); 1610 } else if(element.mozRequestFullScreen) { 1611 element.mozRequestFullScreen(); 1612 } else if(element.webkitRequestFullscreen) { 1613 element.webkitRequestFullscreen(); 1614 } else if(element.msRequestFullscreen) { 1615 element.msRequestFullscreen(); 1616 } 1617 } 1618 function exitFullscreen() { 1619 if(document.exitFullscreen) { 1620 document.exitFullscreen(); 1621 } else if(document.mozCancelFullScreen) { 1622 document.mozCancelFullScreen(); 1623 } else if(document.webkitExitFullscreen) { 1624 document.webkitExitFullscreen(); 1625 } 1626 }; 1627 1628 /* !- Fullscreen button */ 1629 if(!dtGlobals.isWindowsPhone){ 1630 $(".full-screen-btn").each(function(){ 1631 var $this = $(this), 1632 $thisParent = $this.parents(".photo-scroller"); 1633 document.addEventListener("fullscreenchange", function () { 1634 if(!document.fullscreen){ 1635 $this.removeClass("act"); 1636 $thisParent.removeClass("full-screen"); 1637 $("body, html").css("overflow", ""); 1638 } 1639 }, false); 1640 document.addEventListener("mozfullscreenchange", function () { 1641 if(!document.mozFullScreen){ 1642 $this.removeClass("act"); 1643 $thisParent.removeClass("full-screen"); 1644 $("body, html").css("overflow", ""); 1645 } 1646 }, false); 1647 document.addEventListener("webkitfullscreenchange", function () { 1648 if(!document.webkitIsFullScreen){ 1649 $this.removeClass("act"); 1650 $thisParent.removeClass("full-screen"); 1651 $("body, html").css("overflow", ""); 1652 var scroller = $frame.data("thePhotoSlider"); 1653 if(typeof scroller!= "undefined"){ 1654 scroller.update(); 1655 }; 1656 } 1657 }, false); 1658 }) 1659 1660 $(".full-screen-btn").on("click", function(e){ 1661 e.preventDefault(); 1662 var $this = $(this), 1663 $thisParent = $this.parents(".photo-scroller"), 1664 $frame = $thisParent.find(".ts-wrap"), 1665 $thumbs = $thisParent.find(".scroller-thumbnails").data("thePhotoSlider"), 1666 $scroller = $frame.data("thePhotoSlider"); 1667 $this.parents(".photo-scroller").find("figure").animate({"opacity": 0},150); 1668 if( $this.hasClass("act")){ 1669 1670 $this.removeClass("act"); 1671 exitFullscreen(); 1672 $thisParent.removeClass("full-screen"); 1673 1674 setTimeout(function(){ 1675 $this.parents(".photo-scroller").find("figure").delay(600).animate({"opacity": 1},300) 1676 }, 300); 1677 }else{ 1678 $this.addClass("act"); 1679 $thisParent.addClass("full-screen"); 1680 launchFullscreen(document.documentElement); 1681 $("body, html").css("overflow", "hidden"); 1682 setTimeout(function(){ 1683 $this.parents(".photo-scroller").find("figure").delay(600).animate({"opacity": 1},300) 1684 }, 300) 1685 } 1686 var scroller = $frame.data("thePhotoSlider"); 1687 if(typeof scroller!= "undefined"){
1688 scroller.update(); 1689 }; 1690 }); 1691 } 1692 1693 /* !- Show/hide thumbs */ 1694 $photoScroller.each(function(){ 1695 var $this = $(this); 1696 1697 $(".btn-cntr, .slide-caption", $this).css({ 1698 "bottom": parseInt($this.attr("data-thumb-height")) + 15 1699 }); 1700 1701 if( $this.hasClass("hide-thumbs")){ 1702 $this.find(".hide-thumb-btn").addClass("act"); 1703 $(".scroller-thumbnails", $this).css({ 1704 "bottom": -(parseInt($this.attr("data-thumb-height")) +20) 1705 }); 1706 $(".btn-cntr, .slide-caption", $this).css({ 1707 "bottom": 5 + "px" 1708 }); 1709 } 1710 }); 1711 $(".hide-thumb-btn").on("click", function(e){ 1712 e.preventDefault(); 1713 var $this = $(this), 1714 $thisParent = $this.parents(".photo-scroller"); 1715 if( $this.hasClass("act")){ 1716 $this.removeClass("act"); 1717 $thisParent.removeClass("hide-thumbs"); 1718 $(".scroller-thumbnails", $thisParent).css({ 1719 "bottom": 0 1720 }); 1721 $(".btn-cntr, .slide-caption", $thisParent).css({ 1722 "bottom": parseInt($thisParent.attr("data-thumb-height")) + 15 1723 }); 1724 1725 }else{ 1726 $this.addClass("act"); 1727 $thisParent.addClass("hide-thumbs"); 1728 $(".scroller-thumbnails", $thisParent).css({ 1729 "bottom": -(parseInt($thisParent.attr("data-thumb-height")) +20) 1730 }); 1731 $(".btn-cntr, .slide-caption", $thisParent).css({ 1732 "bottom": 5 + "px" 1733 }); 1734 } 1735 }); 1736 }; 1737// }) 1738 1739 //porthole Slider 1740 if ($(".rsHomePorthole").exists()) { 1741 var portholeSlider = {}; 1742 portholeSlider.container = $("#main-slideshow"); 1743 portholeSlider.hendheld = $window.width() < 740 && dtGlobals.isMobile ? true : false; 1744 1745 $("#main-slideshow-content").appendTo(portholeSlider.container); 1746 1747 //Scroller porthole slideshow 1748 1749 $.fn.portholeScroller = function() { 1750 var $el = $(this), 1751 slides = {}, 1752 thumbs = ""; 1753 1754 slides.$items = $el.children("li"), 1755 slides.count = slides.$items.length; 1756 1757 slides.$items.each(function(i) { 1758 var $this = $(this), 1759 $slide = $this, 1760 $thumbImg = $slide.children("img"), 1761 thumbSrc = $thumbImg.attr("data-rstmb"), 1762 thumbDataSrc = $thumbImg.attr("data-src"), 1763 thumbDataSrcset = $thumbImg.attr("data-srcset"), 1764 thumbClass = $thumbImg.attr("class"); 1765 if($thumbImg.hasClass("lazy-load")){ 1766 var $layzrBg = "layzr-bg"; 1767 }else{ 1768 var $layzrBg = ""; 1769 } 1770 thumbs = thumbs + '<div class="ps-thumb-img ' + $layzrBg +'"><img class=" '+thumbClass+'" src="'+thumbSrc+'" width="150" height="150"></div>'; 1771 }); 1772 1773 $el.addClass("ts-cont"); 1774 $el.wrap('<div class="ts-wrap"><div class="ts-viewport portholeSlider-wrap"></div></div>'); 1775 1776 1777 var $slider = $el.parents(".ts-wrap"), 1778 $this_par = $el.parents("#main-slideshow"), 1779 windowW = $window.width(), 1780 paddings = $this_par.attr("data-padding-side") ? parseInt($this_par.attr("data-padding-side")) : 0, 1781 $sliderAutoslideEnable = ( 'true' != $this_par.attr("data-paused") && typeof $this_par.attr("data-autoslide") != "undefined" && !($window.width() < 740 && dtGlobals.isMobile) ) ? true : false, 1782 // $sliderAutoslide = ( 'true' === $this_par.attr("data-paused") ) ? false : true, 1783 $sliderAutoslideDelay = $this_par.attr("data-autoslide") && parseInt($this_par.attr("data-autoslide")) > 999 ? parseInt($this_par.attr("data-autoslide")) : 5000, 1784 $sliderLoop = ( typeof $this_par.attr("data-autoslide") != "undefined" ) ? true : false, 1785 $sliderWidth = $this_par.attr("data-width") ? parseInt($this_par.attr("data-width")) : 800, 1786 $sliderHight = $this_par.attr("data-height") ? parseInt($this_par.attr("data-height")) : 400, 1787 imgMode = $this_par.attr("data-scale") ? $this_par.attr("data-scale") : "none"; 1788 1789 var $sliderData = $slider.thePhotoSlider({ 1790 mode: { 1791 type: "slider" 1792 }, 1793 height: $sliderHight, 1794 width: $sliderWidth, 1795 //sidePaddings: paddings, 1796 resizeImg: true, 1797 imageScaleMode: imgMode, 1798 imageAlignCenter:true, 1799 autoPlay: { 1800 enabled: $sliderAutoslideEnable, 1801 delay: $sliderAutoslideDelay, 1802 loop: $sliderLoop 1803 } 1804 }).data("thePhotoSlider"); 1805 1806 //Create thumbs
1807 var $thumbsScroller = $('<div class="psThumbs"><div class="psThumbsContainer">'+thumbs+'</div></div>'); 1808 $slider.append($thumbsScroller); 1809 var $psThumb = $(".ps-thumb-img "); 1810 $psThumb.each(function(i) { 1811 $(this).on("click", function(event) { 1812 var $this = $(this); 1813 1814 //if ($this.parents(".ts-wrap").hasClass("ts-interceptClicks")) return; 1815 $sliderData.slideTo(i); 1816 }); 1817 }); 1818 1819 //Tumbs progress 1820 $(".psThumbsContainer").after('<div class="progress-wrapper"><div class="progress-controls"></div></div>'); 1821 $progressWrap = $(".psThumbsContainer").next(); 1822 $progressHtml = '<div class="progress-mask"><div class="progress-spinner-left" style="animation-duration: '+$sliderAutoslideDelay+'ms;"></div></div><div class="progress-mask"><div class="progress-spinner-right" style="animation-duration: '+$sliderAutoslideDelay+'ms;"></div></div>'; 1823 1824 if ($sliderData.st.autoPlay.enabled) { 1825 if ($progressWrap.find(".progress-mask").length < 1) { 1826 $progressWrap.prepend($progressHtml); 1827 } 1828 } 1829 $sliderData.ev.on("autoPlayPlay", function() { 1830 if ($progressWrap.find(".progress-mask").length < 1) { 1831 $progressWrap.prepend($progressHtml); 1832 } 1833 $progressWrap.removeClass("paused"); 1834 }); 1835 1836 $sliderData.ev.on("autoPlayPause", function() { 1837 $progressWrap.find(".progress-mask").remove(); 1838 if (!$sliderAutoslideEnable) { 1839 $progressWrap.addClass("paused"); 1840 } 1841 }); 1842 1843 $sliderData.ev.on("sliderReady beforeTransition", function() { 1844 //Animate thums container 1845 var newPos = -$sliderData.currSlide * 40; 1846 if (newPos == 0) { 1847 newPos = 20; 1848 } 1849 $psThumb.removeClass("psNavSelected psNavPrev psNavNext psNavVis"); 1850 $psThumb.eq($sliderData.currSlide).addClass("psNavSelected"); 1851 $psThumb.eq($sliderData.currSlide).prev().addClass("psNavPrev"); 1852 $psThumb.eq($sliderData.currSlide).next().addClass("psNavNext"); 1853 $psThumb.eq($sliderData.currSlide).prev().prev().addClass("psNavVis"); 1854 $psThumb.eq($sliderData.currSlide).next().next().addClass("psNavVis"); 1855 $(".psThumbsContainer").css({ transform:'translateY(' + newPos + 'px)' }); 1856 }) 1857 $sliderData.ev.on("sliderReady beforeTransition", function() { 1858 //hide thumb progress on slide change 1859 $progressWrap.addClass("blurred"); 1860 }); 1861 $sliderData.ev.on("sliderReady afterTransition", function() { 1862 $progressWrap.removeClass("blurred"); 1863 }); 1864 var dtResizeTimeout; 1865 $window.on("resize", function() { 1866 clearTimeout(dtResizeTimeout); 1867 dtResizeTimeout = setTimeout(function() { 1868 $progressWrap.removeClass("blurred"); 1869 }, 200); 1870 }); 1871 1872 //Append slider navigation 1873 $('<div class="leftArrow"></div><div class="rightArrow"></div>').insertAfter($el); 1874 1875 $(".leftArrow", $slider).click(function() { 1876 if (!$sliderData.noSlide) $sliderData.slidePrev(); 1877 }); 1878 $(".rightArrow", $slider).click(function() { 1879 if (!$sliderData.noSlide) $sliderData.slideNext(); 1880 }); 1881 1882 $sliderData.ev.on("updateNav sliderReady", function() { 1883 if ($sliderData.lockRight) { 1884 $(".rightArrow", $slider).addClass("disabled"); 1885 } else { 1886 $(".rightArrow", $slider).removeClass("disabled"); 1887 }; 1888 1889 if ($sliderData.lockLeft) { 1890 $(".leftArrow", $slider).addClass("disabled"); 1891 } else { 1892 $(".leftArrow", $slider).removeClass("disabled"); 1893 }; 1894 if ($sliderData.lockRight && $sliderData.lockLeft) { 1895 $this_par.addClass("hide-arrows"); 1896 }; 1897 }); 1898 1899 //Slider auto play/pause 1900 if( 'true' === $this_par.attr("data-paused") ){ 1901 $progressWrap.addClass("paused"); 1902 }; 1903 $progressWrap.on("click", function(e){ 1904 e.preventDefault(); 1905 var $this = $(this); 1906 if( $this.hasClass("paused")){ 1907 $this.removeClass("paused"); 1908 if ($progressWrap.find(".progress-mask").length < 1) { 1909 $progressWrap.prepend($progressHtml); 1910 } 1911 if (!$sliderData.noSlide) $sliderData.play(); 1912 $sliderData.st.autoPlay.enabled = true; 1913 }else{ 1914 $this.addClass("paused"); 1915 if (!$sliderData.noSlide) $sliderData.pause(); 1916 $sliderData.st.autoPlay.enabled = false;
1917 $progressWrap.find(".progress-mask").remove(); 1918 1919 } 1920 }); 1921 // $(".rsPlayBtn").on("click", function(e){ 1922 // // e.preventDefault(); 1923 // var $this = $(this); 1924 // if( $progressWrap.hasClass("paused")){ 1925 // }else{ 1926 // $progressWrap.addClass("paused"); 1927 // if (!$sliderData.noSlide) $sliderData.pause(); 1928 // $sliderData.st.autoPlay.enabled = false; 1929 // $progressWrap.find(".progress-mask").remove(); 1930 1931 // } 1932 // }); 1933 1934 // scroller.hover( 1935 // function() { 1936 // if($sliderAutoslide) { 1937 // $sliderData._autoPlayPaused = false; 1938 // $sliderData.pause(); 1939 // $sliderData._pausedByHover = true; 1940 // } 1941 // }, 1942 // function() { 1943 // if($sliderAutoslide) { 1944 // $sliderData._pausedByHover = false; 1945 // if(!$sliderData._pausedByClick){ 1946 // $sliderData.play(); 1947 // } 1948 // } 1949 // } 1950 // ); 1951 }; 1952 $(".rsHomePorthole").each(function(){ 1953 $(this).portholeScroller(); 1954 }); 1955 1956 }; 1957 1958});
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.