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