1var thim_scroll = true 2var woof_js_after_ajax_done 3var can_escape = true; 4 5(function ($) { 6 'use strict' 7 if (typeof LearnPress != 'undefined') { 8 if (typeof LearnPress.load_lesson == 'undefined') { 9 LearnPress.load_lesson = function (a, b) { 10 LearnPress.$Course && LearnPress.$Course.loadLesson(a, b) 11 } 12 } 13 } 14 15 $.avia_utilities = $.avia_utilities || {} 16 $.avia_utilities.supported = {} 17 $.avia_utilities.supports = (function () { 18 var div = document.createElement('div'), 19 vendors = ['Khtml', 'Ms', 'Moz', 'Webkit', 'O'] 20 return function (prop, vendor_overwrite) { 21 if (div.style.prop !== undefined) { 22 return '' 23 } 24 if (vendor_overwrite !== undefined) { 25 vendors = vendor_overwrite 26 } 27 prop = prop.replace(/^[a-z]/, function (val) { 28 return val.toUpperCase() 29 }) 30 31 var len = vendors.length 32 while (len--) { 33 if (div.style[vendors[len] + prop] !== undefined) { 34 return '-' + vendors[len].toLowerCase() + '-' 35 } 36 } 37 return false 38 } 39 }()); 40 41 /* Smartresize */ 42 (function ($, sr) { 43 var debounce = function (func, threshold, execAsap) { 44 var timeout 45 return function debounced() { 46 var obj = this, args = arguments 47 48 function delayed() { 49 if (!execAsap) 50 func.apply(obj, args) 51 timeout = null 52 } 53 54 if (timeout) 55 clearTimeout(timeout) 56 else if (execAsap) 57 func.apply(obj, args) 58 timeout = setTimeout(delayed, threshold || 100) 59 } 60 } 61 // smartresize 62 jQuery.fn[sr] = function (fn) { 63 return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr) 64 } 65 })(jQuery, 'smartresize') 66 67 //Back To top 68 var back_to_top = function () { 69 jQuery(window).scroll(function () { 70 if (jQuery(this).scrollTop() > 400) { 71 jQuery('#back-to-top').addClass('active') 72 } else { 73 jQuery('#back-to-top').removeClass('active') 74 } 75 }) 76 jQuery('#back-to-top').on('click', function () { 77 jQuery('html, body').animate({scrollTop: '0px'}, 800) 78 return false 79 }) 80 } 81 82 //// stick header 83 $(document).ready(function () { 84 var layout = $('#thim-course-archive').attr('data-attr') 85 if (!jQuery.cookie('course_switch')) { 86 $('#thim-course-archive').removeClass() 87 $('.thim-course-switch-layout > a').removeClass('switch-active') 88 if (layout === 'thim-course-list') { 89 $('#thim-course-archive').addClass('thim-course-list') 90 $('.thim-course-switch-layout > a.switchToList').addClass('switch-active') 91 } else { 92 $('#thim-course-archive').addClass('thim-course-grid') 93 $('.thim-course-switch-layout > a.switchToGrid').addClass('switch-active') 94 } 95 } 96 97 // var $header = $('#masthead.site-header') 98 // var $content_pusher = $('#wrapper-container .content-pusher') 99 // $header.imagesLoaded(function () { 100 // $('body').removeClass('fixloader'); 101 // var height_sticky_header = $header.outerHeight(true) 102 // if ($('#masthead.header_overlay, #masthead.sticky-header').length > 0) { 103 // console.log('sdfas'); 104 // $content_pusher.css({'padding-top': height_sticky_header + 'px'}); 105 // $(window).resize(function () { 106 // var height_sticky_header = $header.outerHeight(true) 107 // $content_pusher.css( 108 // {'padding-top': height_sticky_header + 'px'}) 109 // }) 110 // } 111 // }) 112 }) 113 114 var thim_SwitchLayout = function () { 115 var cookie_name = 'course_switch', 116 archive = $('#thim-course-archive') 117 if (archive.length > 0) { 118 119 $(document).on('click', '.thim-course-switch-layout > a', function (event) { 120 var elem = $(this), 121 archive = $('#thim-course-archive') 122 event.preventDefault() 123 if (!elem.hasClass('switch-active')) { 124 $('.thim-course-switch-layout > a').removeClass('switch-active') 125 elem.addClass('switch-active') 126 if (elem.hasClass('switchToGrid')) { 127 archive.fadeOut(300, function () { 128 archive.removeClass('thim-course-list').addClass(' thim-course-grid').fadeIn(300) 129 jQuery.cookie(cookie_name, 'grid-layout', 130 {expires: 3, path: '/'}) 131 }) 132 } else { 133 archive.fadeOut(300, function () { 134 archive.removeClass('thim-course-grid').addClass('thim-course-list').fadeIn(300) 135 jQuery.cookie(cookie_name, 'list-layout', 136 {expires: 3, path: '/'}) 137 }) 138 } 139 } 140 }) 141 } 142 143 } 144 145 var thim_Shop_SwitchLayout = function () { 146 var cookie_name = 'product_list', 147 archive = $('#thim-product-archive') 148 if (archive.length > 0) { 149 //Check grid-layout 150 if (!jQuery.cookie(cookie_name) || jQuery.cookie(cookie_name) == 'grid-layout') { 151 if (archive.hasClass('thim-product-list')) { 152 archive.removeClass('thim-product-list').addClass('thim-product-grid') 153 } 154 $('.thim-product-switch-layout > a.switch-active').removeClass('switch-active') 155 $('.thim-product-switch-layout > a.switchToGrid').addClass('switch-active') 156 } else { 157 if (archive.hasClass('thim-product-grid')) { 158 archive.removeClass('thim-product-grid').addClass('thim-product-list') 159 } 160 $('.thim-product-switch-layout > a.switch-active').removeClass('switch-active') 161 $('.thim-product-switch-layout > a.switchToList').addClass('switch-active') 162 } 163 164 $(document).on('click', '.thim-product-switch-layout > a', function (event) { 165 var elem = $(this), 166 archive = $('#thim-product-archive') 167 168 event.preventDefault() 169 if (!elem.hasClass('switch-active')) { 170 $('.thim-product-switch-layout > a').removeClass('switch-active') 171 elem.addClass('switch-active') 172 if (elem.hasClass('switchToGrid')) { 173 archive.fadeOut(300, function () { 174 archive.removeClass('thim-product-list').addClass(' thim-product-grid').fadeIn(300) 175 jQuery.cookie(cookie_name, 'grid-layout', 176 {expires: 3, path: '/'}) 177 }) 178 } else { 179 archive.fadeOut(300, function () { 180 archive.removeClass('thim-product-grid').addClass('thim-product-list').fadeIn(300) 181 jQuery.cookie(cookie_name, 'list-layout', 182 {expires: 3, path: '/'}) 183 }) 184 } 185 } 186 }) 187 } 188 189 } 190 191 var thim_Blog_SwitchLayout = function () { 192 var cookie_name = 'blog_layout', 193 archive = $('#blog-archive'), 194 switch_layout = archive.find('.switch-layout') 195 if (archive.length > 0) { 196 //Check grid-layout 197 if (!jQuery.cookie(cookie_name) || jQuery.cookie(cookie_name) == 'grid-layout') { 198 if (archive.hasClass('blog-list')) { 199 archive.removeClass('blog-list').addClass('blog-grid') 200 } 201 switch_layout.find('> a.switch-active').removeClass('switch-active') 202 switch_layout.find('> a.switchToGrid').addClass('switch-active') 203 } else { 204 if (archive.hasClass('blog-grid')) { 205 archive.removeClass('blog-grid').addClass('blog-list') 206 } 207 switch_layout.find('> a.switch-active').removeClass('switch-active') 208 switch_layout.find('> a.switchToList').addClass('switch-active') 209 } 210 211 $(document).on('click', '#blog-archive .switch-layout > a', 212 function (event) { 213 var elem = $(this), 214 archive = $('#blog-archive') 215 216 event.preventDefault() 217 if (!elem.hasClass('switch-active')) { 218 switch_layout.find('>a').removeClass('switch-active') 219 elem.addClass('switch-active') 220 if (elem.hasClass('switchToGrid')) { 221 archive.fadeOut(300, function () { 222 archive.removeClass('blog-list').addClass('blog-grid').fadeIn(300) 223 jQuery.cookie(cookie_name, 'grid-layout', 224 {expires: 3, path: '/'}) 225 }) 226 } else { 227 archive.fadeOut(300, function () { 228 archive.removeClass('blog-grid').addClass('blog-list').fadeIn(300) 229 jQuery.cookie(cookie_name, 'list-layout', 230 {expires: 3, path: '/'}) 231 }) 232 } 233 } 234 }) 235 } 236 237 } 238 239 240 var thim_post_gallery = function () { 241 $('article.format-gallery .flexslider').imagesLoaded(function () { 242 if (jQuery().flexslider) { 243 $('.flexslider').flexslider({ 244 slideshow : true, 245 animation : 'fade', 246 pauseOnHover : true, 247 animationSpeed: 400, 248 smoothHeight : true, 249 directionNav : true, 250 controlNav : false, 251 }) 252 } 253 }); 254 } 255 256 /* ****** PRODUCT QUICK VIEW ******/ 257 var thim_quick_view = function () { 258 $(document).on('click', '.quick-view', function (e) { 259 /* add loader */ 260 $('.quick-view a').css('display', 'none') 261 $(this).append('<a href="javascript:;" class="loading dark"></a>') 262 var product_id = $(this).attr('data-prod') 263 var data = {action: 'jck_quickview', product: product_id} 264 $.post(ajaxurl, data, function (response) { 265 $.magnificPopup.open({ 266 mainClass: 'my-mfp-zoom-in', 267 items : { 268 src : response, 269 type: 'inline', 270 }, 271 callbacks: { 272 open: function () { 273 $('body').addClass('thim-popup-active') 274 $.magnificPopup.instance.close = function () { 275 $('body').removeClass('thim-popup-active') 276 $.magnificPopup.proto.close.call(this) 277 } 278 }, 279 }, 280 }) 281 $('.quick-view a').css('display', 'inline-block') 282 $('.loading').remove() 283 $('.product-card .wrapper').removeClass('animate') 284 setTimeout(function () { 285 if (typeof wc_add_to_cart_variation_params !== 286 'undefined') { 287 $('.product-info .variations_form').each(function () { 288 $(this).wc_variation_form().find('.variations select:eq(0)').change() 289 }) 290 } 291 }, 600) 292 }) 293 e.preventDefault() 294 }) 295 } 296 297 var thim_course_menu_landing = function () { 298 if ($('.thim-course-menu-landing').length > 0) { 299 var menu_landing = $('.thim-course-menu-landing'), 300 tab_course = $('#learn-press-course-tabs .nav-tabs') 301 302 var tab_active = tab_course.find('>li.active'), 303 tab_item = tab_course.find('>li>a'), 304 tab_landing = menu_landing.find('.thim-course-landing-tab'), 305 tab_landing_item = tab_landing.find('>li>a'), 306 landing_Top = ($('#course-landing').length) > 0 ? $('#course-landing').offset().top : 0, 307 checkTop = ($(window).height() > landing_Top) ? $(window).height() : landing_Top 308 309 $('footer#colophon').addClass('has-thim-course-menu') 310 if (tab_active.length > 0) { 311 var active_href = tab_active.find('>a').attr('href'), 312 landing_active = tab_landing.find('>li>a[href="' + active_href + '"]') 313 314 if (landing_active.length > 0) { 315 landing_active.parent().addClass('active') 316 } 317 } 318 319 tab_landing_item.on('click', function (event) { 320 event.preventDefault() 321 322 var href = $(this).attr('href'), 323 parent = $(this).parent() 324 325 if (!parent.hasClass('active')) { 326 tab_landing.find('li.active').removeClass('active') 327 parent.addClass('active') 328 } 329 330 if (tab_course.length > 0) { 331 tab_course.find('>li>a[href="' + href + '"]').trigger('click') 332 333 $('body, html').animate({ 334 scrollTop: tab_course.offset().top - 50, 335 }, 800) 336 } else { 337 $('body, html').animate({ 338 scrollTop: $($.attr(this, 'href')).offset().top, 339 }, 500) 340 } 341 }) 342 343 tab_item.on('click', function () { 344 var href = $(this).attr('href'), 345 parent_landing = tab_landing.find('>li>a[href="' + href + 346 '"]').parent() 347 348 if (!parent_landing.hasClass('active')) { 349 tab_landing.find('li.active').removeClass('active') 350 parent_landing.addClass('active') 351 } 352 }) 353 354 $(window).scroll(function () { 355 if ($(window).scrollTop() > checkTop) { 356 $('body').addClass('course-landing-active') 357 } else { 358 $('body.course-landing-active').removeClass('course-landing-active') 359 } 360 }) 361 } 362 } 363 364 var thimImagepopup = function () { 365 if (jQuery().magnificPopup) { 366 $('.thim-image-popup').magnificPopup({ 367 type : 'image', 368 closeOnContentClick: true, 369 }) 370 } 371 } 372 373 $(document).on('click', '#course-curriculum-popup .popup-close', function (event) { 374 event.preventDefault() 375 $('#learn-press-block-content').remove() 376 }) 377 378 $(function () { 379 back_to_top() 380 381 /* Waypoints magic 382 ---------------------------------------------------------- */ 383 if (typeof jQuery.fn.waypoint !== 'undefined') { 384 jQuery( 385 '.wpb_animate_when_almost_visible:not(.wpb_start_animation)').waypoint(function () { 386 jQuery(this).addClass('wpb_start_animation') 387 }, {offset: '85%'}) 388 } 389 }) 390 391 function empty(data) { 392 if (typeof (data) == 'number' || typeof (data) == 'boolean') { 393 return false 394 } 395 if (typeof (data) == 'undefined' || data === null) { 396 return true 397 } 398 if (typeof (data.length) != 'undefined') { 399 return data.length === 0 400 } 401 var count = 0 402 for (var i in data) { 403 if (Object.prototype.hasOwnProperty.call(data, i)) { 404 count++ 405 } 406 } 407 return count === 0 408 } 409 410 var windowWidth = window.innerWidth, 411 windowHeight = window.innerHeight, 412 $document = $(document), 413 orientation = windowWidth > windowHeight ? 'landscape' : 'portrait' 414 var TitleAnimation = { 415 selector : '.article__parallax', 416 initialized: false, 417 animated : false, 418 initialize : function () { 419 }, 420 update : function () { 421 }, 422 } 423 424 $(window).on('debouncedresize', function (e) { 425 windowWidth = $(window).width() 426 windowHeight = $(window).height() 427 TitleAnimation.initialize() 428 }) 429 430 $(window).on('orientationchange', function (e) { 431 setTimeout(function () { 432 TitleAnimation.initialize() 433 }, 300) 434 }) 435 436 var latestScrollY = $('html').scrollTop() || $('body').scrollTop(), 437 ticking = false 438 439 function updateAnimation() { 440 ticking = false 441 TitleAnimation.update() 442 } 443 444 function requestScroll() { 445 if (!ticking) { 446 requestAnimationFrame(updateAnimation) 447 } 448 ticking = true 449 } 450 451 $(window).on('scroll', function () { 452 latestScrollY = $('html').scrollTop() || $('body').scrollTop() 453 requestScroll() 454 }) 455 456 jQuery(function ($) { 457 var adminbar_height = jQuery('#wpadminbar').outerHeight() 458 jQuery('.navbar-nav li a,.arrow-scroll > a').on('click', function (e) {
459 if (parseInt(jQuery(window).scrollTop(), 10) < 2) { 460 var height = 47 461 } else height = 0 462 var sticky_height = jQuery('#masthead').outerHeight() 463 var menu_anchor = jQuery(this).attr('href') 464 if (menu_anchor && menu_anchor.indexOf('#') == 0 && 465 menu_anchor.length > 1) { 466 e.preventDefault() 467 $('html,body').animate({ 468 scrollTop: jQuery(menu_anchor).offset().top - 469 adminbar_height - sticky_height + height, 470 }, 850) 471 } 472 }) 473 }) 474 475 function mobilecheck() { 476 var check = false; 477 (function (a) { 478 if (/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test( 479 a) || 480 /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test( 481 a.substr(0, 4))) check = true 482 })(navigator.userAgent || navigator.vendor || window.opera) 483 return check 484 } 485 486 if (mobilecheck()) { 487 window.addEventListener('load', function () { // on page load 488 var main_content = document.getElementById('main-content') 489 if (main_content) { 490 main_content.addEventListener('touchstart', function (e) { 491 $('body').removeClass('mobile-menu-open') 492 }) 493 } 494 }, false) 495 } 496 497 /* mobile menu */ 498 if(jQuery('.navbar-nav>li.menu-item-has-children').hasClass("thim-ekits-menu__has-dropdown")){ 499 500 }else{ 501 if (jQuery(window).width() > 768) { 502 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( 503 '<span class="icon-toggle"><i class="fa fa-angle-down"></i></span>') 504 } else { 505 jQuery( 506 '.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( 507 '<span class="icon-toggle"><i class="fa fa-angle-down"></i></span>') 508 jQuery( 509 '.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( 510 '<span class="icon-toggle"><i class="fa fa-angle-up"></i></span>') 511 } 512 } 513 514 $('.navbar-nav>li .icon-toggle').on('click', function (e) { 515 e.stopPropagation(); 516 $(this).parent().addClass('thim-ekits-menu__is-hover'); 517 }) 518 519 $('.navbar-nav>li .icon-toggle,.thim-ekits-menu__icon').on('click', function (e) { 520 e.stopPropagation(); 521 $('.mobile-menu-wrapper .icon-menu-back').addClass('show-icon'); 522 }) 523 524 $('.mobile-menu-wrapper .icon-menu-back').on('click', function (e) { 525 e.stopPropagation(); 526 $('.mobile-menu-container > ul >li').removeClass('thim-ekits-menu__is-hover'); 527 $(this).removeClass('show-icon'); 528 }) 529 530 /* ====== ON RESIZE ====== */ 531 $(window).on('load', function () { 532 533 thim_post_gallery() 534 thim_quick_view() 535 536 thim_SwitchLayout() 537 thim_Shop_SwitchLayout() 538 thim_Blog_SwitchLayout() 539 thimImagepopup() 540 541 setTimeout(function () { 542 TitleAnimation.initialize() 543 thim_course_menu_landing() 544 }, 400) 545 }) 546 547})(jQuery); 548 549(function ($) { 550 var thim_quiz_index = function () { 551 var question_index = $('.single-quiz .index-question'), 552 quiz_total_text = $('.single-quiz .quiz-total .quiz-text') 553 if (question_index.length > 0) { 554 quiz_total_text.html(question_index.html()) 555 } 556 } 557 558 $(window).on('load', function () { 559 thim_quiz_index() 560 561 //Add class for profile tab 562 var $profile_list = $('.profile-tabs .nav-tabs>li ') 563 if ($profile_list.length > 0) { 564 $profile_list.addClass('thim-profile-list-' + $profile_list.length) 565 } 566 }) 567 568 // Learnpress custom code js 569 $(document).ready(function () { 570 //Course wishlist 571 $('body:not(.learnpress-v4) .course-wishlist-box [class*=\'course-wishlist\']').on('click', function (event) { 572 event.preventDefault() 573 var $this = $(this) 574 if ($this.hasClass('loading')) return 575 $this.addClass('loading') 576 $this.toggleClass('course-wishlist') 577 $this.toggleClass('course-wishlisted') 578 $class = $this.attr('class') 579 if ($this.hasClass('course-wishlisted')) { 580 $.ajax({ 581 type : 'POST', 582 url : window.location.href, 583 dataType: 'html', 584 data : { 585 //action : 'learn_press_toggle_course_wishlist', 586 'lp-ajax': 'toggle_course_wishlist', 587 course_id: $this.data('id'), 588 nonce : $this.data('nonce'), 589 }, 590 success : function () { 591 $this.removeClass('loading') 592 }, 593 error : function () { 594 $this.removeClass('loading') 595 }, 596 }) 597 } 598 if ($this.hasClass('course-wishlist')) { 599 $.ajax({ 600 type : 'POST', 601 url : window.location.href, 602 dataType: 'html', 603 data : { 604 //action : 'learn_press_toggle_course_wishlist', 605 'lp-ajax': 'toggle_course_wishlist', 606 course_id: $this.data('id'), 607 nonce : $this.data('nonce'), 608 }, 609 success : function () { 610 $this.removeClass('loading') 611 }, 612 error : function () { 613 $this.removeClass('loading') 614 }, 615 }) 616 } 617 }) 618 619 $('.video-container').on('click', '.beauty-intro .btns', function () { 620 var iframe = '<iframe src="' + $(this).closest('.video-container').find('.yt-player').attr('data-video') + '" height= "' + 621 $('.parallaxslider').height() + '"></iframe>' 622 $(this).closest('.video-container').find('.yt-player').replaceWith(iframe) 623 //debug >HP 624 $(this).closest('.video-container').find('.hideClick:first').css('display', 'none') 625 }) 626 627 if (!$('.add-review').length) { 628 return 629 } 630 var $star = $('.add-review .filled') 631 var $review = $('#review-course-value') 632 $star.find('li').on('mouseover', function () { 633 $(this).nextAll().find('span').removeClass('fa-star').addClass('fa-star-o') 634 $(this).prevAll().find('span').removeClass('fa-star-o').addClass('fa-star') 635 $(this).find('span').removeClass('fa-star-o').addClass('fa-star') 636 $review.val($(this).index() + 1) 637 }) 638 639 //Replace placeholder input password & login 640 $('.login-username [name="log"]').attr('placeholder', thim_js_translate.login) 641 $('.login-password [name="pwd"]').attr('placeholder', thim_js_translate.password) 642 643 $(window).scroll(function (event) { 644 if (thim_scroll && thim_scroll === false) { 645 event.preventDefault() 646 } 647 }) 648 }) 649 650 // $(document).on('click', '.single-lp_course .course-meta .course-review .value', 651 // function () { 652 // var review_tab = $('.course-tabs a[href="#tab-course-review"]') 653 // if (review_tab.length > 0) { 654 // review_tab.trigger('click') 655 // $('body, html').animate({ 656 // scrollTop: review_tab.offset().top - 50, 657 // }, 800) 658 // } 659 // var review_tab_v3 = $('.course-tabs a[href="#tab-reviews"]') 660 // if (review_tab_v3.length > 0) { 661 // review_tab_v3.trigger('click') 662 // $('body, html').animate({ 663 // scrollTop: review_tab_v3.offset().top - 50, 664 // }, 800) 665 // } 666 // }) 667 668 //Widget live search course 669 var search_timer = false 670 671 function thimlivesearch(contain) { 672 var input_search = contain.find('.courses-search-input'), 673 list_search = contain.find('.courses-list-search'), 674 keyword = input_search.val(), 675 loading = contain.find('.fa-search,.fa-times') 676 677 if (keyword) { 678 if (keyword.length < 1) { 679 return 680 } 681 loading.addClass('fa-spinner fa-spin') 682 $.ajax({ 683 type : 'POST', 684 data : 'action=courses_searching&keyword=' + keyword + '&from=search', 685 url : ajaxurl, 686 success: function (html) { 687 var data_li = '' 688 var see_more = '' 689 var items = jQuery.parseJSON(html) 690 if (!items.error) { 691 $.each(items, function (index) { 692 if (index == 0) { 693 if (this['guid'] != '#') { 694 data_li += '<li class="search-item ui-menu-item' + 695 this['id'] + 696 '"><a class="ui-corner-all" href="' + 697 this['guid'] + '">' + this['title'] + 698 '</a></li>' 699 } else { 700 data_li += '<li class="search-item ui-menu-item">' + 701 this['title'] + '</li>' 702 } 703 704 } else { 705 if(index == items.length-1 && this['see_more']){ 706 see_more = this['see_more'] 707 }else{ 708 data_li += '<li class="search-item ui-menu-item' + 709 this['id'] + 710 '"><a class="ui-corner-all" href="' + 711 this['guid'] + '">' + this['title'] + 712 '</a></li>' 713 } 714 } 715 }) 716 list_search.addClass('search-visible').html('').append(data_li) 717 if(see_more){ 718 list_search.append('<li class="see-more">'+ see_more +'</li>') 719 } 720 } 721 thimsearchHover() 722 thimsearchSeemore() 723 loading.removeClass('fa-spinner fa-spin') 724 }, 725 error : function (html) { 726 }, 727 }) 728 } 729 } 730 731 function thimsearchHover() { 732 $('.courses-list-search .search-item').on('mouseenter', function () { 733 $('.courses-list-search .search-item').removeClass('ob-selected') 734 $(this).addClass('ob-selected') 735 }) 736 $('.courses-list-search .search-item').on('mouseleave', function () { 737 $('.courses-list-search .search-item').removeClass('ob-selected') 738 }) 739 } 740 741 function thimsearchSeemore() { 742 if ($('.search-item').length > 0) { 743 $('.see-more').show(); 744 } 745 $('.see-more').on('click', function(e) { 746 $('.courses-searching form').submit(); 747 }); 748 } 749 750 $(document).ready(function () { 751 752 $(document).on('click', '.thim-course-search-overlay .search-toggle', 753 function (e) { 754 e.stopPropagation() 755 var parent = $(this).parent() 756 $('body').addClass('thim-search-active') 757 setTimeout(function () { 758 parent.find('.thim-s').focus() 759 }, 500) 760 761 }) 762 $(document).on('click', '.search-popup-bg', function () { 763 var parent = $(this).parent() 764 window.clearTimeout(search_timer) 765 parent.find('.courses-list-search').empty() 766 parent.find('.thim-s').val('') 767 $('body').removeClass('thim-search-active') 768 }) 769 770 $(document).on('keyup', '.courses-search-input', function (event) { 771 clearTimeout($.data(this, 'search_timer')) 772 var contain = $(this).parents('.courses-searching'), 773 list_search = contain.find('.courses-list-search'), 774 item_search = list_search.find('>li') 775 if (event.which == 13) { 776 event.preventDefault() 777 $(this).stop() 778 } else if (event.which == 38) { 779 if (navigator.userAgent.indexOf('Chrome') != -1 && parseFloat(
780 navigator.userAgent.substring(navigator.userAgent.indexOf( 781 'Chrome') + 7).split(' ')[0]) >= 15) { 782 var selected = item_search.filter('.ob-selected') 783 if (item_search.length > 1) { 784 item_search.removeClass('ob-selected') 785 // if there is no element before the selected one, we select the last one 786 if (selected.prev().length == 0) { 787 selected.siblings().last().addClass('ob-selected') 788 } else { // otherwise we just select the next one 789 selected.prev().addClass('ob-selected') 790 } 791 } 792 } 793 } else if (event.which == 40) { 794 if (navigator.userAgent.indexOf('Chrome') != -1 && parseFloat( 795 navigator.userAgent.substring(navigator.userAgent.indexOf( 796 'Chrome') + 7).split(' ')[0]) >= 15) { 797 var selected = item_search.filter('.ob-selected') 798 if (selected.length == 0) { 799 selected = item_search.first() 800 selected.addClass('ob-selected') 801 }else{ 802 if (item_search.length > 1) { 803 item_search.removeClass('ob-selected') 804 // if there is no element before the selected one, we select the last one 805 if (selected.next().length == 0) { 806 selected.siblings().first().addClass('ob-selected') 807 } else { // otherwise we just select the next one 808 selected.next().addClass('ob-selected') 809 } 810 } 811 } 812 } 813 } else if (event.which == 27) { 814 if ($('body').hasClass('thim-search-active')) { 815 $('body').removeClass('thim-search-active') 816 } 817 list_search.html('') 818 $(this).val('') 819 $(this).stop() 820 } else { 821 var search_timer = setTimeout(function () { 822 thimlivesearch(contain) 823 }, 500) 824 $(this).data('search_timer', search_timer) 825 page = 1 826 } 827 }) 828 $(document).on('keypress', '.courses-search-input', function (event) { 829 var item_search = $(this).parents('.courses-searching').find('.courses-list-search>li') 830 if (event.keyCode == 13) { 831 var selected = item_search.filter('.ob-selected') 832 if (selected.length > 0) { 833 event.preventDefault() 834 var ob_href = selected.find('a').first().attr('href') 835 window.location.href = ob_href 836 } 837 } 838 if (event.keyCode == 27) { 839 if ($('body').hasClass('thim-search-active')) { 840 $('body').removeClass('thim-search-active') 841 } 842 $('.courses-list-search').html('') 843 $(this).val('') 844 $(this).stop() 845 } 846 if (event.keyCode == 38) { 847 var selected = item_search.filter('.ob-selected') 848 // if there is no element before the selected one, we select the last one 849 if (item_search.length > 1) { 850 item_search.removeClass('ob-selected') 851 if (selected.prev().length == 0) { 852 selected.siblings().last().addClass('ob-selected') 853 } else { // otherwise we just select the next one 854 selected.prev().addClass('ob-selected') 855 } 856 } 857 } 858 if (event.keyCode == 40) { 859 var selected = item_search.filter('.ob-selected') 860 if (selected.length == 0) { 861 selected = item_search.first() 862 selected.addClass('ob-selected') 863 }else{ 864 if (item_search.length > 1) { 865 item_search.removeClass('ob-selected') 866 // if there is no element before the selected one, we select the last one 867 if (selected.next().length == 0) { 868 selected.siblings().first().addClass('ob-selected') 869 } else { // otherwise we just select the next one 870 selected.next().addClass('ob-selected') 871 } 872 } 873 } 874 } 875 }) 876 877 $(document).on('click', '.courses-list-search, .courses-search-input', 878 function (event) { 879 event.stopPropagation() 880 }) 881 882 $(document).on('click', 'body', function () { 883 if (!$('body').hasClass('course-scroll-remove')) { 884 $('body').addClass('course-scroll-remove') 885 $('.courses-list-search').html('') 886 } 887 }) 888 889 $(window).scroll(function () { 890 if ($('body').hasClass('course-scroll-remove') && 891 $('.courses-list-search li').length > 0) { 892 $('.courses-searching .courses-list-search').empty() 893 $('.courses-searching .thim-s').val('') 894 } 895 }) 896 897 $(document).on('focus', '.courses-search-input', function () { 898 if ($('body').hasClass('course-scroll-remove')) { 899 $('body').removeClass('course-scroll-remove') 900 } 901 }) 902 903 //Prevent search result 904 $(document).on('click', '#popup-header .search-visible', function (e) { 905 var href = $(e.target).attr('href') 906 if (!href) { 907 $('#popup-header .search-visible').removeClass('search-visible') 908 } 909 910 }) 911 912 $(document).on('click', '#popup-header button', function (e) { 913 $('#popup-header .thim-s').trigger('focus') 914 915 }) 916 917 $(document).on('focus', '#popup-header .thim-s', function () { 918 var link = $('#popup-header .courses-list-search a') 919 920 if ($(this).val() != '' && link.length > 0) { 921 $('#popup-header .courses-list-search').addClass('search-visible') 922 } 923 }) 924 925 //Widget icon box 926 $('.wrapper-box-icon').each(function () { 927 var $this = $(this) 928 if ($this.attr('data-icon')) { 929 var $color_icon = $('.boxes-icon i', $this).css('color') 930 var $color_title = $('.heading__primary a', $this).css('color') 931 var $color_icon_change = $this.attr('data-icon') 932 } 933 if ($this.attr('data-icon-border')) { 934 var $color_icon_border = $('.boxes-icon', $this).css('border-color') 935 var $color_icon_border_change = $this.attr('data-icon-border') 936 } 937 if ($this.attr('data-icon-bg')) { 938 var $color_bg = $('.boxes-icon', $this).css('background-color') 939 var $color_bg_change = $this.attr('data-icon-bg') 940 } 941 942 if ($this.attr('data-btn-bg')) { 943 var $color_btn_bg = $('.smicon-read', $this).css('background-color') 944 var $color_btn_border = $('.smicon-read', $this).css('border-color') 945 var $color_btn_bg_text_color = $('.smicon-read', $this).css('color') 946 947 var $color_btn_bg_change = $this.attr('data-btn-bg') 948 if ($this.attr('data-text-readmore')) { 949 var $color_btn_bg_text_color_change = $this.attr( 950 'data-text-readmore') 951 } else { 952 $color_btn_bg_text_color_change = $color_btn_bg_text_color 953 } 954 955 $('.smicon-read', $this).on({ 956 'mouseenter': function () { 957 if ($('#style_selector_container').length > 0) { 958 if ($('.smicon-read', $this).css('background-color') != $color_btn_bg) 959 $color_btn_bg = $('.smicon-read', $this).css('background-color') 960 } 961 $('.smicon-read', $this).css({ 962 'background-color': $color_btn_bg_change, 963 'border-color' : $color_btn_bg_change, 964 'color' : $color_btn_bg_text_color_change, 965 }) 966 }, 967 'mouseleave': function () { 968 $('.smicon-read', $this).css({ 969 'background-color': $color_btn_bg, 970 'border-color' : $color_btn_border, 971 'color' : $color_btn_bg_text_color, 972 }) 973 }, 974 }) 975 976 } 977 978 $($this).on({ 979 'mouseenter': function () { 980 if ($this.attr('data-icon')) { 981 $('.boxes-icon i', $this).css({'color': $color_icon_change}) 982 $('.heading__primary a', $this).css({'color': $color_icon_change}) 983 } 984 if ($this.attr('data-icon-bg')) { 985 /* for select style*/ 986 if ($('#style_selector_container').length > 0) { 987 if ($('.boxes-icon', $this).css('background-color') != $color_bg) 988 $color_bg = $('.boxes-icon', $this).css('background-color') 989 } 990 991 $('.boxes-icon', $this).css({'background-color': $color_bg_change}) 992 } 993 if ($this.attr('data-icon-border')) { 994 $('.boxes-icon', $this).css({'border-color': $color_icon_border_change}) 995 } 996 }, 997 'mouseleave': function () { 998 if ($this.attr('data-icon')) { 999 $('.boxes-icon i', $this).css({'color': $color_icon}) 1000 $('.heading__primary a', $this).css({'color': $color_title}) 1001 } 1002 if ($this.attr('data-icon-bg')) { 1003 $('.boxes-icon', $this).css({'background-color': $color_bg}) 1004 } 1005 if ($this.attr('data-icon-border')) { 1006 $('.boxes-icon', $this).css({'border-color': $color_icon_border}) 1007 } 1008 }, 1009 }) 1010 1011 }) 1012 /* End Icon Box */ 1013
1014 //Background video 1015 $('.bg-video-play').on('click', function () { 1016 var elem = $(this), 1017 video = $(this).parents('.thim-widget-icon-box').find('.full-screen-video'), 1018 player = video.get(0) 1019 if (player.paused) { 1020 player.play() 1021 elem.addClass('bg-pause') 1022 } else { 1023 player.pause() 1024 elem.removeClass('bg-pause') 1025 } 1026 }) 1027 1028 //wpcf7-form-submit 1029 $(document).on('click', '.wpcf7-form-control.wpcf7-submit', function () { 1030 var elem = $(this), 1031 form = elem.parents('.wpcf7-form') 1032 form.addClass('thim-sending') 1033 $(document).on('invalid.wpcf7', function (event) { 1034 form.removeClass('thim-sending') 1035 }) 1036 $(document).on('spam.wpcf7', function (event) { 1037 form.removeClass('thim-sending') 1038 setTimeout(function () { 1039 if ($('.wpcf7-response-output').length > 0) { 1040 $('.wpcf7-response-output').hide() 1041 } 1042 }, 4000) 1043 }) 1044 $(document).on('mailsent.wpcf7', function (event) { 1045 form.removeClass('thim-sending') 1046 setTimeout(function () { 1047 if ($('.wpcf7-response-output').length > 0) { 1048 $('.wpcf7-response-output').hide() 1049 } 1050 }, 4000) 1051 1052 }) 1053 $(document).on('mailfailed.wpcf7', function (event) { 1054 form.removeClass('thim-sending') 1055 setTimeout(function () { 1056 if ($('.wpcf7-response-output').length > 0) { 1057 $('.wpcf7-response-output').hide() 1058 } 1059 }, 4000) 1060 }) 1061 }) 1062 }) 1063 1064 //Include plugin event file events.js 1065 jQuery(document).ready(function () { 1066 1067 // owl-carausel 1068 var carousels = $('.tp_event_owl_carousel') 1069 for (var i = 0; i < carousels.length; i++) { 1070 var data = $(carousels[i]).attr('data-countdown') 1071 var options = { 1072 navigation : true, // Show next and prev buttons 1073 slideSpeed : 300, 1074 paginationSpeed: 400, 1075 singleItem : true, 1076 } 1077 if (typeof data !== 'undefined') { 1078 data = JSON.parse(data) 1079 $.extend(options, data) 1080 1081 $.each(options, function (k, v) { 1082 if (v === 'true') { 1083 options[k] = true 1084 } else if (v === 'false') { 1085 options[k] = false 1086 } 1087 }) 1088 } 1089 1090 if (typeof options.slide === 'undefined' || options.slide === 1091 true) { 1092 $(carousels[i]).owlCarousel(options) 1093 } else { 1094 $(carousels[i]).removeClass('owl-carousel') 1095 } 1096 } 1097 }) 1098 1099 // Sticky sidebar 1100 jQuery(document).ready(function () { 1101 var offsetTop = 20 1102 if ($('#wpadminbar').length) { 1103 offsetTop += $('#wpadminbar').outerHeight() 1104 } 1105 if ($('#masthead.sticky-header').length) { 1106 offsetTop += $('#masthead.sticky-header').outerHeight() 1107 } 1108 jQuery('#sidebar.sticky-sidebar').theiaStickySidebar({ 1109 'containerSelector' : '', 1110 'additionalMarginTop' : offsetTop, 1111 'additionalMarginBottom': '0', 1112 'updateSidebarHeight' : false, 1113 'minWidth' : '768', 1114 'sidebarBehavior' : 'modern', 1115 }) 1116 }) 1117 1118 // Prevent search when no content submited 1119 jQuery(document).ready(function () { 1120 const elSkeleton = document.querySelector( '.lp-archive-course-skeleton' ); 1121 1122 $('form#bbp-search-form').submit(function () { 1123 if ($.trim($('#bbp_search').val()) === '') { 1124 $('#bbp_search').focus() 1125 return false 1126 } 1127 }) 1128 1129 $('form.search-form').submit(function () { 1130 var input_search = $(this).find('input[name=\'s\']') 1131 if ($.trim(input_search.val()) === '') { 1132 input_search.focus() 1133 return false 1134 } 1135 }) 1136 1137 //My account login 1138 $('#customer_login .login').submit(function (event) { 1139 var elem = $(this), 1140 input_username = elem.find('#username'), 1141 input_pass = elem.find('#password') 1142 1143 if (input_pass.length > 0 && input_pass.val() == '') { 1144 input_pass.addClass('invalid') 1145 event.preventDefault() 1146 } 1147 1148 if (input_username.length > 0 && input_username.val() == '') { 1149 input_username.addClass('invalid') 1150 event.preventDefault() 1151 } 1152 }) 1153 1154 //My account register 1155 $('#customer_login .register').submit(function (event) { 1156 var elem = $(this), 1157 input_username = elem.find('#reg_username'), 1158 input_email = elem.find('#reg_email'), 1159 input_pass = elem.find('#reg_password'), 1160 input_captcha = $('#customer_login .register .captcha-result'), 1161 valid_email = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm 1162 1163 if (input_captcha.length > 0) { 1164 var captcha_1 = parseInt(input_captcha.data('captcha1')), 1165 captcha_2 = parseInt(input_captcha.data('captcha2')) 1166 1167 if (captcha_1 + captcha_2 != parseInt(input_captcha.val())) { 1168 input_captcha.addClass('invalid').val('') 1169 event.preventDefault() 1170 } 1171 } 1172 1173 if (input_pass.length > 0 && input_pass.val() == '') { 1174 input_pass.addClass('invalid') 1175 event.preventDefault() 1176 } 1177 1178 if (input_username.length > 0 && input_username.val() == '') { 1179 input_username.addClass('invalid') 1180 event.preventDefault() 1181 } 1182 1183 if (input_email.length > 0 && (input_email.val() == '' || 1184 !valid_email.test(input_email.val()))) { 1185 input_email.addClass('invalid') 1186 event.preventDefault() 1187 } 1188 }) 1189 1190 //Validate comment form submit 1191 $('form#commentform').submit(function (event) { 1192 var elem = $(this), 1193 comment = elem.find('#comment[aria-required="true"]'), 1194 author = elem.find('#author[aria-required="true"]'), 1195 url = elem.find('#url[aria-required="true"]'), 1196 email = elem.find('#email[aria-required="true"]'), 1197 valid_email = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm 1198 1199 if (author.length > 0 && author.val() == '') { 1200 author.addClass('invalid') 1201 event.preventDefault() 1202 } 1203 1204 if (comment.length > 0 && comment.val() == '') { 1205 comment.addClass('invalid') 1206 event.preventDefault() 1207 } 1208 1209 if (url.length > 0 && url.val() == '') { 1210 url.addClass('invalid') 1211 event.preventDefault() 1212 } 1213 1214 if (email.length > 0 && 1215 (email.val() == '' || !valid_email.test(email.val()))) { 1216 email.addClass('invalid') 1217 event.preventDefault() 1218 } 1219 }) 1220 1221 $('#customer_login .register, #reg_username, #reg_email, #reg_password').on('focus', function () { 1222 $(this).removeClass('invalid') 1223 }) 1224 1225 $('input.wpcf7-text, textarea.wpcf7-textarea').on('focus', function () { 1226 if ($(this).hasClass('wpcf7-not-valid')) { 1227 $(this).removeClass('wpcf7-not-valid') 1228 } 1229 }) 1230 1231 $('.thim-language').on({ 1232 'mouseenter': function () { 1233 $(this).children('.list-lang').stop(true, false).fadeIn(250) 1234 }, 1235 'mouseleave': function () { 1236 $(this).children('.list-lang').stop(true, false).fadeOut(250) 1237 }, 1238 }) 1239 1240 $('#toolbar .menu li.menu-item-has-children').on({ 1241 'mouseenter': function () { 1242 $(this).children('.sub-menu').stop(true, false).fadeIn(250) 1243 }, 1244 'mouseleave': function () { 1245 $(this).children('.sub-menu').stop(true, false).fadeOut(250) 1246 }, 1247 }) 1248 1249 //Widget gallery-posts 1250 function gallery_layout() { 1251 var $container = jQuery('.isotope-layout') 1252 $container.each(function () { 1253 var $this = jQuery(this), $width, $col, $width_unit, 1254 $height_unit 1255 var $spacing = 10 1256 $col = 6 1257 if ($col != 1) { 1258 if (parseInt($container.width()) < 768) { 1259 $col = 4 1260 } 1261 if (parseInt($container.width()) < 480) { 1262 $col = 2 1263 } 1264 1265 } 1266 $width_unit = Math.floor((parseInt($container.width(), 10) - 1267 ($col - 1) * $spacing) / $col) 1268 $height_unit = Math.floor(parseInt($width_unit, 10)) 1269 1270 $this.find('.item_gallery').css({ 1271 width: $width_unit, 1272 }) 1273 if ($col == 1) { 1274 $height_unit = 'auto' 1275 } 1276 $this.find('.item_gallery .thim-gallery-popup').css({ 1277 height: $height_unit, 1278 }) 1279 if ($this.find('.item_gallery').hasClass('size32')) { 1280 if ($col > 1) { 1281 $this.find('.item_gallery.size32 .thim-gallery-popup').css({ 1282 height: $height_unit * 2 + $spacing, 1283 }) 1284 } 1285 } 1286 if ($this.find('.item_gallery').hasClass('size32')) { 1287 if ($col > 3) { 1288 $width = $width_unit * 4 + $spacing * 3 1289 $this.find('.item_gallery.size32').css({ 1290 width: $width, 1291 }) 1292 } else { 1293 $width = $width_unit * 2 + $spacing * 1 1294 $this.find('.item_gallery.size32').css({ 1295 width: $width, 1296 }) 1297 } 1298 } 1299 if ($this.find('.item_gallery').hasClass('size22') && $col != 1) { 1300 $this.find('.item_gallery.size22 .thim-gallery-popup').css({ 1301 height: $height_unit * 2 + $spacing, 1302 }) 1303 } 1304 if ($this.find('.item_gallery').hasClass('size22') && $col != 1) { 1305 $width = $width_unit * 2 + $spacing * 1 1306 $this.find('.item_gallery.size22').css({ 1307 width: $width, 1308 }) 1309 } 1310 if (jQuery().isotope) { 1311 $this.isotope({ 1312 itemSelector: '.item_gallery', 1313 masonry : { 1314 columnWidth: $width_unit, 1315 gutter : $spacing, 1316 }, 1317 }) 1318 } 1319 }) 1320 } 1321 1322 gallery_layout() 1323 $(window).resize(function () { 1324 gallery_layout() 1325 }) 1326
1327 $(document).on('click', '.filter-controls .filter', function (e) { 1328 e.preventDefault() 1329 var filter = $(this).data('filter'), 1330 filter_wraper = $(this).parents('.thim-widget-gallery-posts').find('.wrapper-gallery-filter') 1331 $('.filter-controls .filter').removeClass('active') 1332 $(this).addClass('active') 1333 filter_wraper.isotope({filter: filter}) 1334 }) 1335 1336 $(document).on('click', '.thim-gallery-popup', function (e) { 1337 e.preventDefault() 1338 var elem = $(this), 1339 post_id = elem.attr('data-id'), 1340 data = {action: 'thim_gallery_popup', post_id: post_id} 1341 elem.addClass('loading') 1342 $.post(ajaxurl, data, function (response) { 1343 elem.removeClass('loading') 1344 $('.thim-gallery-show').append(response) 1345 if ($('.thim-gallery-show img').length > 0) { 1346 $('.thim-gallery-show').magnificPopup({ 1347 mainClass : 'my-mfp-zoom-in', 1348 type : 'image', 1349 delegate : 'a', 1350 showCloseBtn: false, 1351 gallery : { 1352 enabled: true, 1353 }, 1354 callbacks : { 1355 open: function () { 1356 $('body').addClass('thim-popup-active') 1357 $.magnificPopup.instance.close = function () { 1358 $('.thim-gallery-show').empty() 1359 $('body').removeClass('thim-popup-active') 1360 $.magnificPopup.proto.close.call(this) 1361 } 1362 }, 1363 }, 1364 }).magnificPopup('open') 1365 } else { 1366 $.magnificPopup.open({ 1367 mainClass : 'my-mfp-zoom-in', 1368 items : { 1369 src : $('.thim-gallery-show'), 1370 type: 'inline', 1371 }, 1372 showCloseBtn: false, 1373 callbacks : { 1374 open: function () { 1375 $('body').addClass('thim-popup-active') 1376 $.magnificPopup.instance.close = function () { 1377 $('.thim-gallery-show').empty() 1378 $('body').removeClass('thim-popup-active') 1379 $.magnificPopup.proto.close.call(this) 1380 } 1381 }, 1382 }, 1383 }) 1384 } 1385 1386 }) 1387 1388 }) 1389 1390 $('.widget-button.custom_style').each(function () { 1391 var elem = $(this), 1392 old_style = elem.attr('style'), 1393 hover_style = elem.data('hover') 1394 elem.on({ 1395 'mouseenter': function () { 1396 elem.attr('style', hover_style) 1397 }, 1398 'mouseleave': function () { 1399 elem.attr('style', old_style) 1400 }, 1401 }) 1402 }) 1403 1404 }) 1405 1406 $(window).on('load', function () { 1407 1408 $(window).resize(function () { 1409 $('.thim-carousel-instructors .instructor-item').css('min-height', '') 1410 $('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info').css('min-height', '') 1411 if ($(window).width() < 767 || $(window).width() > 1200) { 1412 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', '') 1413 } 1414 1415 thim_min_height_carousel($('.thim-owl-carousel-post:not(.layout-3) .image')) 1416 thim_min_height_carousel($('.thim-row-bg-border-top .thim-bg-border-top')) 1417 thim_min_height_carousel_old($('.thim-carousel-instructors .instructor-item')) 1418 thim_min_height_carousel_old($('.thim-testimonial-carousel-kindergarten .item')) 1419 1420 thim_min_height_carousel( 1421 $('.thim-widget-carousel-categories .item')) 1422 thim_min_height_carousel( 1423 $('.elementor-widget-thim-carousel-categories .item')) 1424 1425 thim_min_height_content_area() 1426 if ($(window).width() > 767) { 1427 thim_min_height_carousel( 1428 $('.thim-grid-posts .item-post')) 1429 thim_min_height_carousel( 1430 $('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info')) 1431 } 1432 1433 if ($(window).width() > 767 && $(window).width() < 1200) { 1434 if ($('body.thim-demo-university-4 .thim-icon-our-programs').length) { 1435 var min_height = parseInt($( 1436 'body.thim-demo-university-4 .thim-icon-our-programs').outerHeight() / 3) 1437 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', min_height) 1438 } 1439 1440 } 1441 }) 1442 }) 1443 1444 function thim_get_position_header_course_v2($selector) { 1445 if ($(window).width() > 1025) { 1446 $selector.css('left', '-' + 1447 ($(window).width() - $('.container').width()) / 2 + 'px') 1448 $selector.css('right', '-' + 1449 (($(window).width() - $('.container').width()) / 2 + 1450 (45 + $('.content_course_2 .course_right').width())) + 1451 'px') 1452 } else { 1453 $selector.css('left', '-15px') 1454 $selector.css('right', '-' + 1455 (45 + $('.content_course_2 .course_right').width()) + 'px') 1456 } 1457 1458 } 1459 1460 $(window).on('load', function () { 1461 thim_min_height_carousel('.thim-carousel-instructors', '.instructor-item') 1462 thim_min_height_carousel('.thim-owl-carousel-post', '.image') 1463 // thim_min_height_carousel('.thim-course-carousel', '.course-thumbnail') 1464 1465 thim_min_height_content_area() 1466 }) 1467 1468 function thim_min_height_carousel_old($selector) { 1469 var min_height = 0 1470 $selector.each(function (index, val) { 1471 if ($(this).outerHeight() > min_height) { 1472 min_height = $(this).outerHeight() 1473 } 1474 if (index + 1 == $selector.length) { 1475 $selector.css('min-height', min_height) 1476 } 1477 }) 1478 } 1479 1480 function thim_min_height_carousel(el, child) { 1481 var $elements = $(el) 1482 1483 $elements.each(function () { 1484 var $element = $(this), 1485 $child = child ? $element.find(child) : $element.children(), 1486 maxHeight = 0 1487 1488 $child.each(function () { 1489 var thisHeight = $(this).outerHeight() 1490 if (thisHeight > maxHeight) { 1491 maxHeight = thisHeight 1492 } 1493 }).css('min-height', maxHeight) 1494 }) 1495 } 1496 1497 function thim_min_height_content_area() { 1498 var content_area = $('#main-content .content-area'), 1499 footer = $('#main-content .site-footer'), 1500 winH = $(window).height() 1501 if (content_area.length > 0 && footer.length > 0) { 1502 content_area.css('min-height', winH - footer.height()) 1503 } 1504 } 1505 1506 $(document).ready(function () { 1507 $('.thim-search-light-style').append('<a class="thim-button-down thim-click-to-bottom" href="#"><i class="fa fa-chevron-down"></i></a>') 1508 $(document).on('click', '.thim-button-down', function (e) { 1509 e.preventDefault() 1510 if ($('#wpadminbar').length > 0) { 1511 var height = parseInt($('#wpadminbar').outerHeight()) + 1512 parseInt($('.thim-search-light-style').outerHeight()) 1513 } else { 1514 var height = parseInt($('.thim-search-light-style').outerHeight()) 1515 } 1516 $('body, html').animate({
1517 'scrollTop': height, 1518 }, 600) 1519 }) 1520 1521 var html_scroll = '<div class="scroll_slider_tab"><div class="container">' + 1522 '<a href="" class="to_bottom">' + 1523 '<svg xmlns="http://www.w3.org/2000/svg"' + 1524 'xmlns:xlink="http://www.w3.org/1999/xlink"' + 1525 'width="18px" height="28px">' + 1526 '<path fill-rule="evenodd" fill="rgb(255, 255, 255)"' + 1527 'd="M16.169,2.687 C14.585,0.904 12.173,0.000 9.000,0.000 C5.827,0.000 3.415,0.904 1.831,2.687 C0.238,4.479 -0.000,6.580 -0.000,7.673 L-0.000,20.328 C-0.000,21.420 0.238,23.520 1.831,25.313 C3.415,27.096 5.827,28.000 9.000,28.000 C12.173,28.000 14.585,27.096 16.169,25.313 C17.762,23.520 18.000,21.420 18.000,20.328 L18.000,7.673 C18.000,6.580 17.762,4.479 16.169,2.687 ZM9.000,9.755 C8.342,9.755 7.808,9.242 7.808,8.611 L7.808,6.159 C7.808,5.528 8.342,5.015 9.000,5.015 C9.658,5.015 10.192,5.528 10.192,6.159 L10.192,8.611 C10.192,9.242 9.658,9.755 9.000,9.755 ZM17.059,20.328 C17.059,21.458 16.670,27.097 9.000,27.097 C1.330,27.097 0.941,21.458 0.941,20.328 L0.941,7.673 C0.941,6.566 1.315,1.138 8.529,0.911 L8.529,4.163 C7.578,4.369 6.866,5.185 6.866,6.159 L6.866,8.611 C6.866,9.585 7.578,10.401 8.529,10.607 L8.529,14.318 C8.529,14.568 8.740,14.770 9.000,14.770 C9.260,14.770 9.471,14.568 9.471,14.318 L9.471,10.607 C10.422,10.401 11.134,9.585 11.134,8.611 L11.134,6.159 C11.134,5.185 10.422,4.369 9.471,4.163 L9.471,0.911 C16.685,1.138 17.059,6.566 17.059,7.673 L17.059,20.328 Z"/>' + 1528 '</svg>' + 1529 '<i class="icon-chevron-down icon1"></i>' + 1530 '<i class="icon-chevron-down icon2"></i>' + 1531 '</a>' + 1532 '</div></div>' 1533 $('.have_scroll_bottom').append(html_scroll) 1534 $(document).on('click', '.have_scroll_bottom .scroll_slider_tab .to_bottom', 1535 function (e) { 1536 e.preventDefault() 1537 if ($('#wpadminbar').length > 0) { 1538 var height = parseInt($('#wpadminbar').outerHeight()) + 1539 parseInt($('.have_scroll_bottom').outerHeight()) 1540 } else { 1541 var height = parseInt( 1542 $('.have_scroll_bottom').outerHeight()) 1543 } 1544 $('body, html').animate({ 1545 'scrollTop': height, 1546 }, 600) 1547 }) 1548 1549 $(document).on('click', 'body.page-template-landing-page .current_page_item>a, .thim-top-landing .widget-button', 1550 function (e) { 1551 if ($('.thim-top-landing').length > 0) { 1552 e.preventDefault() 1553 if ($('#wpadminbar').length > 0) { 1554 var height = parseInt( 1555 $('#wpadminbar').outerHeight()) + 1556 parseInt($('.thim-top-landing').outerHeight()) 1557 } else { 1558 var height = parseInt( 1559 $('.thim-top-landing').outerHeight()) 1560 } 1561 $('body, html').animate({ 1562 'scrollTop': height, 1563 }, 600) 1564 } 1565 }) 1566 1567 }) 1568 $(document).ready(function () { 1569 //Shop filter color 1570 $('.woof_list input[data-tax="pa_color"]').each(function () { 1571 $(this).css('background-color', $(this).attr('name')) 1572 }) 1573 $('.woof_list input.woof_radio_term[name="pa_color"]').each(function () { 1574 $(this).css('background-color', $(this).data('slug')) 1575 }) 1576 }) 1577 1578 woof_js_after_ajax_done = function () { 1579 $('.woof_list input[data-tax="pa_color"]').each(function () { 1580 $(this).css('background-color', $(this).attr('name')) 1581 }) 1582 $('.woof_list input.woof_radio_term[name="pa_color"]').each(function () { 1583 $(this).css('background-color', $(this).data('slug')) 1584 }) 1585 1586 if ($('#thim-product-archive').hasClass('thim-product-list')) { 1587 $('.thim-product-switch-layout>a.switchToGrid.switch-active').removeClass('switch-active') 1588 $('.thim-product-switch-layout>a.switchToList').addClass('switch-active') 1589 } else { 1590 $('.thim-product-switch-layout>a.switchToList.switch-active').removeClass('switch-active') 1591 $('.thim-product-switch-layout>a.switchToGrid').addClass('switch-active') 1592 } 1593 1594 } 1595 1596 //Code for timetable widget 1597 // TODO when using many Thim Course Categories widgets 1598 $(document).ready(function () { 1599 1600 var tab_cat_course = $('.thim-carousel-course-categories-tabs') 1601 tab_cat_course.each(function () { 1602 tab_cat_course.find('.thim-course-slider .item').click(function (e) { 1603 e.preventDefault() 1604 tab_cat_course.find('.item_content.active').removeClass('active') 1605 tab_cat_course.find($(this).find('.title a').attr('href')).addClass('active') 1606 tab_cat_course.find('.thim-course-slider .item.active').removeClass('active') 1607 $(this).addClass('active') 1608 }) 1609 }) 1610 1611 // var item_input_new = $( 1612 // '.form_developer_course .content .yikes-easy-mc-form>label>input') 1613 // item_input_new.focusin(function () { 1614 // $(this).parent().find('span').css('font-size', '14px') 1615 // $(this).parent().find('span').css('bottom', '36px') 1616 // }).focusout(function () { 1617 // if ($(this).val() == '') { 1618 // $(this).parent().find('span').css('font-size', '0px') 1619 // $(this).parent().find('span').css('bottom', '0px') 1620 // } 1621 // }) 1622 1623 //Add class for nav-tabs single course 1624 var tab_course = $('.course-tabs .nav-tabs>li').length 1625 if (tab_course > 0) { 1626 $('.course-tabs .nav-tabs>li').addClass('thim-col-' + tab_course) 1627 } 1628
1629 $('.thim-widget-timetable .timetable-item ').each(function () { 1630 var elem = $(this), 1631 old_style = elem.attr('style'), 1632 hover_style = elem.data('hover') 1633 elem.on({ 1634 'mouseenter': function () { 1635 elem.attr('style', hover_style) 1636 }, 1637 'mouseleave': function () { 1638 elem.attr('style', old_style) 1639 }, 1640 }) 1641 }) 1642 1643 if (typeof LP != 'undefined') { 1644 LP.Hook.addAction('learn_press_receive_message', function () { 1645 var lesson_title = $( 1646 '.course-item.item-current .course-item-title').text(), 1647 lesson_index = $('.course-item.item-current .index').text() 1648 $('#popup-header .popup-title').html('<span class="index">' + lesson_index + '</span>' + 1649 lesson_title) 1650 }) 1651 } 1652 1653 $('.thim-video-popup .button-popup').on('click', function (e) { 1654 var item = $(this) 1655 e.preventDefault() 1656 $.magnificPopup.open({ 1657 items : { 1658 src : item.parent().parent().find('.video-content'), 1659 type: 'inline', 1660 }, 1661 showCloseBtn: false, 1662 callbacks : { 1663 open: function () { 1664 $('body').addClass('thim-popup-active') 1665 $.magnificPopup.instance.close = function () { 1666 $('body').removeClass('thim-popup-active') 1667 $.magnificPopup.proto.close.call(this) 1668 } 1669 }, 1670 }, 1671 }) 1672 }) 1673 1674 $('.mc4wp-form #mc4wp_email').on('focus', function () { 1675 $(this).parents('.mc4wp-form').addClass('focus-input') 1676 }).on('focusout', function () { 1677 $(this).parents('.mc4wp-form.focus-input').removeClass('focus-input') 1678 }) 1679 1680 $(document).on('click', '.button-retake-course, .button-finish-course', function () { 1681 $('.thim-box-loading-container.visible').removeClass('visible') 1682 }) 1683 1684 $(document).on('click', '.button-load-item', function () { 1685 $('#course-curriculum-popup').addClass('loading') 1686 $('.thim-box-loading-container').addClass('visible') 1687 }) 1688 1689 1690 $('.width-navigation .menu-main-menu>li.menu-item').last().addClass('last-menu-item') 1691 1692 1693 //Set padding for demo vc RTL 1694 setTimeout(function () { 1695 $(window).trigger('resize') 1696 }, 1000) 1697 $(window).resize(function () { 1698 var get_padding1 = parseFloat( 1699 $('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css('left')), 1700 get_padding2 = parseFloat( 1701 $('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css('left')) 1702 if (get_padding1 != 'undefined') { 1703 $('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css({'right': get_padding1, 'left': ''}) 1704 } 1705 if (get_padding2 != 'undefined') { 1706 $('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css({'right': get_padding2, 'left': ''}) 1707 } 1708 }) 1709 1710 $(document).on('click', '.button-load-item', function () { 1711 can_escape = false 1712 }) 1713 1714 $(document).on('keydown', function (event) { 1715 if (event.keyCode == 27) { 1716 if (typeof can_escape !== 'undefined') { 1717 if (can_escape === false) { 1718 event.preventDefault() 1719 } 1720 } 1721 } 1722 1723 }) 1724 1725 //Add view password into checkbox field 1726 $('.login-password').append('<span id="show_pass"><i class="fa fa-eye"></i></span>') 1727 $(document).on('click', '#show_pass', function () { 1728 var el = $(this), 1729 thim_pass = el.parents('.login-password').find('>input') 1730 if (el.hasClass('active')) { 1731 thim_pass.attr('type', 'password') 1732 } else { 1733 thim_pass.attr('type', 'text') 1734 } 1735 el.toggleClass('active') 1736 }) 1737 1738 $(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', 1739 function () { 1740 $('html, body').animate({ 1741 scrollTop: $($(this).attr('href')).offset().top, 1742 }, 1000) 1743 }) 1744 1745 $(window).resize(function () { 1746 if ($(window).width() > 600) { 1747 $('footer#colophon.has-footer-bottom').css('margin-bottom', $('.footer-bottom').height()) 1748 } 1749 if ($(window).width() < 768) { 1750 $('body.course-item-popup').addClass('full-screen-content-item') 1751 $('body.ltr.course-item-popup #learn-press-course-curriculum').css('left', '-300px') 1752 $('body.ltr.course-item-popup #learn-press-content-item').css('left', '0') 1753 $('body.rtl.course-item-popup #learn-press-course-curriculum').css('right', 'auto') 1754 $('body.rtl.course-item-popup #learn-press-content-item').css('right', 'auto') 1755 } 1756 }) 1757 1758 }) 1759 1760})(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.