1(function($) { 2"use strict"; 3var o = $("#nav >li.menu-item.current-menu-item,#nav >li.menu-item.current-menu-parent"); 4 if (o.length > 0) { 5 o.before('<span id="magic-line"></span>'); 6 var s = o.find(">a"), 7 r = o.position().left, 8 l = parseInt(s.css("padding-left")), 9 c = $("#magic-line"); 10 c.width(s.width()).css("left", Math.round(l + r)).data("magic-width", c.width()).data("magic-left", c.position().left) 11 } else { 12 var d = $("#nav >li.menu-item:first-child"); 13 d.after('<span id="magic-line"></span>'); 14 var c = $("#magic-line"); 15 c.data("magic-width", 0) 16 } 17 var u = parseInt($(".tb-header-menu-inner").outerHeight()); 18 c.css("bottom", u - (u - 90) / 2 - 64), $("#nav>li.menu-item:not(.tb_logo_center)").on({ 19 mouseenter: function() { 20 var t = $(this).find(">a"), 21 i = t.width(), 22 a = t.parent().position().left, 23 n = parseInt(t.css("padding-left")); 24 c.data("magic-left") || (c.css("left", Math.round(a + n)), c.data("magic-left", "auto")), c.stop().animate({ 25 left: Math.round(a + n), 26 width: i 27 }) 28 }, 29 mouseleave: function() { 30 c.stop().animate({ 31 left: c.data("magic-left"), 32 width: c.data("magic-width") 33 }) 34 } 35 }) 36 37var RaymondObj = { 38 39 tb_featured_video:function(){ 40 var _product_video = $('.video-featured-popup'); 41 if( _product_video.length === 0 ) return; 42 $('[data-toggle="tooltip"]').tooltip(); 43 var _template = '<div class="tb-overlay-bg"><div class="tb-overlay-container"><div class="tb-overlay-content"><div class="tb-iframe-scaler"><iframe class=" mfp-iframe" =""="" src="//www.youtube.com/embed/VIDEOID?autoplay=1" frameborder="0" allowfullscreen=""></iframe></div></div></div></div>'; 44 _product_video.on('click', function(e){ 45 e.preventDefault(); 46 var id = RaymondObj.get_video_id( $(this).attr('href') ); 47 if( id.length > 0 ){ 48 _template = _template.replace( 'VIDEOID', id ); 49 $('body').append(_template).find('.tb-overlay-bg').fadeIn(200); 50 } 51 }); 52 RaymondObj.tb_close_overlay(); 53 }, 54 tb_close_overlay: function(){ 55 $('body').on('click','.tb-overlay-content', function(e){ 56 e.stopPropagation(); 57 }).on('click','.tb-overlay-container', function(){ 58 59 var _parent = $($(this).closest('.tb-overlay-bg')); 60 console.log(_parent); 61 if( _parent.length ){ 62 _parent.fadeOut(); 63 } 64 }) 65 }, 66 get_video_id:function(url){ 67 var id = url.match( /^.*?(?:player.|www.)?(?:vimeo\.com|youtu(?:be\.com|\.be))\/(?:video\/|embed\/|watch\?v=)?([A-Za-z0-9._%-]*)(?:\&\S+)?/ ); 68 return id[1]; 69 }, 70 71 jws_theme_lightbox: function(){ 72 $('.tb-close-lightbox').on('click', function(e){ 73 e.preventDefault(); 74 var _parent = $($(this).attr('href')); 75 if( _parent.length ){ 76 _parent.fadeOut(); 77 } 78 }); 79 $('.tb-open-lightbox').on('click', function(e){ 80 e.preventDefault(); 81 var _parent = $($(this).attr('href')); 82 if( _parent.length ){ 83 _parent.fadeIn(); 84 if( _parent.hasClass('tb-send-mail-wrap') ){ 85 if( typeof $.cookie == 'function' && $.cookie('ckie_popup')==='true'){ 86 _parent.find('#tb-hide-popup').prop('checked',true); 87 } 88 89 } 90 } 91 }); 92 $('#tb-send_mail').on('click', function(e){ 93 e.stopPropagation(); 94 $(this).fadeOut(); 95 }).on('click','.tb-mail-inner', function(e){ 96 e.stopPropagation(); 97 }); 98 }, 99 jws_theme_match_height: function(){ 100 if( $(window).width() < 768 ) return; 101 RaymondObj._same_height = [$('.match-height'),$('.match-height-2')]; 102 103 $.each(RaymondObj._same_height, function(index, _element){ 104 if( ! _element || _element.length === 0 ){ 105 RaymondObj._same_height.splice(index, 1); 106 return; 107 } 108 _element.matchHeight(); 109 110 }); 111 112 $(window).on('resize', function(){ 113 if( $(window).width() > 768 && RaymondObj._same_height && RaymondObj._same_height.length ){ 114 $.each(RaymondObj._same_height, function(index, _element){ 115 _element.matchHeight(); 116 }); 117 } 118 }); 119 120 }, 121 122 jws_theme_same_height: function(){ 123 if( $(window).width() < 768 ) return; 124 var _same_height = $('.same-height'); 125 if( _same_height.length === 0 ) return; 126 _same_height.children().matchHeight(); 127 }, 128 jws_theme_grid_gallery: function(){ 129 130 $( '#tb-list-gallery' ).gridrotator( { 131 132 preventClick : false, 133 maxStep : 2, 134 w1024 : { 135 rows : 1, 136 columns : 4 137 }, 138 w768 : { 139 rows : 1, 140 columns : 3 141 }, 142 w320 : { 143 rows : 1, 144 columns : 1 145 }, 146 w240 : { 147 rows : 1, 148 columns : 1 149 } 150 } ); 151 $('#tb-list-gallery .cb-popup').on('click', function(e){ 152 e.preventDefault(); 153 }); 154 }, 155 jws_theme_grid_instagram: function(){ 156 $( '#instagram_feed' ).gridrotator( { 157 rows : 2, 158 columns : 3, 159 160 w1024 : { 161 rows : 2, 162 columns : 3 163 }, 164 165 w768 : { 166 rows : 2, 167 columns : 3 168 }, 169 170 w480 : { 171 rows : 2, 172 columns : 3 173 }, 174 175 w320 : { 176 rows : 2, 177 columns : 3 178 }, 179 180 w240 : { 181 rows : 2, 182 columns : 3 183 }, 184 } ); 185 }, 186 jws_theme_gallery_grid: function(){ 187 $( '#gallery_grid_widget' ).gridrotator( { 188 rows : 2, 189 columns : 3, 190 191 w1024 : { 192 rows : 2, 193 columns : 3 194 }, 195 196 w768 : { 197 rows : 2, 198 columns : 3 199 }, 200 201 w480 : { 202 rows : 2, 203 columns : 3 204 }, 205 206 w320 : { 207 rows : 2, 208 columns : 3 209 }, 210 211 w240 : { 212 rows : 2, 213 columns : 3 214 }, 215 } ); 216 }, 217 jws_theme_porfolio_masonry: function(){ 218 var _masonry = $('.tpl1 .grid-portfolio'); 219 if( _masonry.length === 0 ) return; 220 var _gallery_masonry = _masonry.masonry({ 221 // options 222 itemSelector: '.grid-item', 223 // columnWidth: 480, 224 gutter: 0, 225 percentPosition: true 226 }); 227 228 }, 229 jws_theme_portfolio:function(){ 230 var _gallery = $('#tb-list-portfolio'); 231 if( _gallery.length === 0 ) return; 232 var loaded = false;
233 if( _gallery.find('.grid-portfolio').length > 0 ){ 234 RaymondObj._grid = _gallery.find('.grid-portfolio').isotope( 235 { 236 itemSelector: '.grid-item', 237 percentPosition: true, 238 gutter: 0, 239 masonry: { 240 columnWidth: '.grid-item' 241 } 242 } 243 ); 244 $('.controls-filter').on( 'click', '.filter', function() { 245 var filterValue = $(this).data('filter'); 246 RaymondObj._grid.isotope({ filter: filterValue }); 247 $(this).addClass('active').siblings('.filter').removeClass('active'); 248 }); 249 }; 250 }, 251 jws_theme_show_product_cat: function(){ 252 var _parent_cat = $('.product-categories').find('.cat-parent'); 253 if( _parent_cat.length === 0 ) return; 254 _parent_cat.on('click','> a', function(e){ 255 e.preventDefault(); 256 $(this).nextAll('.children').removeClass('fadeOutRight').addClass('animated fadeInLeft').parent().toggleClass('open').siblings('.open').removeClass('open'); 257 }); 258 }, 259 jws_theme_single_vertical:function(){ 260 var _slideshow = $('#tb-single-vertical'); 261 if( _slideshow.length === 0 ) return; 262 _slideshow.cycle(); 263 _slideshow.find('.cycle-carousel-wrap').on('click', 'img', function(e){ 264 $('.yith_magnifier_gallery').children('li').eq($(this).data('id')).children('a').trigger('click'); 265 }); 266 267 $(window).on('resize', function(){ 268 _slideshow.height( _slideshow.closest('.images').find('a').height() - 60 ); 269 }) 270 271 _slideshow.one('cycle-update-view', function(e){ 272 _slideshow.hide().closest('.ro-product-wrapper').addClass('vertical-slider'); 273 $(window).trigger('resize'); 274 _slideshow.fadeIn(); 275 }) 276 }, 277 // custom single woo slider 278 jws_theme_fixheight_slider:function(){ 279 RaymondObj._yith_carousel = $('.ro-product-wrapper .caroufredsel_wrapper'); 280 if( RaymondObj._yith_carousel.length ){ 281 282 RaymondObj._yith_carousel.css('max-height', RaymondObj._yith_carousel.find('li').first().height() ); 283 } 284 }, 285 286 287 jws_theme_currence_form: function(){ 288 var _form = $('form.woocommerce-currency-switcher-form'); 289 if( _form.length === 0 ) return; 290 _form.attr('action', window.location.href ); 291 }, 292 jws_theme_set_stick_bar:function( header_offset ){ 293 RaymondObj._header_offset = ( header_offset ) ? header_offset : ( ( RaymondObj._header_offset ) ? RaymondObj._header_offset : ( $('.tb-header-wrap .tb-header-menu').length > 0 ) ? $('.tb-header-wrap .tb-header-menu').height() : 0 ); 294 if( RaymondObj._header_offset ){ 295 setTimeout(function(){ 296 if ($(window).scrollTop() > RaymondObj._header_offset/2 || ($(window).scrollTop() + $(window).height()) > ($(document).height() - 5) ) { 297 $('body').addClass('tb-stick-active'); 298 } else { 299 $('body').removeClass('tb-stick-active'); 300 } 301 }, 500) 302 303 } 304 }, 305 jws_theme_dub_tb_menu_bar: function(){ 306 var _tb_lg_menu_bar = $('#tb-lg-menu-sidebar'); 307 if( _tb_lg_menu_bar.length === 0 ) return; 308 $('.tb-header-menu').find('.tb-menu-sidebar').first().empty().append( _tb_lg_menu_bar.html() ); 309 }, 310 jws_theme_load_more:function(){ 311 var _load_more = $('.tb-view-more-link'); 312 if( _load_more.length === 0 ) return; 313 _load_more.on('click', 'a', function(e){ 314 e.preventDefault(); 315 var data = {}, 316 _this = $(this); 317 data.args = _this.data('args'), 318 data.atts =_this.data('atts'); 319 320 RaymondObj.jws_theme_post( 'load_more_products', data ).done( function(data){ 321 data = $.parseJSON( data ); 322 var _parent = _this.closest('.tb-view-more-link'); 323 if(data.content){ 324 _parent.prev('.tb-products-grid').append(data.content); 325 } 326 if( data.page ){ 327 _parent.next('.pagination').empty().append(data.page); 328 } 329 if( data.args ){ 330 _this.data('args', data.args ); 331 if( data.max ){ 332 _this.parent().fadeOut(); 333 } 334 }else{ 335 _this.parent().fadeOut(); 336 } 337 }) 338 }); 339 }, 340 jws_theme_added_viewcart:function( _this ){ 341 var _next = _this.next('a'); 342 if( wc_add_to_cart_params.i18n_view_cart.length === 0 || _this.parent().attr('data-original-title') === wc_add_to_cart_params.i18n_view_cart ) return; 343 _next.hide(); 344 _this.parent().attr('data-original-title', wc_add_to_cart_params.i18n_view_cart ).delay(200).tooltip('show'); 345 _this.attr('href', wc_add_to_cart_params.cart_url ); 346 }, 347 jws_theme_added_wishlist:function( _this ){ 348 var browser_text = _this.parent().next().children('a').text(); 349 if( RaymondObj.wishlisted && _this.text() == browser_text ) return; 350 _this.closest('[data-toggle="tooltip"]').attr('data-original-title', browser_text).delay(200).tooltip('show'); 351 RaymondObj.wishlisted = true; 352 }, 353 jws_theme_refresh_addtocart:function( _this, callback ){ 354 var _refresh_viewcart = setInterval( function(){
355 RaymondObj[callback](_this); 356 }, 450); 357 setTimeout( function(){ 358 clearInterval( _refresh_viewcart ); 359 },1200); 360 }, 361 jws_theme_custom_scroll_v4: function(){ 362 var _mobile_nav = $('.mobile-leftbar'); 363 if( _mobile_nav.length===0 ) return; 364 _mobile_nav.mCustomScrollbar(); 365 $('#mobile-bar-v4,.br-button').on('click', function(){ 366 _mobile_nav.toggleClass('active'); 367 }); 368 _mobile_nav.on('click',function(e){ 369 e.stopPropagation(); 370 }); 371 $('body').on('click', function(e){ 372 if( ! _mobile_nav.hasClass('active') ) return; 373 _mobile_nav.removeClass('active'); 374 }); 375 }, 376 jws_theme_change_layout:function(){ 377 var _archive = $('.archive-products'); 378 if( _archive.length === 0 ) return; 379 _archive.on('click','.jws_theme_action_layout', function(e){ 380 var cols = 3; 381 if( $(this).hasClass('jws_theme_action_list') ){ 382 cols = 1; 383 }else if( _archive.hasClass('grid-full-width') ){ 384 cols = 4; 385 } 386 387 _archive.find(':hidden[name="columns"]').prop('value', cols).removeAttr('disabled'); 388 389 setTimeout( function(){ 390 _archive.find('form.woocommerce-ordering').submit(); 391 },100); 392 e.preventDefault(); 393 }).find('.tb-after-shop-loop .woocommerce-result-count').on('click','.jws_theme_action', function(e){ 394 e.preventDefault(); 395 var index = $(this).index(); 396 _archive.find('.jws_theme_action_layout').eq(index-1).trigger('click'); 397 }); 398 399 }, 400 jws_theme_change_price: function(){ 401 var _list_price = $('#tb-list-price'); 402 if( _list_price.length === 0 ) return; 403 _list_price.find('option').each( function(){ 404 var value = $(this).val(), 405 detail = value.split('-'), 406 symbol = woocommerce_price_slider_params.currency_symbol; 407 if( woocommerce_price_slider_params.currency_pos === 'left' ){ 408 value = [symbol,parseFloat( detail[0] ),' - ', symbol, parseFloat( detail[1] ) ]; 409 value = value.join(''); 410 }else{ 411 value = [parseFloat( detail[0] ), symbol, ' - ', parseFloat( detail[1] ), symbol]; 412 value = value.join(''); 413 } 414 $(this).text( value ); 415 }); 416 _list_price.on('change', function(){ 417 var _this = $(this), 418 value = _this.val(), 419 detail = value.split('-'); 420 _this.next('#min_price').prop('value',parseFloat( detail[0] ) ).next('#max_price').prop('value',parseFloat( detail[1] ) ); 421 _this.attr('disabled','disabled'); 422 setTimeout( function(){ 423 _this.closest('form').submit(); 424 },100); 425 }); 426 }, 427 jws_theme_fixed_zindex:function(){ 428 var _full_search = $('.full_search'); 429 if( _full_search.length === 0 ) return; 430 $('.icon_search_wrap').on('click', function(){ 431 $('body').addClass('tb-fixed-zindex'); 432 }); 433 }, 434 jws_theme_time_popup: function(){ 435 var _send_mail = $('#tb-send_mail'); 436 437 if( _send_mail.length === 0 || typeof $.cookie === undefined) return; 438 var _ckie_popup = $.cookie('ckie_popup'); 439 440 if( the_ajax_script.show_popup_mail && $.cookie('ckie_popup')!=='true' ){ 441 _send_mail.fadeIn(); 442 } 443 444 _send_mail.find('#tb-hide-popup').on('change', function(){ 445 console.log($(this).is(':checked')) 446 if( $(this).is(':checked') ){ 447 $.cookie('ckie_popup', true, { expires: 30, path: '/' }); 448 }else{ 449 $.cookie('ckie_popup', false, { expires: -50, path: '/' }); 450 } 451 }) 452 453 }, 454 jws_theme_porfolio:function(){ 455 var _porfolio = $('#tb-list-portfolio'); 456 if( _porfolio.length === 0 ) return; 457 if( _porfolio.find('#portfolio-container').length > 0 ){ 458 _porfolio.find('#portfolio-container').mixItUp(); 459 }; 460 461 var _template = '<div class="tb-overlay-bg"><div class="tb-overlay-container"><div class="tb-overlay-content content-lightbox"><div class="portfolio-lightbox"><img class="img-responsive" src="IMGURL"><button title="Close (Esc)" type="button" class="tb-close"><i class="fa fa-times"></i></button></div></div></div></div>'; 462 463 _porfolio.on('click', 'a.cb-popup', function(e){ 464 e.preventDefault(); 465 var img = $(this).attr('href'); 466 if( img.length > 0 ){ 467 $('body').append(_template.replace( 'IMGURL', img )).find('.tb-overlay-bg').fadeIn(200); 468 } 469 }) 470 471 RaymondObj.jws_theme_close_overlay(); 472 $('body').on('click','button.tb-close', function(e){ 473 e.preventDefault(); 474 $('body').find('.tb-overlay-bg').fadeOut( function(){ 475 $(this).remove(); 476 }) 477 }) 478 }, 479 jws_theme_back_to_top:function(){ 480 // Back to top btn 481 var _jws_theme_back_to_top = $('#jws_theme_back_to_top'); 482 var _wHei = $(window).height(); 483 $(document).on('scroll',function () { 484 /* back to top */ 485 var scroll_top = $(window).scrollTop(); 486 if ( scroll_top < _wHei ) { 487 _jws_theme_back_to_top.addClass('no-active').removeClass('active'); 488 } else { 489 _jws_theme_back_to_top.removeClass('no-active').addClass('active'); 490 } 491 }); 492 _jws_theme_back_to_top.click(function () { 493 $("html, body").animate({ 494 scrollTop: 0 495 }, 1500); 496 }); 497 }, 498 499 jws_theme_viewmore: function(){ 500 501 var _view_more = $('#tb-btn-viewmore'); 502 if( _view_more.lenght === 0 ) return; 503 _view_more.on('click', function(e){ 504 e.preventDefault(); 505 var _this = $(this), 506 _page = _this.attr('href'), 507 data = { 508 'link': _page, 509 'args': _this.data('args'), 510 'options': _this.data('options') 511 }; 512 data.args.paged = _page.replace(/\D/g,''); 513 514 RaymondObj.jws_theme_post( 'update_portfolio', data ).done( function(data){ 515 data = $.parseJSON( data ); 516 if( data.content.length > 0 ){ 517 var _porfolio = _this.closest('#tb-list-portfolio'); 518 _porfolio.find('#portfolio-container').append( data.content ); 519 if( _porfolio.find('.controls-filter').length ){ 520 var filter = _porfolio.find('.controls-filter').find('.active').data('filter'); 521 _porfolio.find('#portfolio-container').mixItUp( 'filter', filter ); 522 } 523 524 // change viewmore 525 if( data.paged ){ 526 _this.attr('href', '#page/'+data.paged ); 527 }else{ 528 _this.fadeOut('slow'); 529 } 530 531 // change pagination 532 if( _porfolio.find('.pagination ').length ){ 533 if( data.pagination.length ){ 534 _porfolio.find('.pagination ').empty().append( data.pagination ); 535 var _template = '<div class="tb-overlay-bg"><div class="tb-overlay-container"><div class="tb-overlay-content content-lightbox"><div class="portfolio-lightbox"><img class="img-responsive" src="IMGURL"><button title="Close (Esc)" type="button" class="tb-close"><i class="fa fa-times"></i></button></div></div></div></div>'; 536 $('body .cb-popup').on('click', function(e){ 537 e.preventDefault(); 538 var img = $(this).attr('href'); 539 if( img.length > 0 ){ 540 $('body').append(_template.replace( 'IMGURL', img )).find('.tb-overlay-bg').fadeIn(200); 541 } 542 }) 543 }else{ 544 _porfolio.find('.pagination').fadeOUt(); 545 } 546 } 547 548 } 549 }); 550 }) 551 }, 552 jws_theme_wrap_carousel: function( _element ){ 553 if( _element.length === 0 ) return; 554 _element.parent().addClass('tb-wrap-carousel'); 555 }, 556 jws_theme_post: function( action, data ){ 557 data = { 558 'action': 'jws_theme_'+action, 559 'data': data 560 }; 561 return $.post( the_ajax_script.ajaxurl, data ); 562 }, 563 jws_theme_carousel: function( items, element, assiged ){ 564 var _element = $(element+items); 565 if( _element.length === 0 && assiged ){ 566 _element = $(element); 567 RaymondObj.assiged = true; 568 } 569 if( _element.length === 0 ) return; 570 var _carousel_ops = { 571 loop:true, 572 margin:30, 573 navText:['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 574 dots:true, 575 responsiveClass:true, 576 responsive:{ 577 0:{ 578 items:1, 579 }, 580 768:{ 581 items: ( items > 2 ) ? ( items - 2 ) : ( items > 1 ) ? ( items - 1) : items, 582 }, 583 992:{ 584 items: ( items > 1 ) ? ( items - 1 ) : items, 585 }, 586 1200:{ 587 items:items, 588 nav:true, 589 } 590 } 591 }; 592 593 var owl = _element.find('.owl-carousel').owlCarousel( _carousel_ops ); 594 owl.on('mouseenter translated.owl.carousel', function(event) { 595 RaymondObj.jws_theme_add_end_class( $(this) ); 596 }); 597 598 RaymondObj.jws_theme_set_pos_owlnav( _element ); 599 RaymondObj.jws_theme_wrap_carousel( _element ); 600 }, 601 jws_theme_add_end_class: function( _element ){ 602 _element.find('.owl-item.active').last().addClass('end').siblings('.active').removeClass('end'); 603 }, 604 jws_theme_set_pos_owlnav: function( _element ){ 605 if( _element.length === 0 ) return; 606 _element.on('mouseenter', function(){ 607 if( ! RaymondObj.set_pos ){ 608 var top = _element.find('.tb-image,.tb-thumb').first().height()/2; 609 if( top ){ 610 _element.find('.owl-prev').css('top', top).next('.owl-next').css('top', top); 611 } 612 RaymondObj.set_pos = true; 613 } 614 }) 615 616 }, 617 jws_theme_slider: function( _element, options ){ 618 // var _collection_slider = $('#colection_slider'); 619 options = $.extend( { 620 pagination: '.swiper-pagination', 621 paginationClickable: true 622 }, options ); 623 var swiper = new Swiper(_element, options); 624 }, 625 jws_product_cats_carousel: function(){ 626 var _cats_carousel = $('.tb-product-cats-carousel'), 627 _cats_carousel_large = $('.tb-product-cats-carousel-large');
628 if( _cats_carousel.length == 0 && _cats_carousel_large.length==0 ) return; 629 var _carousel_ops = { 630 loop:true, 631 margin:0, 632 navText:['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 633 dots:false, 634 responsiveClass:true, 635 responsive:{ 636 0:{ 637 items:1, 638 }, 639 768:{ 640 items: 2, 641 }, 642 992:{ 643 items: 3, 644 }, 645 1200:{ 646 items:3, 647 nav:true, 648 } 649 } 650 }; 651 _cats_carousel.find('.tb-product-items').owlCarousel( _carousel_ops ); 652 _carousel_ops = $.extend({}, _carousel_ops, { 653 responsive:{ 654 0:{ 655 items:1, 656 }, 657 768:{ 658 items: 2, 659 }, 660 992:{ 661 items: 2, 662 }, 663 1200:{ 664 items:2, 665 nav:true, 666 } 667 } 668 }); 669 _cats_carousel_large.find('.tb-product-items').owlCarousel( _carousel_ops ); 670 }, 671 jws_theme_owl_carousel: function(){ 672 // setTimeout(function(){ 673 $('.vc_images_carousel').each(function(){ 674 var _this = $(this), 675 items = _this.data('per-view'), 676 show_nav = ! _this.data('hide-nav'); 677 _this.find('.vc_carousel-slideline-inner').owlCarousel({ 678 items:items, 679 loop:true, 680 margin:30, 681 navText:['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 682 dots:false, 683 responsiveClass:true, 684 responsive:{ 685 0:{ 686 items:(2 < items) ? 2 : items, 687 }, 688 768:{ 689 items:(3 < items) ? 3 : items, 690 }, 691 992:{ 692 items:( 4 < items) ? 4 : items, 693 nav:show_nav 694 }, 695 1200:{ 696 items:items, 697 nav:show_nav, 698 } 699 } 700 }); 701 }); 702 // }, 1000); 703 }, 704 jws_theme_incremental: function(){ 705 var _increment = $('.tb-counter'); 706 if( _increment.length === 0 ) return; 707 _increment.each( function(){ 708 $(this).find('.counter').counterUp({ 709 delay: 10, 710 time: 1000 711 }); 712 }) 713 }, 714 jws_theme_disabled_on_mobile: function(){ 715 if( ! window.jws_theme_is_mobile_tablet ) return; 716 $('.product').on('click', '.tb-image', function(e){ 717 e.preventDefault(); 718 }) 719 }, 720 jws_theme_mega_nav: function( ){ 721 var _ct_nav = $('.ct-inc-megamenu'), 722 _main_nav = $('#menu-primary-menu'); 723 if( _ct_nav.length === 0 || _main_nav.length === 0 ) return; 724 RaymondObj.nav_maxwid = _ct_nav.next().width(); 725 RaymondObj.nav_maxwid = RaymondObj.nav_maxwid > 992 ? 992 : RaymondObj.nav_maxwid; 726 _main_nav.find('.drop_full_width').attr('style','width:'+ RaymondObj.nav_maxwid +'!important' ); 727 728 }, 729 jws_theme_mega_search: function(){ 730 var _mega_search = $('#tb-mega-searchform'); 731 if( _mega_search.length === 0 ) return; 732 _mega_search.on('change', 'select', function(){ 733 var cat = $(this).val(); 734 if( cat.length == 0 ){ 735 _mega_search.find('input[name="cat"]').attr('disabled', true); 736 }else{ 737 _mega_search.find('input[name="cat"]').removeAttr('disabled').prop('value', cat ); 738 } 739 }); 740 }, 741 jws_theme_featured_video:function(){ 742 var _product_video = $('.product-video-popup'); 743 if( _product_video.length === 0 ) return; 744 $('[data-toggle="tooltip"]').tooltip({ 745 trigger: 'manual' 746 }); 747 748 var _template = '<div class="tb-overlay-bg"><div class="tb-overlay-container"><div class="tb-overlay-content"><div class="tb-iframe-scaler"><iframe class=" mfp-iframe" =""="" src="//www.youtube.com/embed/VIDEOID?autoplay=1" frameborder="0" allowfullscreen=""></iframe></div></div></div></div>'; 749 _product_video.on('click', function(e){ 750 e.preventDefault(); 751 var id = RaymondObj.get_video_id( $(this).attr('href') ); 752 if( id.length > 0 ){ 753 _template = _template.replace( 'VIDEOID', id ); 754 $('body').append(_template).find('.tb-overlay-bg').fadeIn(200); 755 } 756 }); 757 RaymondObj.jws_theme_close_overlay(); 758 }, 759 jws_theme_close_overlay: function(){ 760 $('body').on('click','.tb-overlay-content', function(e){ 761 e.stopPropagation(); 762 }).on('click','.tb-overlay-container', function(){ 763 $(this).parent().fadeOut( function(){ 764 $(this).remove(); 765 }); 766 }) 767 }, 768 get_video_id:function(url){ 769 var id = url.match( /^.*?(?:player.|www.)?(?:vimeo\.com|youtu(?:be\.com|\.be))\/(?:video\/|embed\/|watch\?v=)?([A-Za-z0-9._%-]*)(?:\&\S+)?/ ); 770 return id[1]; 771 }, 772 jws_theme_light_box: function(){ 773 var _template = '<div class="tb-overlay-bg"><div class="tb-overlay-container"><div class="tb-overlay-content content-lightbox"><div class="portfolio-lightbox"><img class="img-responsive" src="IMGURL"><button title="Close (Esc)" type="button" class="tb-close"><i class="fa fa-times"></i></button></div></div></div></div>'; 774 $('body .cb-popup').on('click', function(e){ 775 e.preventDefault(); 776 var img = $(this).attr('href'); 777 if( img.length > 0 ){ 778 $('body').append(_template.replace( 'IMGURL', img )).find('.tb-overlay-bg').fadeIn(200); 779 } 780 }); 781 $('body').on('click','button.tb-close', function(e){ 782 e.preventDefault(); 783 $('body').find('.tb-overlay-bg').fadeOut( function(){ 784 $(this).remove(); 785 }) 786 }) 787 }, 788 jws_theme_light_box_2: function(){ 789 $('#tb-list-gallery .cb-popup').on('click', function(e){ 790 791 $('#tb-list-gallery .tb-overlay-bg').fadeIn(200); 792 }); 793 $('body').on('click','button.tb-close', function(e){ 794 e.preventDefault(); 795 $('body').find('.tb-overlay-bg').fadeOut( function(){ 796 $(this).remove(); 797 }) 798 }) 799 }, 800 jws_theme_detect_ie: function(){ 801 var ua = window.navigator.userAgent; 802 803 var msie = ua.indexOf('MSIE '); 804 if (msie > 0) { 805 // IE 10 or older => return version number 806 return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 807 } 808 809 var trident = ua.indexOf('Trident/'); 810 if (trident > 0) { 811 // IE 11 => return version number 812 var rv = ua.indexOf('rv:'); 813 return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); 814 } 815 816 var edge = ua.indexOf('Edge/'); 817 if (edge > 0) { 818 // Edge (IE 12+) => return version number
819 return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); 820 } 821 822 // other browser 823 return false; 824 }, 825 jws_theme_fixed_currence_form: function(){ 826 var _form = $('form.woocommerce-currency-switcher-form'); 827 if( _form.length === 0 ) return; 828 _form.attr('action', window.location.href ); 829 }, 830 jws_theme_sloved_testimonial:function(){ 831 var _testimonial_top = $('.tb-testimonial-1.tpl'); 832 if( _testimonial_top.length === 0 ) return; 833 _testimonial_top.parent().parent().addClass('ct-testimonial'); 834 }, 835 836 jws_theme_run_ready:function(){ 837 // lightbox 838 RaymondObj.tb_featured_video(); 839 RaymondObj.jws_theme_currence_form(); 840 RaymondObj.jws_theme_lightbox(); 841 RaymondObj.jws_theme_dub_tb_menu_bar(); 842 RaymondObj.jws_theme_change_layout(); 843 RaymondObj.jws_theme_show_product_cat(); 844 RaymondObj.jws_theme_portfolio(); 845 RaymondObj.jws_theme_porfolio_masonry(); 846 RaymondObj.jws_theme_single_vertical(); 847 RaymondObj.jws_theme_load_more(); 848 RaymondObj.jws_theme_change_price(); 849 RaymondObj.jws_product_cats_carousel(); 850 RaymondObj.jws_theme_porfolio(); 851 RaymondObj.jws_theme_viewmore(); 852 RaymondObj.jws_theme_carousel( 4,'.tb-product-carousel', true ); 853 RaymondObj.jws_theme_carousel( 3, '.tb-product-carousel' ); 854 RaymondObj.jws_theme_carousel( 3, '.tb-porfolio-carousel' ); 855 RaymondObj.jws_theme_carousel( 2, '.tb-product-carousel' ); 856 RaymondObj.jws_theme_carousel( 1, '.tb-product-carousel', true ); 857 RaymondObj.jws_theme_carousel( 1, '.post-carousel .owl-carousel', true ); 858 RaymondObj.jws_theme_incremental(); 859 RaymondObj.jws_theme_back_to_top(); 860 RaymondObj.jws_theme_disabled_on_mobile(); 861 RaymondObj.jws_theme_custom_scroll_v4(); 862 RaymondObj.jws_theme_mega_search(); 863 RaymondObj.jws_theme_fixed_zindex(); 864 RaymondObj.jws_theme_featured_video(); 865 RaymondObj.jws_theme_sloved_testimonial(); 866 RaymondObj.jws_theme_match_height(); 867 RaymondObj.jws_theme_grid_gallery(); 868 RaymondObj.jws_theme_same_height(); 869 RaymondObj.jws_theme_grid_instagram(); 870 RaymondObj.jws_theme_gallery_grid(); 871 //RaymondObj.jws_theme_time_popup(); 872 RaymondObj.jws_theme_light_box(); 873 RaymondObj.jws_theme_light_box_2(); 874 // RaymondObj.jws_theme_mega_nav(); 875 RaymondObj.jws_theme_owl_carousel(); 876 RaymondObj.tb_close_overlay(); 877 if( RaymondObj.jws_theme_detect_ie() ){ 878 $('html').addClass('ie'); 879 } 880 RaymondObj.jws_theme_fixed_currence_form(); 881 // RaymondObj.jws_theme_slider( '#colection_slider .swiper-container' ); 882 } 883}; 884 885$(document).ready(function() { 886 // tooltip 887 RaymondObj.jws_theme_run_ready(); 888 889 $('.tb-btn-prod').on('click','.btn-add-to-cart', function(e){ 890 // if( ! $(this).hasClass('product_type_variable') ){ 891 e.preventDefault(); 892 var _this = $(this); 893 if( _this.hasClass('added') ){ 894 location.href=_this.next('a').attr('href'); 895 }else{ 896 RaymondObj.jws_theme_refresh_addtocart( _this, 'jws_theme_added_viewcart' ); 897 } 898 // } 899 }).on('click','.yith-wcwl-add-button a', function(e){ 900 e.preventDefault(); 901 var _this = $(this); 902 RaymondObj.jws_theme_refresh_addtocart( _this, 'jws_theme_added_wishlist' ); 903 }); 904 905 906 // fix header v4 907 908 $('.teacher .owl-carousel').owlCarousel({ 909 loop:true, 910 margin:30, 911 navText:['<i class="fa fa-long-arrow-left"></i>', '<i class="fa fa-long-arrow-right"></i>'], 912 items:1, 913 responsiveClass:true, 914 responsive:{ 915 1200:{ 916 nav:true, 917 } 918 }, 919 dots:false, 920 }); 921 $('.post-carousel .owl-carousel').owlCarousel({ 922 loop:true, 923 navText:['<i class="fa fa-long-arrow-left"></i>', '<i class="fa fa-long-arrow-right"></i>'], 924 items:1, 925 responsiveClass:true, 926 responsive:{ 927 1200:{ 928 nav:true, 929 } 930 }, 931 dots:false, 932 }); 933 934 935 //RaymondObj.jws_theme_set_pos_owlnav( $('.teacher') ); 936 937 $('.tb-category-slider .tb-product-items').owlCarousel({ 938 loop:true, 939 margin:30, 940 navText:['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 941 dots:false, 942 responsiveClass:true, 943 responsive:{ 944 0:{ 945 items:1, 946 }, 947 768:{ 948 items:2, 949 }, 950 992:{ 951 items:3, 952 }, 953 1200:{ 954 items:4, 955 nav:true, 956 } 957 } 958 }); 959 960 RaymondObj.jws_theme_wrap_carousel( $('.tb-blog-carousel' ) ); 961 962 function ROtesttimonialSlider($elem) { 963 if ($elem.length) { 964 $elem.each( function() { 965 $(this).flexslider({ 966 animation: "slide", 967 animationLoop: false, 968 controlNav: false, 969 slideshow: true, 970 directionNav: true, 971 prevText:'<i class="fa fa-angle-left"></i>', 972 nextText:'<i class="fa fa-angle-right"></i>' 973 }); 974 }); 975 } 976 } 977 ROtesttimonialSlider($('.tb-testimonial-1')); 978 ROtesttimonialSlider($('#colection_slider')); 979 $('.tb-portfolio-flexslider').flexslider({ 980 animation: "slide", 981 animationLoop: true, 982 controlNav: false, 983 slideshow: true, 984 directionNav: true, 985 prevText:'<i class="fa fa-angle-left"></i>', 986 nextText:'<i class="fa fa-angle-right"></i>' 987 }); 988 function ROzoomImage() { 989 var $window = $(window); 990 $("#Ro_zoom_image > img").elevateZoom({ 991 zoomType: "lens", 992 responsive: true, 993 containLensZoom: true, 994 cursor: 'pointer', 995 gallery:'Ro_gallery_0', 996 borderSize: 3, 997 borderColour: "#84C340", 998 galleryActiveClass: "ro-active", 999 loadingIcon: 'http://www.elevateweb.co.uk/spinner.gif' 1000 }); 1001 1002 $("#Ro_zoom_image > img").on("click", function(e) { 1003 var ez = $('#Ro_zoom_image > img').data('elevateZoom'); 1004 $.fancybox(ez.getGalleryList()); 1005 return false;
1006 }); 1007 } 1008 // ROzoomImage(); 1009 function ROheadervideo() { 1010 $("#ro-play-button").on("click", function(e){ 1011 e.preventDefault(); 1012 $.fancybox({ 1013 'padding' : 0, 1014 'autoScale': false, 1015 'transitionIn': 'none', 1016 'transitionOut': 'none', 1017 'title': this.title, 1018 'width': 720, 1019 'height': 405, 1020 'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'), 1021 'type': 'swf', 1022 'swf': { 1023 'wmode': 'transparent', 1024 'allowfullscreen': 'true' 1025 } 1026 }); 1027 }); 1028 } 1029 ROheadervideo(); 1030 1031 1032 /** 1033 * Add Product Quantity Up Down icon 1034 */ 1035 $('form.cart .quantity').each(function() { 1036 $(this).prepend('<span class="qty-minus"><i class="fa fa-minus"></i></span>'); 1037 $(this).append('<span class="qty-plus"><i class="fa fa-plus"></i></span>'); 1038 }); 1039 /* Plus Qty */ 1040 $(document).on('click', '.qty-plus', function() { 1041 var parent = $(this).parent(); 1042 $('input.qty', parent).val( parseInt($('input.qty', parent).val()) + 1); 1043 }) 1044 /* Minus Qty */ 1045 $(document).on('click', '.qty-minus', function() { 1046 var parent = $(this).parent(); 1047 if( parseInt($('input.qty', parent).val()) > 1) { 1048 $('input.qty', parent).val( parseInt($('input.qty', parent).val()) - 1); 1049 } 1050 }) 1051 1052 /* On Page Cart */ 1053 $('#tb-tab-container').easytabs(); 1054 1055 1056 //countdown 1057 var $tb_countdown_js = $('.jws-countdown-js'); 1058 if($tb_countdown_js.length > 0){ 1059 $tb_countdown_js.each(function(){ 1060 var $this = $(this), 1061 dateEnd = $this.data('countdown'); 1062 1063 $this.countdown(dateEnd, function(event){ 1064 var $this = $(this).html(event.strftime('' 1065 + '<span class="jws-box-countdown"><span>%D</span> <p>Days</p></span> ' 1066 + '<span class="jws-box-countdown"><span>%H</span> <p>Hours</p></span> ' 1067 + '<span class="jws-box-countdown"><span>%M</span> <p>Minutes</p></span> ' 1068 + '<span class="jws-box-countdown"><span>%S</span> <p>Seconds</p></span>')); 1069 }); 1070 }) 1071 } 1072 /* Click btn search & cart on header */ 1073 var _jws_theme_mini_cart = $('.wrap-mini-cart'); 1074 if( _jws_theme_mini_cart.length ){ 1075 1076 if($('.shopping_cart_dropdown').length > 0){ 1077 $('.tb-header-wrap').off('click').on('click','a.icon_cart_wrap', function (e) { 1078 if( $(window).width() > 767 ){ 1079 e.preventDefault(); 1080 } 1081 e.stopPropagation(); 1082 //_jws_theme_mini_cart.find(".active").removeClass('active'); 1083 $(this).closest('.widget_mini_cart_wrap ').children('.shopping_cart_dropdown').toggleClass('active'); 1084 1085 }); 1086 } 1087 $('body').click(function(e){ 1088 _jws_theme_mini_cart.find(".active").removeClass('active'); 1089 }); 1090 } 1091 1092 if($('.tb-menu-canvas').length > 0){ 1093 $('.header-menu-item-icon > a').click(function () { 1094 $('.tb-menu-canvas').toggleClass('active'); 1095 }); 1096 } 1097 var _jws_theme_teacher_item = $('.teacher.tpl2'); 1098 if($('.tb-teacher-image').length > 0){ 1099 $('.tb-teacher-image').click(function (e) { 1100 e.preventDefault(); 1101 _jws_theme_teacher_item.find(".teacher_item_active").removeClass('teacher_item_active'); 1102 $(this.closest('.teacher_item')).addClass('teacher_item_active'); 1103 }); 1104 } 1105 1106 var _jws_theme_course_item = $('.jws_courses'); 1107 if($('.jws_courses_item').length > 0){ 1108 $('.jws_courses_item').hover(function (e) { 1109 e.preventDefault(); 1110 _jws_theme_course_item.find(".jws_courses_item_active").removeClass('jws_courses_item_active'); 1111 $(this.closest('.jws_courses_item_inner')).addClass('jws_courses_item_active'); 1112 }); 1113 } 1114 /* Btn menu click */ 1115 $('.tb-menu-control-mobi a').click(function(){ 1116 $('.tb-menu-mobi-list').toggleClass('active'); 1117 $('body').toggleClass('menu-mobi-open'); 1118 }); 1119 $('body').on('click', function(){ 1120 if( $(this).hasClass('menu-mobi-open')){ 1121 $('.tb-menu-mobi-list').toggleClass('active'); 1122 $(this).toggleClass('menu-mobi-open'); 1123 } 1124 }); 1125 1126 $('.jws_theme_menu_mobi,.tb-menu-control-mobi').on('click', function(e){ 1127 e.stopPropagation(); 1128 }); 1129 1130 $('a.icon_search_wrap').click(function () { 1131 $(this).closest('.widget_searchform_content').toggleClass('active'); 1132 }); 1133 $('body').on('click', function(){ 1134 if( $('.widget_searchform_content').hasClass('active')){ 1135 $('.widget_searchform_content').toggleClass('active'); 1136 } 1137 }); 1138 $('.widget_searchform_content').on('click', function(e){ 1139 e.stopPropagation(); 1140 }); 1141 1142 function ROClassesSingleSlider() { 1143 $('#tb-classes-image-carousel').flexslider({ 1144 animation: "slide", 1145 controlNav: false, 1146 animationLoop: false, 1147 slideshow: false, 1148 itemWidth: 170, 1149 itemMargin: 5, 1150 directionNav:false, 1151 asNavFor: '#tb-classes-image' 1152 }); 1153 1154 $('#tb-classes-image').flexslider({ 1155 animation: "slide", 1156 controlNav: false, 1157 animationLoop: false, 1158 slideshow: false, 1159 directionNav:true, 1160 prevText:"<i class='fa fa-long-arrow-left'></i>", 1161 nextText:"<i class='fa fa-long-arrow-right'></i>", 1162 sync: "#tb-classes-image-carousel" 1163 }); 1164 } 1165 1166 ROClassesSingleSlider(); 1167 $('#box-style-inline-css').each(function(){ 1168 var $this = $(this); 1169 var t = $this.text(); 1170 $this.html(t.replace('<','<').replace('>', '>')); 1171 }); 1172 /*Header stick*/ 1173 function ROHeaderStick() { 1174 if( $('.tb-header-menu').length > 0 ){ 1175 if($( '.tb-header-wrap' ).hasClass( 'tb-header-stick' )) { 1176 1177 RaymondObj.jws_theme_set_stick_bar(); 1178 1179 $(window).on('scroll load resize', function() { 1180 RaymondObj.jws_theme_set_stick_bar(); 1181 }); 1182 } 1183 } 1184 1185 } 1186 ROHeaderStick(); 1187 1188 1189 /* 1190 * Mobile Nav Menu Initialization and Event Handling 1191 */ 1192 var _mobile_leftbar = $('.mobile-leftbar'); 1193 1194 function initMobileNav() { 1195 1196 $('.mobile-leftbar .fa-close').on('click', function(e) { 1197 $('.mobile-leftbar').removeClass('open'); 1198 e.stopPropagation(); 1199 }); 1200 $('.mobile-header .fa-bars').on('click', function(e) { 1201 $('.mobile-leftbar').addClass('open'); 1202 e.stopPropagation(); 1203 }); 1204 } 1205 if( _mobile_leftbar.length ){ 1206 initMobileNav(); 1207 } 1208 1209 1210 //checkout 1211 $('.ro-checkout-process .ro-hr-line .ro-tab-1, .ro-customer-info .ro-edit-customer-info').click(function(){ 1212 var process1 = $('.ro-checkout-process .ro-hr-line .ro-tab-1'); 1213 process1.parent().parent().removeClass('ro-process-2'); 1214 process1.parent().parent().addClass('ro-process-1'); 1215 $('.ro-checkout-panel .ro-panel-1').css('display', 'block'); 1216 $('.ro-checkout-panel .ro-panel-2').css('display', 'none'); 1217 }); 1218 $('.ro-checkout-process .ro-hr-line .ro-tab-2, .ro-checkout-panel .ro-btn-2').click(function(){ 1219 var process2 = $('.ro-checkout-process .ro-hr-line .ro-tab-2'); 1220 process2.parent().parent().removeClass('ro-process-1'); 1221 process2.parent().parent().addClass('ro-process-2'); 1222 $('.ro-checkout-panel .ro-panel-1').css('display', 'none'); 1223 $('.ro-checkout-panel .ro-panel-2').css('display', 'block'); 1224 }); 1225}); 1226 1227window.addEventListener ? 1228window.addEventListener("load",jws_theme_onload_func,false) : 1229window.attachEvent && window.attachEvent("onload",jws_theme_onload_func); 1230 1231function jws_theme_onload_func(){ 1232 // tickbar 1233 RaymondObj.jws_theme_set_stick_bar(); 1234 // woo slider 1235 // RaymondObj.jws_theme_fixheight_slider(); 1236 1237 // $('.ro-product-wrapper .thumbnails').find('li').on('click', function(){ 1238 // setTimeout( function(){ 1239 // RaymondObj.jws_theme_fixheight_slider(); 1240 // }, 800) 1241 1242 // }); 1243 1244 // func active tabs default 1245 $('.wpb_tabs').each(function(){ 1246 var wpb_tabs_nav = $(this).find('.wpb_tabs_nav'), 1247 active_num = wpb_tabs_nav.data('active-tab'); 1248 wpb_tabs_nav.find('li').eq(parseInt(active_num) - 1).trigger('click'); 1249 }) 1250 1251 //setTimeout(function(){ 1252 var $wpb_accordion = $('.wpb_accordion'); 1253 if($wpb_accordion.length > 0 && $.fn.niceScroll !== undefined){ 1254 $wpb_accordion.each(function(){ 1255 $(this).find('.wpb_accordion_section').each(function(){ 1256 $(this).css({display: 'block'}); 1257 var nice = $(this).find('.wpb_accordion_content').niceScroll(); 1258 }) 1259 }) 1260 } 1261 //}, 10) 1262 1263 var $nice_scroll_class_js = $('.nice-scroll-class-js'); 1264 if($nice_scroll_class_js.length > 0 && $.fn.niceScroll !== undefined){ 1265 $nice_scroll_class_js.each(function(){ 1266 $(this).niceScroll(); 1267 }) 1268 } 1269}
1269 1270})(window.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.