1var thim_scroll = true; 2var woof_js_after_ajax_done; 3var can_escape = true; 4//if (typeof LearnPress == 'undefined') { 5// LearnPress = {}; 6//} 7(function ($) { 8 "use strict"; 9 if (typeof LearnPress != 'undefined') { 10 if (typeof LearnPress.load_lesson == 'undefined') { 11 LearnPress.load_lesson = function (a, b) { 12 LearnPress.$Course && LearnPress.$Course.loadLesson(a, b); 13 } 14 } 15 } 16 17 $.avia_utilities = $.avia_utilities || {}; 18 $.avia_utilities.supported = {}; 19 $.avia_utilities.supports = (function () { 20 var div = document.createElement('div'), 21 vendors = ['Khtml', 'Ms', 'Moz', 'Webkit', 'O']; 22 return function (prop, vendor_overwrite) { 23 if (div.style.prop !== undefined) { 24 return ""; 25 } 26 if (vendor_overwrite !== undefined) { 27 vendors = vendor_overwrite; 28 } 29 prop = prop.replace(/^[a-z]/, function (val) { 30 return val.toUpperCase(); 31 }); 32 33 var len = vendors.length; 34 while (len--) { 35 if (div.style[vendors[len] + prop] !== undefined) { 36 return "-" + vendors[len].toLowerCase() + "-"; 37 } 38 } 39 return false; 40 }; 41 }()); 42 43 /* Smartresize */ 44 (function ($, sr) { 45 var debounce = function (func, threshold, execAsap) { 46 var timeout; 47 return function debounced() { 48 var obj = this, args = arguments; 49 50 function delayed() { 51 if (!execAsap) 52 func.apply(obj, args); 53 timeout = null; 54 } 55 56 if (timeout) 57 clearTimeout(timeout); 58 else if (execAsap) 59 func.apply(obj, args); 60 timeout = setTimeout(delayed, threshold || 100); 61 }; 62 }; 63 // smartresize 64 jQuery.fn[sr] = function (fn) { 65 return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); 66 }; 67 })(jQuery, 'smartresize'); 68 69 //Back To top 70 var back_to_top = function () { 71 jQuery(window).scroll(function () { 72 if (jQuery(this).scrollTop() > 400) { 73 jQuery('#back-to-top').addClass('active'); 74 } else { 75 jQuery('#back-to-top').removeClass('active'); 76 } 77 }); 78 jQuery('#back-to-top').on('click', function () { 79 jQuery('html, body').animate({scrollTop: '0px'}, 800); 80 return false; 81 }); 82 }; 83 84 //// stick header 85 $(document).ready(function () { 86 var $header = $('#masthead.header_default'); 87 var $content_pusher = $('#wrapper-container .content-pusher'); 88 $header.imagesLoaded(function () { 89 var height_sticky_header = $header.outerHeight(true); 90 $content_pusher.css({"padding-top": height_sticky_header + 'px'}); 91 $(window).resize(function () { 92 var height_sticky_header = $header.outerHeight(true); 93 $content_pusher.css({"padding-top": height_sticky_header + 'px'}); 94 }); 95 }); 96 }); 97 98 var thim_TopHeader = function () { 99 var header = $('#masthead'), 100 height_sticky_header = header.outerHeight(true), 101 content_pusher = $('#wrapper-container .content-pusher'), 102 top_site_main = $('#wrapper-container .top_site_main'); 103 104 //header_overlay 105 if (header.hasClass('header_overlay')) { 106 //header overlay 107 header.imagesLoaded(function () { 108 top_site_main.css({"padding-top": height_sticky_header + 'px'}); 109 $(window).resize(function () { 110 var height_sticky_header = header.outerHeight(true); 111 top_site_main.css({"padding-top": height_sticky_header + 'px'}); 112 }); 113 }); 114 } else { 115 //Header default 116 header.imagesLoaded(function () { 117 content_pusher.css({"padding-top": height_sticky_header + 'px'}); 118 $(window).resize(function () { 119 var height_sticky_header = header.outerHeight(true); 120 content_pusher.css({"padding-top": height_sticky_header + 'px'}); 121 }); 122 }); 123 } 124 }; 125 126 var thim_SwitchLayout = function () { 127 var cookie_name = 'course_switch', 128 archive = $('#thim-course-archive'); 129 if (archive.length > 0) { 130 131 var data_cookie = archive.data('cookie') ? archive.data('cookie') : 'grid-layout'; 132 133 //Check grid-layout 134 if (( !jQuery.cookie(cookie_name) && data_cookie != 'list-layout' ) || jQuery.cookie(cookie_name) == 'grid-layout') { 135 if (archive.hasClass('thim-course-list')) { 136 archive.removeClass('thim-course-list').addClass('thim-course-grid'); 137 } 138 $('.thim-course-switch-layout > a.switchToGrid').addClass('switch-active'); 139 } else { 140 if (archive.hasClass('thim-course-grid')) { 141 archive.removeClass('thim-course-grid').addClass('thim-course-list'); 142 } 143 $('.thim-course-switch-layout > a.switchToList').addClass('switch-active'); 144 } 145 146 $(document).on('click', '.thim-course-switch-layout > a', function (event) { 147 var elem = $(this), 148 archive = $('#thim-course-archive'); 149 event.preventDefault(); 150 if (!elem.hasClass('switch-active')) { 151 $('.thim-course-switch-layout > a').removeClass('switch-active'); 152 elem.addClass('switch-active'); 153 if (elem.hasClass('switchToGrid')) { 154 archive.fadeOut(300, function () { 155 archive.removeClass('thim-course-list').addClass(' thim-course-grid').fadeIn(300); 156 jQuery.cookie(cookie_name, 'grid-layout', {expires: 3, path: '/'}); 157 });
158 } else { 159 archive.fadeOut(300, function () { 160 archive.removeClass('thim-course-grid').addClass('thim-course-list').fadeIn(300); 161 jQuery.cookie(cookie_name, 'list-layout', {expires: 3, path: '/'}); 162 }); 163 } 164 } 165 }); 166 } 167 168 }; 169 170 /** 171 * Product single slider 172 */ 173 var thim_product_slider = function () { 174 /* 175 $('div.product .product-info .image-panel #carousel').flexslider({ 176 animation : "slide", 177 direction : "vertical", 178 controlNav : false, 179 animationLoop: false, 180 slideshow : false, 181 itemWidth : 101, 182 itemMargin : 5, 183 maxItems : 4, 184 directionNav : false, 185 asNavFor : '#slider' 186 }); 187 188 $('div.product .product-info .image-panel #slider').flexslider({ 189 animation : "slide", 190 controlNav : false, 191 animationLoop: false, 192 directionNav : false, 193 slideshow : false, 194 sync : "#carousel" 195 }); 196 */ 197 }; 198 199 var thim_Shop_SwitchLayout = function () { 200 var cookie_name = 'product_list', 201 archive = $('#thim-product-archive'); 202 if (archive.length > 0) { 203 //Check grid-layout 204 if (!jQuery.cookie(cookie_name) || jQuery.cookie(cookie_name) == 'grid-layout') { 205 if (archive.hasClass('thim-product-list')) { 206 archive.removeClass('thim-product-list').addClass('thim-product-grid'); 207 } 208 $('.thim-product-switch-layout > a.switch-active').removeClass('switch-active'); 209 $('.thim-product-switch-layout > a.switchToGrid').addClass('switch-active'); 210 } else { 211 if (archive.hasClass('thim-product-grid')) { 212 archive.removeClass('thim-product-grid').addClass('thim-product-list'); 213 } 214 $('.thim-product-switch-layout > a.switch-active').removeClass('switch-active'); 215 $('.thim-product-switch-layout > a.switchToList').addClass('switch-active'); 216 } 217 218 $(document).on('click', '.thim-product-switch-layout > a', function (event) { 219 var elem = $(this), 220 archive = $('#thim-product-archive'); 221 222 event.preventDefault(); 223 if (!elem.hasClass('switch-active')) { 224 $('.thim-product-switch-layout > a').removeClass('switch-active'); 225 elem.addClass('switch-active'); 226 if (elem.hasClass('switchToGrid')) { 227 archive.fadeOut(300, function () { 228 archive.removeClass('thim-product-list').addClass(' thim-product-grid').fadeIn(300); 229 jQuery.cookie(cookie_name, 'grid-layout', {expires: 3, path: '/'}); 230 }); 231 } else { 232 archive.fadeOut(300, function () { 233 archive.removeClass('thim-product-grid').addClass('thim-product-list').fadeIn(300); 234 jQuery.cookie(cookie_name, 'list-layout', {expires: 3, path: '/'}); 235 }); 236 } 237 } 238 }); 239 } 240 241 }; 242 243 var thim_Blog_SwitchLayout = function () { 244 var cookie_name = 'blog_layout', 245 archive = $('#blog-archive'), 246 switch_layout = archive.find('.switch-layout'); 247 if (archive.length > 0) { 248 //Check grid-layout 249 if (!jQuery.cookie(cookie_name) || jQuery.cookie(cookie_name) == 'grid-layout') { 250 if (archive.hasClass('blog-list')) { 251 archive.removeClass('blog-list').addClass('blog-grid'); 252 } 253 switch_layout.find('> a.switch-active').removeClass('switch-active'); 254 switch_layout.find('> a.switchToGrid').addClass('switch-active'); 255 } else { 256 if (archive.hasClass('blog-grid')) { 257 archive.removeClass('blog-grid').addClass('blog-list'); 258 } 259 switch_layout.find('> a.switch-active').removeClass('switch-active'); 260 switch_layout.find('> a.switchToList').addClass('switch-active'); 261 } 262 263 $(document).on('click', '#blog-archive .switch-layout > a', function (event) { 264 var elem = $(this), 265 archive = $('#blog-archive'); 266 267 event.preventDefault(); 268 if (!elem.hasClass('switch-active')) { 269 switch_layout.find('>a').removeClass('switch-active'); 270 elem.addClass('switch-active'); 271 if (elem.hasClass('switchToGrid')) { 272 archive.fadeOut(300, function () { 273 archive.removeClass('blog-list').addClass('blog-grid').fadeIn(300); 274 jQuery.cookie(cookie_name, 'grid-layout', {expires: 3, path: '/'}); 275 });
276 } else { 277 archive.fadeOut(300, function () { 278 archive.removeClass('blog-grid').addClass('blog-list').fadeIn(300); 279 jQuery.cookie(cookie_name, 'list-layout', {expires: 3, path: '/'}); 280 }); 281 } 282 } 283 }); 284 } 285 286 }; 287 288 var thim_Menu = function () { 289 //Add class for masthead 290 var $header = $('#masthead.sticky-header'), 291 off_Top = ( $('.content-pusher').length > 0 ) ? $('.content-pusher').offset().top : 0, 292 menuH = $header.outerHeight(), 293 latestScroll = 0; 294 if ($(window).scrollTop() > 2) { 295 $header.removeClass('affix-top').addClass('affix'); 296 } 297 $(window).scroll(function () { 298 var current = $(this).scrollTop(); 299 if (current > 2) { 300 $header.removeClass('affix-top').addClass('affix'); 301 } else { 302 $header.removeClass('affix').addClass('affix-top'); 303 } 304 305 if (current > latestScroll && current > menuH + off_Top) { 306 if (!$header.hasClass('menu-hidden')) { 307 $header.addClass('menu-hidden'); 308 } 309 } else { 310 if ($header.hasClass('menu-hidden')) { 311 $header.removeClass('menu-hidden'); 312 } 313 } 314 315 latestScroll = current; 316 }); 317 318 //Show submenu when hover 319 $('.wrapper-container:not(.mobile-menu-open) .site-header .navbar-nav >li,.wrapper-container:not(.mobile-menu-open) .site-header .navbar-nav li,.site-header .navbar-nav li ul li').on({ 320 'mouseenter': function () { 321 $(this).children('.sub-menu').stop(true, false).fadeIn(250); 322 }, 323 'mouseleave': function () { 324 $(this).children('.sub-menu').stop(true, false).fadeOut(250); 325 } 326 }); 327 328 if ($(window).width() > 768) { 329 //Magic Line 330 var menu_active = $('#masthead .navbar-nav>li.menu-item.current-menu-item,#masthead .navbar-nav>li.menu-item.current-menu-parent, #masthead .navbar-nav>li.menu-item.current-menu-ancestor'); 331 if (menu_active.length > 0) { 332 menu_active.before('<span id="magic-line"></span>'); 333 var menu_active_child = menu_active.find('>a,>span.disable_link,>span.tc-menu-inner'), 334 menu_left = menu_active.position().left, 335 menu_child_left = parseInt(menu_active_child.css('padding-left')), 336 magic = $('#magic-line'); 337 magic.width(menu_active_child.width()).css("left", Math.round(menu_child_left + menu_left)).data('magic-width', magic.width()).data('magic-left', magic.position().left); 338 } else { 339 var first_menu = $('#masthead .navbar-nav>li.menu-item:first-child'); 340 first_menu.before('<span id="magic-line"></span>'); 341 var magic = $('#magic-line'); 342 magic.data('magic-width', 0); 343 } 344 345 var nav_H = parseInt($('.site-header .navigation').outerHeight()); 346 magic.css('bottom', nav_H - (nav_H - 90) / 2 - 64); 347 348 $('#masthead .navbar-nav>li.menu-item').on({ 349 'mouseenter': function () { 350 var elem = $(this).find('>a,>span.disable_link,>span.tc-menu-inner'), 351 new_width = elem.width(), 352 parent_left = elem.parent().position().left, 353 left = parseInt(elem.css('padding-left')); 354 if (!magic.data('magic-left')) { 355 magic.css('left', Math.round(parent_left + left)); 356 magic.data('magic-left', 'auto'); 357 } 358 magic.stop().animate({ 359 left : Math.round(parent_left + left), 360 width: new_width 361 }); 362 }, 363 'mouseleave': function () { 364 magic.stop().animate({ 365 left : magic.data('magic-left'), 366 width: magic.data('magic-width') 367 }); 368 } 369 }); 370 371 } 372 373 //Update position for sub-menu 374 $('.header_v1 .menu-item.widget_area:not(.dropdown_full_width),.header_v1 .menu-item.multicolumn:not(.dropdown_full_width),.header_v1 .navbar-nav>li.tc-menu-layout-column,.header_v1 .navbar-nav>li.tc-menu-layout-builder').each(function () { 375 var elem = $(this), 376 elem_Left = elem.offset().left, 377 sub_menu = elem.find('>.sub-menu'); 378 if (sub_menu.length > 0) { 379 var left = ( elem.width() - sub_menu.width() ) / 2; 380 if (Math.abs(left) > elem_Left) { 381 sub_menu.css('left', elem_Left * Math.abs(left) / left); 382 } else { 383 sub_menu.css('left', left); 384 } 385 } 386 }); 387 388 }; 389 390 /* ****** jp-jplayer ******/ 391 var thim_post_audio = function () { 392 $('.jp-jplayer').each(function () { 393 var $this = $(this), 394 url = $this.data('audio'), 395 type = url.substr(url.lastIndexOf('.') + 1), 396 player = '#' + $this.data('player'), 397 audio = {}; 398 audio[type] = url; 399 $this.jPlayer({ 400 ready : function () { 401 $this.jPlayer('setMedia', audio); 402 }, 403 swfPath : 'jplayer/', 404 cssSelectorAncestor: player 405 }); 406 }); 407 }; 408 409 var thim_post_gallery = function () { 410 $('article.format-gallery .flexslider').imagesLoaded(function () { 411 $('.flexslider').flexslider({ 412 slideshow : true, 413 animation : 'fade', 414 pauseOnHover : true, 415 animationSpeed: 400, 416 smoothHeight : true, 417 directionNav : true, 418 controlNav : false 419 }); 420 }); 421 }; 422 423 /* ****** PRODUCT QUICK VIEW ******/ 424 var thim_quick_view = function () { 425 $(document).on('click', '.quick-view', function (e) { 426 /* add loader */ 427 $('.quick-view a').css('display', 'none'); 428 $(this).append('<a href="javascript:;" class="loading dark"></a>'); 429 var product_id = $(this).attr('data-prod'); 430 var data = {action: 'jck_quickview', product: product_id}; 431 $.post(ajaxurl, data, function (response) { 432 $.magnificPopup.open({ 433 mainClass: 'my-mfp-zoom-in', 434 items : { 435 src : response, 436 type: 'inline' 437 }, 438 callbacks: { 439 open: function () { 440 $('body').addClass('thim-popup-active'); 441 $.magnificPopup.instance.close = function () { 442 $('body').removeClass('thim-popup-active'); 443 $.magnificPopup.proto.close.call(this); 444 }; 445 }, 446 } 447 }); 448 $('.quick-view a').css('display', 'inline-block'); 449 $('.loading').remove(); 450 $('.product-card .wrapper').removeClass('animate'); 451 setTimeout(function () { 452 if (typeof wc_add_to_cart_variation_params !== 'undefined') { 453 $('.product-info .variations_form').each(function () { 454 $(this).wc_variation_form().find('.variations select:eq(0)').change(); 455 });
456 } 457 }, 600); 458 }); 459 e.preventDefault(); 460 }); 461 }; 462 463 var thim_miniCartHover = function () { 464 jQuery(document).on('mouseenter', '.site-header .minicart_hover', function () { 465 jQuery(this).next('.widget_shopping_cart_content').slideDown(); 466 }).on('mouseleave', '.site-header .minicart_hover', function () { 467 jQuery(this).next('.widget_shopping_cart_content').delay(100).stop(true, false).slideUp(); 468 }); 469 jQuery(document) 470 .on('mouseenter', '.site-header .widget_shopping_cart_content', function () { 471 jQuery(this).stop(true, false).show(); 472 }) 473 .on('mouseleave', '.site-header .widget_shopping_cart_content', function () { 474 jQuery(this).delay(100).stop(true, false).slideUp(); 475 }); 476 }; 477 478 var thim_carousel = function () { 479 if (jQuery().owlCarousel) { 480 $(".thim-gallery-images").owlCarousel({ 481 autoPlay : false, 482 singleItem : true, 483 stopOnHover: true, 484 pagination : true, 485 autoHeight : false 486 }); 487 488 $('.thim-carousel-wrapper').each(function () { 489 var item_visible = $(this).data('visible') ? parseInt($(this).data('visible')) : 4, 490 item_desktopsmall = $(this).data('desktopsmall') ? parseInt($(this).data('desktopsmall')) : item_visible, 491 itemsTablet = $(this).data('itemtablet') ? parseInt($(this).data('itemtablet')) : 2, 492 itemsMobile = $(this).data('itemmobile') ? parseInt($(this).data('itemmobile')) : 1, 493 pagination = $(this).data('pagination') ? true : false, 494 navigation = $(this).data('navigation') ? true : false, 495 autoplay = $(this).data('autoplay') ? parseInt($(this).data('autoplay')) : false, 496 navigation_text = ( $(this).data('navigation-text') && $(this).data('navigation-text') == '2' ) ? [ 497 "<i class=\'fa fa-long-arrow-left \'></i>", 498 "<i class=\'fa fa-long-arrow-right \'></i>" 499 ] : [ 500 "<i class=\'fa fa-chevron-left \'></i>", 501 "<i class=\'fa fa-chevron-right \'></i>" 502 ]; 503 $(this).owlCarousel({ 504 items : item_visible, 505 itemsDesktop : [1200, item_visible], 506 itemsDesktopSmall: [1024, item_desktopsmall], 507 itemsTablet : [768, itemsTablet], 508 itemsMobile : [480, itemsMobile], 509 navigation : navigation, 510 pagination : pagination, 511 lazyLoad : true, 512 autoPlay : autoplay, 513 navigationText : navigation_text, 514 }); 515 }); 516 517 $('.thim-carousel-course-categories .thim-course-slider, .thim-carousel-course-categories-tabs .thim-course-slider').each(function () { 518 var item_visible = $(this).data('visible') ? parseInt($(this).data('visible')) : 7, 519 item_desktopsmall = $(this).data('desktopsmall') ? parseInt($(this).data('desktopsmall')) : 6, 520 item_tablet = $(this).data('tablet') ? parseInt($(this).data('tablet')) : 4, 521 item_mobile = $(this).data('mobile') ? parseInt($(this).data('mobile')) : 2, 522 pagination = $(this).data('pagination') ? true : false, 523 navigation = $(this).data('navigation') ? true : false, 524 autoplay = $(this).data('autoplay') ? parseInt($(this).data('autoplay')) : false; 525 526 $(this).owlCarousel({ 527 items : item_visible, 528 itemsDesktopSmall: [1024, item_desktopsmall], 529 itemsTablet : [768, item_tablet], 530 itemsMobile : [480, item_mobile], 531 navigation : navigation, 532 pagination : pagination, 533 autoPlay : autoplay, 534 navigationText : [ 535 "<i class=\'fa fa-chevron-left \'></i>", 536 "<i class=\'fa fa-chevron-right \'></i>" 537 ], 538 }); 539 }); 540 } 541 542 }; 543 544 var thim_contentslider = function () { 545 $('.thim-testimonial-slider').each(function () { 546 var elem = $(this), 547 item_visible = parseInt(elem.data('visible')), 548 item_time = parseInt(elem.data('time')), 549 autoplay = elem.data('auto') ? true : false, 550 item_ratio = elem.data('ratio') ? elem.data('ratio') : 1.18, 551 item_padding = elem.data('padding') ? elem.data('padding') : 15, 552 item_activepadding = elem.data('activepadding') ? elem.data('activepadding') : 0, 553 item_width = elem.data('width') ? elem.data('width') : 100, 554 mousewheel = elem.data('mousewheel') ? true : false; 555 556 var testimonial_slider = $(this).thimContentSlider({ 557 items : elem, 558 itemsVisible : item_visible, 559 mouseWheel : mousewheel, 560 autoPlay : autoplay, 561 pauseTime : item_time, 562 itemMaxWidth : item_width, 563 itemMinWidth : item_width, 564 activeItemRatio : item_ratio, 565 activeItemPadding: item_activepadding, 566 itemPadding : item_padding 567 }); 568 569 }); 570 }; 571 572 var thim_course_menu_landing = function () { 573 if ($('.thim-course-menu-landing').length > 0) { 574 var menu_landing = $('.thim-course-menu-landing'), 575 tab_course = $('#course-landing .nav-tabs'), 576 tab_active = tab_course.find('>li.active'), 577 tab_item = tab_course.find('>li>a'), 578 tab_landing = menu_landing.find('.thim-course-landing-tab'), 579 tab_landing_item = tab_landing.find('>li>a'), 580 landing_Top = ( $('#course-landing').length ) > 0 ? $('#course-landing').offset().top : 0, 581 checkTop = ( $(window).height() > landing_Top ) ? $(window).height() : landing_Top; 582 583 $('footer#colophon').addClass('has-thim-course-menu'); 584 if (tab_active.length > 0) { 585 var active_href = tab_active.find('>a').attr('href'), 586 landing_active = tab_landing.find('>li>a[href="' + active_href + '"]'); 587 588 if (landing_active.length > 0) { 589 landing_active.parent().addClass('active'); 590 } 591 } 592 593 tab_landing_item.on('click', function (event) { 594 event.preventDefault(); 595 var href = $(this).attr('href'), 596 parent = $(this).parent(); 597 598 $('body, html').animate({ 599 scrollTop: tab_course.offset().top - 50 600 }, 800); 601 if (!parent.hasClass('active')) { 602 tab_landing.find('li.active').removeClass('active'); 603 parent.addClass('active'); 604 tab_course.find('>li>a[href="' + href + '"]').trigger('click'); 605 } 606 }); 607 608 tab_item.on('click', function () { 609 var href = $(this).attr('href'), 610 parent_landing = tab_landing.find('>li>a[href="' + href + '"]').parent(); 611 612 if (!parent_landing.hasClass('active')) { 613 tab_landing.find('li.active').removeClass('active'); 614 parent_landing.addClass('active'); 615 } 616 }); 617 618 $(window).scroll(function () { 619 if ($(window).scrollTop() > checkTop) { 620 $('body').addClass('course-landing-active'); 621 } else { 622 $('body.course-landing-active').removeClass('course-landing-active'); 623 } 624 ; 625 }) 626 } 627 }; 628 629 var thimImagepopup = function () { 630 $('.thim-image-popup').magnificPopup({ 631 type: 'image', 632 closeOnContentClick: true, 633 }); 634 } 635 636 $(document).on('click', '#course-curriculum-popup .popup-close', function (event) { 637 event.preventDefault(); 638 $('#learn-press-block-content').remove(); 639 }); 640 641 var thim_LoginPopup = function () { 642 if ($('#thim-popup-login .thim-login-container').length) { 643 644 var el = $('#thim-popup-login .thim-login-container'),
645 el_H = el.outerHeight(), 646 win_H = $(window).height(); 647 648 if (win_H > el_H) { 649 el.css('top', ( win_H - el_H ) / 2); 650 } 651 } 652 $(document).on('click', 'body:not(".loggen-in") .thim-button-checkout', function (e) { 653 if ($(window).width() > 767) { 654 e.preventDefault(); 655 if ($('#thim-popup-login').length) { 656 $('body').addClass('thim-popup-active'); 657 $('#thim-popup-login').addClass('active'); 658 } else { 659 var redirect = $(this).data('redirect'); 660 window.location = redirect; 661 } 662 } else { 663 e.preventDefault(); 664 var redirect = $(this).data('redirect'); 665 window.location = redirect; 666 } 667 }); 668 669 $(document).on('click', '#thim-popup-login .close-popup', function (event) { 670 event.preventDefault(); 671 $('body').removeClass('thim-popup-active'); 672 $('#thim-popup-login').removeClass('active'); 673 }); 674 675 $(document).on('click', '.thim-login-popup .login', function (event) { 676 if ($(window).width() > 767) { 677 event.preventDefault(); 678 $('body').addClass('thim-popup-active'); 679 $('#thim-popup-login').addClass('active'); 680 } 681 }); 682 683 $(document).on('click', '#thim-popup-login', function (e) { 684 if ($(e.target).attr('id') == 'thim-popup-login') { 685 $('body').removeClass('thim-popup-active'); 686 $('#thim-popup-login').removeClass('active'); 687 } 688 }); 689 690 $('#thim-popup-login form[name="loginform"]').submit(function (event) { 691 event.preventDefault(); 692 693 var form = $(this), 694 elem = $('#thim-popup-login .thim-login-container'), 695 input_username = elem.find('#thim_login').val(), 696 input_password = elem.find('#thim_pass').val(), 697 wp_submit = elem.find('#wp-submit').val(); 698 699 if (input_username == '' || input_password == '') { 700 return; 701 } 702 elem.addClass('loading'); 703 elem.append('<div class="cssload-container"><div class="cssload-loading"><i></i><i></i><i></i><i></i></div></div>'); 704 elem.find('.message').slideDown().remove(); 705 706 var data = { 707 action: 'thim_login_ajax', 708 data : form.serialize() + '&wp-submit=' + wp_submit, 709 }; 710 711 $.post(ajaxurl, data, function (response) { 712 try { 713 var response = JSON.parse(response); 714 elem.find('.thim-login').append(response.message); 715 if (response.code == '1') { 716 if (response.redirect) { 717 if (window.location.href == response.redirect) { 718 location.reload(); 719 } else { 720 window.location.href = response.redirect; 721 } 722 } else { 723 location.reload(); 724 } 725 } 726 } catch (e) { 727 return false; 728 } 729 elem.removeClass('loading'); 730 elem.find('.cssload-container').remove(); 731 }); 732 733 return false; 734 }); 735/* 736 $('#thim-form-login form[name="loginform"]').submit(function (event) { 737 event.preventDefault(); 738 739 var form = $(this), 740 elem = $('#thim-form-login .thim-login-container'), 741 input_username = elem.find('#thim_login').val(), 742 input_password = elem.find('#thim_pass').val(), 743 wp_submit = elem.find('#wp-submit').val(); 744 745 if (input_username == '' || input_password == '') { 746 return; 747 } 748 elem.addClass('loading'); 749 elem.append('<div class="cssload-container"><div class="cssload-loading"><i></i><i></i><i></i><i></i></div></div>'); 750 elem.find('.message').slideDown().remove(); 751 752 var data = { 753 action: 'thim_login_ajax', 754 data : form.serialize() + '&wp-submit=' + wp_submit, 755 }; 756 757 $.post(ajaxurl, data, function (response) { 758 try { 759 var response = JSON.parse(response); 760 elem.find('.thim-login').append(response.message); 761 if (response.code == '1') { 762 if (response.redirect) { 763 if (window.location.href == response.redirect) { 764 location.reload(); 765 } else { 766 window.location.href = response.redirect; 767 } 768 } else { 769 location.reload(); 770 } 771 } 772 } catch (e) { 773 return false; 774 } 775 elem.removeClass('loading'); 776 elem.find('.cssload-container').remove(); 777 }); 778 779 return false; 780 }); 781 */ 782 } 783 784 $(function () { 785 back_to_top(); 786 787 /* Waypoints magic 788 ---------------------------------------------------------- */ 789 if (typeof jQuery.fn.waypoint !== 'undefined') { 790 jQuery('.wpb_animate_when_almost_visible:not(.wpb_start_animation)').waypoint(function () { 791 jQuery(this).addClass('wpb_start_animation'); 792 }, {offset: '85%'}); 793 } 794 }); 795 796 function empty(data) { 797 if (typeof(data) == 'number' || typeof(data) == 'boolean') { 798 return false; 799 } 800 if (typeof(data) == 'undefined' || data === null) { 801 return true; 802 } 803 if (typeof(data.length) != 'undefined') { 804 return data.length === 0; 805 } 806 var count = 0; 807 for (var i in data) { 808 if (Object.prototype.hasOwnProperty.call(data, i)) { 809 count++; 810 } 811 } 812 return count === 0; 813 } 814 815 var windowWidth = window.innerWidth, 816 windowHeight = window.innerHeight, 817 $document = $(document), 818 orientation = windowWidth > windowHeight ? 'landscape' : 'portrait'; 819 var TitleAnimation = { 820 selector : '.article__parallax', 821 initialized: false, 822 animated : false, 823 initialize : function () { 824 825 //this.update(); 826 }, 827 update : function () { 828 //return; 829 830 } 831 }; 832 833 834 $(window).on("debouncedresize", function (e) { 835 windowWidth = $(window).width(); 836 windowHeight = $(window).height(); 837 TitleAnimation.initialize(); 838 }); 839 840 $(window).on("orientationchange", function (e) { 841 setTimeout(function () { 842 TitleAnimation.initialize(); 843 }, 300); 844 }); 845 846 var latestScrollY = $('html').scrollTop() || $('body').scrollTop(), 847 ticking = false; 848 849 function updateAnimation() { 850 ticking = false; 851 TitleAnimation.update(); 852 } 853 854 function requestScroll() { 855 if (!ticking) { 856 requestAnimationFrame(updateAnimation); 857 } 858 ticking = true; 859 } 860 861 $(window).on("scroll", function () { 862 latestScrollY = $('html').scrollTop() || $('body').scrollTop(); 863 requestScroll(); 864 }); 865 866 867 jQuery(function ($) { 868 var adminbar_height = jQuery('#wpadminbar').outerHeight(); 869 jQuery('.navbar-nav li a,.arrow-scroll > a').on('click', function (e) {
870 if (parseInt(jQuery(window).scrollTop(), 10) < 2) { 871 var height = 47; 872 } else height = 0; 873 var sticky_height = jQuery('#masthead').outerHeight(); 874 var menu_anchor = jQuery(this).attr('href'); 875 if (menu_anchor && menu_anchor.indexOf("#") == 0 && menu_anchor.length > 1) { 876 e.preventDefault(); 877 $('html,body').animate({ 878 scrollTop: jQuery(menu_anchor).offset().top - adminbar_height - sticky_height + height 879 }, 850); 880 } 881 }); 882 }); 883 884 /* Menu Sidebar */ 885 jQuery(document).on('click', '.menu-mobile-effect', function (e) { 886 e.stopPropagation(); 887 jQuery('.wrapper-container').toggleClass('mobile-menu-open'); 888 }); 889 890 jQuery(document).on('click', '.mobile-menu-open #main-content', function () { 891 jQuery('.wrapper-container.mobile-menu-open').removeClass('mobile-menu-open'); 892 }); 893 894 function mobilecheck() { 895 var check = false; 896 (function (a) { 897 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(a) || /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(a.substr(0, 4)))check = true 898 })(navigator.userAgent || navigator.vendor || window.opera); 899 return check; 900 } 901 902 if (mobilecheck()) { 903 window.addEventListener('load', function () { // on page load 904 var main_content = document.getElementById('main-content'); 905 if (main_content) { 906 main_content.addEventListener("touchstart", function (e) { 907 jQuery('.wrapper-container').removeClass('mobile-menu-open'); 908 }); 909 } 910 }, false); 911 } 912 ; 913 914 /* mobile menu */ 915 if (jQuery(window).width() > 768) { 916 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('<span class="icon-toggle"><i class="fa fa-angle-down"></i></span>'); 917 } else { 918 jQuery('.navbar-nav>li.menu-item-has-children:not(.current-menu-parent) >a,.navbar-nav>li.menu-item-has-children:not(.current-menu-parent) >span,.navbar-nav>li.tc-menu-layout-builder:not(.current-menu-parent) >a,.navbar-nav>li.tc-menu-layout-builder:not(.current-menu-parent) >span').after('<span class="icon-toggle"><i class="fa fa-angle-down"></i></span>'); 919 jQuery('.navbar-nav>li.menu-item-has-children.current-menu-parent >a,.navbar-nav>li.menu-item-has-children.current-menu-parent >span,.navbar-nav>li.tc-menu-layout-builder.current-menu-parent >a,.navbar-nav>li.tc-menu-layout-builder.current-menu-parent >span').after('<span class="icon-toggle"><i class="fa fa-angle-up"></i></span>'); 920 } 921 jQuery('.navbar-nav>li.menu-item-has-children .icon-toggle, .navbar-nav>li.tc-menu-layout-builder .icon-toggle').on('click', function () { 922 if (jQuery(this).next('.sub-menu').is(':hidden')) { 923 jQuery(this).next('.sub-menu').slideDown(500, 'linear'); 924 jQuery(this).html('<i class="fa fa-angle-up"></i>'); 925 } 926 else { 927 jQuery(this).next('.sub-menu').slideUp(500, 'linear'); 928 jQuery(this).html('<i class="fa fa-angle-down"></i>'); 929 } 930 }); 931 932 /* ====== ON RESIZE ====== */ 933 $(window).load(function () { 934 thim_post_audio();
935 thim_post_gallery(); 936 thim_TopHeader(); 937 thim_Menu(); 938 thim_quick_view(); 939 thim_miniCartHover(); 940 thim_carousel(); 941 thim_contentslider(); 942 thim_SwitchLayout(); 943 thim_Shop_SwitchLayout(); 944 thim_Blog_SwitchLayout(); 945 thim_LoginPopup(); 946 thim_product_slider(); 947 thimImagepopup(); 948 949 setTimeout(function () { 950 TitleAnimation.initialize(); 951 thim_course_menu_landing(); 952 }, 400); 953 }); 954 955})(jQuery); 956 957(function ($) { 958 var thim_quiz_index = function () { 959 var question_index = $('.single-quiz .index-question'), 960 quiz_total_text = $('.single-quiz .quiz-total .quiz-text'); 961 if (question_index.length > 0) { 962 quiz_total_text.html(question_index.html()); 963 } 964 }; 965 966 967 $(window).load(function () { 968 $('.article__parallax').each(function (index, el) { 969 $(el).parallax("50%", 0.4); 970 }); 971 $('.images_parallax').parallax_images({ 972 speed: 0.5 973 }); 974 975 $(window).resize(function () { 976 $('.images_parallax').each(function (index, el) { 977 $(el).imagesLoaded(function () { 978 var parallaxHeight = $(this).find('img').height(); 979 $(this).height(parallaxHeight); 980 }); 981 }); 982 }).trigger('resize'); 983 984 thim_quiz_index(); 985 986 //Add class for profile tab 987 var $profile_list = $('.profile-tabs .nav-tabs>li '); 988 if ($profile_list.length > 0) { 989 $profile_list.addClass('thim-profile-list-' + $profile_list.length); 990 } 991 }); 992 993 // Learnpress custom code js 994 $(document).ready(function () { 995 //Course wishlist 996 $(".course-wishlist-box [class*='course-wishlist']").on('click', function (event) { 997 event.preventDefault(); 998 var $this = $(this); 999 if ($this.hasClass('loading')) return; 1000 $this.addClass('loading'); 1001 $this.toggleClass('course-wishlist'); 1002 $this.toggleClass('course-wishlisted'); 1003 $class = $this.attr('class'); 1004 if ($this.hasClass('course-wishlisted')) { 1005 $.ajax({
1006 type : "POST", 1007 url : window.location.href, 1008 dataType: 'html', 1009 data : { 1010 //action : 'learn_press_toggle_course_wishlist', 1011 'lp-ajax': 'toggle_course_wishlist', 1012 course_id: $this.data('id'), 1013 nonce : $this.data('nonce') 1014 }, 1015 success : function () { 1016 $this.removeClass('loading') 1017 }, 1018 error : function () { 1019 $this.removeClass('loading') 1020 } 1021 }); 1022 } 1023 if ($this.hasClass('course-wishlist')) { 1024 $.ajax({ 1025 type : "POST", 1026 url : window.location.href, 1027 dataType: 'html', 1028 data : { 1029 //action : 'learn_press_toggle_course_wishlist', 1030 'lp-ajax': 'toggle_course_wishlist', 1031 course_id: $this.data('id'), 1032 nonce : $this.data('nonce') 1033 }, 1034 success : function () { 1035 $this.removeClass('loading') 1036 }, 1037 error : function () { 1038 $this.removeClass('loading') 1039 } 1040 }); 1041 } 1042 }); 1043 1044 $('.video-container').on('click', '.beauty-intro .btns', function () { 1045 var iframe = '<iframe src="' + $(this).closest(".video-container").find(".yt-player").attr('data-video') + '" height= "' + $('.parallaxslider').height() + '"></iframe>'; 1046 $(this).closest(".video-container").find(".yt-player").replaceWith(iframe); 1047 //debug >HP 1048 $(this).closest(".video-container").find('.hideClick:first').css('display', 'none'); 1049 }); 1050 1051 if (!$('.add-review').length) { 1052 return; 1053 } 1054 var $star = $('.add-review .filled'); 1055 var $review = $('#review-course-value'); 1056 $star.find('li').on('mouseover', 1057 function () { 1058 $(this).nextAll().find('span').removeClass('fa-star').addClass('fa-star-o'); 1059 $(this).prevAll().find('span').removeClass('fa-star-o').addClass('fa-star'); 1060 $(this).find('span').removeClass('fa-star-o').addClass('fa-star'); 1061 $review.val($(this).index() + 1); 1062 } 1063 ); 1064 1065 //Replace placeholder input password & login 1066 $('.login-username [name="log"]').attr('placeholder', thim_js_translate.login); 1067 $('.login-password [name="pwd"]').attr('placeholder', thim_js_translate.password); 1068 1069 1070 $(window).scroll(function (event) { 1071 if (thim_scroll && thim_scroll === false) { 1072 event.preventDefault(); 1073 } 1074 }); 1075 }); 1076 1077 $(document).on('click', '#course-review-load-more', function () { 1078 var $button = $(this); 1079 if (!$button.is(':visible')) return; 1080 $button.addClass('loading'); 1081 var paged = parseInt($(this).attr('data-paged')) + 1; 1082 $.ajax({ 1083 type : "POST", 1084 dataType: 'html', 1085 url : window.location.href, 1086 data : { 1087 action: 'learn_press_load_course_review', 1088 paged : paged 1089 }, 1090 success : function (response) { 1091 var $content = $(response), 1092 $new_review = $content.find('.course-reviews-list>li'); 1093 $('#course-reviews .course-reviews-list').append($new_review); 1094 if ($content.find('#course-review-load-more').length) { 1095 $button.removeClass('loading').attr('data-paged', paged); 1096 } else { 1097 $button.remove(); 1098 } 1099 } 1100 }); 1101 }); 1102 1103 1104 $(document).on('click', '.single-lp_course .course-meta .course-review .value', function () { 1105 var review_tab = $('.course-tabs a[href="#tab-course-review"]'); 1106 if (review_tab.length > 0) { 1107 review_tab.trigger('click'); 1108 $('body, html').animate({ 1109 scrollTop: review_tab.offset().top - 50 1110 }, 800); 1111 } 1112 var review_tab_v3 = $('.course-tabs a[href="#tab-reviews"]'); 1113 if (review_tab_v3.length > 0) { 1114 review_tab_v3.trigger('click'); 1115 $('body, html').animate({ 1116 scrollTop: review_tab_v3.offset().top - 50 1117 }, 800); 1118 } 1119 }); 1120 1121 //Widget live search course 1122 var search_timer = false; 1123 1124 function thimlivesearch(contain) { 1125 var input_search = contain.find('.courses-search-input'), 1126 list_search = contain.find('.courses-list-search'), 1127 keyword = input_search.val(), 1128 loading = contain.find('.fa-search,.fa-times'); 1129 1130 if (keyword) { 1131 if (keyword.length < 1) { 1132 return; 1133 } 1134 loading.addClass('fa-spinner fa-spin'); 1135 $.ajax({
1136 type : 'POST', 1137 data : 'action=courses_searching&keyword=' + keyword + '&from=search', 1138 url : ajaxurl, 1139 success: function (html) { 1140 var data_li = ''; 1141 var items = jQuery.parseJSON(html); 1142 if (!items.error) { 1143 $.each(items, function (index) { 1144 if (index == 0) { 1145 if (this['guid'] != '#') { 1146 data_li += '<li class="ui-menu-item' + this['id'] + ' ob-selected"><a class="ui-corner-all" href="' + this['guid'] + '">' + this['title'] + '</a></li>'; 1147 } else { 1148 data_li += '<li class="ui-menu-item' + this['id'] + ' ob-selected">' + this['title'] + '</li>'; 1149 } 1150 1151 } else { 1152 data_li += '<li class="ui-menu-item' + this['id'] + '"><a class="ui-corner-all" href="' + this['guid'] + '">' + this['title'] + '</a></li>'; 1153 } 1154 }); 1155 list_search.addClass('search-visible').html('').append(data_li); 1156 } 1157 thimsearchHover(); 1158 loading.removeClass('fa-spinner fa-spin'); 1159 }, 1160 error : function (html) { 1161 } 1162 }); 1163 } 1164 list_search.html(''); 1165 } 1166 1167 function thimsearchHover() { 1168 $('.courses-list-search li').on('mouseenter', function () { 1169 $('.courses-list-search li').removeClass('ob-selected'); 1170 $(this).addClass('ob-selected'); 1171 }); 1172 } 1173 1174 $(document).ready(function () { 1175 1176 $(document).on('click', '.thim-course-search-overlay .search-toggle', function (e) { 1177 e.stopPropagation(); 1178 var parent = $(this).parent(); 1179 $('body').addClass('thim-search-active'); 1180 setTimeout(function () { 1181 parent.find('.thim-s').focus(); 1182 }, 500); 1183 1184 }); 1185 $(document).on('click', '.search-popup-bg', function () { 1186 var parent = $(this).parent(); 1187 window.clearTimeout(search_timer); 1188 parent.find('.courses-list-search').empty(); 1189 parent.find('.thim-s').val(''); 1190 $('body').removeClass('thim-search-active'); 1191 }); 1192 1193 $(document).on('keyup', '.courses-search-input', function (event) { 1194 clearTimeout($.data(this, 'search_timer')); 1195 var contain = $(this).parents('.courses-searching'), 1196 list_search = contain.find('.courses-list-search'), 1197 item_search = list_search.find('>li'); 1198 if (event.which == 13) { 1199 event.preventDefault(); 1200 $(this).stop(); 1201 } else if (event.which == 38) { 1202 if (navigator.userAgent.indexOf('Chrome') != -1 && parseFloat(navigator.userAgent.
1202substring(navigator.userAgent.indexOf('Chrome') + 7).split(' ')[0]) >= 15) { 1203 var selected = item_search.filter(".ob-selected"); 1204 if (item_search.length > 1) { 1205 item_search.removeClass("ob-selected"); 1206 // if there is no element before the selected one, we select the last one 1207 if (selected.prev().length == 0) { 1208 selected.siblings().last().addClass("ob-selected"); 1209 } else { // otherwise we just select the next one 1210 selected.prev().addClass("ob-selected"); 1211 } 1212 } 1213 } 1214 } else if (event.which == 40) { 1215 if (navigator.userAgent.indexOf('Chrome') != -1 && parseFloat(navigator.userAgent.substring(navigator.userAgent.indexOf('Chrome') + 7).split(' ')[0]) >= 15) { 1216 var selected = item_search.filter(".ob-selected"); 1217 if (item_search.length > 1) { 1218 item_search.removeClass("ob-selected"); 1219 1220 // if there is no element before the selected one, we select the last one 1221 if (selected.next().length == 0) { 1222 selected.siblings().first().addClass("ob-selected"); 1223 } else { // otherwise we just select the next one 1224 selected.next().addClass("ob-selected"); 1225 } 1226 } 1227 } 1228 } else if (event.which == 27) { 1229 if ($('body').hasClass('thim-search-active')) { 1230 $('body').removeClass('thim-search-active'); 1231 } 1232 list_search.html(''); 1233 $(this).val(''); 1234 $(this).stop(); 1235 } else { 1236 var search_timer = setTimeout(function () { 1237 thimlivesearch(contain); 1238 }, 500); 1239 $(this).data('search_timer', search_timer); 1240 } 1241 }); 1242 $(document).on('keypress', '.courses-search-input', function (event) { 1243 var item_search = $(this).parents('.courses-searching').find('.courses-list-search>li'); 1244 1245 if (event.keyCode == 13) { 1246 var selected = $(".ob-selected"); 1247 if (selected.length > 0) { 1248 var ob_href = selected.find('a').first().attr('href'); 1249 window.location.href = ob_href; 1250 } 1251 event.preventDefault(); 1252 } 1253 if (event.keyCode == 27) { 1254 if ($('body').hasClass('thim-search-active')) { 1255 $('body').removeClass('thim-search-active'); 1256 } 1257 $('.courses-list-search').html(''); 1258 $(this).val(''); 1259 $(this).stop(); 1260 } 1261 if (event.keyCode == 38) { 1262 var selected = item_search.filter(".ob-selected"); 1263 // if there is no element before the selected one, we select the last one 1264 if (item_search.length > 1) { 1265 item_search.removeClass("ob-selected"); 1266 if (selected.prev().length == 0) { 1267 selected.siblings().last().addClass("ob-selected"); 1268 } else { // otherwise we just select the next one 1269 selected.prev().addClass("ob-selected"); 1270 } 1271 } 1272 } 1273 if (event.keyCode == 40) { 1274 var selected = item_search.filter(".ob-selected"); 1275 if (item_search.length > 1) { 1276 item_search.removeClass("ob-selected"); 1277 // if there is no element before the selected one, we select the last one 1278 if (selected.next().length == 0) { 1279 selected.siblings().first().addClass("ob-selected"); 1280 } else { // otherwise we just select the next one 1281 selected.next().addClass("ob-selected"); 1282 } 1283 } 1284 } 1285 }); 1286 1287 $(document).on('click', '.courses-list-search, .courses-search-input', function (event) { 1288 event.stopPropagation(); 1289 }); 1290 1291 $(document).on('click', 'body', function () { 1292 if (!$('body').hasClass('course-scroll-remove')) { 1293 $('body').addClass('course-scroll-remove'); 1294 $('.courses-list-search').html(''); 1295 } 1296 }); 1297 1298 $(window).scroll(function () { 1299 if ($('body').hasClass('course-scroll-remove') && $(".courses-list-search li").length > 0) { 1300 $(".courses-searching .courses-list-search").empty(); 1301 $(".courses-searching .thim-s").val(''); 1302 } 1303 }); 1304 1305 $(document).on('focus', '.courses-search-input', function () { 1306 if ($('body').hasClass('course-scroll-remove')) { 1307 $('body').removeClass('course-scroll-remove'); 1308 } 1309 }); 1310 1311 //Prevent search result 1312 $(document).on('click', '#popup-header .search-visible', function (e) { 1313 var href = $(e.target).attr('href'); 1314 if (!href) { 1315 $('#popup-header .search-visible').removeClass('search-visible'); 1316 } 1317 1318 }); 1319 1320 $(document).on('click', '#popup-header button', function (e) { 1321 $('#popup-header .thim-s').trigger('focus'); 1322 1323 }); 1324 1325 $(document).on('focus', '#popup-header .thim-s', function () { 1326 var link = $('#popup-header .courses-list-search a');
1327 console.log($(this).val(), link.length); 1328 if ($(this).val() != '' && link.length > 0) { 1329 $('#popup-header .courses-list-search').addClass('search-visible'); 1330 } 1331 }); 1332 1333 1334 //Widget icon box 1335 $(".wrapper-box-icon").each(function () { 1336 var $this = $(this); 1337 if ($this.attr("data-icon")) { 1338 var $color_icon = $(".boxes-icon i", $this).css('color'); 1339 var $color_title = $(".heading__primary a", $this).css('color'); 1340 var $color_icon_change = $this.attr("data-icon"); 1341 } 1342 if ($this.attr("data-icon-border")) { 1343 var $color_icon_border = $(".boxes-icon", $this).css('border-color'); 1344 var $color_icon_border_change = $this.attr("data-icon-border"); 1345 } 1346 if ($this.attr("data-icon-bg")) { 1347 var $color_bg = $(".boxes-icon", $this).css('background-color'); 1348 var $color_bg_change = $this.attr("data-icon-bg"); 1349 } 1350 1351 1352 if ($this.attr("data-btn-bg")) { 1353 var $color_btn_bg = $(".smicon-read", $this).css('background-color'); 1354 var $color_btn_border = $(".smicon-read", $this).css('border-color'); 1355 var $color_btn_bg_text_color = $(".smicon-read", $this).css('color'); 1356 1357 var $color_btn_bg_change = $this.attr("data-btn-bg"); 1358 if ($this.attr("data-text-readmore")) { 1359 var $color_btn_bg_text_color_change = $this.attr("data-text-readmore"); 1360 } else { 1361 $color_btn_bg_text_color_change = $color_btn_bg_text_color; 1362 } 1363 1364 $(".smicon-read", $this).on({ 1365 'mouseenter': function () { 1366 if ($("#style_selector_container").length > 0) { 1367 if ($(".smicon-read", $this).css("background-color") != $color_btn_bg) 1368 $color_btn_bg = $(".smicon-read", $this).css('background-color'); 1369 } 1370 $(".smicon-read", $this).css({ 1371 'background-color': $color_btn_bg_change, 1372 'border-color' : $color_btn_bg_change, 1373 'color' : $color_btn_bg_text_color_change 1374 }); 1375 }, 1376 'mouseleave': function () { 1377 $(".smicon-read", $this).css({ 1378 'background-color': $color_btn_bg, 1379 'border-color' : $color_btn_border, 1380 'color' : $color_btn_bg_text_color 1381 }); 1382 } 1383 }); 1384 1385 } 1386/* 1387 $(".boxes-icon", $this).on({ 1388 'mouseenter': function () { 1389 if ($this.attr("data-icon")) { 1390 $(".boxes-icon", $this).css({'color': $color_icon_change}); 1391 } 1392 if ($this.attr("data-icon-bg")) { 1393 1394 if ($("#style_selector_container").length > 0) { 1395 if ($(".boxes-icon", $this).css("background-color") != $color_bg) 1396 $color_bg = $(".boxes-icon", $this).css('background-color'); 1397 } 1398 1399 $(".boxes-icon", $this).css({'background-color': $color_bg_change}); 1400 } 1401 if ($this.attr("data-icon-border")) { 1402 $(".boxes-icon", $this).css({'border-color': $color_icon_border_change}); 1403 } 1404 }, 1405 'mouseleave': function () { 1406 if ($this.attr("data-icon")) { 1407 $(".boxes-icon", $this).css({'color': $color_icon}); 1408 } 1409 if ($this.attr("data-icon-bg")) { 1410 $(".boxes-icon", $this).css({'background-color': $color_bg}); 1411 } 1412 if ($this.attr("data-icon-border")) { 1413 $(".boxes-icon", $this).css({'border-color': $color_icon_border}); 1414 } 1415 } 1416 }); 1417*/ 1418 $($this).on({ 1419 'mouseenter': function () { 1420 if ($this.attr("data-icon")) { 1421 $(".boxes-icon i", $this).css({'color': $color_icon_change}); 1422 $(".heading__primary a", $this).css({'color': $color_icon_change}); 1423 } 1424 if ($this.attr("data-icon-bg")) { 1425 /* for select style*/ 1426 if ($("#style_selector_container").length > 0) { 1427 if ($(".boxes-icon", $this).css("background-color") != $color_bg) 1428 $color_bg = $(".boxes-icon", $this).css('background-color'); 1429 } 1430 1431 $(".boxes-icon", $this).css({'background-color': $color_bg_change}); 1432 } 1433 if ($this.attr("data-icon-border")) { 1434 $(".boxes-icon", $this).css({'border-color': $color_icon_border_change});
1435 } 1436 }, 1437 'mouseleave': function () { 1438 if ($this.attr("data-icon")) { 1439 $(".boxes-icon i", $this).css({'color': $color_icon}); 1440 $(".heading__primary a", $this).css({'color': $color_title}); 1441 } 1442 if ($this.attr("data-icon-bg")) { 1443 $(".boxes-icon", $this).css({'background-color': $color_bg}); 1444 } 1445 if ($this.attr("data-icon-border")) { 1446 $(".boxes-icon", $this).css({'border-color': $color_icon_border}); 1447 } 1448 } 1449 }); 1450 1451 }); 1452 /* End Icon Box */ 1453 1454 //Background video 1455 $('.bg-video-play').on("click", function () { 1456 var elem = $(this), 1457 video = $(this).parents('.thim-widget-icon-box').find('.full-screen-video'), 1458 player = video.get(0); 1459 if (player.paused) { 1460 player.play(); 1461 elem.addClass('bg-pause'); 1462 } else { 1463 player.pause(); 1464 elem.removeClass('bg-pause'); 1465 } 1466 }); 1467 1468 1469 //wpcf7-form-submit 1470 $(document).on('click', '.wpcf7-form-control.wpcf7-submit', function () { 1471 var elem = $(this), 1472 form = elem.parents('.wpcf7-form'); 1473 form.addClass('thim-sending'); 1474 $(document).on('invalid.wpcf7', function (event) { 1475 form.removeClass('thim-sending'); 1476 }); 1477 $(document).on('spam.wpcf7', function (event) { 1478 form.removeClass('thim-sending'); 1479 setTimeout(function () { 1480 if ($('.wpcf7-response-output').length > 0) { 1481 $('.wpcf7-response-output').hide(); 1482 } 1483 }, 4000); 1484 }); 1485 $(document).on('mailsent.wpcf7', function (event) { 1486 form.removeClass('thim-sending'); 1487 setTimeout(function () { 1488 if ($('.wpcf7-response-output').length > 0) { 1489 $('.wpcf7-response-output').hide(); 1490 } 1491 }, 4000); 1492 1493 }); 1494 $(document).on('mailfailed.wpcf7', function (event) { 1495 form.removeClass('thim-sending'); 1496 setTimeout(function () { 1497 if ($('.wpcf7-response-output').length > 0) { 1498 $('.wpcf7-response-output').hide(); 1499 } 1500 }, 4000); 1501 }); 1502 }); 1503 }); 1504 1505 //Include plugin event file events.js 1506 jQuery(document).ready(function () { 1507 1508 // owl-carausel 1509 var carousels = $('.tp_event_owl_carousel'); 1510 for (var i = 0; i < carousels.length; i++) { 1511 var data = $(carousels[i]).attr('data-countdown'); 1512 var options = { 1513 navigation : true, // Show next and prev buttons 1514 slideSpeed : 300, 1515 paginationSpeed: 400, 1516 singleItem : true 1517 }; 1518 if (typeof data !== 'undefined') { 1519 data = JSON.parse(data); 1520 $.extend(options, data); 1521 1522 $.each(options, function (k, v) { 1523 if (v === 'true') { 1524 options[k] = true; 1525 } else if (v === 'false') { 1526 options[k] = false; 1527 } 1528 }); 1529 } 1530 1531 if (typeof options.slide === 'undefined' || options.slide === true) { 1532 $(carousels[i]).owlCarousel(options); 1533 } 1534 else { 1535 $(carousels[i]).removeClass('owl-carousel'); 1536 } 1537 } 1538 }); 1539 1540 // Sticky sidebar 1541 jQuery(document).ready(function () { 1542 var offsetTop = 20; 1543 if ($("#wpadminbar").length) { 1544 offsetTop += $("#wpadminbar").outerHeight(); 1545 } 1546 if ($("#masthead.sticky-header").length) { 1547 offsetTop += $("#masthead.sticky-header").outerHeight(); 1548 } 1549 jQuery("#sidebar.sticky-sidebar").theiaStickySidebar({ 1550 "containerSelector" : "", 1551 "additionalMarginTop" : offsetTop, 1552 "additionalMarginBottom": "0", 1553 "updateSidebarHeight" : false, 1554 "minWidth" : "768", 1555 "sidebarBehavior" : "modern" 1556 }); 1557 }); 1558 1559 // Prevent search when no content submited 1560 jQuery(document).ready(function () { 1561 $(".courses-searching form").submit(function () { 1562 var input_search = $(this).find("input[name='s']"); 1563 if ($.trim(input_search.val()) === "") { 1564 input_search.focus(); 1565 return false; 1566 } 1567 }); 1568 1569 $('form#bbp-search-form').submit(function () { 1570 if ($.trim($("#bbp_search").val()) === "") { 1571 $("#bbp_search").focus(); 1572 return false; 1573 } 1574 }); 1575 1576 $("form.search-form").submit(function () { 1577 var input_search = $(this).find("input[name='s']"); 1578 if ($.trim(input_search.val()) === "") { 1579 input_search.focus(); 1580 return false; 1581 } 1582 }); 1583 1584 //Register form untispam 1585 $('.thim-login form#registerform').each(function(){ 1586 $(this).submit(function (event) { 1587 var elem = $(this), 1588 input_username = elem.find('#user_login'), 1589 input_email = elem.find('#user_email'), 1590 input_captcha = elem.find('.thim-login-captcha .captcha-result'); 1591 1592 if( elem.hasClass('auto_login') ) { 1593 var input_pass = elem.find('#password'), 1594 input_rppass = elem.find('#repeat_password'); 1595 } 1596 1597 var email_valid = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm; 1598 1599 if ($('#registerform #check_spam_register').val() != '') { 1600 event.preventDefault(); 1601 } 1602 1603 if (input_captcha.length > 0) { 1604 var captcha_1 = parseInt(input_captcha.data('captcha1')), 1605 captcha_2 = parseInt(input_captcha.data('captcha2')); 1606 1607 if (captcha_1 + captcha_2 != parseInt(input_captcha.val())) { 1608 input_captcha.addClass('invalid').val(''); 1609 event.preventDefault(); 1610 } 1611 } 1612 1613 if (input_username.length > 0 && input_username.val() == '') { 1614 input_username.addClass('invalid'); 1615 event.preventDefault(); 1616 } 1617 1618 if (input_email.length > 0 && ( input_email.val() == '' || !email_valid.test(input_email.val()) )) { 1619 input_email.addClass('invalid'); 1620 event.preventDefault(); 1621 } 1622 1623 if( elem.hasClass('auto_login') ) { 1624 if (input_pass.val() !== input_rppass.val() || input_pass.val() == '') { 1625 input_pass.addClass('invalid'); 1626 input_rppass.addClass('invalid'); 1627 event.preventDefault(); 1628 } 1629 } 1630 }); 1631 }); 1632 1633 1634 //Validate login submit 1635 $('.thim-login form#loginform').each(function(){ 1636 $(this).submit(function (event) { 1637 var elem = $(this), 1638 input_username = elem.find('#thim_login'), 1639 input_captcha = elem.find('.thim-login-captcha .captcha-result'), 1640 input_pass = elem.find('#thim_pass'); 1641 1642 if (input_username.length > 0 && input_username.val() == '') { 1643 input_username.addClass('invalid'); 1644 event.preventDefault(); 1645 } 1646 1647 if (input_pass.length > 0 && input_pass.val() == '') { 1648 input_pass.addClass('invalid'); 1649 event.preventDefault(); 1650 } 1651 1652 if (input_captcha.length > 0) { 1653 var captcha_1 = parseInt(input_captcha.data('captcha1')), 1654 captcha_2 = parseInt(input_captcha.data('captcha2')); 1655 1656 if (captcha_1 + captcha_2 != parseInt(input_captcha.val())) { 1657 input_captcha.addClass('invalid').val(''); 1658 event.preventDefault(); 1659 } 1660 } 1661 }); 1662 }); 1663 1664 1665 //Validate lostpassword submit 1666 $('.thim-login form#lostpasswordform').submit(function (event) { 1667 var elem = $(this), 1668 input_username = elem.find('#user_login'); 1669 1670 if (input_username.length > 0 && input_username.val() == '') { 1671 input_username.addClass('invalid'); 1672 event.preventDefault(); 1673 } 1674 }); 1675 1676 1677 $('.thim-login #thim_login, .thim-login #thim_pass, .thim-login #user_login').on('focus', function () { 1678 $(this).removeClass('invalid'); 1679 }); 1680 1681 //My account login 1682 $('#customer_login .login').submit(function (event) { 1683 var elem = $(this), 1684 input_username = elem.find('#username'), 1685 input_pass = elem.find('#password'); 1686 1687 if (input_pass.length > 0 && input_pass.val() == '') { 1688 input_pass.addClass('invalid'); 1689 event.preventDefault(); 1690 } 1691 1692 if (input_username.length > 0 && input_username.val() == '') { 1693 input_username.addClass('invalid'); 1694 event.preventDefault(); 1695 } 1696 }); 1697 1698 //My account register 1699 $('#customer_login .register').submit(function (event) { 1700 var elem = $(this), 1701 input_username = elem.find('#reg_username'), 1702 input_email = elem.find('#reg_email'), 1703 input_pass = elem.find('#reg_password'), 1704 input_captcha = $('#customer_login .register .captcha-result'), 1705 valid_email = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm; 1706 1707 if (input_captcha.length > 0) { 1708 var captcha_1 = parseInt(input_captcha.data('captcha1')), 1709 captcha_2 = parseInt(input_captcha.data('captcha2')); 1710 1711 if (captcha_1 + captcha_2 != parseInt(input_captcha.val())) { 1712 input_captcha.addClass('invalid').val(''); 1713 event.preventDefault(); 1714 } 1715 } 1716 1717 if (input_pass.length > 0 && input_pass.val() == '') { 1718 input_pass.addClass('invalid'); 1719 event.preventDefault(); 1720 } 1721 1722 if (input_username.length > 0 && input_username.val() == '') { 1723 input_username.addClass('invalid'); 1724 event.preventDefault(); 1725 } 1726 1727 if (input_email.length > 0 && ( input_email.val() == '' || !valid_email.test(input_email.val()) )) { 1728 input_email.addClass('invalid'); 1729 event.preventDefault(); 1730 } 1731 }); 1732 1733 //Validate comment form submit 1734 $('form#commentform').submit(function (event) { 1735 var elem = $(this), 1736 comment = elem.find('#comment[aria-required="true"]'), 1737 author = elem.find('#author[aria-required="true"]'), 1738 url = elem.find('#url[aria-required="true"]'), 1739 email = elem.find('#email[aria-required="true"]'), 1740 valid_email = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm; 1741 1742 if (author.length > 0 && author.val() == '') { 1743 author.addClass('invalid'); 1744 event.preventDefault(); 1745 } 1746 1747 if (comment.length > 0 && comment.val() == '') { 1748 comment.addClass('invalid'); 1749 event.preventDefault(); 1750 } 1751 1752 if (url.length > 0 && url.val() == '') { 1753 url.addClass('invalid'); 1754 event.preventDefault(); 1755 } 1756 1757 if (email.length > 0 && ( email.val() == '' || !valid_email.test(email.val()) )) { 1758 email.addClass('invalid'); 1759 event.preventDefault(); 1760 } 1761 }); 1762 1763 $('#customer_login .register, #reg_username, #reg_email, #reg_password, .thim-login-captcha .captcha-result, #registerform input, #thim_login, #thim_pass, #comment, #author, #email').on('focus', function () { 1764 if ($(this).hasClass('invalid')) { 1765 $(this).removeClass('invalid'); 1766 } 1767 }); 1768 1769 $('input.wpcf7-text, textarea.wpcf7-textarea').on('focus', function () { 1770 if ($(this).hasClass('wpcf7-not-valid')) { 1771 $(this).removeClass('wpcf7-not-valid'); 1772 } 1773 }); 1774 1775 $('.thim-language').on({ 1776 'mouseenter': function () { 1777 $(this).children('.list-lang').stop(true, false).fadeIn(250); 1778 }, 1779 'mouseleave': function () { 1780 $(this).children('.list-lang').stop(true, false).fadeOut(250); 1781 } 1782 }); 1783 1784 $('#toolbar .menu li.menu-item-has-children').on({ 1785 'mouseenter': function () { 1786 $(this).children('.sub-menu').stop(true, false).fadeIn(250); 1787 }, 1788 'mouseleave': function () { 1789 $(this).children('.sub-menu').stop(true, false).fadeOut(250); 1790 } 1791 }); 1792 1793 //Widget gallery-posts 1794 function gallery_layout() { 1795 var $container = jQuery('.isotope-layout'); 1796 $container.each(function () { 1797 var $this = jQuery(this), $width, $col, $width_unit, $height_unit; 1798 var $spacing = 10; 1799 $col = 6; 1800 if ($col != 1) { 1801 if(parseInt($container.width()) < 768) { 1802 $col = 4; 1803 } 1804 if(parseInt($container.width()) < 480) { 1805 $col = 2; 1806 } 1807 1808 } 1809 $width_unit = Math.floor((parseInt($container.width(), 10) - ($col-1)*$spacing )/ $col); 1810 $height_unit = Math.floor(parseInt($width_unit, 10)); 1811 1812 $this.find('.item_gallery').css({ 1813 width: $width_unit 1814 }); 1815 if ($col == 1) { 1816 $height_unit = 'auto'; 1817 } 1818 $this.find('.item_gallery .thim-gallery-popup').css({ 1819 height: $height_unit 1820 }); 1821 if ($this.find('.item_gallery').hasClass('size32')) { 1822 if( $col > 1 ) { 1823 $this.find('.item_gallery.size32 .thim-gallery-popup').css({ 1824 height: $height_unit*2+$spacing 1825 }); 1826 } 1827 } 1828 if ($this.find('.item_gallery').hasClass('size32')) { 1829 if( $col > 3 ) { 1830 $width = $width_unit*4 + $spacing*3; 1831 $this.find('.item_gallery.size32').css({ 1832 width: $width 1833 }); 1834 } else { 1835 $width = $width_unit*2 + $spacing*1; 1836 $this.find('.item_gallery.size32').css({ 1837 width: $width 1838 }); 1839 } 1840 } 1841 if ($this.find('.item_gallery').hasClass('size22') && $col != 1) { 1842 $this.find('.item_gallery.size22 .thim-gallery-popup').css({ 1843 height: $height_unit*2+$spacing 1844 }); 1845 } 1846 if ($this.find('.item_gallery').hasClass('size22') && $col != 1) { 1847 $width = $width_unit*2 + $spacing*1; 1848 $this.find('.item_gallery.size22').css({ 1849 width: $width 1850 }); 1851 } 1852 $this.isotope({ 1853 itemSelector : '.item_gallery', 1854 masonry: { 1855 columnWidth : $width_unit, 1856 gutter: $spacing 1857 } 1858 }); 1859 }); 1860 } 1861 gallery_layout(); 1862 $(window).resize(function () { 1863 gallery_layout(); 1864 }) 1865/* 1866 $(window).load(function () { 1867 if ($('.thim-widget-gallery-posts .wrapper-gallery-filter').length > 0) { 1868 $('.thim-widget-gallery-posts .wrapper-gallery-filter').isotope({ 1869 filter: '*', 1870 itemSelector : '.item_gallery', 1871 percentPosition: true, 1872 layoutMode: 'masonry', 1873 masonry: { 1874 // use element for option 1875 columnWidth: '.size11', 1876 rowHeight: '.size11', 1877 gutter: 10, 1878 } 1879 }); 1880 } 1881 }); 1882*/
1883 $(document).on('click', '.filter-controls .filter', function (e) { 1884 e.preventDefault(); 1885 var filter = $(this).data('filter'), 1886 filter_wraper = $(this).parents('.thim-widget-gallery-posts').find('.wrapper-gallery-filter'); 1887 $('.filter-controls .filter').removeClass('active'); 1888 $(this).addClass('active'); 1889 filter_wraper.isotope({filter: filter}); 1890 }); 1891 1892 $(document).on('click', '.thim-gallery-popup', function (e) { 1893 e.preventDefault(); 1894 var elem = $(this), 1895 post_id = elem.attr('data-id'), 1896 data = {action: 'thim_gallery_popup', post_id: post_id}; 1897 elem.addClass('loading'); 1898 $.post(ajaxurl, data, function (response) { 1899 elem.removeClass('loading'); 1900 $('.thim-gallery-show').append(response); 1901 if ($('.thim-gallery-show img').length > 0) { 1902 $('.thim-gallery-show').magnificPopup({ 1903 mainClass : 'my-mfp-zoom-in', 1904 type : 'image', 1905 delegate : 'a', 1906 showCloseBtn: false, 1907 gallery : { 1908 enabled: true 1909 }, 1910 callbacks : { 1911 open: function () { 1912 $('body').addClass('thim-popup-active'); 1913 $.magnificPopup.instance.close = function () { 1914 $('.thim-gallery-show').empty(); 1915 $('body').removeClass('thim-popup-active'); 1916 $.magnificPopup.proto.close.call(this); 1917 }; 1918 }, 1919 } 1920 }).magnificPopup('open'); 1921 } else { 1922 $.magnificPopup.open({ 1923 mainClass : 'my-mfp-zoom-in', 1924 items : { 1925 src : $('.thim-gallery-show'), 1926 type: 'inline' 1927 }, 1928 showCloseBtn: false, 1929 callbacks : { 1930 open: function () { 1931 $('body').addClass('thim-popup-active'); 1932 $.magnificPopup.instance.close = function () { 1933 $('.thim-gallery-show').empty(); 1934 $('body').removeClass('thim-popup-active'); 1935 $.magnificPopup.proto.close.call(this); 1936 }; 1937 }, 1938 } 1939 }); 1940 } 1941 1942 }); 1943 1944 }); 1945 1946 $('.widget-button.custom_style').each(function () { 1947 var elem = $(this), 1948 old_style = elem.attr('style'), 1949 hover_style = elem.data('hover'); 1950 elem.on({ 1951 'mouseenter': function () { 1952 elem.attr('style', hover_style); 1953 }, 1954 'mouseleave': function () { 1955 elem.attr('style', old_style); 1956 } 1957 }) 1958 }); 1959 1960 }); 1961 1962 1963 1964 $(window).load(function () { 1965 1966 $(window).resize(function () { 1967 thim_get_position_header_course_v2($('.content_course_2 .header_single_content .bg_header')); 1968 $('.thim-carousel-instructors .instructor-item').css('min-height', ''); 1969 $('.thim-owl-carousel-post:not(.layout-3) .image').css('min-height', ''); 1970 $('.thim-course-carousel .course-thumbnail').css('min-height', ''); 1971 $('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info').css('min-height', ''); 1972 if ($(window).width() < 767 || $(window).width() > 1200) { 1973 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', ''); 1974 } 1975 thim_get_position_header_course_v2($('.content_course_2 .header_single_content .bg_header')); 1976 thim_min_height_carousel($('.thim-carousel-instructors .instructor-item')); 1977 thim_min_height_carousel($('.thim-owl-carousel-post:not(.layout-3) .image')); 1978 thim_min_height_carousel($('.thim-course-carousel .course-thumbnail')); 1979 thim_min_height_carousel($('.thim-row-bg-border-top .thim-bg-border-top')); 1980 thim_min_height_carousel($('.thim-testimonial-carousel-kindergarten .item')); 1981 1982 thim_min_height_carousel($('.thim-widget-carousel-categories .item .image, .thim-widget-carousel-categories .item .content-wrapper')); 1983 1984 thim_min_height_content_area(); 1985 if ($(window).width() > 767) { 1986 thim_min_height_carousel($('.thim-grid-posts .item-post .article-wrapper, .thim-grid-posts .item-post .article-image')); 1987 thim_min_height_carousel($('body.thim-demo-university-4 .thim-about-eduma, body.thim-demo-university-4 .thim-video-popup .video-info')); 1988 } 1989 1990 if ($(window).width() > 767 && $(window).width() < 1200) { 1991 if ($('body.thim-demo-university-4 .thim-icon-our-programs').length) { 1992 var min_height = parseInt($('body.thim-demo-university-4 .thim-icon-our-programs').outerHeight() / 3); 1993 $('body.thim-demo-university-4 #sb_instagram .sbi_photo').css('min-height', min_height); 1994 } 1995 1996 } 1997 }); 1998 }); 1999 2000 function thim_get_position_header_course_v2($selector) { 2001 if($(window).width()>1025) { 2002 $selector.css('left','-'+($(window).width()-$('.container').width())/2+'px'); 2003 $selector.css('right','-'+(($(window).width()-$('.container').width())/2+(45+$('.content_course_2 .course_right').width()))+'px'); 2004 } else { 2005 $selector.css('left','-15px'); 2006 $selector.css('right','-'+(45+$('.content_course_2 .course_right').width())+'px'); 2007 } 2008 2009 } 2010 2011 function thim_min_height_carousel($selector) { 2012 var min_height = 0; 2013 $selector.each(function (index, val) { 2014 if ($(this).outerHeight() > min_height) { 2015 min_height = $(this).outerHeight(); 2016 } 2017 if (index + 1 == $selector.length) { 2018 $selector.css('min-height', min_height); 2019 } 2020 }); 2021 } 2022 2023 function thim_min_height_content_area() { 2024 var content_area = $('#main-content .content-area'), 2025 footer = $('#main-content .site-footer'), 2026 winH = $(window).height(); 2027 if (content_area.length > 0 && footer.length > 0) { 2028 content_area.css('min-height', winH - footer.height()); 2029 } 2030 } 2031 2032 2033 //Widget counter box 2034 (function (a) { 2035 a.fn.countTo = function (g) { 2036 g = g || {}; 2037 return a(this).each(function () { 2038 function e(a) { 2039 a = b.formatter.call(h, a, b); 2040 f.html(a); 2041 } 2042 2043 var b = a.extend({}, a.fn.countTo.defaults, { 2044 from : a(this).data("from"), 2045 to : a(this).data("to"), 2046 speed : a(this).data("speed"), 2047 refreshInterval: a(this).data("refresh-interval"), 2048 decimals : a(this).data("decimals") 2049 }, g), j = Math.ceil(b.speed / b.refreshInterval), l = (b.to - b.from) / j, h = this, f = a(this), k = 0, c = b.from, d = f.data("countTo") || {}; 2050 f.data("countTo", d); 2051 d.interval && clearInterval(d.interval); 2052 d.interval = 2053 setInterval(function () { 2054 c += l; 2055 k++; 2056 e(c); 2057 "function" == typeof b.onUpdate && b.onUpdate.call(h, c); 2058 k >
2058= j && (f.removeData("countTo"), clearInterval(d.interval), c = b.to, "function" == typeof b.onComplete && b.onComplete.call(h, c)); 2059 }, b.refreshInterval); 2060 e(c); 2061 }); 2062 }; 2063 a.fn.countTo.defaults = { 2064 from : 0, to: 0, speed: 1E3, refreshInterval: 100, decimals: 0, formatter: function (a, e) { 2065 return a.toFixed(e.decimals); 2066 }, onUpdate: null, onComplete: null 2067 }; 2068 })(jQuery); 2069 2070 jQuery(window).load(function () { 2071 2072 if (jQuery().waypoint) { 2073 jQuery('.counter-box').waypoint(function () { 2074 jQuery(this).find('.display-percentage').each(function () { 2075 var percentage = jQuery(this).data('percentage'); 2076 jQuery(this).countTo({from: 0, to: percentage, refreshInterval: 40, speed: 2000}); 2077 }); 2078 }, { 2079 triggerOnce: true, 2080 offset : '80%' 2081 }); 2082 } 2083 2084 }); 2085 2086 $(document).ready(function () { 2087 $('.thim-search-light-style').append('<a class="thim-button-down thim-click-to-bottom" href="#"><i class="fa fa-chevron-down"></i></a>'); 2088 $(document).on('click', '.thim-button-down', function (e) { 2089 e.preventDefault(); 2090 if ($('#wpadminbar').length > 0) { 2091 var height = parseInt($('#wpadminbar').outerHeight()) + parseInt($('.thim-search-light-style').outerHeight()); 2092 } else { 2093 var height = parseInt($('.thim-search-light-style').outerHeight()); 2094 } 2095 $('body, html').animate({ 2096 'scrollTop': height 2097 }, 600); 2098 }); 2099 2100 var html_scroll = '<div class="scroll_slider_tab"><div class="container">' + 2101 '<a href="" class="to_bottom">'+ 2102 '<svg xmlns="http://www.w3.org/2000/svg"' + 2103 'xmlns:xlink="http://www.w3.org/1999/xlink"'+ 2104 'width="18px" height="28px">'+ 2105 '<path fill-rule="evenodd" fill="rgb(255, 255, 255)"'+ 2106 '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"/>'+ 2107 '</svg>'+ 2108 '<i class="icon-chevron-down icon1"></i>'+ 2109 '<i class="icon-chevron-down icon2"></i>'+ 2110 '</a>'+ 2111 '</div></div>'; 2112 $('.have_scroll_bottom').append(html_scroll); 2113 $(document).on('click', '.have_scroll_bottom .scroll_slider_tab .to_bottom', function (e) { 2114 e.preventDefault(); 2115 if ($('#wpadminbar').length > 0) { 2116 var height = parseInt($('#wpadminbar').outerHeight()) + parseInt($('.have_scroll_bottom').outerHeight()); 2117 } else { 2118 var height = parseInt($('.have_scroll_bottom').outerHeight()); 2119 } 2120 $('body, html').animate({ 2121 'scrollTop': height 2122 }, 600); 2123 }); 2124 2125 $(document).on('click', 'body.page-template-landing-page .current_page_item>a, .thim-top-landing .widget-button', function (e) { 2126 if ($('.thim-top-landing').length > 0) { 2127 e.preventDefault(); 2128 if ($('#wpadminbar').length > 0) { 2129 var height = parseInt($('#wpadminbar').outerHeight()) + parseInt($('.thim-top-landing').outerHeight()); 2130 } else { 2131 var height = parseInt($('.thim-top-landing').outerHeight()); 2132 } 2133 $('body, html').animate({ 2134 'scrollTop': height 2135 }, 600); 2136 } 2137 }); 2138 2139 }); 2140 $(document).ready(function () { 2141 //Shop filter color 2142 $('.woof_list input[data-tax="pa_color"]').each(function () { 2143 $(this).css('background-color', $(this).attr('name')); 2144 }); 2145 $('.woof_list input.woof_radio_term[name="pa_color"]').each(function () { 2146 $(this).css('background-color', $(this).data('slug')); 2147 }); 2148 }); 2149 2150 woof_js_after_ajax_done = function () { 2151 $('.woof_list input[data-tax="pa_color"]').each(function () { 2152 $(this).css('background-color', $(this).attr('name')); 2153 }); 2154 $('.woof_list input.woof_radio_term[name="pa_color"]').each(function () { 2155 $(this).css('background-color', $(this).data('slug')); 2156 }); 2157 2158 if ($('#thim-product-archive').hasClass('thim-product-list')) { 2159 $('.thim-product-switch-layout>a.switchToGrid.switch-active').removeClass('switch-active'); 2160 $('.thim-product-switch-layout>a.switchToList').addClass('switch-active'); 2161 } else { 2162 $('.thim-product-switch-layout>a.switchToList.switch-active').removeClass('switch-active'); 2163 $('.thim-product-switch-layout>a.switchToGrid').addClass('switch-active'); 2164 } 2165 2166 } 2167 2168 //Code for timetable widget 2169 $(document).ready(function () { 2170 2171 var tab_cat_course = $('.thim-carousel-course-categories-tabs'); 2172 tab_cat_course.each(function(){ 2173 tab_cat_course.find('.thim-course-slider .item').click(function(e){
2174 e.preventDefault(); 2175 tab_cat_course.find('.item_content.active').removeClass('active'); 2176 tab_cat_course.find($(this).find('.title a').attr('href')).addClass('active'); 2177 tab_cat_course.find('.thim-course-slider .item.active').removeClass('active'); 2178 $(this).addClass('active'); 2179 }); 2180 }); 2181 2182 var item_input = $('.form_developer_course .field_item input'); 2183 item_input 2184 .focusin(function() { 2185 $(this).parent().find('label').css('font-size', '12px'); 2186 $(this).parent().find('label').css('bottom', '20px'); 2187 }) 2188 .focusout(function() { 2189 if($(this).val()=='') { 2190 $(this).parent().find('label').css('font-size', '0px'); 2191 $(this).parent().find('label').css('bottom', '0px'); 2192 } 2193 }); 2194 2195 var item_input_new = $('.form_developer_course .content .yikes-easy-mc-form>label>input'); 2196 item_input_new 2197 .focusin(function() { 2198 $(this).parent().find('span').css('font-size', '14px'); 2199 $(this).parent().find('span').css('bottom', '36px'); 2200 }) 2201 .focusout(function() { 2202 if($(this).val()=='') { 2203 $(this).parent().find('span').css('font-size', '0px'); 2204 $(this).parent().find('span').css('bottom', '0px'); 2205 } 2206 }); 2207 2208 //Add class for nav-tabs single course 2209 var tab_course = $('.course-tabs .nav-tabs>li').length; 2210 if (tab_course > 0) { 2211 $('.course-tabs .nav-tabs>li').addClass('thim-col-' + tab_course); 2212 } 2213 2214 $('.thim-widget-timetable .timetable-item ').each(function () { 2215 var elem = $(this), 2216 old_style = elem.attr('style'), 2217 hover_style = elem.data('hover'); 2218 elem.on({ 2219 'mouseenter': function () { 2220 elem.attr('style', hover_style); 2221 }, 2222 'mouseleave': function () { 2223 elem.attr('style', old_style); 2224 } 2225 }) 2226 }); 2227 2228 //Resize window when click certificate tab on page profile 2229 $('.profile-tabs').each(function () { 2230 var elem = $(this); 2231 elem.find('a[href^=#user_certificates]').on('click', function () { 2232 $(window).resize(); 2233 if ($('.canvas-container').length > 0) { 2234 $('.canvas-container').trigger('click'); 2235 } 2236 }); 2237 }); 2238 2239 if (typeof LP != 'undefined') { 2240 LP.Hook.addAction('learn_press_receive_message', function () { 2241 var lesson_title = $('.course-item.item-current .course-item-title').text(), 2242 lesson_index = $('.course-item.item-current .index').text(); 2243 $('#popup-header .popup-title').html('<span class="index">' + lesson_index + '</span>' + lesson_title); 2244 }); 2245 } 2246 2247 $('.thim-video-popup .button-popup').on('click', function (e) { 2248 var item = $(this); 2249 e.preventDefault(); 2250 $.magnificPopup.open({ 2251 items : { 2252 src : item.parent().parent().find('.video-content'), 2253 type: 'inline' 2254 }, 2255 showCloseBtn: false, 2256 callbacks : { 2257 open: function () { 2258 $('body').addClass('thim-popup-active'); 2259 $.magnificPopup.instance.close = function () { 2260 $('body').removeClass('thim-popup-active'); 2261 $.magnificPopup.proto.close.call(this); 2262 }; 2263 }, 2264 } 2265 }); 2266 }); 2267 2268 $('.mc4wp-form #mc4wp_email').on('focus', function () { 2269 $(this).parents('.mc4wp-form').addClass('focus-input'); 2270 }).on('focusout', function () { 2271 $(this).parents('.mc4wp-form.focus-input').removeClass('focus-input'); 2272 }); 2273 2274 $(document).on('click', '.button-retake-course, .button-finish-course', function () { 2275 $('.thim-box-loading-container.visible').removeClass('visible'); 2276 }); 2277 2278 $(document).on('click', '.button-load-item', function () { 2279 $('#course-curriculum-popup').addClass('loading'); 2280 $('.thim-box-loading-container').addClass('visible'); 2281 }); 2282 2283 //Thim simple slider 2284 $('.thim-event-simple-slider').thim_simple_slider({ 2285 item : 3, 2286 itemActive : 1, 2287 itemSelector: '.item-event', 2288 align : 'right', 2289 pagination : true, 2290 navigation : true, 2291 height : 392, 2292 activeWidth : 1170, 2293 itemWidth : 800, 2294 prev_text : '<i class="fa fa-long-arrow-left"></i>', 2295 next_text : '<i class="fa fa-long-arrow-right"></i>' 2296 }); 2297 2298 $('.width-navigation .menu-main-menu>li.menu-item').last().addClass('last-menu-item'); 2299 2300 2301 //add mac-os to body class 2302 if (navigator.userAgent.indexOf('Mac') > 0) { 2303 $('body').addClass('mac-os'); 2304 } 2305 //add i-os to body class 2306 if(navigator.platform.match(/(iPhone|iPod|iPad)/i)) { 2307 $('body').addClass('i-os'); 2308 } 2309 2310 //Set padding for demo vc RTL 2311 setTimeout(function () { 2312 $(window).trigger('resize'); 2313 }, 1000); 2314 $(window).resize(function () { 2315 var get_padding1 = parseFloat($('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css('left')), 2316 get_padding2 = parseFloat($('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css('left')); 2317 if (get_padding1 != 'undefined') { 2318 $('body.rtl .vc_row-has-fill[data-vc-full-width="true"]').css({'right': get_padding1, 'left': ''}); 2319 } 2320 if (get_padding2 != 'undefined') { 2321 $('body.rtl .vc_row-no-padding[data-vc-full-width="true"]').css({'right': get_padding2, 'left': ''}); 2322 } 2323 }); 2324 2325
2326 //Course archive search filter 2327 var search_time_out = null; 2328 $(document).on('keyup', 'body:not(.course-filter-active) .course-search-filter', function (event) { 2329 if (event.ctrlKey) { 2330 return; 2331 } 2332 if (( event.keyCode >= 48 && event.keyCode <= 90 ) || event.keyCode == 8 || event.keyCode == 32) { 2333 var elem = $(this), 2334 keyword = elem.val(); 2335 2336 if (search_time_out != null) clearTimeout(search_time_out); 2337 search_time_out = setTimeout(function () { 2338 elem.attr('disabled', 'disabled'); 2339 search_time_out = null; 2340 $('body').addClass('course-filter-active').append('<div class="filter-loading"><div class="cssload-container"><div class="cssload-loading"><i></i><i></i><i></i><i></i></div></div></div>'); 2341 var url_ajax = window.location.protocol + "//" + window.location.host + window.location.pathname; 2342 url_ajax = url_ajax.replace(/\/page\/[0-9]+\/?/, '/'); 2343 var archive = elem.parents('#lp-archive-courses'); 2344 $.ajax({ 2345 type : 'POST', 2346 dataType: 'html', 2347 url : url_ajax + '?s=' + keyword + '&ref=course', 2348 success : function (html) { 2349 var archive_html = $(html).find('#lp-archive-courses').html(); 2350 archive.html(archive_html); 2351 $('.course-search-filter').val(keyword).trigger('focus'); 2352 $('body').removeClass('course-filter-active'); 2353 $('.filter-loading').remove(); 2354 }, 2355 error : function () { 2356 $('body').removeClass('course-filter-active'); 2357 $('.filter-loading').remove(); 2358 } 2359 }); 2360 2361 }, 1000); 2362 } 2363 }); 2364 2365 $(document).on('click', '.button-load-item', function () { 2366 can_escape = false; 2367 }); 2368 2369 $(document).on('keydown', function (event) { 2370 if (event.keyCode == 27) { 2371 if (typeof can_escape !== 'undefined') { 2372 if (can_escape === false) { 2373 event.preventDefault(); 2374 } 2375 } 2376 } 2377 2378 }); 2379 2380 //Add view password into checkbox field 2381 $('.login-password').append('<span id="show_pass"><i class="fa fa-eye"></i></span>'); 2382 $(document).on('click', '#show_pass', function () { 2383 var el = $(this), 2384 thim_pass = el.parents('.login-password').find('>input'); 2385 if (el.hasClass('active')) { 2386 thim_pass.attr('type', 'password'); 2387 } else { 2388 thim_pass.attr('type', 'text'); 2389 } 2390 el.toggleClass('active'); 2391 }); 2392 2393 $(document).on('click', '.content_course_2 .course_right .menu_course ul li a, .content_course_2 .thim-course-menu-landing .thim-course-landing-tab li a', function () { 2394 $('html, body').animate({ 2395 scrollTop: $($(this).attr('href')).offset().top 2396 }, 1000); 2397 }); 2398 2399 2400 $( window ).resize(function() { 2401 if($(window).width()>600) { 2402 $('footer#colophon.has-footer-bottom').css('margin-bottom',$('.footer-bottom').height()); 2403 } 2404 if($(window).width()<768) { 2405 $('body.course-item-popup').addClass('full-screen-content-item'); 2406 $('body.ltr.course-item-popup #learn-press-course-curriculum').css('left', '-300px'); 2407 $('body.ltr.course-item-popup #learn-press-content-item').css('left', '0'); 2408 $('body.rtl.course-item-popup #learn-press-course-curriculum').css('right', 'auto'); 2409 $('body.rtl.course-item-popup #learn-press-content-item').css('right', 'auto'); 2410 } 2411 }); 2412 2413 }); 2414 2415})(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.