1(function ($) { 2 "use strict"; 3 var infiniteClickFlag = true; 4 window.pbthemeHorisontalTabsFlag = []; 5 var $root = $('html, body'); 6 var stickyFlag = false; 7 var headHeig; 8 var winScr = 0; 9 var marginTop = 0; 10 var menuWrap = 0; 11 var adminbar = 0; 12 var fullHeadHeig = 0; 13 var navActive = false; 14 var divTouchOptimizedStart; 15 var GridSliderStorage = []; 16 var GridResponsiveStorage = []; 17 var gridSliderResizeTimer; 18 var divSliderPosiitonMark, divSliderPosiitonMarkNew; 19 var numberOfSlides = []; 20 var numberOfSlidesFormated = []; 21 var resizeTimer; 22 var swipeboxInstance; 23 var entranceId = [], $divPortItem; 24 var woocart_timer; 25 26 var pointerEventToXY = function (e) { 27 var out = {x: 0, y: 0}; 28 if (e.type == 'touchstart' || e.type == 'touchmove' || e.type == 'touchend' || e.type == 'touchcancel') { 29 var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 30 out.x = touch.pageX; 31 out.y = touch.pageY; 32 } else if (e.type == 'mousedown' || e.type == 'mouseup' || e.type == 'mousemove' || e.type == 'mouseover' || e.type == 'mouseout' || e.type == 'mouseenter' || e.type == 'mouseleave') { 33 out.x = e.pageX; 34 out.y = e.pageY; 35 } else if (e.type == 'MSPointerDown' || e.type == 'MSPointerMove' || e.type == 'MSPointerUp') { 36 var touch = e.originalEvent; 37 out.x = touch.pageX; 38 out.y = touch.pageY; 39 } 40 return out; 41 }; 42 43 44 function directionCalc($el, coordinates, mod) { 45 var offset = $el.offset(); 46 if (mod) { 47 var refOffset = $('.div_portfolio_slider .pbtheme_hover.current-in').offset(), 48 left = refOffset.left - offset.left, 49 top = refOffset.top - offset.top, 50 vert = (Math.abs(top) >= Math.abs(left)) ? true : false; 51 output = vert ? ((top >= 0) ? 'bottom' : 'top') : ((left >= 0) ? 'right' : 'left'); 52 } else { 53 var w = $el.outerWidth(), 54 h = $el.outerHeight(), 55 x = (coordinates.x - offset.left - (w / 2)) * (w > h ? (h / w) : 1), 56 y = (coordinates.y - offset.top - (h / 2)) * (h > w ? (w / h) : 1), 57 direction = Math.round((((Math.atan2(y, x) * (180 / Math.PI)) + 180) / 90) + 3) % 4, 58 output; 59 switch (direction) { 60 case 0: 61 output = 'top'; 62 break; 63 case 1: 64 output = 'right'; 65 break; 66 case 2: 67 output = 'bottom'; 68 break; 69 case 3: 70 output = 'left'; 71 break; 72 } 73 ; 74 } 75 return output; 76 } 77 78 function divPortFlipDefaulting($el, direction) { 79 var origin, rot; 80 if (direction == 'left') { 81 rot = 'rotate3d(1,0,0,110deg)'; 82 origin = '0% 0% 0'; 83 } 84 if (direction == 'top') { 85 rot = 'rotate3d(-1,0,0,110deg)'; 86 origin = ' 0% 0% 0'; 87 } 88 if (direction == 'right') { 89 rot = 'rotate3d(0,-1,0,110deg)'; 90 origin = ' 100% 0% 0'; 91 } 92 if (direction == 'bottom') { 93 rot = 'rotate3d(0,1,0,110deg)'; 94 origin = ' 0% 100% 0'; 95 } 96 $el.find('.pbtheme_hover_over').css({'transform': rot, '-ms-transform': rot, '-webkit-transform': rot}); 97 } 98 pbtheme_navigation(); 99 100 101 $(document).ready(function () { 102 103 $(document).on('mouseleave', '.div_portfolio_slider .div_portfolio_slides', function (e) { 104 var divPortModExit = directionCalc($(this), pointerEventToXY(e), false); 105 $(this).find('.pbtheme_hover.current-in').removeClass('in-left in-right in-bottom in-top').addClass('out-' + divPortModExit).removeClass('current-in'); 106 }); 107 108 if (window.navigator.userAgent.indexOf('MSIE') >= 0 || window.navigator.userAgent.indexOf('Opera') >= 0) { 109 $('.div_portfolio_slider').addClass('fallback'); 110 } 111 $(document).on('mouseenter', '.div_portfolio_slider .pbtheme_hover', function (e) { 112 var $this = $(this); 113 if (window.navigator.userAgent.indexOf('MSIE') >= 0 || window.navigator.userAgent.indexOf('Opera') >= 0) { 114 $this.find('.pbtheme_hover_over').stop(true).animate({opacity: 1}, 300); 115 } else { 116 entranceId[$this.index()] = directionCalc($this, pointerEventToXY(e), $this.hasClass('current-in')); 117 divPortFlipDefaulting($this, entranceId[$this.index()]);
118 var inverse = entranceId[$this.index()] != 'top' ? (entranceId[$this.index()] != 'left' ? (entranceId[$this.index()] != 'right' ? 'top' : 'left') : 'right') : 'bottom'; 119 $('.div_portfolio_slider .pbtheme_hover.current-in').removeClass('in-left in-right in-bottom in-top').addClass('out-' + inverse).removeClass('current-in'); 120 $this.removeClass('out-left out-right out-bottom out-top'); 121 $this.addClass('current-in in-' + entranceId[$this.index()]); 122 } 123 }); 124 125 126 $(document).on('mouseleave', '.div_portfolio_slider .pbtheme_hover', function () { 127 var $this = $(this); 128 if (window.navigator.userAgent.indexOf('MSIE') >= 0 || window.navigator.userAgent.indexOf('Opera') >= 0) { 129 $this.find('.pbtheme_hover_over').stop(true).animate({opacity: 0}, 300); 130 } 131 }); 132 133 if (pbtheme.page_bg == "bgimage" || pbtheme.is_mobile_tablet == "yes") { 134 var theWindow = $(window), 135 $bg = $("#bg"), 136 aspectRatio = $bg.width() / $bg.height(); 137 138 theWindow.resize(function () { 139 if ((theWindow.width() / theWindow.height()) < aspectRatio) 140 $bg.removeClass().addClass('bgheight'); 141 else 142 $bg.removeClass().addClass('bgwidth'); 143 }).trigger("resize"); 144 } else if (pbtheme.page_bg == "videoembed") { 145 var atts = { 146 mute: (pbtheme.video_mute == 1 ? true : false), 147 loop: (pbtheme.video_loop == 1 ? true : false), 148 hd: (pbtheme.video_hd == 1 ? true : false) 149 }; 150 pbuilderYoutube("pbtheme_page_bg_inner", pbtheme.video_bg, atts); 151 } 152 153 154 $("a[rel^='prettyPhoto']").attr('rel', 'lightbox'); 155 156 $('.blog_content iframe').each(function () { 157 var url = $(this).attr("src"); 158 $(this).attr("src", url + "?wmode=transparent"); 159 }); 160 161 /* Shopping cart */ 162 163 $(document).on('mouseenter', '.element-woo-cart', function () { 164 if (!$(this).hasClass('hovered')) { 165 $(this).addClass('hovered'); 166 $('#div_woocart').stop(true, true).slideDown(100); 167 } 168 else { 169 window.clearTimeout(woocart_timer); 170 } 171 return false; 172 }); 173 174 $(document).on('mouseleave', '.element-woo-cart', function () { 175 if ($(this).hasClass('hovered')) { 176 woocart_timer = setTimeout(function () { 177 $('.element-woo-cart').removeClass('hovered'); 178 $('#div_woocart').stop(true, true).fadeOut(100); 179 }, 300); 180 } 181 return false; 182 }); 183 184 winScr = window.scrollY; 185 if ($('#wpadminbar').length > 0) { 186 adminbar = $('#wpadminbar').outerHeight(); 187 } 188 headHeig = $('.header_wrapper').outerHeight(); 189 menuWrap = $('nav.menu_wrapper').outerHeight(); 190 fullHeadHeig = $('.header_wrapper').height() + adminbar; 191 pbthemeHeader(); 192// swipebox 193 swipeboxInstance = $('a[rel="lightbox"]').addClass('swipebox').swipebox(); 194 195 }); 196 197 198 $(window).scroll(function () { 199 winScr = (window.scrollY || window.pageYOffset); 200 201 /*if ($(window).width() < pbtheme.go_responsive) { 202 if ($('.header_wrapper').hasClass('sticky-header')) { 203 $('.header_wrapper').css('padding-top', 0).removeClass('sticky-header'); 204 } 205 return; 206 }*/ 207 208 if (winScr > 2) { 209 stickyFlag = true; 210 if ($('#widgets-trigger a').hasClass('widgets-open') == true) { 211 $('.header_wrapper .pbtheme_top:not(.element-to-be-hidden)').css('display', 'block'); 212 } 213 else { 214 $('.header_wrapper .pbtheme_top').removeAttr('style'); 215 } 216 } 217 else if (winScr > fullHeadHeig) { 218 stickyFlag = true; 219 if ($('#widgets-trigger a').hasClass('widgets-open') == true) {
220 $('.header_wrapper .pbtheme_top:not(.element-to-be-hidden)').css('display', 'block'); 221 } 222 else { 223 $('.header_wrapper .pbtheme_top').removeAttr('style'); 224 } 225 } 226 else { 227 stickyFlag = false; 228 } 229 pbthemeHeader(); 230 231 }); 232 233 function pbthemeHeader() { 234 235 if (stickyFlag === true) { 236 if (!$('.header_wrapper').hasClass('sticky-header')) { 237 $('.header_wrapper').addClass('div_notransition'); 238 239 $('.header_wrapper').css({top: -menuWrap}).addClass('sticky-header'); 240 241 $('.header_wrapper .header_alt_nav, .header_wrapper .header_main_nav').children('div').each(function () { 242 if ($(this).is(':visible')) { 243 $(this).addClass('element-to-be-hidden'); 244 } 245 }); 246 247 $('#pbtheme_wrapper').css({paddingTop: headHeig}); 248 pbthemeAnimate(); 249 setTimeout(function () { 250 $('.header_wrapper').removeClass('div_notransition'); 251 }, 300); 252 } 253 } 254 else { 255 if ($('.header_wrapper').hasClass('sticky-header')) { 256 $('.header_wrapper').addClass('div_notransition'); 257 258 $('#pbtheme_wrapper').css({paddingTop: 0}); 259 260 $('.header_wrapper').children('div').each(function () { 261 if ($(this).is(':hidden')) { 262 $(this).removeClass('element-to-be-hidden'); 263 } 264 }); 265 266 $('.header_wrapper').removeClass('sticky-header').css({top: 0}); 267 setTimeout(function () { 268 $('.header_wrapper').removeClass('div_notransition'); 269 }, 300); 270 } 271 } 272 } 273 274 function pbthemeAnimate() { 275 if ($('.header_wrapper').hasClass('sticky-header')) { 276 $('.header_wrapper').stop(true).animate({top: adminbar}, 300); 277 } 278 } 279 280 $(document).on('click', '#search-trigger a', function () { 281 var $this = $(this); 282 if ($(this).hasClass('search-open')) { 283 $('.pbtheme_search').stop(true, true).fadeOut(200); 284 $this.removeClass('search-open'); 285 } 286 else { 287 var searchPos = $this.position().left + $this.outerWidth() / 2 - 204; 288 $this.addClass('search-open'); 289 $('.pbtheme_search').css({left: searchPos}).stop(true, true).fadeIn(200); 290 $('#div_header_menu .pbtheme_search input[name="s"]').focus(); 291 } 292 return false; 293 }); 294 295 296 $(document).on('click', '#widgets-trigger a, #topmenu-trigger, #div_rwidgetized', function (e) { 297 e.preventDefault(); 298 var $this = $(this); 299 if ($(this).hasClass('widgets-open')) { 300 $('.pbtheme_header_widgets').stop(true, true).slideUp(300); 301 if (stickyFlag == true || $('body').hasClass('div_responsive')) { 302 $('.header_wrapper .pbtheme_top').slideUp(300, function () { 303 $('.header_wrapper .pbtheme_top').removeAttr('style'); 304 }); 305 } 306 $this.removeClass('widgets-open'); 307 $this.children('i').attr('class', 'divicon-plus') 308 } 309 else { 310 $this.addClass('widgets-open'); 311 $('.pbtheme_header_widgets').stop(true, true).slideDown(300); 312 if (stickyFlag == true || $('body').hasClass('div_responsive')) { 313 $('.header_wrapper .pbtheme_top ').slideDown(300); 314 } 315 $this.children('i').attr('class', 'divicon-minus') 316 } 317 }); 318 319 $(document).on('click', 'a#div_rtrigger', function (e) { 320 e.preventDefault(); 321 var $this = $(this); 322 if ($(this).hasClass('responsive-open')) { 323 $('#div_header_menu').stop(true, true).slideUp(300); 324 $this.removeClass('responsive-open'); 325 } 326 else { 327 $this.addClass('responsive-open'); 328 $('#div_header_menu').stop(true, true).slideDown(300); 329 } 330 });
331 332// Grid Position Measurement 333 334 335 $(document).on('touchstart', '.div_touch_optimized', function (e) { 336 divTouchOptimizedStart = pointerEventToXY(e).x; 337 }); 338 339 340 $(document).on('touchend', '.div_touch_optimized', function (e) { 341 var curr = pointerEventToXY(e).x; 342 var res = divTouchOptimizedStart - curr; 343 if (Math.abs(res) > 50 && res > 0) { 344 $(this).find('.blog_top_pagination .next').trigger('click'); 345 } else if (Math.abs(res) > 30 && res < 0) { 346 $(this).find('.blog_top_pagination .previous').trigger('click'); 347 } 348 }); 349 350 var gridSlider = new Array(); 351 var pbthemeSlider = new Array(); 352 var pbthemeSliderWidthReference = new Array(); 353 354 $(document).ready(function () { 355 356 357 $(document).on('click', '.widget-pbtheme-catthree h3 a', function () { 358 $(this).parents().eq(3).children('ul').slideUp(); 359 $(this).parents().eq(2).next().slideDown(); 360 return false; 361 }); 362 363 $('.pbtheme_grid.grid_content').each(function (ind) { 364 var $this = $(this); 365 var slideClassStr; 366 var h = ($(window).width() > 800 * window.devicePixelRatio) ? ($this.width() / 2 - $this.width() / 200) : ($this.width() * 3 / 4); 367 $this.height(h).find('.grid_slides, .grid_slide').height(h); 368 slideClassStr = 'grid_slide'; 369// GridSliderStorage[ind] = $this.not('.div_grid_responsive')clone(); 370// GridResponsiveStorage[ind] = $this.not('.div_grid_notresponsive')clone(); 371 372 373// GridSliderStorage[ind] = $this.html(); 374// console.log(GridSliderStorage[0]); 375// GridSliderRespFlag[ind] = false; 376// if($(window).width() > 800*window.devicePixelRatio) { 377// var h = $this.width()/2 - $this.width()/200; 378// $this.height(h).find('.grid_slides, .grid_slide').height(h); 379// slideClassStr = 'grid_slide'; 380// $this.find('.grid_single_post').css('float','none'); 381// }else { 382// var sldString = []; 383// $this.find('.grid_single_post').each(function(ind2){ 384// sldString[ind2] = $(this).clone(); 385// slideClassStr = 'grid_single_post'; 386// }); 387// 388// for(var i=0; i<sldString.length;i++) { 389// $this.find('.grid_slides').append(sldString[i]); 390// } 391// $this.find('.grid_single_post').css('float','left'); 392// 393// $this.find('.grid_slide').each(function(){$(this).remove();}); 394// var h = $this.width()/2 - $this.width()/200; 395// $this.height(h).find('.grid_slides, .grid_slide').height(h); 396// GridSliderRespFlag[ind] = true; 397// } 398 399 400 401 402 gridSlider[ind] = $this.swiper({ 403 createPagination: false, 404 wrapperClass: 'grid_slides', 405 slideClass: slideClassStr, 406 loop: true, 407 grabCursor: true 408 }); 409 410 411 412 if ($(window).width() > 800 * window.devicePixelRatio) { 413 $this.not('.div_grid_responsive').removeClass('div_dis_none'); 414 $this.not('.div_grid_notresponsive').addClass('div_dis_none'); 415 gridSlider[ind].reInit(); 416 } else { 417 $this.not('.div_grid_responsive').addClass('div_dis_none'); 418 $this.not('.div_grid_notresponsive').removeClass('div_dis_none'); 419 gridSlider[ind].reInit(); 420 } 421 422 423 $this.find('.grid_navigation_previous').on('click', function () { 424 gridSlider[ind].swipePrev(); 425 426 }); 427 $this.find('.grid_navigation_next').on('click', function () { 428 gridSlider[ind].swipeNext(); 429 }); 430 431 432 }); 433 434 $(window).load(function () { 435 if ($('.pbtheme_grid.grid_content').length > 0) { 436 gridSlider[0].reInit(); 437 } 438 439 }); 440 441 $(window).resize(function () { 442 //fullHeadHeig = $('.header_wrapper').outerHeight() + adminbar + 20; 443 clearTimeout(gridSliderResizeTimer); 444 gridSliderResizeTimer = setTimeout(function () { 445 446 $('.pbtheme_grid.grid_content').each(function (ind) { 447 var $this = $(this); 448 var h = ($(window).width() > 800 * window.devicePixelRatio) ? ($this.width() / 2 - $this.width() / 200) : ($this.width() * 3 / 4); 449 $this.height(h).find('.grid_slides, .grid_slide').height(h); 450 451 if ($(window).width() > 800 * window.devicePixelRatio) { 452 $this.not('.div_grid_responsive').removeClass('div_dis_none'); 453 $this.not('.div_grid_notresponsive').addClass('div_dis_none'); 454 gridSlider[ind].reInit(); 455 } else { 456 $this.not('.div_grid_responsive').addClass('div_dis_none'); 457 $this.not('.div_grid_notresponsive').removeClass('div_dis_none'); 458 gridSlider[ind].reInit(); 459 } 460 }); 461 462 /* $('.pbtheme_grid.grid_content').each(function(ind) { 463 var $this = $(this); 464 var slideClassStr; 465 if($(window).width() > 800*window.devicePixelRatio) { 466 if($this.find('.grid_slide').length == 0){$this.html(GridSliderStorage[ind]);GridSliderRespFlag[ind] = true;} 467 var h = $this.width()/2 - $this.width()/200; 468 $this.height(h).find('.grid_slides, .grid_slide').height(h); 469 slideClassStr = 'grid_slide'; 470 $this.find('.grid_single_post').css('float','none'); 471 } else { 472 var sldString = []; 473 $this.find('.grid_single_post').each(function(ind2){ 474 sldString[ind2] = $(this).clone(); 475 slideClassStr = 'grid_single_post'; 476 }); 477 478 for(var i=0; i<sldString.length;i++) { 479 $this.find('.grid_slides').append(sldString[i]); 480 } 481 $this.find('.grid_single_post').css('float','left'); 482 483 $this.find('.grid_slide').each(function(){$(this).remove();}); 484 var h = $this.width()/2 - $this.width()/200; 485 $this.height(h).find('.grid_slides, .grid_slide').height(h); 486 GridSliderRespFlag[ind] = false; 487 } 488 console.log(GridSliderRespFlag[ind]); 489 if(GridSliderRespFlag[ind]){ 490 gridSlider[ind] = $this.swiper({ 491 createPagination : false, 492 wrapperClass : 'grid_slides', 493 slideClass : slideClassStr, 494 loop:true, 495 grabCursor: true 496 }); 497 498 }
499 gridSlider[ind].params.slideClass=slideClassStr; 500 gridSlider[ind].reInit(); 501 502 503 504 $this.find('.grid_navigation_previous').on('click', function(){ 505 gridSlider[ind].swipePrev(); 506 }); 507 $this.find('.grid_navigation_next').on('click', function(){ 508 gridSlider[ind].swipeNext(); 509 }); 510 511 512 });*/ 513 }, 200); 514 515 headHeig = $('.header_wrapper').outerHeight(); 516 menuWrap = $('nav.menu_wrapper').outerHeight(); 517 pbtheme_navigation(); 518 }); 519 520 521 522// pbtheme slider 523 $('.pbtheme_slider_wrapper').each(function (ind) { 524 var $this = $(this); 525 $this.addClass('pbtheme_slider_' + ind).children('.pbtheme_slider_content').addClass('pbtheme_slider_content_' + ind).children('.separate-slider-column').addClass('separate-slider-column_' + ind); 526 numberOfSlides[ind] = parseInt($this.attr('data-slides')); 527 528 pbthemeSliderWidthReference[ind] = 280; 529 530 531 $(document).on('mousedown', '.pbtheme_slider_wrapper a.div_slider_img', function (e) { 532 divSliderPosiitonMark = pointerEventToXY(e); 533 }); 534 $(document).on('mousemove', '.pbtheme_slider_wrapper a.div_slider_img', function (e) { 535 divSliderPosiitonMarkNew = pointerEventToXY(e); 536 }); 537 538 $(document).on('click', '.pbtheme_slider_wrapper a.div_slider_img', function (e) { 539 if (Math.abs(divSliderPosiitonMark.x - divSliderPosiitonMarkNew.x) >= 50 || Math.abs(divSliderPosiitonMark.y - divSliderPosiitonMarkNew.y) >= 50) { 540 console.log('bleh'); 541 e.preventDefault(); 542 } 543 }); 544 545 numberOfSlidesFormated[ind] = (numberOfSlides[ind] < Math.floor($this.width() / (pbthemeSliderWidthReference[ind]))) ? numberOfSlides[ind] : Math.floor($this.width() / (pbthemeSliderWidthReference[ind])); 546 var wrapSel = 'pbtheme_slider_content_' + ind; 547 var slideSel = 'separate-slider-column_' + ind; 548 var itemHeight = ($this.width() / numberOfSlidesFormated[ind]) / 1.6; 549 $this.height(itemHeight).find('.pbtheme_slider_content, .separate-slider-column').height(itemHeight); 550 551 pbthemeSlider[ind] = $('.pbtheme_slider_' + ind).swiper({ 552 createPagination: false, 553 wrapperClass: wrapSel, 554 slideClass: slideSel, 555 loop: true, 556 grabCursor: true, 557 loopedSlides: 6, 558 slidesPerView: numberOfSlidesFormated[ind] 559 }); 560 }); 561 562 563 564 $(window).resize(function () { 565 clearTimeout(resizeTimer); 566 resizeTimer = setTimeout(function () { 567 $('.pbtheme_slider_wrapper').each(function (ind) { 568 var $this = $(this); 569 numberOfSlidesFormated[ind] = (numberOfSlides[ind] < Math.floor($this.width() / (pbthemeSliderWidthReference[ind]))) ? numberOfSlides[ind] : Math.floor($this.width() / (pbthemeSliderWidthReference[ind])); 570 var itemHeight = ($this.width() / numberOfSlidesFormated[ind]) / 1.6; 571 var wrapSel = 'pbtheme_slider_content_' + ind; 572 var slideSel = 'separate-slider-column_' + ind; 573 $this.height(itemHeight).find('.pbtheme_slider_content, .separate-slider-column').height(itemHeight); 574 pbthemeSlider[ind].params.slidesPerView = numberOfSlidesFormated[ind]; 575 pbthemeSlider[ind].reInit(); 576 pbthemeSlider[ind].swipeTo(0, 500); 577 }); 578 }, 200); 579 }); 580 581 582 $(window).load(function () { 583// pbtheme slider 584 $('.pbtheme_slider_wrapper').each(function (ind) { 585 var $this = $(this); 586 $this.addClass('pbtheme_slider_' + ind).children('.pbtheme_slider_content').addClass('pbtheme_slider_content_' + ind).children('.separate-slider-column').addClass('separate-slider-column_' + ind); 587 numberOfSlides[ind] = parseInt($this.attr('data-sli
587des')); 588 589 pbthemeSliderWidthReference[ind] = 280; 590 591 592 numberOfSlidesFormated[ind] = (numberOfSlides[ind] < Math.floor($this.width() / (pbthemeSliderWidthReference[ind]))) ? numberOfSlides[ind] : Math.floor($this.width() / (pbthemeSliderWidthReference[ind])); 593 var wrapSel = 'pbtheme_slider_content_' + ind; 594 var slideSel = 'separate-slider-column_' + ind; 595 var itemHeight = ($this.width() / numberOfSlidesFormated[ind]) / 1.6; 596 $this.height(itemHeight).find('.pbtheme_slider_content, .separate-slider-column').height(itemHeight); 597 598 pbthemeSlider[ind] = $('.pbtheme_slider_' + ind).swiper({ 599 createPagination: false, 600 wrapperClass: wrapSel, 601 slideClass: slideSel, 602 loop: true, 603 grabCursor: true, 604 loopedSlides: 6, 605 slidesPerView: numberOfSlidesFormated[ind] 606 }); 607 608 }); 609 }); 610 611 612 613 614 /* Add 'has_children' class to menus */ 615 616 $.each($('#div_header_menu > ul > li, li.menu-item').has('ul.sub-menu'), function () { 617 $(this).addClass('has_children'); 618 }); 619 620 621 /* Magazine tags */ 622 623 $(document).on('mouseenter', '.category_tag', function () { 624 if (!$(this).hasClass('active')) { 625 $(this).addClass('active'); 626 $(this).find('a').each(function (i) { 627 $(this).delay(100 * i).animate({opacity: 1}, 200); 628 }); 629 } 630 }); 631 632 $(document).on('mouseleave', '.category_tag', function () { 633 $($(this).find('.mag_tag:not(:first-child) a').get().reverse()).each(function (i) { 634 $(this).stop(true).delay(100 * i).animate({opacity: 0}, 200); 635 }); 636 $(this).removeClass('active'); 637 638 }); 639 640 641 }); 642 643 644 $(document).on('click', '.pbtheme_menu a[href^="#"]:not(:last-child), .element-to-the-top a', function () { 645 var target = $(this).attr('href'); 646 647 if (target == '#') { 648 return false; 649 } 650 651 var offset = (target == '#pbtheme_wrapper' ? 0 : $(target).offset().top); 652 var speed = $(document).height() / 5000; 653 TweenLite.to(window, speed, {scrollTo: {y: offset, x: 0}, ease: Quad.easeInOut}); 654 return false; 655 }); 656 657 658 $(document).ready(function () { 659 660 $('#div_header_menu > ul.pbtheme_menu').append('<li id="search-trigger"><a href="#"><i class="divicon-search"></i></a></li>'); 661 if (typeof hidetopbar != "undefined" && hidetopbar != "1") { 662 if ($('.pbtheme_header_widgets').length) { 663 $('#div_header_menu > ul.pbtheme_menu').append('<li id="widgets-trigger"><a href="#"><i class="divicon-plus cl1"></i></a></li>'); 664 } else { 665 $('#div_header_menu > ul.pbtheme_menu').append('<li id="topmenu-trigger"><a href="#"><i class="divicon-plus cl2"></i></a></li>'); 666 } 667 } 668 669// news feed tabs 670 671 $(document).on('click', '.news_feed_tabs .tabsnav a', function (e) { 672 e.preventDefault(); 673 if (!$(this).hasClass('active')) { 674 $(this).closest('ul').find('a').removeClass('active background-color-main-rgba'); 675 $(this).addClass('active div_main_bg'); 676 677 $(this).closest('.news_feed_tabs').find('.single_slide').removeClass('shown').stop(true).animate({opacity: 0}, 300, function () { 678 $(this).hide(); 679 }); 680 681 $(this).closest('.news_feed_tabs').find($(this).attr('href')).addClass('shown').show().stop(true).animate({opacity: 1}, 300); 682 } 683 684 }); 685 686 687 $('.news_feed_tabs .tabsnav').each(function () { 688 $(this).find('a').eq(0).trigger('click'); 689 }); 690 691 692// Header Menu Solid Hover 693 694 $(document).on('click', '.div_responsive #div_header_menu li.has_children a', function (e) { 695 if (e.pageX - $(this).offset().left > $(this).parent().width() - 36) { 696 $(this).next().slideToggle(200); 697 return false; 698 } 699 }); 700 701 if ($(window).width() > pbtheme.go_responsive) { 702 navActive = true; 703 } else { 704 $('body').addClass('div_responsive'); 705 706 } 707 708 var nav = $('.menu_wrapper ul.pbtheme_menu'); 709 710 711 712 713 function is_touch_device() { 714 return !!('ontouchstart' in window); 715 } 716 717 if (navActive == true) { 718 if (is_touch_device() === false) { 719 nav.on('mouseover', function (e) { 720 if ($('body').hasClass('div_responsive')) { 721 return; 722 } 723 nav.doTimeout('menu-item', 100, over, e.target); 724 return false; 725 726 }).on('mouseout', function () { 727 if ($('body').hasClass('div_responsive')) { 728 return; 729 } 730 nav.doTimeout('menu-item', 300, out); 731 return false; 732 }); 733 } 734 else { 735 nav.on('touchstart', function (e) { 736 if ($('body').hasClass('div_responsive')) { 737 return; 738 } 739 var curr = $(e.target).closest('li'); 740 if (!curr.hasClass('div-nav-activated')) { 741 curr.addClass('div-nav-activated'); 742 nav.doTimeout('menu-item', 100, over, e.target); 743 return false; 744 } 745 746 }); 747 } 748 749 } 750 751 752 function over(elem) { 753 if ($(elem).parents().eq(1).is('.is_fullwidth, .navmenu_fullwidth')) { 754 return false; 755 } 756 var parent = $(elem).closest('li'); 757 var liHeight = $(elem).outerHeight(); 758 out(parent); 759 parent.addClass('hovered'); 760 parent.children('ul:hidden').css({top: '100%'}).delay(100).slideDown(100); 761 } 762 ; 763 764 function out(elem) { 765 if ($(elem).parents().eq(1).is('.is_fullwidth, .navmenu_fullwidth')) { 766 return false; 767 } 768 var parents = elem ? $(elem).closest('li').siblings() : nav.children();
769 if (nav.is('.menu_wrapper ul.pbtheme_menu')) { 770 parents = parents.not('.active'); 771 } 772 parents.removeClass('hovered'); 773 parents.find('li.menu-item.hovered').removeClass('hovered'); 774 parents.find('ul.sub-menu').delay(100).fadeOut(100); 775 776 } 777 ; 778 779 780// Input Field Clear 781 782 783 $('input.input_field').focus(function () { 784 if (!$(this).hasClass('collected')) { 785 $(this).attr('data-val', $(this).val()); 786 $(this).addClass('collected'); 787 $(this).val(''); 788 } else { 789 if ($(this).val() === $(this).attr('data-val')) { 790 $(this).val(''); 791 } 792 } 793 794 }); 795 $('input.input_field').focusout(function () { 796 if ($(this).val() === '') { 797 $(this).val($(this).attr('data-val')); 798 } 799 800 }); 801 802 803// Textarea Field Clear 804 805 $('textarea.textarea_field').focus(function () { 806 if (!$(this).hasClass('collected')) { 807 $(this).attr('data-val', $(this).html()); 808 $(this).addClass('collected'); 809 $(this).html(''); 810 } else { 811 if ($(this).html() === $(this).attr('data-val')) { 812 $(this).html(''); 813 } 814 } 815 }); 816 $('textarea.textarea_field').focusout(function () { 817 if ($(this).html() === '') { 818 $(this).html($(this).attr('data-val')); 819 } 820 821 822 }); 823 824// select replace 825 $('#bbpress-forums .bbp_select_wrapper > select').each(function () { 826 var $this = $(this); 827 $this.hide(); 828 var selected = $this.find('option[value=' + $this.val() + ']').html(); 829 var html = '<div class="select_menu" data-name="' + $this.attr('name') + '">' + 830 '<span>' + selected + '</span>' + 831 '<a href="" class="drop_button"><i class="fa fa-angle-down"></i></a>' + 832 '<ul style="display:none">'; 833 $this.find('option').each(function () { 834 html += '<li><a href="#" data-value="' + $(this).attr('value') + '">' + $(this).html() + '</a></li>'; 835 }); 836 html += 837 '</ul>' + 838 '<div class="clear"></div><!-- clear -->' + 839 '</div><!-- select_menu -->'; 840 $(html).insertAfter($this); 841 }); 842 843 $('.select_menu').hover(function () { 844 $(this).data('hover', true); 845 }, function () { 846 $(this).data('hover', false); 847 }); 848 849 850 $('.drop_button').click(function (e) { 851 e.preventDefault(); 852 var $parent = $(this).parent(); 853 if (!$parent.hasClass('active')) { 854 $parent.addClass('active').find('ul').show(); 855 } 856 else { 857 $parent.removeClass('active').find('ul').hide(); 858 } 859 }); 860 861 $('.select_menu ul a').click(function (e) { 862 e.preventDefault(); 863 var $parent = $(this).parent().parent().parent(); 864 var $select = $('select[name="' + $parent.attr('data-name') + '"]'); 865 $select.val($(this).attr('data-value')).change(); 866 $parent.find('span').html($(this).html()); 867 $parent.removeClass('active').find('ul').hide(); 868 }); 869 870 $('body').click(function () { 871 $('.select_menu.active').each(function () { 872 if (!$(this).data('hover')) { 873 $(this).removeClass('active').find('ul').hide(); 874 } 875 }); 876 }); 877 878 879 880// team member module 881 882 $(document).on('mouseenter', '.team_member_module .img_wrapper', function () { 883 $(this).find('.hover_element').show().stop(true).animate({opacity: 1}, 300); 884 $(this).find('.hover_element').find('.socials li a').each(function (index) { 885 $(this).stop(true).delay(index * 50).animate({opacity: 1}, 200); 886 }); 887 }); 888 $(document).on('mouseleave', '.team_member_module .img_wrapper', function () { 889 $(this).find('.hover_element').show().stop(true).animate({opacity: 0}, 300, function () { 890 $(this).hide(); 891 }).find('.socials li a').stop(true).animate({opacity: 0}, 300); 892 }); 893 894 895 896 $(document).on('click', '.infinite-load-button', function () { 897 infiniteClickFlag = false; 898 $(this).addClass('ilb-active'); 899 var pbthemeInfiniteIndex = 0; 900 window.pbthemeInfiniteDelayIndex = 0; 901 window.pbthemeInfiniteScreenMeasurement = $(window).scrollTop() - $('.infinite-load-target').find('div > .pbuilder_column').eq(0).find('.magazine_image_column:last').offset().top - $('.infinite-load-target').find('div > .pbuilder_column').eq(0).find('.magazine_image_column:last').height() + $(window).height(); 902 903 var currentItem = $(this); 904 var oldItem = currentItem.parent().prev().prev(); 905 var string = oldItem.attr('data-string');
906 var actionSend = 'pbtheme_ajaxinfinite_send'; 907 var ajaxPage = currentItem.attr('data-page'); 908 var color = oldItem.find('.hover_transparent:first-child').hasClass('not-transparent'); 909 var data = { 910 action: actionSend, 911 page: ajaxPage, 912 data: string, 913 colored: color 914 }; 915 916 $.post(pbtheme.ajaxurl, data, function (response) { 917 if (response) { 918 919 $('body').append('<div id="infinitePreLoad" style="overflow:hidden; height:0;">' + response + '<div>'); 920 var imagesNum = $('#infinitePreLoad img').length; 921 if (imagesNum != 0) { 922 $('#infinitePreLoad img').load(function () { 923 imagesNum--; 924 if (imagesNum == 0) { 925 window.pbthemeInfiniteLoadItemArray = []; 926 window.pbthemeInfiniteLoadItemCounter = 0; 927 window.pbthemeInfiniteLoadItemArrayInit = []; 928 window.pbthemeInfiniteLoadItemCounterInit = 0; 929 var pbthemeInfiniteIndex = 0; 930 window.pbthemeInfiniteDelayIndex = 0; 931 currentItem.attr('data-page', parseInt(ajaxPage, 10) + 1); 932 window.pbthemeInfiniteLoadItemArray = (response).split("--||--"); 933 while (window.pbthemeInfiniteLoadItemArray.length > window.pbthemeInfiniteLoadItemCounter + 1) { 934 var pbthemeInfiniteHeightCal = 0; 935 pbthemeInfiniteIndex = 0; 936 937 pbthemeInfiniteHeightCal = oldItem.find('div > .pbuilder_column').eq(0).height(); 938 939 var arrone = oldItem.find('div > .pbuilder_column'); 940 for (var m = 0; m < arrone.length; m++) { 941 var itemx = arrone.eq(m); 942 if (itemx.height() < pbthemeInfiniteHeightCal) { 943 pbthemeInfiniteHeightCal = itemx.height(); 944 pbthemeInfiniteIndex = itemx.index(); 945 } 946 } 947 window.pbthemeInfiniteScreenMeasurement = $(window).scrollTop() - oldItem.find('div > .pbuilder_column').eq(pbthemeInfiniteIndex).find('.magazine_image_column:last').offset().top - oldItem.find('div > .pbuilder_column').eq(pbthemeInfiniteIndex).find('.magazine_image_column:last').height() + $(window).height(); 948 949 if (jQuery.isFunction((jQuery.fn.kkstarratings))) { 950 oldItem.children('div').children('.pbuilder_column').eq(pbthemeInfiniteIndex).append(window.pbthemeInfiniteLoadItemArray[window.pbthemeInfiniteLoadItemCounter]).find('.magazine_image_column:last').css({opacity: 0}).delay(window.pbthemeInfiniteDelayIndex * 50).animate({opacity: 1}, 300).find('.kk-star-ratings').kkstarratings(); 951 } 952 else { 953 oldItem.children('div').children('.pbuilder_column').eq(pbthemeInfiniteIndex).append(window.pbthemeInfiniteLoadItemArray[window.pbthemeInfiniteLoadItemCounter]).find('.magazine_image_column:last').css({opacity: 0}).delay(window.pbthemeInfiniteDelayIndex * 50).animate({opacity: 1}, 300); 954 } 955 956 window.pbthemeInfiniteDelayIndex++; 957 window.pbthemeInfiniteLoadItemCounter++; 958 } 959 960 $('.pbtheme_ultimate_fix a[rel="lightbox"]').swipebox(); 961 $('.pbtheme_ultimate_fix').removeClass('pbtheme_ultimate_fix'); 962 963 $('#infinitePreLoad').remove(); 964 965 } 966 }); 967 infiniteClickFlag = true; 968 $('.infinite-load-button').removeClass('ilb-active'); 969 } else { 970 window.pbthemeInfiniteLoadItemArray = []; 971 window.pbthemeInfiniteLoadItemCounter = 0; 972 window.pbthemeInfiniteLoadItemArrayInit = []; 973 window.pbthemeInfiniteLoadItemCounterInit = 0; 974 var pbthemeInfiniteIndex = 0; 975 window.pbthemeInfiniteDelayIndex = 0; 976 currentItem.attr('data-page', parseInt(ajaxPage, 10) + 1); 977 window.pbthemeInfiniteLoadItemArray = (response).split("--||--"); 978 while (window.pbthemeInfiniteScreenMeasurement > 0 && window.pbthemeInfiniteLoadItemArray.length > window.pbthemeInfiniteLoadItemCounter + 1) { 979 var pbthemeInfiniteHeightCal = 0; 980 pbthemeInfiniteIndex = 0; 981 982 pbthemeInfiniteHeightCal = oldItem.find('div > .pbuilder_column').eq(0).height(); 983 984 var arrone = oldItem.find('div > .pbuilder_column'); 985 for (var m = 0; m < arrone.length; m++) { 986 var itemx = arrone.eq(m); 987 if (itemx.height() < pbthemeInfiniteHeightCal) { 988 pbthemeInfiniteHeightCal = itemx.height(); 989 pbthemeInfiniteIndex = itemx.index(); 990 } 991 992 } 993 window.pbthemeInfiniteScreenMeasurement = $(window).scrollTop() - oldItem.find('div > .pbuilder_column').eq(pbthemeInfiniteIndex).find('.magazine_image_column:last').offset().top - oldItem.find('div > .pbuilder_column').eq(pbthemeInfiniteIndex).find('.magazine_image_column:last').height() + $(window).height(); 994 995 oldItem.children('div').children('.pbuilder_column').eq(pbthemeInfiniteIndex).append(window.pbthemeInfiniteLoadItemArray[window.pbthemeInfiniteLoadItemCounter]).find('.magazine_image_column:last').css({opacity: 0}).delay(window.pbthemeInfiniteDelayIndex * 50).animate({opacity: 1}, 300); 996 window.pbthemeInfiniteDelayIndex++; 997 window.pbthemeInfiniteLoadItemCounter++; 998 } 999 $('#infinitePreLoad').remove(); 1000 infiniteClickFlag = true; 1001 $('.infinite-load-button').removeClass('ilb-active'); 1002 1003 } 1004 $(this).find('.pbuilder_module').trigger('refresh'); 1005 } else { 1006 currentItem.addClass('infinite-load-button-no-more').removeClass('infinite-load-button').text('No more posts'); 1007 } 1008 1009 1010 1011 }); 1012 }); 1013 1014 1015// portfolio columns 1016 1017 $(document).ready(function () { 1018 var newItem = $('.portfolio_content, .div_portfolio_slider'); 1019 var prel = newItem.find('.div_ajax_col .pbtheme_hover').width(); 1020 newItem.find('.div_ajax_col .pbtheme_hover').each(function () { 1021 /* 1022 Code Added by Asim Ashraf - DevBatch 1023 Date: 2/2/2015 1024 css set min-height Comment 1025 */ 1026 //$(this).css('min-height', prel); 1027// jQuery(this).css({opacity: 0}); 1028// jQuery('<div class="img_prel"><i class="fa fa-spinner fa-spin"></i></div>').insertAfter(jQuery(this)); 1029// var prel = jQuery(this).siblings('.img_prel'); 1030// prel.height(prel.width()); 1031 }); 1032 1033 portfolioColumnsInit(newItem); 1034 1035// setTimeout(function(){ 1036// $('.portfolio_content, .div_portfolio_slider').find('.div_ajax_col .pbtheme_hover img:not(".appeared")').each(function(){ 1037// jQuery(this).css({'display' :'block'}).animate({opacity:1}, 200); 1038// jQuery(this).siblings('.img_prel').hide(); 1039// }); 1040// },5000); 1041 1042// $('.portfolio_content, .div_portfolio_slider').find('.div_ajax_col .pbtheme_hover img').load(function(){ 1043// jQuery(this).addClass('appeared').css({'display' :'block'}).animate({opacity:1}, 200); 1044// jQuery(this).siblings('.img_prel').hide(); 1045// }); 1046 }); 1047 1048//$(window).load(function(){ 1049// var newItem = $('.portfolio_content, .div_portfolio_slider'); 1050// portfolioColumnsInit(newItem); 1051//}); 1052// 1053 1054 $(document).on('click', '.div_top_nav_cat li a', function () { 1055 $(this).closest('.div_top_nav_cat').find('.div_ajax_port_selected').removeClass('div_ajax_port_selected'); 1056 $(this).parent().addClass('div_ajax_port_selected'); 1057 }); 1058 1059// Fbuilder fixed 1060 1061 $(document).on('refresh', '.pbuilder_module', function () { 1062 1063 1064// portfolio columns 1065 1066 portfolioColumnsInit($(this).find('.portfolio_content, .div_portfolio_slider')); 1067 1068// grid slider 1069 1070 $(this).find('.pbtheme_grid.grid_content').each(function (ind) { 1071 var $this = $(this); 1072 var h = $(this).width() / 2 - $(this).width() / 200; 1073 $(this).height(h); 1074 $(this).find('.grid_slide, .grid_slides').height(h); 1075 $(this).find('.grid_navigation').children('div').css('line-height', h + 'px'); 1076 1077 gridSlider[ind] = $this.swiper({ 1078 createPagination: false, 1079 wrapperClass: 'grid_slides', 1080 slideClass: 'grid_slide', 1081 loop: true, 1082 grabCursor: true 1083 }); 1084 1085 1086 }); 1087 1088 1089// pbtheme slider 1090 1091 $(this).find('.pbtheme_slider_wrapper').each(function (ind) { 1092 var $this = $(this); 1093 $this.addClass('pbtheme_slider_' + ind).children('.pbtheme_slider_content').addClass('pbtheme_slider_content_' + ind).children('.separate-slider-column').addClass('separate-slider-column_' + ind); 1094 numberOfSlides[ind] = parseInt($this.attr('data-sli
1094des')); 1095 1096 pbthemeSliderWidthReference[ind] = 280; 1097 1098 1099 numberOfSlidesFormated[ind] = (numberOfSlides[ind] < Math.floor($this.width() / (pbthemeSliderWidthReference[ind]))) ? numberOfSlides[ind] : Math.floor($this.width() / (pbthemeSliderWidthReference[ind])); 1100 var wrapSel = 'pbtheme_slider_content_' + ind; 1101 var slideSel = 'separate-slider-column_' + ind; 1102 var itemHeight = ($this.width() / numberOfSlidesFormated[ind]) / 1.6; 1103 console.log(itemHeight); 1104 $this.height(itemHeight).find('.pbtheme_slider_content, .separate-slider-column').height(itemHeight); 1105 1106 pbthemeSlider[ind] = $('.pbtheme_slider_' + ind).swiper({ 1107 createPagination: false, 1108 wrapperClass: wrapSel, 1109 slideClass: slideSel, 1110 loop: true, 1111 grabCursor: true, 1112 loopedSlides: 6, 1113 slidesPerView: numberOfSlidesFormated[ind] 1114 }); 1115 }); 1116 1117 1118 1119// magazine infinite load 1120 1121 $(this).find('.infinite-load-target').each(function () { 1122 window.pbthemeInfiniteLoadItemCounter = 0; 1123 window.pbthemeInfiniteLoadItemArrayInit = []; 1124 window.pbthemeInfiniteLoadItemCounterInit = 0; 1125 var pbthemeInfiniteIndex = 0; 1126 window.pbthemeInfiniteDelayIndex = 0; 1127 $(this).children('.infinite-load-init').children('li').each(function (index) { 1128 window.pbthemeInfiniteLoadItemArrayInit[index] = $(this).html(); 1129 }); 1130 1131 $(this).children('.infinite-load-init').remove(); 1132 1133 var targetwidth = $(this).width(); 1134 1135 if (targetwidth < 480) { 1136 $(this).append('<div><div class="pbuilder_column pbuilder_column-1-1"></div><!-- pbtheme-1-1 -->'); 1137 } 1138 else if (targetwidth < 900) { 1139 $(this).append('<div><div class="pbuilder_column pbuilder_column-1-2"></div><!-- pbtheme-1-2 --><div class="pbuilder_column pbuilder_column-1-2"></div></div><!-- pbtheme-1-2 -->'); 1140 } 1141 else { 1142 $(this).append('<div><div class="pbuilder_column pbuilder_column-1-3"></div><!-- pbtheme-1-3 --><div class="pbuilder_column pbuilder_column-1-3"></div><!-- pbtheme-1-3 --><div class="pbuilder_column pbuilder_column-1-3"></div></div><!-- pbtheme-1-3 -->'); 1143 } 1144 1145 window.pbthemeInfiniteLoadColumnCounter = $(this).find('div > .pbuilder_column').length; 1146 1147 for (var i = 0; i < window.pbthemeInfiniteLoadColumnCounter; i++) { 1148 $(this).children('div').children('.pbuilder_column').eq(i).append(window.pbthemeInfiniteLoadItemArrayInit[window.pbthemeInfiniteLoadItemCounterInit]).find('.magazine_image_column:last').css({opacity: 0}).delay(window.pbthemeInfiniteDelayIndex * 50).animate({opacity: 1}, 300); 1149 window.pbthemeInfiniteDelayIndex++; 1150 window.pbthemeInfiniteLoadItemCounterInit++; 1151 1152 } 1153 1154 while (window.pbthemeInfiniteLoadItemArrayInit.length > window.pbthemeInfiniteLoadItemCounterInit) { 1155 var pbthemeInfiniteHeightCal = 0; 1156 pbthemeInfiniteIndex = 0; 1157 1158 pbthemeInfiniteHeightCal = $(this).find('div > .pbuilder_column').eq(0).height(); 1159 1160 var arrone = $(this).find('div > .pbuilder_column'); 1161 for (var m = 0; m < arrone.length; m++) { 1162 var itemx = arrone.eq(m); 1163 if (itemx.height() < pbthemeInfiniteHeightCal) { 1164 pbthemeInfiniteHeightCal = itemx.height(); 1165 pbthemeInfiniteIndex = itemx.index(); 1166 } 1167 } 1168 1169 window.pbthemeInfiniteScreenMeasurement = $(window).scrollTop() - $(this).find('div > .pbuilder_column').eq(0).find('.magazine_image_column:last').offset().top - $(this).find('div > .pbuilder_column').eq(0).find('.magazine_image_column:last').height() + $(window).height(); 1170 1171 $(this).children('div').children('.pbuilder_column').eq(pbthemeInfiniteIndex).append(window.pbthemeInfiniteLoadItemArrayInit[window.pbthemeInfiniteLoadItemCounterInit]).find('.magazine_image_column:last').css({opacity: 0}).delay(window.pbthemeInfiniteDelayIndex * 50).animate({opacity: 1}, 300); 1172 window.pbthemeInfiniteDelayIndex++; 1173 window.pbthemeInfiniteLoadItemCounterInit++; 1174 1175 } 1176 1177 infiniteClickFlag = true; 1178 1179 if (typeof (swipeboxInstance) != 'undefined') 1180 swipeboxInstance.refresh();
1181 $(this).find('.pbuilder_module').trigger('refresh'); 1182 1183 }); 1184 1185// news feed tabs 1186 1187 $(this).find('.news_feed_tabs .tabsnav').each(function () { 1188 $(this).find('a').eq(0).trigger('click'); 1189 }); 1190 1191 1192 }); 1193 1194 1195 1196 }); // document.ready END 1197 1198 1199 $(window).load(function () { 1200// infinite load - Magazine category 1201 window.pbthemeInfiniteLoadItemArray = []; 1202 window.pbthemeInfiniteLoadItemCounter = 0; 1203 window.pbthemeInfiniteLoadItemArrayInit = []; 1204 window.pbthemeInfiniteLoadItemCounterInit = 0; 1205 var pbthemeInfiniteIndex = 0; 1206 window.pbthemeInfiniteDelayIndex = 0; 1207 $('.infinite-load-target').each(function () { 1208 1209 window.pbthemeInfiniteLoadItemCounter = 0; 1210 window.pbthemeInfiniteLoadItemArrayInit = []; 1211 window.pbthemeInfiniteLoadItemCounterInit = 0; 1212 var pbthemeInfiniteIndex = 0; 1213 window.pbthemeInfiniteDelayIndex = 0; 1214 $(this).children('.infinite-load-init').children('li').each(function (index) { 1215 window.pbthemeInfiniteLoadItemArrayInit[index] = $(this).html(); 1216 }); 1217 1218 $(this).addClass('pbuilder_row').children('.infinite-load-init').remove(); 1219 1220 var targetwidth = $(this).width(); 1221 if (targetwidth < 480) { 1222 $(this).append('<div><div class="pbuilder_column pbuilder_column-1-1"></div></div><!-- pbtheme-1-1 -->'); 1223 } 1224 else if (targetwidth < 900) { 1225 $(this).append('<div><div class="pbuilder_column pbuilder_column-1-2"></div><!-- pbtheme-1-2 --><div class="pbuilder_column pbuilder_column-1-2"></div><!-- pbtheme-1-2 --></div>'); 1226 2 1227 } 1228 else { 1229 $(this).append('<div><div class="pbuilder_column pbuilder_column-1-3"></div><!-- pbtheme-1-3 --><div class="pbuilder_column pbuilder_column-1-3"></div><!-- pbtheme-1-3 --><div class="pbuilder_column pbuilder_column-1-3"></div><!-- pbtheme-1-3 --></div>'); 1230 } 1231 1232 window.pbthemeInfiniteLoadColumnCounter = $(this).find('div > .pbuilder_column').length; 1233 1234 for (var i = 0; i < window.pbthemeInfiniteLoadColumnCounter; i++) { 1235 $(this).children('div').children('.pbuilder_column').eq(i).append(window.pbthemeInfiniteLoadItemArrayInit[window.pbthemeInfiniteLoadItemCounterInit]).find('.magazine_image_column:last').css({opacity: 0}).delay(window.pbthemeInfiniteDelayIndex * 50).animate({opacity: 1}, 300); 1236 window.pbthemeInfiniteDelayIndex++; 1237 window.pbthemeInfiniteLoadItemCounterInit++; 1238 1239 } 1240 while (window.pbthemeInfiniteLoadItemArrayInit.length > window.pbthemeInfiniteLoadItemCounterInit) { 1241 var pbthemeInfiniteHeightCal = 0; 1242 pbthemeInfiniteIndex = 0; 1243 1244 pbthemeInfiniteHeightCal = $(this).find('div > .pbuilder_column').eq(0).height(); 1245 1246 var arrone = $(this).find('div > .pbuilder_column'); 1247 for (var m = 0; m < arrone.length; m++) { 1248 var itemx = arrone.eq(m); 1249 if (itemx.height() < pbthemeInfiniteHeightCal) { 1250 pbthemeInfiniteHeightCal = itemx.height(); 1251 pbthemeInfiniteIndex = itemx.index(); 1252 } 1253 } 1254 1255 window.pbthemeInfiniteScreenMeasurement = $(window).scrollTop() - $(this).find('div > .pbuilder_column').eq(0).find('.magazine_image_column:last').offset().top - $(this).find('div > .pbuilder_column').eq(0).find('.magazine_image_column:last').height() + $(window).height(); 1256 1257 $(this).children('div').children('.pbuilder_column').eq(pbthemeInfiniteIndex).append(window.pbthemeInfiniteLoadItemArrayInit[window.pbthemeInfiniteLoadItemCounterInit]).find('.magazine_image_column:last').css({opacity: 0}).delay(window.pbthemeInfiniteDelayIndex * 50).animate({opacity: 1}, 300); 1258 window.pbthemeInfiniteDelayIndex++; 1259 window.pbthemeInfiniteLoadItemCounterInit++; 1260 1261 } 1262 $('a[rel="lightbox"]').swipebox(); 1263 $('.infinite-load-button').animate({'opacity': 1}, 300); 1264 $(this).find('.pbuilder_module').trigger('refresh'); 1265 }); 1266 1267 });
1268 1269 1270 1271 $(document).on('refresh', '.pbuilder_module', function () { 1272 1273 $(this).find('.pbtheme_featured_video').each(function () { 1274 window.afv_margin_bottom = $(this).css('margin-bottom'); 1275 window.afv_margin_right = $(this).css('margin-right'); 1276 window.afv_margin_top = $(this).css('margin-top'); 1277 window.afv_margin_left = $(this).css('margin-left'); 1278 window.afv_floating = $(this).css('float'); 1279 $(this).wrap('<div></div>').parent().addClass('pbtheme_featured_video_wrapper').css({'margin-bottom': window.afv_margin_bottom, 'margin-right': window.afv_margin_right, 'margin-top': window.afv_margin_top, 'margin-left': window.afv_margin_left, 'float': window.afv_floating}).prepend('<div><div><i class="fa fa-play-circle"></i></div></div>'); 1280 }); 1281 1282 $(this).find('[class^="attachment-shop_"]').each(function () { 1283 if ($(this).parents('.widget').length > 0) { 1284 return; 1285 } 1286 var productImg = $(this); 1287 if (!productImg.hasClass('pbtheme_zoom_interface_installed')) { 1288 productImg.wrap('<div class="pbtheme_zoom_interface" />'); 1289 productImg.parent().css({'position': 'relative', 'overflow': 'hidden', width: '100%', height: '100%', 'margin-bottom': '20px'}); 1290 productImg.css({'max-width': 'none', 'max-height': 'none', 'display': 'block', 'margin-bottom': 0}).addClass('pbtheme_zoom_interface_installed'); 1291 var liParent = productImg.parent().parent().parent('li'); 1292 if (liParent.hasClass('product')) { 1293 productImg.parent().append('<div class="product_hover"><span class="product_hover_text">' + pbtheme.ts_viewmore + '</span><span class="product_hover_icon">></span></div>') 1294 1295 } 1296 } 1297 }); 1298 1299 1300 }); 1301 1302 $(document).on('click', 'a.language_selected', function (e) { 1303 e.preventDefault(); 1304 if (!$(this).closest('.element-language-bar').find('ul').hasClass('opened')) { 1305 var ulHeight = $(this).closest('.element-language-bar').find('ul li').height() * $(this).closest('.element-language-bar').find('ul li').length; 1306 $(this).closest('.element-language-bar').find('ul').stop(true).slideDown(150, function () { 1307 $(this).addClass('opened'); 1308 }); 1309 } 1310 else { 1311 $(this).closest('.element-language-bar').find('ul').stop(true).slideUp(150).removeClass('opened'); 1312 } 1313 }); 1314 1315 $(document).on('click', '.element-language-bar ul li a', function () { 1316 var currLang = $('a.language_selected').html(); 1317 var selectedLang = $(this).html(); 1318 if (currLang != selectedLang) { 1319 $(this).closest('.element-language-bar').find('a.language_selected span').html(selectedLang); 1320 } 1321 }); 1322 1323 function pbtheme_navigation() { 1324 function over(elem) { 1325 if ($(elem).parents().eq(1).is('.is_fullwidth, .navmenu_fullwidth')) { 1326 return false; 1327 } 1328 var parent = $(elem).closest('li'); 1329 var liHeight = $(elem).outerHeight(); 1330 out(parent); 1331 parent.addClass('hovered'); 1332 parent.children('ul:hidden').css({top: liHeight}).slideDown(100); 1333 } 1334 ; 1335 1336 function out(elem) { 1337 var parents = elem ? $(elem).closest('li').siblings() : nav.children(); 1338 if (nav.is('.menu_wrapper ul.pbtheme_menu')) { 1339 parents = parents.not('.active'); 1340 } 1341 parents.removeClass('hovered'); 1342 parents.find('li.menu-item.hovered').removeClass('hovered'); 1343 parents.find('ul.sub-menu ul.sub-menu').fadeOut(100); 1344 parents.children('ul.sub-menu').delay(100).fadeOut(100); 1345 } 1346 ; 1347 1348 var currentWidth = $(window).width(); 1349 if (currentWidth < pbtheme.go_responsive) { 1350 $('#div_header_menu').removeClass('menu_wrapper').css('display', 'none'); 1351 $('body').addClass('div_responsive'); 1352 $('.header_wrapper').removeClass('sticky-header').css('top', 0); 1353 } 1354 else { 1355 if ($('#div_header_menu').hasClass('menu_wrapper') === false) { 1356 $('#pbtheme_wrapper').removeAttr('style'); 1357 $('#div_header_menu').addClass('menu_wrapper').css('display', 'block'); 1358 $('body').removeClass('div_responsive'); 1359 1360 if (navActive == false) { 1361 var nav = $('.menu_wrapper ul.pbtheme_menu'); 1362 nav.mouseover(function (e) { 1363 if ($('body').hasClass('div_responsive')) { 1364 return; 1365 } 1366 nav.doTimeout('menu-item', 100, over, e.target); 1367 }).mouseout(function () { 1368 if ($('body').hasClass('div_responsive')) { 1369 return; 1370 } 1371 nav.doTimeout('menu-item', 300, out); 1372 }); 1373 } 1374 } 1375 } 1376 } 1377 1378})(jQuery); 1379 1380 1381 1382// portfolio columns entry anim 1383 1384 1385var portColInitDReady = true; 1386function portfolioColumnsInit(newItem) { 1387 var colNumb = parseInt(newItem.attr('data-columns')); 1388 newItem.find('.div_ajax_col').css({'display': 'none', 'opacity': 0}); 1389 1390 newItem.css({'display': 'none'}); 1391 for (i = 1; i <= Math.floor(newItem.find('.div_ajax_col').length / colNumb); i++) { 1392 if (newItem.find('.div_ajax_col').eq(i * colNumb - 1).next().attr('style') !== 'clear:both') { 1393 //jQuery('<div style="clear:both"></div>').insertAfter(newItem.find('.div_ajax_col').eq(i*colNumb-1)); 1394 } 1395 } 1396 if (newItem.find('.div_top_nav_cat').hasClass('pbtheme_anim_fade')) { 1397 newItem.show().find('.div_ajax_col').each(function (ind) { 1398 jQuery(this).show().delay(ind * 150).animate({opacity: 1}, 300); 1399 }); 1400 } else if (newItem.find('.div_top_nav_cat').hasClass('pbtheme_anim_snake')) { 1401 var mainCount = 0, dirIden = 1; 1402 for (var i = 0; i < newItem.find('.div_ajax_col').length; i++) { 1403 for (var j = 0; j < colNumb; j++) { 1404 var delaySet = (dirIden >
1404 0) ? mainCount : (mainCount + colNumb - 1 - 2 * j); 1405 newItem.show().find('.div_ajax_col').eq(mainCount).show().delay(delaySet * 200).animate({opacity: 1}, 300); 1406 if (j == colNumb - 1) { 1407 dirIden = dirIden * (-1); 1408 } 1409 mainCount++; 1410 } 1411 } 1412 } 1413} 1414 1415 1416// Ajax Load 1417var ajaxLoading = false; 1418function pbtheme_ajaxload(currentItem) { 1419 if (ajaxLoading) { 1420 return; 1421 } 1422 ajaxLoading = true; 1423 "use strict"; 1424 var nav = currentItem.parents().eq(4); 1425 var oldItem = nav.next(); 1426 1427 oldItem.parent().parent().css({'overflow': 'hidden'}); 1428 var string = oldItem.attr('data-string'); 1429 var shortData = oldItem.attr('data-shortcode').split('|'); 1430 var stringClass = oldItem.attr('class'); 1431 var direction = currentItem.attr('class'); 1432 1433 if (stringClass.indexOf('blog_content') >= 0) { 1434 var stringClassType = stringClass.replace('blog_content ', ''); 1435 var actionSend = 'pbtheme_ajaxload_send'; 1436 } 1437 1438 var ajaxPage = currentItem.children('.pbtheme_page').text(); 1439 1440 var data = { 1441 action: actionSend, 1442 page: ajaxPage, 1443 type: stringClassType, 1444 data: string, 1445 ajax: 'yes', 1446 excerpt: shortData[0], 1447 bot_margin: shortData[1], 1448 title: shortData[2] 1449 }; 1450 1451 jQuery.post(pbtheme.ajaxurl, data, function (response) { 1452 if (response) { 1453 var content = response.split('@@@!SPLIT!@@@'); 1454 var margin = oldItem.find('.pbuilder_column').css('border-left-width'); 1455 margin = margin.replace('px', ''); 1456 var width = oldItem.width() + 2 * parseInt(margin, 10); 1457 nav.remove(); 1458 oldItem.before(content[0]); 1459 oldItem.after(content[1]); 1460 var newItem = oldItem.next(); 1461 if (direction.indexOf('next') >= 0) { 1462 newItem.css({'position': 'absolute', 'width': 'inherit', 'left': width.toString() + 'px', 'top': '51px'}); 1463 newItem.show(); 1464 TweenLite.to(oldItem, 0.5, {left: '-=' + width.toString(), onComplete: function () { 1465 oldItem.remove(); 1466 }}); 1467 1468 TweenLite.to(newItem, 0.5, {left: '-=' + width.toString(), onComplete: function () { 1469 newItem.css({'position': 'relative', 'left': '0', 'top': '0'}); 1470 ajaxLoading = false; 1471 }}); 1472 jQuery('body').animate({ 1473 scrollTop: newItem.offset().top - 208 1474 }); 1475 } 1476 else { 1477 newItem.css({'position': 'absolute', 'width': 'inherit', 'left': '-' + width.toString() + 'px', 'top': '51px'}); 1478 newItem.show(); 1479 TweenLite.to(oldItem, 0.5, {left: width.toString(), onComplete: function () { 1480 oldItem.remove(); 1481 }}); 1482 TweenLite.to(newItem, 0.5, {left: 0, onComplete: function () { 1483 newItem.css({'position': 'relative', 'left': '0', 'top': '0'}); 1484 ajaxLoading = false; 1485 }}); 1486 1487 jQuery('body').animate({ 1488 scrollTop: newItem.offset().top - 208 1489 }); 1490 } 1491 1492 // swipebox 1493 swipeboxInstance = newItem.find('a[rel="lightbox"]').swipebox(); 1494 1495 newItemMod = newItem.find('.pbuilder_module'); 1496 newItemMod.trigger('refresh'); 1497 newItemMod.find('.frb-swiper-container').height(newItemMod.width() * 400 / 640); 1498 1499 } else { 1500 alert('fail'); 1501 } 1502 }); 1503} 1504 1505// Ajax Load 1506var ajaxLoading = false; 1507function pbtheme_ajaxload_send_woo(currentItem) { 1508 1509 if (ajaxLoading) { 1510 return; 1511 } 1512 ajaxLoading = true; 1513 "use strict"; 1514 var nav = currentItem.parents().eq(4); 1515 var oldItem = nav.next(); 1516 1517 oldItem.parent().parent().parent().css({'overflow': 'hidden'}); 1518 var string = oldItem.parent().attr('data-string'); 1519 1520 var shortData = oldItem.parent().attr('data-shortcode').split('|'); 1521 1522 var direction = currentItem.attr('class'); 1523 1524 var ajaxPage = currentItem.children('.pbtheme_page').text(); 1525 1526 var data = { 1527 action: 'pbtheme_ajaxload_send_woo', 1528 page: ajaxPage, 1529 data: string, 1530 ajax: 'yes', 1531 bot_margin: shortData[0], 1532 title: shortData[1], 1533 columns: shortData[2] 1534 }; 1535 1536 jQuery.post(pbtheme.ajaxurl, data, function (response) { 1537 if (response) { 1538 var content = response.split('@@@!SPLIT!@@@'); 1539 var margin = oldItem.find('.pbuilder_column').css('border-left-width'); 1540 margin = margin.replace('px', ''); 1541 var width = oldItem.width() + 2 * parseInt(margin, 10); 1542 nav.remove(); 1543 oldItem.before(content[0]); 1544 oldItem.after(content[1]); 1545 var newItem = oldItem.next(); 1546 if (direction.indexOf('next') >= 0) { 1547 newItem.css({'position': 'absolute', 'width': 'inherit', 'left': width.toString() + 'px', 'top': '51px'}); 1548 newItem.show(); 1549 TweenLite.to(oldItem, 0.5, {left: '-=' + width.toString(), onComplete: function () { 1550 oldItem.remove(); 1551 }}); 1552 TweenLite.to(newItem, 0.5, {left: '-=' + width.toString(), onComplete: function () { 1553 newItem.css({'position': 'relative', 'left': '0', 'top': '0'}); 1554 ajaxLoading = false; 1555 }}); 1556 jQuery('body').animate({ 1557 scrollTop: newItem.offset().top - 208 1558 }); 1559 } 1560 else { 1561 newItem.css({'position': 'absolute', 'width': 'inherit', 'left': '-' + width.toString() + 'px', 'top': '51px'}); 1562 newItem.show(); 1563 TweenLite.to(oldItem, 0.5, {left: width.toString(), onComplete: function () { 1564 oldItem.remove(); 1565 }}); 1566 1567 TweenLite.to(newItem, 0.5, {left: 0, onComplete: function () { 1568 newItem.css({'position': 'relative', 'left': '0', 'top': '0'}); 1569 ajaxLoading = false; 1570 }}); 1571 jQuery('body').animate({ 1572 scrollTop: newItem.offset().top - 208 1573 }); 1574 } 1575 } else { 1576 alert('fail'); 1577 } 1578 });
1579} 1580 1581// Ajax Load 1582var ajaxLoading = false; 1583function pbtheme_ajaxload_send_woo_cat(currentItem) { 1584 1585 if (ajaxLoading) { 1586 return; 1587 } 1588 ajaxLoading = true; 1589 "use strict"; 1590 var nav = currentItem.parents().eq(4); 1591 var oldItem = nav.next(); 1592 1593 oldItem.parent().parent().parent().css({'overflow': 'hidden'}); 1594 1595 var shortData = oldItem.parent().attr('data-shortcode').split('|'); 1596 1597 var direction = currentItem.attr('class'); 1598 1599 var ajaxPage = currentItem.children('.pbtheme_page').text(); 1600 1601 var data = { 1602 action: 'pbtheme_ajaxload_send_woo_cat', 1603 page: ajaxPage, 1604 ajax: 'yes', 1605 bot_margin: shortData[0], 1606 title: shortData[1], 1607 columns: shortData[2], 1608 per_page: shortData[3], 1609 order: shortData[4], 1610 orderby: shortData[5], 1611 ids: shortData[6] 1612 }; 1613 1614 jQuery.post(pbtheme.ajaxurl, data, function (response) { 1615 if (response) { 1616 var content = response.split('@@@!SPLIT!@@@'); 1617 var margin = oldItem.find('.pbuilder_column').css('border-left-width'); 1618 margin = margin.replace('px', ''); 1619 var width = oldItem.width() + 2 * parseInt(margin, 10); 1620 nav.remove(); 1621 oldItem.before(content[0]); 1622 oldItem.after(content[1]); 1623 var newItem = oldItem.next(); 1624 if (direction.indexOf('next') >= 0) { 1625 newItem.css({'position': 'absolute', 'width': 'inherit', 'left': width.toString() + 'px', 'top': '51px'}); 1626 newItem.show(); 1627 TweenLite.to(oldItem, 0.5, {left: '-=' + width.toString(), onComplete: function () { 1628 oldItem.remove(); 1629 }}); 1630 TweenLite.to(newItem, 0.5, {left: '-=' + width.toString(), onComplete: function () { 1631 newItem.css({'position': 'relative', 'left': '0', 'top': '0'}); 1632 ajaxLoading = false; 1633 }}); 1634 jQuery('body').animate({ 1635 scrollTop: newItem.offset().top - 208 1636 }); 1637 } 1638 else { 1639 newItem.css({'position': 'absolute', 'width': 'inherit', 'left': '-' + width.toString() + 'px', 'top': '51px'}); 1640 newItem.show(); 1641 TweenLite.to(oldItem, 0.5, {left: width.toString(), onComplete: function () { 1642 oldItem.remove(); 1643 }}); 1644 1645 TweenLite.to(newItem, 0.5, {left: 0, onComplete: function () { 1646 newItem.css({'position': 'relative', 'left': '0', 'top': '0'}); 1647 ajaxLoading = false; 1648 }}); 1649 jQuery('body').animate({ 1650 scrollTop: newItem.offset().top - 208 1651 }); 1652 } 1653 } else { 1654 alert('fail'); 1655 } 1656 }); 1657} 1658 1659// Ajax Load 1660var ajaxLoading = false; 1661function pbtheme_ajaxload_portfolio(currentItem) { 1662 1663 if (ajaxLoading) { 1664 return; 1665 } 1666 ajaxLoading = true; 1667 "use strict"; 1668 var data_cat = currentItem.attr('data-cat'); 1669 1670 if (data_cat === undefined) { 1671 var oldItem = currentItem.parents().eq(4).prev().parent(); 1672 } 1673 else { 1674 var oldItem = currentItem.parents().eq(3); 1675 } 1676 1677// 1678// oldItem.css('opacity', '0.33'); 1679 var string = oldItem.attr('data-string'); 1680 1681 var shortData = oldItem.attr('data-shortcode').split('|'); 1682 1683 if (data_cat !== undefined) { 1684 string = string.substring(0, string.indexOf("&cat=")); 1685 if (data_cat == '-1') { 1686 string = string + '&cat=' + shortData[1]; 1687 } 1688 else { 1689 string = string + '&cat=' + data_cat; 1690 } 1691 } 1692 else { 1693 data_cat = shortData[1]; 1694 } 1695 1696 var stringClass = oldItem.attr('class'); 1697 if (stringClass.indexOf('portfolio_content') >= 0) { 1698 var stringClassType = stringClass.replace('portfolio_content ', ''); 1699 var actionSend = 'pbtheme_ajaxload_send_portfolio'; 1700 } 1701 else { 1702 var stringClassType = stringClass.replace('div_portfolio_slider ', '');
1703 var actionSend = 'pbtheme_ajaxload_send_portfolio_alt'; 1704 } 1705 1706 var ajaxPage = currentItem.children('.pbtheme_page').text(); 1707 1708 var data = { 1709 action: actionSend, 1710 page: ajaxPage, 1711 type: stringClassType, 1712 data: string, 1713 ajax: 'yes', 1714 margin: shortData[0], 1715 category: shortData[1], 1716 top_pagination: shortData[2], 1717 top_align: shortData[3], 1718 trans_effect: shortData[4], 1719 data_cat: data_cat, 1720 pagination: shortData[5] 1721 }; 1722 1723 jQuery.post(pbtheme.ajaxurl, data, function (response) { 1724 if (response) { 1725 oldItem.after(response); 1726 var newItem = oldItem.next(); 1727 var colNumb = parseInt(newItem.attr('data-columns')); 1728 newItem.find('.div_ajax_col').css({'display': 'none', 'opacity': 0}); 1729 newItem.css({'display': 'none'}); 1730 oldItem.children(':not(.div_top_nav_wrap)').fadeOut(function () { 1731 portfolioColumnsInit(newItem); 1732 jQuery('body').animate({ 1733 scrollTop: newItem.offset().top - 208 1734 }, 500); 1735 oldItem.remove(); 1736 1737 }); 1738 ajaxLoading = false; 1739 // swipebox 1740 swipeboxInstance = newItem.find('a[rel="lightbox"]').swipebox(); 1741 newItem.find('.pbuilder_module').trigger('refresh'); 1742 } else { 1743 alert('fail'); 1744 } 1745 }); 1746 1747}
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.