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.header_default') 98 var $content_pusher = $('#wrapper-container .content-pusher') 99 $header.imagesLoaded(function () { 100 var height_sticky_header = $header.outerHeight(true) 101 $content_pusher.css({ 'padding-top': height_sticky_header + 'px' }) 102 $(window).resize(function () { 103 var height_sticky_header = $header.outerHeight(true) 104 $content_pusher.css( 105 { 'padding-top': height_sticky_header + 'px' }) 106 }) 107 }) 108 }) 109 110 var thim_SwitchLayout = function () { 111 var cookie_name = 'course_switch', 112 archive = $('#thim-course-archive') 113 if (archive.length > 0) { 114 115 $(document).on('click', '.thim-course-switch-layout > a', function (event) { 116 var elem = $(this), 117 archive = $('#thim-course-archive') 118 event.preventDefault() 119 if (!elem.hasClass('switch-active')) { 120 $('.thim-course-switch-layout > a').removeClass('switch-active') 121 elem.addClass('switch-active') 122 if (elem.hasClass('switchToGrid')) { 123 archive.fadeOut(300, function () { 124 archive.removeClass('thim-course-list').addClass(' thim-course-grid').fadeIn(300) 125 jQuery.cookie(cookie_name, 'grid-layout', 126 { expires: 3, path: '/' }) 127 }) 128 } else { 129 archive.fadeOut(300, function () { 130 archive.removeClass('thim-course-grid').addClass('thim-course-list').fadeIn(300) 131 jQuery.cookie(cookie_name, 'list-layout', 132 { expires: 3, path: '/' }) 133 }) 134 } 135 } 136 }) 137 } 138 139 } 140 141 var thim_Shop_SwitchLayout = function () { 142 var cookie_name = 'product_list', 143 archive = $('#thim-product-archive') 144 if (archive.length > 0) { 145 //Check grid-layout 146 if (!jQuery.cookie(cookie_name) || jQuery.cookie(cookie_name) == 'grid-layout') { 147 if (archive.hasClass('thim-product-list')) { 148 archive.removeClass('thim-product-list').addClass('thim-product-grid') 149 } 150 $('.thim-product-switch-layout > a.switch-active').removeClass('switch-active') 151 $('.thim-product-switch-layout > a.switchToGrid').addClass('switch-active') 152 } else { 153 if (archive.hasClass('thim-product-grid')) { 154 archive.removeClass('thim-product-grid').addClass('thim-product-list') 155 } 156 $('.thim-product-switch-layout > a.switch-active').removeClass('switch-active') 157 $('.thim-product-switch-layout > a.switchToList').addClass('switch-active') 158 } 159 160 $(document).on('click', '.thim-product-switch-layout > a', function (event) { 161 var elem = $(this), 162 archive = $('#thim-product-archive') 163 164 event.preventDefault() 165 if (!elem.hasClass('switch-active')) { 166 $('.thim-product-switch-layout > a').removeClass('switch-active') 167 elem.addClass('switch-active') 168 if (elem.hasClass('switchToGrid')) { 169 archive.fadeOut(300, function () { 170 archive.removeClass('thim-product-list').addClass(' thim-product-grid').fadeIn(300) 171 jQuery.cookie(cookie_name, 'grid-layout', 172 { expires: 3, path: '/' }) 173 }) 174 } else { 175 archive.fadeOut(300, function () { 176 archive.removeClass('thim-product-grid').addClass('thim-product-list').fadeIn(300) 177 jQuery.cookie(cookie_name, 'list-layout', 178 { expires: 3, path: '/' }) 179 }) 180 } 181 } 182 }) 183 } 184 185 } 186 187 var thim_Blog_SwitchLayout = function () { 188 var cookie_name = 'blog_layout', 189 archive = $('#blog-archive'), 190 switch_layout = archive.find('.switch-layout') 191 if (archive.length > 0) { 192 //Check grid-layout 193 if (!jQuery.cookie(cookie_name) || jQuery.cookie(cookie_name) == 'grid-layout') { 194 if (archive.hasClass('blog-list')) { 195 archive.removeClass('blog-list').addClass('blog-grid') 196 } 197 switch_layout.find('> a.switch-active').removeClass('switch-active') 198 switch_layout.find('> a.switchToGrid').addClass('switch-active') 199 } else { 200 if (archive.hasClass('blog-grid')) { 201 archive.removeClass('blog-grid').addClass('blog-list') 202 } 203 switch_layout.find('> a.switch-active').removeClass('switch-active') 204 switch_layout.find('> a.switchToList').addClass('switch-active') 205 } 206 207 $(document).on('click', '#blog-archive .switch-layout > a', 208 function (event) { 209 var elem = $(this), 210 archive = $('#blog-archive') 211 212 event.preventDefault() 213 if (!elem.hasClass('switch-active')) { 214 switch_layout.find('>a').removeClass('switch-active') 215 elem.addClass('switch-active') 216 if (elem.hasClass('switchToGrid')) { 217 archive.fadeOut(300, function () { 218 archive.removeClass('blog-list').addClass('blog-grid').fadeIn(300) 219 jQuery.cookie(cookie_name, 'grid-layout', 220 { expires: 3, path: '/' }) 221 }) 222 } else { 223 archive.fadeOut(300, function () { 224 archive.removeClass('blog-grid').addClass('blog-list').fadeIn(300) 225 jQuery.cookie(cookie_name, 'list-layout', 226 { expires: 3, path: '/' }) 227 }) 228 } 229 } 230 }) 231 } 232 233 } 234 235 /* ****** jp-jplayer ******/ 236 var thim_post_audio = function () { 237 $('.jp-jplayer').each(function () { 238 var $this = $(this), 239 url = $this.data('audio'), 240 type = url.substr(url.lastIndexOf('.') + 1), 241 player = '#' + $this.data('player'), 242 audio = {} 243 audio[type] = url 244 $this.jPlayer({ 245 ready: function () { 246 $this.jPlayer('setMedia', audio) 247 }, 248 swfPath: 'jplayer/', 249 cssSelectorAncestor: player, 250 }) 251 }) 252 } 253 254 var thim_post_gallery = function () { 255 $('article.format-gallery .flexslider').imagesLoaded(function () { 256 if (jQuery().flexslider) { 257 $('.flexslider').flexslider({ 258 slideshow: true, 259 animation: 'fade', 260 pauseOnHover: true, 261 animationSpeed: 400, 262 smoothHeight: true, 263 directionNav: true, 264 controlNav: false, 265 }) 266 } 267 }) 268 } 269 270 /* ****** PRODUCT QUICK VIEW ******/ 271 var thim_quick_view = function () { 272 $(document).on('click', '.quick-view', function (e) { 273 /* add loader */ 274 $('.quick-view a').css('display', 'none') 275 $(this).append('<a href="javascript:;" class="loading dark"></a>') 276 var product_id = $(this).attr('data-prod') 277 var data = { action: 'jck_quickview', product: product_id } 278 $.post(ajaxurl, data, function (response) { 279 $.magnificPopup.open({ 280 mainClass: 'my-mfp-zoom-in', 281 items: { 282 src: response, 283 type: 'inline', 284 }, 285 callbacks: { 286 open: function () { 287 $('body').addClass('thim-popup-active') 288 $.magnificPopup.instance.close = function () { 289 $('body').removeClass('thim-popup-active') 290 $.magnificPopup.proto.close.call(this) 291 } 292 }, 293 }, 294 }) 295 $('.quick-view a').css('display', 'inline-block') 296 $('.loading').remove() 297 $('.product-card .wrapper').removeClass('animate') 298 setTimeout(function () { 299 if (typeof wc_add_to_cart_variation_params !== 300 'undefined') { 301 $('.product-info .variations_form').each(function () { 302 $(this).wc_variation_form().find('.variations select:eq(0)').change() 303 }) 304 } 305 }, 600) 306 }) 307 e.preventDefault() 308 }) 309 } 310 311 var thim_miniCartHover = function () { 312 jQuery(document).on('mouseenter', '.site-header .minicart_hover', function () { 313 jQuery(this).next('.widget_shopping_cart_content').slideDown() 314 }).on('mouseleave', '.site-header .minicart_hover', function () { 315 jQuery(this).next('.widget_shopping_cart_content').delay(100).stop(true, false).slideUp() 316 }) 317 jQuery(document).on('mouseenter', '.site-header .widget_shopping_cart_content', 318 function () { 319 jQuery(this).stop(true, false).show() 320 }).on('mouseleave', '.site-header .widget_shopping_cart_content', 321 function () { 322 jQuery(this).delay(100).stop(true, false).slideUp() 323 }) 324 } 325 326 var thim_course_menu_landing = function () { 327 if ($('.thim-course-menu-landing').length > 0) { 328 var menu_landing = $('.thim-course-menu-landing'), 329 tab_course = $('#learn-press-course-tabs .nav-tabs') 330 331 var tab_active = tab_course.find('>li.active'), 332 tab_item = tab_course.find('>li>a'), 333 tab_landing = menu_landing.find('.thim-course-landing-tab'), 334 tab_landing_item = tab_landing.find('>li>a'), 335 landing_Top = ($('#course-landing').length) > 0 ? $('#course-landing').offset().top : 0, 336 checkTop = ($(window).height() > landing_Top) ? $(window).height() : landing_Top 337 338 $('footer#colophon').addClass('has-thim-course-menu') 339 if (tab_active.length > 0) { 340 var active_href = tab_active.find('>a').attr('href'), 341 landing_active = tab_landing.find('>li>a[href="' + active_href + '"]') 342 343 if (landing_active.length > 0) { 344 landing_active.parent().addClass('active') 345 } 346 } 347 348 tab_landing_item.on('click', function (event) { 349 event.preventDefault() 350 351 var href = $(this).attr('href'), 352 parent = $(this).parent() 353 354 if (!parent.hasClass('active')) { 355 tab_landing.find('li.active').removeClass('active') 356 parent.addClass('active') 357 } 358 359 if (tab_course.length > 0) { 360 tab_course.find('>li>a[href="' + href + '"]').trigger('click') 361 362 $('body, html').animate({ 363 scrollTop: tab_course.offset().top - 50, 364 }, 800) 365 } else { 366 $('body, html').animate({ 367 scrollTop: $($.attr(this, 'href')).offset().top, 368 }, 500) 369 } 370 }) 371 372 tab_item.on('click', function () { 373 var href = $(this).attr('href'), 374 parent_landing = tab_landing.find('>li>a[href="' + href + 375 '"]').parent() 376 377 if (!parent_landing.hasClass('active')) { 378 tab_landing.find('li.active').removeClass('active') 379 parent_landing.addClass('active') 380 } 381 }) 382 383 $(window).scroll(function () { 384 if ($(window).scrollTop() > checkTop) { 385 $('body').addClass('course-landing-active') 386 } else { 387 $('body.course-landing-active').removeClass('course-landing-active') 388 } 389 }) 390 } 391 } 392 393 var thimImagepopup = function () { 394 if (jQuery().magnificPopup) { 395 $('.thim-image-popup').magnificPopup({ 396 type: 'image', 397 closeOnContentClick: true, 398 }) 399 } 400 } 401 402 $(document).on('click', '#course-curriculum-popup .popup-close', function (event) { 403 event.preventDefault() 404 $('#learn-press-block-content').remove() 405 }) 406 407 $(function () { 408 back_to_top() 409 410 /* Waypoints magic 411 ---------------------------------------------------------- */ 412 if (typeof jQuery.fn.waypoint !== 'undefined') { 413 jQuery( 414 '.wpb_animate_when_almost_visible:not(.wpb_start_animation)').waypoint(function () { 415 jQuery(this).addClass('wpb_start_animation') 416 }, { offset: '85%' }) 417 } 418 }) 419 420 function empty (data) { 421 if (typeof (data) == 'number' || typeof (data) == 'boolean') { 422 return false 423 } 424 if (typeof (data) == 'undefined' || data === null) { 425 return true 426 } 427 if (typeof (data.length) != 'undefined') { 428 return data.length === 0 429 } 430 var count = 0 431 for (var i in data) { 432 if (Object.prototype.hasOwnProperty.call(data, i)) { 433 count++ 434 } 435 } 436 return count === 0 437 } 438 439 var windowWidth = window.innerWidth, 440 windowHeight = window.innerHeight, 441 $document = $(document), 442 orientation = windowWidth > windowHeight ? 'landscape' : 'portrait' 443 var TitleAnimation = { 444 selector: '.article__parallax', 445 initialized: false, 446 animated: false, 447 initialize: function () { 448 }, 449 update: function () { 450 }, 451 } 452 453 $(window).on('debouncedresize', function (e) { 454 windowWidth = $(window).width() 455 windowHeight = $(window).height() 456 TitleAnimation.initialize() 457 }) 458 459 $(window).on('orientationchange', function (e) { 460 setTimeout(function () { 461 TitleAnimation.initialize() 462 }, 300) 463 }) 464 465 var latestScrollY = $('html').scrollTop() || $('body').scrollTop(), 466 ticking = false 467 468 function updateAnimation () { 469 ticking = false 470 TitleAnimation.update() 471 } 472 473 function requestScroll () { 474 if (!ticking) { 475 requestAnimationFrame(updateAnimation) 476 } 477 ticking = true 478 } 479 480 $(window).on('scroll', function () { 481 latestScrollY = $('html').scrollTop() || $('body').scrollTop() 482 requestScroll() 483 }) 484 485 jQuery(function ($) { 486 var adminbar_height = jQuery('#wpadminbar').outerHeight() 487 jQuery('.navbar-nav li a,.arrow-scroll > a').on('click', function (e) {
488 if (parseInt(jQuery(window).scrollTop(), 10) < 2) { 489 var height = 47 490 } else height = 0 491 var sticky_height = jQuery('#masthead').outerHeight() 492 var menu_anchor = jQuery(this).attr('href') 493 if (menu_anchor && menu_anchor.indexOf('#') == 0 && 494 menu_anchor.length > 1) { 495 e.preventDefault() 496 $('html,body').animate({ 497 scrollTop: jQuery(menu_anchor).offset().top - 498 adminbar_height - sticky_height + height, 499 }, 850) 500 } 501 }) 502 }) 503 504 function mobilecheck () { 505 var check = false; 506 (function (a) { 507 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( 508 a) || 509 /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( 510 a.substr(0, 4))) check = true 511 })(navigator.userAgent || navigator.vendor || window.opera) 512 return check 513 } 514 515 if (mobilecheck()) { 516 window.addEventListener('load', function () { // on page load 517 var main_content = document.getElementById('main-content') 518 if (main_content) { 519 main_content.addEventListener('touchstart', function (e) { 520 jQuery('.wrapper-container').removeClass('mobile-menu-open') 521 }) 522 } 523 }, false) 524 } 525 526 /* mobile menu */ 527 if (jQuery(window).width() > 768) { 528 jQuery( 529 '.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( 530 '<span class="icon-toggle"><i class="fa fa-angle-down"></i></span>') 531 } else { 532 jQuery( 533 '.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( 534 '<span class="icon-toggle"><i class="fa fa-angle-down"></i></span>') 535 jQuery( 536 '.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( 537 '<span class="icon-toggle"><i class="fa fa-angle-up"></i></span>') 538 } 539 jQuery( 540 '.navbar-nav>li.menu-item-has-children .icon-toggle, .navbar-nav>li.tc-menu-layout-builder .icon-toggle').on( 541 'click', function () { 542 if (jQuery(this).next('.sub-menu').is(':hidden')) { 543 jQuery(this).next('.sub-menu').slideDown(500, 'linear') 544 jQuery(this).html('<i class="fa fa-angle-up"></i>') 545 } else { 546 jQuery(this).next('.sub-menu').slideUp(500, 'linear') 547 jQuery(this).html('<i class="fa fa-angle-down"></i>') 548 } 549 }) 550 551 /* ====== ON RESIZE ====== */ 552 $(window).on('load', function () { 553 thim_post_audio() 554 thim_post_gallery() 555 thim_quick_view() 556 thim_miniCartHover() 557 thim_SwitchLayout() 558 thim_Shop_SwitchLayout() 559 thim_Blog_SwitchLayout() 560 thimImagepopup() 561 562 setTimeout(function () { 563 TitleAnimation.initialize() 564 thim_course_menu_landing() 565 }, 400) 566 }) 567 568})(jQuery); 569 570(function ($) { 571 var thim_quiz_index = function () { 572 var question_index = $('.single-quiz .index-question'), 573 quiz_total_text = $('.single-quiz .quiz-total .quiz-text') 574 if (question_index.length > 0) { 575 quiz_total_text.html(question_index.html()) 576 } 577 } 578 579 $(window).on('load', function () { 580 // $('.article__parallax').each(function(index, el) { 581 // $(el).parallax('50%', 0.4); 582 // }); 583 // $('.images_parallax').parallax_images({ 584 // speed: 0.5, 585 // }); 586 587 // $(window).resize(function() { 588 // $('.images_parallax').each(function(index, el) { 589 // $(el).imagesLoaded(function() { 590 // var parallaxHeight = $(this).find('img').height(); 591 // $(this).height(parallaxHeight); 592 // }); 593 // }); 594 // }).trigger('resize'); 595 596 thim_quiz_index() 597 598 //Add class for profile tab 599 var $profile_list = $('.profile-tabs .nav-tabs>li ') 600 if ($profile_list.length > 0) { 601 $profile_list.addClass('thim-profile-list-' + $profile_list.length) 602 } 603 }) 604 605 // Learnpress custom code js 606 $(document).ready(function () { 607 //Course wishlist 608 $('body:not(.learnpress-v4) .course-wishlist-box [class*=\'course-wishlist\']').on('click', function (event) { 609 event.preventDefault() 610 var $this = $(this) 611 if ($this.hasClass('loading')) return 612 $this.addClass('loading') 613 $this.toggleClass('course-wishlist') 614 $this.toggleClass('course-wishlisted') 615 $class = $this.attr('class') 616 if ($this.hasClass('course-wishlisted')) { 617 $.ajax({ 618 type: 'POST', 619 url: window.location.href, 620 dataType: 'html', 621 data: { 622 //action : 'learn_press_toggle_course_wishlist', 623 'lp-ajax': 'toggle_course_wishlist', 624 course_id: $this.data('id'), 625 nonce: $this.data('nonce'), 626 }, 627 success: function () { 628 $this.removeClass('loading') 629 }, 630 error: function () { 631 $this.removeClass('loading') 632 }, 633 }) 634 } 635 if ($this.hasClass('course-wishlist')) { 636 $.ajax({ 637 type: 'POST', 638 url: window.location.href, 639 dataType: 'html', 640 data: { 641 //action : 'learn_press_toggle_course_wishlist', 642 'lp-ajax': 'toggle_course_wishlist', 643 course_id: $this.data('id'), 644 nonce: $this.data('nonce'), 645 }, 646 success: function () { 647 $this.removeClass('loading') 648 }, 649 error: function () { 650 $this.removeClass('loading') 651 }, 652 }) 653 } 654 }) 655 656 $('.video-container').on('click', '.beauty-intro .btns', function () { 657 var iframe = '<iframe src="' + $(this).closest('.video-container').find('.yt-player').attr('data-video') + '" height= "' + 658 $('.parallaxslider').height() + '"></iframe>' 659 $(this).closest('.video-container').find('.yt-player').replaceWith(iframe) 660 //debug >HP 661 $(this).closest('.video-container').find('.hideClick:first').css('display', 'none') 662 }) 663 664 if (!$('.add-review').length) { 665 return 666 } 667 var $star = $('.add-review .filled') 668 var $review = $('#review-course-value') 669 $star.find('li').on('mouseover', function () { 670 $(this).nextAll().find('span').removeClass('fa-star').addClass('fa-star-o') 671 $(this).prevAll().find('span').removeClass('fa-star-o').addClass('fa-star') 672 $(this).find('span').removeClass('fa-star-o').addClass('fa-star') 673 $review.val($(this).index() + 1) 674 }) 675 676 //Replace placeholder input password & login 677 $('.login-username [name="log"]').attr('placeholder', thim_js_translate.login) 678 $('.login-password [name="pwd"]').attr('placeholder', thim_js_translate.password) 679 680 $(window).scroll(function (event) { 681 if (thim_scroll && thim_scroll === false) { 682 event.preventDefault() 683 } 684 }) 685 }) 686 687 $(document).on('click', '#course-review-load-more', function () { 688 var $button = $(this) 689 if (!$button.is(':visible')) return 690 $button.addClass('loading') 691 var paged = parseInt($(this).attr('data-paged')) + 1 692 $.ajax({ 693 type: 'POST', 694 dataType: 'html', 695 url: window.location.href, 696 data: { 697 action: 'learn_press_load_course_review', 698 paged: paged, 699 }, 700 success: function (response) { 701 var $content = $(response), 702 $new_review = $content.find('.course-reviews-list>li') 703 $('#course-reviews .course-reviews-list').append($new_review) 704 if ($content.find('#course-review-load-more').length) { 705 $button.removeClass('loading').attr('data-paged', paged) 706 } else { 707 $button.remove() 708 } 709 }, 710 }) 711 }) 712 713 $(document).on('click', '.single-lp_course .course-meta .course-review .value', 714 function () { 715 var review_tab = $('.course-tabs a[href="#tab-course-review"]') 716 if (review_tab.length > 0) { 717 review_tab.trigger('click') 718 $('body, html').animate({ 719 scrollTop: review_tab.offset().top - 50, 720 }, 800) 721 } 722 var review_tab_v3 = $('.course-tabs a[href="#tab-reviews"]') 723 if (review_tab_v3.length > 0) { 724 review_tab_v3.trigger('click') 725 $('body, html').animate({ 726 scrollTop: review_tab_v3.offset().top - 50, 727 }, 800) 728 } 729 }) 730 731 //Widget live search course 732 var search_timer = false 733 734 function thimlivesearch (contain) { 735 var input_search = contain.find('.courses-search-input'), 736 list_search = contain.find('.courses-list-search'), 737 keyword = input_search.val(), 738 loading = contain.find('.fa-search,.fa-times') 739 740 if (keyword) { 741 if (keyword.length < 1) { 742 return 743 } 744 loading.addClass('fa-spinner fa-spin') 745 $.ajax({ 746 type: 'POST', 747 data: 'action=courses_searching&keyword=' + keyword + '&from=search', 748 url: ajaxurl, 749 success: function (html) { 750 var data_li = '' 751 var items = jQuery.parseJSON(html) 752 if (!items.error) { 753 $.each(items, function (index) { 754 if (index == 0) { 755 if (this['guid'] != '#') { 756 data_li += '<li class="ui-menu-item' + 757 this['id'] + 758 ' ob-selected"><a class="ui-corner-all" href="' + 759 this['guid'] + '">' + this['title'] + 760 '</a></li>' 761 } else { 762 data_li += '<li class="ui-menu-item' + 763 this['id'] + ' ob-selected">' + 764 this['title'] + '</li>' 765 } 766 767 } else { 768 data_li += '<li class="ui-menu-item' + 769 this['id'] + 770 '"><a class="ui-corner-all" href="' + 771 this['guid'] + '">' + this['title'] + 772 '</a></li>' 773 } 774 }) 775 list_search.addClass('search-visible').html('').append(data_li) 776 } 777 thimsearchHover() 778 loading.removeClass('fa-spinner fa-spin') 779 }, 780 error: function (html) { 781 }, 782 }) 783 } 784 list_search.html('') 785 } 786 787 function thimsearchHover () { 788 $('.courses-list-search li').on('mouseenter', function () { 789 $('.courses-list-search li').removeClass('ob-selected') 790 $(this).addClass('ob-selected') 791 }) 792 } 793 794 $(document).ready(function () { 795 796 $(document).on('click', '.thim-course-search-overlay .search-toggle', 797 function (e) { 798 e.stopPropagation() 799 var parent = $(this).parent() 800 $('body').addClass('thim-search-active') 801 setTimeout(function () { 802 parent.find('.thim-s').focus() 803 }, 500) 804 805 }) 806 $(document).on('click', '.search-popup-bg', function () { 807 var parent = $(this).parent() 808 window.clearTimeout(search_timer) 809 parent.find('.courses-list-search').empty() 810 parent.find('.thim-s').val('') 811 $('body').removeClass('thim-search-active') 812 }) 813 814 $(document).on('keyup', '.courses-search-input', function (event) { 815 clearTimeout($.data(this, 'search_timer')) 816 var contain = $(this).parents('.courses-searching'), 817 list_search = contain.find('.courses-list-search'), 818 item_search = list_search.find('>li') 819 if (event.which == 13) { 820 event.preventDefault() 821 $(this).stop() 822 } else if (event.which == 38) { 823 if (navigator.userAgent.indexOf('Chrome') != -1 && parseFloat(
824 navigator.userAgent.substring(navigator.userAgent.indexOf( 825 'Chrome') + 7).split(' ')[0]) >= 15) { 826 var selected = item_search.filter('.ob-selected') 827 if (item_search.length > 1) { 828 item_search.removeClass('ob-selected') 829 // if there is no element before the selected one, we select the last one 830 if (selected.prev().length == 0) { 831 selected.siblings().last().addClass('ob-selected') 832 } else { // otherwise we just select the next one 833 selected.prev().addClass('ob-selected') 834 } 835 } 836 } 837 } else if (event.which == 40) { 838 if (navigator.userAgent.indexOf('Chrome') != -1 && parseFloat( 839 navigator.userAgent.substring(navigator.userAgent.indexOf( 840 'Chrome') + 7).split(' ')[0]) >= 15) { 841 var selected = item_search.filter('.ob-selected') 842 if (item_search.length > 1) { 843 item_search.removeClass('ob-selected') 844 845 // if there is no element before the selected one, we select the last one 846 if (selected.next().length == 0) { 847 selected.siblings().first().addClass('ob-selected') 848 } else { // otherwise we just select the next one 849 selected.next().addClass('ob-selected') 850 } 851 } 852 } 853 } else if (event.which == 27) { 854 if ($('body').hasClass('thim-search-active')) { 855 $('body').removeClass('thim-search-active') 856 } 857 list_search.html('') 858 $(this).val('') 859 $(this).stop() 860 } else { 861 var search_timer = setTimeout(function () { 862 thimlivesearch(contain) 863 }, 500) 864 $(this).data('search_timer', search_timer) 865 } 866 }) 867 $(document).on('keypress', '.courses-search-input', function (event) { 868 var item_search = $(this).parents('.courses-searching').find('.courses-list-search>li') 869 870 if (event.keyCode == 13) { 871 var selected = $('.ob-selected') 872 if (selected.length > 0) { 873 var ob_href = selected.find('a').first().attr('href') 874 window.location.href = ob_href 875 } 876 event.preventDefault() 877 } 878 if (event.keyCode == 27) { 879 if ($('body').hasClass('thim-search-active')) { 880 $('body').removeClass('thim-search-active') 881 } 882 $('.courses-list-search').html('') 883 $(this).val('') 884 $(this).stop() 885 } 886 if (event.keyCode == 38) { 887 var selected = item_search.filter('.ob-selected') 888 // if there is no element before the selected one, we select the last one 889 if (item_search.length > 1) { 890 item_search.removeClass('ob-selected') 891 if (selected.prev().length == 0) { 892 selected.siblings().last().addClass('ob-selected') 893 } else { // otherwise we just select the next one 894 selected.prev().addClass('ob-selected') 895 } 896 } 897 } 898 if (event.keyCode == 40) { 899 var selected = item_search.filter('.ob-selected') 900 if (item_search.length > 1) { 901 item_search.removeClass('ob-selected') 902 // if there is no element before the selected one, we select the last one 903 if (selected.next().length == 0) { 904 selected.siblings().first().addClass('ob-selected') 905 } else { // otherwise we just select the next one 906 selected.next().addClass('ob-selected') 907 } 908 } 909 } 910 }) 911 912 $(document).on('click', '.courses-list-search, .courses-search-input', 913 function (event) { 914 event.stopPropagation() 915 }) 916 917 $(document).on('click', 'body', function () { 918 if (!$('body').hasClass('course-scroll-remove')) { 919 $('body').addClass('course-scroll-remove') 920 $('.courses-list-search').html('') 921 } 922 }) 923 924 $(window).scroll(function () { 925 if ($('body').hasClass('course-scroll-remove') && 926 $('.courses-list-search li').length > 0) { 927 $('.courses-searching .courses-list-search').empty() 928 $('.courses-searching .thim-s').val('') 929 } 930 }) 931 932 $(document).on('focus', '.courses-search-input', function () { 933 if ($('body').hasClass('course-scroll-remove')) { 934 $('body').removeClass('course-scroll-remove') 935 } 936 }) 937 938 //Prevent search result 939 $(document).on('click', '#popup-header .search-visible', function (e) { 940 var href = $(e.target).attr('href') 941 if (!href) { 942 $('#popup-header .search-visible').removeClass('search-visible') 943 } 944 945 }) 946 947 $(document).on('click', '#popup-header button', function (e) { 948 $('#popup-header .thim-s').trigger('focus') 949 950 }) 951 952 $(document).on('focus', '#popup-header .thim-s', function () { 953 var link = $('#popup-header .courses-list-search a') 954 955 if ($(this).val() != '' && link.length > 0) { 956 $('#popup-header .courses-list-search').addClass('search-visible') 957 } 958 }) 959 960 //Widget icon box 961 $('.wrapper-box-icon').each(function () { 962 var $this = $(this) 963 if ($this.attr('data-icon')) { 964 var $color_icon = $('.boxes-icon i', $this).css('color') 965 var $color_title = $('.heading__primary a', $this).css('color') 966 var $color_icon_change = $this.attr('data-icon') 967 } 968 if ($this.attr('data-icon-border')) { 969 var $color_icon_border = $('.boxes-icon', $this).css('border-color') 970 var $color_icon_border_change = $this.attr('data-icon-border') 971 } 972 if ($this.attr('data-icon-bg')) { 973 var $color_bg = $('.boxes-icon', $this).css('background-color') 974 var $color_bg_change = $this.attr('data-icon-bg') 975 } 976 977 if ($this.attr('data-btn-bg')) { 978 var $color_btn_bg = $('.smicon-read', $this).css('background-color') 979 var $color_btn_border = $('.smicon-read', $this).css('border-color') 980 var $color_btn_bg_text_color = $('.smicon-read', $this).css('color') 981 982 var $color_btn_bg_change = $this.attr('data-btn-bg') 983 if ($this.attr('data-text-readmore')) { 984 var $color_btn_bg_text_color_change = $this.attr( 985 'data-text-readmore') 986 } else { 987 $color_btn_bg_text_color_change = $color_btn_bg_text_color 988 } 989 990 $('.smicon-read', $this).on({ 991 'mouseenter': function () { 992 if ($('#style_selector_container').length > 0) { 993 if ($('.smicon-read', $this).css('background-color') != $color_btn_bg) 994 $color_btn_bg = $('.smicon-read', $this).css('background-color') 995 } 996 $('.smicon-read', $this).css({ 997 'background-color': $color_btn_bg_change, 998 'border-color': $color_btn_bg_change, 999 'color': $color_btn_bg_text_color_change, 1000 }) 1001 }, 1002 'mouseleave': function () { 1003 $('.smicon-read', $this).css({ 1004 'background-color': $color_btn_bg, 1005 'border-color': $color_btn_border, 1006 'color': $color_btn_bg_text_color, 1007 }) 1008 }, 1009 }) 1010 1011 } 1012 1013 $($this).on({ 1014 'mouseenter': function () { 1015 if ($this.attr('data-icon')) { 1016 $('.boxes-icon i', $this).css({ 'color': $color_icon_change }) 1017 $('.heading__primary a', $this).css({ 'color': $color_icon_change }) 1018 } 1019 if ($this.attr('data-icon-bg')) { 1020 /* for select style*/ 1021 if ($('#style_selector_container').length > 0) { 1022 if ($('.boxes-icon', $this).css('background-color') != $color_bg) 1023 $color_bg = $('.boxes-icon', $this).css('background-color') 1024 } 1025 1026 $('.boxes-icon', $this).css({ 'background-color': $color_bg_change }) 1027 } 1028 if ($this.attr('data-icon-border')) { 1029 $('.boxes-icon', $this).css({ 'border-color': $color_icon_border_change }) 1030 } 1031 }, 1032 'mouseleave': function () { 1033 if ($this.attr('data-icon')) { 1034 $('.boxes-icon i', $this).css({ 'color': $color_icon }) 1035 $('.heading__primary a', $this).css({ 'color': $color_title }) 1036 } 1037 if ($this.attr('data-icon-bg')) { 1038 $('.boxes-icon', $this).css({ 'background-color': $color_bg }) 1039 } 1040 if ($this.attr('data-icon-border')) { 1041 $('.boxes-icon', $this).css({ 'border-color': $color_icon_border }) 1042 } 1043 }, 1044 }) 1045 1046 }) 1047 /* End Icon Box */ 1048
1049 //Background video 1050 $('.bg-video-play').on('click', function () { 1051 var elem = $(this), 1052 video = $(this).parents('.thim-widget-icon-box').find('.full-screen-video'), 1053 player = video.get(0) 1054 if (player.paused) { 1055 player.play() 1056 elem.addClass('bg-pause') 1057 } else { 1058 player.pause() 1059 elem.removeClass('bg-pause') 1060 } 1061 }) 1062 1063 //wpcf7-form-submit 1064 $(document).on('click', '.wpcf7-form-control.wpcf7-submit', function () { 1065 var elem = $(this), 1066 form = elem.parents('.wpcf7-form') 1067 form.addClass('thim-sending') 1068 $(document).on('invalid.wpcf7', function (event) { 1069 form.removeClass('thim-sending') 1070 }) 1071 $(document).on('spam.wpcf7', function (event) { 1072 form.removeClass('thim-sending') 1073 setTimeout(function () { 1074 if ($('.wpcf7-response-output').length > 0) { 1075 $('.wpcf7-response-output').hide() 1076 } 1077 }, 4000) 1078 }) 1079 $(document).on('mailsent.wpcf7', function (event) { 1080 form.removeClass('thim-sending') 1081 setTimeout(function () { 1082 if ($('.wpcf7-response-output').length > 0) { 1083 $('.wpcf7-response-output').hide() 1084 } 1085 }, 4000) 1086 1087 }) 1088 $(document).on('mailfailed.wpcf7', function (event) { 1089 form.removeClass('thim-sending') 1090 setTimeout(function () { 1091 if ($('.wpcf7-response-output').length > 0) { 1092 $('.wpcf7-response-output').hide() 1093 } 1094 }, 4000) 1095 }) 1096 }) 1097 }) 1098 1099 //Include plugin event file events.js 1100 jQuery(document).ready(function () { 1101 1102 // owl-carausel 1103 var carousels = $('.tp_event_owl_carousel') 1104 for (var i = 0; i < carousels.length; i++) { 1105 var data = $(carousels[i]).attr('data-countdown') 1106 var options = { 1107 navigation: true, // Show next and prev buttons 1108 slideSpeed: 300, 1109 paginationSpeed: 400, 1110 singleItem: true, 1111 } 1112 if (typeof data !== 'undefined') { 1113 data = JSON.parse(data) 1114 $.extend(options, data) 1115 1116 $.each(options, function (k, v) { 1117 if (v === 'true') { 1118 options[k] = true 1119 } else if (v === 'false') { 1120 options[k] = false 1121 } 1122 }) 1123 } 1124 1125 if (typeof options.slide === 'undefined' || options.slide === 1126 true) { 1127 $(carousels[i]).owlCarousel(options) 1128 } else { 1129 $(carousels[i]).removeClass('owl-carousel') 1130 } 1131 } 1132 }) 1133 1134 // Sticky sidebar 1135 jQuery(document).ready(function () { 1136 var offsetTop = 20 1137 if ($('#wpadminbar').length) { 1138 offsetTop += $('#wpadminbar').outerHeight() 1139 } 1140 if ($('#masthead.sticky-header').length) { 1141 offsetTop += $('#masthead.sticky-header').outerHeight() 1142 } 1143 jQuery('#sidebar.sticky-sidebar').theiaStickySidebar({ 1144 'containerSelector': '', 1145 'additionalMarginTop': offsetTop, 1146 'additionalMarginBottom': '0', 1147 'updateSidebarHeight': false, 1148 'minWidth': '768', 1149 'sidebarBehavior': 'modern', 1150 }) 1151 }) 1152 1153 // Prevent search when no content submited 1154 jQuery(document).ready(function () { 1155 $('.courses-searching form').submit(function () { 1156 var input_search = $(this).find('input[name=\'s\']') 1157 if ($.trim(input_search.val()) === '') { 1158 input_search.focus() 1159 return false 1160 } 1161 }) 1162 1163 $('form#bbp-search-form').submit(function () { 1164 if ($.trim($('#bbp_search').val()) === '') { 1165 $('#bbp_search').focus() 1166 return false 1167 } 1168 }) 1169 1170 $('form.search-form').submit(function () { 1171 var input_search = $(this).find('input[name=\'s\']') 1172 if ($.trim(input_search.val()) === '') { 1173 input_search.focus() 1174 return false 1175 } 1176 }) 1177 1178 //My account login 1179 $('#customer_login .login').submit(function (event) { 1180 var elem = $(this), 1181 input_username = elem.find('#username'), 1182 input_pass = elem.find('#password') 1183 1184 if (input_pass.length > 0 && input_pass.val() == '') { 1185 input_pass.addClass('invalid') 1186 event.preventDefault() 1187 } 1188 1189 if (input_username.length > 0 && input_username.val() == '') { 1190 input_username.addClass('invalid') 1191 event.preventDefault() 1192 } 1193 }) 1194 1195 //My account register 1196 $('#customer_login .register').submit(function (event) { 1197 var elem = $(this), 1198 input_username = elem.find('#reg_username'), 1199 input_email = elem.find('#reg_email'), 1200 input_pass = elem.find('#reg_password'), 1201 input_captcha = $('#customer_login .register .captcha-result'), 1202 valid_email = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm 1203 1204 if (input_captcha.length > 0) { 1205 var captcha_1 = parseInt(input_captcha.data('captcha1')), 1206 captcha_2 = parseInt(input_captcha.data('captcha2')) 1207 1208 if (captcha_1 + captcha_2 != parseInt(input_captcha.val())) { 1209 input_captcha.addClass('invalid').val('') 1210 event.preventDefault() 1211 } 1212 } 1213 1214 if (input_pass.length > 0 && input_pass.val() == '') { 1215 input_pass.addClass('invalid') 1216 event.preventDefault() 1217 } 1218 1219 if (input_username.length > 0 && input_username.val() == '') { 1220 input_username.addClass('invalid') 1221 event.preventDefault() 1222 } 1223 1224 if (input_email.length > 0 && (input_email.val() == '' || 1225 !valid_email.test(input_email.val()))) { 1226 input_email.addClass('invalid') 1227 event.preventDefault() 1228 } 1229 }) 1230 1231 //Validate comment form submit 1232 $('form#commentform').submit(function (event) { 1233 var elem = $(this), 1234 comment = elem.find('#comment[aria-required="true"]'), 1235 author = elem.find('#author[aria-required="true"]'), 1236 url = elem.find('#url[aria-required="true"]'), 1237 email = elem.find('#email[aria-required="true"]'), 1238 valid_email = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm 1239 1240 if (author.length > 0 && author.val() == '') { 1241 author.addClass('invalid') 1242 event.preventDefault() 1243 } 1244 1245 if (comment.length > 0 && comment.val() == '') { 1246 comment.addClass('invalid') 1247 event.preventDefault() 1248 } 1249 1250 if (url.length > 0 && url.val() == '') { 1251 url.addClass('invalid') 1252 event.preventDefault() 1253 } 1254 1255 if (email.length > 0 && 1256 (email.val() == '' || !valid_email.test(email.val()))) { 1257 email.addClass('invalid') 1258 event.preventDefault() 1259 } 1260 }) 1261 1262 $('#customer_login .register, #reg_username, #reg_email, #reg_password').on('focus', function () { 1263 $(this).removeClass('invalid') 1264 }) 1265 1266 $('input.wpcf7-text, textarea.wpcf7-textarea').on('focus', function () { 1267 if ($(this).hasClass('wpcf7-not-valid')) { 1268 $(this).removeClass('wpcf7-not-valid') 1269 } 1270 }) 1271 1272 $('.thim-language').on({ 1273 'mouseenter': function () { 1274 $(this).children('.list-lang').stop(true, false).fadeIn(250) 1275 }, 1276 'mouseleave': function () { 1277 $(this).children('.list-lang').stop(true, false).fadeOut(250) 1278 }, 1279 }) 1280 1281 $('#toolbar .menu li.menu-item-has-children').on({ 1282 'mouseenter': function () { 1283 $(this).children('.sub-menu').stop(true, false).fadeIn(250) 1284 }, 1285 'mouseleave': function () { 1286 $(this).children('.sub-menu').stop(true, false).fadeOut(250) 1287 }, 1288 }) 1289 1290 //Widget gallery-posts 1291 function gallery_layout () { 1292 var $container = jQuery('.isotope-layout') 1293 $container.each(function () { 1294 var $this = jQuery(this), $width, $col, $width_unit, 1295 $height_unit 1296 var $spacing = 10 1297 $col = 6 1298 if ($col != 1) { 1299 if (parseInt($container.width()) < 768) { 1300 $col = 4 1301 } 1302 if (parseInt($container.width()) < 480) { 1303 $col = 2 1304 } 1305 1306 } 1307 $width_unit = Math.floor((parseInt($container.width(), 10) - 1308 ($col - 1) * $spacing) / $col) 1309 $height_unit = Math.floor(parseInt($width_unit, 10)) 1310 1311 $this.find('.item_gallery').css({ 1312 width: $width_unit, 1313 }) 1314 if ($col == 1) { 1315 $height_unit = 'auto' 1316 } 1317 $this.find('.item_gallery .thim-gallery-popup').css({ 1318 height: $height_unit, 1319 }) 1320 if ($this.find('.item_gallery').hasClass('size32')) { 1321 if ($col > 1) { 1322 $this.find('.item_gallery.size32 .thim-gallery-popup').css({ 1323 height: $height_unit * 2 + $spacing, 1324 }) 1325 } 1326 } 1327 if ($this.find('.item_gallery').hasClass('size32')) { 1328 if ($col > 3) { 1329 $width = $width_unit * 4 + $spacing * 3 1330 $this.find('.item_gallery.size32').css({ 1331 width: $width, 1332 }) 1333 } else { 1334 $width = $width_unit * 2 + $spacing * 1 1335 $this.find('.item_gallery.size32').css({ 1336 width: $width, 1337 }) 1338 } 1339 } 1340 if ($this.find('.item_gallery').hasClass('size22') && $col != 1) { 1341 $this.find('.item_gallery.size22 .thim-gallery-popup').css({ 1342 height: $height_unit * 2 + $spacing, 1343 }) 1344 } 1345 if ($this.find('.item_gallery').hasClass('size22') && $col != 1) { 1346 $width = $width_unit * 2 + $spacing * 1 1347 $this.find('.item_gallery.size22').css({ 1348 width: $width, 1349 }) 1350 } 1351 if (jQuery().isotope) { 1352 $this.isotope({ 1353 itemSelector: '.item_gallery', 1354 masonry: { 1355 columnWidth: $width_unit, 1356 gutter: $spacing, 1357 }, 1358 }) 1359 } 1360 }) 1361 } 1362 1363 gallery_layout() 1364 $(window).resize(function () { 1365 gallery_layout() 1366 }) 1367
1368 $(document).on('click', '.filter-controls .filter', function (e) { 1369 e.preventDefault() 1370 var filter = $(this).data('filter'), 1371 filter_wraper = $(this).parents('.thim-widget-gallery-posts').find('.wrapper-gallery-filter') 1372 $('.filter-controls .filter').removeClass('active') 1373 $(this).addClass('active') 1374 filter_wraper.isotope({ filter: filter }) 1375 }) 1376 1377 $(document).on('click', '.thim-gallery-popup', function (e) { 1378 e.preventDefault() 1379 var elem = $(this), 1380 post_id = elem.attr('data-id'), 1381 data = { action: 'thim_gallery_popup', post_id: post_id } 1382 elem.addClass('loading') 1383 $.post(ajaxurl, data, function (response) { 1384 elem.removeClass('loading') 1385 $('.thim-gallery-show').append(response) 1386 if ($('.thim-gallery-show img').length > 0) { 1387 $('.thim-gallery-show').magnificPopup({ 1388 mainClass: 'my-mfp-zoom-in', 1389 type: 'image', 1390 delegate: 'a', 1391 showCloseBtn: false, 1392 gallery: { 1393 enabled: true, 1394 }, 1395 callbacks: { 1396 open: function () { 1397 $('body').addClass('thim-popup-active') 1398 $.magnificPopup.instance.close = function () { 1399 $('.thim-gallery-show').empty() 1400 $('body').removeClass('thim-popup-active') 1401 $.magnificPopup.proto.close.call(this) 1402 } 1403 }, 1404 }, 1405 }).magnificPopup('open') 1406 } else { 1407 $.magnificPopup.open({ 1408 mainClass: 'my-mfp-zoom-in', 1409 items: { 1410 src: $('.thim-gallery-show'), 1411 type: 'inline', 1412 }, 1413 showCloseBtn: false, 1414 callbacks: { 1415 open: function () { 1416 $('body').addClass('thim-popup-active') 1417 $.magnificPopup.instance.close = function () { 1418 $('.thim-gallery-show').empty() 1419 $('body').removeClass('thim-popup-active') 1420 $.magnificPopup.proto.close.call(this) 1421 } 1422 }, 1423 }, 1424 }) 1425 } 1426 1427 }) 1428 1429 }) 1430 1431 $('.widget-button.custom_style').each(function () { 1432 var elem = $(this), 1433 old_style = elem.attr('style'), 1434 hover_style = elem.data('hover') 1435 elem.on({ 1436 'mouseenter': function () { 1437 elem.attr('style', hover_style) 1438 }, 1439 'mouseleave': function () { 1440 elem.attr('style', old_style) 1441 }, 1442 }) 1443 }) 1444 1445 }) 1446 1447 $(window).on('load', function () { 1448 1449 $(window).resize(function () { 1450 thim_get_position_header_course_v2( 1451 $('.content_course_2 .header_single_content .bg_header')) 1452 $('.thim-carousel-instructors .instructor-item').css('min-height', '') 1453 // $('.thim-owl-carousel-post:not(.layout-3) .image'). 1454 // css('min-height', ''); 1455 // $('.thim-course-carousel .course-thumbnail').css('min-height', '') 1456 $('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info').css('min-height', '') 1457 if ($(window).width() < 767 || $(window).width() > 1200) { 1458 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', '') 1459 } 1460 thim_get_position_header_course_v2( 1461 $('.content_course_2 .header_single_content .bg_header')) 1462 // thim_min_height_carousel($('.thim-carousel-instructors .instructor-item')); 1463 thim_min_height_carousel($('.thim-owl-carousel-post:not(.layout-3) .image')) 1464 // thim_min_height_carousel($('.thim-course-carousel .course-thumbnail')) 1465 thim_min_height_carousel($('.thim-row-bg-border-top .thim-bg-border-top')) 1466 thim_min_height_carousel_old($('.thim-carousel-instructors .instructor-item')) 1467 thim_min_height_carousel_old($('.thim-testimonial-carousel-kindergarten .item')) 1468 1469 thim_min_height_carousel( 1470 $('.thim-widget-carousel-categories .item')) 1471 thim_min_height_carousel( 1472 $('.elementor-widget-thim-carousel-categories .item')) 1473 1474 thim_min_height_content_area() 1475 if ($(window).width() > 767) { 1476 thim_min_height_carousel( 1477 $('.thim-grid-posts .item-post')) 1478 thim_min_height_carousel( 1479 $('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info')) 1480 } 1481 1482 if ($(window).width() > 767 && $(window).width() < 1200) { 1483 if ($('body.thim-demo-university-4 .thim-icon-our-programs').length) { 1484 var min_height = parseInt($( 1485 'body.thim-demo-university-4 .thim-icon-our-programs').outerHeight() / 3) 1486 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', min_height) 1487 } 1488 1489 } 1490 }) 1491 }) 1492 1493 function thim_get_position_header_course_v2 ($selector) { 1494 if ($(window).width() > 1025) { 1495 $selector.css('left', '-' + 1496 ($(window).width() - $('.container').width()) / 2 + 'px') 1497 $selector.css('right', '-' + 1498 (($(window).width() - $('.container').width()) / 2 + 1499 (45 + $('.content_course_2 .course_right').width())) + 1500 'px') 1501 } else { 1502 $selector.css('left', '-15px') 1503 $selector.css('right', '-' + 1504 (45 + $('.content_course_2 .course_right').width()) + 'px') 1505 } 1506 1507 } 1508 1509 $(window).on('load', function () { 1510 thim_min_height_carousel('.thim-carousel-instructors', '.instructor-item') 1511 thim_min_height_carousel('.thim-owl-carousel-post', '.image') 1512 // thim_min_height_carousel('.thim-course-carousel', '.course-thumbnail') 1513 1514 thim_min_height_content_area() 1515 }) 1516 1517 function thim_min_height_carousel_old ($selector) { 1518 var min_height = 0 1519 $selector.each(function (index, val) { 1520 if ($(this).outerHeight() > min_height) { 1521 min_height = $(this).outerHeight() 1522 } 1523 if (index + 1 == $selector.length) { 1524 $selector.css('min-height', min_height) 1525 } 1526 }) 1527 } 1528 1529 function thim_min_height_carousel (el, child) { 1530 var $elements = $(el) 1531 1532 $elements.each(function () { 1533 var $element = $(this), 1534 $child = child ? $element.find(child) : $element.children(), 1535 maxHeight = 0 1536 1537 $child.each(function () { 1538 var thisHeight = $(this).outerHeight() 1539 if (thisHeight > maxHeight) { 1540 maxHeight = thisHeight 1541 } 1542 }).css('min-height', maxHeight) 1543 }) 1544 } 1545 1546 function thim_min_height_content_area () { 1547 var content_area = $('#main-content .content-area'), 1548 footer = $('#main-content .site-footer'), 1549 winH = $(window).height() 1550 if (content_area.length > 0 && footer.length > 0) { 1551 content_area.css('min-height', winH - footer.height()) 1552 } 1553 } 1554 1555 $(document).ready(function () { 1556 $('.thim-search-light-style').append('<a class="thim-button-down thim-click-to-bottom" href="#"><i class="fa fa-chevron-down"></i></a>') 1557 $(document).on('click', '.thim-button-down', function (e) { 1558 e.preventDefault() 1559 if ($('#wpadminbar').length > 0) { 1560 var height = parseInt($('#wpadminbar').outerHeight()) + 1561 parseInt($('.thim-search-light-style').outerHeight()) 1562 } else { 1563 var height = parseInt($('.thim-search-light-style').outerHeight()) 1564 } 1565 $('body, html').animate({
1566 'scrollTop': height, 1567 }, 600) 1568 }) 1569 1570 var html_scroll = '<div class="scroll_slider_tab"><div class="container">' + 1571 '<a href="" class="to_bottom">' + 1572 '<svg xmlns="http://www.w3.org/2000/svg"' + 1573 'xmlns:xlink="http://www.w3.org/1999/xlink"' + 1574 'width="18px" height="28px">' + 1575 '<path fill-rule="evenodd" fill="rgb(255, 255, 255)"' + 1576 '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"/>' + 1577 '</svg>' + 1578 '<i class="icon-chevron-down icon1"></i>' + 1579 '<i class="icon-chevron-down icon2"></i>' + 1580 '</a>' + 1581 '</div></div>' 1582 $('.have_scroll_bottom').append(html_scroll) 1583 $(document).on('click', '.have_scroll_bottom .scroll_slider_tab .to_bottom', 1584 function (e) { 1585 e.preventDefault() 1586 if ($('#wpadminbar').length > 0) { 1587 var height = parseInt($('#wpadminbar').outerHeight()) + 1588 parseInt($('.have_scroll_bottom').outerHeight()) 1589 } else { 1590 var height = parseInt( 1591 $('.have_scroll_bottom').outerHeight()) 1592 } 1593 $('body, html').animate({ 1594 'scrollTop': height, 1595 }, 600) 1596 }) 1597 1598 $(document).on('click', 'body.page-template-landing-page .current_page_item>a, .thim-top-landing .widget-button', 1599 function (e) { 1600 if ($('.thim-top-landing').length > 0) { 1601 e.preventDefault() 1602 if ($('#wpadminbar').length > 0) { 1603 var height = parseInt( 1604 $('#wpadminbar').outerHeight()) + 1605 parseInt($('.thim-top-landing').outerHeight()) 1606 } else { 1607 var height = parseInt( 1608 $('.thim-top-landing').outerHeight()) 1609 } 1610 $('body, html').animate({ 1611 'scrollTop': height, 1612 }, 600) 1613 } 1614 }) 1615 1616 }) 1617 $(document).ready(function () { 1618 //Shop filter color 1619 $('.woof_list input[data-tax="pa_color"]').each(function () { 1620 $(this).css('background-color', $(this).attr('name')) 1621 }) 1622 $('.woof_list input.woof_radio_term[name="pa_color"]').each(function () { 1623 $(this).css('background-color', $(this).data('slug')) 1624 }) 1625 }) 1626 1627 woof_js_after_ajax_done = function () { 1628 $('.woof_list input[data-tax="pa_color"]').each(function () { 1629 $(this).css('background-color', $(this).attr('name')) 1630 }) 1631 $('.woof_list input.woof_radio_term[name="pa_color"]').each(function () { 1632 $(this).css('background-color', $(this).data('slug')) 1633 }) 1634 1635 if ($('#thim-product-archive').hasClass('thim-product-list')) { 1636 $('.thim-product-switch-layout>a.switchToGrid.switch-active').removeClass('switch-active') 1637 $('.thim-product-switch-layout>a.switchToList').addClass('switch-active') 1638 } else { 1639 $('.thim-product-switch-layout>a.switchToList.switch-active').removeClass('switch-active') 1640 $('.thim-product-switch-layout>a.switchToGrid').addClass('switch-active') 1641 } 1642 1643 } 1644 1645 //Code for timetable widget 1646 // TODO when using many Thim Course Categories widgets 1647 $(document).ready(function () { 1648 1649 var tab_cat_course = $('.thim-carousel-course-categories-tabs') 1650 tab_cat_course.each(function () { 1651 tab_cat_course.find('.thim-course-slider .item').click(function (e) { 1652 e.preventDefault() 1653 tab_cat_course.find('.item_content.active').removeClass('active') 1654 tab_cat_course.find($(this).find('.title a').attr('href')).addClass('active') 1655 tab_cat_course.find('.thim-course-slider .item.active').removeClass('active') 1656 $(this).addClass('active') 1657 }) 1658 }) 1659 1660 var item_input_new = $( 1661 '.form_developer_course .content .yikes-easy-mc-form>label>input') 1662 item_input_new.focusin(function () { 1663 $(this).parent().find('span').css('font-size', '14px') 1664 $(this).parent().find('span').css('bottom', '36px') 1665 }).focusout(function () { 1666 if ($(this).val() == '') { 1667 $(this).parent().find('span').css('font-size', '0px') 1668 $(this).parent().find('span').css('bottom', '0px') 1669 } 1670 }) 1671 1672 //Add class for nav-tabs single course 1673 var tab_course = $('.course-tabs .nav-tabs>li').length 1674 if (tab_course > 0) { 1675 $('.course-tabs .nav-tabs>li').addClass('thim-col-' + tab_course) 1676 } 1677
1678 $('.thim-widget-timetable .timetable-item ').each(function () { 1679 var elem = $(this), 1680 old_style = elem.attr('style'), 1681 hover_style = elem.data('hover') 1682 elem.on({ 1683 'mouseenter': function () { 1684 elem.attr('style', hover_style) 1685 }, 1686 'mouseleave': function () { 1687 elem.attr('style', old_style) 1688 }, 1689 }) 1690 }) 1691 1692 if (typeof LP != 'undefined') { 1693 LP.Hook.addAction('learn_press_receive_message', function () { 1694 var lesson_title = $( 1695 '.course-item.item-current .course-item-title').text(), 1696 lesson_index = $('.course-item.item-current .index').text() 1697 $('#popup-header .popup-title').html('<span class="index">' + lesson_index + '</span>' + 1698 lesson_title) 1699 }) 1700 } 1701 1702 $('.thim-video-popup .button-popup').on('click', function (e) { 1703 var item = $(this) 1704 e.preventDefault() 1705 $.magnificPopup.open({ 1706 items: { 1707 src: item.parent().parent().find('.video-content'), 1708 type: 'inline', 1709 }, 1710 showCloseBtn: false, 1711 callbacks: { 1712 open: function () { 1713 $('body').addClass('thim-popup-active') 1714 $.magnificPopup.instance.close = function () { 1715 $('body').removeClass('thim-popup-active') 1716 $.magnificPopup.proto.close.call(this) 1717 } 1718 }, 1719 }, 1720 }) 1721 }) 1722 1723 $('.mc4wp-form #mc4wp_email').on('focus', function () { 1724 $(this).parents('.mc4wp-form').addClass('focus-input') 1725 }).on('focusout', function () { 1726 $(this).parents('.mc4wp-form.focus-input').removeClass('focus-input') 1727 }) 1728 1729 $(document).on('click', '.button-retake-course, .button-finish-course', function () { 1730 $('.thim-box-loading-container.visible').removeClass('visible') 1731 }) 1732 1733 $(document).on('click', '.button-load-item', function () { 1734 $('#course-curriculum-popup').addClass('loading') 1735 $('.thim-box-loading-container').addClass('visible') 1736 }) 1737 1738 //Thim simple slider 1739 // $('.thim-event-simple-slider').thim_simple_slider({ 1740 // item : 3, 1741 // itemActive : 1, 1742 // itemSelector: '.item-event', 1743 // align : 'right', 1744 // pagination : true, 1745 // navigation : true, 1746 // height : 392, 1747 // activeWidth : 1170, 1748 // itemWidth : 800, 1749 // prev_text : '<i class="fa fa-long-arrow-left"></i>', 1750 // next_text : '<i class="fa fa-long-arrow-right"></i>', 1751 // }); 1752 1753 $('.width-navigation .menu-main-menu>li.menu-item').last().addClass('last-menu-item') 1754 1755 //add mac-os to body class 1756 if (navigator.userAgent.indexOf('Mac') > 0) { 1757 $('body').addClass('mac-os') 1758 } 1759 //add i-os to body class 1760 if (navigator.platform.match(/(iPhone|iPod|iPad)/i)) { 1761 $('body').addClass('i-os') 1762 } 1763 1764 //Set padding for demo vc RTL 1765 setTimeout(function () { 1766 $(window).trigger('resize') 1767 }, 1000) 1768 $(window).resize(function () { 1769 var get_padding1 = parseFloat( 1770 $('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css('left')), 1771 get_padding2 = parseFloat( 1772 $('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css('left')) 1773 if (get_padding1 != 'undefined') { 1774 $('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css({ 'right': get_padding1, 'left': '' }) 1775 } 1776 if (get_padding2 != 'undefined') { 1777 $('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css({ 'right': get_padding2, 'left': '' }) 1778 } 1779 }) 1780 1781 //Course archive search filter 1782 var search_time_out = null 1783 $(document).on('keydown', 'body:not(.course-filter-active) .course-search-filter', 1784 function (event) { 1785 if (event.ctrlKey) { 1786 return 1787 } 1788 1789 if (event.keyCode === 13) { 1790 event.preventDefault() 1791 return false 1792 } 1793 1794 if ((event.keyCode >= 48 && event.keyCode <= 90) || event.keyCode === 8 || event.keyCode === 32) { 1795 var elem = $(this), 1796 keyword = event.keyCode === 8 ? elem.val() : elem.val() + event.key, 1797 $body = $('body') 1798 1799 if (search_time_out != null) clearTimeout(search_time_out) 1800 1801 search_time_out = setTimeout(function () { 1802 elem.attr('disabled', 'disabled') 1803 search_time_out = null 1804 1805 $('#thim-course-archive').addClass('loading') 1806 1807 var archive = elem.parents('#lp-archive-courses'), 1808 cateArr = [] 1809 1810 if ($body.hasClass('category')) { 1811 var bodyClass = $body.attr('class'), 1812 cateClass = bodyClass.match(/category\-\d+/gi)[0], 1813 cateID = cateClass.split('-').pop() 1814 1815 cateArr.push(cateID) 1816 } 1817 1818 if ($('.list-cate-filter').length > 0) { 1819 $('.list-cate-filter input.filtered').each(function () { 1820 1821 if ($(this).val() !== cateID) { 1822 cateArr.push($(this).val()) 1823 } 1824 }) 1825 } 1826 1827 $.ajax({ 1828 url: $('#lp-archive-courses').data('allCoursesUrl'), 1829 type: 'POST', 1830 dataType: 'html', 1831 data: { 1832 s: keyword, 1833 ref: 'course', 1834 post_type: 'lp_course', 1835 course_orderby: $('.thim-course-order > select').val(), 1836 course_cate_filter: cateArr, 1837 course_paged: 1, 1838 }, 1839 success: function (html) { 1840 var archive_html = $(html).find('#lp-archive-courses').html() 1841 archive.html(archive_html) 1842 $('.course-search-filter').val(keyword).trigger('focus') 1843 $body.removeClass('course-filter-active') 1844 $('.filter-loading').remove() 1845 }, 1846 error: function () { 1847 $body.removeClass('course-filter-active') 1848 $('.filter-loading').remove() 1849 }, 1850 }) 1851 1852 }, 1000) 1853 } 1854 }) 1855 1856 $(document).on('click', '.button-load-item', function () { 1857 can_escape = false 1858 }) 1859 1860 $(document).on('keydown', function (event) { 1861 if (event.keyCode == 27) { 1862 if (typeof can_escape !== 'undefined') { 1863 if (can_escape === false) { 1864 event.preventDefault() 1865 } 1866 } 1867 } 1868 1869 }) 1870 1871 //Add view password into checkbox field 1872 $('.login-password').append('<span id="show_pass"><i class="fa fa-eye"></i></span>') 1873 $(document).on('click', '#show_pass', function () { 1874 var el = $(this), 1875 thim_pass = el.parents('.login-password').find('>input') 1876 if (el.hasClass('active')) { 1877 thim_pass.attr('type', 'password') 1878 } else { 1879 thim_pass.attr('type', 'text') 1880 } 1881 el.toggleClass('active') 1882 }) 1883 1884 $(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', 1885 function () { 1886 $('html, body').animate({ 1887 scrollTop: $($(this).attr('href')).offset().top, 1888 }, 1000) 1889 }) 1890 1891 $(window).resize(function () { 1892 if ($(window).width() > 600) { 1893 $('footer#colophon.has-footer-bottom').css('margin-bottom', $('.footer-bottom').height()) 1894 } 1895 if ($(window).width() < 768) { 1896 $('body.course-item-popup').addClass('full-screen-content-item') 1897 $('body.ltr.course-item-popup #learn-press-course-curriculum').css('left', '-300px') 1898 $('body.ltr.course-item-popup #learn-press-content-item').css('left', '0') 1899 $('body.rtl.course-item-popup #learn-press-course-curriculum').css('right', 'auto') 1900 $('body.rtl.course-item-popup #learn-press-content-item').css('right', 'auto') 1901 } 1902 }) 1903 1904 }) 1905 1906})(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.