1/* start page builder */ 2(function($){ 3 "use strict"; 4 5 // Detect Mobile Device 6 var gdlr_core_mobile = false; 7 if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/BlackBerry/i) || 8 navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Windows Phone/i) ){ 9 gdlr_core_mobile = true; 10 }else{ 11 gdlr_core_mobile = false; 12 } 13 14 // Detect Screen 15 var gdlr_core_display = 'desktop'; 16 if( typeof(window.matchMedia) == 'function' ){ 17 $(window).on('resize themename-set-display gdlr-core-element-resize', function(){ 18 if( window.matchMedia('(max-width: 419px)').matches ){ 19 gdlr_core_display = 'mobile-portrait'; 20 }else if( window.matchMedia('(max-width: 767px)').matches ){ 21 gdlr_core_display = 'mobile-landscape' 22 }else if( window.matchMedia('(max-width: 959px)').matches ){ 23 gdlr_core_display = 'tablet' 24 }else{ 25 gdlr_core_display = 'desktop'; 26 } 27 }); 28 $(window).trigger('themename-set-display'); 29 }else{ 30 $(window).on('resize themename-set-display gdlr-core-element-resize', function(){ 31 if( $(window).innerWidth() <= 419 ){ 32 gdlr_core_display = 'mobile-portrait'; 33 }else if( $(window).innerWidth() <= 767 ){ 34 gdlr_core_display = 'mobile-landscape' 35 }else if( $(window).innerWidth() <= 959 ){ 36 gdlr_core_display = 'tablet' 37 }else{ 38 gdlr_core_display = 'desktop'; 39 } 40 }); 41 $(window).trigger('themename-set-display'); 42 } 43 44 // set cookie 45 function gdlr_core_set_cookie( cname, cvalue, expires ){ 46 if( typeof(expires) != 'undefined' ){ 47 if( expires == 0 ){ 48 expires = 86400; 49 } 50 51 var now = new Date(); 52 var new_time = now.getTime() + (parseInt(expires) * 1000); 53 now.setTime(new_time); 54 55 expires = now.toGMTString(); 56 } 57 58 document.cookie = cname + "=" + encodeURIComponent(cvalue) + "; expires=" + expires + "; path=/"; 59 } 60 61 // script for normal content 62 $.fn.gdlr_core_content_script = function( filter_elem, document_ready ){ 63 64 $(this).gdlr_core_fluid_video( filter_elem ); 65 66 // audio 67 if( !document_ready && typeof($.fn.mediaelementplayer) == 'function' ){ 68 var wpme_settings = { 69 "stretching": "responsive" 70 }; 71 if( typeof(_wpmejsSettings) !== 'undefined' ){ 72 wpme_settings.pluginPath = _wpmejsSettings.pluginPath; 73 } 74 75 $(this).find('audio, video').mediaelementplayer(wpme_settings); 76 } 77 78 return $(this); 79 } 80 81 // responsive video 82 $.fn.gdlr_core_fluid_video = function( filter_elem ){ 83 84 if( typeof(filter_elem) == 'undefined' ){ 85 var elem = $(this).find('iframe[src*="youtube"], iframe[src*="vimeo"]'); 86 }else{ 87 var elem = filter_elem.filter('iframe[src*="youtube"], iframe[src*="vimeo"]'); 88 } 89 90 elem.each(function(){ 91 92 // ignore if inside slider 93 if( $(this).closest('.ls-container, .master-slider').length <= 0 ){ 94 if( ($(this).is('embed') && $(this).parent('object').length) || $(this).parent('.gdlr-core-fluid-video-wrapper').length ){ return; } 95 if( !$(this).attr('id') ){ $(this).attr('id', 'gdlr-video-' + Math.floor(Math.random()*999999)); } 96 97 var ratio = $(this).height() / $(this).width(); 98 $(this).removeAttr('height').removeAttr('width'); 99 100 try{ 101 $(this).wrap('<div class="gdlr-core-fluid-video-wrapper"></div>').parent().css('padding-top', (ratio * 100)+"%"); 102 $(this).attr('src', $(this).attr('src')); 103 }catch(e){} 104 } 105 }); 106 107 return $(this); 108 } 109 110 // ajax mejs 111 $.fn.gdlr_core_mejs_ajax = function(){ 112 if( typeof($.fn.mediaelementplayer) == 'function' ){ 113 114 var wpme_settings = {}; 115 if( typeof(_wpmejsSettings) !== 'undefined' ){ wpme_settings.pluginPath = _wpmejsSettings.pluginPath; } 116 $(this).find('audio, video').mediaelementplayer(wpme_settings); 117 118 } 119 } 120 121 // counter item 122 $.fn.gdlr_core_counter_item = function( filter_elem ){ 123 124 if( typeof(filter_elem) == 'undefined' ){ 125 var elem = $(this).find('.gdlr-core-counter-item-count[data-counter-start][data-counter-end]'); 126 }else{ 127 var elem = filter_elem.filter('.gdlr-core-counter-item-count[data-counter-start][data-counter-end]'); 128 } 129 130 elem.each(function(){ 131 var counter_item = $(this); 132 var start_num = parseInt($(this).attr('data-counter-start')); 133 var end_num = parseInt($(this).attr('data-counter-end')); 134 var duration_time = ($(this).attr('data-duration'))? parseInt($(this).attr('data-duration')): 4000; 135 136 if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > counter_item.offset().top ){ 137 $({ counter_num: start_num }).animate({ counter_num: end_num }, { duration: duration_time, easing: 'easeOutExpo', 138 step: function(){ 139 if( this.counter_num > 0.3 ){ 140 counter_item.html( Math.ceil(this.counter_num) ); 141 }else{ 142 counter_item.html( 0 ); 143 } 144 145 } 146 }); 147 }else{ 148 $(window).on('scroll pb-scroll', function( e ){ 149 if( $(this).scrollTop() + $(window).height() > counter_item.offset().top ){ 150 $({ counter_num: start_num }).animate({ counter_num: end_num }, { duration: duration_time, easing: 'easeOutExpo', 151 step: function(){ 152 if( this.counter_num > 0.3 ){ 153 counter_item.html( Math.ceil(this.counter_num) ); 154 }else{ 155 counter_item.html( 0 ); 156 } 157 } 158 });
159 160 $(this).unbind('scroll pb-scroll', e.handleObj.handler, e); 161 } 162 }); 163 } 164 }); 165 } 166 167 // typed animation item 168 $.fn.gdlr_core_typed_animation = function( filter_elem ){ 169 170 if( typeof(filter_elem) == 'undefined' ){ 171 var elem = $(this).find('.gdlr-core-type-animation-item-animated[data-animation-text]'); 172 }else{ 173 var elem = filter_elem.filter('.gdlr-core-type-animation-item-animated[data-animation-text]'); 174 } 175 176 elem.each(function(){ 177 178 var animation_text = JSON.parse($(this).attr('data-animation-text')); 179 180 if( typeof($.fn.typed) == 'function' && animation_text && animation_text.length > 0 ){ 181 $(this).typed({ 182 strings: animation_text, 183 typeSpeed: 50, 184 loop: true 185 }); 186 } 187 }); 188 } 189 190 // countdown item 191 $.fn.gdlr_core_countdown_item = function( filter_elem ){ 192 193 if( typeof(filter_elem) == 'undefined' ){ 194 var elem = $(this).find('.gdlr-core-countdown-wrap'); 195 }else{ 196 var elem = filter_elem.filter('.gdlr-core-countdown-wrap'); 197 } 198 199 elem.each(function(){ 200 var day_field = $(this).find('.gdlr-core-day'); 201 var day = parseInt(day_field.text()); 202 203 var hrs_field = $(this).find('.gdlr-core-hrs'); 204 var hrs = parseInt(hrs_field.text()); 205 206 var min_field = $(this).find('.gdlr-core-min'); 207 var min = parseInt(min_field.text()); 208 209 var sec_field = $(this).find('.gdlr-core-sec'); 210 var sec = parseInt(sec_field.text()); 211 212 $(window).load(function(){ 213 sec_field.text('00'); 214 sec_field.css('width', sec_field.width()); 215 sec_field.text(sec); 216 }); 217 218 var i = setInterval(function(){ 219 if( sec > 0 ){ 220 sec--; 221 }else{ 222 sec = 59; 223 if( min > 0 ){ 224 min--; 225 }else{ 226 min = 59; 227 if( hrs > 0 ){ 228 hrs--; 229 }else{ 230 hrs = 24; 231 if( day > 0 ){ 232 day--; 233 }else{ 234 day = 0; 235 hrs = 0; 236 min = 0; 237 sec = 0; 238 clearInterval(i); 239 } 240 day_field.text(day); 241 } 242 hrs_field.text(hrs); 243 } 244 min_field.text(min); 245 } 246 sec_field.text(sec); 247 }, 1000); 248 }); 249 } 250 251 // accordion 252 $.fn.gdlr_core_accordion = function( filter_elem ){ 253 254 if( typeof(filter_elem) == 'undefined' ){ 255 var elem_title = $(this).find('.gdlr-core-accordion-item-title'); 256 var elem_icon = $(this).find('.gdlr-core-accordion-item-icon'); 257 }else{ 258 var elem_title = filter_elem.filter('.gdlr-core-accordion-item-title'); 259 var elem_icon = filter_elem.filter('.gdlr-core-accordion-item-icon'); 260 } 261 262 elem_title.click(function(){ 263 $(this).siblings('.gdlr-core-accordion-item-content').slideDown(200); 264 265 var item_tab = $(this).closest('.gdlr-core-accordion-item-tab'); 266 if( item_tab.hasClass('gdlr-core-active') ){ 267 if( item_tab.closest('.gdlr-core-accordion-item').hasClass('gdlr-core-allow-close-all') ){ 268 item_tab.removeClass('gdlr-core-active') 269 .find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200); 270 } 271 }else{ 272 item_tab.addClass('gdlr-core-active') 273 .siblings('.gdlr-core-active').removeClass('gdlr-core-active') 274 .find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200); 275 } 276 }); 277 elem_icon.click(function(){ 278 if( $(this).closest('.gdlr-core-accordion-item-title').length ){ return; } 279 280 $(this).siblings('.gdlr-core-accordion-item-content-wrapper').children('.gdlr-core-accordion-item-content').slideDown(200); 281 282 var item_tab = $(this).closest('.gdlr-core-accordion-item-tab'); 283 if( item_tab.hasClass('gdlr-core-active') ){ 284 if( item_tab.closest('.gdlr-core-accordion-item').hasClass('gdlr-core-allow-close-all') ){ 285 item_tab.removeClass('gdlr-core-active') 286 .find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200); 287 } 288 }else{ 289 item_tab.addClass('gdlr-core-active') 290 .siblings('.gdlr-core-active').removeClass('gdlr-core-active') 291 .find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200); 292 } 293 }); 294 } 295 296 // toggle_box 297 $.fn.gdlr_core_toggle_box = function( filter_elem ){ 298 299 if( typeof(filter_elem) == 'undefined' ){ 300 var elem_title = $(this).find('.gdlr-core-toggle-box-item-title'); 301 var elem_icon = $(this).find('.gdlr-core-toggle-box-item-icon'); 302 }else{ 303 var elem_title = filter_elem.filter('.gdlr-core-toggle-box-item-title'); 304 var elem_icon = filter_elem.filter('.gdlr-core-toggle-box-item-icon'); 305 } 306 307 elem_title.click(function(){ 308 var toggle_parent = $(this).closest('.gdlr-core-toggle-box-item-tab'); 309 if( toggle_parent.hasClass('gdlr-core-active') ){ 310 311 toggle_parent.removeClass('gdlr-core-active'); 312 $(this).siblings('.gdlr-core-toggle-box-item-content').css({display: 'block'}).slideUp(200); 313 314 }else{ 315 316 toggle_parent.addClass('gdlr-core-active'); 317 $(this).siblings('.gdlr-core-toggle-box-item-content').css({display: 'none'}).slideDown(200); 318 } 319 }); 320 elem_icon.click(function(){ 321 if( $(this).closest('.gdlr-core-toggle-box-item-title').length ){ return; } 322 323 var toggle_parent = $(this).closest('.gdlr-core-toggle-box-item-tab'); 324 if( toggle_parent.hasClass('gdlr-core-active') ){ 325 toggle_parent.removeClass('gdlr-core-active'); 326 $(this).siblings('.gdlr-core-toggle-box-item-content-wrapper').children('.gdlr-core-toggle-box-item-content').css({display: 'block'}).slideUp(200); 327 328 }else{ 329 toggle_parent.addClass('gdlr-core-active'); 330 $(this).siblings('.gdlr-core-toggle-box-item-content-wrapper').children('.gdlr-core-toggle-box-item-content').css({display: 'none'}).slideDown(200); 331 } 332 }); 333 } 334 335 // alert box 336 $.fn.gdlr_core_alert_box_item = function( filter_elem ){ 337 338 if( typeof(filter_elem) == 'undefined' ){ 339 var elem = $(this).find('.gdlr-core-alert-box-remove'); 340 }else{ 341 var elem = filter_elem.filter('.gdlr-core-alert-box-remove'); 342 } 343 344 elem.click(function(){ 345 $(this).closest('.gdlr-core-alert-box-item').slideUp(400, 'easeOutQuart', function(){ 346 $(this).remove(); 347 }); 348 }); 349 } 350 351 // particle background 352 $.fn.gdlr_core_particle_background = function( filter_elem ){ 353 354 if( typeof(filter_elem) == 'undefined' ){ 355 var elem = $(this).find('.gdlr-core-particle-bg'); 356 }else{ 357 var elem = filter_elem.filter('.gdlr-core-particle-bg'); 358 } 359 360 elem.each(function(){ 361 if( typeof(window.gdlr_particle_bg_id) == 'undefined' ){ 362 window.gdlr_particle_bg_id = 1; 363 }else{ 364 window.gdlr_particle_bg_id++; 365 } 366 367 var item_id = 'gdlr-core-particle' + window.gdlr_particle_bg_id; 368 $(this).attr('id', item_id); 369 370 particlesJS(item_id, { 371 "particles": { 372 "number": { 373 "value": 40, 374 "density": {"enable": true,"value_area": 1500} 375 }, 376 "color": {"value": "#ffffff"}, 377 "shape": { 378 "type": "circle", 379 "stroke": {"width": 0,"color": "#000000"}, 380 "polygon": {"nb_sides": 5}, 381 "image": {"src": "img/github.svg","width": 100,"height": 100} 382 }, 383 "opacity": { 384 "value": 0.8, 385 "random": false, 386 "anim": {"enable": false,"speed": 0.6,"opacity_min": 0.1,"sync": false} 387 }, 388 "size": { 389 "value": 2, 390 "random": true, 391 "anim": {"enable": false,"speed": 80,"size_min": 0.1,"sync": false} 392 }, 393 "line_linked": {"enable": true,"distance": 300,"color": "#ffffff","opacity": 0.4,"width": 2}, 394 "move": { 395 "enable": true, 396 "speed": 12, 397 "direction": "none", 398 "random": false, 399 "straight": false, 400 "out_mode": "out", 401 "bounce": false, 402 "attract": {"enable": false,"rotateX": 600,"rotateY": 1200} 403 } 404 }, 405 "interactivity": { 406 "detect_on": "canvas", 407 "events": { 408 "onhover": {"enable": false,"mode": "repulse"}, 409 "onclick": {"enable": false,"mode": "push"}, 410 "resize": true 411 }, 412 "modes": { 413 "grab": {"distance": 800,"line_linked": {"opacity": 1}}, 414 "bubble": {"distance": 800,"size": 80,"duration": 2,"opacity": 0.8,"
414speed": 3}, 415 "repulse": {"distance": 400,"duration": 0.4}, 416 "push": {"particles_nb": 4}, 417 "remove": {"particles_nb": 2} 418 } 419 }, 420 "retina_detect": true 421 }); 422 }); 423 424 return $(this); 425 } 426 427 // parallax background 428 $.fn.gdlr_core_parallax_background = function( filter_elem ){ 429 430 if( typeof(filter_elem) == 'undefined' ){ 431 var elem = $(this).find('.gdlr-core-parallax'); 432 }else{ 433 var elem = filter_elem.filter('.gdlr-core-parallax'); 434 } 435 436 elem.each(function(){ 437 new gdlr_core_parallax($(this)); 438 }); 439 440 return $(this); 441 } 442 443 var gdlr_core_parallax = function(t){ 444 445 this.wrapper_bg = t; 446 this.wrapper = t.parent(); // background-wrap 447 448 this.parallax_speed = parseFloat(t.attr('data-parallax-speed')); 449 450 this.init(); 451 } 452 gdlr_core_parallax.prototype = { 453 454 init: function(){ 455 456 var t = this; 457 458 // scroll event 459 if( t.parallax_speed != 0 ){ 460 t.set_extra_height(); 461 t.set_background_position(t); 462 $(window).on('load resize gdlr-core-element-resize', function(){ 463 t.set_extra_height($(this)); 464 t.set_background_position(t); 465 }); 466 467 $(window).on('scroll pb-scroll', function(){ 468 t.set_background_position(t); 469 }); 470 } 471 472 if( gdlr_core_mobile ){ 473 t.wrapper_bg.children('[data-background-type="video"]').remove(); 474 475 if( t.wrapper_bg.attr('data-video-fallback') ){ 476 t.wrapper_bg.css('background-image', 'url(' + t.wrapper_bg.attr('data-video-fallback') + ')') 477 } 478 }else{ 479 t.wrapper_bg.children('[data-background-type="video"]').each(function(){ 480 if( t.parallax_speed == 0 ){ 481 t.set_extra_height(); 482 t.set_background_position(t); 483 $(window).on('load resize gdlr-core-element-resize', function(){ 484 t.set_extra_height($(this)); 485 t.set_background_position(t); 486 }); 487 } 488 489 // script for muting the vimeo/youtube player 490 $(this).find('iframe').each(function(){ 491 if( $(this).attr('data-player-type') == 'vimeo' ){ 492 var player = $f($(this)[0]); 493 494 player.addEvent('ready', function() { 495 player.api('setVolume', 0); 496 }); 497 }else if( $(this).attr('data-player-type') == 'youtube' ){ 498 499 // assign the script 500 if( $('body').children('#gdlr-core-youtube-api').length == 0 ){ 501 $('body').append('<script src="https://www.youtube.com/iframe_api" id="gdlr-core-youtube-api" ></script>'); 502 } 503 504 // store to global variable 505 if( typeof(window.gdlr_core_ytb) == 'undefined' ){ 506 window.gdlr_core_ytb = [$(this)[0]]; 507 }else{ 508 window.gdlr_core_ytb.push($(this)[0]); 509 } 510 511 // script loading action 512 window.onYouTubeIframeAPIReady = function(){ 513 for( var key in window.gdlr_core_ytb ){ 514 new YT.Player(gdlr_core_ytb[key],{ 515 events: { 516 'onReady': function(e){ 517 e.target.mute(); 518 } 519 } 520 }); 521 } 522 } 523 } 524 }); 525 }); 526 } // else gdlr_core_mobile 527 528 }, // init 529 530 set_extra_height: function(){ 531 532 var t = this; 533 534 var new_height = t.wrapper.outerHeight(); 535 if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){ 536 t.wrapper_bg.css({'transform': ''}); 537 }else{ 538 if( t.parallax_speed > 0){ 539 new_height += (($(window).height() - t.wrapper.outerHeight()) * t.parallax_speed); 540 }else if( t.parallax_speed < 0){ 541 new_height += (($(window).height() + t.wrapper.outerHeight()) * Math.abs(t.parallax_speed)); 542 } 543 } 544 t.wrapper_bg.css({height: new_height}); 545 546 // set video height 547 var ratio = parseInt(gdlr_core_pbf.video.width) / parseInt(gdlr_core_pbf.video.height); 548 t.wrapper_bg.children('[data-background-type="video"]').each(function(){ 549 if( (t.wrapper_bg.width() / t.wrapper_bg.height()) > ratio ){ 550 var v_height = t.wrapper_bg.width() / ratio; 551 var v_margin = (t.wrapper_bg.height() - v_height) / 2; 552 $(this).css({width: t.wrapper_bg.width(), height: v_height, 'margin-left': 0, 'margin-top': v_margin}); 553 }else{ 554 var v_width = t.wrapper_bg.height() * ratio; 555 var v_margin = (t.wrapper_bg.width() - v_width) / 2; 556 $(this).css({width: v_width, height: t.wrapper_bg.height(), 'margin-left': v_margin, 'margin-top': 0}); 557 } 558 }); 559 560 }, // set_extra_height 561 562 set_background_position: function( t ){ 563 564 if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ) return; 565 566 var wrapper_top = t.wrapper.offset().top; 567 var scroll_pos = $(window).scrollTop(); 568 569 if( scroll_pos + $(window).height() > wrapper_top && 570 scroll_pos < wrapper_top + t.wrapper.outerHeight() ){ 571 572 if( t.parallax_speed > 0 ){ 573 t.wrapper_bg.css({'transform': 'translate(0px, ' + (($(window).scrollTop() - wrapper_top) * t.parallax_speed) + 'px)'}); 574 }else if( t.parallax_speed < 0 ){ 575 t.wrapper_bg.css({'transform': 'translate(0px, ' + (($(window).scrollTop() + $(window).height() - wrapper_top) * t.parallax_speed) + 'px)'}); 576 } 577 } 578 } 579 }; // gdlr_core_parallax 580 581 // ux animation 582 var gdlr_core_ux = function( container, filter_elem ){ 583 584 if( typeof(filter_elem) == 'undefined' ){ 585 this.elem = container.find('[data-gdlr-animation]'); 586 }else{ 587 this.elem = filter_elem.filter('[data-gdlr-animation]'); 588 this.preload = filter_elem.filter('.gdlr-core-page-preload'); 589 } 590 591 this.ux_items = []; 592 this.ux_item_length = 0; 593 594 this.init(); 595 596 } // gdlr_core_ux 597 gdlr_core_ux.prototype = { 598 599 init: function(){ 600 601 var t = this; 602 603 t.ux_item_length = t.elem.each(function(){ 604 var ux_item = $(this); 605 var ux_item_offset = 0.8; 606 if( $(this).attr('data-gdlr-animation-offset') ){ 607 ux_item_offset = parseFloat($(this).attr('data-gdlr-animation-offset')); 608 } 609 610 // check item at the first time the page is loaded 611 if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > ux_item.offset().top ){ 612 t.ux_items.push(ux_item); 613 614 // check the item on scroll event 615 }else{ 616 $(window).on('scroll pb-scroll', function(e){
617 if( $(window).scrollTop() + ($(window).height() * ux_item_offset) > ux_item.offset().top ){ 618 t.ux_items.push(ux_item); 619 $(window).unbind('scroll', e.handleObj.handler, e); 620 } 621 }); 622 } 623 }).length; 624 625 if( typeof(t.preload) != 'undefined' && t.preload.length ){ 626 $(window).load(function(){ 627 var preload_time = t.preload.attr('data-animation-time'); 628 if( !preload_time ){ preload_time = 0; } 629 630 setTimeout(function(){ 631 t.animate(); 632 }, preload_time); 633 }); 634 }else{ 635 t.animate(); 636 } 637 638 }, 639 640 animate: function(){ 641 642 var t = this; 643 644 // run the ux in order with delay 645 var ux_interval = setInterval(function(){ 646 647 while( t.ux_items.length > 0 ){ 648 649 // animate the ux item 650 var ux_animate = t.ux_items.shift(); 651 var animation_duration = '600ms'; 652 if( ux_animate.attr('data-gdlr-animation-duration') ){ 653 animation_duration = ux_animate.attr('data-gdlr-animation-duration'); 654 } 655 656 ux_animate.css({ 'animation-duration': animation_duration }); 657 ux_animate.addClass(ux_animate.attr('data-gdlr-animation')); 658 659 // remove selector 660 setTimeout(function(){ 661 ux_animate.css({ 'animation-duration': '' }) 662 .removeClass(ux_animate.attr('data-gdlr-animation')) 663 .removeAttr('data-gdlr-animation'); 664 }, parseInt(animation_duration)); 665 666 t.ux_item_length--; 667 668 // if item is inside the screen break while loop 669 if( $(window).scrollTop() < ux_animate.offset().top + ux_animate.outerHeight() ){ 670 break; 671 } 672 } 673 674 if( t.ux_item_length <= 0 ){ 675 clearInterval(ux_interval); 676 } 677 }, 200); 678 679 } 680 681 }; // gdlr_core_ux.prototype 682 $.fn.gdlr_core_ux = function( filter_elem ){ 683 new gdlr_core_ux( $(this), filter_elem ); 684 685 return $(this); 686 } 687 688 // skill bar 689 $.fn.gdlr_core_skill_bar = function( filter_elem ){ 690 691 if( typeof(filter_elem) == 'undefined' ){ 692 var elem = $(this).find('.gdlr-core-skill-bar-filled'); 693 }else{ 694 var elem = filter_elem.filter('.gdlr-core-skill-bar-filled'); 695 } 696 697 elem.each(function(){ 698 var t = $(this); 699 700 if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > t.offset().top ){ 701 t.animate({width: parseInt(t.attr('data-width')) + '%'}, {duration: 1200, easing: 'easeOutQuart'}); 702 }else{ 703 $(window).on('scroll pb-scroll', function(e){ 704 if( $(window).scrollTop() + $(window).height() > t.offset().top ){ 705 t.animate({width: parseInt(t.attr('data-width')) + '%'}, {duration: 1200, easing: 'easeOutQuart'}); 706 $(window).unbind('scroll pb-scroll', e.handleObj.handler, e); 707 } 708 }); 709 } 710 }); 711 } 712 713 // divider width 714 $.fn.gdlr_core_divider = function( filter_elem ){ 715 716 if( typeof(filter_elem) == 'undefined' ){ 717 var elem = $(this).find('.gdlr-core-divider-item-with-icon-inner'); 718 }else{ 719 var elem = filter_elem.filter('.gdlr-core-divider-item-with-icon-inner'); 720 } 721 722 elem.each(function(){ 723 var divider_elem = $(this); 724 var icon_width = divider_elem.children('i, img').outerWidth(); 725 var divider_width = (divider_elem.width() - icon_width) / 2; 726 $(this).children('.gdlr-core-divider-line').css({ width: divider_width }).each(function(){ 727 $(this).css('margin-top', -$(this).outerHeight()/2); 728 }); 729 730 $(window).on('resize gdlr-core-element-resize', function(){ 731 icon_width = divider_elem.children('i, img').outerWidth(); 732 divider_width = (divider_elem.width() - icon_width) / 2; 733 divider_elem.children('.gdlr-core-divider-line').css({ width: divider_width }).each(function(){ 734 $(this).css('margin-top', -$(this).outerHeight()/2); 735 }); 736 }); 737 }); 738 739 } 740 741 window.gdlr_core_sidebar_wrapper = function( container, filter_elem ){ 742 743 if( typeof(filter_elem) == 'undefined' ){ 744 this.elem = container.find('.gdlr-core-page-builder-wrapper-sidebar-container, .gdlr-core-pbf-sidebar-container'); 745 }else{
746 this.elem = filter_elem.filter('.gdlr-core-page-builder-wrapper-sidebar-container, .gdlr-core-pbf-sidebar-container'); 747 } 748 749 this.init(); 750 751 } 752 gdlr_core_sidebar_wrapper.prototype = { 753 754 init: function(){ 755 756 var t = this; 757 758 // if no background, don't sync height 759 var sync_height = false; 760 t.elem.each(function(){ 761 if( $(this).children().children('.gdlr-core-pbf-background-wrap').length ){ 762 sync_height = true; 763 } 764 }); 765 766 // sync the height 767 if( sync_height ){ 768 t.set_height(); 769 $(window).on('load resize gdlr-core-element-resize', function(){ t.set_height(); }); 770 } 771 }, 772 773 set_height: function(){ 774 775 var t = this; 776 777 t.elem.each(function(){ 778 779 var sidebar_elem = $(this).find('.gdlr-core-pbf-sidebar-padding'); 780 sidebar_elem.css('min-height', ''); 781 782 if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ) return; 783 784 // determine max height 785 var max_height = 0; 786 sidebar_elem.each(function(){ 787 if( $(this).outerHeight() > max_height ){ 788 max_height = $(this).outerHeight(); 789 } 790 }); 791 792 // set the height 793 sidebar_elem.css('min-height', max_height); 794 795 }); 796 797 } 798 799 }; 800 801 // title divider width 802 $.fn.gdlr_core_title_divider = function( filter_elem ){ 803 804 if( typeof(filter_elem) == 'undefined' ){ 805 var elem = $(this).find('.gdlr-core-title-item-title-wrap.gdlr-core-with-divider'); 806 }else{ 807 var elem = filter_elem.filter('.gdlr-core-title-item-title-wrap.gdlr-core-with-divider'); 808 } 809 810 elem.each(function(){ 811 var t = $(this); 812 var title_width = t.children('.gdlr-core-title-item-title').outerWidth(true); 813 var divider_num = t.children('.gdlr-core-title-item-divider').length; 814 divider_num = (divider_num)? divider_num: 1; 815 816 var divider_width = (t.width() - title_width) / divider_num; 817 818 // for right divider with link text 819 if( divider_num == 1 ){ 820 var right_pos = t.children('.gdlr-core-title-item-link').outerWidth() + 20; 821 t.children('.gdlr-core-title-item-divider').css({ width: (divider_width - right_pos), right: right_pos }); 822 }else{ 823 t.children('.gdlr-core-title-item-divider').css({ width: divider_width }); 824 } 825 826 $(window).on('resize gdlr-core-element-resize', function(){ 827 title_width = t.children('.gdlr-core-title-item-title').outerWidth(true); 828 divider_width = (t.width() - title_width) / divider_num; 829 830 // for right divider with link text 831 if( divider_num == 1 ){ 832 right_pos = t.children('.gdlr-core-title-item-link').outerWidth() + 20; 833 t.children('.gdlr-core-title-item-divider').css({ width: (divider_width - right_pos), right: right_pos }); 834 }else{ 835 t.children('.gdlr-core-title-item-divider').css({ width: divider_width }); 836 } 837 }); 838 }); 839 840 if( typeof(filter_elem) == 'undefined' ){ 841 var elem2 = $(this).find('.gdlr-core-title-item-title-wrap.gdlr-core-with-link-text'); 842 }else{ 843 var elem2 = filter_elem.filter('.gdlr-core-title-item-title-wrap.gdlr-core-with-link-text'); 844 } 845 elem2.each(function(){ 846 var t = $(this); 847 var title_width = t.children('.gdlr-core-title-item-title').outerWidth(true); 848 var right_pos = t.children('.gdlr-core-title-item-link').outerWidth(); 849 850 if( t.width() < title_width + right_pos ){ 851 t.children('.gdlr-core-title-item-link').addClass('gdlr-core-overflow'); 852 }else{ 853 t.children('.gdlr-core-title-item-link').removeClass('gdlr-core-overflow'); 854 } 855 856 $(window).on('resize gdlr-core-element-resize', function(){ 857 if( t.width() < title_width + right_pos ){ 858 t.children('.gdlr-core-title-item-link').addClass('gdlr-core-overflow'); 859 }else{ 860 t.children('.gdlr-core-title-item-link').removeClass('gdlr-core-overflow'); 861 } 862 }); 863 864 }); 865 866 } 867 868 $.fn.gdlr_core_flipbox = function( filter_elem ){ 869 if(typeof($.fn.flip) == 'function'){ 870 871 if( typeof(filter_elem) == 'undefined' ){ 872 var elem = $(this).find('.gdlr-core-flipbox'); 873 }else{ 874 var elem = filter_elem.filter('.gdlr-core-flipbox'); 875 } 876 877 elem.each(function(){ 878 var flipbox_obj = $(this).flip({ 879 axis: 'y', 880 trigger: 'hover', 881 autoSize: false, 882 front: '.gdlr-core-flipbox-front', 883 back: '.gdlr-core-flipbox-back' 884 }); 885 886 $(this).find('.gdlr-core-flipbox-back a').click(function(){ 887 if( flipbox_obj.data('flip-model') ){ 888 flipbox_obj.data('flip-model').unflip(); 889 } 890 }); 891 892 $(this).addClass('gdlr-core-after-init'); 893 }); 894 } 895 896 return $(this); 897 } 898 899 // marquee 900 $.fn.gdlr_core_marquee = function( filter_elem ){ 901 if( typeof(filter_elem) == 'undefined' ){ 902 var elem = $(this).find('.gdlr-core-marquee'); 903 }else{ 904 var elem = filter_elem.filter('.gdlr-core-marquee'); 905 } 906 907 elem.each(function(){ 908 var speed = $(this).attr('data-speed')? parseFloat($(this).attr('data-speed')): 10000; 909 var direction = $(this).attr('data-direction')? parseFloat($(this).attr('data-direction')): 'left'; 910 911 $(this).marquee({ 912 //time in milliseconds before the marquee will start animating 913 delayBeforeStart: 0, 914 //speed in milliseconds of the marquee 915 duration: speed, 916 //gap in pixels between the tickers 917 gap: 50, 918 //'left' or 'right' 919 direction: direction, 920 //true or false - should the marquee be duplicated to show an effect of continues flow 921 duplicated: true, 922 // the marquee is visible initially positioned next to the border towards it will be moving 923 startVisible: true 924 }); 925 }); 926 927 return $(this); 928 } 929 930 // pie chart
931 function gdlr_core_skill_circle_height(t){ 932 t.children('.gdlr-core-skill-circle-content').each(function(){ 933 $(this).css({'margin-top': -$(this).outerHeight()/2}); 934 }); 935 t.css({'max-width': t.parent().width(), 'max-height': t.parent().width()}); 936 } 937 $.fn.gdlr_core_pie_chart = function(){ 938 if(typeof($.fn.easyPieChart) == 'function'){ 939 $(this).easyPieChart({ 940 animate: parseInt($(this).attr('data-duration')), 941 lineWidth: parseInt($(this).attr('data-line-width')), 942 size: parseInt($(this).attr('data-width')), 943 barColor: $(this).attr('data-filled-color'), 944 trackColor: $(this).attr('data-filled-background'), 945 scaleColor: false, 946 lineCap: 'square' 947 }); 948 } 949 } 950 $.fn.gdlr_core_skill_circle = function( filter_elem ){ 951 952 if( typeof(filter_elem) == 'undefined' ){ 953 var elem = $(this).find('.gdlr-core-skill-circle'); 954 }else{ 955 var elem = filter_elem.filter('.gdlr-core-skill-circle'); 956 } 957 958 elem.each(function(){ 959 var t = $(this); 960 961 // for responsive 962 gdlr_core_skill_circle_height(t); 963 $(window).on('resize gdlr-core-element-resize', function(){ gdlr_core_skill_circle_height(t); }); 964 965 // scroll action 966 if( $(window).scrollTop() + $(window).height() > t.offset().top ){ 967 t.gdlr_core_pie_chart(); 968 }else{ 969 $(window).on('scroll pb-scroll', function(e){ 970 if( $(window).scrollTop() + $(window).height() > t.offset().top ){ 971 t.gdlr_core_pie_chart(); 972 $(window).unbind('scroll pb-scroll', e.handleObj.handler, e); 973 } 974 }); 975 } 976 }); 977 } 978 979 // chart.js 980 $.fn.gdlr_core_chart_js = function( filter_elem ){ 981 982 if( typeof(filter_elem) == 'undefined' ){ 983 var elem = $(this).find('.gdlr-core-chart-js'); 984 }else{ 985 var elem = filter_elem.filter('.gdlr-core-chart-js'); 986 } 987 988 if( typeof(window.gdlr_core_chart_js_id) == 'undefined' ){ 989 window.gdlr_core_chart_js_id = 0; 990 } 991 992 elem.each(function(){ 993 994 var data = []; 995 var options = []; 996 if( $(this).attr('data-content') ){ 997 data = JSON.parse($(this).attr('data-content')); 998 } 999 if( $(this).attr('data-options') ){ 1000 options = JSON.parse($(this).attr('data-options')); 1001 } 1002 1003 if( $(this).attr('data-type') == 'doughnut' || $(this).attr('data-type') == 'pie' ){ 1004 if( options.legend.position == 'right' || options.legend.position == 'left' ){ 1005 if( gdlr_core_display == 'mobile-portrait' || gdlr_core_display == 'mobile-landscape' ){ 1006 options.legend.orig_position = options.legend.position; 1007 options.legend.position = 'bottom'; 1008 $(this).attr('width', $(this).width()); 1009 $(this).attr('height', $(this).width() * 1); 1010 } 1011 } 1012 } 1013 options.onResize = function(chart, size){ 1014 if( chart.config.type == 'doughnut' || chart.config.type == 'pie' ){ 1015 if( chart.config.options.legend.position == 'right' || chart.config.options.legend.position == 'left' ){ 1016 if( gdlr_core_display == 'mobile-portrait' || gdlr_core_display == 'mobile-landscape' ){ 1017 chart.config.options.legend.orig_position = chart.config.options.legend.position; 1018 chart.config.options.legend.position = 'bottom'; 1019 chart.aspectRatio = 1; 1020 } 1021 }else if( typeof(chart.config.options.legend.orig_position) != 'undefined' ){ 1022 if( gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop' ){ 1023 chart.config.options.legend.position = chart.config.options.legend.orig_position; 1024 chart.aspectRatio = 2; 1025 } 1026 } 1027 1028 } 1029 1030 } 1031 1032 new Chart($(this), { 1033 type: $(this).attr('data-type')? $(this).attr('data-type'): 'pie', 1034 data: data, 1035 options: options 1036 }); 1037 1038 }); 1039 1040 } // gdlr_core_chart_js 1041 1042 // tab 1043 $.fn.gdlr_core_tab = function( filter_elem ){ 1044 1045 if( typeof(filter_elem) == 'undefined' ){ 1046 var elem = $(this).find('.gdlr-core-tab-item, .gdlr-core-roadmap-item, .gdlr-core-tab-feature-item, .gdlr-core-tab-featurev-item'); 1047 }else{ 1048 var elem = filter_elem.filter('.gdlr-core-tab-item, .gdlr-core-roadmap-item, .gdlr-core-tab-feature-item, .gdlr-core-tab-featurev-item'); 1049 } 1050 1051 elem.each(function(){ 1052 1053 // click action 1054 $(this).find('.gdlr-core-tab-item-title, .gdlr-core-roadmap-item-head, .gdlr-core-tab-feature-title-wrap, .gdlr-core-tab-featurev-title').click(function(){ 1055 if( $(this).hasClass('gdlr-core-active') ) return; 1056 1057 var tab_id = $(this).attr('data-tab-id'); 1058 1059 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 1060 1061 // for tab feature vertical 1062 if( $(this).is('.gdlr-core-tab-featurev-title') ){ 1063 var parent = $(this).parent().parent(); 1064 1065 parent.closest('.gdlr-core-tab-featurev-item').find('.gdlr-core-tab-featurev-background-switch').each(function(){ 1066 $(this).children().removeClass('gdlr-core-active'); 1067 $(this).children('[data-tab-id="' + tab_id + '"]').addClass('gdlr-core-active'); 1068 });
1069 }else{ 1070 var parent = $(this).parent(); 1071 } 1072 parent.siblings('.gdlr-core-tab-item-content-wrap, .gdlr-core-roadmap-item-content-wrap, .gdlr-core-tab-feature-item-content-wrap, .gdlr-core-tab-featurev-item-content-wrap').each(function(){ 1073 var active_tab = $(this).children('[data-tab-id="' + tab_id + '"]'); 1074 1075 if( active_tab.length ){ 1076 active_tab.fadeIn(200).siblings().hide(); 1077 }else{ 1078 $(this).children().hide(); 1079 } 1080 }); 1081 1082 }); 1083 1084 // hover action 1085 if( !(gdlr_core_mobile || gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') && 1086 $(this).is('.gdlr-core-tab-style2-horizontal, .gdlr-core-tab-style2-vertical') ){ 1087 1088 var horizontal = $(this).is('.gdlr-core-tab-style2-horizontal'); 1089 var hover_line = $(this).find('.gdlr-core-tab-item-title-line'); 1090 var hover_line_w = 0; 1091 var hover_line_l = 0; 1092 1093 // initiate 1094 $(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-active').each(function(){ 1095 if( horizontal ){ 1096 hover_line_w = $(this).outerWidth(); 1097 hover_line_l = $(this).position().left; 1098 hover_line.css({ width: hover_line_w, left: hover_line_l }); 1099 }else{ 1100 hover_line_w = $(this).outerHeight(); 1101 hover_line_l = $(this).position().top; 1102 hover_line.css({ height: hover_line_w, top: hover_line_l }); 1103 } 1104 }); 1105 $(window).on('resize gdlr-core-element-resize', function(){ 1106 $(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-active').each(function(){ 1107 if( horizontal ){ 1108 hover_line_w = $(this).outerWidth(); 1109 hover_line_l = $(this).position().left; 1110 hover_line.css({ width: hover_line_w, left: hover_line_l }); 1111 }else{ 1112 hover_line_w = $(this).outerHeight(); 1113 hover_line_l = $(this).position().top; 1114 hover_line.css({ height: hover_line_w, top: hover_line_l }); 1115 } 1116 }); 1117 }); 1118 1119 // animate 1120 $(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-tab-item-title').hover(function(){ 1121 if( horizontal ){ 1122 hover_line.animate({ width: $(this).outerWidth(), left: $(this).position().left }, { duration: 300, easing: 'easeOutQuart', queue: false }); 1123 }else{ 1124 hover_line.animate({ height: $(this).outerHeight(), top: $(this).position().top }, { duration: 300, easing: 'easeOutQuart', queue: false }); 1125 } 1126 }, function(){ 1127 if( horizontal ){ 1128 hover_line.animate({ width: hover_line_w, left: hover_line_l }, { duration: 300, easing: 'easeOutQuart', queue: false }); 1129 }else{ 1130 hover_line.animate({ height: hover_line_w, top: hover_line_l }, { duration: 300, easing: 'easeOutQuart', queue: false }); 1131 } 1132 }); 1133 1134 // click 1135 $(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-tab-item-title').click(function(){ 1136 if( horizontal ){ 1137 hover_line_w = $(this).outerWidth(); 1138 hover_line_l = $(this).position().left; 1139 hover_line.css({ width: hover_line_w, left: hover_line_l }); 1140 }else{ 1141 hover_line_w = $(this).outerHeight(); 1142 hover_line_l = $(this).position().top; 1143 hover_line.css({ height: hover_line_w, top: hover_line_l }); 1144 } 1145 }); 1146 } 1147 }); 1148 1149 return $(this); 1150 1151 } // gdlr_core_tab 1152 1153 $.fn.gdlr_core_sly = function( filter_elem ){ 1154 1155 if( typeof(filter_elem) == 'undefined' ){ 1156 var elem = $(this).find('.gdlr-core-sly-slider'); 1157 }else{ 1158 var elem = filter_elem.filter('.gdlr-core-sly-slider'); 1159 } 1160 1161 elem.addClass('gdlr-core-after-init').each(function(){ 1162 var sly_slider = $(this); 1163 1164 sly_slider.sly({ 1165 horizontal: 1, 1166 itemNav: 'basic', 1167 smart: 1, 1168 activateOn: 'click', 1169 mouseDragging: 1, 1170 touchDragging: 1, 1171 releaseSwing: 1, 1172 startAt: 0, 1173 scrollBy: 1, 1174 speed: 1000, 1175 elasticBounds: 1, 1176 easing: 'easeOutQuart', 1177 dragHandle: 1, 1178 dynamicHandle: 1, 1179 clickBar: 1, 1180 scrollBar: $(this).siblings('.gdlr-core-sly-scroll') 1181 }); 1182 $(window).on('resize gdlr-core-element-resize', function(){ sly_slider.sly('reload'); }); 1183 }); 1184 1185 return $(this); 1186 1187 } // gdlr-core_sly 1188 1189 $.fn.gdlr_core_flexslider = function( filter_elem ){ 1190 1191 if( typeof(filter_elem) == 'undefined' ){ 1192 var elem = $(this).find('.gdlr-core-flexslider'); 1193 }else{ 1194 var elem = filter_elem.filter('.gdlr-core-flexslider'); 1195 } 1196 1197 elem.each(function(){ 1198 1199 var flex_attr = {
1200 useCSS: false, 1201 animation: 'fade', 1202 animationLoop: true, 1203 prevText: '<i class="arrow_carrot-left"></i>', 1204 nextText: '<i class="arrow_carrot-right"></i>' 1205 }; 1206 1207 if( $(this).attr('data-start-at') && $(this).attr('data-start-at') > 1 ){ 1208 flex_attr.startAt = $(this).attr('data-start-at') - 1; 1209 } 1210 1211 if( $(this).find('.gdlr-core-flexslider').length > 0 ){ 1212 $(this).children('ul.slides').addClass('parent-slides'); 1213 flex_attr.selector = '.parent-slides > li'; 1214 } 1215 1216 // variable settings 1217 if( $(this).attr('data-disable-autoslide') ){ 1218 flex_attr.slideshow = false; 1219 } 1220 if( $(this).attr('data-pausetime') ){ 1221 flex_attr.slideshowSpeed = parseInt($(this).attr('data-pausetime')); 1222 } 1223 if( $(this).attr('data-slidespeed') ){ 1224 flex_attr.animationSpeed = parseInt($(this).attr('data-slidespeed')); 1225 }else{ 1226 flex_attr.animationSpeed = 500; 1227 } 1228 1229 // for carousel 1230 if( $(this).attr('data-type') == 'carousel' ){ 1231 flex_attr.move = $(this).attr('data-move')? parseInt($(this).attr('data-move')): 1; 1232 flex_attr.animation = 'slide'; 1233 1234 // determine the spaces 1235 var column_num = parseInt($(this).attr('data-column')); 1236 flex_attr.itemMargin = 2 * parseInt($(this).children('ul.slides').children('li:first-child').css('margin-right')); 1237 flex_attr.itemWidth = (($(this).width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin); 1238 1239 flex_attr.minItems = column_num; 1240 flex_attr.maxItems = column_num; 1241 1242 var t = $(this); 1243 $(window).on('resize gdlr-core-element-resize', function(){ 1244 if( t.data('goodlayers_flexslider') ){ 1245 var newWidth = ((t.width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin); 1246 t.data('goodlayers_flexslider').editItemWidth(newWidth); 1247 } 1248 }); 1249 1250 }else if( $(this).attr('data-effect') ){ 1251 if( $(this).attr('data-effect') == 'kenburn' ){ 1252 flex_attr.animation = 'fade'; 1253 }else{ 1254 flex_attr.animation = $(this).attr('data-effect'); 1255 } 1256 } 1257 1258 // for navigation 1259 if( !$(this).attr('data-nav') || $(this).attr('data-nav') == 'both' || $(this).attr('data-nav') == 'navigation' || $(this).attr('data-nav') == 'navigation-outer' ){ 1260 if( $(this).attr('data-nav-parent') ){ 1261 1262 if( $(this).attr('data-nav-type') == 'custom' ){ 1263 flex_attr.customDirectionNav = $(this).closest('.' + $(this).attr('data-nav-parent')).find('.flex-prev, .flex-next'); 1264 }else{ 1265 $(this).closest('.' + $(this).attr('data-nav-parent')).each(function(){ 1266 var flex_nav = $('<ul class="flex-direction-nav">' + 1267 '<li class="flex-nav-prev"><a class="flex-prev" href="#"><i class="arrow_carrot-left"></i></a></li>' + 1268 '<li class="flex-nav-next"><a class="flex-next" href="#"><i class="arrow_carrot-right"></i></a></li>' + 1269 '</ul>'); 1270 1271 var flex_nav_position = $(this).find('.gdlr-core-flexslider-nav'); 1272 if( flex_nav_position.length ){ 1273 flex_nav_position.append(flex_nav); 1274 flex_attr.customDirectionNav = flex_nav.find('.flex-prev, .flex-next'); 1275 } 1276 }); 1277 } 1278 } 1279 }else if( $(this).attr('data-nav') != 'navigation-bottom' ){ 1280 flex_attr.directionNav = false; 1281 } 1282 if( $(this).attr('data-nav') == 'both' || $(this).attr('data-nav') == 'bullet' ){ 1283 flex_attr.controlNav = true; 1284 }else{ 1285 flex_attr.controlNav = false; 1286 } 1287 1288 // for thumbnail 1289 if( $(this).attr('data-thumbnail') ){ 1290 var thumbnail_slide = $(this).siblings('.gdlr-core-sly-slider'); 1291 1292 flex_attr.manualControls = thumbnail_slide.find('ul.slides li') 1293 flex_attr.controlNav = true; 1294 } 1295 1296 // center the navigation 1297 // add active class for kenburn effects 1298 if( $(this).attr('data-vcenter-nav') ){ 1299 flex_attr.start = function(slider){ 1300 if( slider.directionNav ){ 1301 $(window).on('resize gdlr-core-element-resize', function(){ 1302 slider.directionNav.each(function(){ 1303 var margin = -(slider.height() + $(this).outerHeight()) / 2; 1304 $(this).css('margin-top', margin); 1305 });
1306 }); 1307 } 1308 if( typeof(slider.slides) != 'undefined' ){ 1309 $(window).trigger('gdlr-core-element-resize'); 1310 slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 1311 } 1312 }; 1313 }else{ 1314 flex_attr.start = function(slider){ 1315 if( typeof(slider.slides) != 'undefined' ){ 1316 $(window).trigger('gdlr-core-element-resize'); 1317 slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 1318 } 1319 } 1320 } 1321 1322 // add the action for class 1323 flex_attr.after = function(slider){ 1324 slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 1325 } 1326 1327 // add outer frame class 1328 if( $(this).find('.gdlr-core-outer-frame-element').length > 0 ){ 1329 $(this).addClass('gdlr-core-with-outer-frame-element'); 1330 } 1331 1332 $(this).goodlayers_flexslider(flex_attr); 1333 }); 1334 1335 return $(this); 1336 1337 } // gdlr-core-flexslier 1338 1339 window.gdlr_core_sticky_sidebar = function( filter_elem ){ 1340 1341 if( typeof(filter_elem) == 'undefined' ){ 1342 this.elem = $(this).find('.gdlr-core-sticky-sidebar'); 1343 }else{ 1344 this.elem = filter_elem.filter('.gdlr-core-sticky-sidebar'); 1345 } 1346 1347 this.init(); 1348 1349 } 1350 gdlr_core_sticky_sidebar.prototype = { 1351 1352 init: function(){ 1353 1354 var t = this; 1355 t.elem.each(function(){ 1356 $(this).find('.gdlr-core-pbf-sidebar-left, .gdlr-core-pbf-sidebar-right, .gdlr-core-sidebar-script').each(function(){ 1357 1358 var sidebar_item = $(this); 1359 var sidebar_wrap = sidebar_item.parent(); 1360 var sidebar_sub = $('<div></div>'); 1361 1362 var prev_scroll = 0; 1363 $(window).on('scroll resize', function(e){ 1364 1365 // sidebar larger than content 1366 if( sidebar_item.outerHeight() >= sidebar_wrap.outerHeight() ){ 1367 t.return_sidebar_pos(sidebar_sub, sidebar_item); 1368 return; 1369 } 1370 1371 // not in desktop 1372 if( gdlr_core_display != 'desktop' ){ 1373 t.return_sidebar_pos(sidebar_sub, sidebar_item); 1374 return; 1375 } 1376 1377 var scroll_pos = $(window).scrollTop(); 1378 var scroll_direction = (prev_scroll > scroll_pos)? 'up': 'down'; 1379 prev_scroll = scroll_pos; 1380 1381 // sidebar smaller than screen 1382 if( $(window).height() > sidebar_item.height() ){ 1383 1384 if( scroll_pos <= sidebar_wrap.offset().top ){ 1385 1386 if( sidebar_item.hasClass('gdlr-core-fixed-sidebar') || sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){ 1387 t.return_sidebar_pos(sidebar_sub, sidebar_item); 1388 } 1389 1390 }else{ 1391 1392 // overflow the content - stick to the bottom 1393 if( scroll_pos + sidebar_item.outerHeight() >= sidebar_wrap.offset().top + sidebar_wrap.outerHeight() ){ 1394 1395 if( !sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){ 1396 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1397 1398 sidebar_item.addClass('gdlr-core-fixed-bottom-sidebar').removeClass('gdlr-core-fixed-sidebar'); 1399 sidebar_item.css({ 1400 'position': 'absolute', 1401 'top': 'auto', 1402 'bottom': 0, 1403 'left': sidebar_sub.position().left, 1404 'width': sidebar_sub.outerWidth() 1405 }); 1406 } 1407 1408 // inside the content - fixed at the top 1409 }else{ 1410 1411 if( !sidebar_item.hasClass('gdlr-core-fixed-sidebar') ){ 1412 1413 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1414 1415 sidebar_item.addClass('gdlr-core-fixed-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar'); 1416 sidebar_item.css({ 1417 'position': 'fixed', 1418 'top': 0, 1419 'bottom': 'auto', 1420 'left': sidebar_sub.offset().left, 1421 'width': sidebar_sub.outerWidth() 1422 }); 1423 1424 } 1425 1426 } 1427 1428 if( e.type == 'resize' ){ 1429 1430 if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){ 1431 sidebar_item.css({ 1432 'width': sidebar_sub.outerWidth(), 1433 'left': sidebar_sub.position().left, 1434 });
1435 }else if( sidebar_item.hasClass('gdlr-core-fixed-sidebar') ){ 1436 sidebar_item.css({ 1437 'width': sidebar_sub.outerWidth(), 1438 'left': sidebar_sub.offset().left, 1439 }); 1440 } 1441 1442 } 1443 1444 } 1445 1446 // sidebar larger than screen 1447 }else{ 1448 1449 // to the top 1450 if( scroll_pos <= sidebar_wrap.offset().top ){ 1451 1452 if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-stick-bottom-sidebar') || 1453 sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') || sidebar_item.hasClass('gdlr-core-stick-top-sidebar') ){ 1454 t.return_sidebar_pos(sidebar_sub, sidebar_item); 1455 } 1456 1457 }else{ 1458 1459 // scroll direction down 1460 if( scroll_direction == 'down' ){ 1461 1462 if( sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') ){ 1463 1464 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1465 1466 sidebar_item.addClass('gdlr-core-stick-top-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-bottom-sidebar'); 1467 sidebar_item.css({ 1468 'position': 'absolute', 1469 'top': scroll_pos - sidebar_wrap.offset().top, 1470 'bottom': 'auto', 1471 'left': sidebar_sub.position().left, 1472 'width': sidebar_sub.outerWidth() 1473 }); 1474 1475 // stick at the bottom 1476 }else if( scroll_pos + $(window).height() >= sidebar_wrap.offset().top + sidebar_wrap.outerHeight() ){ 1477 1478 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1479 1480 sidebar_item.addClass('gdlr-core-stick-bottom-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-top-sidebar'); 1481 sidebar_item.css({ 1482 'position': 'absolute', 1483 'top': 'auto', 1484 'bottom': 0, 1485 'left': sidebar_sub.position().left, 1486 'width': sidebar_sub.outerWidth() 1487 }); 1488 1489 // fixed at the bottom 1490 }else if( scroll_pos + $(window).height() > sidebar_item.offset().top + sidebar_item.outerHeight() ){ 1491 1492 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1493 1494 sidebar_item.addClass('gdlr-core-fixed-bottom-sidebar').removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-stick-top-sidebar gdlr-core-fixed-top-sidebar'); 1495 sidebar_item.css({ 1496 'position': 'fixed', 1497 'top': 'auto', 1498 'bottom': '0', 1499 'left': sidebar_sub.offset().left, 1500 'width': sidebar_sub.outerWidth() 1501 }); 1502 } 1503 1504 // scroll direction up 1505 }else{ 1506 1507 if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){ 1508 1509 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1510 1511 sidebar_item.addClass('gdlr-core-stick-bottom-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-top-sidebar'); 1512 sidebar_item.css({ 1513 'position': 'absolute', 1514 'top': scroll_pos + $(window).height() - sidebar_item.outerHeight() - sidebar_wrap.offset().top, 1515 'bottom': 'auto', 1516 'left': sidebar_sub.position().left, 1517 'width': sidebar_sub.outerWidth() 1518 }); 1519 1520 }else{ 1521 1522 // stick at the top 1523 if( scroll_pos < sidebar_item.offset().top ){ 1524 1525 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1526 1527 sidebar_item.addClass('gdlr-core-fixed-top-sidebar').removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-stick-top-sidebar'); 1528 sidebar_item.css({ 1529 'position': 'fixed', 1530 'top': '0', 1531 'bottom': 'auto', 1532 'left': sidebar_sub.offset().left, 1533 'width': sidebar_sub.outerWidth() 1534 }); 1535 1536 } 1537 } 1538 1539 1540 1541 } 1542 1543 if( e.type == 'resize' ){ 1544 if( sidebar_item.hasClass('gdlr-core-stick-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-stick-top-sidebar') ){ 1545 sidebar_item.css({ 1546 'width': sidebar_sub.outerWidth(), 1547 'left': sidebar_sub.position().left, 1548 });
1549 }else if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') ){ 1550 sidebar_item.css({ 1551 'width': sidebar_sub.outerWidth(), 1552 'left': sidebar_sub.offset().left, 1553 }); 1554 } 1555 } 1556 1557 } 1558 } 1559 1560 }); // window scroll 1561 1562 }); 1563 }); 1564 1565 }, 1566 1567 set_sidebar_sub: function(sidebar_sub, sidebar_item){ 1568 1569 if(sidebar_item.hasClass('gdlr-core-sidebar-sub-added')) return; 1570 1571 // set the width 1572 var sidebar_class = ''; 1573 sidebar_item.each(function(){ 1574 var className = this.className.match(/gdlr-core-column-\d+/); 1575 if( className ){ 1576 sidebar_class = className[0]; 1577 } 1578 }); 1579 sidebar_sub.addClass(sidebar_class); 1580 1581 // set position 1582 sidebar_sub.css({ 1583 'float': sidebar_item.css('float'), 1584 'height': 20, 1585 'background': '#fd9' 1586 }); 1587 1588 sidebar_sub.insertAfter(sidebar_item); 1589 sidebar_item.addClass('gdlr-core-sidebar-sub-added'); 1590 }, 1591 1592 return_sidebar_pos: function(sidebar_sub, sidebar_item){ 1593 sidebar_item.css({'position': '', 'top': '', 'bottom': '', 'left': '', 'width': '', 'height': ''}); 1594 sidebar_item.removeClass('gdlr-core-fixed-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-sidebar-sub-added'); 1595 sidebar_item.removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar'); 1596 sidebar_sub.remove(); 1597 } 1598 1599 } 1600 1601 $.fn.gdlr_core_isotope = function( filter_elem ){ 1602 1603 if(typeof($.fn.isotope) == 'function'){ 1604 1605 if( typeof(filter_elem) == 'undefined' ){ 1606 var elem = $(this).find('[data-layout="masonry"]'); 1607 }else{ 1608 var elem = filter_elem.filter('[data-layout="masonry"]'); 1609 } 1610 1611 elem.each(function(){ 1612 1613 var t = $(this); 1614 var columnSize = t.width() / 60; 1615 1616 t.isotope({ 1617 itemSelector: '.gdlr-core-item-list', 1618 layoutMode: 'masonry', 1619 masonry:{ 1620 columnWidth: columnSize 1621 } 1622 }); 1623 t.isotope(); 1624 1625 t.children('.gdlr-core-item-list').gdlr_core_animate_list_item(); 1626 1627 // resize event 1628 $(window).on('resize gdlr-core-element-resize', function(){ 1629 1630 columnSize = t.width() / 60; 1631 1632 t.isotope({ 1633 masonry:{ 1634 columnWidth: columnSize 1635 } 1636 }); 1637 }); 1638 }); 1639 1640 } 1641 1642 return $(this); 1643 1644 } // gdlr-core-isotope 1645 $.fn.gdlr_core_animate_list_item = function(){ 1646 1647 var ux_items = $(this).get(); 1648 1649 // run the ux in order with delay 1650 var ux_interval = setInterval(function(){ 1651 1652 if( ux_items.length > 0 ){ 1653 // animate the ux item 1654 var ux_animate = $(ux_items.shift()); 1655 var animation_duration = '600ms'; 1656 1657 ux_animate.css({'animation-duration': animation_duration}); 1658 ux_animate.addClass('gdlr-core-animate'); 1659 1660 // remove selector 1661 setTimeout(function(){ 1662 ux_animate.css({'animation-duration': ''}) 1663 .addClass('gdlr-core-animate-end') 1664 .removeClass('gdlr-core-animate gdlr-core-animate-init'); 1665 }, parseInt(animation_duration)); 1666 1667 }else{ 1668 clearInterval(ux_interval); 1669 } 1670 }, 200); 1671 1672 } 1673 1674 $.fn.gdlr_core_lightbox = function( filter_elem ){ 1675 1676 // ilightbox 1677 if( typeof($.iLightBox) == 'function' ){ 1678 1679 if( typeof(filter_elem) == 'undefined' ){ 1680 var ilightbox = $(this).find('.gdlr-core-ilightbox'); 1681 }else{ 1682 var ilightbox = filter_elem.filter('.gdlr-core-ilightbox'); 1683 } 1684 1685 var ilightbox_atts = {}; 1686 var ilightbox_groups = []; 1687 1688 if( typeof(gdlr_core_pbf.ilightbox_skin) != 'undefined' ){ 1689 ilightbox_atts['skin'] = gdlr_core_pbf.ilightbox_skin; 1690 } 1691 1692 ilightbox.each(function(){ 1693 if( $(this).attr('data-ilightbox-group') ){ 1694 if( ilightbox_groups.indexOf($(this).attr('data-ilightbox-group')) == -1 ){ 1695 ilightbox_groups.push($(this).attr('data-ilightbox-group')); 1696 } 1697 }else{ 1698 $(this).iLightBox(ilightbox_atts); 1699 } 1700 }); 1701 1702 for( var key in ilightbox_groups ){ 1703 $(this).find('.gdlr-core-ilightbox[data-ilightbox-group="' + ilightbox_groups[key] + '"]').iLightBox(ilightbox_atts); 1704 } 1705 1706 }else if( typeof($.fn.lightGallery) == 'function' ){ 1707 1708 if( typeof(filter_elem) == 'undefined' ){ 1709 var lightgallery = $(this).find('.gdlr-core-lightgallery'); 1710 }else{ 1711 var lightgallery = filter_elem.filter('.gdlr-core-lightgallery'); 1712 } 1713 1714 var lightbox_groups = []; 1715 1716 lightgallery.each(function(){ 1717 if( $(this).attr('data-lightbox-group') ){ 1718 if( lightbox_groups.indexOf($(this).attr('data-lightbox-group')) == -1 ){ 1719 lightbox_groups.push($(this).attr('data-lightbox-group')); 1720 } 1721 }else{ 1722 $(this).lightGallery({ selector: 'this' });
1723 } 1724 }); 1725 1726 for( var key in lightbox_groups ){ 1727 var group_selector = '.gdlr-core-lightgallery[data-lightbox-group="' + lightbox_groups[key] + '"]'; 1728 1729 lightgallery.filter(group_selector).first().lightGallery({ 1730 selector: group_selector, 1731 selectWithin: 'body', 1732 thumbnail: false 1733 }); 1734 } 1735 1736 } 1737 1738 // lightbox gallery 1739 if( typeof(filter_elem) == 'undefined' ){ 1740 var gallery_lb = $(this).find('[data-gallery-lb]'); 1741 }else{ 1742 var gallery_lb = filter_elem.filter('[data-gallery-lb]'); 1743 } 1744 1745 gallery_lb.click(function(){ 1746 if( typeof($.iLightBox) != 'undefined' ){ 1747 $.iLightBox($(this).data('gallery-lb')); 1748 }else if(typeof(Strip) != 'undefined' ){ 1749 Strip.show($(this).data('gallery-lb')); 1750 }else if(typeof($.fn.lightGallery) == 'function'){ 1751 $(this).lightGallery({ 1752 dynamic: true, 1753 dynamicEl: $(this).data('gallery-lb'), 1754 thumbnail: false 1755 }); 1756 } 1757 1758 return false; 1759 }); 1760 1761 1762 // image overlay 1763 if( typeof(filter_elem) == 'undefined' ){ 1764 var center_overlay = $(this).find('.gdlr-core-image-overlay-center, .gdlr-core-image-overlay-center-icon'); 1765 }else{ 1766 var center_overlay = filter_elem.filter('.gdlr-core-image-overlay-center, .gdlr-core-image-overlay-center-icon'); 1767 } 1768 1769 center_overlay.each(function(){ 1770 1771 // for portfolio overlay content style 1772 if( $(this).hasClass('gdlr-core-image-overlay-center') ){ 1773 var overlay_content = $(this).children('.gdlr-core-image-overlay-content'); 1774 var wrap_height = $(this).outerHeight() - (2 * parseInt(overlay_content.css('bottom'))); 1775 1776 var overlay_icon = overlay_content.children('.gdlr-core-portfolio-icon-wrap'); 1777 var icon_margin = (wrap_height - (overlay_content.outerHeight() - parseInt(overlay_icon.css('margin-bottom')))) / 2; 1778 if( icon_margin > 20 ){ 1779 overlay_icon.css('margin-bottom', icon_margin); 1780 } 1781 1782 // normal centering 1783 }else{ 1784 var content_offset = 0; 1785 if( $(this).children('.gdlr-core-image-overlay-content-offset').length ){ 1786 content_offset = $(this).children('.gdlr-core-image-overlay-content-offset').outerHeight(true); 1787 } 1788 1789 $(this).children('.gdlr-core-image-overlay-content').each(function(){ 1790 $(this).css({ 'margin-top': -( ($(this).outerHeight() + content_offset) / 2 ) }); 1791 }); 1792 } 1793 1794 }); 1795 $(window).on('resize gdlr-core-element-resize', function(){ 1796 center_overlay.each(function(){ 1797 // for portfolio style 1798 if( $(this).hasClass('gdlr-core-image-overlay-center') ){ 1799 var overlay_content = $(this).children('.gdlr-core-image-overlay-content'); 1800 var wrap_height = $(this).outerHeight() - (2 * parseInt(overlay_content.css('bottom'))); 1801 1802 var overlay_icon = overlay_content.children('.gdlr-core-portfolio-icon-wrap'); 1803 var icon_margin = (wrap_height - (overlay_content.outerHeight() - parseInt(overlay_icon.css('margin-bottom')))) / 2; 1804 if( icon_margin > 20 ){ 1805 overlay_icon.css('margin-bottom', icon_margin); 1806 } 1807 1808 // normal centering 1809 }else{ 1810 var content_offset = 0; 1811 if( $(this).children('.gdlr-core-image-overlay-content-offset').length ){ 1812 content_offset = $(this).children('.gdlr-core-image-overlay-content-offset').outerHeight(true); 1813 } 1814 1815 $(this).children('.gdlr-core-image-overlay-content').each(function(){ 1816 $(this).css({ 'margin-top': -( ($(this).outerHeight() + content_offset) / 2 ) }); 1817 }); 1818 } 1819 }); 1820 }); 1821 1822 return $(this); 1823 } 1824 1825 $.fn.gdlr_core_set_image_height = function(){ 1826 1827 var all_image = $(this).find('img'); 1828 1829 all_image.each(function(){ 1830 var img_width = $(this).attr('width'); 1831 var img_height = $(this).attr('height'); 1832 1833 if( img_width && img_height ){ 1834 var parent_item = $(this).parent('.gdlr-core-temp-image-wrap'); 1835 1836 if( parent_item.length ){ 1837 parent_item.height((img_height * $(this).parent().width()) / img_width); 1838 }else{ 1839 parent_item = $('<div class="gdlr-core-temp-image-wrap" ></div>'); 1840 parent_item.css('height', ((img_height * $(this).closest('span, div').width()) / img_width)); 1841 $(this).wrap(parent_item); 1842 } 1843 }else{ 1844 return; 1845 } 1846 }); 1847 $(window).on('resize gdlr-core-element-resize', function(e){
1848 all_image.each(function(){ 1849 var parent_item = $(this).parent('.gdlr-core-temp-image-wrap'); 1850 1851 if( parent_item.length ){ 1852 $(this).unwrap(); 1853 } 1854 }); 1855 1856 $(window).unbind('resize', e.handleObj.handler, e); 1857 }); 1858 1859 return $(this); 1860 } // gdlr_core_set_image_height 1861 1862 // to set full height wrapper / column 1863 window.gdlr_core_set_full_height = function( container, filter_elem ){ 1864 if( typeof(filter_elem) == 'undefined' ){ 1865 this.elements = container.find('.gdlr-core-wrapper-full-height, .gdlr-core-column-full-height'); 1866 }else{ 1867 this.elements = filter_elem.filter('.gdlr-core-wrapper-full-height, .gdlr-core-column-full-height'); 1868 } 1869 1870 if( this.elements.length ){ 1871 this.init(); 1872 } 1873 } 1874 gdlr_core_set_full_height.prototype = { 1875 1876 init: function(){ 1877 1878 var t = this; 1879 1880 t.resize(); 1881 $(window).on('load resize gdlr-core-element-resize', function(){ t.resize(); }); 1882 }, 1883 1884 resize: function(){ 1885 1886 this.elements.each(function(){ 1887 var offset = $(this).attr('data-decrease-height')? parseInt($(this).attr('data-decrease-height')): 0; 1888 1889 $(this).css('min-height', $(window).height() - offset); 1890 1891 if( $(this).hasClass('gdlr-core-full-height-center') ){ 1892 $(this).children('.gdlr-core-full-height-pre-spaces').remove(); 1893 1894 var pre_space = ($(this).height() - $(this).children('.gdlr-core-full-height-content').outerHeight(true)) / 2; 1895 if( pre_space > 0 ){ 1896 $(this).prepend($('<div class="gdlr-core-full-height-pre-spaces" ></div>').height(pre_space)); 1897 } 1898 } 1899 }); 1900 1901 } 1902 }; 1903 1904 // sync height among items 1905 window.gdlr_core_sync_height = function( container, filter_elem ){ 1906 1907 // for half height item 1908 this.set_half_height(container); 1909 1910 // sync height 1911 if( typeof(window.gdlr_core_sync_height_elem) != 'undefined' ){ 1912 window.gdlr_core_sync_height_elem.reinit(); 1913 return; 1914 } 1915 window.gdlr_core_sync_height_elem = this; 1916 1917 if( typeof(filter_elem) == 'undefined' ){ 1918 this.elements = container.find('[data-sync-height]'); 1919 }else{ 1920 this.elements = filter_elem.filter('[data-sync-height]'); 1921 } 1922 1923 this.elements_group = []; 1924 this.container = container; 1925 this.init(); 1926 } 1927 gdlr_core_sync_height.prototype = { 1928 1929 init: function(){ 1930 1931 var t = this; 1932 t.group_elements(); 1933 t.set_height(); 1934 1935 $(window).on('load resize gdlr-core-element-resize', function(){ t.set_height(); }); 1936 }, 1937 1938 reinit: function(){ 1939 1940 if( !this.container.is('.gdlr-core-page-builder-body') ){ 1941 this.container = this.container.closest('.gdlr-core-page-builder-body'); 1942 } 1943 1944 this.elements = this.container.find('[data-sync-height]'); 1945 this.group_elements(); 1946 this.set_height(); 1947 1948 }, 1949 1950 group_elements: function(){ 1951 1952 var t = this; 1953 1954 // do flipbox first 1955 t.elements.filter('.gdlr-core-flipbox-front, .gdlr-core-feature-box').each(function(){ 1956 if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){ 1957 t.elements_group.push($(this).attr('data-sync-height')); 1958 } 1959 }); 1960 1961 // do the rest elements 1962 t.elements.each(function(){ 1963 if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){ 1964 t.elements_group.push($(this).attr('data-sync-height')); 1965 } 1966 }); 1967 }, 1968 1969 set_height: function(){ 1970 1971 var t = this; 1972 1973 // revert to default value 1974 t.elements.css('height', 'auto').children('.gdlr-core-sync-height-pre-spaces').remove(); 1975 t.elements.find('.gdlr-core-sync-height-offset').remove(); 1976 1977 var sync_element = t.elements; 1978 if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){ 1979 sync_element = sync_element.filter('.gdlr-core-flipbox-front, .gdlr-core-flipbox-back'); 1980 } 1981 1982 // setting the height by each group 1983 for( var key in t.elements_group ){ 1984 var max_height = 0; 1985 1986 // determine max height 1987 sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){ 1988 if( $(this).outerHeight() > max_height ){ 1989 max_height = $(this).outerHeight(); 1990 } 1991 }); 1992 1993 // set the height 1994 sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){ 1995 1996 // set the offset space to the bottom 1997 var offset = parseInt(max_height - $(this).outerHeight()); 1998 var offset_item = $(this).find('[data-sync-height-offset]'); 1999 if( offset_item.length && offset > 0 ){ 2000 $('<div class="gdlr-core-sync-height-offset" ></div>').css('height', offset).insertBefore(offset_item); 2001 } 2002 2003 $(this).css('height', max_height); 2004 2005 // flipbox 2006 if( $(this).hasClass('gdlr-core-flipbox-front') ){ 2007 $(this).parent().css('height', max_height); 2008 } 2009 2010 // center the content if selected 2011 if( $(this).is('[data-sync-height-center]') ){ 2012 var content = $(this).children('.gdlr-core-sync-height-content'); 2013 2014 // determine top padding for centering content 2015 var padding_top = max_height; 2016 if( content.length > 0 ){ 2017 padding_top -= content.outerHeight(); 2018 }else{ 2019 $(this).children().each(function(){ 2020 padding_top -= $(this).outerHeight(); 2021 });
2022 } 2023 padding_top = padding_top / 2; 2024 padding_top = padding_top - (parseInt($(this).css('padding-top')) + parseInt($(this).css('border-top-width'))); 2025 2026 // insert the spaces 2027 if( padding_top > 0 ){ 2028 var spaces_item = $('<div class="gdlr-core-sync-height-pre-spaces" ></div>').css('padding-top', padding_top); 2029 var space_position = $(this).children('.gdlr-core-sync-height-space-position'); 2030 if( space_position.length > 0 ){ 2031 spaces_item.insertBefore(space_position); 2032 }else{ 2033 $(this).prepend(spaces_item); 2034 } 2035 } 2036 } 2037 2038 }); 2039 } 2040 2041 }, 2042 2043 set_half_height: function( container ){ 2044 2045 container.find('.gdlr-core-half-height').each(function(){ 2046 var temp = $(this); 2047 if( !gdlr_core_mobile && (gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop') ){ 2048 var temp_height = temp.outerHeight(); 2049 temp.gdlr_core_set_image_height(); 2050 temp.css('height', temp_height / 2); 2051 temp.find('img').css('margin-top', -temp_height/4); 2052 } 2053 $(window).on('load resize', function(){ 2054 temp.css('height', 'auto'); 2055 temp.find('img').css('margin-top', '0'); 2056 if( !gdlr_core_mobile && (gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop') ){ 2057 temp_height = temp.outerHeight(); 2058 temp.gdlr_core_set_image_height(); 2059 temp.css('height', temp_height / 2); 2060 temp.find('img').css('margin-top', -temp_height/4); 2061 } 2062 }); 2063 }); 2064 2065 } 2066 2067 }; // gdlr_core_sync_height.prototype 2068 2069 function gdlr_core_ajax_action(ajax_section, name, value){ 2070 2071 var now_loading = $('<div class="gdlr-core-now-loading" ></div>').hide(); 2072 2073 $.ajax({ 2074 type: 'POST', 2075 url: gdlr_core_pbf.ajax_url, 2076 data: { 2077 'action': ajax_section.attr('data-ajax'), 2078 'settings': ajax_section.data('settings'),
2079 'option': { 'name':name, 'value':value } 2080 }, 2081 dataType: 'json', 2082 beforeSend: function(jqXHR, settings){ 2083 // before send action 2084 if( ajax_section.attr('data-target-action') == 'replace' ){ 2085 ajax_section.siblings('.' + ajax_section.attr('data-target')).animate({opacity: 0}, 150); 2086 } 2087 2088 // for portfolio item 2089 if( ajax_section.attr('data-target') == 'gdlr-core-portfolio-item-holder' && 2090 ajax_section.attr('data-target-action') == 'replace' ){ 2091 2092 now_loading.insertBefore( ajax_section.siblings('.gdlr-core-portfolio-item-holder') ); 2093 now_loading.fadeIn(200); 2094 } 2095 }, 2096 error: function(jqXHR, textStatus, errorThrown){ 2097 ajax_section.removeClass('gdlr-core-disable'); 2098 2099 console.log(jqXHR, textStatus, errorThrown); 2100 }, 2101 success: function(data){ 2102 ajax_section.removeClass('gdlr-core-disable'); 2103 2104 if( data.status == 'success' ){ 2105 if( data.content && ajax_section.attr('data-target') ){ 2106 if( ajax_section.attr('data-target-action') == 'append' ){ 2107 var content = $(data.content); 2108 ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){ 2109 2110 if( $(this).attr('data-layout') != 'masonry' || typeof($.fn.isotope) != 'function' ){ 2111 content.addClass('gdlr-core-animate-init'); 2112 } 2113 $(this).append(content); 2114 2115 content.gdlr_core_lightbox().gdlr_core_flexslider().gdlr_core_content_script().gdlr_core_set_image_height(); 2116 new gdlr_core_sync_height(content); 2117 2118 if( $(this).attr('data-layout') == 'masonry' && typeof($.fn.isotope) == 'function' ){ 2119 var addItems = $(this).isotope('addItems', content); 2120 $(this).isotope('layoutItems', addItems, true); 2121 } 2122 2123 content.gdlr_core_animate_list_item(); 2124 }); 2125 2126 if( data.load_more ){ 2127 if( data.load_more != 'none' ){ 2128 var load_more = $(data.load_more); 2129 ajax_section.parent().append(load_more); 2130 load_more.gdlr_core_ajax(load_more); 2131 load_more.css('display', 'none').slideDown(100); 2132 2133 ajax_section.remove(); 2134 }else{ 2135 ajax_section.slideUp(100, function(){ $(this).remove(); }); 2136 } 2137 } 2138 2139 }else if( ajax_section.attr('data-target-action') == 'replace' ){ 2140 var content = $(data.content); 2141 ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){ 2142 var fix_height = false; 2143 var current_height = $(this).height(); 2144 2145 if( $(this).attr('data-layout') != 'masonry' || typeof($.fn.isotope) != 'function' ){ 2146 content.addClass('gdlr-core-animate-init'); 2147 } 2148 $(this).empty().append(content); 2149 2150 content.gdlr_core_lightbox().gdlr_core_flexslider().gdlr_core_fluid_video().gdlr_core_set_image_height(); 2151 new gdlr_core_sync_height(content); 2152 2153 if( $(this).attr('data-layout') == 'masonry' && typeof($.fn.isotope) == 'function' ){ 2154 $(this).isotope('destroy'); 2155 $(this).parent().gdlr_core_isotope(); 2156 fix_height = true; 2157 }else{ 2158 content.gdlr_core_animate_list_item(); 2159 } 2160 2161 var new_height = $(this).height(); 2162 $(this).css({height:current_height, opacity:1}).animate({'height':new_height}, {'duration':400, 'easing':'easeOutExpo', 'complete': function(){ 2163 if( !fix_height ){ $(this).css('height',''); } 2164 }}); 2165 }); 2166 2167 // pagination 2168 if( data.pagination ){
2169 ajax_section.siblings('.gdlr-core-pagination').slideUp(100, function(){ $(this).remove(); }); 2170 2171 if( data.pagination != 'none' ){ 2172 var pagination = $(data.pagination); 2173 ajax_section.parent().append(pagination); 2174 pagination.gdlr_core_ajax(pagination); 2175 pagination.css('display', 'none').slideDown(100); 2176 } 2177 } 2178 2179 // load more button 2180 if( data.load_more ){ 2181 ajax_section.siblings('.gdlr-core-load-more-wrap').slideUp(100, function(){ $(this).remove(); }); 2182 2183 if( data.load_more != 'none' ){ 2184 var load_more = $(data.load_more); 2185 ajax_section.parent().append(load_more); 2186 load_more.gdlr_core_ajax(load_more); 2187 load_more.css('display', 'none').slideDown(100); 2188 } 2189 } 2190 2191 } 2192 } 2193 2194 if( typeof(data.settings) != 'undefined' ){ 2195 ajax_section.data('settings', data.settings); 2196 } 2197 2198 now_loading.fadeOut(200, function(){ $(this).remove(); }); 2199 } 2200 } 2201 }); 2202 2203 } // gdlr_core_ajax_action 2204 $.fn.gdlr_core_ajax = function( filter_elem ){ 2205 2206 if( typeof(filter_elem) == 'undefined' ){ 2207 var elem = $(this).find('[data-ajax]'); 2208 }else{ 2209 var elem = filter_elem.filter('[data-ajax]'); 2210 } 2211 2212 elem.each(function(){ 2213 2214 var ajax_section = $(this); 2215 2216 // button click 2217 $(this).on('click', 'a', function(){ 2218 if( $(this).hasClass('gdlr-core-active') || ajax_section.hasClass('gdlr-core-disable') ){ 2219 return false; 2220 } 2221 2222 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 2223 ajax_section.addClass('gdlr-core-disable'); 2224 2225 var name = $(this).attr('data-ajax-name'); 2226 var value = $(this).attr('data-ajax-value'); 2227 2228 gdlr_core_ajax_action(ajax_section, name, value); 2229 2230 return false; 2231 }); 2232 2233 // filter changed 2234 $(this).on('change', 'select', function(){ 2235 var name = $(this).attr('data-ajax-name'); 2236 var value = $(this).val(); 2237 2238 gdlr_core_ajax_action(ajax_section, name, value); 2239 }); 2240 2241 }); 2242 2243 } // gdlr_core_ajax 2244 $.fn.gdlr_core_ajax_slide_bar = function( filter_elem ){ 2245 if( typeof(filter_elem) == 'undefined' ){ 2246 var elem = $(this).find('[data-ajax]'); 2247 }else{ 2248 var elem = filter_elem.filter('[data-ajax]'); 2249 } 2250 2251 elem.each(function(){ 2252 2253 var ajax_section = $(this); 2254 2255 // filter slide bar 2256 $(this).children('.gdlr-core-filterer-slide-bar').each(function(){ 2257 var slide_bar = $(this); 2258 var active_slide = slide_bar.siblings('.gdlr-core-active'); 2259 slide_bar.css({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) }); 2260 2261 $(window).on('load resize', function(){ 2262 active_slide = slide_bar.siblings('.gdlr-core-active'); 2263 slide_bar.css({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) }); 2264 }); 2265 2266 ajax_section.find('a').hover(function(){ 2267 slide_bar.animate({'width': $(this).outerWidth(), 'left': $(this).position().left + parseInt($(this).css('margin-left')) }, {queue: false, duration: 200}); 2268 }, function(){ 2269 active_slide = slide_bar.siblings('.gdlr-core-active'); 2270 slide_bar.animate({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) }, {queue: false, duration: 200}); 2271 }); 2272 }); 2273 2274 }); 2275 } 2276 2277 $.fn.gdlr_core_dropdown_tab = function( filter_elem ){ 2278 2279 if( typeof(filter_elem) == 'undefined' ){ 2280 var elem = $(this).find('.gdlr-core-dropdown-tab'); 2281 }else{ 2282 var elem = filter_elem.filter('.gdlr-core-dropdown-tab'); 2283 } 2284 2285 elem.each(function(){ 2286 var tab_title = $(this).children('.gdlr-core-dropdown-tab-title'); 2287 var tab_title_text = tab_title.children('.gdlr-core-head'); 2288 var tab_dropdown = tab_title.children('.gdlr-core-dropdown-tab-head-wrap'); 2289 var tab_content = $(this).children('.gdlr-core-dropdown-tab-content-wrap'); 2290 2291 // dropdown 2292 tab_title.click(function(){ 2293 if( $(this).hasClass('gdlr-core-active') ){ 2294 $(this).removeClass('gdlr-core-active'); 2295 tab_dropdown.hide(); 2296 }else{ 2297 $(this).addClass('gdlr-core-active'); 2298 tab_dropdown.slideDown(200); 2299 } 2300 }); 2301 tab_dropdown.children().click(function(){ 2302 tab_title_text.html($(this).html()); 2303 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 2304 2305 var content_active = tab_content.children('[data-index="' + $(this).attr('data-index') + '"]'); 2306 content_active.fadeIn(200).addClass('gdlr-core-active'); 2307 content_active.siblings().hide().removeClass('gdlr-core-active'); 2308 }); 2309 2310 }); 2311 2312 } // gdlr_core_dropdown_tab 2313 2314 if( !gdlr_core_pbf.admin ){
2315 2316 $(document).ready(function(){ 2317 2318 $('body').each(function(){ 2319 2320 // turns image link to open in lightbox 2321 if( $(this).hasClass('gdlr-core-link-to-lightbox') ){ 2322 var image_link = $(this).find('a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"]') 2323 .not('.gdlr-core-ilightbox, .strip, [data-rel], .gdlr-core-lightgallery, .gdlr-core-social-share-pinterest') 2324 .addClass('strip gdlr-core-ilightbox gdlr-core-lightgallery').each(function(){ 2325 2326 if( $(this).closest('.gallery').length ){ 2327 var gallery_wrap = $(this).closest('.gallery'); 2328 if( gallery_wrap.attr('data-gallery-id') ){ 2329 var gallery_id = gallery_wrap.attr('data-gallery-id'); 2330 }else{ 2331 var gallery_id = Math.floor((Math.random() * 10000) + 1); 2332 gallery_wrap.attr('data-gallery-id', gallery_id); 2333 } 2334 2335 $(this).attr('data-ilightbox-group', 'wp-gallery-' + gallery_id); 2336 $(this).attr('data-lightbox-group', 'wp-gallery-' + gallery_id); 2337 $(this).attr('data-strip-group', 'wp-gallery-' + gallery_id); 2338 2339 } 2340 }); 2341 $(this).gdlr_core_lightbox( image_link ); 2342 } 2343 2344 var gdlr_core_js = $(this).find('.gdlr-core-js, iframe[src*="youtube"], iframe[src*="vimeo"]'); 2345 2346 // video resizing 2347 $(this).gdlr_core_content_script( gdlr_core_js, true ); 2348 2349 // counter item 2350 $(this).gdlr_core_counter_item( gdlr_core_js ); 2351 2352 // type animation item 2353 $(this).gdlr_core_typed_animation( gdlr_core_js ); 2354 2355 // countdown item 2356 $(this).gdlr_core_countdown_item( gdlr_core_js ); 2357 2358 // alert box item 2359 $(this).gdlr_core_alert_box_item( gdlr_core_js ); 2360 2361 // accordion item 2362 $(this).gdlr_core_accordion( gdlr_core_js ); 2363 2364 // toggle box item 2365 $(this).gdlr_core_toggle_box( gdlr_core_js ); 2366 2367 // divider 2368 $(this).gdlr_core_divider( gdlr_core_js ); 2369 2370 // flipbox 2371 $(this).gdlr_core_flipbox( gdlr_core_js ); 2372 2373 // marquee 2374 $(this).gdlr_core_marquee( gdlr_core_js ); 2375 2376 // chart.js 2377 $(this).gdlr_core_chart_js( gdlr_core_js ); 2378 2379 // skill circle 2380 $(this).gdlr_core_skill_circle( gdlr_core_js ); 2381 2382 // skill bar 2383 $(this).gdlr_core_skill_bar( gdlr_core_js ); 2384 2385 // tab 2386 $(this).gdlr_core_tab( gdlr_core_js ); 2387 2388 // dropdown tab 2389 $(this).gdlr_core_dropdown_tab( gdlr_core_js ); 2390 2391 // lightbox 2392 $(this).gdlr_core_lightbox( gdlr_core_js ); 2393 2394 // ajax action 2395 $(this).gdlr_core_ajax( gdlr_core_js ); 2396 $(this).gdlr_core_ajax_slide_bar( gdlr_core_js ); 2397 2398 // ux animation 2399 // $(this).gdlr_core_ux( gdlr_core_js ); 2400 new gdlr_core_ux( $(this), gdlr_core_js ); 2401 2402 // sync height 2403 new gdlr_core_sync_height( $(this), gdlr_core_js ); 2404 2405 // set height 2406 new gdlr_core_set_full_height( $(this), gdlr_core_js ); 2407 2408 // sidebar wrapper height 2409 new gdlr_core_sidebar_wrapper( $(this), gdlr_core_js ); 2410 2411 // background parallax 2412 $(this).gdlr_core_parallax_background( gdlr_core_js ); 2413 2414 // particle 2415 $(this).gdlr_core_particle_background( gdlr_core_js ); 2416 2417 // privacy box cookie 2418 gdlr_core_js.filter('.gdlr-core-privacy-box-button').on('click', function(){ 2419 var privacy_box_wrap = $(this).closest('.gdlr-core-privacy-box-wrap'); 2420 if( privacy_box_wrap.is('.gdlr-core-pos-bottom-bar, .gdlr-core-pos-top-bar') ){ 2421 privacy_box_wrap.slideUp(200); 2422 }else{ 2423 privacy_box_wrap.fadeOut(250); 2424 } 2425 2426 var cookie_time = $(this).attr('data-cookie-time')? $(this).attr('data-cookie-time'): 2592000; 2427 console.log(cookie_time) 2428 gdlr_core_set_cookie('gdlr-core-privacy-box', 1, cookie_time); 2429 2430 return false; 2431 }); 2432 2433 // gdlr lightbox 2434 gdlr_core_js.filter('[data-gdlr-lb]').each(function(){ 2435 var lb_wrap = $('#' + $(this).data('gdlr-lb')); 2436 if( lb_wrap.length ){ 2437 2438 // open lightbox action 2439 $(this).on('click', function(){ 2440 lb_wrap.fadeIn(200); 2441 return false; 2442 }); 2443 2444 // bind the lightbox close action 2445 lb_wrap.find('.gdlr-core-lightbox-form-close').on('click', function(){ 2446 $(this).closest('.gdlr-core-lightbox-wrapper').fadeOut(); 2447 return false; 2448 });
2449 } 2450 }); 2451 2452 // gdpr form 2453 gdlr_core_js.filter('#gdlr-core-gdpr-form').each(function(){ 2454 2455 // change tab 2456 $(this).on('click', '.gdlr-core-gdlr-form-nav li', function(){ 2457 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 2458 2459 var nav_id = $(this).data('gdlr-nav'); 2460 var content_wrap = $(this).closest('.gdlr-core-gdpr-form-left').siblings('.gdlr-core-gdpr-form-right'); 2461 content_wrap.find('[data-gdlr-nav="' + nav_id + '"]').each(function(){ 2462 $(this).siblings('[data-gdlr-nav]').removeClass('gdlr-core-active').css('display', 'none'); 2463 $(this).fadeIn(200, function(){ $(this).addClass('gdlr-core-active'); }); 2464 }); 2465 }); 2466 }); 2467 2468 // sticky sidebar 2469 new gdlr_core_sticky_sidebar(gdlr_core_js); 2470 }); 2471 2472 }); // document.ready 2473 2474 $(window).load(function(){ 2475 2476 $('body').each(function(){ 2477 2478 var gdlr_core_js = $(this).find('.gdlr-core-js-2'); 2479 2480 // title divider 2481 $(this).gdlr_core_title_divider( gdlr_core_js ); 2482 2483 // flexslider 2484 $(this).gdlr_core_flexslider( gdlr_core_js ); 2485 2486 // sly slider 2487 $(this).gdlr_core_sly( gdlr_core_js ); 2488 2489 // isotope 2490 $(this).gdlr_core_isotope( gdlr_core_js ); 2491 2492 }); 2493 2494 }); // window.load 2495 2496 } 2497 2498})(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.