1/* 2 * Copyright (c) 2021 Frenify 3 * Author: Frenify 4 * This file is made for CURRENT THEME 5*/ 6 7 8/* 9 10 @Author: Frenify 11 @URL: http://themeforest.net/user/frenify 12 13 14 This file contains the jquery functions for the actual theme, this 15 is the file you need to edit to change the structure of the 16 theme. 17 18 This files contents are outlined below. 19 20*/ 21 22 23var siteurl = fn_object.siteurl; 24 25/* Page Preloader */ 26var t0 = performance.now(); 27window.addEventListener("load", function(){ 28 "use strict"; 29 if(jQuery('.vivaco_fn_pageloader').length){ 30 var speed = parseFloat(jQuery('.vivaco_fn_pageloader').data('speed'))*1000; 31 var t1 = performance.now(); 32 if(t1-t0>speed){ 33 jQuery('body').addClass('preloader_loaded').removeClass('preloader_loading'); 34 }else{ 35 setTimeout(function(){jQuery('body').addClass('preloader_loaded').removeClass('preloader_loading');},speed-(t1-t0)); 36 } 37 } 38}); 39 40 41// All other theme functions 42(function ($){ 43 44 "use strict"; 45 46 var VivacoInit = { 47 48 49 50 pageNumber: 1, 51 52 init: function () { 53 this.cursor(); 54 this.minHeightForPages(); 55 this.url_fixer(); 56 this.textSkin(); 57 this.projectCategoryFitler(); 58 this.portfolioFilter(); 59 this.hamburgerOpener__Mobile(); 60 this.submenu__Mobile(); 61 this.openShare(); 62 this.imgToSVG(); 63 this.isotopeMasonry(); 64 this.dataFnBgImg(); 65 this.estimateWidgetHeight(); 66 this.runPlayer(); 67 this.newPlayer(); 68 this.header_recipe_carousel(); 69 this.right_bar_opener(); 70 this.categoryHook(); 71 this.right_bar_height(); 72 this.toTopJumper(); 73 this.like(); 74 this.rating(); 75 this.recipe_video(); 76 this.search_opener(); 77 this.search_filter(); 78 this.fixedTotopScroll(); 79 this.prev_next_posts(); 80 this.widget__pages(); 81 this.widget__archives(); 82 this.select2(); 83 this.dataFnStyle(); 84 this.portfolioContentHeight(); 85 this.inputCheckBoxInComment(); 86 this.inlineStyle(); 87 }, 88 89 inlineStyle: function(){ 90 var s = ''; 91 $('.vivaco_fn_style').each(function(){ 92 var e = $(this), v = e.val(); e.val(''); s+= v; 93 }); 94 $('body').append(s); 95 }, 96 97 inputCheckBoxInComment: function(){ 98 if($('p.comment-form-cookies-consent input[type=checkbox]').length){ 99 $('p.comment-form-cookies-consent input[type=checkbox]').wrap('<label class="fn_checkbox"></label>').after('<span></span>'); 100 } 101 }, 102 103 portfolioContentHeight: function(){ 104 var portfolio = $('.vivaco_fn_portfolio_page .portfolio_content'); 105 if(portfolio.height() === 0){ 106 portfolio.css({display: 'none'}); 107 } 108 }, 109 110 dataFnStyle: function(){ 111 $('[data-fn-style]').each(function(){ 112 var el = $(this); 113 var s = el.attr('data-fn-style'); 114 $.each(s.split(';'),function(i,e){ 115 el.css(e.split(':')[0],e.split(':')[1]); 116 }); 117 }); 118 }, 119 120 minHeightForPages: function(){ 121 var H = $(window).height(), 122 W = $(window).width(), 123 headerH = 0, 124 mobileH = 0, 125 adminBarH = 0, 126 footerH = $('.vivaco_fn_footer').height(), 127 mobile = $('.vivaco_fn_mobilemenu_wrap'), 128 header = $('.vivaco_fn_header'); 129 if($('.vivaco-fn-wrapper').data('pos') === 'relative'){ 130 headerH = header.height(); 131 } 132 if(mobile.css('display') !== 'none'){ 133 mobileH = mobile.height(); 134 headerH = 0; 135 } 136 if($('body').hasClass('admin-bar')){ 137 if(W<782){ 138 adminBarH = 46; 139 }else{ 140 adminBarH = 32; 141 } 142 } 143 $('.vivaco_fn_pages,.vivaco_fn_404').css({minHeight: (H-mobileH-headerH-footerH-adminBarH) + 'px'}); 144 }, 145 146 url_fixer: function(){ 147 $('a[href*="fn_ex_link"]').each(function(){ 148 var oldUrl = $(this).attr('href'), 149 array = oldUrl.split('fn_ex_link/'), 150 newUrl = siteurl + "/" + array[1]; 151 $(this).attr('href', newUrl); 152 }); 153 }, 154 155 textSkin: function(){ 156 $('body').addClass('fn__text_skin_'+$('.vivaco-fn-wrapper').data('text-skin')); 157 }, 158 159 160 161 portfolioFilter: function(){ 162 var self = this; 163 $('.vivaco_fn_portfolio_page .fn_ajax_more a').off().on('click',function(){ 164 var thisButton = $(this); 165 var more = thisButton.closest('.fn_ajax_more'); 166 var input = more.find('input'); 167 var abb = thisButton.closest('.vivaco_fn_portfolio_page'); 168 var filter_page = parseInt(input.val()); 169 if(thisButton.hasClass('active')){ 170 return false; 171 } 172 if(!abb.hasClass('go') && !more.hasClass('disabled')){ 173 abb.addClass('go'); 174 175 var requestData = { 176 action: 'vivaco_fn_ajax_portfolio', 177 filter_page: filter_page, 178 }; 179 180 181 $.ajax({
182 type: 'POST', 183 url: fn_ajax_object.fn_ajax_url, 184 cache: false, 185 data: requestData, 186 success: function(data) { 187 var fnQueriedObj = $.parseJSON(data); 188 var html = fnQueriedObj.data; 189 var $grid = abb.find('.posts_list'); 190 var $items; 191 $items = $(html); 192 input.val(filter_page+1); 193 input.change(); 194 195 if(fnQueriedObj.disabled === 'disabled'){ 196 more.addClass('disabled'); 197 } 198 $grid.append( $items ).isotope( 'appended', $items ); 199 setTimeout(function(){ 200 $grid.isotope({ 201 itemSelector: 'li', 202 masonry: {}, 203 stagger: 30 204 }); 205 },500); 206 self.dataFnStyle(); 207 self.dataFnBgImg(); 208 abb.removeClass('go'); 209 }, 210 error: function(xhr, textStatus, errorThrown){ 211 abb.removeClass('go'); 212 } 213 }); 214 } 215 216 217 return false; 218 }); 219 }, 220 221 projectCategoryFitler: function(){ 222 if($().isotope){ 223 var items = $('.vivaco_fn_ajax_portfolio'); 224 items.each(function() { 225 var thisItem = $(this); 226 var list = thisItem.find('.posts_list'); 227 var filter = thisItem.find('.posts_filter'); 228 229 list.isotope({ 230 itemSelector: 'li', 231 masonry: {}, 232 stagger: 30 233 }); 234 235 // Isotope Filter 236 filter.find('a').off().on('click', function() { 237 var selector = $(this).attr('data-filter'); 238 list = thisItem.find('.posts_list'); 239 filter.find('a').removeClass('current'); 240 $(this).addClass('current'); 241 list.isotope({ 242 filter: selector, 243 animationOptions: { 244 duration: 750, 245 easing: 'linear', 246 queue: false 247 } 248 }); 249 return false; 250 }); 251 252 }); 253 } 254 255 }, 256 257 cursor: function () { 258 var myCursor = $('.frenify-cursor'); 259 if (myCursor.length) { 260 if ($("body").length) { 261 const e = document.querySelector(".cursor-inner"), 262 t = document.querySelector(".cursor-outer"); 263 var n, i = 0, 264 o = !1; 265 var buttons = "fn_cs_intro_testimonials .prev, .fn_cs_intro_testimonials .next, .fn_cs_swiper_nav_next, .fn_cs_swiper_nav_prev, .fn_dots, .swiper-button-prev, .swiper-button-next, .fn_cs_accordion .acc_head, .vivaco_fn_popupshare .share_closer, .vivaco_fn_header .fn_finder, .vivaco_fn_header .fn_trigger, a, input[type='submit'], .cursor-link, button"; 266 var sliders = ".owl-carousel, .swiper-container, .cursor-link"; 267 // link mouse enter + move 268 window.onmousemove = function(s) { 269 o || (t.style.transform = "translate(" + s.clientX + "px, " + s.clientY + "px)"), e.style.transform = "translate(" + s.clientX + "px, " + s.clientY + "px)", n = s.clientY, i = s.clientX 270 }, $("body").on("mouseenter", buttons, function() { 271 e.classList.add("cursor-hover"), t.classList.add("cursor-hover") 272 }), $("body").on("mouseleave", buttons, function() { 273 $(this).is("a") && $(this).closest(".cursor-link").length || (e.classList.remove("cursor-hover"), t.classList.remove("cursor-hover")) 274 }), e.style.visibility = "visible", t.style.visibility = "visible"; 275 276 277 // slider mouse enter 278 $('body').on('mouseenter', sliders, function(){ 279 e.classList.add('cursor-slider'); 280 t.classList.add('cursor-slider'); 281 }).on('mouseleave', sliders,function(){ 282 e.classList.remove('cursor-slider'); 283 t.classList.remove('cursor-slider'); 284 }); 285 286 // slider mouse hold 287 $('body').on('mousedown', sliders, function(){ 288 e.classList.add('mouse-down'); 289 t.classList.add('mouse-down'); 290 }).on('mouseup', sliders, function(){ 291 e.classList.remove('mouse-down'); 292 t.classList.remove('mouse-down'); 293 }); 294 } 295 } 296 }, 297 298 select2: function(){ 299 $('.fn_contact select').select2(); 300 }, 301 302 widget__archives: function(){ 303 $('.widget_archive li').each(function(){ 304 var e = $(this); 305 var a = e.find('a').clone(); 306 $('body').append('<div class="frenify_hidden_item"></div>'); 307 $('.frenify_hidden_item').html(e.html()); 308 $('.frenify_hidden_item').find('a').remove(); 309 var suffix = $('.frenify_hidden_item').html().match(/\d+/); // 123456 310 $('.frenify_hidden_item').remove(); 311 suffix = parseInt(suffix); 312 if(isNaN(suffix)){ 313 return false; 314 } 315 suffix = '<span class="count">'+suffix+'</span>'; 316 e.html(a); 317 e.append(suffix); 318 }); 319 }, 320 321 prev_next_posts: function(){ 322 if($('.vivaco_fn_siblings')){ 323 $(document).keyup(function(e) { 324 if(e.key.toLowerCase() === 'p') { 325 var a = $('.vivaco_fn_siblings').find('a.previous_project_link'); 326 if(a.length){ 327 window.location.href = a.attr('href'); 328 return false; 329 } 330 } 331 if(e.key.toLowerCase() === 'n') { 332 var b = $('.vivaco_fn_siblings').find('a.next_project_link'); 333 if(b.length){ 334 window.location.href = b.attr('href'); 335 return false; 336 } 337 } 338 }); 339 } 340 }, 341 342 fixedTotopScroll: function(){ 343 var totop = $('.vivaco_fn_totop'); 344 var height = parseInt(totop.find('input').val()); 345 if(totop.length){ 346 if($(window).scrollTop() > height){ 347 totop.addClass('scrolled'); 348 }else{ 349 totop.removeClass('scrolled'); 350 } 351 } 352 }, 353 354 header_recipe_carousel: function(){ 355 $(".vivaco_fn_header .recipe_content .owl-carousel").owlCarousel({ 356 items: 1, 357 margin: 5, 358 loop: true, 359 nav: true, 360 dosts: false, 361 autoplay: true, 362 autoplayTimeout: 9000, 363 smartSpeed: 1500, 364 navText: ['<span class="fn-prev"></span>','<span class="fn-next"></span>'] 365 });
366 }, 367 368 search_placeholder: function(searchinput,text,i,speed){ 369 setTimeout(function(){ 370 searchinput.attr('placeholder',text); 371 },i*speed); 372 }, 373 374 search_opener: function(){ 375 var self = this; 376 var speed = 10; 377 var searchbox = $('.vivaco_fn_searchpopup'); 378 var opener = $('.vivaco_fn_header .fn_finder'); 379 var searchinput = $('.vivaco_fn_searchpopup input[type=text]'); 380 if(opener.length){ 381 opener.on('click',function(){ 382 if($('body').hasClass('open_search_popup')){ 383 searchbox.removeClass('focused'); 384 $('body').removeClass('open_search_popup'); 385 }else{ 386 var placeholder = searchinput.attr('placeholder'); 387 searchinput.attr('placeholder',''); 388 var array = placeholder.split(''); 389 $('body').addClass('open_search_popup'); 390 setTimeout(function(){ 391 var text = ''; 392 for(var i=0;i<array.length;i++){ 393 text+= array[i]; 394 self.search_placeholder(searchinput,text,i,speed); 395 } 396 setTimeout(function(){ 397 searchinput.focus(); 398 searchinput.trigger('click'); 399 },speed*array.length); 400 },500); 401 } 402 return false; 403 }); 404 } 405 if(searchbox.length){ 406 var closer = searchbox.find('.search_closer,.extra_closer'); 407 var inputText = searchbox.find('input[type=text]'); 408 var inputSubmit = searchbox.find('input[type=submit]'); 409 searchbox.find('.search_inner').on('click',function(){ 410 searchbox.removeClass('focused'); 411 }); 412 inputText.on('click',function(event){ 413 searchbox.addClass('focused'); 414 event.stopPropagation(); 415 }); 416 inputSubmit.on('click',function(event){ 417 event.stopPropagation(); 418 }); 419 closer.on('click',function(event){ 420 event.stopPropagation(); 421 searchbox.removeClass('focused'); 422 $('body').removeClass('open_search_popup'); 423 closer.addClass('closed'); 424 setTimeout(function(){ 425 closer.removeClass('closed'); 426 },500); 427 }); 428 } 429 }, 430 431 paginationFilter: function(){ 432 var self = this; 433 if($('.vivaco_fn_search_recipes').length){ 434 var pagination = $('.vivaco_fn_search_recipes .my_pagination a'); 435 pagination.off().on('click',function(){ 436 var el = $(this); 437 var li = el.parent(); 438 if(!li.hasClass('current')){ 439 self.filterAjaxCall(el,el.html()); 440 } 441 return false; 442 }); 443 } 444 }, 445 446 search_filter: function(){ 447 var self = this; 448 if($('.vivaco_fn_search_recipes').length){ 449 self.paginationFilter(); 450 var inputWrapper = $('.vivaco_fn_search_recipes .input_wrapper'); 451 452 453 var textFilter = $('.vivaco_fn_search_recipe_filter.text_filter'); 454 var textInput = textFilter.find('input[type="text"]'); 455 456 var categoryFilter = $('.vivaco_fn_search_recipe_filter.category_filter'); 457 var categoryPopup = categoryFilter.find('.filter_popup_list'); 458 var categoryInput = categoryFilter.find('input[type="text"]'); 459 var categoryHidden = categoryFilter.find('input[type="hidden"]'); 460 var categoryNewValue = categoryFilter.find('.new_value'); 461 var categoryPlaceholder = categoryInput.attr('data-placeholder'); 462 var categoryType = categoryInput.attr('data-type'); 463 464 var difficultyFilter = $('.vivaco_fn_search_recipe_filter.difficulty_filter'); 465 var difficultyPopup = difficultyFilter.find('.filter_popup_list'); 466 var difficultyInput = difficultyFilter.find('input'); 467 var difficultyPlaceholder = difficultyInput.attr('data-placeholder'); 468 var difficultyType = difficultyInput.attr('data-type'); 469 470 var countryFilter = $('.vivaco_fn_search_recipe_filter.country_filter'); 471 var countryPopup = countryFilter.find('.filter_popup_list'); 472 var countryInput = countryFilter.find('input'); 473 var countryPlaceholder = countryInput.attr('data-placeholder'); 474 var countryType = countryInput.attr('data-type'); 475 476 inputWrapper.on('click',function(){ 477 $('.vivaco_fn_search_recipes .filter_popup_list .item').show(); //added new 478 $('.vivaco_fn_search_recipes .filter_popup_list .no_records').remove(); //added new 479 }); 480 481 482 /************************/ 483 /* Filter by Text */ 484 /************************/ 485 var oldValue = textInput.val(); 486 var myVar = null; 487 textInput.off().on('keyup', function(){ 488 var element = $(this); 489 if(element.val() === oldValue){ 490 return false; 491 } 492 if(element.val() === ''){
493 textFilter.removeClass('ready filtered opened'); 494 }else{ 495 textFilter.addClass('ready filtered opened'); 496 } 497 oldValue = element.val(); 498 clearTimeout(myVar); 499 myVar = setTimeout(function(){ 500 self.filterAjaxCall(element); 501 }, 700); 502 return false; 503 }).focusout(function() { 504 textFilter.removeClass('opened'); 505 }).focus(function() { 506 textFilter.addClass('opened'); 507 }); 508 509 /* remove filter */ 510 textFilter.find('.icon').off().on('click',function(e){ 511 e.preventDefault(); 512 e.stopPropagation(); 513 var el = $(this); 514 515 textInput.val(''); // added new 516 textFilter.removeClass('ready filtered opened'); 517 518 self.filterAjaxCall(el); 519 }); 520 521 /************************/ 522 /* Filter by Country */ 523 /************************/ 524 525 526 /* remove popup on window click */ 527 $(window).on('click',function(){ 528 countryFilter.removeClass('opened'); 529 }); 530 531 /* open popup on filter click */ 532 countryFilter.on('click',function(e){ 533 e.preventDefault(); 534 e.stopPropagation(); 535 difficultyFilter.removeClass('opened'); 536 categoryFilter.removeClass('opened'); 537 countryFilter.addClass('opened'); 538 }); 539 540 /* change placeholder to "Type Something" and backward */ 541 countryInput.focusout(function() { 542 countryInput.attr('placeholder', countryPlaceholder); 543 }).focus(function() { 544 countryInput.attr('placeholder', countryType); 545 }); 546 547 /* live search */ 548 countryInput.on('keyup', function(){ 549 var searchText = $(this).val().toUpperCase(); 550 var list = countryPopup.find('.filter_popup_list_in'); 551 var item = list.children('.item'); 552 var span, i, txtValue, counter=0; 553 var norecord = list.find('.no_records'); 554 555 if(searchText !== ''){ 556 countryFilter.addClass('ready clear'); 557 }else{ 558 countryFilter.removeClass('ready clear'); 559 } 560 for (i = 0; i < item.length; i++) { 561 span = item[i].getElementsByTagName("span")[0]; 562 txtValue = span.textContent || span.innerText; 563 if (txtValue.toUpperCase().indexOf(searchText) > -1) { 564 item[i].style.display = ""; 565 counter--; 566 } else { 567 item[i].style.display = "none"; 568 counter++; 569 } 570 571 } 572 if(counter === item.length && !norecord.length){ 573 list.append('<div class="no_records"><span>'+self.noRecords+'</span></div>'); 574 }else if(counter !== item.length){ 575 list.find('.no_records').remove(); 576 } 577 578 }); 579 580 /* select function */ 581 countryPopup.find('.item').off().on('click',function(e){ 582 e.preventDefault(); 583 e.stopPropagation(); 584 var el = $(this); 585 var statusName = el.data('name'); 586 587 if(!el.hasClass('sending')){ 588 el.addClass('sending'); 589 el.siblings().removeClass('sending'); 590 countryInput.attr('placeholder',''); // remove placeholder 591 countryInput.val(statusName); 592 countryFilter.addClass('ready'); // to enable reset button 593 countryFilter.removeClass('opened'); 594 595 countryFilter.addClass('filtered'); 596 self.filterAjaxCall(el); 597 } 598 599 return false; 600 }); 601 602 /* remove filter */ 603 countryFilter.find('.icon').off().on('click',function(e){ 604 e.preventDefault(); 605 e.stopPropagation(); 606 var el = $(this); 607 difficultyFilter.removeClass('opened'); 608 categoryFilter.removeClass('opened'); 609 610 countryInput.val(''); // added new 611 countryPopup.find('.item').show(); //added new 612 countryPopup.find('.no_records').remove(); // added new 613 countryInput.attr('placeholder',countryPlaceholder); 614 countryFilter.removeClass('ready'); 615 countryPopup.find('.item').removeClass('sending'); 616 countryFilter.removeClass('opened'); 617 countryFilter.removeClass('filtered'); 618 619 self.filterAjaxCall(el); 620 }); 621 622 /************************/ 623 /* Filter by Difficulty */ 624 /************************/ 625 626 627 /* remove popup on window click */ 628 $(window).on('click',function(){ 629 difficultyFilter.removeClass('opened'); 630 }); 631 632 /* open popup on filter click */ 633 difficultyFilter.on('click',function(e){
634 e.preventDefault(); 635 e.stopPropagation(); 636 637 categoryFilter.removeClass('opened'); 638 countryFilter.removeClass('opened'); 639 difficultyFilter.addClass('opened'); 640 }); 641 642 /* change placeholder to "Type Something" and backward */ 643 difficultyInput.focusout(function() { 644 difficultyInput.attr('placeholder', difficultyPlaceholder); 645 }).focus(function() { 646 difficultyInput.attr('placeholder', difficultyType); 647 }); 648 649 /* live search */ 650 difficultyInput.on('keyup', function(){ 651 var searchText = $(this).val().toUpperCase(); 652 var list = difficultyPopup.find('.filter_popup_list_in'); 653 var item = list.children('.item'); 654 var span, i, txtValue, counter=0; 655 var norecord = list.find('.no_records'); 656 657 if(searchText !== ''){ 658 difficultyFilter.addClass('ready clear'); 659 }else{ 660 difficultyFilter.removeClass('ready clear'); 661 } 662 for (i = 0; i < item.length; i++) { 663 span = item[i].getElementsByTagName("span")[0]; 664 txtValue = span.textContent || span.innerText; 665 if (txtValue.toUpperCase().indexOf(searchText) > -1) { 666 item[i].style.display = ""; 667 counter--; 668 } else { 669 item[i].style.display = "none"; 670 counter++; 671 } 672 673 } 674 if(counter === item.length && !norecord.length){ 675 list.append('<div class="no_records"><span>'+self.noRecords+'</span></div>'); 676 }else if(counter !== item.length){ 677 list.find('.no_records').remove(); 678 } 679 680 }); 681 682 /* select function */ 683 difficultyPopup.find('.item').off().on('click',function(e){ 684 e.preventDefault(); 685 e.stopPropagation(); 686 var el = $(this); 687 var statusName = el.data('name'); 688 689 if(!el.hasClass('sending')){ 690 el.addClass('sending'); 691 el.siblings().removeClass('sending'); 692 difficultyInput.attr('placeholder',''); // remove placeholder 693 difficultyInput.val(statusName); 694 difficultyFilter.addClass('ready'); // to enable reset button 695 difficultyFilter.removeClass('opened'); 696 697 difficultyFilter.addClass('filtered'); 698 self.filterAjaxCall(el); 699 } 700 701 return false; 702 }); 703 704 /* remove filter */ 705 difficultyFilter.find('.icon').off().on('click',function(e){ 706 e.preventDefault(); 707 e.stopPropagation(); 708 var el = $(this); 709 countryFilter.removeClass('opened'); 710 categoryFilter.removeClass('opened'); 711 712 difficultyInput.val(''); // added new 713 difficultyPopup.find('.item').show(); //added new 714 difficultyPopup.find('.no_records').remove(); // added new 715 difficultyInput.attr('placeholder',difficultyPlaceholder); 716 difficultyFilter.removeClass('ready'); 717 difficultyPopup.find('.item').removeClass('sending'); 718 difficultyFilter.removeClass('opened'); 719 difficultyFilter.removeClass('filtered'); 720 721 self.filterAjaxCall(el); 722 }); 723 724 725 726 727 728 /**********************/ 729 /* Filter by Category */ 730 /**********************/ 731 732 733 /* remove popup on window click */ 734 $(window).on('click',function(){ 735 categoryFilter.removeClass('opened'); 736 }); 737 738 /* open popup on filter click */ 739 categoryFilter.on('click',function(e){ 740 e.preventDefault(); 741 e.stopPropagation(); 742 difficultyFilter.removeClass('opened'); 743 countryFilter.removeClass('opened'); 744 categoryFilter.addClass('opened'); 745 categoryInput.focus(); 746 }); 747 748 /* change placeholder to "Type Something" and backward */ 749 categoryInput.focusout(function() { 750 if(categoryNewValue.html() === ''){
751 categoryInput.attr('placeholder', categoryPlaceholder); 752 }else{ 753 categoryInput.attr('placeholder', ''); 754 } 755 756 }).focus(function() { 757 categoryInput.attr('placeholder', categoryType); 758 }); 759 760 /* live search */ 761 categoryInput.on('keyup', function(){ 762 var searchText = $(this).val().toUpperCase(); 763 var list = categoryPopup.find('.filter_popup_list_in'); 764 var item = list.children('.item'); 765 var span, i, txtValue, counter=0; 766 var norecord = list.find('.no_records'); 767 768 if(searchText !== ''){ 769 categoryFilter.addClass('ready clear'); 770 }else{ 771 categoryFilter.removeClass('ready clear'); 772 } 773 for (i = 0; i < item.length; i++) { 774 span = item[i].getElementsByTagName("span")[0]; 775 txtValue = span.textContent || span.innerText; 776 if (txtValue.toUpperCase().indexOf(searchText) > -1) { 777 item[i].style.display = ""; 778 counter--; 779 } else { 780 item[i].style.display = "none"; 781 counter++; 782 } 783 784 } 785 if(counter === item.length && !norecord.length){ 786 list.append('<div class="no_records"><span>'+self.noRecords+'</span></div>'); 787 }else if(counter !== item.length){ 788 list.find('.no_records').remove(); 789 } 790 791 }); 792 793 /* select function */ 794 categoryPopup.find('.item').off().on('click',function(e){ 795 e.preventDefault(); 796 e.stopPropagation(); 797 var el = $(this); 798 var statusName = el.data('name'); 799 var array = [],newvalue = ''; 800 801 if(categoryHidden.val() !== ''){ 802 array = categoryHidden.val().split(','); 803 } 804 805 categoryInput.val(''); 806 categoryPopup.find('.item').show(); 807 categoryPopup.find('.no_records').remove(); 808 categoryInput.attr('placeholder',''); 809 categoryInput.bind('click'); 810 811 if(!el.hasClass('sending')){ 812 el.addClass('sending'); 813 array.push(statusName); 814 }else{ 815 el.removeClass('sending'); 816 var index = array.indexOf(statusName); 817 if (index > -1) { 818 array.splice(index, 1); 819 } 820 } 821 categoryHidden.val(array.join(',')); 822 categoryHidden.triggerHandler("change"); 823 if(array.length){ 824 categoryFilter.addClass('ready'); // to enable reset button 825 categoryFilter.addClass('filtered'); 826 newvalue += ''+array[0]; 827 if(array.length > 1){ 828 newvalue += ', + ' + (array.length - 1); 829 } 830 }else{ 831 categoryFilter.removeClass('ready'); // to disable reset button 832 categoryFilter.removeClass('filtered'); 833 } 834 categoryNewValue.html(newvalue); 835 categoryInput.focus(); 836 self.filterAjaxCall(el); 837 838 return false; 839 }); 840 841 /* remove filter */ 842 categoryFilter.find('.icon').off().on('click',function(e){ 843 e.preventDefault(); 844 e.stopPropagation(); 845 var el = $(this); 846 difficultyFilter.removeClass('opened'); 847 countryFilter.removeClass('opened'); 848 849 categoryHidden.val(''); 850 categoryHidden.triggerHandler("change"); 851 categoryInput.val(''); // added new 852 categoryNewValue.html(''); 853 categoryPopup.find('.item').show(); //added new 854 categoryPopup.find('.no_records').remove(); // added new 855 categoryInput.attr('placeholder',categoryPlaceholder); 856 categoryFilter.removeClass('ready'); 857 categoryPopup.find('.item').removeClass('sending'); 858 categoryFilter.removeClass('opened'); 859 categoryFilter.removeClass('filtered'); 860 861 self.filterAjaxCall(el); 862 }); 863 } 864 }, 865 getQueryVariable: function(url, variable) { 866 var query = url.substring(1); 867 var vars = query.split('&'); 868 for (var i=0; i<vars.length; i++) { 869 var pair = vars[i].split('='); 870 if (pair[0] === variable) { 871 return pair[1]; 872 } 873 } 874 875 return false; 876 }, 877 filterAjaxCall: function(element,filter_page){ 878 var pagination = true; 879 if ( typeof filter_page === 'undefined') { 880 filter_page = 1; 881 pagination = false; 882 } 883 var parent = element.closest('.vivaco_fn_search_recipes'); 884 if(parent.hasClass('loading')){ 885 return false; 886 } 887 var self = this; 888 var filter_difficulty = '*'; 889 var filter_country = '*'; 890 var filter_category_array = ''; 891 filter_category_array = parent.find('.category_filters').val(); 892 if(parent.find('.filter_popup_list.difficulty div.sending').length){ 893 filter_difficulty = parent.find('.filter_popup_list.difficulty .sending').data('filter'); 894 } 895 if(parent.find('.filter_popup_list.country div.sending').length){ 896 filter_country = parent.find('.filter_popup_list.country .sending').data('filter'); 897 } 898 var search_term = parent.find('.text_filter input').val(); 899 var requestData = { 900 action: 'vivaco_fn_search_filter', 901 filter_category_array: filter_category_array, 902 filter_difficulty: filter_difficulty, 903 filter_country: filter_country, 904 filter_page: filter_page, 905 search_term: search_term, 906 }; 907 908 909 910 $.ajax({
911 type: 'POST', 912 url: fn_ajax_object.fn_ajax_url, 913 cache: false, 914 data: requestData, 915 success: function(data) { 916 var fnQueriedObj = $.parseJSON(data); 917 var html = fnQueriedObj.vivaco_fn_data; 918 parent.find('.post_section_in').html(html); 919 self.dataFnBgImg(); 920 self.imgToSVG(); 921 self.like(); 922 parent.removeClass('loading'); 923 924 var speed = 800; 925 if(!pagination){ 926 speed = 0; 927 } 928 var listItem = parent.find('.my_list ul > li'); 929 if(listItem.length){ 930 setTimeout(function(){ 931 listItem.each(function(i, e){ 932 setTimeout(function(){ 933 $(e).addClass('fadeInTop done'); 934 }, (i*100)); 935 }); 936 }, speed+100); 937 }else{ 938 parent.find('.fn_animated').addClass('fadeInTop done'); 939 } 940 if(pagination){ 941 $([document.documentElement, document.body]).animate({ 942 scrollTop: parent.offset().top 943 }, speed); 944 } 945 946 self.paginationFilter(); 947 }, 948 error: function(xhr, textStatus, errorThrown){ 949 console.log(errorThrown); 950 console.log(textStatus); 951 console.log(xhr); 952 } 953 }); 954 }, 955 956 right_bar_opener: function(){ 957 var hamburger = $('.vivaco_fn_header .fn_trigger');hamburger.addClass('ready'); 958 var trigger = $('.vivaco_fn_right_panel .extra_closer, .vivaco_fn_right_panel .fn_closer'); 959 trigger.on('click',function(){ 960 $('body').toggleClass('fn_opened'); 961 return false; 962 }); 963 hamburger.on('click',function(){ 964 $('body').addClass('fn_opened'); 965 return false; 966 }); 967 var i = null; 968 hamburger.on('mouseenter',function(){ 969 i = setTimeout(function(){ 970 $('body').addClass('fn_opened'); 971 },700); 972 }).on('mouseleave',function(){ 973 clearTimeout(i); 974 }); 975 }, 976 977 categoryHook: function(){ 978 var self = this; 979 var list = $('.wp-block-archives li, .widget_vivaco_custom_categories li, .widget_categories li, .widget_archive li'); 980 list.each(function(){ 981 var item = $(this); 982 if(item.find('ul').length){ 983 item.addClass('has-child'); 984 } 985 }); 986 987 988 var html = $('.vivaco_fn_hidden.more_cats').html(); 989 var cats = $('.widget_categories,.widget_archive,.widget_vivaco_custom_categories'); 990 if(cats.length){ 991 cats.each(function(){ 992 var element = $(this); 993 var limit = 3; 994 element.append(html); 995 var li = element.find('ul:not(.children) > li'); 996 if(li.length > limit){ 997 var h = 0; 998 li.each(function(i,e){ 999 if(i < limit){ 1000 h += $(e).outerHeight(true,true); 1001 }else{ 1002 return false; 1003 } 1004 }); 1005 element.find('ul:not(.children)').css({height: h + 'px'}); 1006 element.find('.vivaco_fn_more_categories .fn_count').html('('+(li.length-limit)+')'); 1007 }else{ 1008 element.addClass('all_active'); 1009 } 1010 }); 1011 self.categoryHookAction(); 1012 } 1013 }, 1014 1015 categoryHookAction: function(){ 1016 var self = this; 1017 $('.vivaco_fn_more_categories').find('a').off().on('click',function(){ 1018 var e = $(this); 1019 var limit = 3; 1020 var myLimit = limit; 1021 var parent = e.closest('.widget_block'); 1022 var li = parent.find('ul:not(.children) > li'); 1023 var liHeight = li.outerHeight(true,true); 1024 var h = liHeight*limit; 1025 var liLength = li.length; 1026 var speed = (liLength-limit)*50; 1027 e.toggleClass('show'); 1028 if(e.hasClass('show')){ 1029 myLimit = liLength; 1030 h = liHeight*liLength; 1031 e.find('.text').html(e.data('less')); 1032 e.find('.fn_count').html(''); 1033 }else{ 1034 e.find('.text').html(e.data('more')); 1035 e.find('.fn_count').html('('+(liLength-limit)+')'); 1036 } 1037 1038 1039 var H = 0; 1040 li.each(function(i,e){ 1041 if(i < myLimit){ 1042 H += $(e).outerHeight(true,true); 1043 }else{ 1044 return false; 1045 } 1046 }); 1047 1048 speed = (speed > 300) ? speed : 300; 1049 speed = (speed < 1500) ? speed : 1500; 1050 parent.find('ul:not(.children)').animate({height:H},speed); 1051 1052 setTimeout(function(){ 1053 self.right_bar_height(); 1054 },(speed+1)); 1055 1056 1057 return false; 1058 }); 1059 }, 1060 1061 recipe_video: function(){ 1062 $('.vivaco_fn_single_recipe .popup-youtube').each(function() { // the containers for all your galleries 1063 $(this).magnificPopup({ 1064 disableOn: 700, 1065 type: 'iframe', 1066 mainClass: 'mfp-fade', 1067 removalDelay: 160, 1068 preloader: false,
1069 fixedContentPos: false 1070 }); 1071 }); 1072 }, 1073 1074 rating: function(){ 1075 var radio = $('.comments-rating input[type="radio"]'); 1076 radio.on('click',function(){ 1077 var el = $(this); 1078 var id = el.attr('id'); 1079 $('.comments-rating .fn_radio').removeClass('clicked'); 1080 $('.comments-rating .'+id).addClass('clicked'); 1081 }).on('mouseenter',function(){ 1082 var el = $(this); 1083 var id = el.attr('id'); 1084 $('.comments-rating .fn_radio').removeClass('hovered'); 1085 $('.comments-rating .'+id).addClass('hovered'); 1086 }).on('mouseleave',function(){ 1087 $('.comments-rating .fn_radio').removeClass('hovered'); 1088 }); 1089 }, 1090 1091 1092 1093 1094 1095 1096 1097 right_bar_height: function(){ 1098 var H = $(window).height(), 1099 bar = $('.vivaco_fn_popup_sidebar'), 1100 inner = bar.find('.sidebar_wrapper'); 1101 bar.height(H + 'px'); 1102 if($().niceScroll){ 1103 inner.getNiceScroll().remove(); 1104 inner.height('100%').niceScroll({ 1105 touchbehavior: false, 1106 cursorwidth: 0, 1107 autohidemode: true, 1108 cursorborder: "0px solid #e5e5e5" 1109 }); 1110 } 1111 }, 1112 1113 1114 toTopJumper: function(){ 1115 var totop = $('.vivaco_fn_footer .footer_totop a,a.vivaco_fn_totop,.vivaco_fn_footer .footer_right_totop a'); 1116 if(totop.length){ 1117 totop.on('click', function(e) { 1118 e.preventDefault(); 1119 $("html, body").animate( 1120 { scrollTop: 0 }, 'slow'); 1121 return false; 1122 }); 1123 } 1124 }, 1125 1126 1127 1128 runPlayer: function(){ 1129 var parent = $('.vivaco_fn_main_audio'); 1130 var audioVideo = parent.find('audio,video'); 1131 audioVideo.each(function(){ 1132 var element = $(this); 1133 element.mediaelementplayer({ 1134 // Do not forget to put a final slash (/) 1135 pluginPath: 'https://cdnjs.com/libraries/mediaelement/', 1136 // this will allow the CDN to use Flash without restrictions 1137 // (by default, this is set as `sameDomain`) 1138 shimScriptAccess: 'always', 1139 success: function(mediaElement, domObject) { 1140 mediaElement.addEventListener('play', function() { 1141 parent.removeClass('fn_pause').addClass('fn_play'); 1142 }, false); 1143 mediaElement.addEventListener('pause', function() { 1144 parent.removeClass('fn_play').addClass('fn_pause'); 1145 }, false); 1146 }, 1147 }); 1148 }); 1149 }, 1150 1151 newPlayer: function(){ 1152 var parent = $('.vivaco_fn_main_audio'); 1153 var closer = parent.find('.fn_closer'); 1154 var audioVideo = parent.find('audio,video'); 1155 var icon = parent.find('.podcast_icon'); 1156 var audios = $('.vivaco_fn_audio_button'); 1157 var playButton = $('.vivaco_fn_audio_button a'); 1158 var self = this; 1159 audioVideo.each(function(){ 1160 var element = $(this); 1161 element.mediaelementplayer({ 1162 // Do not forget to put a final slash (/) 1163 pluginPath: 'https://cdnjs.com/libraries/mediaelement/', 1164 // this will allow the CDN to use Flash without restrictions 1165 // (by default, this is set as `sameDomain`) 1166 shimScriptAccess: 'always', 1167 success: function(mediaElement, domObject) { 1168 mediaElement.addEventListener('pause', function() { 1169 parent.removeClass('fn_play').addClass('fn_pause'); 1170 }, false); 1171 mediaElement.addEventListener('play', function() { 1172 parent.removeClass('fn_pause').addClass('fn_play'); 1173 }, false); 1174 }, 1175 }); 1176 }); 1177 closer.off().on('click', function(){ 1178 if(parent.hasClass('closed')){ 1179 parent.removeClass('closed'); 1180 closer.find('span').html(closer.attr('data-close-text')); 1181 }else{ 1182 parent.addClass('closed'); 1183 closer.find('span').html(closer.attr('data-open-text'));
1184 } 1185 }); 1186 icon.off().on('click', function(){ 1187 if(parent.find('audio,video').length){ 1188 if(parent.hasClass('fn_pause')){ 1189 parent.removeClass('fn_pause').addClass('fn_play').find('audio,video')[0].play(); 1190 }else{ 1191 parent.removeClass('fn_play').addClass('fn_pause').find('audio,video')[0].pause(); 1192 } 1193 } 1194 }); 1195 playButton.off().on('click',function(){ 1196 var button = $(this); 1197 var wrapper = button.parent(); 1198 if(!wrapper.hasClass('active')){ 1199 audios.removeClass('active fn_play fn_pause'); 1200 wrapper.addClass('active'); 1201 } 1202 if(wrapper.hasClass('fn_pause')){ 1203 wrapper.removeClass('fn_pause').addClass('fn_play'); 1204 parent.find('audio,video')[0].play(); 1205 }else if(wrapper.hasClass('fn_play')){ 1206 wrapper.removeClass('fn_play').addClass('fn_pause'); 1207 parent.find('audio,video')[0].pause(); 1208 }else{ 1209 wrapper.addClass('fn_play'); 1210 var src = wrapper.attr('data-mp3'); 1211 var audio = '<audio controls><source src="'+src+'" type="audio/mpeg"></audio>'; 1212 $('.vivaco_fn_main_audio .audio_player').html(audio); 1213 self.runPlayer(); 1214 setTimeout(function(){ 1215 parent.find('audio,video')[0].play(); 1216 parent.removeClass('fn_pause').addClass('fn_play'); 1217 parent.removeClass('closed'); 1218 closer.find('span').html(closer.attr('data-close-text')); 1219 self.playerSpace(); 1220 },50); 1221 } 1222 1223 return false; 1224 }); 1225 }, 1226 1227 1228 1229 openShare: function(){ 1230 var btn = $('.vivaco_fn_sharebox a'); 1231 var sharebox = $('.vivaco_fn_popupshare'); 1232 btn.off().on('click',function(){ 1233 var element = $(this), 1234 parent = element.closest('.vivaco_fn_sharebox'); 1235 var box = parent.find('.share_hidden_box'), 1236 title = box.find('.hidden_title').html(), 1237 heading = box.find('.hidden_share').html(), 1238 list = box.find('ul').html(); 1239 sharebox.find('.share_header').html(heading); 1240 sharebox.find('.share_title').html(title); 1241 sharebox.find('.share_list ul').html(list); 1242 sharebox.addClass('opened'); 1243 parent.addClass('opened'); 1244 return false; 1245 }); 1246 var closer = $('.vivaco_fn_popupshare .share_closer'); 1247 closer.off().on('click',function(){ 1248 btn.removeClass('opened'); 1249 sharebox.removeClass('opened'); 1250 return false; 1251 }); 1252 }, 1253 1254 widget__pages: function(){ 1255 var nav = $('.widget_pages ul'); 1256 nav.each(function(){ 1257 $(this).find('a').off().on('click', function(e){ 1258 var element = $(this); 1259 var parentItem = element.parent('li'); 1260 var parentItems = element.parents('li'); 1261 var parentUls = parentItem.parents('ul.children'); 1262 var subMenu = element.next(); 1263 var allSubMenusParents = nav.find('li'); 1264 1265 allSubMenusParents.removeClass('opened'); 1266 1267 if(subMenu.length){ 1268 e.preventDefault(); 1269 1270 if(!(subMenu.parent('li').hasClass('active'))){ 1271 if(!(parentItems.hasClass('opened'))){parentItems.addClass('opened');} 1272 1273 allSubMenusParents.each(function(){ 1274 var el = $(this); 1275 if(!el.hasClass('opened')){el.find('ul.children').slideUp();} 1276 }); 1277 1278 allSubMenusParents.removeClass('active'); 1279 parentUls.parent('li').addClass('active'); 1280 subMenu.parent('li').addClass('active'); 1281 subMenu.slideDown(); 1282 1283 1284 }else{ 1285 subMenu.parent('li').removeClass('active'); 1286 subMenu.slideUp(); 1287 } 1288 return false; 1289 } 1290 }); 1291 }); 1292 }, 1293 1294 submenu__Mobile: function(){ 1295 var nav = $('ul.vert_menu_list, .widget_nav_menu ul.menu'); 1296 var mobileAutoCollapse = $('.vivaco-fn-wrapper').data('mobile-autocollapse'); 1297 nav.each(function(){ 1298 $(this).find('a').on('click', function(e){ 1299 var element = $(this); 1300 var parentItem = element.parent('li'); 1301 var parentItems = element.parents('li'); 1302 var parentUls = parentItem.parents('ul.sub-menu'); 1303 var subMenu = element.next(); 1304 var allSubMenusParents = nav.find('li'); 1305 1306 allSubMenusParents.removeClass('opened'); 1307 1308 if(subMenu.length){ 1309 e.preventDefault(); 1310 1311 if(!(subMenu.parent('li').hasClass('active'))){ 1312 if(!(parentItems.hasClass('opened'))){parentItems.addClass('opened');} 1313 1314 allSubMenusParents.each(function(){ 1315 var el = $(this); 1316 if(!el.hasClass('opened')){el.find('ul.sub-menu').slideUp();} 1317 });
1318 1319 allSubMenusParents.removeClass('active'); 1320 parentUls.parent('li').addClass('active'); 1321 subMenu.parent('li').addClass('active'); 1322 subMenu.slideDown(); 1323 1324 1325 }else{ 1326 subMenu.parent('li').removeClass('active'); 1327 subMenu.slideUp(); 1328 } 1329 return false; 1330 } 1331 if(mobileAutoCollapse === 'enable'){ 1332 if(nav.parent().parent().hasClass('opened')){ 1333 nav.parent().parent().removeClass('opened').slideUp(); 1334 $('.vivaco_fn_mobilemenu_wrap .hamburger').removeClass('is-active'); 1335 } 1336 } 1337 }); 1338 }); 1339 }, 1340 1341 hamburgerOpener__Mobile: function(){ 1342 var hamburger = $('.vivaco_fn_mobilemenu_wrap .hamburger'); 1343 hamburger.on('click',function(){ 1344 var element = $(this); 1345 var menupart = $('.vivaco_fn_mobilemenu_wrap .mobilemenu'); 1346 if(element.hasClass('is-active')){ 1347 element.removeClass('is-active'); 1348 menupart.removeClass('opened'); 1349 menupart.slideUp(500); 1350 }else{ 1351 element.addClass('is-active'); 1352 menupart.addClass('opened'); 1353 menupart.slideDown(500); 1354 }return false; 1355 }); 1356 }, 1357 1358 like: function(){ 1359 var svg; 1360 var self = this; 1361 if($('.vivaco-fn-wrapper').length){ 1362 svg = $('.vivaco-fn-wrapper').data('like-url'); 1363 } 1364 var ajaxRunningForLike = false; 1365 $('.vivaco_fn_like').off().on('click', function(e) { 1366 e.preventDefault(); 1367 1368 var likeLink = $(this), 1369 ID = $(this).data('id'), 1370 likeAction,addAction; 1371 1372 likeLink = $('.vivaco_fn_like[data-id="'+ID+'"]'); 1373 1374 if(ajaxRunningForLike === true) {return false;} 1375 1376 if(likeLink.hasClass('liked')){ 1377 likeAction = 'liked'; 1378 addAction = 'not-rated'; 1379 }else{ 1380 likeAction = 'not-rated'; 1381 addAction = 'liked'; 1382 } 1383 ajaxRunningForLike = true; 1384 1385 var requestData = { 1386 action: 'vivaco_fn_like', 1387 ID: ID, 1388 likeAction: likeAction 1389 }; 1390 1391 $.ajax({
1392 type: 'POST', 1393 url: fn_ajax_object.fn_ajax_url, 1394 cache: false, 1395 data: requestData, 1396 success: function(data) { 1397 var fnQueriedObj = $.parseJSON(data); //get the data object 1398 likeLink.removeClass('animate ' + likeAction).addClass(addAction); 1399 likeLink.find('.vivaco_w_fn_svg').remove(); 1400 likeLink.find('.vivaco_fn_like_count').before('<img src="'+fnQueriedObj.svg+'" class="vivaco_w_fn_svg" alt="" />'); 1401 self.imgToSVG(); 1402 likeLink.find('.count').html(fnQueriedObj.count); 1403 likeLink.find('.text').html(fnQueriedObj.like_text); 1404 likeLink.attr('title',fnQueriedObj.title); 1405 likeLink.addClass('animate'); 1406 ajaxRunningForLike = false; 1407 }, 1408 error: function(MLHttpRequest, textStatus, errorThrown) { 1409 console.log(MLHttpRequest); 1410 console.log(textStatus); 1411 console.log(errorThrown); 1412 } 1413 }); 1414 1415 return false; 1416 }); 1417 }, 1418 1419 1420 imgToSVG: function(){ 1421 $('img.vivaco_fn_svg,img.vivaco_w_fn_svg').each(function(){ 1422 var img = $(this); 1423 var imgClass = img.attr('class'); 1424 var imgURL = img.attr('src'); 1425 1426 $.get(imgURL, function(data) { 1427 var svg = $(data).find('svg'); 1428 if(typeof imgClass !== 'undefined') { 1429 svg = svg.attr('class', imgClass+' replaced-svg'); 1430 } 1431 img.replaceWith(svg); 1432 1433 }, 'xml'); 1434 1435 }); 1436 }, 1437 1438 1439 dataFnBgImg: function(){ 1440 var bgImage = $('*[data-fn-bg-img]'); 1441 bgImage.each(function(){ 1442 var element = $(this); 1443 var attrBg = element.attr('data-fn-bg-img'); 1444 var bgImg = element.data('fn-bg-img'); 1445 if(typeof(attrBg) !== 'undefined'){ 1446 element.addClass('frenify-ready').css({backgroundImage:'url('+bgImg+')'}); 1447 } 1448 }); 1449 }, 1450 1451 isotopeMasonry: function(){ 1452 var masonry = $('.vivaco_fn_masonry'); 1453 if($().isotope){ 1454 masonry.each(function(){ 1455 $(this).isotope({ 1456 itemSelector: '.vivaco_fn_masonry_in', 1457 masonry: { 1458 columnWidth: '.grid-sizer' 1459 } 1460 }); 1461 }); 1462 } 1463 }, 1464 1465 estimateWidgetHeight: function(){ 1466 var est = $('.vivaco_fn_widget_estimate'); 1467 est.each(function(){ 1468 var el = $(this); 1469 var h1 = el.find('.helper1'); 1470 var h2 = el.find('.helper2'); 1471 var h3 = el.find('.helper3'); 1472 var h4 = el.find('.helper4'); 1473 var h5 = el.find('.helper5'); 1474 var h6 = el.find('.helper6'); 1475 var eW = el.outerWidth(); 1476 var w1 = Math.floor((eW * 80) / 300); 1477 var w2 = eW-w1; 1478 var e1 = Math.floor((w1 * 55) / 80); 1479 h1.css({borderLeftWidth: w1+'px', borderTopWidth: e1+'px'}); 1480 h2.css({borderRightWidth: w2+'px', borderTopWidth: e1+'px'}); 1481 h3.css({borderLeftWidth: w1+'px', borderTopWidth: w1+'px'}); 1482 h4.css({borderRightWidth: w2+'px', borderTopWidth: w1+'px'}); 1483 h5.css({borderLeftWidth: w1+'px', borderTopWidth: w1+'px'}); 1484 h6.css({borderRightWidth: w2+'px', borderTopWidth: w1+'px'}); 1485 }); 1486 }, 1487 }; 1488 1489 1490 1491 // ready functions 1492 $(document).ready(function(){ 1493 VivacoInit.init(); 1494 }); 1495 1496 // resize functions 1497 $(window).on('resize',function(e){ 1498 e.preventDefault(); 1499 VivacoInit.isotopeMasonry(); 1500 VivacoInit.projectCategoryFitler(); 1501 VivacoInit.right_bar_height(); 1502 VivacoInit.estimateWidgetHeight(); 1503 }); 1504 1505 // scroll functions 1506 $(window).on('scroll', function(e) { 1507 e.preventDefault(); 1508 VivacoInit.fixedTotopScroll(); 1509 }); 1510 1511 // load functions 1512 $(window).on('load', function(e) { 1513 e.preventDefault(); 1514 VivacoInit.isotopeMasonry(); 1515 VivacoInit.projectCategoryFitler(); 1516 setTimeout(function(){ 1517 VivacoInit.isotopeMasonry(); 1518 VivacoInit.projectCategoryFitler(); 1519 },100); 1520 }); 1521 1522})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.