1if(typeof window.onYouTubeIframeAPIReady == 'undefined') { 2 window.onYouTubeIframeAPIReady = function() {}; 3 4} 5 function pbuilderYoutube() {}; 6 7(function($){ 8 9 /*$(document).ready(function(){ 10 $('i[class*="ba"]').each(function(){ 11 var reg = /ba/gi; 12 var classes = $(this).attr("class"); 13 classes = classes.replace(reg, "fa"); 14 $(this).attr("class", classes); 15 //$(this).css('font-family', 'FontAwesome'); 16 }); 17 })*/ 18 19 20 $.fn.frb_refresh = function(bodyRefresh){ 21 22 // audio - - start 23 $(this).find('.frb_audio_player').each(function(){ 24 var options = $(this).data('frb_options').split('|'), volume = 1, thisReference = $(this); 25 26 thisReference.find('.frb_mute_button,.frb_muted_button').data('volume',volume); 27 thisReference.find('.frb_mute_button,.frb_muted_button').data('volume'); 28 29 if (options[3]=='true'){$(this).css('display','none');} 30 var duration=0, src_mp3=options[4], src_ogg=options[5], startingTime = parseInt(options[6]), song = thisReference.find('audio')[0]; 31 32 song.preload = 'metadata'; 33 if (song.canPlayType('audio/mpeg;')) { 34 song.type= 'audio/mpeg'; 35 song.src= src_mp3; 36 } else { 37 song.type= 'audio/ogg'; 38 song.src= src_ogg; 39 } 40 41 song.addEventListener('loadedmetadata', function() { 42 duration = song.duration; 43 44 var hours = parseInt( duration / 3600 ) % 24, minutes = parseInt( duration / 60 ) % 60, seconds = Math.ceil(duration % 60), 45 result = (hours!=0 ? (hours < 10 ? "0" + hours + ":" : hours + ":" ) : '' ) + (minutes!=0 ? ( minutes < 10 ? "0" + minutes : minutes) : "00") + ":" + (seconds < 10 ? "0" + seconds : seconds); 46 47 thisReference.find(".frb_full_time").text(result); 48 thisReference.find(".frb_time_slider").slider({ 49 create: function(event, ui) { 50 $(this).slider("option", "value",startingTime); 51 song.currentTime = $(this).slider("option", "value"); 52 }, 53 stop: function( event, ui ) { 54 song.currentTime = $(this).slider("option", "value"); 55 }, 56 change: function(event, ui){ 57 var value = $(this).slider("option", "value"); 58 hours = parseInt( value / 3600 ) % 24; 59 minutes = parseInt( value / 60 ) % 60; 60 seconds = Math.ceil(value % 60); 61 result = (hours!=0 ? (hours < 10 ? "0" + hours + ":" : hours + ":" ) : '' ) + (minutes!=0 ? ( minutes < 10 ? "0" + minutes : minutes) : "00") + ":" + (seconds < 10 ? "0" + seconds : seconds); 62 thisReference.find(".frb_current_time").text(result); 63 }, 64 max: Math.ceil(duration), 65 step: 0.01, 66 range:"min" 67 }); 68 69 70 thisReference.find(".frb_volume_slider").slider({ 71 slide: function(event, ui){ 72 song.volume = $(this).slider("option", "value"); 73 if (song.volume == 0) { 74 thisReference.find('.frb_mute_button, .frb_muted_button').removeClass('frb_mute_button frb_muted_button frb_volume_down').addClass('frb_muted_button'); 75 } else if (song.volume<0.5) { 76 thisReference.find('.frb_mute_button, .frb_muted_button').removeClass('frb_mute_button frb_muted_button frb_volume_down').addClass('frb_mute_button frb_volume_down'); 77 } else { 78 thisReference.find('.frb_mute_button, .frb_muted_button').removeClass('frb_mute_button frb_muted_button frb_volume_down').addClass('frb_mute_button'); 79 } 80 81 }, 82 change: function( event, ui ) { 83 if ($(this).slider("option", "value")!=0) { 84 volume = $(this).slider("option", "value"); 85 thisReference.find('.frb_mute_button,.frb_muted_button').data('volume',volume); 86 } 87 song.volume = $(this).slider("option", "value"); 88 89 if (song.volume == 0) { 90 thisReference.find('.frb_mute_button, .frb_muted_button').removeClass('frb_mute_button frb_muted_button frb_volume_down').addClass('frb_muted_button'); 91 } else if (song.volume<0.5) { 92 thisReference.find('.frb_mute_button, .frb_muted_button').removeClass('frb_mute_button frb_muted_button frb_volume_down').addClass('frb_mute_button frb_volume_down'); 93 } else { 94 thisReference.find('.frb_mute_button, .frb_muted_button').removeClass('frb_mute_button frb_muted_button frb_volume_down').addClass('frb_mute_button'); 95 } 96 }, 97 max: 1, 98 min: 0, 99 step: 0.01, 100 range:"min", 101 value:1 102 }); 103 104 105 var timeBarWidth = thisReference.width()-thisReference.find('.frb_play_button').outerWidth(true)-thisReference.find('.frb_mute_button').outerWidth(true)-thisReference.find('.frb_stop_button').outerWidth(true)-thisReference.find(".frb_volume_slider").outerWidth(true)-85; 106 var timeBarWidthSmall = thisReference.width()-thisReference.find('.frb_play_button').outerWidth(true)-thisReference.find('.frb_stop_button').outerWidth(true)-85; 107 108 if (timeBarWidth>0){ 109 thisReference.find(".frb_time_slider").outerWidth(timeBarWidth); 110 } else { 111 thisReference.find(".frb_time_slider").outerWidth(timeBarWidthSmall); 112 } 113 114 if (options[0]=='true') { 115 thisReference.find('.frb_play_button').removeClass('frb_play_button').addClass('frb_pause_button'); 116 song.autoplay=true; 117 } 118 if (options[1]=='true') {song.loop=true;} 119 if (options[2]=='true') { 120 song.volume=0; 121 thisReference.find('.frb_mute_button').removeClass('frb_mute_button').addClass('frb_muted_button'); 122 thisReference.find('.frb_volume_slider').slider( "option", "value", 0 ); 123 } 124 song.addEventListener('timeupdate',function (){ 125 curtime = parseFloat(song.currentTime); 126 if (!thisReference.find(".frb_time_slider .ui-slider-handle").hasClass('ui-state-active')){ 127 thisReference.find( ".frb_time_slider" ).slider( "option", "value", curtime ); 128 } 129 }); 130 song.addEventListener('ended',function (){ 131 thisReference.find('.frb_pause_button').removeClass('frb_pause_button').addClass('frb_play_button'); 132 thisReference.find(".frb_time_slider" ).slider( "option", "value", 0 ); 133 }); 134 }); 135 }); 136 137 // audio - - end 138 139 $(this).find('.frb_accordion').each(function(){ 140 var collapse = true; 141 var collapseInd = false;
142 var heightStyle; 143 if($(this).attr('data-fixedheight') != 'true') 144 heightStyle = 'content'; 145 else 146 heightStyle = 'auto'; 147 148 $(this).find('h3').each(function(index){ 149 if($(this).hasClass('ui-state-active')) { 150 collapse = false; 151 collapseInd = index; 152 return false; 153 } 154 }); 155 $(this).accordion({ 156 collapsible : collapse, 157 active : collapseInd, 158 heightStyle : heightStyle 159 }); 160 }); 161 $(this).find('.frb_tabs').each(function(){ 162 var hashtag = window.location.hash; 163 if(hashtag != '' && $(this).find(hashtag).length > 0) { 164 $(this).find('ul a.active').removeClass('active'); 165 $(this).find('ul a[href='+hashtag+']').trigger('click'); 166 } 167 else if($(this).find('ul .active').length>0) { 168 $(this).find('ul a.active').removeClass('active').trigger('click'); 169 } 170 else { 171 $(this).find("ul a:first").trigger("click"); 172 } 173 }); 174 175 $(this).find('.frb_tour').each(function(){ 176 var hashtag = window.location.hash; 177 if(hashtag != '' && $(this).find(hashtag).length > 0) { 178 $(this).find('ul a.active').removeClass('active'); 179 $(this).find('ul a[href='+hashtag+']').trigger('click'); 180 } 181 else if($(this).find('ul .active').length>0) { 182 $(this).find('ul a.active').removeClass('active').trigger('click'); 183 } 184 else { 185 $(this).find("ul a:first").trigger("click"); 186 } 187 188 $(this).find(".frb_tour-content").css("min-height", $(this).find("ul:first").height()+"px"); 189 }); 190 191 $(this).find('.frb_toggle').each(function(){ 192 var maxHeight = -1; 193 var itemContent = $(this).find(".frb_toggle_item_content"); 194 195 if ($(this).hasClass('frb_fixed_h')) { 196 maxHeight = itemContent.map(function () 197 { 198 return $(this).height(); 199 }).get(); 200 201 maxHeight = Math.max.apply(null, maxHeight); 202 } 203 204 $(this).find('.frb_toggle_item').each(function(){ 205 206 var itemContent = $(this).children(".frb_toggle_item_content"); 207 if (maxHeight == -1) 208 $(this).data("itemHeight",itemContent.height()); 209 else 210 $(this).data("itemHeight",maxHeight); 211 212 if ($(this).children("input:checked").length != 0 ) 213 itemContent.height($(this).data("itemHeight")+"px").prev().find("i").addClass("fa-minus"); 214 else 215 itemContent.height("0px").prev().find("i").addClass("fa-plus"); 216 }); 217 }); 218 219 //swiper slider 220 221 $(this).find('.frb-swiper-container').each(function(){ 222 if(!$(this).hasClass('initiated')) { 223 $(this).addClass('initiated'); 224 var modid = $(this).closest('.pbuilder_module').attr('data-modid'); 225 var sliderId = $(this).attr('id').replace('_container',''); 226 var options = { 227 pagination: '#'+sliderId+' .frb-swiper-pagination', 228 loop:true, 229 grabCursor: true, 230 slidesPerView: parseInt($(this).attr('data-slidesPerView')), 231 paginationClickable: true, 232 calculateHeight:true, 233 resizeReInit: true, 234 updateOnImagesReady: true, 235 mode: $(this).attr('data-mode') 236 } 237 if(typeof $(this).attr('data-min-res-width') == 'undefined') { 238 $(this).attr('data-min-res-width', 1); 239 } 240 if($(this).attr('data-autoplay') != '') options['autoplay'] = parseInt($(this).attr('data-autoplay')); 241 242 var height = 0; 243 244 $(this).find('.swiper-slide').each(function(){ 245 if (options['mode'] != 'horizontal') { 246 $(this).css('width','100%'); 247 if($(this).height() > height) height = $(this).height()*options['slidesPerView']; 248 $(this).css('height', height+'px'); 249 options['calculateHeight'] = false; 250 } 251 }); 252 253 254 if(typeof bodyRefresh != 'undefined' && bodyRefresh == true) { 255 $('#'+sliderId+' .frb-swiper-container').hide(); 256 $(window).load(function(){ 257 $('#'+sliderId+' .frb-swiper-container').each(function(){ 258 $(this).show(); 259 var mySwiper = new Swiper(this, options); 260 $(this).find('.frb-swiper-nav-left').click(function(){mySwiper.swipePrev()}); 261 $(this).find('.frb-swiper-nav-right').click(function(){mySwiper.swipeNext()}); 262 $(this).data('swiper_controls', mySwiper); 263 frbSliderResponsive($(this)); 264 $(this).find('a[rel^="frbprettyphoto"]').prettyPhoto(); 265 mySwiper.swipeTo(0, 0, false); 266 }); 267 }); 268 } 269 else { 270 $('#'+sliderId+' .frb-swiper-container').each(function(){ 271 var mySwiper = new Swiper(this, options); 272 $(this).find('.frb-swiper-nav-left').click(function(){mySwiper.swipePrev()}); 273 $(this).find('.frb-swiper-nav-right').click(function(){mySwiper.swipeNext()}); 274 $(this).data('swiper_controls', mySwiper); 275 frbSliderResponsive($(this)); 276 $(this).find('a[rel^="frbprettyphoto"]').prettyPhoto(); 277 mySwiper.swipeTo(0, 0, false); 278 }); 279 } 280 } 281 }); 282 if($(this).find('.frb_percentage_bar').attr('data-onscreen') == 'true'){ 283 $(this).find('.frb_percentage_bar').each(function(){ 284 $(this).frbPercentageBars();}); 285 } 286 287 if($(this).attr('data-onscreen') == 'true'){ 288 $(this).find('.frb_scrolling_counter').each(function(){$(this).frbScrollingCounters();}); 289 } 290 if($(this).attr('data-onscreen') == 'true'){ 291 $(this).find('.frb_percentage_chart').frbPercentageChart(); 292 } 293 // gauge 294 if($(this).find('.frb_gauge_chart').attr('data-onscreen') == 'true'){ 295 frbGaugeChartRefresh($(this)); 296 } 297 298 299 contactFormResize(); 300 301 302 frbGalleryInit($(this).find('.frb_gallery_container')); 303 galleryShortcodeRefresh($(this).find('.frb_gallery_container')); 304 305 306 307 $(this).find('a[rel^="frbprettyphoto"]').prettyPhoto(); 308 309 frbScrollAnimations(); 310 } 311 312 313 314 315 var parallaxTimeout; 316 317 $(window).resize(function(){ 318 galleryShortcodeRefresh($('.frb_gallery_container')); 319 $('.frb_percentage_chart').each(function(){$(this).frbPercentageChart();}); 320 }); 321 322 323 324 /* DOCUMENT READY */ 325 $(document).ready(function(){ 326 327 328 if('ontouchstart' in window) { 329 $('#pbuilder_wrapper').addClass('pbuilder_touch'); 330 } 331 332 $(document).on("onscreen", '.frb_percentage_chart', function(){ 333 $(this).frbPercentageChart(); 334 }); 335 336 $(document).on('onscreen', '.frb_scrolling_counter', function(){ 337 $(this).frbScrollingCounters(); 338 $(this).attr('data-onscreen', true); 339 }); 340 341 $(document).on('onscreen', '.frb_percentage_bar', function(){ 342 $(this).frbPercentageBars(); 343 $(this).attr('data-onscreen', true); 344 }); 345 346 $(document).on('onscreen', '.frb_gauge_chart', function(){ 347 frbGaugeChartRefresh($(this).closest('.pbuilder_module')); 348 $(this).attr('data-onscreen', true); 349 }); 350 351 352 $('.pbuilder_module').each(function(){ 353 $(this).frb_refresh(true); 354 });
355 frbParallaxBackground(); 356 if(window.location.hash != '') 357 window.location.hash = window.location.hash; 358 //frbParallax(); 359 360 361 /* FULL WIDTH ROW */ 362 var winW = $(window).width(); 363 var winH = $(window).height(); 364 var rowW = $('#pbuilder_wrapper').width(); 365 $('<style id="pbuilder_dynamic_row_css" type="text/css"> .pbuilder_row.pbuilder_row_full_width{margin:0 '+( (-winW + rowW)/2 - 1500 ) +'px; } .pbuilder_row .pbuilder_row_video > div {width:'+(winW+200)+'px; height:'+(winH+200)+'px; margin:-'+((winH+200)/2)+'px 0 0 -'+((winW+200)/2)+'px !important;} </style>').appendTo('head'); 366 367 368 $(window).resize(function(){ 369 var winW = $(window).width(); 370 var winH = $(window).height(); 371 var rowW = $('#pbuilder_wrapper').width(); 372 $('#pbuilder_dynamic_row_css').html('.pbuilder_row.pbuilder_row_full_width{margin:0 '+( (-winW + rowW)/2 - 1500 )+'px;} .pbuilder_row .pbuilder_row_video > div {width:'+(winW+200)+'px; height:'+(winH+200)+'px; margin:-'+((winH+200)/2)+'px 0 0 -'+((winW+200)/2)+'px !important;} '); 373 }); 374 375 376 $(this).find('.YTPlayer').mb_YTPlayer(); 377 378 379 }); 380 381 $(window).load(function(){ 382 $(this).scrollTop($(this).scrollTop()+1); 383 $(this).scrollTop($(this).scrollTop()-1); 384 }); 385 386 387 /* MODULE REFRESH */ 388 389 $(document).on('refresh','.pbuilder_module', function(){ 390 $(this).frb_refresh(false); 391 }); 392 $(document).on('refresh','.pbuilder_row', function(){ 393 $(this).find('.YTPlayer').mb_YTPlayer(); 394 }); 395 396 $(window).scroll(function(){ 397 frbScrollAnimations(); 398 frbParallaxBackground(); 399 }); 400 401 function frbScrollAnimations() { 402 $('.frb_animated').each(function(){ 403 if(!$(this).hasClass('frb_onScreen') && isScrolledIntoView(this)) { 404 if(typeof $(this).attr('data-agroup') != 'undefined') { 405 $('[data-agroup=' + $(this).attr('data-agroup') + ']').each(function(){ 406 if(typeof $(this).attr('data-adelay') != 'undefined' && parseInt($(this).attr('data-adelay')) != 0) { 407 if(!$(this).hasClass('frb_onScreenDelay')) { 408 $(this).addClass('frb_onScreenDelay'); 409 var $this = $(this); 410 setTimeout(function(){ 411 $this.addClass('frb_onScreen').trigger('onscreen'); 412 }, parseInt($(this).attr('data-adelay'))); 413 } 414 } 415 else { 416 $(this).addClass('frb_onScreen').trigger('onscreen'); 417 } 418 }); 419 } 420 else { 421 if(typeof $(this).attr('data-adelay') != 'undefined' && parseInt($(this).attr('data-adelay')) != 0) { 422 if(!$(this).hasClass('frb_onScreenDelay')) { 423 $(this).addClass('frb_onScreenDelay'); 424 var $this = $(this); 425 setTimeout(function(){ 426 $this.addClass('frb_onScreen').trigger('onscreen'); 427 }, parseInt($(this).attr('data-adelay'))) 428 } 429 } 430 else { 431 $(this).addClass('frb_onScreen').trigger('onscreen'); 432 } 433 434 } 435 } 436 437 }) 438 } 439 function isScrolledIntoView(elem){ 440 if($.fn.scrollBro != 'undefined' && $('.scb_main_wrap').length > 0) { 441 var $wrap = $('.scb_main_wrap'); 442 var docViewTop = $wrap.scrollBro('scrollTop'); 443 var docViewLimit = $(window).height()/1.1; 444 445 var wrapTop = $wrap.offset().top; 446 var elemTop = $(elem).offset().top; 447 448 return ((elemTop <= docViewLimit+wrapTop) && (elemTop >= wrapTop)); 449 } 450 else { 451 var docViewTop = $(window).scrollTop(); 452 var docViewLimit = docViewTop + $(window).height()/1.1; 453 454 var elemTop = $(elem).offset().top; 455 var elemBottom = elemTop + $(elem).height(); 456 457 return ((elemTop <= docViewLimit) && (elemTop >= docViewTop)); 458 } 459 } 460 461 function frbParallaxEvent(){ 462 $('.pbuilder_row_parallax').each(function(){ 463 if(typeof $(this).data('backH') == 'undefined') { 464 var imageSrc = $(this).css('background-image').replace(/url\((['"])?(.*?)\1\)/gi, '$2').split(',')[0]; 465 var image = new Image(); 466 image.src = imageSrc; 467 $(this).data('backH', image.height); 468 } 469 var parallaxPos = (window.myScroll.y/($(this).data('backH') - $(window).height() ))*100 + 50; 470 $(this).css('background-position', '50% '+parallaxPos+'%'); 471 }); 472 } 473 474 function frbParallaxBackground(){ 475 if(!('ontouchstart' in window)) { 476 $('.pbuilder_row_background_parallax, .pbuilder_row_background_fixed').each(function(){ 477 var scrTop = $(window).scrollTop(); 478 var winH = $(window).height(); 479 var elTop = $(this).offset().top;
480 var elH = $(this).height(); 481 var zero = elTop -winH/2 + elH/2; 482 483 if(zero < 0) zero; 484 if($(this).hasClass('pbuilder_row_background_fixed')) { 485 var parallaxPos = scrTop - zero -winH/2 + elH/2; 486 } 487 else { 488 var parallaxPos = (scrTop - zero)*0.6 -winH/2 + elH/2; 489 } 490 491 $(this).find('.pbuilder_row_back_image:first').css({top : parallaxPos, height : winH}); 492 }); 493 } 494 495 } 496 497 498 499 /* AUDIO */ 500 501 $(document).on('click', '.frb_play_button' ,function(e){ 502 e.preventDefault(); 503 $(this).siblings('audio')[0].play(); 504 $(this).removeClass('frb_play_button').addClass('frb_pause_button'); 505 }); 506 507 $(document).on('click', '.frb_pause_button' ,function(e){ 508 e.preventDefault(); 509 $(this).siblings('audio')[0].pause(); 510 $(this).removeClass('frb_pause_button').addClass('frb_play_button'); 511 }); 512 513 $(document).on('click', '.frb_mute_button' ,function(e){ 514 e.preventDefault(); 515 $(this).siblings('audio')[0].volume = 0; 516 $(this).removeClass('frb_mute_button').addClass('frb_muted_button'); 517 $(this).parent().find('.frb_volume_slider').slider( "option", "value", 0 ); 518 }); 519 520 $(document).on('click', '.frb_muted_button' ,function(e){ 521 e.preventDefault(); 522 $(this).siblings('audio')[0].volume=$(this).data('volume'); 523 $(this).removeClass('frb_muted_button').addClass('frb_mute_button'); 524 $(this).parent().find('.frb_volume_slider').slider( "option", "value", $(this).data('volume') ); 525 }); 526 527 $(document).on('click', '.frb_stop_button' ,function(e){ 528 e.preventDefault(); 529 $(this).siblings('audio')[0].pause(); 530 $(this).siblings('audio')[0].currentTime = 0; 531 $(".frb_pause_button").removeClass('frb_pause_button').addClass('frb_play_button'); 532 }); 533 534 /* TABS */ 535 536 $(document).on('click','.frb_tabs ul a', function(e){ 537 e.preventDefault(); 538 if(!$(this).hasClass('active')) { 539 $(this).parent().parent().find('a').removeClass("active"); 540 $(this).addClass('active'); 541 542 var $containter = $(this).closest('.frb_tabs'), 543 tabId = $(this).attr('href'); 544 $containter.children('.frb_tabs-content').stop(true, true).hide(); 545 $containter.find(tabId).fadeIn(); 546 } 547 }); 548 549 550 /* TOGGLE */ 551 552 $(document).on('click','.frb_toggle label', function(e){ 553 var $itemContent = $(this).next(); 554 if ($itemContent.outerHeight()>0) { 555 $itemContent.outerHeight("0px").prev().find("i").removeClass("fa-minus").addClass("fa-plus"); 556 } 557 else { 558 $itemContent.outerHeight($(this).parent().data("itemHeight")+"px").prev().find("i").removeClass("fa-plus").addClass("fa-minus"); 559 } 560 561 }); 562 563 564 /* TOUR */ 565 566 $(document).on('click','.frb_tour ul a', function(e){ 567 e.preventDefault(); 568 if(!$(this).hasClass('active')) { 569 $(this).parent().parent().find('a').removeClass("active"); 570 $(this).addClass('active').parent().next().find("a"); 571 var $containter = $(this).closest('.frb_tour'), 572 tabId = $(this).attr('href'); 573 $containter.children('.frb_tour-content').stop(true, true).hide(); 574 $containter.find(tabId).fadeIn(); 575 } 576 }); 577 578 /* BUTTONS */ 579 580 $(document).on('mouseenter','.frb_button', function(){ 581 var backcolor = $(this).attr('data-hoverbackcolor'); if(backcolor == '') backcolor = 'transparent'; 582 var textcolor = $(this).attr('data-hovertextcolor'); if(textcolor == '') textcolor = 'transparent'; 583 if(!$(this).hasClass('frb_nofill')) 584 $(this).stop(true).animate({backgroundColor: backcolor, color: textcolor},300).find('.frb_button_icon i').stop(true).animate({color: textcolor},300); 585 else 586 $(this).stop(true).animate({borderColor: backcolor, color: textcolor},300).find('.frb_button_icon i').stop(true).animate({color: textcolor},300); 587 }); 588 $(document).on('mouseleave','.frb_button', function(){ 589 var backcolor = $(this).attr('data-backcolor'); if(backcolor == '') backcolor = 'transparent'; 590 var textcolor = $(this).attr('data-textcolor'); if(textcolor == '') textcolor = 'transparent'; 591 if(!$(this).hasClass('frb_nofill')) 592 $(this).stop(true).animate({backgroundColor: backcolor, color: textcolor},300).find('.frb_button_icon i').stop(true).animate({color: textcolor},300); 593 else 594 $(this).stop(true).animate({borderColor: backcolor, color: textcolor},300).find('.frb_button_icon i').stop(true).animate({color: textcolor},300); 595 }); 596 597 598 599 /* FEATURES */ 600 601 $(document).on('mouseenter','.frb_features', function(){ 602 var backColor = $(this).attr('data-hovercolor'); if(backColor == '') backColor = 'transparent'; 603 var titleColor = $(this).find('.frb_features_title').attr('data-hovercolor'); if(titleColor == '') titleColor = 'transparent'; 604 var iconColor = $(this).find('.frb_features_icon').attr('data-hovercolor'); if(iconColor == '') iconColor = 'transparent'; 605 var textColor = $(this).find('.frb_features_content').attr('data-hovercolor'); if(textColor == '') textColor = 'transparent'; 606 607 $(this).find('.frb_features_title').stop(true).animate({color: titleColor},300); 608 $(this).find('.frb_features_icon').stop(true).animate({color: iconColor},300); 609 $(this).find('.frb_features_content').stop(true).animate({color: textColor},300); 610 if(!$(this).hasClass('frb_features_clean')) 611 $(this).stop(true).animate({backgroundColor: backColor},300); 612 }); 613 614 615 /* ICON MENU */ 616 617 $(document).on('mouseenter','.frb_iconmenu_link', function(){ 618 var backColor = $(this).attr('data-backhover'); if(backColor == '') backColor = 'transparent'; 619 var iconColor = $(this).find('i').attr('data-hovercolor'); if(iconColor == '') iconColor = 'transparent'; 620 $(this).find('i').stop(true).animate({color: iconColor},300); 621 $(this).stop(true).animate({backgroundColor: backColor},300); 622 }); 623 $(document).on('mouseleave','.frb_iconmenu_link', function(){ 624 var backColor = $(this).attr('data-backcolor'); if(backColor == '') backColor = 'transparent'; 625 var iconColor = $(this).find('i').attr('data-color'); if(iconColor == '') iconColor = 'transparent'; 626 $(this).find('i').stop(true).animate({color: iconColor},300); 627 $(this).stop(true).animate({backgroundColor: backColor},300); 628 }); 629 630 631 /* SEARCHFORM */ 632 633 $(document).on('focus','.frb_searchform input', function(){ 634 if($(this).val() == $(this).attr('data-value')) $(this).val(''); 635
636 $this = $(this).parent().parent().parent(); 637 var backColor = $this.attr('data-backfocus'); if(backColor == '') backColor = 'transparent'; 638 var borderColor = $this.attr('data-borderfocus'); if(borderColor == '') borderColor = 'transparent'; 639 var textColor = $(this).attr('data-focuscolor'); if(textColor == '') textColor = 'transparent'; 640 641 $this.find('i').stop(true).animate({color: textColor},300); 642 $this.stop(true).animate({backgroundColor: backColor, borderColor : borderColor},300); 643 $(this).stop(true).animate({color: textColor},300); 644 }); 645 $(document).on('blur','.frb_searchform input', function(){ 646 if($(this).val() == '') $(this).val($(this).attr('data-value')); 647 648 $this = $(this).parent().parent().parent(); 649 var backColor = $this.attr('data-backcolor'); if(backColor == '') backColor = 'transparent'; 650 var borderColor = $this.attr('data-bordercolor'); if(borderColor == '') borderColor = 'transparent'; 651 var textColor = $(this).attr('data-color'); if(textColor == '') textColor = 'transparent'; 652 653 $this.find('i').stop(true).animate({color: textColor},300); 654 $this.stop(true).animate({backgroundColor: backColor, borderColor : borderColor},300); 655 $(this).stop(true).animate({color: textColor},300); 656 }); 657 $(document).on('click', '.frb_searchform .frb_searchright', function(){ 658 var $input = $(this).parent().find('input'); 659 if($input.val() != $input.attr('data-value') && $input.val() != ''){ 660 $(this).parent().submit(); 661 } 662 663 }); 664 665 666 /* CONTACT FORM */ 667 668 669 $(document).on('submit', '.frb_contact_form > form', function(e){ 670 e.preventDefault(); 671 var $this = $(this); 672 var sendAllow = true; 673 $this.find('.frb_required').each(function(){ 674 if($(this).val() != '' || $(this).html() != ''){ 675 sendAllow = sendAllow == true ? true : false; 676 $(this).removeClass('frb_req_error'); 677 if($(this).is('input[name="e-mail"]') && ($(this).val().indexOf('@')<0 || $(this).val().indexOf('.')<0)) { 678 sendAllow = false; 679 $(this).addClass('frb_req_error'); 680 } 681 } else { 682 sendAllow = false; 683 $(this).addClass('frb_req_error'); 684 } 685 686 }); 687 688 var $customFieldSelect = $this.find('.frb_input_wrapper input[name="custom"]'), 689 submission = {}, 690 defaults = $this.serializeArray(), 691 customName = $customFieldSelect.length > 0 ? $customFieldSelect.attr('placeholder') : null; 692 responseText = $('.frb_contact_response').attr('data-text'); 693 694 submission = {'action' : 'pbuilder_contact_form', 'defaults' :defaults, 'customname' : customName, 'response' : responseText, 'recipient_email' : $this.data('email'), 'recipient_name' : $this.data('name')}; 695 if(sendAllow){ 696 var tempVal = $this.find('.frb_contact_submit > input').val(), 697 $submitSel = $this.find('.frb_contact_submit > input'); 698 699 $submitSel.attr('value', $submitSel.attr('data-proc-val')); 700 $.post(ajaxurl, submission).done(function(){ 701 $this.children(':not(.frb_contact_form_overlay)').animate({opacity : 0.4},400); 702 $this.find('.frb_contact_form_overlay').show().animate({opacity: 1}, 400); 703 setTimeout(function(){ 704 $this.children(':not(.frb_contact_form_overlay)').animate({opacity : 1},400); 705 $this.find('.frb_contact_form_overlay').animate({opacity: 0}, 400, function(){$(this).hide();}); 706 $submitSel.attr('value', tempVal); 707 }, $this.data('responseDelay')); 708 709 }); 710 } 711 }); 712 713 $(window).resize(function(){ 714 contactFormResize(); 715 }); 716 717 function contactFormResize(){ 718 $('.frb_contact_form').each(function(){ 719 var $this = $(this), 720 $inputWrap = $this.find('.frb_input_wrapper'), 721 inputCount = $this.find('.frb_input_wrapper input').length, 722 maxItems = Math.floor($this.width()/190), 723 maxItems = maxItems < 1 ? 1 : maxItems; 724 725 if(inputCount == 3) {$inputWrap.css('width', '33.3333%');} 726 if(inputCount%4 == 0 && maxItems >= 2 && maxItems < inputCount) { 727 $inputWrap.removeClass('frb_fullw').addClass('frb_halfw'); 728 } else if(maxItems < inputCount){ 729 $inputWrap.removeClass('frb_halfw').addClass('frb_fullw'); 730 } else {$inputWrap.removeClass('frb_halfw frb_fullw');} 731 732 733 }); 734 } 735 736 737 738 739 /* IMAGE */ 740 741 $(document).on('mouseenter','.frb_image a', function(){ 742 // $(this).find('.frb_image_hover').stop(true).animate({opacity:$(this).find('.frb_image_hover').attr('data-transparency')},300); 743 $(this).find('i.fawesome, i.frb_icon').stop(true).animate({opacity:1},300);
744 $this = $(this).parent(); 745 746 var borderColor = $this.find('.frb_image_inner').attr('data-borderhover'); if(borderColor == '') borderColor = 'transparent'; 747 $this.find('.frb_image_inner').stop(true).animate({borderColor:borderColor},300); 748 749 if($this.find('.frb_image_desc').length >0) { 750 var backColor = $this.find('.frb_image_desc').attr('data-backhover'); if(backColor == '') backColor = 'transparent'; 751 var descColor = $this.find('.frb_image_desc').attr('data-hovercolor'); if(descColor == '') descColor = 'transparent'; 752 $this.find('.frb_image_desc').stop(true).animate({backgroundColor:backColor, color:descColor},300); 753 } 754 755 }); 756 $(document).on('mouseleave','.frb_image a', function(){ 757 // $(this).find('.frb_image_hover').stop(true).animate({opacity:0},300); 758 $(this).find('i.fawesome, i.frb_icon').stop(true).animate({opacity:0},300); 759 var borderColor = $this.find('.frb_image_inner').attr('data-bordercolor'); if(borderColor == '') borderColor = 'transparent'; 760 $this.find('.frb_image_inner').stop(true).animate({borderColor:borderColor},300); 761 762 if($this.find('.frb_image_desc').length >0) { 763 var descColor = $this.find('.frb_image_desc').attr('data-color'); if(descColor == '') descColor = 'transparent'; 764 var backColor = $this.find('.frb_image_desc').attr('data-backcolor'); if(backColor == '') backColor = 'transparent'; 765 $this.find('.frb_image_desc').stop(true).animate({backgroundColor:backColor,color:descColor},300); 766 } 767 }); 768 769 770 /* NAV MENU */ 771 772 $(document).on('mouseenter','.frb_menu li', function(){ 773 var $mainlist = $(this); 774 var submenu = false; 775 while(!$mainlist.hasClass('frb_menu')) { 776 if($mainlist.hasClass('sub-menu')) submenu = true; 777 $mainlist = $mainlist.parent(); 778 } 779 var textColor = $mainlist.attr('data-textcolor'); if(textColor == '') textColor = 'transparent'; 780 var subTextColor = $mainlist.attr('data-subtextcolor'); if(subTextColor == '') subTextColor = 'transparent'; 781 var hoverColor = $mainlist.attr('data-hovercolor'); if(hoverColor == '') hoverColor = 'transparent'; 782 var hoverTextColor = $mainlist.attr('data-hovertextcolor'); if(hoverTextColor == '') hoverTextColor = 'transparent'; 783 784 if($mainlist.hasClass('frb_menu_horizontal-clean') || $mainlist.hasClass('frb_menu_horizontal-squared') || $mainlist.hasClass('frb_menu_horizontal-rounded')) { 785 if(submenu) $(this).children('a').stop(true).animate({color : hoverColor}, 300); 786 else $(this).children('a').stop(true).animate({color : hoverTextColor, backgroundColor: hoverColor}, 300); 787 788 if($(this).children('ul').length > 0) { 789 $(this).children('ul').stop(true).show().animate({marginTop:'10px', opacity:1}, 300); 790 } 791 } 792 else if($mainlist.hasClass('frb_menu_vertical-clean') || $mainlist.hasClass('frb_menu_vertical-squared') || $mainlist.hasClass('frb_menu_vertical-rounded')) { 793 if(submenu) { 794 $(this).children('a').stop(true).animate({color : textColor}, 300); 795 } 796 else { 797 $(this).stop(true).animate({backgroundColor: hoverColor}, 300); 798 $(this).children('a').stop(true).animate({color : hoverTextColor}, 300); 799 $(this).find('ul a').stop(true).animate({color : hoverTextColor}, 300); 800 } 801 } 802 else { 803 $(this).children('a').stop(true).animate({color : hoverTextColor, backgroundColor: hoverColor}, 300); 804 } 805 }); 806 807 808 $(document).on('mouseleave','.frb_menu li', function(){ 809 var $mainlist = $(this); 810 var submenu = false; 811 while(!$mainlist.hasClass('frb_menu')) { 812 if($mainlist.hasClass('sub-menu')) submenu = true; 813 $mainlist = $mainlist.parent(); 814 } 815 var textColor = $mainlist.attr('data-textcolor'); if(textColor == '') textColor = 'transparent'; 816 var subTextColor = $mainlist.attr('data-subtextcolor'); if(subTextColor == '') subTextColor = 'transparent'; 817 var hoverColor = $mainlist.attr('data-hovercolor'); if(hoverColor == '') hoverColor = 'transparent'; 818 var hoverTextColor = $mainlist.attr('data-hovertextcolor'); if(hoverTextColor == '') hoverTextColor = 'transparent'; 819 820 if($mainlist.hasClass('frb_menu_horizontal-clean') || $mainlist.hasClass('frb_menu_horizontal-squared') || $mainlist.hasClass('frb_menu_horizontal-rounded')) { 821 if(submenu) $(this).children('a').stop(true).animate({color : subTextColor}, 300); 822 else $(this).children('a').stop(true).animate({color : textColor, backgroundColor: 'transparent'}, 300); 823 824 if($(this).children('ul').length > 0) { 825 $(this).children('ul').stop(true).animate({marginTop:'0px', opacity:0}
825, 300, function(){ $(this).hide(); }); 826 } 827 } 828 else if($mainlist.hasClass('frb_menu_vertical-clean') || $mainlist.hasClass('frb_menu_vertical-squared') || $mainlist.hasClass('frb_menu_vertical-rounded')) { 829 if(submenu) { 830 $(this).children('a').stop(true).animate({color : subTextColor}, 300); 831 } 832 else { 833 $(this).stop(true).animate({backgroundColor: 'transparent'}, 300); 834 $(this).children('a').stop(true).animate({color : textColor}, 300); 835 } 836 } 837 else { 838 $(this).children('a').stop(true).animate({color : subTextColor, backgroundColor: 'transparent'}, 300); 839 } 840 }); 841 842 $(document).on('click','.frb_menu_container[class*="dropdown"] .frb_menu_header', function(){ 843 if(!$(this).hasClass('active')) { 844 $(this).addClass('active'); 845 $(this).parent().find('ul.frb_menu').stop(true).show().animate({marginTop:'10px', opacity:1}, 300); 846 } 847 else { 848 $(this).removeClass('active'); 849 $(this).parent().find('ul.frb_menu').stop(true).animate({marginTop:'0px', opacity:0}, 300, function(){ $(this).hide(); }); 850 } 851 }); 852 853 854 /* PRICING TABLE */ 855 856 $(document).on('click','.frb_pricing_controls a', function(e){ 857 e.preventDefault(); 858 var $cont = $(this).closest('.frb_pricing_container'); 859 var $ctrl = $(this).closest('.frb_pricing_controls'); 860 if(typeof $cont.data('slide') == 'undefined') $cont.data('slide',0); 861 if($(this).hasClass('frb_pricing_left') && $cont.data('slide') !=0 ) { 862 $cont.data('slide',$cont.data('slide')-1); 863 $cont.find('table').stop(true).animate({'margin-left':(-$cont.data('slide')*100)+'%'},300); 864 } 865 else if($(this).hasClass('frb_pricing_right') && $cont.data('slide') != parseInt($cont.attr('data-colnum'))-1 ) { 866 $cont.data('slide',$cont.data('slide')+1); 867 $cont.find('table').stop(true).animate({'margin-left':(-$cont.data('slide')*100)+'%'}, 300); 868 } 869 }); 870 $(window).resize(function(){ 871 872 if ($('.frb_charts_wrapper canvas').length > 0) { 873 $('.frb_charts_wrapper').each(function(ind){ 874 if ($(this).hasClass('frb_onScreen')) { 875 $(this).parent().parent().frbChartsDraw(); 876 $(this).attr('data-onscreen', true); 877 } 878 }); 879 } 880 if ($('.frb_graph_wrapper canvas').length > 0) { 881 $('.frb_graph_wrapper').each(function(ind){ 882 if ($(this).hasClass('frb_onScreen')) { 883 $(this).parent().parent().frbGraphDraw(); 884 $(this).attr('data-onscreen', true); 885 } 886 }); 887 } 888 }); 889 890 $('.pbuilder_row').on('row_width_change', function() { 891 contactFormResize(); 892 if ($(this).find('.frb_charts_wrapper canvas').length > 0) { 893 $(this).find('.frb_charts_wrapper').each(function(ind){ 894 if ($(this).hasClass('frb_onScreen')) { 895 $(this).parent().parent().frbChartsDraw(); 896 $(this).attr('data-onscreen', true); 897 } 898 }); 899 } 900 if ($(this).find('.frb_graph_wrapper canvas').length > 0) { 901 $(this).find('.frb_graph_wrapper').each(function(ind){ 902 if ($(this).hasClass('frb_onScreen')) { 903 $(this).parent().parent().frbGraphDraw(); 904 $(this).attr('data-onscreen', true); 905 } 906 }); 907 } 908 }); 909 910// Gallery 911 912 913$(document).on('click', '.frb_gallery_hover', function(){ 914 var href = $(this).siblings('.frb_gallery_new_tab_link').attr('href'); 915 if(typeof href != 'undefined') { 916 window.open(href,'_blank'); 917 } else { 918 $(this).siblings('a[rel^="frbprettyPhoto"]').trigger('click'); 919 } 920}); 921 922function frbGalleryInit($this) { 923 $this.each(function(){ 924 925 var categories_height = 0; 926 if ($(this).find('.frb_gallery_categories').length!=0) 927 var categories_height = $(this).find('.frb_gallery_categories').outerHeight(true); 928 var itemPaddingTop = parseInt($(this).find('.frb_media_file').first().css("padding-top")); 929 930 //$(this).find('.frb_gallery_inner').css('top',categories_height-itemPaddingTop); 931 $(this).find('.frb_gallery_cat').each(function(index){ 932 $(this).click(function(e){ 933 e.preventDefault(); 934 $(this).siblings().removeClass('frb_cat_active'); 935 $(this).addClass('frb_cat_active'); 936 $(this).closest('.frb_gallery_container').find('.frb_media_file').removeClass('frb_cat_active'); 937 938 if (index==0 ) { 939 if ($(this).attr('href')=='All') 940 $(this).closest('.frb_gallery_container').find('.frb_gallery_inner').isotope({filter: '.frb_media_file'}); 941 else 942 $(this).closest('.frb_gallery_container').find('.frb_gallery_inner').isotope({filter: '.frb_gallery_cat_0'}); 943 } 944 else { 945 if ($(this).siblings().first().attr('href')=='All') 946 $(this).closest('.frb_gallery_container').find('.frb_gallery_inner').isotope({filter: '.frb_gallery_cat_'+(index-1)}); 947 else 948 $(this).closest('.frb_gallery_container').find('.frb_gallery_inner').isotope({filter: '.frb_gallery_cat_'+index}); 949 } 950 951 952 }); 953 }); 954 955 }); 956 957} 958 959function galleryShortcodeRefresh($this) { 960 961 $this.each(function(){ 962 963 $(this).find('.frb_cat_active').last().siblings().removeClass('frb_cat_active');//fail safe da samo jedna klasa bude active 964 965 var index = $(this).find('.frb_cat_active').last().index('.frb_gallery_cat');//indeks aktivne klase ili -1 ako nije nadjena 966 967 var numOfCats = $('.frb_gallery_cat').length; 968 969 var aspect_ratio = $(this).data('frb_aspect_ratio'); 970 var width = $(this).width(); 971 var itemWidth = $(this).find('.frb_media_file').width(); 972 var itemHeight = 0; 973 974 switch(aspect_ratio) { 975 case '4:3': 976 itemHeight = itemWidth/1.33; 977 break; 978 case '16:9': 979 itemHeight = itemWidth/1.78; 980 break; 981 case '16:10': 982 itemHeight = itemWidth/1.6; 983 break; 984 case '1:2': 985 itemHeight = itemWidth*2; 986 break; 987 default: 988 itemHeight = itemWidth; 989 } 990 991 992 $(this).find('.frb_media_file, .frb_media_file_inner, .frb_media_file_inner video').height(itemHeight+"px"); 993 994 $(this).find('.frb_media_file_inner img').each(function(){ 995 var picWidth = $(this).attr('width'); 996 var picHeight = $(this).attr('height'); 997 $(this).css({'margin-left' : (itemWidth-picWidth)/2, 'margin-top' : (itemHeight - picHeight)/2}); 998 }); 999 1000 //$(this).find('.frb_gallery_inner').isotope({itemSelector: '.frb_media_file'}); 1001 1002 if (numOfCats!=0) { 1003 if (index==0 ) { 1004 if ($(this).attr('href')=='All') 1005 $(this).find('.frb_gallery_inner').isotope({filter: '.frb_media_file'}); 1006 else 1007 $(this).find('.frb_gallery_inner').isotope({filter: '.frb_gallery_cat_0'}); 1008 } 1009 else { 1010 if ($(this).siblings().first().attr('href')=='All') 1011 $(this).find('.frb_gallery_inner').isotope({filter: '.frb_gallery_cat_'+(index-1)}); 1012 else 1013 $(this).find('.frb_gallery_inner').isotope({filter: '.frb_gallery_cat_'+index}); 1014 } 1015 1016 if ($(this).find('.frb_cat_active').length > 0) 1017 $(this).find('.frb_cat_active').trigger('click'); 1018 else 1019 $(this).find('.frb_gallery_inner').isotope({filter: '.frb_media_file'}); 1020 1021 } else { 1022 $(this).find('.frb_gallery_inner').isotope({filter: '.frb_media_file'}); 1023 } 1024 1025 1026 }); 1027 1028 1029} 1030
1031 /* SLIDER */ 1032 1033 $(document).on('mousedown touchstart', '.frb-swiper-container .frb_lightbox_link', function(e){ 1034 var date = new Date(); 1035 $(this).data({'time' : date.getTime()}); 1036 $(this).off('click'); 1037 e.preventDefault(); 1038 }); 1039 1040 $(document).on('mouseup touchend', '.frb-swiper-container .frb_lightbox_link', function(e){ 1041 $(this).on('click', function(e){ 1042 e.preventDefault(); 1043 }); 1044 var date = new Date(); 1045 e.preventDefault(); 1046 var oldTime = $(this).data('time'); 1047 if(date.getTime() - oldTime < 150) { 1048 $(this).prettyPhoto(); 1049 } 1050 }); 1051 1052 $(window).resize(function(){ 1053 $('.frb-swiper-container').each(function(){ 1054 frbSliderResponsive($(this)); 1055 }); 1056 }); 1057 1058 $(document).on("row_width_change", ".pbuilder_row", function() { 1059 $(this).find('.frb-swiper-container').each(function(){ 1060 frbSliderResponsive($(this)); 1061 }); 1062 }); 1063 1064 1065 function frbSliderResponsive($this) { 1066 var swp = $this.data('swiper_controls'), 1067 calcSPV, 1068 minWidth = parseInt($this.attr('data-min-res-width')), 1069 moduleWidth = $this.closest('.pbuilder_module').width(), 1070 SPV = parseInt($this.attr('data-slidesPerView')), 1071 maxSPV = Math.floor(moduleWidth/minWidth); 1072 1073 1074 calcSPV = SPV > maxSPV ? maxSPV : SPV; 1075 if(typeof swp != 'undefined' && swp.params.mode == 'horizontal') { 1076 swp.params.slidesPerView=calcSPV; 1077 swp.reInit(); 1078 } 1079 1080 1081 var height = 0, hgt = 0; 1082 $this.find('.swiper-slide').each(function(){ 1083 var content_height = $(this).children().first().innerHeight(); 1084 1085 if (typeof swp != 'undefined' && swp.params.mode != 'horizontal') { 1086 $(this).height(content_height); 1087 $(this).css('width','100%'); 1088 if($(this).height() > height) height = $(this).height(); 1089 } else if (typeof swp != 'undefined' && swp.params.mode == 'horizontal') { 1090 hgt = hgt < $(this).children().outerHeight(true) ? $(this).children().outerHeight(true) : hgt; 1091// $this.height(hgt); 1092 1093 } 1094 }); 1095 1096 if (typeof swp != 'undefined' && swp.params.mode != 'horizontal') { 1097 $this.css('height', height*swp.params.slidesPerView+'px'); 1098 $this.find('.swiper-slide').each(function(){ 1099 $(this).height(height); 1100 }); 1101 } 1102 if(typeof swp != 'undefined') {swp.reInit();} 1103 } 1104 1105 /* CREATIVE POST SLIDER */ 1106 1107 $(document).on('click', '.frb_creative_link_icon', function(){ 1108 $(this).siblings('.frb_creative_post_slider_img_wrapper').trigger('click'); 1109 }); 1110 1111 $(document).on('mousedown touchstart', '.frb_creative_post_slider_img_wrapper[rel^="frbprettyphoto"]', function(e){ 1112 var date = new Date(); 1113 $(this).data({'time' : date.getTime()}); 1114 $(this).off('click'); 1115 e.preventDefault(); 1116 }); 1117 1118 $(document).on('mouseup touchend', '.frb_creative_post_slider_img_wrapper[rel^="frbprettyphoto"]', function(e){ 1119 $(this).on('click', function(e){ 1120 e.preventDefault(); 1121 }); 1122 var date = new Date(); 1123 e.preventDefault(); 1124 var oldTime = $(this).data('time');
1125 if(date.getTime() - oldTime < 120) { 1126 $(this).prettyPhoto(); 1127 } 1128 }); 1129 1130 1131 $(document).on('mouseenter', '.frb_creative_post_slide_inner', function(){ 1132 var $this = $(this); 1133 if(!$this.hasClass('frb_record')) { 1134 $this.addClass('frb_record').attr('data-height', $this.children('.frb_creative_post_slider_hover').outerHeight()); 1135 $this.children('.frb_creative_post_slider_hover').css('bottom', -$this.children('.frb_creative_post_slider_hover').outerHeight()); 1136 } 1137 $this.children('.frb_creative_post_slider_hover').stop(true).animate({'bottom' : 0}, 250); 1138 $this.children('.frb_creative_post_slider_img_wrapper').stop(true).animate({'top' : -40}, 250); 1139 1140 var iconPos = ($(this).closest('.frb_creative_post_slider_container').height() - parseInt($(this).attr('data-height'))-parseInt($(this).closest('.frb_creative_post_slider_container').attr('data-icnh')))/2; 1141 $(this).closest('.frb_creative_post_slider_container').data('iconPos', iconPos); 1142 $this.children('.frb_creative_link_icon').stop(true).animate({'top' : $(this).closest('.frb_creative_post_slider_container').data('iconPos')}, 250); 1143 1144 }); 1145 1146 $(document).on('mouseleave', '.frb_creative_post_slide_inner', function(){ 1147 $(this).children('.frb_creative_post_slider_hover').stop(true).animate({'bottom' : -parseInt($(this).attr('data-height'))}, 250); 1148 $(this).children('.frb_creative_post_slider_img_wrapper').stop(true).animate({'top' : 0}, 250); 1149 var iconPos = ($(this).closest('.frb_creative_post_slider_container').height()+parseInt($(this).closest('.frb_creative_post_slider_container').attr('data-icnh'))); 1150 $(this).children('.frb_creative_link_icon').stop(true).animate({'top' : iconPos}, 250); 1151 }); 1152 1153 $(window).resize(function(){ 1154 $('.frb_creative_post_slide_inner.frb_record').attr('data-height', $('.frb_creative_post_slide_inner.frb_record > .frb_creative_post_slider_hover').outerHeight()) 1155 $('.frb_creative_post_slide_inner.frb_record > .frb_creative_post_slider_hover').css('bottom', -$('.frb_creative_post_slide_inner.frb_record > .frb_creative_post_slider_hover').outerHeight()); 1156 }); 1157 1158 $('.pbuilder_row').on('row_width_change', function() { 1159 if($(this).find('.frb_creative_post_slider_container').length > 0) { 1160 $(this).find('.frb_creative_post_slide_inner.frb_record').attr('data-height', $(this).find('.frb_creative_post_slide_inner.frb_record > .frb_creative_post_slider_hover').children('.frb_creative_post_slider_hover').outerHeight()); 1161 $(this).find('.frb_creative_post_slide_inner.frb_record > .frb_creative_post_slider_hover').css('bottom', -$(this).find('.frb_creative_post_slide_inner.frb_record > .frb_creative_post_slider_hover').outerHeight()); 1162 } 1163 }); 1164 1165 1166 $(document).ready(function(){ 1167 $('.frb_creative_post_slider_container').each(function(){ 1168 frbCreativePostSlider($(this)); 1169 }); 1170 }); 1171 1172 $(document).on('refresh', '.pbuilder_module', function(){ 1173 if($(this).find('.frb_creative_post_slider_container').length > 0) { 1174 frbCreativePostSlider($(this).find('.frb_creative_post_slider_container')); 1175 } 1176 }); 1177 1178 $(window).resize(function(){ 1179 $('.frb_creative_post_slider_container').each(function(){ 1180 frbCreativePostSliderResize($(this)); 1181 }); 1182 }); 1183 1184 $(document).on("row_width_change", ".pbuilder_row", function() { 1185 $(this).find('.frb_creative_post_slider_container').each(function(){ 1186 frbCreativePostSliderResize($(this)); 1187 }); 1188 }); 1189 1190 function frbCreativePostSlider($this){ 1191 var settings = {}; 1192 settings['spv'] = parseInt($this.attr('data-spv')); 1193 settings['asr'] = $this.attr('data-asr'); 1194 settings['rref'] = parseInt($this.attr('data-rref')); 1195 settings['ratio'] = parseInt(settings['asr'].split(':')[1])/parseInt(settings['asr'].split(':')[0]); 1196 settings['swiper'] = $this.swiper({ 1197 mode:'horizontal', 1198 loop: true, 1199 slidesPerView: settings['spv'], 1200 resizeReInit : true, 1201 wrapperClass : 'frb_creative_post_slider_wrapper', 1202 slideClass: 'frb_creative_post_slide', 1203 preventLinks : true, 1204 preventLinksPropagation : true 1205 }); 1206 $this.data('settings', settings); 1207 1208 $this.height($this.find('.frb_creative_post_slide:first').width()*settings['ratio']); 1209 $this.find('.frb_creative_post_slide').height($this.height()); 1210 frbCpsImageCentering($this, $this.find('img.wp-post-image')); 1211 1212 var iconPos = ($this.height()+parseInt($this.attr('data-icnh'))); 1213 $this.find('.frb_creative_link_icon').css({'top' : iconPos}); 1214 $('.frb_creative_post_slider_img_wrapper[rel^="frbprettyphoto"]').prettyPhoto(); 1215 } 1216 1217 function frbCreativePostSliderResize($this){ 1218 var settings = $this.data('settings'), calculatedNum = Math.floor($this.width()/settings['rref']); 1219 settings['spvRecalc'] = calculatedNum >
1219 settings['spv'] ? settings['spv'] : calculatedNum; 1220 settings['spvRecalc'] = settings['spvRecalc'] < 1 ? 1 : settings['spvRecalc']; 1221 settings['swiper'].params.slidesPerView=settings['spvRecalc']; 1222 settings['swiper'].reInit(); 1223 $this.height($this.find('.frb_creative_post_slide:first').width()*settings['ratio']); 1224 $this.find('.frb_creative_post_slide').height($this.height()); 1225 var iconPos = ($this.height()+parseInt($this.attr('data-icnh'))); 1226 $this.data('iconPos', iconPos); 1227 settings['swiper'].setWrapperTranslate(0,0,0); 1228 frbCpsImageCentering($this, $this.find('img.wp-post-image')); 1229 } 1230 1231 function frbCpsImageCentering($wrpThis, $cThis) { 1232 var width = parseInt($cThis.attr('width')), 1233 height = parseInt($cThis.attr('height')), 1234 wrpWidth = parseInt($cThis.closest('.frb_creative_post_slide').css('width')), 1235 wrpHeight =parseInt($wrpThis.css('height')); 1236 $cThis.css({'margin-left' : (wrpWidth-width)/2, 'margin-top' : (wrpHeight - height)/2}); 1237 } 1238 1239 1240// COUNTER 1241 1242$.fn.frbScrollingCounters = function() { 1243 var $this = $(this), rawResultStr = $this.attr('data-result'), rawResult = parseInt(rawResultStr), tempResult = rawResult, curPosVal, fSize = parseInt($this.css('font-size')), rawStartStr = $this.attr('data-startval'), rawStart = parseInt(rawStartStr), tempStart = rawStart, lengthFactor, difference = rawStart - rawResult, directionControl = $this.attr('data-direction'); 1244 $this.css({'height' : fSize+'px', 'line-height' : fSize+'px'}); 1245 $this.append('<div class="frb_clear" />'); 1246 if(directionControl =='' || typeof directionControl == 'undefined'){directionControl = 'auto'} 1247 if(rawResultStr.length >
1247 rawStartStr.length){lengthFactor = rawResultStr.length;} else {lengthFactor = rawStartStr.length;} 1248 if(difference > 0 && directionControl == 'auto') {directionControl = 'upward';} else if(difference <= 0 && directionControl == 'auto') {directionControl = 'downward';} 1249 for (i=0; i<lengthFactor; i++) { 1250 var curPosVal = tempResult%10; 1251 tempResult = Math.floor(tempResult/10); 1252 curPosStart = tempStart%10; 1253 if(curPosStart < 1){curPosStart = 0;} 1254 tempStart = Math.floor(tempStart/10); 1255 scrlCounterDigitSetup($this, curPosVal, curPosStart, difference, directionControl); 1256 } 1257 1258 $this.children('.frb_scrl_count_digit_wrap').each(function(){ 1259 scrlDigitAnimate($(this), fSize, directionControl); 1260 }); 1261} 1262 1263function scrlCounterDigitSetup($scrlSel, CPV, CPS, difference, directionControl) { 1264 $scrlSel.prepend('<div class="frb_scrl_count_digit_wrap" />'); 1265 if(directionControl == 'upward'){ 1266 var transite = CPS; 1267 while (transite != CPV) { 1268 $scrlSel.children('.frb_scrl_count_digit_wrap:first').append('<div>'+transite+'</div>'); 1269 transite++; 1270 if(transite > 9) {transite = 0;} 1271 } 1272 $scrlSel.children('.frb_scrl_count_digit_wrap:first').append('<div>'+transite+'</div>'); 1273 } 1274 if(directionControl == 'downward'){ 1275 var transite = CPS; 1276 while (transite != CPV) { 1277 $scrlSel.children('.frb_scrl_count_digit_wrap:first').prepend('<div>'+transite+'</div>'); 1278 transite--; 1279 if(transite < 0) {transite = 9;} 1280 } 1281 $scrlSel.children('.frb_scrl_count_digit_wrap:first').prepend('<div>'+transite+'</div>'); 1282 } 1283 $scrlSel.children('.frb_scrl_count_digit_wrap:first').append('<div class="frb_clear" />'); 1284} 1285 1286function scrlDigitAnimate($digitSel, fSize, directionControl) { 1287 var targetTop = fSize - $digitSel.height(); 1288 if(directionControl == 'upward'){ 1289 $digitSel.each(function(){ 1290 $(this).css('top', 0).animate({'top' : targetTop}, 2000);; 1291 }); 1292 } 1293 if(directionControl == 'downward'){ 1294 $digitSel.each(function(){ 1295 $(this).css('top', targetTop).animate({'top' : 0}, 2000);; 1296 }); 1297 } 1298} 1299 1300// CHARTS 1301 1302$.fn.frbPercentageBars = function() { 1303 var $bar = $(this).find('.frb_pbar_line'), 1304 $pin = $(this).find('.frb_pbar_pin'), 1305 wrapWidth = $(this).find('.frb_pbar_single_bar_wrapper').width(), 1306 pinWidth = $pin.eq(0).outerWidth(), 1307 numberOfBars = $(this).find('.frb_pbar_single_bar_wrapper').length, 1308 target = [], 1309 speed = [], 1310 direction = [], 1311 dest = []; 1312 1313 target = $(this).attr('data-percentage').split('|'); 1314 speed = $(this).attr('data-aspd').split('|'), 1315 direction = $(this).attr('data-dir').split('|'); 1316 1317 for(i=0; i< numberOfBars; i++) { 1318 dest[i] = {}; 1319 dest[i] = direction[i] == "rtl" ? {'right' : wrapWidth*Math.abs(parseInt(target[i]))/100 - pinWidth/2} : {'left' : wrapWidth*Math.abs(parseInt(target[i]))/100 - pinWidth/2}; 1320 $bar.eq(i).stop(true).animate({'width' : Math.abs(parseInt(target[i]))+'%'}, parseInt(speed[i])); 1321 $pin.eq(i).html('<span>'+Math.abs(parseInt(target[i]))+'%</span>').stop(true).animate(dest[i], parseInt(speed[i]), function(){ 1322 $(this).closest('.frb_pbar_single_bar_wrapper').find('h5').stop(true).animate({opacity : 1}, 300); 1323 $(this).children('span').stop(true).animate({opacity : 1}, 300); 1324 }); 1325 } 1326} 1327 1328$.fn.frbPercentageChart = function() { 1329 var $this = $(this), width = $this.width(), rad = parseInt($this.attr('data-radius')); 1330 if(width < rad) { 1331 $this.find('.frb_perchart_canvas, .frb_perchart_bg').attr({'width' : $this.innerWidth(), 'height' : $this.innerWidth()}); 1332 $this.find('.frb_perchart_percent').height($this.innerWidth()); 1333 frbPercentageChartDraw($this); 1334 } else { 1335 $this.find('.frb_perchart_canvas, .frb_perchart_bg').attr({'width' : rad, 'height' : rad}); 1336 $this.find('.frb_perchart_percent').height(rad); 1337 frbPercentageChartDraw($this); 1338 } 1339} 1340 1341function frbPercentageChartDraw($this) { 1342 var percent = parseInt($this.attr('data-percent')), cut = 98 - parseInt($this.attr('data-linewidth')), clr = $this.attr('data-barcolor'), bgClr = $this.attr('data-bgcolor'), dgnt = [{value: percent, color:clr}, {value: 100-percent, color:"transparent"}]; 1343 var myChart = new Chart($this.find('.frb_perchart_canvas').get(0).getContext("2d")).Doughnut(dgnt, { 1344 percentageInnerCutout : cut, 1345 segmentShowStroke : false, 1346 animationEasing : "easeOutQuad", 1347 animationSteps : 75, 1348 segmentStrokeColor : "transparent", 1349 onAnimationComplete : function(){ 1350 $this.find('.frb_perchart_percent').animate({opacity : 1}, 300); 1351 } 1352 }); 1353 var myChart = new Chart($this.find('.frb_perchart_bg').get(0).getContext("2d")).Doughnut([{value: 100, color:bgClr}], { 1354 percentageInnerCutout : cut, 1355 segmentShowStroke : false, 1356 animation : false, 1357 segmentStrokeColor : "transparent" 1358 }); 1359} 1360 1361$.fn.frbChartsLegendSetup = function(relation) { 1362 1363 var $this = $(this); 1364 $this.children('div:not(.frb_clear)').append('<div class="frb_charts_legend" />'); 1365 var $legend = $this.find('.frb_charts_legend'), chSel; 1366 1367 if ($this.children().children(':first').hasClass('frb_charts_wrapper')) {chSel= false;} else {chSel = true;} 1368 var chColor, chCaption; 1369 1370 var chCount = chSel ? relation.datasets.length : relation.length; 1371 for(i=0;i<chCount; i++){ 1372 chColor = chSel ? relation.datasets[i].strokeColor : relation[i].color; 1373 chCaption = chSel ? relation.datasets[i].caption : relation[i].caption; 1374 $legend.append('<div class="frb_charts_legend_row" />').children('.frb_charts_legend_row:last').append('<div /><span />').children('div').css({'background-color' : chColor}).parent().children('span').html(chCaption); 1375 } 1376 $this.append('<div class="frb_clear" />'); 1377}; 1378 1379 1380$.fn.frbChartsDraw = function() { 1381 var $this = $(this), width = $this.innerWidth(), rad = parseInt($this.data('radius')); 1382 if(width - rad <= parseInt($this.data('font-size'))*0.75*15) {$this.addClass('frb_chart_resp');} else {$this.removeClass('frb_chart_resp');} 1383 if(width < rad) { 1384 $this.find('.frb_charts_wrapper canvas').attr('width', $this.innerWidth()).attr('height', $this.innerWidth()); 1385 var myChart = new Chart($(this).find('.frb_piechart_canvas').get(0).getContext("2d")).Doughnut($this.data('obj'),{ 1386 percentageInnerCutout : $this.data('percentageInnerCutout'), 1387 segmentShowStroke : $this.data('segmentShowStroke'), 1388 segmentStrokeWidth : parseInt($this.data('segmentStrokeWidth')), 1389 animationEasing : "easeOutQuad", 1390 animationSteps : 30, 1391 segmentStrokeColor : $this.data('segmentStrokeColor'), 1392 onAnimationComplete : function(){ 1393 $this.find(".frb_charts_legend").children(".frb_charts_legend_row").each(function(ind){ 1394 $(this).delay(ind*150).animate({opacity : 1}, 300); 1395 }); 1396 } 1397 }); 1398 } else { 1399 $this.find('.frb_charts_wrapper canvas').attr('width', rad).attr('height', rad); 1400 var myChart = new Chart($(this).find('.frb_piechart_canvas').get(0).getContext("2d")).Doughnut($this.data('obj'),{ 1401 percentageInnerCutout : $this.data('percentageInnerCutout'), 1402 segmentShowStroke : $this.data('segmentShowStroke'), 1403 segmentStrokeWidth : parseInt($this.data('segmentStrokeWidth')), 1404 animationEasing : "easeOutQuad", 1405 animationSteps : 30, 1406 segmentStrokeColor : $this.data('segmentStrokeColor'), 1407 onAnimationComplete : function(){ 1408 $this.find(".frb_charts_legend").children(".frb_charts_legend_row").each(function(ind){ 1409 $(this).delay(ind*150).animate({opacity : 1}, 300); 1410 }); 1411 } 1412 }); 1413 }
1414 if($(window).width() < 440*window.devicePixelRatio){$this.addClass('frb_chart_force_centering');} else {$this.removeClass('frb_chart_force_centering');} 1415 1416 1417 1418} 1419 1420$.fn.frbGraphDraw = function() { 1421 var $this = $(this), 1422 graphData = $(this).data("graphData"), 1423 curve = $(this).data("curve") == 'true' ? true : false, 1424 fill = $(this).data("fill") == 'true' ? true : false, 1425 stroke = $(this).data("barStroke") == 'true' ? true : false, 1426 wWidth = $this.innerWidth(), 1427 iWidth = $this.data('itemWidth'), 1428 typeSel = $this.data('graph_style'), 1429 legFontSize = $this.data('legend_font_size'); 1430 if(wWidth - iWidth <= parseInt(legFontSize)*0.75*15) {$this.addClass('frb_chart_resp');} else {$this.removeClass('frb_chart_resp');} 1431 if(wWidth < iWidth) {$this.find('.frb_graph_wrapper canvas').attr('width', wWidth); 1432 } else {$this.find('.frb_graph_wrapper canvas').attr('width', iWidth);} 1433 1434 var controlSet = { 1435 segmentShowStroke : true, 1436 segmentStrokeWidth : 5, 1437 animationEasing : "easeOutQuad", 1438 animationSteps : 75, 1439 scaleFontColor : $(this).data("scale_font_color"), 1440 scaleFontSize : 12, 1441 barShowStroke : stroke, 1442 scaleFontStyle : "italic", 1443 bezierCurve : curve, 1444 datasetFill : fill, 1445 animateRotate : true, 1446 onAnimationComplete : function(){ 1447 $this.find('.frb_charts_legend').children('.frb_charts_legend_row').each(function(ind){ 1448 $(this).delay(ind*150).animate({opacity : 1}, 300); 1449 }); 1450 } // callback 1451 } 1452 1453 1454 1455 1456 if(typeSel == 'line'){ 1457 graphData = new Chart($this.find('.frb_graph_canvas')[0].getContext("2d")).Line(graphData, controlSet); 1458 } else if(typeSel == 'bar') { 1459 graphData = new Chart($this.find('.frb_graph_canvas')[0].getContext("2d")).Bar(graphData, controlSet); 1460 } 1461 1462 1463 1464} 1465 1466 1467// gauge 1468 1469function frbGaugeChartRefresh(thisReference) { 1470 var initData, g, gaugeValue, gaugeWidth, parentWidth, sideMargin, topMargin; 1471 thisReference.find(".frb_gauge_shortcode").each(function(){ 1472 gaugeWidth = $(this).width(); 1473 parentWidth = $(this).parent().width(); 1474 1475 if (gaugeWidth>parentWidth) { 1476 $(this).width(parentWidth).height(parentWidth*0.6); 1477 } 1478 1479 initData = $(this).data("gauge_init"); 1480 gaugeValue = $(this).data("gauge_value"); 1481 g = new JustGage(initData); 1482 g.refresh(gaugeValue); 1483 gaugeWidth = $(this).width(); 1484 sideMargin = gaugeWidth*0.17; 1485 topMargin = gaugeWidth * 0.12; 1486 $(this).css({"margin-left":"-"+sideMargin+"px","margin-right":"-"+sideMargin+"px", "margin-top":"-"+topMargin+"px" }); 1487 }); 1488} 1489 1490 1491var frb_gauge_resize; 1492$(window).resize(function(){ 1493 clearTimeout(frb_gauge_resize); 1494 frb_gauge_resize = setTimeout(function(){ 1495 var initData, gaugeValue, gaugeWidth, parentWidth; 1496 $(".frb_gauge_shortcode").each(function(){ 1497 $(this).empty(); 1498 gaugeWidth = $(this).data('gauge_width'); 1499 parentWidth = $(this).parent().width(); 1500 1501 if (gaugeWidth>parentWidth) { 1502 $(this).width(parentWidth).height(parentWidth*0.6); 1503 } else { 1504 $(this).width(gaugeWidth).height(gaugeWidth*0.6); 1505 } 1506 1507 initData = $(this).data("gauge_init"); 1508 gaugeValue = $(this).data("gauge_value"); 1509 var g = new JustGage(initData); 1510 g.refresh(gaugeValue); 1511 }); 1512 },250); 1513}); 1514 1515 1516var FRBpointerEventToXY = function(e){ 1517 var out = {x:0, y:0}; 1518 if(e.type == 'touchstart' || e.type == 'touchmove' || e.type == 'touchend' || e.type == 'touchcancel'){ 1519 var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 1520 out.x = touch.pageX; 1521 out.y = touch.pageY; 1522 } else if (e.type == 'mousedown' || e.type == 'mouseup' || e.type == 'mousemove' || e.type == 'mouseover'|| e.type=='mouseout' || e.type=='mouseenter' || e.type=='mouseleave') { 1523 out.x = e.pageX; 1524 out.y = e.pageY; 1525 } else if ( e.type == 'MSPointerDown' || e.type == 'MSPointerMove' || e.type == 'MSPointerUp') { 1526 var touch = e.originalEvent; 1527 out.x = touch.pageX; 1528 out.y = touch.pageY; 1529 } 1530 return out; 1531}; 1532 1533 1534 1535 1536// YouTube 1537 1538pbuilderYoutube = function(domid, videoid, atts){ 1539 1540 var settings = $.extend({ 1541 height : '480', 1542 width : '600', 1543 autoplay : true, 1544 controls : false, 1545 loop : true, 1546 mute : true, 1547 hd : false 1548 }, atts); 1549 if(typeof window.onYouTubeIframeAPIReady == 'undefined') { 1550 window.onYouTubeIframeAPIReady = function() { 1551 pbuilderYouTubeIframeAPIReady(); 1552 } 1553 1554 } 1555 else { 1556 var oldfunction = window.onYouTubeIframeAPIReady; 1557 window.onYouTubeIframeAPIReady = function() { 1558 oldfunction(); 1559 pbuilderYouTubeIframeAPIReady(); 1560 } 1561 } 1562 1563 var tag = document.createElement('script');
1564 tag.id = 'frb_youtube_api'; 1565 tag.src = "https://www.youtube.com/iframe_api"; 1566 var firstScriptTag = document.getElementsByTagName('script')[0]; 1567 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 1568 1569 1570 1571 1572 function pbuilderYouTubeIframeAPIReady() { 1573 if(videoid != '') { 1574 function onPlayerReady(event) { 1575 event.target.playVideo(); 1576 if(settings['mute']) player.mute(); 1577 if(settings['hd']) player.setPlaybackQuality('hd720'); 1578 } 1579 1580 var ytopts = { 1581 height: settings['height'], 1582 width: settings['width'], 1583 videoId: videoid, 1584 playerVars: { 1585 'autoplay': (settings['autoplay'] ? 1 : 0), 1586 'wmode' : 'transparent', 1587 'version' : 3 1588 }, 1589 events: { 1590 'onReady': onPlayerReady 1591 } 1592 } 1593 if(!settings['controls']) { 1594 ytopts['playerVars']['controls'] = 0; 1595 ytopts['playerVars']['showinfo'] = 0; 1596 ytopts['playerVars']['disablekb'] = 1; 1597 ytopts['playerVars']['iv_load_policy'] = 3; 1598 } 1599 if(settings['loop']) { 1600 ytopts['playerVars']['playlist'] = videoid; 1601 ytopts['playerVars']['loop'] = 1; 1602 } 1603 1604 player = new YT.Player(domid, ytopts); 1605 } 1606 } 1607} 1608 1609})(jQuery); 1610 1611function checkoptinrequired(field, rules, i, options){ 1612 var message = typeof field.attr('error-message') != "undefined"?field.attr('error-message'):"This field is required"; 1613 if (field.val() == "" || field.val() == field.attr('default-value')) { 1614 return '* '+message; 1615 } 1616}
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.