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 if ($('article.format-gallery .flexslider').length > 0){ 910 $('article.format-gallery .flexslider').imagesLoaded(function () { 911 if (jQuery().flexslider) { 912 $('.flexslider').flexslider({ 913 slideshow: true, 914 animation: 'fade', 915 pauseOnHover: true, 916 animationSpeed: 400, 917 smoothHeight: true, 918 directionNav: true, 919 controlNav: false, 920 }) 921 } 922 }); 923 } 924 var $container = $('.isotope-layout') 925 if ($container.length > 0) { 926 $container.each(function () { 927 var $this = jQuery(this), $width, $col, $width_unit, 928 $height_unit 929 var $spacing = 10 930 $col = 6 931 if ($col != 1) { 932 if (parseInt($container.width()) < 768) { 933 $col = 4 934 } 935 if (parseInt($container.width()) < 480) { 936 $col = 2 937 } 938 939 } 940 $width_unit = Math.floor((parseInt($container.width(), 10) - 941 ($col - 1) * $spacing) / $col) 942 $height_unit = Math.floor(parseInt($width_unit, 10)) 943 944 $this.find('.item_gallery').css({ 945 width: $width_unit, 946 }) 947 if ($col == 1) { 948 $height_unit = 'auto' 949 } 950 $this.find('.item_gallery .thim-gallery-popup').css({ 951 height: $height_unit, 952 }) 953 if ($this.find('.item_gallery').hasClass('size32')) { 954 if ($col > 1) { 955 $this.find('.item_gallery.size32 .thim-gallery-popup').css({ 956 height: $height_unit * 2 + $spacing, 957 }) 958 } 959 } 960 if ($this.find('.item_gallery').hasClass('size32')) { 961 if ($col > 3) { 962 $width = $width_unit * 4 + $spacing * 3 963 $this.find('.item_gallery.size32').css({ 964 width: $width, 965 }) 966 } else { 967 $width = $width_unit * 2 + $spacing * 1 968 $this.find('.item_gallery.size32').css({ 969 width: $width, 970 }) 971 } 972 } 973 if ($this.find('.item_gallery').hasClass('size22') && $col != 1) { 974 $this.find('.item_gallery.size22 .thim-gallery-popup').css({ 975 height: $height_unit * 2 + $spacing, 976 }) 977 } 978 if ($this.find('.item_gallery').hasClass('size22') && $col != 1) { 979 $width = $width_unit * 2 + $spacing * 1 980 $this.find('.item_gallery.size22').css({ 981 width: $width, 982 }) 983 } 984 if (jQuery().isotope) { 985 $this.isotope({ 986 itemSelector: '.item_gallery', 987 masonry: { 988 columnWidth: $width_unit, 989 gutter: $spacing, 990 }, 991 }) 992 } 993 }) 994 } 995 $(document).on('click', '.thim-gallery-popup', function (e) { 996 e.preventDefault() 997 var elem = $(this), post_id = elem.attr('data-id'), 998 data = { action: 'thim_gallery_popup', post_id: post_id } 999 elem.addClass('loading') 1000 $.post(ajaxurl, data, function (response) { 1001 elem.removeClass('loading') 1002 $('.thim-gallery-show').append(response) 1003 if ($('.thim-gallery-show img').length > 0) { 1004 $('.thim-gallery-show').magnificPopup({ 1005 mainClass: 'my-mfp-zoom-in', 1006 type: 'image', 1007 delegate: 'a', 1008 showCloseBtn: false, 1009 gallery: { 1010 enabled: true, 1011 }, 1012 callbacks: { 1013 open: function () { 1014 $('body').addClass('thim-popup-active') 1015 $.magnificPopup.instance.close = function () { 1016 $('.thim-gallery-show').empty() 1017 $('body').removeClass('thim-popup-active') 1018 $.magnificPopup.proto.close.call(this) 1019 } 1020 }, 1021 }, 1022 }).magnificPopup('open') 1023 } else { 1024 $.magnificPopup.open({ 1025 mainClass: 'my-mfp-zoom-in', 1026 items: { 1027 src: $('.thim-gallery-show'), 1028 type: 'inline', 1029 }, 1030 showCloseBtn: false, 1031 callbacks: { 1032 open: function () { 1033 $('body').addClass('thim-popup-active') 1034 $.magnificPopup.instance.close = function () { 1035 $('.thim-gallery-show').empty() 1036 $('body').removeClass('thim-popup-active') 1037 $.magnificPopup.proto.close.call(this) 1038 } 1039 }, 1040 }, 1041 }) 1042 } 1043 }) 1044 }) 1045 }, 1046 1047 thim_contentslider: function () { 1048 $('.thim-testimonial-slider').each(function () { 1049 var elem = $(this), 1050 item_visible = parseInt(elem.data('visible')), 1051 item_time = parseInt(elem.data('time')), 1052 autoplay = elem.data('auto') ? true : false, 1053 item_ratio = elem.data('ratio') ? elem.data('ratio') : 1.18, 1054 item_padding = elem.data('padding') ? elem.data('padding') : 15, 1055 item_activepadding = elem.data('activepadding') ? elem.data('activepadding') : 0, 1056 item_width = elem.data('width') ? elem.data('width') : 100, 1057 mousewheel = !!elem.data('mousewheel') 1058 if (jQuery().thimContentSlider) { 1059 var testimonial_slider = $(this).thimContentSlider({ 1060 items: elem, 1061 itemsVisible: item_visible, 1062 mouseWheel: mousewheel, 1063 autoPlay: autoplay, 1064 pauseTime: item_time, 1065 itemMaxWidth: item_width, 1066 itemMinWidth: item_width, 1067 activeItemRatio: item_ratio, 1068 activeItemPadding: item_activepadding, 1069 itemPadding: item_padding, 1070 }) 1071 } 1072 }) 1073 }, 1074 1075 counter_box: function () { 1076 if (jQuery().waypoint) { 1077 jQuery('.counter-box').waypoint(function () { 1078 jQuery(this).find('.display-percentage').each(function () { 1079 var percentage = jQuery(this).data('percentage') 1080 jQuery(this).countTo({ 1081 from: 0, 1082 to: percentage, 1083 refreshInterval: 40, 1084 speed: 2000,
1085 }) 1086 }) 1087 }, { 1088 triggerOnce: true, 1089 offset: '80%', 1090 }) 1091 } 1092 }, 1093 1094 thim_background_gradient: function () { 1095 var background_gradient = jQuery('.thim_overlay_gradient') 1096 var background_gradient_2 = jQuery('.thim_overlay_gradient_2') 1097 if (background_gradient.length) { 1098 $('.thim_overlay_gradient rs-sbg-px > rs-sbg-wrap > rs-sbg').addClass('thim-overlayed') 1099 } 1100 1101 if (background_gradient_2.length) { 1102 $('.thim_overlay_gradient_2 rs-sbg-px > rs-sbg-wrap > rs-sbg').addClass('thim-overlayed') 1103 } 1104 }, 1105 1106 thim_magnificPopup: function () { 1107 if (jQuery().magnificPopup) { 1108 $('.thim-single-image-popup,.thim-image-popup').magnificPopup({ 1109 type: 'image', 1110 zoom: { 1111 enabled: true, 1112 duration: 300, 1113 easing: 'ease-in-out', 1114 } 1115 }) 1116 $('.thim-video-popup .button-popup').on('click', function (e) { 1117 var item = $(this) 1118 e.preventDefault() 1119 $.magnificPopup.open({ 1120 items: { 1121 src: item.parent().parent().find('.video-content'), 1122 type: 'inline', 1123 }, 1124 showCloseBtn: false, 1125 callbacks: { 1126 open: function () { 1127 $('body').addClass('thim-popup-active') 1128 $.magnificPopup.instance.close = function () { 1129 $('body').removeClass('thim-popup-active') 1130 $.magnificPopup.proto.close.call(this) 1131 } 1132 }, 1133 }, 1134 }) 1135 }) 1136 } 1137 }, 1138 1139 full_right: function () { 1140 $('.thim_full_right').each(function () { 1141 var full_right = (jQuery(window).width() - jQuery(this).width()) / 2; 1142 jQuery(this).children().css("margin-right", "-" + full_right + "px"); 1143 }); 1144 $('.thim_full_left').each(function () { 1145 var full_left = (jQuery(window).width() - jQuery(this).width()) / 2; 1146 jQuery(this).children().css("margin-left", "-" + full_left + "px"); 1147 }); 1148 $('.thim_coundown_full_left').each(function () { 1149 var full_left = (jQuery(window).width() - jQuery(this).width()) / 2; 1150 var number = full_left + 'px'; 1151 jQuery(this).find('.thim-widget-countdown-box').parent().css({ 1152 "margin-left": '-' + number, 1153 "padding-left": number 1154 }); 1155 }); 1156 $('footer#colophon.has-footer-bottom').css('margin-bottom', $('.footer-bottom').height()) 1157 1158 // Fix RTL row full of VC 1159 var left_has_fill = parseFloat($('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css('left')), 1160 left_no_padding = parseFloat($('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css('left')) 1161 if (left_has_fill != 'undefined') { 1162 $('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css({ 'right': left_has_fill, 'left': '' }) 1163 } 1164 if (left_no_padding != 'undefined') { 1165 $('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css({ 'right': left_no_padding, 'left': '' }) 1166 } 1167 }, 1168 1169 thim_course_offline_popup_form_register: function () { 1170 if ($('#contact-form-registration >.wpcf7').length) { 1171 var el = $('#contact-form-registration >.wpcf7'); 1172 el.append('<a href="#" class="thim-close fa fa-times"></a>'); 1173 } 1174 $(document).on('click', '#contact-form-registration .wpcf7-form-control.wpcf7-submit', function () { 1175 $(document).on('mailsent.wpcf7', function (event) { 1176 setTimeout(function () { 1177 $('body').removeClass('thim-contact-popup-active'); 1178 $('#contact-form-registration').removeClass('active'); 1179 }, 3000); 1180 }); 1181 }); 1182 $(document).on('click', '.course-payment .thim-enroll-course-button', function (e) { 1183 e.preventDefault(); 1184 $('body').addClass('thim-contact-popup-active'); 1185 $('#contact-form-registration').addClass('active'); 1186 }); 1187 1188 $(document).on('click', '#contact-form-registration', function (e) { 1189 if ($(e.target).attr('id') == 'contact-form-registration') { 1190 $('body').removeClass('thim-contact-popup-active'); 1191 $('#contact-form-registration').removeClass('active'); 1192 } 1193 }); 1194 1195 $(document).on('click', '#contact-form-registration .thim-close', function (e) { 1196 e.preventDefault(); 1197 $('body').removeClass('thim-contact-popup-active'); 1198 $('#contact-form-registration').removeClass('active'); 1199 }); 1200 }, 1201 1202 course_sidebar_right_offset_top: function () { 1203 var elementInfoTop = $('.course-info-top'); 1204 if (elementInfoTop.length) { 1205 var InfoTopHeight = elementInfoTop.innerHeight(), 1206 elementInfoRight = $('.thim-style-content-layout_style_3 .sticky-sidebar'); 1207 elementInfoRight.css('margin-top', '-' + (InfoTopHeight - 20) + 'px'); 1208 } 1209 }, 1210 1211 addWrapOwlControls: function (el) {
1212 const elOwlControls = el.find('.owl-controls'); 1213 if (!elOwlControls.length) { 1214 el.find('.owl-nav, .owl-dots').wrapAll("<div class='owl-controls'></div>"); 1215 } 1216 }, 1217 1218 event_click: function () { 1219 $(document).on('click', '.filter-courses-effect', function (e) { 1220 e.stopPropagation() 1221 $('body').toggleClass('mobile-filter-open') 1222 }) 1223 $(document).on('click', '.filter-column, .close-filter, .widget-area, .course-filter-submit', function (e) { 1224 $('body').removeClass('mobile-filter-open') 1225 }) 1226 $(document).on('click', '.filter-course, .widget_course_filter', function (e) { 1227 e.stopPropagation() 1228 }) 1229 $(document).on('click', '.button-categories-popup', function (e) { 1230 e.stopPropagation() 1231 $('body').toggleClass('categories-popup-open') 1232 }) 1233 $(document).on('click', '.categories-column, .close-categories', function (e) { 1234 $('body').removeClass('categories-popup-open') 1235 }) 1236 $(document).on('click', '.categories-popup', function (e) { 1237 e.stopPropagation() 1238 }) 1239 1240 $('.video-container').on('click', '.beauty-intro .btns', function () { 1241 var iframe = '<iframe src="' + $(this).closest('.video-container').find('.yt-player').attr('data-video') + '" height= "' + $('.parallaxslider').height() + '"></iframe>' 1242 $(this).closest('.video-container').find('.yt-player').replaceWith(iframe) 1243 $(this).closest('.video-container').find('.hideClick:first').css('display', 'none') 1244 }) 1245 1246 // add icon for button show pass 1247 $('.login-password').append('<span id="show_pass"><i class="fa fa-eye"></i></span>') 1248 $(document).on('click', '#show_pass', function () { 1249 var el = $(this), thim_pass = el.parents('.login-password').find('>input') 1250 if (el.hasClass('active')) { 1251 thim_pass.attr('type', 'password') 1252 } else { 1253 thim_pass.attr('type', 'text') 1254 } 1255 el.toggleClass('active') 1256 }) 1257 1258 // Nav scroll 1259 $('.navbar-nav li a,.arrow-scroll > a').on('click', function (e) { 1260 var height = 0, 1261 sticky_height = jQuery('#masthead').outerHeight(), 1262 menu_anchor = jQuery(this).attr('href'), 1263 adminbar_height = jQuery('#wpadminbar').outerHeight(); 1264 if (parseInt(jQuery(window).scrollTop(), 10) < 2) { 1265 height = 47 1266 } 1267 1268 if (menu_anchor && menu_anchor.indexOf('#') == 0 && menu_anchor.length > 1) { 1269 e.preventDefault() 1270 $('html,body').animate({ 1271 scrollTop: jQuery(menu_anchor).offset().top - adminbar_height - sticky_height + height, 1272 }, 850) 1273 } 1274 }) 1275 1276 // menu course scroll 1277 $(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 () { 1278 $('html, body').animate({ 1279 scrollTop: $($(this).attr('href')).offset().top, 1280 }, 1000) 1281 }) 1282 1283 // Filter Gallery 1284 $(document).on('click', '.filter-controls .filter', function (e) { 1285 e.preventDefault() 1286 var filter = $(this).data('filter'), 1287 filter_wraper = $(this).parents('.thim-widget-gallery-posts').find('.wrapper-gallery-filter') 1288 $('.filter-controls .filter').removeClass('active') 1289 $(this).addClass('active') 1290 filter_wraper.isotope({ filter: filter }) 1291 }) 1292 //Background video 1293 $('.bg-video-play').on('click', function () { 1294 var elem = $(this), 1295 video = $(this).parents('.thim-widget-icon-box').find('.full-screen-video'), 1296 player = video.get(0) 1297 if (player.paused) { 1298 player.play() 1299 elem.addClass('bg-pause') 1300 } else { 1301 player.pause() 1302 elem.removeClass('bg-pause') 1303 } 1304 }) 1305 1306 var tab_cat_course = $('.thim-carousel-course-categories-tabs') 1307 tab_cat_course.each(function () { 1308 tab_cat_course.find('.thim-course-slider .item').click(function (e) { 1309 e.preventDefault() 1310 tab_cat_course.find('.item_content.active').removeClass('active') 1311 tab_cat_course.find($(this).find('.title a').attr('href')).addClass('active') 1312 tab_cat_course.find('.thim-course-slider .item.active').removeClass('active') 1313 $(this).addClass('active') 1314 }) 1315 }) 1316 1317 //popup category 1318 var popup_cat = $('.click-show-sub') 1319 popup_cat.each(function () { 1320 popup_cat.find('li.has-child').click(function (e) { 1321 popup_cat.find('li.has-child.active').removeClass('active') 1322 $(this).addClass('active') 1323 }) 1324 }) 1325 1326 //Add class for nav-tabs single course 1327 var tab_course = $('.course-tabs .nav-tabs>li').length 1328 if (tab_course > 0) { 1329 $('.course-tabs .nav-tabs>li').addClass('thim-col-' + tab_course) 1330 } 1331 $('.filter-button-toggle-wp').on('click', function () { 1332 $('body').toggleClass('thim-filter-product'); 1333 }); 1334 document.addEventListener('click', function (event) { 1335 if (!event.target.classList.contains('wrapper-search-fields') && !event.target.classList.contains('filter-button-toggle-wp')) { 1336 $('body').removeClass('thim-filter-product'); 1337 } 1338 }); 1339 1340 1341 }, 1342 1343 /* @ function switch layout 1344 * @since 5.3.6 - Move from custom-script-v2.js file 1345 * @author tuanta 1346 */ 1347 thim_SwitchLayout: function (prefix) { 1348 var archive = $('#' + prefix + '-archive'),
1349 cl_click = '.' + prefix + '-switch-layout > a'; 1350 if (archive.length < 0) { 1351 return; 1352 } 1353 var switch_store = localStorage.getItem(prefix + '-layout'); 1354 if (switch_store == 'list-layout') { 1355 if (archive.hasClass(prefix + '-grid')) { 1356 archive.removeClass(prefix + '-grid').addClass(prefix + '-list') 1357 } 1358 $(cl_click).removeClass('switch-active') 1359 $('.' + prefix + '-switch-layout .switchToList').addClass('switch-active') 1360 } 1361 if (switch_store == 'grid-layout') { 1362 if (archive.hasClass(prefix + '-list')) { 1363 archive.removeClass(prefix + '-list').addClass(prefix + '-grid') 1364 } 1365 $(cl_click).removeClass('switch-active') 1366 $('.' + prefix + '-switch-layout .switchToGrid').addClass('switch-active') 1367 } 1368 $(cl_click).on('click', function (event) { 1369 event.preventDefault() 1370 var elem = $(this); 1371 if (!elem.hasClass('switch-active')) { 1372 $(cl_click).removeClass('switch-active') 1373 elem.addClass('switch-active') 1374 if (elem.hasClass('switchToGrid')) { 1375 archive.fadeOut(300, function () { 1376 archive.removeClass(prefix + '-list').addClass(prefix + '-grid').fadeIn(300) 1377 localStorage.setItem(prefix + '-layout', 'grid-layout'); 1378 }) 1379 } else { 1380 archive.fadeOut(300, function () { 1381 archive.removeClass(prefix + '-grid').addClass(prefix + '-list').fadeIn(300) 1382 localStorage.setItem(prefix + '-layout', 'list-layout'); 1383 }) 1384 } 1385 } 1386 }) 1387 }, 1388 1389 back_to_top: function () { 1390 if (jQuery(".scroll-circle-progress").length) { 1391 var progressPath = document.querySelector('.scroll-circle-progress path'); 1392 var pathLength = progressPath.getTotalLength(); 1393 progressPath.style.transition = progressPath.style.WebkitTransition = 'none'; 1394 progressPath.style.strokeDasharray = pathLength + ' ' + pathLength; 1395 progressPath.style.strokeDashoffset = pathLength; 1396 progressPath.getBoundingClientRect(); 1397 progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear'; 1398 var updateProgress = function () { 1399 var scroll = $(window).scrollTop(); 1400 var height = $(document).height() - $(window).height(); 1401 var progress = pathLength - (scroll * pathLength / height); 1402 progressPath.style.strokeDashoffset = progress; 1403 } 1404 updateProgress(); 1405 $(window).scroll(updateProgress); 1406 } 1407 jQuery(window).scroll(function () { 1408 if (jQuery(this).scrollTop() > 100) { 1409 jQuery('#back-to-top').addClass('active') 1410 } else { 1411 jQuery('#back-to-top').removeClass('active') 1412 } 1413 }) 1414 jQuery('#back-to-top').on('click', function () { 1415 jQuery('html, body').animate({scrollTop: '0px'}, 500) 1416 return false 1417 }) 1418 }, 1419 1420 StickySidebar: function () { 1421 var offsetTop = 20 1422 if ($('#wpadminbar').length) { 1423 offsetTop += $('#wpadminbar').outerHeight() 1424 } 1425 if ($('#masthead.sticky-header').length) { 1426 offsetTop += $('#masthead.sticky-header').outerHeight() 1427 } 1428 jQuery('#sidebar.sticky-sidebar').theiaStickySidebar({ 1429 'containerSelector': '', 1430 'additionalMarginTop': offsetTop, 1431 'additionalMarginBottom': '0', 1432 'updateSidebarHeight': false, 1433 'minWidth': '768', 1434 'sidebarBehavior': 'modern', 1435 }) 1436 }, 1437 /* ****** PRODUCT QUICK VIEW ******/ 1438 product_quick_view: function () { 1439 $(document).on('click', '.quick-view', function (e) { 1440 $('.quick-view a').css('display', 'none') 1441 $(this).append('<a href="javascript:;" class="loading dark"></a>') 1442 var product_id = $(this).attr('data-prod') 1443 var data = { action: 'jck_quickview', product: product_id } 1444 $.post(ajaxurl, data, function (response) { 1445 $.magnificPopup.open({ 1446 mainClass: 'my-mfp-zoom-in', 1447 items: { 1448 src: response, 1449 type: 'inline', 1450 }, 1451 callbacks: { 1452 open: function () { 1453 $('body').addClass('thim-popup-active') 1454 $.magnificPopup.instance.close = function () { 1455 $('body').removeClass('thim-popup-active') 1456 $.magnificPopup.proto.close.call(this) 1457 } 1458 }, 1459 }, 1460 }) 1461 $('.quick-view a').css('display', 'inline-block') 1462 $('.loading').remove() 1463 $('.product-card .wrapper').removeClass('animate') 1464 setTimeout(function () { 1465 if (typeof wc_add_to_cart_variation_params !== 1466 'undefined') { 1467 $('.product-info .variations_form').each(function () { 1468 $(this).wc_variation_form().find('.variations select:eq(0)').change() 1469 }) 1470 } 1471 }, 600) 1472 }) 1473 e.preventDefault() 1474 }) 1475 }, 1476 1477 thimLiveCourseSearch: function () { 1478 1479 }, 1480 submit_form_validate: function () { 1481 $('form#bbp-search-form').submit(function () { 1482 if ($.trim($('#bbp_search').val()) === '') { 1483 $('#bbp_search').focus() 1484 return false 1485 } 1486 }) 1487 1488 $('form.search-form').submit(function () { 1489 var input_search = $(this).find('input[name=\'s\']') 1490 if ($.trim(input_search.val()) === '') { 1491 input_search.focus() 1492 return false 1493 } 1494 }) 1495 1496 //Validate comment form submit 1497 $('form#commentform').submit(function (event) { 1498 var elem = $(this), 1499 comment = elem.find('#comment[aria-required="true"]'), 1500 author = elem.find('#author[aria-required="true"]'), 1501 url = elem.find('#url[aria-required="true"]'), 1502 email = elem.find('#email[aria-required="true"]'), 1503 valid_email = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm 1504 1505 if (author.length > 0 && author.val() == '') { 1506 author.addClass('invalid') 1507 event.preventDefault() 1508 } 1509 1510 if (comment.length > 0 && comment.val() == '') { 1511 comment.addClass('invalid') 1512 event.preventDefault() 1513 } 1514 1515 if (url.length > 0 && url.val() == '') { 1516 url.addClass('invalid') 1517 event.preventDefault() 1518 } 1519 1520 if (email.length > 0 && 1521 (email.val() == '' || !valid_email.test(email.val()))) { 1522 email.addClass('invalid') 1523 event.preventDefault() 1524 } 1525 }) 1526 1527 $('input.wpcf7-text, textarea.wpcf7-textarea').on('focus', function () { 1528 if ($(this).hasClass('wpcf7-not-valid')) { 1529 $(this).removeClass('wpcf7-not-valid') 1530 } 1531 }) 1532 1533 //wpcf7-form-submit 1534 $(document).on('click', '.wpcf7-form-control.wpcf7-submit', function () { 1535 var elem = $(this), form = elem.parents('.wpcf7-form') 1536 form.addClass('thim-sending') 1537 $(document).on('invalid.wpcf7', function (event) { 1538 form.removeClass('thim-sending') 1539 }) 1540 $(document).on('spam.wpcf7', function (event) { 1541 form.removeClass('thim-sending') 1542 setTimeout(function () { 1543 if ($('.wpcf7-response-output').length > 0) { 1544 $('.wpcf7-response-output').hide() 1545 } 1546 }, 4000) 1547 }) 1548 $(document).on('mailsent.wpcf7', function (event) { 1549 form.removeClass('thim-sending') 1550 setTimeout(function () { 1551 if ($('.wpcf7-response-output').length > 0) { 1552 $('.wpcf7-response-output').hide() 1553 } 1554 }, 4000) 1555 1556 }) 1557 $(document).on('mailfailed.wpcf7', function (event) { 1558 form.removeClass('thim-sending') 1559 setTimeout(function () { 1560 if ($('.wpcf7-response-output').length > 0) { 1561 $('.wpcf7-response-output').hide() 1562 } 1563 }, 4000) 1564 }) 1565 }) 1566 1567 $('.mc4wp-form #mc4wp_email').on('focus', function () { 1568 $(this).parents('.mc4wp-form').addClass('focus-input') 1569 }).on('focusout', function () { 1570 $(this).parents('.mc4wp-form.focus-input').removeClass('focus-input') 1571 }) 1572 }, 1573 waypoint_js: function () { 1574 /* Waypoints magic ---------------------------------------------------------- */ 1575 if (typeof jQuery.fn.waypoint !== 'undefined') { 1576 jQuery('.wpb_animate_when_almost_visible:not(.wpb_start_animation)').waypoint(function () { 1577 jQuery(this).addClass('wpb_start_animation') 1578 }, { offset: '85%' }) 1579 } 1580 }, 1581 course_menu_landing: function () { 1582 if ($('.thim-course-menu-landing').length > 0) { 1583 var menu_landing = $('.thim-course-menu-landing'), tab_course = $('#learn-press-course-tabs .nav-tabs') 1584 1585 var tab_active = tab_course.find('>li.active'), 1586 tab_item = tab_course.find('>li>a'), 1587 tab_landing = menu_landing.find('.thim-course-landing-tab'), 1588 tab_landing_item = tab_landing.find('>li>a'), 1589 landing_Top = ($('#course-landing').length) > 0 ? $('#course-landing').offset().top : 0, 1590 checkTop = ($(window).height() > landing_Top) ? $(window).height() : landing_Top 1591 1592 $('footer#colophon').addClass('has-thim-course-menu') 1593 if (tab_active.length > 0) { 1594 var active_href = tab_active.find('>a').attr('href'), 1595 landing_active = tab_landing.find('>li>a[href="' + active_href + '"]') 1596 1597 if (landing_active.length > 0) { 1598 landing_active.parent().addClass('active') 1599 } 1600 } 1601 1602 tab_landing_item.on('click', function (event) { 1603 event.preventDefault() 1604 1605 var href = $(this).attr('href'), 1606 parent = $(this).parent() 1607 1608 if (!parent.hasClass('active')) { 1609 tab_landing.find('li.active').removeClass('active') 1610 parent.addClass('active') 1611 } 1612 1613 if (tab_course.length > 0) { 1614 tab_course.find('>li>a[href="' + href + '"]').trigger('click') 1615 1616 $('body, html').animate({ 1617 scrollTop: tab_course.offset().top - 50, 1618 }, 800) 1619 } else { 1620 $('body, html').animate({ 1621 scrollTop: $($.attr(this, 'href')).offset().top, 1622 }, 500) 1623 } 1624 }) 1625 1626 tab_item.on('click', function () { 1627 var href = $(this).attr('href'), 1628 parent_landing = tab_landing.find('>li>a[href="' + href + 1629 '"]').parent() 1630 1631 if (!parent_landing.hasClass('active')) { 1632 tab_landing.find('li.active').removeClass('active') 1633 parent_landing.addClass('active') 1634 } 1635 }) 1636 1637 $(window).scroll(function () { 1638 if ($(window).scrollTop() > checkTop) { 1639 $('body').addClass('course-landing-active') 1640 } else { 1641 $('body.course-landing-active').removeClass('course-landing-active') 1642 } 1643 }) 1644 } 1645 }, 1646 product_gallery: function () { 1647 if (($('#carousel').length > 0) && (jQuery().flexslider)) { 1648 // The slider being synced must be initialized first 1649 jQuery('#carousel').flexslider({ 1650 animation : "slide", 1651 controlNav : false, 1652 animationLoop: false, 1653 slideshow : false, 1654 itemWidth : 125, 1655 itemMargin : 15, 1656 asNavFor : '#slider' 1657 }); 1658 1659 jQuery('#slider').flexslider({ 1660 animation : "slide", 1661 controlNav : false, 1662 animationLoop: false, 1663 slideshow : false, 1664 sync : "#carousel" 1665 }); 1666 } 1667 } 1668 } 1669
1670 $(document).ready(function () { 1671 thim_eduma.ready(); 1672 1673 $(window).resize(function () { 1674 thim_eduma.resize() 1675 }) 1676 1677 }) 1678 1679 $(window).on('load', function () { 1680 thim_eduma.load(); 1681 setTimeout(function () { 1682 // TitleAnimation.initialize() 1683 thim_eduma.course_menu_landing() 1684 }, 400) 1685 if ($(window).width() > 767) { 1686 thim_min_height_carousel($('.thim-grid-posts .item-post')) 1687 } 1688 $(window).resize(function () { 1689 $('.thim-carousel-instructors .instructor-item').css('min-height', '') 1690 $('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info').css('min-height', '') 1691 if ($(window).width() < 767 || $(window).width() > 1200) { 1692 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', '') 1693 } 1694 1695 thim_min_height_carousel($('.thim-owl-carousel-post:not(.layout-3) .image')) 1696 thim_min_height_carousel($('.thim-row-bg-border-top .thim-bg-border-top')) 1697 thim_min_height_carousel_old($('.thim-carousel-instructors .instructor-item')) 1698 thim_min_height_carousel_old($('.thim-testimonial-carousel-kindergarten .item')) 1699 1700 thim_min_height_carousel($('.thim-widget-carousel-categories .item')) 1701 thim_min_height_carousel($('.elementor-widget-thim-carousel-categories .item')) 1702 1703 thim_min_height_content_area() 1704 if ($(window).width() > 767) { 1705 thim_min_height_carousel($('.thim-grid-posts .item-post')) 1706 thim_min_height_carousel($('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info')) 1707 } 1708 1709 if ($(window).width() > 767 && $(window).width() < 1200) { 1710 if ($('body.thim-demo-university-4 .thim-icon-our-programs').length) { 1711 var min_height = parseInt($( 1712 'body.thim-demo-university-4 .thim-icon-our-programs').outerHeight() / 3) 1713 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', min_height) 1714 } 1715 } 1716 }) 1717 thim_min_height_carousel('.thim-carousel-instructors', '.instructor-item') 1718 thim_min_height_carousel('.thim-owl-carousel-post', '.image') 1719 thim_min_height_content_area() 1720 }) 1721 // 1722 function thim_min_height_carousel_old($selector) { 1723 var min_height = 0 1724 $selector.each(function (index, val) { 1725 if ($(this).outerHeight() > min_height) { 1726 min_height = $(this).outerHeight() 1727 } 1728 if (index + 1 == $selector.length) { 1729 $selector.css('min-height', min_height) 1730 } 1731 }) 1732 } 1733 1734 function thim_min_height_carousel(el, child) { 1735 var $elements = $(el) 1736 1737 $elements.each(function () { 1738 var $element = $(this), 1739 $child = child ? $element.find(child) : $element.children(), 1740 maxHeight = 0 1741 1742 $child.each(function () { 1743 var thisHeight = $(this).outerHeight() 1744 if (thisHeight > maxHeight) { 1745 maxHeight = thisHeight 1746 } 1747 }).css('min-height', maxHeight) 1748 }) 1749 } 1750 1751 function thim_min_height_content_area() { 1752 var content_area = $('#main-content .content-area'), 1753 footer = $('#main-content .site-footer'), 1754 winH = $(window).height() 1755 if (content_area.length > 0 && footer.length > 0) { 1756 content_area.css('min-height', winH - footer.height()) 1757 } 1758 } 1759 1760 $(window).on('elementor/frontend/init', function () { 1761 elementorFrontend.hooks.addAction('frontend/element_ready/thim-carousel-post.default', 1762 thim_eduma.thim_carousel) 1763 elementorFrontend.hooks.addAction('frontend/element_ready/thim-twitter.default', 1764 thim_eduma.thim_carousel) 1765 1766 elementorFrontend.hooks.addAction('frontend/element_ready/thim-courses.default', 1767 thim_eduma.thim_carousel); 1768 1769 elementorFrontend.hooks.addAction('frontend/element_ready/thim-list-event.default', 1770 thim_eduma.thim_carousel); 1771 1772 elementorFrontend.hooks.addAction('frontend/element_ready/thim-course-categories.default', 1773 thim_eduma.thim_carousel) 1774 1775 elementorFrontend.hooks.addAction('frontend/element_ready/thim-our-team.default', 1776 thim_eduma.thim_carousel) 1777 1778 elementorFrontend.hooks.addAction('frontend/element_ready/thim-gallery-images.default', 1779 thim_eduma.thim_carousel) 1780 1781 elementorFrontend.hooks.addAction('frontend/element_ready/thim-list-instructors.default', 1782 thim_eduma.thim_carousel) 1783 1784 elementorFrontend.hooks.addAction('frontend/element_ready/thim-testimonials.default', 1785 thim_eduma.thim_carousel) 1786 1787 elementorFrontend.hooks.addAction('frontend/element_ready/thim-courses-collection.default', 1788 thim_eduma.thim_carousel) 1789 1790 elementorFrontend.hooks.addAction('frontend/element_ready/thim-testimonials.default', 1791 thim_eduma.thim_contentslider) 1792 1793 elementorFrontend.hooks.addAction('frontend/element_ready/thim-counters-box.default', 1794 thim_eduma.counter_box) 1795 1796 elementorFrontend.hooks.addAction('frontend/element_ready/global', function ($scope) { 1797 var $carousel = $scope.find('.owl-carousel') 1798 if ($carousel.length) { 1799 var carousel = $carousel.data('owlCarousel') 1800 carousel && carousel.reload() 1801 } 1802 }) 1803 }) 1804})(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.