1/* 2* Re-structure JS 3* */ 4(function ($) { 5 'use strict' 6 var thim_eduma = { 7 el_thim_pop_up_login: null, 8 el_loginpopupform: null, 9 el_registerPopupForm: null, 10 el_form_purchase_course: null, 11 el_form_enroll_course: null, 12 data: {}, 13 ready: function () { 14 this.getElements() 15 if (this.el_thim_pop_up_login.length) { 16 this.el_loginpopupform = this.el_thim_pop_up_login.find('form[name=loginpopupform]') 17 this.el_registerPopupForm = this.el_thim_pop_up_login.find('form[name=registerformpopup]') 18 this.login_form() 19 } 20 this.form_submission_validate() 21 this.thim_TopHeader() 22 this.ctf7_input_effect() 23 this.mobile_menu_toggle() 24 this.thim_background_gradient() 25 this.thim_magnificPopup() 26 this.full_right() 27 this.course_sidebar_right_offset_top() 28 this.thim_carousel() 29 this.event_click() 30 this.plus_minus_addtocart() 31 this.back_to_top() 32 this.StickySidebar() 33 this.thim_SwitchLayout('thim-course') 34 this.thim_SwitchLayout('thim-product') 35 this.thim_SwitchLayout('blog') 36 this.thim_gallery() 37 this.submit_form_validate() 38 this.waypoint_js() 39 this.product_gallery() 40 this.recipe_ingredient() 41 this.nav_tabs_post(); 42 this.anchor_nav_tabs_course(); 43 this.list_scroll(); 44 }, 45 46 getElements: function () { 47 this.el_thim_pop_up_login = $('#thim-popup-login') 48 this.el_form_purchase_course = $('form[name=purchase-course]') 49 this.el_form_enroll_course = $('form[name=enroll-course]') 50 }, 51 52 load: function () { 53 this.thim_menu() 54 this.thim_contentslider() 55 this.counter_box() 56 this.product_quick_view() 57 if ($('#contact-form-registration').length) { 58 this.thim_course_offline_popup_form_register(); 59 } 60 }, 61 62 resize: function () { 63 this.full_right() 64 this.thim_carousel() 65 this.thim_gallery() 66 }, 67 68 plus_minus_addtocart: function () { 69 if ($('body').hasClass('woocommerce-cart')) { 70 $('th.product-name').attr('colspan', '2') 71 $('td.actions').attr('colspan', '7') 72 } 73 $(document).on('click', '.quantity-add-value div.plus,.quantity-add-value div.minus', function (event) { 74 var qty = $(this).parent('.quantity-add-value').find('.qty'); 75 var val = parseFloat(qty.val()); 76 if (isNaN(val)) { 77 val = 0; 78 } 79 var max = parseFloat(qty.attr('max')); 80 var min = parseFloat(qty.attr('min')); 81 var step = parseFloat(qty.attr('step')); 82 if ($(this).is('.plus')) { 83 if (max && (max <= val)) { 84 qty.val(max).change(); 85 } else { 86 qty.val(val + step).change(); 87 } 88 } else { 89 if (min && (min >= val)) { 90 qty.val(min).change(); 91 } else if (val > 0) { 92 qty.val(val - step).change(); 93 } 94 } 95 }); 96 // check quanity in cart page 97 $('.quantity-add-value').each(function () { 98 var type = $(this).find('.qty').attr("type"); 99 if (type == 'hidden') { 100 $(this).hide(); 101 } 102 }) 103 }, 104 105 validate_form: function (form) { 106 var valid = true, 107 email_valid = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm 108 109 form.find('input.required').each(function () { 110 // Check empty value 111 if (!$(this).val()) { 112 $(this).addClass('invalid') 113 valid = false 114 } 115 116 // Uncheck 117 if ($(this).is(':checkbox') && !$(this).is(':checked')) { 118 $(this).addClass('invalid') 119 valid = false 120 } 121 122 // Check email format 123 if ('email' === $(this).attr('type')) { 124 if (!email_valid.test($(this).val())) { 125 $(this).addClass('invalid') 126 valid = false 127 } 128 } 129 130 // Check captcha 131 if ($(this).hasClass('captcha-result')) { 132 let captcha_1 = parseInt($(this).data('captcha1')), 133 captcha_2 = parseInt($(this).data('captcha2')) 134 135 if ((captcha_1 + captcha_2) !== parseInt($(this).val())) { 136 $(this).addClass('invalid').val('') 137 valid = false 138 } 139 } 140 }) 141 142 // Check repeat password 143 if (form.hasClass('auto_login')) { 144 let $pw = form.find('input[name=password]'), 145 $repeat_pw = form.find('input[name=repeat_password]') 146 147 if ($pw.val() !== $repeat_pw.val()) { 148 $pw.addClass('invalid') 149 $repeat_pw.addClass('invalid') 150 valid = false 151 } 152 } 153 154 $('form input.required').on('focus', function () { 155 $(this).removeClass('invalid') 156 }) 157 158 return valid 159 }, 160 161 login_form: function () { 162 var teduma = this 163 164 $(document).on('click', '#thim-popup-login .close-popup', function (event) { 165 event.preventDefault() 166 $('body').removeClass('thim-popup-active') 167 teduma.el_thim_pop_up_login.removeClass() 168 169 // Remove param purchase course on login popup 170 teduma.el_loginpopupform.find('.params-purchase-code').remove() 171 // Remove param enroll course on login popup 172 teduma.el_loginpopupform.find('.params-enroll-code').remove() 173 }) 174 175 $('body .thim-login-popup a.js-show-popup').on('click', function (event) { 176 event.preventDefault() 177 178 $('body').addClass('thim-popup-active') 179 teduma.el_thim_pop_up_login.addClass('active') 180 181 if ($(this).hasClass('login')) { 182 teduma.el_thim_pop_up_login.addClass('sign-in') 183 } else { 184 teduma.el_thim_pop_up_login.addClass('sign-up') 185 } 186 }) 187 188 //when login in single page event, show login-popup ,remove redirect to page account 189 $('body .widget_book-event a.js-show-popup').on('click', function (event) { 190 event.preventDefault() 191 $('body').addClass('thim-popup-active') 192 teduma.el_thim_pop_up_login.addClass('active') 193 }) 194 195 teduma.el_thim_pop_up_login.find('.link-bottom a').on('click', function (e) { 196 e.preventDefault() 197 198 if ($(this).hasClass('login')) { 199 teduma.el_thim_pop_up_login.removeClass('sign-up').addClass('sign-in') 200 } else { 201 teduma.el_thim_pop_up_login.removeClass('sign-in').addClass('sign-up') 202 } 203 }) 204 205 // Show login popup when click to LP buttons 206 if ($('body').hasClass('thim-popup-feature')) { 207 var button_click = $('body:not(".logged-in") .enroll-course .button-enroll-course,' + 208 'body:not(".logged-in") form.purchase-course:not(".guest_checkout") .button:not(.button-add-to-cart),' + 209 'body:not(".logged-in") form.learnpress-single-package__add-cart:not(".guest_checkout") .lp-buy-package'); 210 211 button_click.on('click', function (e) { 212 const elThimLoginPopup = $('.thim-link-login.thim-login-popup .login'); 213 if ( elThimLoginPopup ) { 214 e.preventDefault(); 215 elThimLoginPopup.trigger('click') 216 217 // Add param purchase course to login and Register form if exists 218 teduma.add_params_purchase_course_to_el(teduma.el_loginpopupform) 219 teduma.add_params_purchase_course_to_el(teduma.el_registerPopupForm) 220 } 221 }) 222 223 $('.learn-press-content-protected-message .lp-link-login').on('click', function (e) { 224 e.preventDefault() 225 $('.thim-link-login.thim-login-popup .login').trigger('click') 226 // Add param purchase course to login and Register form if exists 227 teduma.add_params_purchase_course_to_el(teduma.el_loginpopupform) 228 teduma.add_params_purchase_course_to_el(teduma.el_registerPopupForm) 229 }) 230 } 231 232 $(document).on('click', '#thim-popup-login', function (e) { 233 if ($(e.target).attr('id') === 'thim-popup-login') { 234 $('body').removeClass('thim-popup-active') 235 teduma.el_thim_pop_up_login.removeClass() 236 237 // remove param purchase course on login popup 238 teduma.el_loginpopupform.find('.params-purchase-code').remove() 239 teduma.el_registerPopupForm.find('.params-purchase-code').remove() 240 // remove param enroll course on login popup 241 teduma.el_loginpopupform.find('.params-enroll-code').remove() 242 teduma.el_registerPopupForm.find('.params-enroll-code').remove() 243 } 244 }) 245 246 this.el_loginpopupform.submit(function (e) { 247 if (!thim_eduma.validate_form($(this))) { 248 e.preventDefault() 249 return false 250 } 251 252 var $elem = teduma.el_thim_pop_up_login.find('.thim-login-container') 253 $elem.addClass('loading') 254 }) 255
256 teduma.el_thim_pop_up_login.find('form[name=registerformpopup]').on('submit', function (e) { 257 if (!thim_eduma.validate_form($(this))) { 258 e.preventDefault() 259 return false 260 } 261 262 var $elem = teduma.el_thim_pop_up_login.find('.thim-login-container') 263 $elem.addClass('loading') 264 }) 265 266 //My account login 267 $('#customer_login .login').submit(function (event) { 268 var elem = $(this), 269 input_username = elem.find('#username'), 270 input_pass = elem.find('#password') 271 272 if (input_pass.length > 0 && input_pass.val() == '') { 273 input_pass.addClass('invalid') 274 event.preventDefault() 275 } 276 277 if (input_username.length > 0 && input_username.val() == '') { 278 input_username.addClass('invalid') 279 event.preventDefault() 280 } 281 }) 282 //My account register 283 $('#customer_login .register').submit(function (event) { 284 var elem = $(this), 285 input_username = elem.find('#reg_username'), 286 input_email = elem.find('#reg_email'), 287 input_pass = elem.find('#reg_password'), 288 input_captcha = $('#customer_login .register .captcha-result'), 289 valid_email = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm 290 291 if (input_captcha.length > 0) { 292 var captcha_1 = parseInt(input_captcha.data('captcha1')), 293 captcha_2 = parseInt(input_captcha.data('captcha2')) 294 295 if (captcha_1 + captcha_2 != parseInt(input_captcha.val())) { 296 input_captcha.addClass('invalid').val('') 297 event.preventDefault() 298 } 299 } 300 301 if (input_pass.length > 0 && input_pass.val() == '') { 302 input_pass.addClass('invalid') 303 event.preventDefault() 304 } 305 306 if (input_username.length > 0 && input_username.val() == '') { 307 input_username.addClass('invalid') 308 event.preventDefault() 309 } 310 311 if (input_email.length > 0 && (input_email.val() == '' || 312 !valid_email.test(input_email.val()))) { 313 input_email.addClass('invalid') 314 event.preventDefault() 315 } 316 }) 317 $('#reg_username, #reg_email, #reg_password,#username, #password').on('focus', function () { 318 $(this).removeClass('invalid') 319 }) 320 }, 321 322 /** 323 * Add params purchase course to element 324 * @purpose When register, login via buy course will send params purchase to action 325 * 326 * @param el 327 * @since 4.2.6 328 * @author tungnx 329 */ 330 add_params_purchase_course_to_el: function (el) { 331 const teduma = this 332 // Purchase course. 333 if (teduma.el_form_purchase_course.length) { 334 el.append('<p class="params-purchase-code"></p>') 335 336 var el_paramsPurchaseCode = el.find('.params-purchase-code') 337 338 $.each(teduma.el_form_purchase_course.find('input'), function (i) { 339 const inputName = $(this).attr('name') 340 const inputPurchaseCourse = $(this).clone() 341 342 if (el_paramsPurchaseCode.find('input[name=' + inputName + ']').length === 0) { 343 el_paramsPurchaseCode.append(inputPurchaseCourse) 344 } 345 }) 346 } 347 348 // Enroll course 349 if (teduma.el_form_enroll_course.length) { 350 el.append('<p class="params-enroll-code"></p>') 351 const el_paramsEnrollCode = el.find('.params-enroll-code') 352 353 $.each(teduma.el_form_enroll_course.find('input'), function (i) { 354 const inputName = $(this).attr('name') 355 const inputEnrollCourse = $(this).clone() 356 357 if (el_paramsEnrollCode.find('input[name=' + inputName + ']').length === 0) { 358 el_paramsEnrollCode.append(inputEnrollCourse) 359 } 360 }) 361 } 362 }, 363 364 form_submission_validate: function () { 365 // Form login 366 $('.form-submission-login form[name=loginform]').on('submit', function (e) { 367 if (!thim_eduma.validate_form($(this))) { 368 e.preventDefault() 369 return false 370 } 371 }) 372 373 // Form register 374 $('.form-submission-register form[name=registerform]').on('submit', function (e) { 375 if (!thim_eduma.validate_form($(this))) { 376 e.preventDefault() 377 return false 378 } 379 }) 380 381 // Form lost password 382 $('.form-submission-lost-password form[name=lostpasswordform]').on('submit', function (e) { 383 if (!thim_eduma.validate_form($(this))) { 384 e.preventDefault() 385 return false 386 } 387 }) 388 }, 389 390 thim_TopHeader: function () { 391 var header = $('#masthead'), 392 height_sticky_header = header.outerHeight(true), 393 content_pusher = $('#wrapper-container .content-pusher'), 394 top_site_main = $('#wrapper-container .top_site_main') 395 $('body').removeClass('fixloader'); 396 if (header.hasClass('header_overlay')) { // Header overlay
397 top_site_main.css({ 'padding-top': height_sticky_header + 'px' }) 398 $(window).resize(function () { 399 let height_sticky_header = header.outerHeight(true) 400 top_site_main.css({ 'padding-top': height_sticky_header + 'px' }) 401 }) 402 } else if (header.hasClass('sticky-header') & header.hasClass('header_default')) { // Header default 403 content_pusher.css({ 'padding-top': height_sticky_header + 'px' }) 404 $(window).resize(function () { 405 let height_sticky_header = header.outerHeight(true) 406 content_pusher.css({ 'padding-top': height_sticky_header + 'px' }) 407 }) 408 } 409 }, 410 411 ctf7_input_effect: function () { 412 let $ctf7_edtech = $('.form_developer_course'), 413 $item_input = $ctf7_edtech.find('.field_item input'), 414 $submit_wrapper = $ctf7_edtech.find('.submit_row') 415 416 $item_input.focus(function () { 417 $(this).parent().addClass('focusing') 418 }).blur(function () { 419 $(this).parent().removeClass('focusing') 420 421 }) 422 $submit_wrapper.on('click', function () { 423 $(this).closest('form').submit() 424 }) 425 }, 426 427 thim_menu: function () { 428 // add class last-menu-item 429 $('.width-navigation .menu-main-menu>li.menu-item').last().addClass('last-menu-item') 430 431 //Add class for masthead 432 var $header = $('#masthead.sticky-header'), 433 off_Top = ($('.content-pusher').length > 0) ? $('.content-pusher').offset().top : 0, 434 menuH = $header.outerHeight(), 435 latestScroll = 0 436 var $imgLogo = $('.site-header .thim-logo img'), 437 srcLogo = $($imgLogo).attr('src'), 438 dataRetina = $($imgLogo).data('retina'), 439 dataSticky = $($imgLogo).data('sticky'), 440 dataMobile = $($imgLogo).data('mobile'), 441 dataStickyMobile = $($imgLogo).data('sticky_mobile'); 442 if ($(window).scrollTop() > 2) { 443 $header.removeClass('affix-top').addClass('affix') 444 } 445 if ($(window).outerWidth() < 769) { 446 if (dataMobile != null) { 447 $($imgLogo).attr('src', dataMobile); 448 } 449 } else { 450 if (window.devicePixelRatio > 1 && dataRetina != null) { 451 $($imgLogo).attr('src', dataRetina); 452 } 453 } 454 let flag = false; 455 $(window).scroll(function () { 456 var current = $(this).scrollTop() 457 if (current > 2) { 458 $header.removeClass('affix-top').addClass('affix'); 459 if (!flag) { 460 if ($(window).outerWidth() < 769) { 461 if (dataStickyMobile != null) { 462 $($imgLogo).attr('src', dataStickyMobile); 463 } else { 464 if (dataSticky != null) { 465 $($imgLogo).attr('src', dataSticky); 466 } 467 } 468 } else { 469 if (dataSticky != null) { 470 $($imgLogo).attr('src', dataSticky); 471 } 472 } 473 } 474 flag = true; 475 } else { 476 $header.removeClass('affix').addClass('affix-top'); 477 if (flag) { 478 if ($(window).outerWidth() < 769) { 479 if (dataMobile != null) { 480 $($imgLogo).attr('src', dataMobile); 481 } else if (srcLogo != null) { 482 $($imgLogo).attr('src', srcLogo); 483 } 484 } else { 485 if (window.devicePixelRatio > 1 && dataRetina != null) { 486 $($imgLogo).attr('src', dataRetina); 487 488 } else if (srcLogo != null) { 489 $($imgLogo).attr('src', srcLogo); 490 } 491 } 492 } 493 flag = false; 494 } 495 496 if (current > latestScroll && current > menuH + off_Top) { 497 if (!$header.hasClass('menu-hidden')) { 498 $header.addClass('menu-hidden') 499 } 500 } else { 501 if ($header.hasClass('menu-hidden')) { 502 $header.removeClass('menu-hidden') 503 } 504 } 505 506 latestScroll = current 507 }) 508 509 //Submenu position 510 $('.wrapper-container:not(.mobile-menu-open) .site-header .navbar-nav > .menu-item').each(function () { 511 if ($('>.sub-menu', this).length <= 0) { 512 return 513 } 514 515 let elm = $('>.sub-menu', this), 516 off = elm.offset(), 517 left = off.left, 518 width = elm.width() 519 520 let navW = $('.thim-nav-wrapper').width(), 521 isEntirelyVisible = (left + width <= navW) 522 523 if (!isEntirelyVisible) { 524 elm.addClass('dropdown-menu-right') 525 } else { 526 let subMenu2 = elm.find('>.menu-item>.sub-menu') 527 528 if (subMenu2.length <= 0) { 529 return 530 } 531 532 let off = subMenu2.offset(), 533 left = off.left, 534 width = subMenu2.width() 535 536 let isEntirelyVisible = (left + width <= navW) 537 538 if (!isEntirelyVisible) { 539 elm.addClass('dropdown-left-side') 540 } 541 } 542 }) 543 544 let $headerLayout = $('header#masthead') 545 let magicLine = function () { 546 if ($(window).width() > 768) { 547 //Magic Line 548 var menu_active = $( 549 '#masthead .navbar-nav>li.menu-item.current-menu-item,#masthead .navbar-nav>li.menu-item.current-menu-parent, #masthead .navbar-nav>li.menu-item.current-menu-ancestor') 550 if (menu_active.length > 0) { 551 menu_active.before('<span id="magic-line"></span>') 552 var menu_active_child = menu_active.find( 553 '>a,>span.disable_link,>span.tc-menu-inner'), 554 menu_left = menu_active.position().left, 555 menu_child_left = parseInt(menu_active_child.css('padding-left')), 556 magic = $('#magic-line') 557 558 magic.width(menu_active_child.width()).css('left', Math.round(menu_child_left + menu_left)).data('magic-width', magic.width()).data('magic-left', magic.position().left) 559 560 } else { 561 var first_menu = $( 562 '#masthead .navbar-nav>li.menu-item:first-child') 563 first_menu.before('<span id="magic-line"></span>') 564 var magic = $('#magic-line') 565 magic.data('magic-width', 0) 566 } 567 568 var nav_H = parseInt($('.site-header .navigation').outerHeight()) 569 magic.css('bottom', nav_H - (nav_H - 90) / 2 - 64) 570 if ($headerLayout.hasClass('item_menu_active_top')) { 571 magic.css('bottom', nav_H - 2) 572 } 573 $('#masthead .navbar-nav>li.menu-item').on({ 574 'mouseenter': function () { 575 var elem = $(this).find('>a,>span.disable_link,>span.tc-menu-inner'), 576 new_width = elem.width(), 577 parent_left = elem.parent().position().left, 578 left = parseInt(elem.css('padding-left')) 579 if (!magic.data('magic-left')) { 580 magic.css('left', Math.round(parent_left + left)) 581 magic.data('magic-left', 'auto') 582 } 583 magic.stop().animate({ 584 left: Math.round(parent_left + left), 585 width: new_width, 586 }) 587 }, 588 'mouseleave': function () { 589 magic.stop().animate({ 590 left: magic.data('magic-left'), 591 width: magic.data('magic-width'), 592 }) 593 }, 594 }) 595 } 596 } 597 598 if (!$headerLayout.hasClass('noline_menu_active')) { 599 magicLine() 600 } 601 602 }, 603 604 mobile_menu_toggle: function () { 605 // Mobile Menu 606 if (jQuery('.navbar-nav>li.menu-item-has-children').hasClass("thim-ekits-menu__has-dropdown") == false) { 607 if (jQuery(window).width() > 1024) { 608 jQuery('.navbar-nav>li.menu-item-has-children >a,.navbar-nav>li.menu-item-has-children >span,.navbar-nav>li.tc-menu-layout-builder >a,.navbar-nav>li.tc-menu-layout-builder >span').after( 609 '<span class="icon-toggle"><i class="edu-angle-down"></i></span>') 610 } else { 611 jQuery('.navbar-nav li.menu-item-has-children:not(.current-menu-parent) >a,.navbar-nav li.menu-item-has-children:not(.current-menu-parent) >span,.navbar-nav li.tc-menu-layout-builder:not(.current-menu-parent) >a,.navbar-nav li.tc-menu-layout-builder:not(.current-menu-parent) >span').after( 612 '<span class="icon-toggle"><i class="edu-angle-down"></i></span>') 613 jQuery('.navbar-nav li.menu-item-has-children.current-menu-parent >a,.navbar-nav li.menu-item-has-children.current-menu-parent >span,.navbar-nav li.tc-menu-layout-builder.current-menu-parent >a,.navbar-nav li.tc-menu-layout-builder.current-menu-parent >span').after( 614 '<span class="icon-toggle"><i class="edu-angle-up"></i></span>') 615 } 616 } 617 618 $(document).on('click', '.menu-mobile-effect', function (e) { 619 e.stopPropagation() 620 $('body').toggleClass('mobile-menu-open') 621 }) 622 623 $(document).on('click', '.wrapper-container', function (e) { 624 $('body').removeClass('mobile-menu-open') 625 }) 626 627 $(document).on('click', '.mobile-menu-inner', function (e) { 628 e.stopPropagation() 629 }) 630
631 $('.navbar-nav li .icon-toggle').on('click', function (e) { 632 e.stopPropagation(); 633 $(this).parent().toggleClass('thim-ekits-menu__is-hover'); 634 }) 635 636 $('.navbar-nav li .icon-toggle,.thim-ekits-menu__icon').on('click', function (e) { 637 e.stopPropagation(); 638 $('.mobile-menu-wrapper .icon-menu-back').addClass('show-icon'); 639 }) 640 641 $('.mobile-menu-wrapper .icon-menu-back').on('click', function (e) { 642 e.stopPropagation(); 643 const openSubmenus = document.querySelectorAll('.thim-ekits-menu__is-hover'); 644 if (openSubmenus.length > 0) { 645 // Remove the thim-ekits-menu__is-hover class from the last (deepest) element 646 openSubmenus[openSubmenus.length - 1].classList.remove('thim-ekits-menu__is-hover'); 647 } 648 // Check if there are any elements with the class open-submenu left 649 if (document.querySelectorAll('.thim-ekits-menu__is-hover').length === 0) { 650 // Remove the show-icon class from the icon-remove element 651 this.classList.remove('show-icon'); 652 } 653 }) 654 }, 655 656 thim_carousel: function () { 657 if (jQuery().owlCarousel) { 658 let is_rtl = $('body').hasClass('rtl') ? true : false; 659 $('.thim-gallery-images').owlCarousel({ 660 rtl: is_rtl, 661 autoplay: false, 662 singleItem: true, 663 stopOnHover: true, 664 autoHeight: false, 665 loop: true, 666 loadedClass: 'owl-loaded owl-carousel', 667 }) 668 669 $('.thim-carousel-wrapper').each(function () { 670 671 var item_visible = $(this).data('visible') ? parseInt( 672 $(this).data('visible')) : 4, 673 item_desktopsmall = $(this).data('desktopsmall') ? parseInt( 674 $(this).data('desktopsmall')) : item_visible, 675 itemsTablet = $(this).data('itemtablet') ? parseInt( 676 $(this).data('itemtablet')) : 2, 677 itemsMobile = $(this).data('itemmobile') ? parseInt( 678 $(this).data('itemmobile')) : 1, 679 pagination = !!$(this).data('pagination'), 680 navigation = !!$(this).data('navigation'), 681 autoplay = $(this).data('autoplay') ? parseInt( 682 $(this).data('autoplay')) : false, 683 margin = $(this).data('margin') ? parseInt( 684 $(this).data('margin')) : 0, 685 navigation_text = ($(this).data('navigation-text') && 686 $(this).data('navigation-text') === '2') ? [ 687 '<i class=\'edu-long-arrow-left \'></i>', 688 '<i class=\'edu-long-arrow-right \'></i>', 689 ] : [ 690 '<i class=\'edu-chevron-left \'></i>', 691 '<i class=\'edu-chevron-right \'></i>', 692 ] 693 $(this).owlCarousel({ 694 items: item_visible, 695 // itemsDesktop : [1200, item_visible], 696 // itemsDesktopSmall: [1024, item_desktopsmall], 697 // itemsTablet : [768, itemsTablet], 698 // itemsMobile : [480, itemsMobile], 699 nav: navigation, 700 dots: pagination, 701 loop: ($(this).children().length > item_visible) ? true : false, 702 rewind: true, 703 rtl: is_rtl, 704 margin : margin, 705 // dots : true, 706 loadedClass: 'owl-loaded owl-carousel', 707 navContainerClass: 'owl-nav owl-buttons', 708 dotsClass: 'owl-dots owl-pagination', 709 dotClass: 'owl-page', 710 responsive: { 711 0: { 712 items: itemsMobile, 713 dots: true, 714 nav: false 715 }, 716 480: { 717 items: itemsTablet 718 }, 719 1024: { 720 items: item_desktopsmall 721 }, 722 1200: { 723 items: item_visible 724 } 725 }, 726 lazyLoad: true, 727 autoplay: autoplay, 728 navText: navigation_text, 729 afterAction: function () { 730 var width_screen = $(window).width() 731 var width_container = $('#main-home-content').width() 732 var elementInstructorCourses = $('.thim-instructor-courses') 733 var button_full_left = $('.thim_full_right.thim-event-layout-6') 734 if (button_full_left.length) { 735 var full_left = (jQuery(window).width() - button_full_left.width()) / 2; 736 button_full_left.find('.owl-controls .owl-buttons').css("margin-left", "-" + full_left + "px") 737 button_full_left.find('.owl-controls .owl-buttons').css({ 738 'margin-left': '-' + full_left + 'px', 739 'padding-left': full_left + 'px', 740 'margin-right': full_left + 'px', 741 }) 742 } 743 if (elementInstructorCourses.length) { 744 if (width_screen > width_container) { 745 var margin_left_value = (width_screen - width_container) / 2 746 $('.thim-instructor-courses .thim-course-slider-instructor .owl-control
746s .owl-buttons').css('left', margin_left_value + 'px') 747 } 748 } 749 } 750 }) 751 thim_eduma.addWrapOwlControls($(this)); 752 753 }) 754 755 $('.thim-course-slider-instructor').each(function () { 756 var item_visible = $(this).data('visible') ? parseInt($(this).data('visible')) : 4, 757 item_desktopsmall = $(this).data('desktopsmall') ? parseInt( 758 $(this).data('desktopsmall')) : item_visible, 759 itemsTablet = $(this).data('itemtablet') ? parseInt( 760 $(this).data('itemtablet')) : 2, 761 itemsMobile = $(this).data('itemmobile') ? parseInt( 762 $(this).data('itemmobile')) : 1, 763 pagination = !!$(this).data('pagination'), 764 navigation = !!$(this).data('navigation'), 765 autoplay = $(this).data('autoplay') ? parseInt( 766 $(this).data('autoplay')) : false, 767 navigation_text = ($(this).data('navigation-text') && 768 $(this).data('navigation-text') === '2') ? [ 769 '<i class=\'edu-long-arrow-left \'></i>', 770 '<i class=\'edu-long-arrow-right \'></i>', 771 ] : [ 772 '<i class=\'edu-chevron-left \'></i>', 773 '<i class=\'edu-chevron-right \'></i>', 774 ] 775 776 $(this).owlCarousel({ 777 items: item_visible, 778 rtl: is_rtl, 779 // itemsDesktop : [1400, item_desktopsmall], 780 // itemsDesktopSmall: [1024, itemsTablet], 781 // itemsTablet : [768, itemsTablet], 782 // itemsMobile : [480, itemsMobile], 783 responsive: { 784 0: { 785 items: itemsMobile 786 }, 787 480: { 788 items: itemsTablet 789 }, 790 1024: { 791 items: itemsTablet 792 }, 793 1400: { 794 items: item_desktopsmall 795 } 796 }, 797 nav: navigation, 798 dots: pagination, 799 loop: ($(this).children().length > item_visible) ? true : false, 800 rewind: true, 801 lazyLoad: true, 802 autoplay: autoplay, 803 navText: navigation_text, 804 loadedClass: 'owl-loaded owl-carousel', 805 navContainerClass: 'owl-nav owl-buttons', 806 dotsClass: 'owl-dots owl-pagination', 807 dotClass: 'owl-page', 808 afterAction: function () { 809 var width_screen = $(window).width() 810 var width_container = $('#main-home-content').width() 811 var elementInstructorCourses = $('.thim-instructor-courses') 812 813 if (elementInstructorCourses.length) { 814 if (width_screen > width_container) { 815 var margin_left_value = (width_screen - width_container) / 2 816 $('.thim-instructor-courses .thim-course-slider-instructor .owl-controls .owl-buttons').css('left', margin_left_value + 'px') 817 } 818 } 819 } 820 }) 821 thim_eduma.addWrapOwlControls($(this)); 822 }) 823 824 $('.thim-carousel-course-categories .thim-course-slider, .thim-carousel-course-categories-tabs .thim-course-slider').each(function () { 825 826 var item_visible = $(this).data('visible') ? parseInt($(this).data('visible')) : 7, 827 item_desktop = $(this).data('desktop') ? parseInt($(this).data('desktop')) : item_visible, 828 item_desktopsmall = $(this).data('desktopsmall') ? parseInt($(this).data('desktopsmall')) : 6, 829 item_tablet = $(this).data('tablet') ? parseInt($(this).data('tablet')) : 4, 830 item_mobile = $(this).data('mobile') ? parseInt($(this).data('mobile')) : 2, 831 pagination = !!$(this).data('pagination'), 832 navigation = !!$(this).data('navigation'), 833 autoplay = $(this).data('autoplay') ? parseInt($(this).data('autoplay')) : false 834 $(this).owlCarousel({ 835 items: item_visible, 836 loop: ($(this).children().length > item_visible) ? true : false, 837 rewind: true, 838 rtl: is_rtl, 839 responsive: { 840 841 0: { 842 items: item_mobile 843 }, 844 480: { 845 items: item_tablet 846 }, 847 1024: { 848 items: item_desktopsmall 849 }, 850 1800: { 851 items: item_desktop 852 } 853 }, 854 nav: navigation, 855 dots: pagination, 856 loadedClass: 'owl-loaded owl-carousel', 857 autoplay: autoplay, 858 navContainerClass: 'owl-nav owl-buttons', 859 dotsClass: 'owl-dots owl-pagination', 860 dotClass: 'owl-page', 861 navText: [ 862 '<i class=\'edu-chevron-left \'></i>', 863 '<i class=\'edu-chevron-right \'></i>', 864 ], 865 }) 866 thim_eduma.addWrapOwlControls($(this)); 867 }) 868 if ($('div').hasClass('cross-sells')) { 869 var $product_grid = $('.cross-sells').find('.product-grid'), 870 $product_item = $product_grid.find('.product'); 871 if ($product_item.length > 3) { 872 $product_grid.owlCarousel({ 873 items : 4, 874 loop : false, 875 rewind : true, 876 dots : true, 877 nav : true, 878 margin: 30, 879 responsive: { 880 0 : { 881 items : 1, 882 margin: 0, 883 }, 884 480 : { 885 items : 2, 886 margin: 15, 887 }, 888 768 : { 889 items: 3, 890 }, 891 1290: { 892 items: 4 893 }, 894 }, 895 loadedClass : 'owl-loaded owl-carousel', 896 navContainerClass: 'owl-nav owl-buttons', 897 dotsClass : 'owl-dots owl-pagination', 898 dotClass : 'owl-page', 899 autoplay : false, 900 navText : ['<i class=\'edu-angle-left \'></i>', 901 '<i class=\'edu-angle-right \'></i>', 902 ], 903 }) 904 thim_eduma.addWrapOwlControls($product_grid); 905 } 906 } 907 } 908 }, 909 910 thim_gallery: function () { 911 if ($('article.format-gallery .flexslider').length > 0){ 912 $('article.format-gallery .flexslider').imagesLoaded(function () { 913 if (jQuery().flexslider) { 914 $('.flexslider').flexslider({ 915 slideshow: true, 916 animation: 'fade', 917 pauseOnHover: true, 918 animationSpeed: 400, 919 smoothHeight: true, 920 directionNav: true, 921 controlNav: false, 922 }) 923 } 924 }); 925 } 926 927 if ($('.thim-ekit-single-post__featured-image .flexslider').length > 0){ 928 $('.thim-ekit-single-post__featured-image .flexslider').imagesLoaded(function () { 929 if (jQuery().flexslider) { 930 $('.flexslider').flexslider({ 931 slideshow: true, 932 animation: 'fade', 933 pauseOnHover: true, 934 animationSpeed: 400, 935 smoothHeight: true, 936 directionNav: true, 937 controlNav: false, 938 }) 939 } 940 }); 941 } 942 943 944 var $container = $('.isotope-layout') 945 if ($container.length > 0) { 946 $container.each(function () { 947 var $this = jQuery(this), $width, $col, $width_unit, 948 $height_unit; 949 var $spacing = 30; 950 $col = $(this).data('column') ? parseInt($(this).data('column')) : 4; 951 if ($col != 1) { 952 if (parseInt($container.width()) < 768) { 953 $col = 2 954 } 955 if (parseInt($container.width()) < 480) { 956 $col = 1 957 } 958 959 } 960 $width_unit = Math.floor((parseInt($container.width(), 10) - 961 ($col - 1) * $spacing) / $col) 962 $height_unit = Math.floor(parseInt($width_unit, 10)) 963 964 $this.find('.item_gallery').css({ 965 width: $width_unit, 966 }) 967 968 if (jQuery().isotope) { 969 $this.isotope({ 970 itemSelector: '.item_gallery', 971 masonry: { 972 columnWidth: $width_unit, 973 gutter: $spacing, 974 }, 975 }) 976 } 977 }) 978 } 979 $(document).on('click', '.thim-gallery-popup', function (e) { 980 e.preventDefault() 981 var nonce = (typeof thim_ajax_vars !== 'undefined') ? thim_ajax_vars.nonce_gallery_popup : '' 982 var elem = $(this), post_id = elem.attr('data-id'), 983 data = { action: 'thim_gallery_popup', post_id: post_id, nonce: nonce } 984 elem.addClass('loading') 985 $.post(ajaxurl, data, function (response) { 986 elem.removeClass('loading') 987 $('.thim-gallery-show').append(response) 988 if ($('.thim-gallery-show img').length > 0) { 989 $('.thim-gallery-show').magnificPopup({ 990 mainClass: 'my-mfp-zoom-in', 991 type: 'image', 992 delegate: 'a', 993 showCloseBtn: false, 994 gallery: { 995 enabled: true, 996 }, 997 callbacks: { 998 open: function () { 999 $('body').addClass('thim-popup-active') 1000 $.magnificPopup.instance.close = function () { 1001 $('.thim-gallery-show').empty() 1002 $('body').removeClass('thim-popup-active') 1003 $.magnificPopup.proto.close.call(this) 1004 } 1005 }, 1006 }, 1007 }).magnificPopup('open') 1008 } else { 1009 $.magnificPopup.open({ 1010 mainClass: 'my-mfp-zoom-in', 1011 items: { 1012 src: $('.thim-gallery-show'), 1013 type: 'inline', 1014 }, 1015 showCloseBtn: false, 1016 callbacks: { 1017 open: function () { 1018 $('body').addClass('thim-popup-active') 1019 $.magnificPopup.instance.close = function () { 1020 $('.thim-gallery-show').empty() 1021 $('body').removeClass('thim-popup-active') 1022 $.magnificPopup.proto.close.call(this) 1023 } 1024 }, 1025 }, 1026 }) 1027 } 1028 }) 1029 }) 1030 // Gallery Filter Click Handler
1031 $(document).on("click", ".filter-controls .filter", function (e) { 1032 e.preventDefault(); 1033 var $filter = $(this); 1034 var filterValue = $filter.data("filter"); 1035 var $wrapper = $filter.closest(".thim-widget-gallery-posts"); 1036 var $loadMoreWrap = $wrapper.find(".thim-gallery-loadmore-wrap"); 1037 $filter 1038 .closest(".filter-controls") 1039 .find(".filter") 1040 .removeClass("active"); 1041 $filter.addClass("active"); 1042 if (filterValue === "*") { 1043 $loadMoreWrap.show(); 1044 } else { 1045 $loadMoreWrap.hide(); 1046 } 1047 var $container = $wrapper.find(".isotope-layout"); 1048 if ($container.length && jQuery().isotope) { 1049 $container.isotope({ filter: filterValue }); 1050 } 1051 }); 1052 // Gallery Load More 1053 $(document).on("click", ".thim-gallery-load-more", function (e) { 1054 e.preventDefault(); 1055 var $button = $(this), 1056 $wrapper = $button.closest(".thim-widget-gallery-posts"), 1057 $container = $wrapper.find(".wrapper-gallery-filter"), 1058 currentPage = parseInt($button.data("page")), 1059 maxPages = parseInt($button.data("max")), 1060 limit = parseInt($button.data("limit")), 1061 columns = parseInt($button.data("columns")), 1062 cat = $button.data("cat"), 1063 template = $button.data("template"), 1064 nonce = $button.data("nonce"); 1065 1066 if ($button.hasClass("loading")) { 1067 return; 1068 } 1069 1070 $button.addClass("loading").text("Loading..."); 1071 1072 var data = { 1073 action: "thim_gallery_load_more", 1074 page: currentPage + 1, 1075 limit: limit, 1076 columns: columns, 1077 cat: cat, 1078 template: template, 1079 nonce: nonce, 1080 }; 1081 1082 $.post(ajaxurl, data, function (response) { 1083 if (response.success && response.data.html) { 1084 var $newItems = $(response.data.html); 1085 1086 // if (template === "isotope") { 1087 // For isotope layout 1088 $container.append($newItems).isotope("appended", $newItems); 1089 1090 // Recalculate isotope layout 1091 setTimeout(function () { 1092 $container.isotope("layout"); 1093 }, 100); 1094 // } else { 1095 // // For base layout 1096 // $container.append($newItems); 1097 // } 1098 1099 // Update button data 1100 $button.data("page", currentPage + 1); 1101 1102 // Hide button if no more pages 1103 if (!response.data.has_more || currentPage + 1 >= maxPages) { 1104 $button.hide(); 1105 } 1106 } else { 1107 // Hide button if no content returned 1108 $button.hide(); 1109 } 1110 }) 1111 .fail(function () { 1112 alert("Error loading more items. Please try again."); 1113 }) 1114 .always(function () { 1115 $button.removeClass("loading").text("Load More"); 1116 }); 1117 }); 1118 }, 1119 1120 1121 thim_contentslider: function () { 1122 $('.thim-testimonial-slider').each(function () { 1123 var elem = $(this), 1124 item_visible = parseInt(elem.data('visible')), 1125 item_time = parseInt(elem.data('time')), 1126 autoplay = elem.data('auto') ? true : false, 1127 item_ratio = elem.data('ratio') ? elem.data('ratio') : 1.18, 1128 item_padding = elem.data('padding') ? elem.data('padding') : 15, 1129 item_activepadding = elem.data('activepadding') ? elem.data('activepadding') : 0, 1130 item_width = elem.data('width') ? elem.data('width') : 100, 1131 mousewheel = !!elem.data('mousewheel') 1132 if (jQuery().thimContentSlider) { 1133 var testimonial_slider = $(this).thimContentSlider({ 1134 items: elem, 1135 itemsVisible: item_visible, 1136 mouseWheel: mousewheel, 1137 autoPlay: autoplay, 1138 pauseTime: item_time, 1139 itemMaxWidth: item_width, 1140 itemMinWidth: item_width, 1141 activeItemRatio: item_ratio, 1142 activeItemPadding: item_activepadding, 1143 itemPadding: item_padding, 1144 }) 1145 } 1146 }) 1147 }, 1148 1149 counter_box: function () { 1150 if (jQuery().waypoint) { 1151 jQuery('.counter-box').waypoint(function () { 1152 jQuery(this).find('.display-percentage').each(function () { 1153 var percentage = jQuery(this).data('percentage') 1154 jQuery(this).countTo({ 1155 from: 0, 1156 to: percentage, 1157 refreshInterval: 40, 1158 speed: 2000, 1159 }) 1160 }) 1161 }, { 1162 triggerOnce: true, 1163 offset: '80%', 1164 }) 1165 } 1166 }, 1167 1168 thim_background_gradient: function () { 1169 var background_gradient = jQuery('.thim_overlay_gradient') 1170 var background_gradient_2 = jQuery('.thim_overlay_gradient_2') 1171 if (background_gradient.length) { 1172 $('.thim_overlay_gradient rs-sbg-px > rs-sbg-wrap > rs-sbg').addClass('thim-overlayed') 1173 } 1174 1175 if (background_gradient_2.length) { 1176 $('.thim_overlay_gradient_2 rs-sbg-px > rs-sbg-wrap > rs-sbg').addClass('thim-overlayed') 1177 } 1178 }, 1179 1180 thim_magnificPopup: function () { 1181 if (jQuery().magnificPopup) { 1182 $('.thim-single-image-popup,.thim-image-popup').magnificPopup({ 1183 type: 'image', 1184 zoom: { 1185 enabled: true, 1186 duration: 300, 1187 easing: 'ease-in-out', 1188 } 1189 }) 1190 $('.thim-video-popup .button-popup').on('click', function (e) { 1191 var item = $(this) 1192 e.preventDefault() 1193 $.magnificPopup.open({ 1194 items: { 1195 src: item.parent().parent().find('.video-content'), 1196 type: 'inline', 1197 }, 1198 showCloseBtn: false, 1199 callbacks: { 1200 open: function () { 1201 $('body').addClass('thim-popup-active') 1202 $.magnificPopup.instance.close = function () { 1203 $('body').removeClass('thim-popup-active') 1204 $.magnificPopup.proto.close.call(this) 1205 } 1206 }, 1207 }, 1208 }) 1209 }) 1210 } 1211 }, 1212 1213 full_right: function () { 1214 $('.thim_full_right').each(function () { 1215 var full_right = (jQuery(window).width() - jQuery(this).width()) / 2; 1216 jQuery(this).children().css("margin-right", "-" + full_right + "px"); 1217 }); 1218 $('.thim_full_left').each(function () { 1219 var full_left = (jQuery(window).width() - jQuery(this).width()) / 2;
1220 jQuery(this).children().css("margin-left", "-" + full_left + "px"); 1221 }); 1222 $('.thim_coundown_full_left').each(function () { 1223 var full_left = (jQuery(window).width() - jQuery(this).width()) / 2; 1224 var number = full_left + 'px'; 1225 jQuery(this).find('.thim-widget-countdown-box').parent().css({ 1226 "margin-left": '-' + number, 1227 "padding-left": number 1228 }); 1229 }); 1230 $('footer#colophon.has-footer-bottom').css('margin-bottom', $('.footer-bottom').height()) 1231 1232 // Fix RTL row full of VC 1233 var left_has_fill = parseFloat($('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css('left')), 1234 left_no_padding = parseFloat($('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css('left')) 1235 if (left_has_fill != 'undefined') { 1236 $('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css({ 'right': left_has_fill, 'left': '' }) 1237 } 1238 if (left_no_padding != 'undefined') { 1239 $('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css({ 'right': left_no_padding, 'left': '' }) 1240 } 1241 }, 1242 1243 thim_course_offline_popup_form_register: function () { 1244 if ($('#contact-form-registration >.wpcf7').length) { 1245 var el = $('#contact-form-registration >.wpcf7'); 1246 el.append('<a href="#" class="thim-close edu-times"></a>'); 1247 } 1248 $(document).on('click', '#contact-form-registration .wpcf7-form-control.wpcf7-submit', function () { 1249 $(document).on('mailsent.wpcf7', function (event) { 1250 setTimeout(function () { 1251 $('body').removeClass('thim-contact-popup-active'); 1252 $('#contact-form-registration').removeClass('active'); 1253 }, 3000); 1254 }); 1255 }); 1256 $(document).on('click', '.course-payment .thim-enroll-course-button', function (e) { 1257 e.preventDefault(); 1258 $('body').addClass('thim-contact-popup-active'); 1259 $('#contact-form-registration').addClass('active'); 1260 }); 1261 1262 $(document).on('click', '#contact-form-registration', function (e) { 1263 if ($(e.target).attr('id') == 'contact-form-registration') { 1264 $('body').removeClass('thim-contact-popup-active'); 1265 $('#contact-form-registration').removeClass('active'); 1266 } 1267 }); 1268 1269 $(document).on('click', '#contact-form-registration .thim-close', function (e) { 1270 e.preventDefault(); 1271 $('body').removeClass('thim-contact-popup-active'); 1272 $('#contact-form-registration').removeClass('active'); 1273 }); 1274 }, 1275 1276 course_sidebar_right_offset_top: function () { 1277 var elementInfoTop = $('.course-info-top'); 1278 if (elementInfoTop.length) { 1279 var InfoTopHeight = elementInfoTop.innerHeight(), 1280 elementInfoRight = $('.thim-style-content-layout_style_3 .sticky-sidebar'); 1281 elementInfoRight.css('margin-top', '-' + (InfoTopHeight - 20) + 'px'); 1282 } 1283 }, 1284 1285 addWrapOwlControls: function (el) { 1286 const elOwlControls = el.find('.owl-controls'); 1287 if (!elOwlControls.length) { 1288 el.find('.owl-nav, .owl-dots').wrapAll("<div class='owl-control
1288s'></div>"); 1289 } 1290 }, 1291 1292 event_click: function () { 1293 $(document).on('click', '.filter-courses-effect', function (e) { 1294 e.stopPropagation() 1295 $('body').toggleClass('mobile-filter-open') 1296 }) 1297 $(document).on('click', '.filter-column, .close-filter, .widget-area, .course-filter-submit, .lp-form-course-filter__close', function (e) { 1298 $('body').removeClass('mobile-filter-open') 1299 }) 1300 $(document).on('click', '.filter-course, .widget_course_filter', function (e) { 1301 e.stopPropagation() 1302 }) 1303 $(document).on('click', '.button-categories-popup', function (e) { 1304 e.stopPropagation() 1305 $('body').toggleClass('categories-popup-open') 1306 }) 1307 $(document).on('click', '.categories-column, .close-categories', function (e) { 1308 $('body').removeClass('categories-popup-open') 1309 }) 1310 $(document).on('click', '.categories-popup', function (e) { 1311 e.stopPropagation() 1312 }) 1313 1314 $('.video-container').on('click', '.beauty-intro .btns', function () { 1315 var iframe = '<iframe src="' + $(this).closest('.video-container').find('.yt-player').attr('data-video') + '" height= "' + $('.parallaxslider').height() + '"></iframe>' 1316 $(this).closest('.video-container').find('.yt-player').replaceWith(iframe) 1317 $(this).closest('.video-container').find('.hideClick:first').css('display', 'none') 1318 }) 1319 1320 // add icon for button show pass 1321 $('.login-password').append('<span id="show_pass"><i class="edu-eye"></i></span>') 1322 $(document).on('click', '#show_pass', function () { 1323 var el = $(this), thim_pass = el.parents('.login-password').find('>input') 1324 if (el.hasClass('active')) { 1325 thim_pass.attr('type', 'password') 1326 } else { 1327 thim_pass.attr('type', 'text') 1328 } 1329 el.toggleClass('active') 1330 }) 1331 1332 // Nav scroll 1333 $('.navbar-nav li a,.arrow-scroll > a').on('click', function (e) { 1334 var height = 0, 1335 sticky_height = jQuery('#masthead').outerHeight(), 1336 menu_anchor = jQuery(this).attr('href'), 1337 adminbar_height = jQuery('#wpadminbar').outerHeight(); 1338 if (parseInt(jQuery(window).scrollTop(), 10) < 2) { 1339 height = 47 1340 } 1341 1342 if (menu_anchor && menu_anchor.indexOf('#') == 0 && menu_anchor.length > 1) { 1343 e.preventDefault() 1344 $('html,body').animate({ 1345 scrollTop: jQuery(menu_anchor).offset().top - adminbar_height - sticky_height + height, 1346 }, 850) 1347 } 1348 }) 1349 1350 // menu course scroll 1351 $(document).on('click', '.content_course_2 .course_right .menu_course ul li a, .content_course_2 .thim-course-menu-landing .thim-course-landing-tab li a', function () { 1352 $('html, body').animate({ 1353 scrollTop: $($(this).attr('href')).offset().top, 1354 }, 1000) 1355 }) 1356 1357 // Filter Gallery 1358 $(document).on('click', '.filter-controls .filter', function (e) { 1359 e.preventDefault() 1360 var filter = $(this).data('filter'), 1361 filter_wraper = $(this).parents('.thim-widget-gallery-posts').find('.wrapper-gallery-filter') 1362 $('.filter-controls .filter').removeClass('active') 1363 $(this).addClass('active') 1364 filter_wraper.isotope({ filter: filter }) 1365 }) 1366 //Background video 1367 $('.bg-video-play').on('click', function () { 1368 var elem = $(this), 1369 video = $(this).parents('.thim-widget-icon-box').find('.full-screen-video'), 1370 player = video.get(0) 1371 if (player.paused) { 1372 player.play() 1373 elem.addClass('bg-pause') 1374 } else { 1375 player.pause() 1376 elem.removeClass('bg-pause') 1377 } 1378 }) 1379 1380 var tab_cat_course = $('.thim-carousel-course-categories-tabs') 1381 tab_cat_course.each(function () { 1382 tab_cat_course.find('.thim-course-slider .item').click(function (e) { 1383 e.preventDefault() 1384 tab_cat_course.find('.item_content.active').removeClass('active') 1385 tab_cat_course.find($(this).find('.title a').attr('href')).addClass('active') 1386 tab_cat_course.find('.thim-course-slider .item.active').removeClass('active') 1387 $(this).addClass('active') 1388 }) 1389 }) 1390 1391 //popup category 1392 var popup_cat = $('.click-show-sub') 1393 popup_cat.each(function () { 1394 popup_cat.find('li.has-child .drop-icon').click(function (e) { 1395 e.preventDefault() 1396 if ($(this).parents('li.has-child').hasClass('active')){ 1397 $(this).parents('li.has-child').removeClass('active') 1398 }else { 1399 popup_cat.find('li.has-child.active').removeClass('active') 1400 $(this).parents('li.has-child').addClass('active') 1401 } 1402 }) 1403 }) 1404 1405 var $login_user_info = $('.thim-login-popup.has_sub_info'); 1406 if($login_user_info.length > 0) { 1407 $(document).on('click', '.thim-login-popup.has_sub_info > .profile', function (e) { 1408 e.preventDefault(); 1409 $(this).next('.user-info').toggle(); 1410 $login_user_info.toggleClass('show'); 1411 }); 1412 1413 $(document).on('click', function(event) { 1414 if (!$(event.target).closest('.profile, .user-info').length) { 1415 $('.user-info').hide(); 1416 $login_user_info.removeClass('show'); 1417 } 1418 }); 1419 } 1420 1421 //Add class for nav-tabs single course 1422 var tab_course = $('.course-tabs .nav-tabs>li').length 1423 if (tab_course > 0) { 1424 $('.course-tabs .nav-tabs>li').addClass('thim-col-' + tab_course) 1425 } 1426 $('.filter-button-toggle-wp').on('click', function () { 1427 $('body').toggleClass('thim-filter-product'); 1428 }); 1429 document.addEventListener('click', function (event) { 1430 if (!event.target.classList.contains('wrapper-search-fields') && !event.target.classList.contains('filter-button-toggle-wp')) { 1431 $('body').removeClass('thim-filter-product'); 1432 } 1433 }); 1434 }, 1435 1436 /* @ function switch layout 1437 * @since 5.3.6 - Move from custom-script-v2.js file 1438 * @author tuanta 1439 */ 1440 thim_SwitchLayout: function (prefix) { 1441 var archive = $('#' + prefix + '-archive'), 1442 cl_click = '.' + prefix + '-switch-layout > a'; 1443 if (archive.length < 1 ) { 1444 return; 1445 } 1446 if (prefix == 'thim-course') { 1447 var switch_layout = $('.thim-course-switch-layout'); 1448 if (switch_layout.length < 1 ) { 1449 return; 1450 } 1451 } 1452 1453 var switch_store = localStorage.getItem(prefix + '-layout'); 1454 if (switch_store == 'list-layout') { 1455 if (archive.hasClass(prefix + '-grid')) { 1456 archive.removeClass(prefix + '-grid').addClass(prefix + '-list') 1457 } 1458 $(cl_click).removeClass('switch-active') 1459 $('.' + prefix + '-switch-layout .switchToList').addClass('switch-active') 1460 } 1461 if (switch_store == 'grid-layout') { 1462 if (archive.hasClass(prefix + '-list')) { 1463 archive.removeClass(prefix + '-list').addClass(prefix + '-grid') 1464 } 1465 $(cl_click).removeClass('switch-active') 1466 $('.' + prefix + '-switch-layout .switchToGrid').addClass('switch-active') 1467 } 1468 $(cl_click).on('click', function (event) { 1469 event.preventDefault() 1470 var elem = $(this); 1471 if (!elem.hasClass('switch-active')) { 1472 $(cl_click).removeClass('switch-active') 1473 elem.addClass('switch-active') 1474 if (elem.hasClass('switchToGrid')) { 1475 archive.fadeOut(300, function () { 1476 archive.removeClass(prefix + '-list').addClass(prefix + '-grid').fadeIn(300) 1477 localStorage.setItem(prefix + '-layout', 'grid-layout'); 1478 }) 1479 } else { 1480 archive.fadeOut(300, function () { 1481 archive.removeClass(prefix + '-grid').addClass(prefix + '-list').fadeIn(300) 1482 localStorage.setItem(prefix + '-layout', 'list-layout'); 1483 }) 1484 } 1485 } 1486 }) 1487 }, 1488 1489 back_to_top: function () { 1490 if (jQuery(".scroll-circle-progress").length) { 1491 var progressPath = document.querySelector('.scroll-circle-progress path'); 1492 var pathLength = progressPath.getTotalLength(); 1493 progressPath.style.transition = progressPath.style.WebkitTransition = '
1493none'; 1494 progressPath.style.strokeDasharray = pathLength + ' ' + pathLength; 1495 progressPath.style.strokeDashoffset = pathLength; 1496 progressPath.getBoundingClientRect(); 1497 progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear'; 1498 var updateProgress = function () { 1499 var scroll = $(window).scrollTop(); 1500 var height = $(document).height() - $(window).height(); 1501 var progress = pathLength - (scroll * pathLength / height); 1502 progressPath.style.strokeDashoffset = progress; 1503 } 1504 updateProgress(); 1505 $(window).scroll(updateProgress); 1506 } 1507 jQuery(window).scroll(function () { 1508 if (jQuery(this).scrollTop() > 100) { 1509 jQuery('#back-to-top').addClass('active') 1510 } else { 1511 jQuery('#back-to-top').removeClass('active') 1512 } 1513 }) 1514 jQuery('#back-to-top').on('click', function () { 1515 jQuery('html, body').animate({scrollTop: '0px'}, 500) 1516 return false 1517 }) 1518 }, 1519 1520 StickySidebar: function () { 1521 var offsetTop = 20 1522 if ($('#wpadminbar').length) { 1523 offsetTop += $('#wpadminbar').outerHeight() 1524 } 1525 if ($('#masthead.sticky-header').length) { 1526 offsetTop += $('#masthead.sticky-header').outerHeight() 1527 } 1528 if ($('.thim-ekit__header').length) { 1529 offsetTop += $('.thim-ekit__header').outerHeight() 1530 } 1531 jQuery('#sidebar.sticky-sidebar').theiaStickySidebar({ 1532 'containerSelector': '', 1533 'additionalMarginTop': offsetTop, 1534 'additionalMarginBottom': '0', 1535 'updateSidebarHeight': false, 1536 'minWidth': '768', 1537 'sidebarBehavior': 'modern', 1538 }) 1539 }, 1540 /* ****** PRODUCT QUICK VIEW ******/ 1541 product_quick_view: function () { 1542 $(document).on('click', '.quick-view', function (e) { 1543 $('.quick-view a').css('display', 'none') 1544 $(this).append('<a href="javascript:;" class="loading dark"></a>') 1545 var product_id = $(this).attr('data-prod') 1546 var data = { action: 'jck_quickview', product: product_id } 1547 $.post(ajaxurl, data, function (response) { 1548 $.magnificPopup.open({ 1549 mainClass: 'my-mfp-zoom-in', 1550 items: { 1551 src: response, 1552 type: 'inline', 1553 }, 1554 callbacks: { 1555 open: function () { 1556 $('body').addClass('thim-popup-active') 1557 $.magnificPopup.instance.close = function () { 1558 $('body').removeClass('thim-popup-active') 1559 $.magnificPopup.proto.close.call(this) 1560 } 1561 }, 1562 }, 1563 }) 1564 $('.quick-view a').css('display', 'inline-block') 1565 $('.loading').remove() 1566 $('.product-card .wrapper').removeClass('animate') 1567 setTimeout(function () { 1568 if (typeof wc_add_to_cart_variation_params !== 1569 'undefined') { 1570 $('.product-info .variations_form').each(function () { 1571 $(this).wc_variation_form().find('.variations select:eq(0)').change() 1572 }) 1573 } 1574 }, 600) 1575 }) 1576 e.preventDefault() 1577 }) 1578 }, 1579 1580 submit_form_validate: function () { 1581 $('form#bbp-search-form').submit(function () { 1582 if ($.trim($('#bbp_search').val()) === '') { 1583 $('#bbp_search').focus() 1584 return false 1585 } 1586 }) 1587 1588 $('form.search-form').submit(function () { 1589 var input_search = $(this).find('input[name=\'s\']') 1590 if ($.trim(input_search.val()) === '') { 1591 input_search.focus() 1592 return false 1593 } 1594 }) 1595 1596 //Validate comment form submit 1597 $('form#commentform').submit(function (event) { 1598 var elem = $(this), 1599 comment = elem.find('#comment[aria-required="true"]'), 1600 author = elem.find('#author[aria-required="true"]'), 1601 url = elem.find('#url[aria-required="true"]'), 1602 email = elem.find('#email[aria-required="true"]'), 1603 valid_email = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm 1604 1605 if (author.length > 0 && author.val() == '') { 1606 author.addClass('invalid') 1607 event.preventDefault() 1608 } 1609 1610 if (comment.length > 0 && comment.val() == '') { 1611 comment.addClass('invalid') 1612 event.preventDefault() 1613 } 1614 1615 if (url.length > 0 && url.val() == '') { 1616 url.addClass('invalid') 1617 event.preventDefault() 1618 } 1619 1620 if (email.length > 0 && 1621 (email.val() == '' || !valid_email.test(email.val()))) { 1622 email.addClass('invalid') 1623 event.preventDefault() 1624 } 1625 }) 1626 1627 $('input.wpcf7-text, textarea.wpcf7-textarea').on('focus', function () { 1628 if ($(this).hasClass('wpcf7-not-valid')) { 1629 $(this).removeClass('wpcf7-not-valid') 1630 } 1631 }) 1632 1633 //wpcf7-form-submit 1634 $(document).on('click', '.wpcf7-form-control.wpcf7-submit', function () { 1635 var elem = $(this), form = elem.parents('.wpcf7-form') 1636 form.addClass('thim-sending') 1637 $(document).on('invalid.wpcf7', function (event) { 1638 form.removeClass('thim-sending') 1639 }) 1640 $(document).on('spam.wpcf7', function (event) { 1641 form.removeClass('thim-sending') 1642 setTimeout(function () { 1643 if ($('.wpcf7-response-output').length > 0) { 1644 $('.wpcf7-response-output').hide() 1645 } 1646 }, 4000) 1647 }) 1648 $(document).on('mailsent.wpcf7', function (event) { 1649 form.removeClass('thim-sending') 1650 setTimeout(function () { 1651 if ($('.wpcf7-response-output').length > 0) { 1652 $('.wpcf7-response-output').hide() 1653 } 1654 }, 4000) 1655 1656 }) 1657 $(document).on('mailfailed.wpcf7', function (event) { 1658 form.removeClass('thim-sending') 1659 setTimeout(function () { 1660 if ($('.wpcf7-response-output').length > 0) { 1661 $('.wpcf7-response-output').hide() 1662 } 1663 }, 4000) 1664 }) 1665 }) 1666 1667 $('.mc4wp-form #mc4wp_email').on('focus', function () { 1668 $(this).parents('.mc4wp-form').addClass('focus-input') 1669 }).on('focusout', function () { 1670 $(this).parents('.mc4wp-form.focus-input').removeClass('focus-input') 1671 }) 1672 }, 1673 waypoint_js: function () { 1674 /* Waypoints magic ---------------------------------------------------------- */ 1675 if (typeof jQuery.fn.waypoint !== 'undefined') { 1676 jQuery('.wpb_animate_when_almost_visible:not(.wpb_start_animation)').waypoint(function () { 1677 jQuery(this).addClass('wpb_start_animation') 1678 }, { offset: '85%' }) 1679 } 1680 }, 1681 course_menu_landing: function () { 1682 if ($('.thim-course-menu-landing').length > 0) { 1683 var menu_landing = $('.thim-course-menu-landing'), tab_course = $('#learn-press-course-tabs .nav-tabs') 1684 1685 var tab_active = tab_course.find('>li.active'), 1686 tab_item = tab_course.find('>li>a'), 1687 tab_landing = menu_landing.find('.thim-course-landing-tab'), 1688 tab_landing_item = tab_landing.find('>li>a'), 1689 landing_Top = ($('#course-landing').length) > 0 ? $('#course-landing').offset().top : 0, 1690 checkTop = ($(window).height() > landing_Top) ? $(window).height() : landing_Top 1691 1692 $('footer#colophon').addClass('has-thim-course-menu') 1693 $('.thim-ekit__footer').addClass('has-thim-course-menu') 1694 $('.navbar-mobile-button').addClass('hide'); 1695 $('body').removeClass('has-navbar-mobile'); 1696 if (tab_active.length > 0) { 1697 var active_href = tab_active.find('>a').attr('href'), 1698 landing_active = tab_landing.find('>li>a[href="' + active_href + '"]') 1699 1700 if (landing_active.length > 0) { 1701 landing_active.parent().addClass('active') 1702 } 1703 } 1704 1705 tab_landing_item.on('click', function (event) { 1706 event.preventDefault() 1707 1708 var href = $(this).attr('href'), 1709 parent = $(this).parent() 1710 1711 if (!parent.hasClass('active')) { 1712 tab_landing.find('li.active').removeClass('active') 1713 parent.addClass('active') 1714 } 1715 1716 if (tab_course.length > 0) { 1717 tab_course.find('>li>a[href="' + href + '"]').trigger('click') 1718 1719 $('body, html').animate({ 1720 scrollTop: tab_course.offset().top - 50, 1721 }, 800) 1722 } else { 1723 $('body, html').animate({ 1724 scrollTop: $($.attr(this, 'href')).offset().top, 1725 }, 500) 1726 } 1727 }) 1728 1729 tab_item.on('click', function () { 1730 var href = $(this).attr('href'), 1731 parent_landing = tab_landing.find('>li>a[href="' + href + 1732 '"]').parent() 1733 1734 if (!parent_landing.hasClass('active')) { 1735 tab_landing.find('li.active').removeClass('active') 1736 parent_landing.addClass('active') 1737 } 1738 }) 1739 1740 $(window).scroll(function () { 1741 if ($(window).scrollTop() > checkTop) { 1742 $('body').addClass('course-landing-active') 1743 } else { 1744 $('body.course-landing-active').removeClass('course-landing-active') 1745 } 1746 }) 1747 } 1748 }, 1749 product_gallery: function () { 1750 if (($('#carousel').length > 0) && (jQuery().flexslider)) { 1751 // The slider being synced must be initialized first 1752 jQuery('#carousel').flexslider({ 1753 animation : "slide", 1754 controlNav : false, 1755 animationLoop: false, 1756 slideshow : false, 1757 itemWidth : 125, 1758 itemMargin : 15, 1759 asNavFor : '#slider' 1760 }); 1761 1762 jQuery('#slider').flexslider({ 1763 animation : "slide", 1764 controlNav : false, 1765 animationLoop: false, 1766 slideshow : false, 1767 sync : "#carousel" 1768 }); 1769 } 1770 }, 1771 recipe_ingredient: function () { 1772 // Toggle buttons. 1773 let buttons_servings = $( '.wprm-recipe-servings-toggle' ); 1774 1775 if ( buttons_servings.length > 0 ) { 1776 function fractionToDecimal(fraction) { 1777 var parts = fraction.split('/'); 1778 if (parts.length === 2) { 1779 return parseFloat(parts[0]) / parseFloat(parts[1]); 1780 } 1781 return parseFloat(fraction); 1782 } 1783 function formatResult(value) { 1784 if (Number.isInteger(value)) { 1785 return value.toString(); 1786 } else { 1787 var numerator = value; 1788 var denominator = 1; 1789 1790 while (numerator % 1 !== 0) { 1791 numerator *= 10; 1792 denominator *= 10; 1793 } 1794 1795 var gcd = function(a, b) { 1796 return b === 0 ? a : gcd(b, a % b); 1797 }; 1798 1799 var divisor = gcd(numerator, denominator); 1800 numerator /= divisor; 1801 denominator /= divisor; 1802 1803 if (denominator === 1) { 1804 return numerator.toString(); 1805 } else { 1806 return numerator + '/' + denominator; 1807 } 1808 } 1809 } 1810 1811 $('.wprm-recipe-ingredient-amount').each(function() { 1812 var originalAmount = $(this).text(); 1813 var decimalAmount = fractionToDecimal(originalAmount); 1814 $(this).data('original-decimal', decimalAmount); 1815 }); 1816 1817 $(buttons_servings).on('click', '.wprm-toggle', function (e) { 1818 e.preventDefault(); 1819 var $data_servings = parseInt($(this).data("value")); 1820 $('.wprm-recipe-ingredient-amount').each(function() { 1821 var originalDecimal = $(this).data('original-decimal'); 1822 var updatedDecimal = originalDecimal * $data_servings; 1823 $(this).text(formatResult(updatedDecimal)); 1824 }); 1825 buttons_servings.find('>.wprm-toggle').removeClass('wprm-toggle-active'); 1826 $(this).addClass('wprm-toggle-active'); 1827 }); 1828 } 1829 }, 1830 nav_tabs_post :function (){ 1831 var $sc = $( '.thim-tabs-post' ); 1832 if ($sc.length == 0) { 1833 return; 1834 } 1835 $sc.on( 'click', '.nav-tabs a', function( e ) { 1836 e.preventDefault(); 1837 $sc = $( this ).parents( '.thim-tabs-post' ); 1838 var current_cat = $sc.find( '.nav-tabs .cat-item.active a' ).attr( 'data-cat' ); 1839 $sc.find( '.nav-tabs li' ).removeClass( 'active' ); 1840 $( this ).parents( 'li' ).addClass( 'active' ); 1841
1842 var params = $sc.attr( 'data-params' ), 1843 category = $( this ).attr( 'data-cat' ), 1844 sc_id = $sc.attr( 'id' ); 1845 1846 var data = { 1847 action: 'thim_load_content_post', 1848 category: category, 1849 params: params, 1850 nonce: (typeof thim_ajax_vars !== 'undefined') ? thim_ajax_vars.nonce_load_content_post : '', 1851 }; 1852 1853 $sc.data[sc_id + current_cat] = $sc.find( '.loop-wrapper' ).html(); 1854 1855 $sc.find( '.loop-wrapper' ).removeClass( 'fadeIn' ); 1856 1857 if ($sc.data[sc_id + category]) { 1858 setTimeout( function() { 1859 $sc.find( '.loop-wrapper' ).html( $sc.data[sc_id + category] ); 1860 $sc.find( '.loop-wrapper' ).addClass( 'fadeIn' ); 1861 }, 300 ); 1862 } else { 1863 $.ajax( { 1864 type: 'POST', 1865 url: ajaxurl, 1866 data: data, 1867 beforeSend: function() { 1868 $sc.addClass( 'loading' ); 1869 }, 1870 success: function( res ) { 1871 if (res.success) { 1872 $sc.find( '.loop-wrapper' ).html( res.data ); 1873 $sc.find( '.loop-wrapper' ).addClass( 'fadeIn' ); 1874 } 1875 $sc.removeClass( 'loading' ); 1876 1877 }, 1878 error: function( xhr, status ) { 1879 alert( xhr.statusText ); 1880 }, 1881 } ); 1882 } 1883 } ); 1884 }, 1885 anchor_nav_tabs_course : function () { 1886 var hash = window.location.hash; 1887 if ( ! hash ) return; 1888 1889 var target = document.querySelector( '#learn-press-course-tabs a[href="' + hash + '"]' ); 1890 if ( ! target ) return; 1891 1892 // Remove active from all tabs and panes 1893 document.querySelectorAll( '#learn-press-course-tabs .nav-tabs li' ).forEach( function ( li ) { 1894 li.classList.remove( 'active' ); 1895 } ); 1896 document.querySelectorAll( '#learn-press-course-tabs .tab-pane' ).forEach( function ( pane ) { 1897 pane.classList.remove( 'active' ); 1898 } ); 1899 1900 // Activate the matched tab 1901 target.closest( 'li' ).classList.add( 'active' ); 1902 var pane = document.querySelector( hash ); 1903 if ( pane ) pane.classList.add( 'active' ); 1904 1905 // Scroll to tab section 1906 var tabsEl = document.getElementById( 'learn-press-course-tabs' ); 1907 if ( tabsEl ) { 1908 setTimeout( function () { 1909 tabsEl.scrollIntoView( { behavior: 'smooth', block: 'start' } ); 1910 }, 100 ); 1911 } 1912 }, 1913 list_scroll: function() { 1914 // scroll swiper effect: class thim-scroll-swiper for image carousel widget 1915 const $wrapper = $('.thim-scroll-swiper .swiper-wrapper'); 1916 1917 function checkSwiper() { 1918 if (!$wrapper.length) return; 1919 1920 const scrollAmount = $wrapper[0].getBoundingClientRect().top * 0.3; 1921 $wrapper.css('transform', 'translate3d(' + -scrollAmount + 'px, 0px, 0px)'); 1922 } 1923 1924 $(window).on('scroll', function() { 1925 checkSwiper(); 1926 }); 1927 1928 // scroll motion effect: all classes of Thim eKit Animations for v4 EL 1929 const selector = '.ekit--scale, .ekit--fancy, .ekit--slide-up, .ekit--slide-left, .ekit--slide-right, .ekit--slide-down'; 1930 let $elements = $(selector).filter(function() { 1931 return !isInView(this); 1932 }); 1933 1934 function isInView(el) { 1935 const rect = el.getBoundingClientRect(); 1936 return rect.top < window.innerHeight * 0.85 && rect.bottom > 0; 1937 } 1938 1939 function triggerAnimation(el) { 1940 const $el = $(el); 1941 const animatedClass = Array.from(el.classList).find(c => c.startsWith('animated')) || 'animated-slow'; 1942 1943 $el.css('animation', 'none'); 1944 void el.offsetWidth; 1945 $el.css('animation', '').removeClass(animatedClass); 1946 void el.offsetWidth; 1947 $el.addClass(animatedClass); 1948 } 1949 1950 function checkElements() { 1951 $elements = $elements.filter(function() { 1952 if ( !isInView(this) ) return true; 1953 triggerAnimation(this); 1954 return false; 1955 }); 1956 1957 if (!$elements.length) $(window).off('scroll.animCheck'); 1958 } 1959 1960 $(window).on('scroll.animCheck', function() { 1961 checkElements(); 1962 }); 1963 } 1964 } 1965 1966 $(document).ready(function () { 1967 thim_eduma.ready(); 1968 $(window).resize(function () { 1969 thim_eduma.resize() 1970 }) 1971 }) 1972 1973 $(window).on('load', function () { 1974 thim_eduma.load(); 1975 setTimeout(function () { 1976 // TitleAnimation.initialize() 1977 thim_eduma.course_menu_landing() 1978 }, 400) 1979 if ($(window).width() > 767) { 1980 thim_min_height_carousel($('.thim-grid-posts .item-post')) 1981 } 1982 $(window).resize(function () { 1983 $('.thim-carousel-instructors .instructor-item').css('min-height', '') 1984 $('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info').css('min-height', '') 1985 if ($(window).width() < 767 || $(window).width() > 1200) { 1986 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', '') 1987 } 1988 1989 thim_min_height_carousel($('.thim-owl-carousel-post:not(.layout-3) .image')) 1990 thim_min_height_carousel($('.thim-row-bg-border-top .thim-bg-border-top')) 1991 thim_min_height_carousel_old($('.thim-carousel-instructors .instructor-item')) 1992 thim_min_height_carousel_old($('.thim-testimonial-carousel-kindergarten .item')) 1993 1994 thim_min_height_carousel($('.thim-widget-carousel-categories .item')) 1995 thim_min_height_carousel($('.elementor-widget-thim-carousel-categories .item')) 1996 1997 thim_min_height_content_area() 1998 if ($(window).width() > 767) { 1999 thim_min_height_carousel($('.thim-grid-posts .item-post')) 2000 thim_min_height_carousel($('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info')) 2001 } 2002 2003 if ($(window).width() > 767 && $(window).width() < 1200) { 2004 if ($('body.thim-demo-university-4 .thim-icon-our-programs').length) { 2005 var min_height = parseInt($( 2006 'body.thim-demo-university-4 .thim-icon-our-programs').outerHeight() / 3) 2007 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', min_height) 2008 } 2009 } 2010 }) 2011 thim_min_height_carousel('.thim-carousel-instructors', '.instructor-item') 2012 thim_min_height_carousel('.thim-owl-carousel-post', '.image') 2013 thim_min_height_content_area() 2014 }) 2015 2016 function thim_min_height_carousel_old($selector) { 2017 var min_height = 0 2018 $selector.each(function (index, val) { 2019 if ($(this).outerHeight() > min_height) { 2020 min_height = $(this).outerHeight() 2021 } 2022 if (index + 1 == $selector.length) { 2023 $selector.css('min-height', min_height) 2024 } 2025 }) 2026 } 2027 2028 function thim_min_height_carousel(el, child) { 2029 var $elements = $(el) 2030 2031 $elements.each(function () { 2032 var $element = $(this), 2033 $child = child ? $element.find(child) : $element.children(), 2034 maxHeight = 0 2035 2036 $child.each(function () { 2037 var thisHeight = $(this).outerHeight() 2038 if (thisHeight > maxHeight) { 2039 maxHeight = thisHeight 2040 } 2041 }).css('min-height', maxHeight) 2042 }) 2043 } 2044 2045 function thim_min_height_content_area() { 2046 var content_area = $('#main-content .content-area'), 2047 footer = $('#main-content .site-footer'), 2048 winH = $(window).height() 2049 if (content_area.length > 0 && footer.length > 0) { 2050 content_area.css('min-height', winH - footer.height()) 2051 } 2052 } 2053 2054 $(window).on('elementor/frontend/init', function () { 2055 elementorFrontend.hooks.addAction('frontend/element_ready/thim-carousel-post.default', 2056 thim_eduma.thim_carousel) 2057 elementorFrontend.hooks.addAction('frontend/element_ready/thim-twitter.default', 2058 thim_eduma.thim_carousel) 2059 2060 elementorFrontend.hooks.addAction('frontend/element_ready/thim-courses.default', 2061 thim_eduma.thim_carousel); 2062 2063 elementorFrontend.hooks.addAction('frontend/element_ready/thim-list-event.default', 2064 thim_eduma.thim_carousel); 2065 2066 elementorFrontend.hooks.addAction('frontend/element_ready/thim-course-categories.default', 2067 thim_eduma.thim_carousel) 2068 2069 elementorFrontend.hooks.addAction('frontend/element_ready/thim-our-team.default', 2070 thim_eduma.thim_carousel) 2071 2072 elementorFrontend.hooks.addAction('frontend/element_ready/thim-gallery-images.default', 2073 thim_eduma.thim_carousel) 2074 2075 elementorFrontend.hooks.addAction('frontend/element_ready/thim-list-instructors.default', 2076 thim_eduma.thim_carousel) 2077 2078 elementorFrontend.hooks.addAction('frontend/element_ready/thim-testimonials.default', 2079 thim_eduma.thim_carousel) 2080 2081 elementorFrontend.hooks.addAction('frontend/element_ready/thim-courses-collection.default', 2082 thim_eduma.thim_carousel) 2083 2084 elementorFrontend.hooks.addAction('frontend/element_ready/thim-testimonials.default', 2085 thim_eduma.thim_contentslider) 2086 2087 elementorFrontend.hooks.addAction('frontend/element_ready/thim-counters-box.default', 2088 thim_eduma.counter_box) 2089 2090 elementorFrontend.hooks.addAction('frontend/element_ready/global', function ($scope) { 2091 var $carousel = $scope.find('.owl-carousel') 2092 if ($carousel.length) { 2093 var carousel = $carousel.data('owlCarousel') 2094 carousel && carousel.reload() 2095 } 2096 }) 2097 const addHandler = ( $element ) => { 2098 elementorFrontend.elementsHandler.addHandler( window.ThimEkits.ThimSlider, { 2099 $element, 2100 } ); 2101 }; 2102 elementorFrontend.hooks.addAction('frontend/element_ready/thim-list-instructors.default', addHandler) 2103 elementorFrontend.hooks.addAction('frontend/element_ready/thim-list-event.default', addHandler) 2104 }) 2105})(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.