1/* global jQuery:false */ 2/* global JACQUELINE_STORAGE:false */ 3 4jQuery(document).ready(function() { 5 "use strict"; 6 JACQUELINE_STORAGE['theme_init_counter'] = 0; 7 jacqueline_init_actions(); 8}); 9 10jQuery(window).on('beforeunload', function() { 11 "use strict"; 12 // Show preloader 13 if (jQuery.browser && !jQuery.browser.safari) jQuery('#page_preloader').css({display: 'block', opacity: 0}).animate({opacity:0.8}, 300); 14}); 15 16 17// Theme init actions 18function jacqueline_init_actions() { 19 "use strict"; 20 21 if (JACQUELINE_STORAGE['vc_edit_mode'] && jQuery('.vc_empty-placeholder').length==0 && JACQUELINE_STORAGE['theme_init_counter']++ < 30) { 22 setTimeout(jacqueline_init_actions, 200); 23 return; 24 } 25 26 if (jQuery('body').hasClass('logged-in')) jQuery('html').addClass('bar'); 27 28 if (JACQUELINE_STORAGE['use_ajax_views_counter']) { 29 jQuery(document).ready(function() { 30 setTimeout(function(){ 31 jQuery.post(JACQUELINE_STORAGE['ajax_url'], { 32 action: 'post_counter', 33 nonce: JACQUELINE_STORAGE['ajax_nonce'], 34 post_id: JACQUELINE_STORAGE['post_id'], 35 views: JACQUELINE_STORAGE['views'] 36 }); 37 }, 10); 38 }); 39 } 40 41 // Hide preloader 42 jQuery('#page_preloader').animate({opacity:0}
42, 500, function() { jQuery(this).css({display: 'none'}); }); 43 44 // Check for Retina display 45 if (jacqueline_is_retina()) { 46 jacqueline_set_cookie('jacqueline_retina', 1, 365); 47 } 48 49 jacqueline_ready_actions(); 50 51 // Add resize handlers after VC row stretch handlers on('resize.vcRowBehaviour', ...) 52 setTimeout(function() { 53 jQuery(window).on('resize.jacqueline', function() { 54 jacqueline_resize_actions(); 55 jacqueline_scroll_actions() 56 }).trigger('resize.jacqueline'); 57 }, 10); 58 59 // Scroll handlers 60 jQuery(window).on('scroll.jacqueline', function() { 61 "use strict"; 62 jacqueline_scroll_actions(); 63 }); 64} 65 66 67 68// Theme first load actions 69//============================================== 70function jacqueline_ready_actions() { 71 "use strict"; 72 73 // Call skin specific action (if exists) 74 //---------------------------------------------- 75 if (window.jacqueline_skin_ready_actions) jacqueline_skin_ready_actions(); 76 77 // Call theme specific action (if exists) 78 //---------------------------------------------- 79 if (window.jacqueline_theme_ready_actions) jacqueline_theme_ready_actions(); 80 81 82 // Widgets decoration 83 //---------------------------------------------- 84 85 // Decorate nested lists in widgets and side panels 86 jQuery('.widget ul > li').each(function() { 87 if (jQuery(this).find('ul').length > 0) { 88 jQuery(this).addClass('has_children'); 89 } 90 }); 91 92 93 // Archive widget decoration 94 jQuery('.widget_archive a').each(function() { 95 var val = jQuery(this).html().split(' '); 96 if (val.length > 1) { 97 val[val.length-1] = '<span>' + val[val.length-1] + '</span>'; 98 jQuery(this).html(val.join(' ')) 99 } 100 }); 101 102 103 // Calendar handlers - change months 104 jQuery('.widget_calendar').on('click', '.month_prev a, .month_next a', function(e) { 105 "use strict"; 106 var calendar = jQuery(this).parents('.wp-calendar'); 107 var m = jQuery(this).data('month'); 108 var y = jQuery(this).data('year'); 109 var pt = jQuery(this).data('type'); 110 jQuery.post(JACQUELINE_STORAGE['ajax_url'], { 111 action: 'calendar_change_month', 112 nonce: JACQUELINE_STORAGE['ajax_nonce'], 113 month: m, 114 year: y, 115 post_type: pt 116 }).done(function(response) { 117 var rez = {}; 118 try { 119 rez = JSON.parse(response); 120 } catch (e) { 121 rez = { error: JACQUELINE_STORAGE['ajax_error'] }; 122 console.log(response); 123 } 124 if (rez.error === '') { 125 calendar.parent().fadeOut(200, function() { 126 jQuery(this).find('.wp-calendar').remove(); 127 jQuery(this).append(rez.data).fadeIn(200); 128 }); 129 } 130 }); 131 e.preventDefault(); 132 return false; 133 }); 134 135 // Add buttons to quantity on first run 136 if (jQuery('.woocommerce div.quantity .q_inc,.woocommerce-page div.quantity .q_inc').length == 0) { 137 var woocomerce_inc_dec = '<span class="q_inc"></span><span class="q_dec"></span>'; 138 jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').append(woocomerce_inc_dec); 139 jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').on('click', '>span', function(e) { 140 woocomerce_inc_dec_click(jQuery(this)); 141 e.preventDefault(); 142 return false; 143 }); 144 } 145 // Add buttons to quantity after the cart is updated 146 jQuery(document.body).on('updated_wc_div', function() { 147 if (jQuery('.woocommerce div.quantity .q_inc,.woocommerce-page div.quantity .q_inc').length == 0) { 148 jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').append(woocomerce_inc_dec); 149 jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').on('click', '>span', function(e) { 150 woocomerce_inc_dec_click(jQuery(this)); 151 e.preventDefault(); 152 return false; 153 }); 154 } 155 }); 156 // Inc/Dec quantity on buttons inc/dec 157 function woocomerce_inc_dec_click(button) { 158 var f = button.siblings('input'); 159 if (button.hasClass('q_inc')) { 160 f.val(Math.max(0, parseInt(f.val()))+1).trigger('change'); 161 } else { 162 f.val(Math.max(1, Math.max(0, parseInt(f.val()))-1)).trigger('change'); 163 } 164 } 165 // Media setup 166 //---------------------------------------------- 167 168 // Video background init 169 jQuery('.video_background').each(function() { 170 var youtube = jQuery(this).data('youtube-code'); 171 if (youtube) { 172 jQuery(this).tubular({videoId: youtube}); 173 } 174 }); 175 176 177 // Main slider 178 //---------------------------------------------- 179 jQuery('.slider_over_button,.slider_over_close').on('click', function(e) { 180 jQuery(this).parent().toggleClass('opened'); 181 e.preventDefault(); 182 return false;
183 }); 184 185 186 187 // Menu 188 //---------------------------------------------- 189 190 // hide header mobile 191 if (jQuery('.header_mobile').length > 0) { 192 jQuery('.header_mobile .menu_main_nav a').each(function (){ 193 "use strict"; 194 var href = jQuery(this).attr('href'); 195 if (href===undefined) return; 196 var aHref = jQuery(this).attr('href').indexOf("#"); 197 if ( (aHref >= 0) && (href.length >1) ) { 198 jQuery(this).addClass('anchorClose'); 199 } 200 }); 201 } 202 203 // Clone side menu for responsive 204 if (jQuery('ul#menu_side').length > 0) { 205 jQuery('ul#menu_side').clone().removeAttr('id').removeClass('menu_side_nav').addClass('menu_side_responsive').insertAfter('ul#menu_side'); 206 jacqueline_show_current_menu_item(jQuery('.menu_side_responsive'), jQuery('.sidebar_outer_menu_responsive_button')); 207 } 208 if (jQuery('.header_mobile').length > 0) { 209 jQuery('.header_mobile .menu_main_nav_area ul.menu_main_nav').removeAttr('id'); 210 jQuery('.header_mobile .menu_button').on('click', function(){ 211 jQuery('.header_mobile .side_wrap').toggleClass('open'); 212 jQuery('.header_mobile .mask').toggleClass('show'); 213 jQuery('html').toggleClass('menu_mobile_open'); 214 // Fix for Safari 215 if (jacqueline_browser_is_ios() && jQuery('body').hasClass('menu_mobile')) { 216 jQuery('body').toggleClass('ios_fixed'); 217 } 218 }); 219 jQuery('.header_mobile .mask, .header_mobile .side_wrap .close').on('click', function(){ 220 jQuery('.header_mobile .side_wrap').removeClass('open'); 221 jQuery('.header_mobile .mask').removeClass('show'); 222 jQuery('html').removeClass('menu_mobile_open'); 223 // Fix for Safari 224 if (jacqueline_browser_is_ios() && jQuery('body').hasClass('menu_mobile')) { 225 jQuery('body').toggleClass('ios_fixed'); 226 } 227 }); 228 jQuery(window).on('resize', function(){ 229 if (jQuery(window).width() >= 1024) { 230 jQuery('.header_mobile .side_wrap').removeClass('open'); 231 jQuery('.header_mobile .mask').removeClass('show'); 232 jQuery('html').removeClass('menu_mobile_open'); 233 // Fix for Safari 234 if (jacqueline_browser_is_ios() && jQuery('body').hasClass('menu_mobile')) { 235 jQuery('body').toggleClass('ios_fixed'); 236 } 237 } 238 }); 239 } 240 241 // Push menu button 242 jQuery('.menu_pushy_button').on('click', function(e){ 243 "use strict"; 244 jQuery('body').addClass('pushy-active').css('overflow', 'hidden'); 245 jQuery('.site-overlay').fadeIn('fast'); 246 e.preventDefault(); 247 return false; 248 }); 249 jQuery('.pushy .close-pushy,.site-overlay').on('click', function(e){ 250 jQuery('body').removeClass('pushy-active').css('overflow', 'visible'); 251 jQuery('.site-overlay').fadeOut('fast'); 252 e.preventDefault(); 253 return false; 254 }); 255 256 // Side menu widgets button 257 jQuery('.sidebar_outer_widgets_button').on('click', function(e){ 258 "use strict"; 259 jQuery('.sidebar_outer_widgets').slideToggle(); 260 e.preventDefault(); 261 return false; 262 }); 263 264 // Add arrows in responsive menu 265 jQuery('.header_mobile ul.menu_main_nav .menu-item-has-children > a, .menu_side_responsive .menu-item-has-children > a, .menu_pushy_nav_area .menu-item-has-children > a, body:not(.woocommerce) .widget_area:not(.footer_wrap) .widget_product_categories ul.product-categories .has_children > a').prepend('<span class="open_child_menu"></span>'); 266 267 268 // Enable click on root menu items (without submenu) in iOS 269 if (jacqueline_browser_is_ios()) { 270 jQuery('.header_mobile .menu_main_nav li:not(.menu-item-has-children) > a').on('touchend', function (e) { 271 "use strict"; 272 if (jQuery(this).attr('href')!='#') { 273 window.location.href = jQuery(this).attr('href'); 274 } 275 }); 276 } 277 278 279 // Submenu click handler for the responsive menu 280 jQuery('.header_mobile ul.menu_main_nav, .menu_side_responsive, .menu_pushy_nav_area, body:not(.woocommerce) .widget_area:not(.footer_wrap) .widget_product_categories').on(jacqueline_browser_is_ios() ? 'touchend' : 'click', 'li a,li a .open_child_menu, ul.product-categories.plain li a .open_child_menu', function(e) { 281 "use strict"; 282 var is_menu_main = jQuery(this).parents('ul.menu_main_nav').length > 0; 283 var $a = jQuery(this).hasClass('open_child_menu') ? jQuery(this).parent() : jQuery(this); 284 if ((!is_menu_main || jQuery('body').hasClass('menu_mobile')) && ($a.parent().hasClass('menu-item-has-children') || $a.parent().hasClass('has_children'))) { 285 if ($a.siblings('ul:visible').length > 0) 286 $a.siblings('ul').slideUp().parent().removeClass('opened'); 287 else { 288 jQuery(this).parents('li').siblings('li').find('ul:visible').slideUp().parent().removeClass('opened'); 289 $a.siblings('ul').slideDown().parent().addClass('opened'); 290 } 291 } 292 // Ignore link for parent menu items 293 if (jQuery(this).hasClass('open_child_menu') || $a.attr('href')=='#') { 294 e.preventDefault(); 295 return false;
296 } 297 }); 298 299 // Init superfish menus 300 jacqueline_init_sfmenu('header .menu_main_nav_area ul.menu_main_nav, ul.menu_user_nav, ul#menu_side, body:not(.woocommerce) .widget_area:not(.footer_wrap) .widget_product_categories ul.product-categories'); 301 302 // Slide effect for main menu 303 if (JACQUELINE_STORAGE['menu_slider']) { 304 jQuery('ul.menu_main_nav').spasticNav({ 305 color: JACQUELINE_STORAGE['accent2_color'] 306 }); 307 } 308 309 // Show table of contents for the current page 310 if (JACQUELINE_STORAGE['toc_menu'] != 'hide' && JACQUELINE_STORAGE['toc_menu'] != 'no') { 311 jacqueline_build_page_toc(); 312 } 313 314 // One page mode for menu links (scroll to anchor) 315 jQuery('#toc, ul.menu_main_nav li, ul.menu_user_nav li, ul#menu_side li, ul#menu_footer li, ul#menu_pushy li').on('click', 'a', function(e) { 316 "use strict"; 317 var href = jQuery(this).attr('href'); 318 if (href===undefined) return; 319 var pos = href.indexOf('#'); 320 if (pos < 0 || href.length == 1) return; 321 if (jQuery(href.substr(pos)).length > 0) { 322 var loc = window.location.href; 323 var pos2 = loc.indexOf('#'); 324 if (pos2 > 0) loc = loc.substring(0, pos2); 325 var now = pos==0; 326 if (!now) now = loc == href.substring(0, pos); 327 if (now) { 328 jacqueline_document_animate_to(href.substr(pos)); 329 jacqueline_document_set_location(pos==0 ? loc + href : href); 330 e.preventDefault(); 331 return false; 332 } 333 } 334 }); 335 336 337 // Store height of the top and side panels 338 JACQUELINE_STORAGE['top_panel_height'] = 0; //Math.max(0, jQuery('.top_panel_wrap').height()); 339 JACQUELINE_STORAGE['side_panel_height'] = 0; 340 341 342 // Pagination 343 //---------------------------------------------- 344 345 // Page navigation (style slider) 346 jQuery('.pager_cur').on('click', function(e) { 347 "use strict"; 348 jQuery('.pager_slider').slideDown(300, function() { 349 if (window.jacqueline_sc_init !== undefined ) jacqueline_sc_init(jQuery('.pager_slider').eq(0)); 350 }); 351 e.preventDefault(); 352 return false; 353 }); 354 355 356 // View More button 357 jQuery('#viewmore_link').on('click', function(e) { 358 "use strict"; 359 if (!JACQUELINE_STORAGE['viewmore_busy'] && !jQuery(this).hasClass('viewmore_empty')) { 360 jQuery(this).parent().addClass('loading'); 361 JACQUELINE_STORAGE['viewmore_busy'] = true; 362 jQuery.post(JACQUELINE_STORAGE['ajax_url'], { 363 action: 'view_more_posts', 364 nonce: JACQUELINE_STORAGE['ajax_nonce'], 365 page: +JACQUELINE_STORAGE['viewmore_page'] + 1, 366 data: JACQUELINE_STORAGE['viewmore_data'], 367 vars: JACQUELINE_STORAGE['viewmore_vars'] 368 }).done(function(response) { 369 "use strict"; 370 var rez = {}; 371 try { 372 rez = JSON.parse(response); 373 } catch (e) { 374 rez = { error: JACQUELINE_STORAGE['ajax_error'] }; 375 console.log(response); 376 } 377 jQuery('#viewmore_link').parent().removeClass('loading'); 378 JACQUELINE_STORAGE['viewmore_busy'] = false; 379 if (rez.error === '') { 380 var posts_container = jQuery('.content').eq(0); 381 if (posts_container.find('.isotope_wrap').length > 0) posts_container = posts_container.find('.isotope_wrap').eq(0); 382 if (posts_container.hasClass('isotope_wrap')) { 383 posts_container.data('last-width', 0).append(rez.data); 384 JACQUELINE_STORAGE['isotope_init_counter'] = 0; 385 jacqueline_init_appended_isotope(posts_container, rez.filters); 386 } else 387 jQuery('#viewmore').before(rez.data); 388 389 JACQUELINE_STORAGE['viewmore_page']++; 390 if (rez.no_more_data==1) { 391 jQuery('#viewmore_link').addClass('viewmore_empty').parent().hide(); 392 } 393 394 jacqueline_init_post_formats(); 395 if (window.jacqueline_sc_init !== undefined ) jacqueline_sc_init(posts_container); 396 jacqueline_scroll_actions(); 397 } 398 }); 399 } 400 e.preventDefault(); 401 return false; 402 }); 403 404 405 // WooCommerce 406 //---------------------------------------------- 407 408 // Change display mode 409 jQuery('.woocommerce,.woocommerce-page').on('click', '.mode_buttons a', function(e) { 410 "use strict"; 411 var mode = jQuery(this).hasClass('woocommerce_thumbs') ? 'thumbs' : 'list'; 412 jacqueline_set_cookie('jacqueline_shop_mode', mode, {expires: 365, path: '/'}); 413 jQuery(this).siblings('input').val(mode).parents('form').get(0).submit(); 414 e.preventDefault(); 415 return false;
416 }); 417 // Added to cart 418 jQuery('body').bind('added_to_cart', function() { 419 "use strict"; 420 // Update amount on the cart button 421 var total = jQuery('.widget_shopping_cart').eq(0).find('.total .amount').text(); 422 if (total != undefined) { 423 jQuery('.top_panel_cart_button .cart_summa').text(total); 424 } 425 // Update count items on the cart button 426 var cnt = 0; 427 jQuery('.widget_shopping_cart_content').eq(0).find('.cart_list li').each(function() { 428 var q = jQuery(this).find('.quantity').html().split(' ', 2); 429 if (!isNaN(q[0])) 430 cnt += Number(q[0]); 431 }); 432 var items = jQuery('.top_panel_cart_button .cart_items').eq(0).text().split(' ', 2); 433 items[0] = cnt; 434 jQuery('.top_panel_cart_button .cart_items').text(items[0]+' '+items[1]); 435 // Update data-attr on button 436 jQuery('.top_panel_cart_button').data({ 437 'items': cnt ? cnt : 0, 438 'summa': total ? total : 0 439 }); 440 }); 441 // Show cart 442 jQuery('.top_panel_middle .top_panel_cart_button, .header_mobile .top_panel_cart_button').on('click', function(e) { 443 "use strict"; 444 jQuery(this).siblings('.sidebar_cart').slideToggle(); 445 e.preventDefault(); 446 return false; 447 }); 448 // Add stretch behaviour to WooC tabs area 449 jQuery('body:not(.sidebar_show) .single-product .woocommerce-tabs') 450 .addClass('trx-stretch-width inverse_colors') 451 .after('<div class="trx-stretch-width-original"></div>'); 452 jacqueline_stretch_width(); 453 454 // Popup login and register windows 455 //---------------------------------------------- 456 jQuery('.popup_link').addClass('inited').on('click', function(e){ 457 var popup = jQuery(jQuery(this).attr('href')); 458 if (popup.length === 1) { 459 jacqueline_hide_popup(jQuery(popup.hasClass('popup_login') ? '.popup_registration' : '.popup_login' )); 460 jacqueline_toggle_popup(popup); 461 } 462 e.preventDefault(); 463 return false; 464 }); 465 jQuery('.popup_wrap').on('click', '.popup_close', function(e){ 466 var popup = jQuery(this).parent(); 467 if (popup.length === 1) { 468 jacqueline_hide_popup(popup); 469 } 470 e.preventDefault(); 471 return false; 472 }); 473 474 475 // Bookmarks 476 //---------------------------------------------- 477 478 // Add bookmark 479 jQuery('.bookmarks_add').on('click', function(e) { 480 "use strict"; 481 var title = window.document.title.split('|')[0]; 482 var url = window.location.href; 483 var list = jacqueline_get_cookie('jacqueline_bookmarks'); 484 var exists = false; 485 if (list) { 486 try { 487 list = JSON.parse(list); 488 } catch (e) {} 489 if (list.length) { 490 for (var i=0; i<list.length; i++) { 491 if (list[i].url == url) { 492 exists = true; 493 break; 494 } 495 } 496 } 497 } else 498 list = new Array(); 499 if (!exists) { 500 var message_popup = jacqueline_message_dialog('<label for="bookmark_title">'+JACQUELINE_STORAGE['strings']['bookmark_title']+'</label><br><input type="text" id="bookmark_title" name="bookmark_title" value="'+title+'">', JACQUELINE_STORAGE['strings']['bookmark_add'], null, 501 function(btn, popup) { 502 "use strict"; 503 if (btn != 1) return; 504 title = message_popup.find('#bookmark_title').val(); 505 list.push({title: title, url: url}); 506 jQuery('.bookmarks_list').append('<li><a href="'+url+'" class="bookmarks_item">'+title+'<span class="bookmarks_delete icon-cancel" title="'+JACQUELINE_STORAGE['strings']['bookmark_del']+'"></span></a></li>'); 507 jacqueline_set_cookie('jacqueline_bookmarks', JSON.stringify(list), {expires: 365, path: '/'}); 508 setTimeout(function () {jacqueline_message_success(JACQUELINE_STORAGE['strings']['bookmark_added'], JACQUELINE_STORAGE['strings']['bookmark_add']);}, JACQUELINE_STORAGE['message_timeout']/4); 509 }); 510 } else 511 jacqueline_message_warning(JACQUELINE_STORAGE['strings']['bookmark_exists'], JACQUELINE_STORAGE['strings']['bookmark_add']); 512 e.preventDefault(); 513 return false; 514 }); 515 516 // Delete bookmark 517 jQuery('.bookmarks_list').on('click', '.bookmarks_delete', function(e) { 518 "use strict"; 519 var idx = jQuery(this).parent().index(); 520 var list = jacqueline_get_cookie('jacqueline_bookmarks'); 521 if (list) { 522 try { 523 list = JSON.parse(list); 524 } catch (e) {} 525 if (list.length) { 526 list.splice(idx, 1); 527 jacqueline_set_cookie('jacqueline_bookmarks', JSON.stringify(list), {expires: 365, path: '/'}); 528 } 529 } 530 jQuery(this).parent().remove(); 531 e.preventDefault(); 532 return false;
533 }); 534 535 536 // Comments 537 //------------------------------------ 538 539 // Checkbox with "I agree..." 540 if (jQuery('input[type="checkbox"][name="i_agree_privacy_policy"]:not(.inited),input[type="checkbox"][name="gdpr_terms"]:not(.inited),input[type="checkbox"][name="wpgdprc"]:not(.inited)').length > 0) { 541 jQuery('input[type="checkbox"][name="i_agree_privacy_policy"]:not(.inited),input[type="checkbox"][name="gdpr_terms"]:not(.inited),input[type="checkbox"][name="wpgdprc"]:not(.inited)') 542 .addClass('inited') 543 .on('change', function(e) { 544 if (jQuery(this).get(0).checked) 545 jQuery(this).parents('form').find('button,input[type="submit"]').removeAttr('disabled'); 546 else 547 jQuery(this).parents('form').find('button,input[type="submit"]').attr('disabled', 'disabled'); 548 }).trigger('change'); 549 } 550 551 552 // Other settings 553 //------------------------------------ 554 555 // Scroll to top button 556 jQuery('.scroll_to_top').on('click', function(e) { 557 "use strict"; 558 jQuery('html,body').animate({ 559 scrollTop: 0 560 }, 'slow'); 561 e.preventDefault(); 562 return false; 563 }); 564 565 // Show system message 566 jacqueline_show_system_message(); 567 568 // Init post format specific scripts 569 jacqueline_init_post_formats(); 570 571 // Call sc init action (if exists) 572 if (window.jacqueline_sc_init_actions) jacqueline_sc_init_actions(); 573 574 // Init hidden elements (if exists) 575 if (window.jacqueline_init_hidden_elements) jacqueline_init_hidden_elements(jQuery('body').eq(0)); 576 577 //Make columns equal height 578 jQuery('.columns_wrap.sc_columns.equal_height').each(function(){ 579 var height = 0; 580 jQuery(this).find('.sc_column_item').each(function(){ 581 if(jQuery(this).height() > height) height = jQuery(this).height(); 582 }); 583 jQuery(this).find('.sc_column_item').height(height); 584 }); 585 586 587 // Woo products buttons 588 jQuery('.woocommerce ul.products li.product .post_thumb').each(function(){ 589 var button = jQuery(this).find('.add_to_cart_button'); 590 jQuery(this).find('.button_container.cart').append(button); 591 }); 592 593 jQuery('.woocommerce ul.products li.product .post_thumb').each(function(){ 594 var button = jQuery(this).find('.product_type_external'); 595 jQuery(this).find('.button_container.cart').append(button); 596 }); 597 598 jQuery('.woocommerce ul.products li.product .post_thumb .button_container:not(.animate)').mouseover(function(){ 599 if(jQuery(this).find('.added').length <= 0) 600 jQuery(this).addClass('animate').removeClass('animateOut'); 601 }); 602 603 jQuery('.woocommerce ul.products li.product .post_thumb .button_container').mouseout(function(){ 604 if(jQuery(this).find('.added').length <= 0) 605 jQuery(this).addClass('animateOut'); 606 }); 607 608 jQuery('.woocommerce ul.products li.product .post_thumb .button').each(function(){ 609 var item = jQuery(this); 610 var clone = jQuery(item).clone().addClass('clone'); 611 jQuery(this).after( clone ); 612 }); 613 614 615} //end ready 616 617 618 619 620// Scroll actions 621//============================================== 622 623// Do actions when page scrolled 624function jacqueline_scroll_actions() { 625 "use strict"; 626 627 // Call skin specific action (if exists) 628 //---------------------------------------------- 629 if (window.jacqueline_skin_scroll_actions) jacqueline_skin_scroll_actions(); 630 631 // Call theme specific action (if exists) 632 //---------------------------------------------- 633 if (window.jacqueline_theme_scroll_actions) jacqueline_theme_scroll_actions(); 634 635 var scroll_offset = jQuery(window).scrollTop(); 636 var scroll_to_top_button = jQuery('.scroll_to_top'); 637 var adminbar_height = Math.max(0, jQuery('#wpadminbar').height()); 638 639 if (JACQUELINE_STORAGE['top_panel_height'] < 1) { 640 JACQUELINE_STORAGE['top_panel_height'] = Math.max(0, jQuery('.top_panel_wrap').height()); 641 } 642 643 // Scroll to top button show/hide 644 if (scroll_offset > JACQUELINE_STORAGE['top_panel_height']) 645 scroll_to_top_button.addClass('show'); 646 else 647 scroll_to_top_button.removeClass('show'); 648 649 // Fix/unfix top panel 650 if (!jQuery('body').hasClass('menu_mobile') && JACQUELINE_STORAGE['menu_fixed']) { 651 var slider_height = 0; 652 if (jQuery('.top_panel_below .slider_wrap').length > 0) { 653 slider_height = jQuery('.top_panel_below .slider_wrap').height(); 654 if (slider_height < 10) { 655 slider_height = jQuery('.slider_wrap').hasClass('.slider_fullscreen') ? jQuery(window).height() : JACQUELINE_STORAGE['slider_height']; 656 } 657 } 658 if (scroll_offset <= slider_height + JACQUELINE_STORAGE['top_panel_height']) { 659 if (jQuery('body').hasClass('top_panel_fixed')) { 660 jQuery('body').removeClass('top_panel_fixed'); 661 } 662 } else if (scroll_offset > slider_height + JACQUELINE_STORAGE['top_panel_height']) { 663 if (!jQuery('body').hasClass('top_panel_fixed') && jQuery(document).height() > jQuery(window).height()*1.5) { 664 jQuery('.top_panel_fixed_wrap').height(JACQUELINE_STORAGE['top_panel_height']); 665 jQuery('.top_panel_wrap').css('marginTop', '-150px').animate({'marginTop': 0}, 500); 666 jQuery('body').addClass('top_panel_fixed'); 667 } 668 } 669 } 670 671 // Fix/unfix side panel 672 if (jQuery('.sidebar_outer').length > 0) { 673 if (JACQUELINE_STORAGE['side_panel_height'] == 0) 674 JACQUELINE_STORAGE['side_panel_height'] = jQuery('.sidebar_outer_logo_wrap').outerHeight() + jQuery('.sidebar_outer_menu').outerHeight() + jQuery('.sidebar_outer_widgets').outerHeight(); 675 if (scroll_offset + jQuery(window).height() > JACQUELINE_STORAGE['side_panel_height'] + 100) { 676 if (jQuery('.sidebar_outer').css('position')!=='fixed') { 677 jQuery('.sidebar_outer').css({ 678 'position': 'fixed', 679 'top': Math.min(0, jQuery(window).height() - JACQUELINE_STORAGE['side_panel_height'] - 100) + 'px', 680 }); 681 } 682 } else { 683 if (jQuery('.sidebar_outer').css('position')=='fixed') { 684 jQuery('.sidebar_outer').css({ 685 'position': 'absolute', 686 'top': 0 687 }); 688 } 689 } 690 } 691 692 // TOC current items 693 jQuery('#toc .toc_item').each(function() { 694 "use strict"; 695 var id = jQuery(this).find('a').attr('href'); 696 var pos = id.indexOf('#'); 697 if (pos < 0 || id.length == 1) return; 698 var loc = window.location.href; 699 var pos2 = loc.indexOf('#'); 700 if (pos2 > 0) loc = loc.substring(0, pos2); 701 var now = pos==0; 702 if (!now) now = loc == href.substring(0, pos); 703 if (!now) return; 704 var off = jQuery(id).offset().top; 705 var id_next = jQuery(this).next().find('a').attr('href'); 706 var off_next = id_next ? jQuery(id_next).offset().top : 1000000; 707 if (off < scroll_offset + jQuery(window).height()*0.8 && scroll_offset + JACQUELINE_STORAGE['top_panel_height'] < off_next) 708 jQuery(this).addClass('current'); 709 else 710 jQuery(this).removeClass('current'); 711 }); 712 713 // Infinite pagination 714 jacqueline_infinite_scroll() 715 716 // Parallax scroll
717 jacqueline_parallax_scroll(); 718 719 // Call sc scroll actions (if exists) 720 if (window.jacqueline_sc_scroll_actions) jacqueline_sc_scroll_actions(); 721} 722 723 724// Infinite Scroll 725function jacqueline_infinite_scroll() { 726 "use strict"; 727 if (JACQUELINE_STORAGE['viewmore_busy']) return; 728 var infinite = jQuery('#viewmore.pagination_infinite'); 729 if (infinite.length > 0) { 730 var viewmore = infinite.find('#viewmore_link:not(.viewmore_empty)'); 731 if (viewmore.length > 0) { 732 if (jQuery(window).scrollTop() + jQuery(window).height() + 100 >= infinite.offset().top) { 733 viewmore.eq(0).trigger('click'); 734 } 735 } 736 } 737} 738 739// Parallax scroll 740function jacqueline_parallax_scroll(){ 741 "use strict"; 742 jQuery('.sc_parallax').each(function(){ 743 var windowHeight = jQuery(window).height(); 744 var scrollTops = jQuery(window).scrollTop(); 745 var offsetPrx = Math.max(jQuery(this).offset().top, windowHeight); 746 if ( offsetPrx <= scrollTops + windowHeight ) { 747 var speed = Number(jQuery(this).data('parallax-speed')); 748 var xpos = jQuery(this).data('parallax-x-pos'); 749 var ypos = Math.round((offsetPrx - scrollTops - windowHeight) * speed + (speed < 0 ? windowHeight*speed : 0)); 750 jQuery(this).find('.sc_parallax_content').css('backgroundPosition', xpos+' '+ypos+'px'); 751 // Uncomment next line if you want parallax video (else - video position is static) 752 jQuery(this).find('div.sc_video_bg').css('top', ypos+'px'); 753 } 754 }); 755} 756 757 758 759 760 761// Resize actions 762//============================================== 763 764// Do actions when page scrolled 765function jacqueline_resize_actions() { 766 "use strict"; 767 768 // Call skin specific action (if exists) 769 //---------------------------------------------- 770 if (window.jacqueline_skin_resize_actions) jacqueline_skin_resize_actions(); 771 772 // Call theme specific action (if exists) 773 //---------------------------------------------- 774 if (window.jacqueline_theme_resize_actions) jacqueline_theme_resize_actions(); 775 776 // Reset stored value 777 JACQUELINE_STORAGE['top_panel_height'] = 0; 778 779 jacqueline_responsive_menu(); 780 jacqueline_video_dimensions(); 781 jacqueline_resize_video_background(); 782 jacqueline_resize_fullscreen_slider(); 783 jacqueline_resize_alter_portfolio(); 784 jacqueline_stretch_width(); 785 786 // Call sc resize actions (if exists) 787 if (window.jacqueline_sc_resize_actions) jacqueline_sc_resize_actions(); 788} 789 790// Stretch area to full window width 791function jacqueline_stretch_width() { 792 "use strict"; 793 jQuery('.trx-stretch-width').each(function() { 794 var $el = jQuery(this); 795 var $el_full = $el.next('.trx-stretch-width-original'); 796 var el_margin_left = parseInt( $el.css( 'margin-left' ), 10 ); 797 var el_margin_right = parseInt( $el.css( 'margin-right' ), 10 ); 798 var offset = 0 - $el_full.offset().left - el_margin_left; 799 var width = jQuery( window ).width(); 800 if (!$el.hasClass('inited')) { 801 $el.addClass('inited invisible'); 802 $el.css({ 803 'position': 'relative', 804 'box-sizing': 'border-box' 805 }); 806 } 807 $el.css({ 808 'left': offset, 809 'width': jQuery( window ).width() 810 }); 811 if ( !$el.hasClass('trx-stretch-content') ) { 812 var padding = Math.max(0, -1*offset); 813 var paddingRight = Math.max(0, width - padding - $el_full.width() + el_margin_left + el_margin_right); 814 $el.css( { 'padding-left': padding + 'px', 'padding-right': paddingRight + 'px' } ); 815 } 816 $el.removeClass('invisible'); 817 }); 818} 819 820// Check window size and do responsive menu 821function jacqueline_responsive_menu() { 822 "use strict"; 823 if (jacqueline_is_responsive_need(JACQUELINE_STORAGE['menu_mobile'])) { 824 if (!jQuery('body').hasClass('menu_mobile')) { 825 jQuery('body').removeClass('top_panel_fixed').addClass('menu_mobile'); 826 jQuery('header.top_panel_wrap ').hide(); 827 jQuery('.header_mobile').show(); 828 829 jQuery('header #popup_login').attr('id', 'popup_login_1'); 830 jQuery('header #popup_registration').attr('id', 'popup_registration_1'); 831 jQuery('.header_mobile #popup_login_1').attr('id', 'popup_login'); 832 jQuery('.header_mobile #popup_registration_1').attr('id', 'popup_registration'); 833 } 834 } else { 835 if (jQuery('body').hasClass('menu_mobile')) { 836 jQuery('body').removeClass('menu_mobile'); 837 jQuery('header.top_panel_wrap ').show(); 838 jQuery('.header_mobile').hide(); 839 840 jQuery('header #popup_login_1').attr('id', 'popup_login'); 841 jQuery('header #popup_registration_1').attr('id', 'popup_registration'); 842 jQuery('.header_mobile #popup_login').attr('id', 'popup_login_1'); 843 jQuery('.header_mobile #popup_registration').attr('id', 'popup_registration_1'); 844 } 845 } 846
847 if (jQuery(window).width() < 640) { 848 var pass = jQuery('.header_mobile .popup_wrap.popup_registration .registration_form > .form_right'); 849 if (pass.length > 0){ 850 jQuery('.header_mobile .popup_wrap.popup_registration .form_left .popup_form_field.email_field').after(pass); 851 } 852 } 853 else{ 854 var pass = jQuery('.header_mobile .popup_wrap.popup_registration .form_left > .form_right'); 855 if (pass.length > 0){ 856 jQuery('.header_mobile .popup_wrap.popup_registration .registration_form').append(pass); 857 } 858 } 859 860 if (!jQuery('.top_panel_wrap').hasClass('menu_show')) jQuery('.top_panel_wrap').addClass('menu_show'); 861 // Show widgets block on the sidebar outer (if sidebar not responsive and widgets are hidden) 862 if (jQuery('.sidebar_outer').length > 0 && jQuery('.sidebar_outer').css('position')=='absolute' && jQuery('.sidebar_outer_widgets:visible').length==0) 863 jQuery('.sidebar_outer_widgets').show(); 864 // Switch popup menu / hierarchical list on product categories list placed in sidebar 865 var cat_menu = jQuery('body:not(.woocommerce) .widget_area:not(.footer_wrap) .widget_product_categories ul.product-categories'); 866 var sb = cat_menu.parents('.widget_area'); 867 if (sb.length > 0 && cat_menu.length > 0) { 868 if (sb.width() == sb.parents('.content_wrap').width()) { 869 if (cat_menu.hasClass('inited')) { 870 cat_menu.removeClass('inited').addClass('plain').superfish('destroy'); 871 cat_menu.find('ul.animated').removeClass('animated').addClass('no_animated'); 872 } 873 } else { 874 if (!cat_menu.hasClass('inited')) { 875 cat_menu.removeClass('plain').addClass('inited'); 876 cat_menu.find('ul.no_animated').removeClass('no_animated').addClass('animated'); 877 jacqueline_init_sfmenu('body:not(.woocommerce) .widget_area:not(.footer_wrap) .widget_product_categories ul.product-categories'); 878 } 879 } 880 } 881} 882 883 884// Check if responsive menu need 885function jacqueline_is_responsive_need(max_width) { 886 "use strict"; 887 var rez = false; 888 if (max_width > 0) { 889 var w = window.innerWidth; 890 if (w == undefined) { 891 w = jQuery(window).width()+(jQuery(window).height() < jQuery(document).height() || jQuery(window).scrollTop() > 0 ? 16 : 0); 892 } 893 rez = max_width > w; 894 } 895 return rez; 896} 897 898 899// Fit video frames to document width 900function jacqueline_video_dimensions() { 901 "use strict"; 902 jQuery('.sc_video_frame').each(function() { 903 "use strict"; 904 if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return; 905 var frame = jQuery(this).eq(0); 906 var player = frame.parent(); 907 var ratio = (frame.data('ratio') ? frame.data('ratio').split(':') : (frame.find('[data-ratio]').length>0 ? frame.find('[data-ratio]').data('ratio').split(':') : [16,9])); 908 ratio = ratio.length!=2 || ratio[0]==0 || ratio[1]==0 ? 16/9 : ratio[0]/ratio[1]; 909 var w_attr = frame.data('width'); 910 var h_attr = frame.data('height'); 911 if (!w_attr || !h_attr) return; 912 var percent = (''+w_attr).substr(-1)=='%'; 913 w_attr = parseInt(w_attr); 914 h_attr = parseInt(h_attr); 915 var w_real = Math.min(percent || frame.parents('.columns_wrap').length>0 ? 10000 : w_attr, frame.parents('div,article').width()), //player.width(); 916 h_real = Math.round(percent ? w_real/ratio : w_real/w_attr*h_attr); 917 if (parseInt(frame.attr('data-last-width'))==w_real) return; 918 if (percent) { 919 frame.height(h_real); 920 } else { 921 frame.css({'width': w_real+'px', 'height': h_real+'px'}); 922 } 923 frame.attr('data-last-width', w_real); 924 }); 925 jQuery('video.sc_video,video.wp-video-shortcode').each(function() { 926 "use strict"; 927 if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return; 928 var video = jQuery(this).eq(0); 929 var ratio = (video.data('ratio')!=undefined ? video.data('ratio').split(':') : [16,9]); 930 ratio = ratio.length!=2 || ratio[0]==0 || ratio[1]==0 ? 16/9 : ratio[0]/ratio[1]; 931 var mejs_cont = video.parents('.mejs-video'); 932 var frame = video.parents('.sc_video_frame'); 933 var w_attr = frame.length>0 ? frame.data('width') : video.data('width'); 934 var h_attr = frame.length>0 ? frame.data('height') : video.data('height'); 935 if (!w_attr || !h_attr) { 936 w_attr = video.attr('width'); 937 h_attr = video.attr('height'); 938 if (!w_attr || !h_attr) return;
939 video.data({'width': w_attr, 'height': h_attr}); 940 } 941 var percent = (''+w_attr).substr(-1)=='%'; 942 w_attr = parseInt(w_attr); 943 h_attr = parseInt(h_attr); 944 var w_real = Math.round(mejs_cont.length > 0 ? Math.min(percent ? 10000 : w_attr, mejs_cont.parents('div,article').width()) : video.width()), 945 h_real = Math.round(percent ? w_real/ratio : w_real/w_attr*h_attr); 946 if (parseInt(video.attr('data-last-width'))==w_real) return; 947 if (mejs_cont.length > 0 && mejs) { 948 jacqueline_set_mejs_player_dimensions(video, w_real, h_real); 949 } 950 if (percent) { 951 video.height(h_real); 952 } else { 953 video.attr({'width': w_real, 'height': h_real}).css({'width': w_real+'px', 'height': h_real+'px'}); 954 } 955 video.attr('data-last-width', w_real); 956 }); 957 jQuery('video.sc_video_bg').each(function() { 958 "use strict"; 959 if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return; 960 var video = jQuery(this).eq(0); 961 var ratio = (video.data('ratio')!=undefined ? video.data('ratio').split(':') : [16,9]); 962 ratio = ratio.length!=2 || ratio[0]==0 || ratio[1]==0 ? 16/9 : ratio[0]/ratio[1]; 963 var mejs_cont = video.parents('.mejs-video'); 964 var container = mejs_cont.length>0 ? mejs_cont.parent() : video.parent(); 965 var w = container.width(); 966 var h = container.height(); 967 var w1 = Math.ceil(h*ratio); 968 var h1 = Math.ceil(w/ratio); 969 if (video.parents('.sc_parallax').length > 0) { 970 var windowHeight = jQuery(window).height(); 971 var speed = Number(video.parents('.sc_parallax').data('parallax-speed')); 972 var h_add = Math.ceil(Math.abs((windowHeight-h)*speed)); 973 if (h1 < h + h_add) { 974 h1 = h + h_add; 975 w1 = Math.ceil(h1 * ratio); 976 } 977 } 978 if (h1 < h) { 979 h1 = h; 980 w1 = Math.ceil(h1 * ratio); 981 } 982 if (w1 < w) { 983 w1 = w; 984 h1 = Math.ceil(w1 / ratio); 985 } 986 var l = Math.round((w1-w)/2); 987 var t = Math.round((h1-h)/2); 988 if (parseInt(video.attr('data-last-width'))==w1) return; 989 if (mejs_cont.length > 0) { 990 jacqueline_set_mejs_player_dimensions(video, w1, h1); 991 mejs_cont.css({ 992 //'left': -l+'px', 993 'top': -t+'px' 994 }); 995 } else 996 video.css({ 997 //'left': -l+'px', 998 'top': -t+'px' 999 }); 1000 video.attr({'width': w1, 'height': h1, 'data-last-width':w1}).css({'width':w1+'px', 'height':h1+'px'}); 1001 if (video.css('opacity')==0) video.animate({'opacity': 1}, 3000); 1002 }); 1003 jQuery('iframe').each(function() { 1004 "use strict"; 1005 if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return; 1006 var iframe = jQuery(this).eq(0); 1007 var ratio = (iframe.data('ratio')!=undefined ? iframe.data('ratio').split(':') : (iframe.find('[data-ratio]').length>0 ? iframe.find('[data-ratio]').data('ratio').split(':') : [16,9])); 1008 ratio = ratio.length!=2 || ratio[0]==0 || ratio[1]==0 ? 16/9 : ratio[0]/ratio[1]; 1009 var w_attr = iframe.attr('width'); 1010 var h_attr = iframe.attr('height'); 1011 var frame = iframe.parents('.sc_video_frame'); 1012 if (frame.length > 0) { 1013 w_attr = frame.data('width'); 1014 h_attr = frame.data('height'); 1015 } 1016 if (!w_attr || !h_attr) { 1017 return; 1018 } 1019 var percent = (''+w_attr).substr(-1)=='%'; 1020 w_attr = parseInt(w_attr); 1021 h_attr = parseInt(h_attr); 1022 var w_real = frame.length > 0 ? frame.width() : iframe.width(), 1023 h_real = Math.round(percent ? w_real/ratio : w_real/w_attr*h_attr); 1024 if (parseInt(iframe.attr('data-last-width'))==w_real) return; 1025 iframe.css({'width': w_real+'px', 'height': h_real+'px'}); 1026 }); 1027} 1028 1029// Resize fullscreen video background 1030function jacqueline_resize_video_background() { 1031 "use strict"; 1032 var bg = jQuery('.video_bg'); 1033 if (bg.length < 1) 1034 return; 1035 if (JACQUELINE_STORAGE['media_elements_enabled'] && bg.find('.mejs-video').length == 0) { 1036 setTimeout(jacqueline_resize_video_background, 100); 1037 return; 1038 } 1039 var video = bg.find('video'); 1040 var ratio = (video.data('ratio')!=undefined ? video.data('ratio').split(':') : [16,9]); 1041 ratio = ratio.length!=2 || ratio[0]==0 || ratio[1]==0 ? 16/9 : ratio[0]/ratio[1]; 1042 var w = bg.width(); 1043 var h = bg.height(); 1044 var w1 = Math.ceil(h*ratio); 1045 var h1 = Math.ceil(w/ratio); 1046 if (h1 < h) { 1047 h1 = h; 1048 w1 = Math.ceil(h1 * ratio); 1049 } 1050 if (w1 < w) { 1051 w1 = w; 1052 h1 = Math.ceil(w1 / ratio); 1053 } 1054 var l = Math.round((w1-w)/2); 1055 var t = Math.round((h1-h)/2); 1056 if (bg.find('.mejs-container').length > 0) { 1057 jacqueline_set_mejs_player_dimensions(bg.find('video'), w1, h1);
1058 bg.find('.mejs-container').css({'left': -l+'px', 'top': -t+'px'}); 1059 } else 1060 bg.find('video').css({'left': -l+'px', 'top': -t+'px'}); 1061 bg.find('video').attr({'width': w1, 'height': h1}).css({'width':w1+'px', 'height':h1+'px'}); 1062} 1063 1064// Set Media Elements player dimensions 1065function jacqueline_set_mejs_player_dimensions(video, w, h) { 1066 "use strict"; 1067 if (mejs) { 1068 for (var pl in mejs.players) { 1069 if (mejs.players[pl].media.src == video.attr('src')) { 1070 if (mejs.players[pl].media.setVideoSize) { 1071 mejs.players[pl].media.setVideoSize(w, h); 1072 } 1073 mejs.players[pl].setPlayerSize(w, h); 1074 mejs.players[pl].setControlsSize(); 1075 } 1076 } 1077 } 1078} 1079 1080// Resize Fullscreen Slider 1081function jacqueline_resize_fullscreen_slider() { 1082 "use strict"; 1083 var slider_wrap = jQuery('.slider_wrap.slider_fullscreen'); 1084 if (slider_wrap.length < 1) 1085 return; 1086 var slider = slider_wrap.find('.sc_slider_swiper'); 1087 if (slider.length < 1) 1088 return; 1089 var h = jQuery(window).height() - jQuery('#wpadminbar').height() - (jQuery('body').hasClass('top_panel_above') && !jQuery('body').hasClass('.top_panel_fixed') ? jQuery('.top_panel_wrap').height() : 0); 1090 slider.height(h); 1091} 1092 1093// Resize Alter portfolio elements 1094function jacqueline_resize_alter_portfolio() { 1095 "use strict"; 1096 var wrap = jQuery('.isotope_wrap.inited'); 1097 if (wrap.length==0) return; 1098 wrap.each(function() { 1099 "use strict"; 1100 var alter = jQuery(this).find('.post_item_alter'); 1101 if (alter.length==0) return; 1102 var single = alter.find('.post_featured img[data-alter-items-w="1"]').eq(0); 1103 if (single.length != 1) return; 1104 var w_real = single.width(); 1105 var h_real = single.height(); 1106 var space = Number(single.data('alter-item-space')); 1107 var relayout = false; 1108 alter.find('.post_featured img').each(function() { 1109 "use strict"; 1110 var items_w = Number(jQuery(this).data('alter-items-w')); 1111 var items_h = Number(jQuery(this).data('alter-items-h')); 1112 if (items_h > 1) { 1113 jQuery(this).height(Math.round(items_h*h_real+(items_h-1)*(space+1))); 1114 relayout = true; 1115 } else if (items_w > 1) { 1116 jQuery(this).height(h_real); 1117 relayout = true; 1118 } 1119 }); 1120 if (relayout) { 1121 jQuery(this).isotope('layout'); 1122 } 1123 }); 1124} 1125 1126 1127 1128 1129 1130// Navigation 1131//============================================== 1132 1133// Init Superfish menu 1134function jacqueline_init_sfmenu(selector) { 1135 "use strict"; 1136 jQuery(selector).show().each(function() { 1137 if (jacqueline_is_responsive_need() && (jQuery(this).attr('id')=='menu_main' || jQuery(this).attr('id')=='menu_side')) return; 1138 jQuery(this).addClass('inited').superfish({ 1139 delay: 500, 1140 animation: { 1141 opacity: 'show' 1142 }, 1143 animationOut: { 1144 opacity: 'hide' 1145 }, 1146 speed: JACQUELINE_STORAGE['css_animation'] ? 500 : 200, 1147 speedOut: JACQUELINE_STORAGE['css_animation'] ? 500 : 200,
1148 autoArrows: false, 1149 dropShadows: false, 1150 onBeforeShow: function(ul) { 1151 if (jQuery(this).parents("ul").length > 1){ 1152 var w = jQuery(window).width(); 1153 var par_offset = jQuery(this).parents("ul").offset().left; 1154 var par_width = jQuery(this).parents("ul").outerWidth(); 1155 var ul_width = jQuery(this).outerWidth(); 1156 if (par_offset+par_width+ul_width > w-20 && par_offset-ul_width > 0) 1157 jQuery(this).addClass('submenu_left'); 1158 else 1159 jQuery(this).removeClass('submenu_left'); 1160 } 1161 if (JACQUELINE_STORAGE['css_animation']) { 1162 jQuery(this).removeClass('animated fast '+JACQUELINE_STORAGE['menu_animation_out']); 1163 jQuery(this).addClass('animated fast '+JACQUELINE_STORAGE['menu_animation_in']); 1164 } 1165 }, 1166 onBeforeHide: function(ul) { 1167 if (JACQUELINE_STORAGE['css_animation']) { 1168 jQuery(this).removeClass('animated fast '+JACQUELINE_STORAGE['menu_animation_in']); 1169 jQuery(this).addClass('animated fast '+JACQUELINE_STORAGE['menu_animation_out']); 1170 } 1171 } 1172 }); 1173 }); 1174} 1175 1176 1177// Build page TOC from the tag's id 1178function jacqueline_build_page_toc() { 1179 "use strict"; 1180 var toc = '', toc_count = 0; 1181 jQuery('[id^="toc_"],.sc_anchor').each(function(idx) { 1182 "use strict"; 1183 var obj = jQuery(this); 1184 var id = obj.attr('id'); 1185 var url = obj.data('url'); 1186 var icon = obj.data('icon'); 1187 if (!icon) icon = 'icon-circle-dot'; 1188 var title = obj.attr('title'); 1189 var description = obj.data('description'); 1190 var separator = obj.data('separator'); 1191 toc_count++; 1192 toc += '<div class="toc_item'+(separator=='yes' ? ' toc_separator' : '')+'">' 1193 +(description ? '<div class="toc_description">'+description+'</div>' : '') 1194 +'<a href="'+(url ? url : '#'+id)+'" class="toc_icon'+(title ? ' with_title' : '')+' '+icon+'">'+(title ? '<span class="toc_title">'+title+'</span>' : '')+'</a>' 1195 +'</div>'; 1196 }); 1197 if (toc_count > (JACQUELINE_STORAGE['toc_menu_home'] ? 1 : 0) + (JACQUELINE_STORAGE['toc_menu_top'] ? 1 : 0)) { 1198 if (jQuery('#toc').length > 0) 1199 jQuery('#toc .toc_inner').html(toc); 1200 else 1201 jQuery('body').append('<div id="toc" class="toc_'+JACQUELINE_STORAGE['toc_menu']+'"><div class="toc_inner">'+toc+'</div></div>'); 1202 } 1203} 1204 1205 1206// Show current page title on the responsive menu button 1207function jacqueline_show_current_menu_item(menu, button) { 1208 "use strict"; 1209 menu.find('a').each(function () { 1210 var menu_link = jQuery(this); 1211 if (menu_link.text() == "") { 1212 return; 1213 } 1214 if (menu_link.attr('href') == window.location.href) 1215 button.text(menu_link.text()); 1216 }); 1217} 1218 1219 1220// Isotope 1221//===================================================== 1222 1223// First init isotope containers 1224function jacqueline_init_isotope() { 1225 "use strict"; 1226 1227 var all_images_complete = true; 1228 1229 // Check if all images in isotope wrapper are loaded 1230 jQuery('.isotope_wrap:not(.inited)').each(function () { 1231 "use strict"; 1232 all_images_complete = all_images_complete && jacqueline_check_images_complete(jQuery(this)); 1233 }); 1234 // Wait for images loading 1235 if (!all_images_complete && JACQUELINE_STORAGE['isotope_init_counter']++ < 30) { 1236 setTimeout(jacqueline_init_isotope, 200); 1237 return; 1238 } 1239 1240 // Isotope filters handler 1241 jQuery('.isotope_filters:not(.inited)').addClass('inited').on('click', 'a', function(e) { 1242 "use strict"; 1243 jQuery(this).parents('.isotope_filters').find('a').removeClass('active'); 1244 jQuery(this).addClass('active'); 1245 1246 var selector = jQuery(this).data('filter'); 1247 jQuery(this).parents('.isotope_filters').siblings('.isotope_wrap').eq(0).isotope({ 1248 filter: selector 1249 }); 1250 1251 if (selector == '*') 1252 jQuery('#viewmore_link').fadeIn(); 1253 else 1254 jQuery('#viewmore_link').fadeOut(); 1255 1256 e.preventDefault(); 1257 return false; 1258 }); 1259 1260 // Init isotope script 1261 jQuery('.isotope_wrap:not(.inited)').each(function() { 1262 "use strict"; 1263 1264 var isotope_container = jQuery(this); 1265 1266 // Init shortcodes 1267 if (window.jacqueline_sc_init !== undefined ) jacqueline_sc_init(isotope_container); 1268 1269 // If in scroll container - no init isotope 1270 if (isotope_container.parents('.sc_scroll').length > 0) { 1271 isotope_container.addClass('inited').find('.isotope_item').animate({opacity: 1}, 200, function () { jQuery(this).addClass('isotope_item_show'); }); 1272 return; 1273 } 1274 1275 // If in hidden container (in the inactive tab) - return without init 1276 if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return; 1277 1278 // Init isotope with timeout 1279 setTimeout(function() { 1280 isotope_container.addClass('inited').isotope({ 1281 itemSelector: '.isotope_item', 1282 animationOptions: { 1283 duration: 750, 1284 easing: 'linear', 1285 queue: false 1286 } 1287 }); 1288 1289 // Show elements 1290 isotope_container.find('.isotope_item').animate({opacity: 1}, 200, function () { 1291 jQuery(this).addClass('isotope_item_show'); 1292 }); 1293 1294 // Resize Alter portfolio elements 1295 jacqueline_resize_alter_portfolio(); 1296 1297 }, 500); 1298 1299 }); 1300} 1301 1302function jacqueline_init_appended_isotope(posts_container, filters) { 1303 "use strict"; 1304 1305 if (posts_container.parents('.sc_scroll_horizontal').length > 0) return; 1306 1307 if (!jacqueline_check_images_complete(posts_container) && JACQUELINE_STORAGE['isotope_init_counter']++ < 30) { 1308 setTimeout(function() { jacqueline_init_appended_isotope(posts_container, filters); }, 200); 1309 return; 1310 }
1311 // Add filters 1312 var flt = posts_container.siblings('.isotope_filter'); 1313 for (var i in filters) { 1314 if (flt.find('a[data-filter=".flt_'+i+'"]').length == 0) { 1315 flt.append('<a href="#" class="isotope_filters_button" data-filter=".flt_'+i+'">'+filters[i]+'</a>'); 1316 } 1317 } 1318 // Init shortcodes in added elements 1319 if (window.jacqueline_sc_init !== undefined ) jacqueline_sc_init(posts_container); 1320 // Get added elements 1321 var elems = posts_container.find('.isotope_item:not(.isotope_item_show)'); 1322 // Notify isotope about added elements with timeout 1323 setTimeout(function() { 1324 posts_container.isotope('appended', elems); 1325 // Show appended elements 1326 elems.animate({opacity: 1}, 200, function () { jQuery(this).addClass('isotope_item_show'); }); 1327 }, 500); 1328} 1329 1330 1331 1332// Post formats init 1333//===================================================== 1334 1335function jacqueline_init_post_formats() { 1336 "use strict"; 1337 1338 // Call theme specific action (if exists) 1339 if (window.jacqueline_theme_init_post_formats) jacqueline_theme_init_post_formats(); 1340 1341 // MediaElement init 1342 jacqueline_init_media_elements(jQuery('body')); 1343 1344 // Isotope first init 1345 if (jQuery('.isotope_wrap:not(.inited)').length > 0) { 1346 JACQUELINE_STORAGE['isotope_init_counter'] = 0; 1347 jacqueline_init_isotope(); 1348 } 1349 1350 // Hover Effect 'Dir' 1351 if (jQuery('.isotope_wrap .isotope_item_content.square.effect_dir:not(.inited)').length > 0) { 1352 jQuery('.isotope_wrap .isotope_item_content.square.effect_dir:not(.inited)').each(function() { 1353 jQuery(this).addClass('inited').hoverdir(); 1354 }); 1355 } 1356 1357 // Popup init 1358 if (JACQUELINE_STORAGE['popup_engine'] == 'pretty') { 1359 jQuery("a[href$='jpg'],a[href$='jpeg'],a[href$='png'],a[href$='gif']").attr('rel', 'prettyPhoto[slideshow]'); 1360 var images = jQuery("a[rel*='prettyPhoto']:not(.inited):not(.esgbox):not([data-rel*='pretty']):not([rel*='magnific']):not([data-rel*='magnific'])").addClass('inited'); 1361 try { 1362 images.prettyPhoto({ 1363 social_tools: '', 1364 theme: 'facebook', 1365 deeplinking: false 1366 }); 1367 } catch (e) {}; 1368 } else if (JACQUELINE_STORAGE['popup_engine']=='magnific') { 1369 jQuery("a[href$='jpg'],a[href$='jpeg'],a[href$='png'],a[href$='gif']").attr('rel', 'magnific'); 1370 var images = jQuery("a[rel*='magnific']:not(.inited):not(.esgbox):not(.prettyphoto):not([rel*='pretty']):not([data-rel*='pretty']):not([data-linktype*='lightbox'])").addClass('inited'); 1371 try { 1372 images.magnificPopup({ 1373 type: 'image', 1374 mainClass: 'mfp-img-mobile', 1375 closeOnContentClick: true, 1376 closeBtnInside: true, 1377 fixedContentPos: true, 1378 midClick: true, 1379 //removalDelay: 500, 1380 preloader: true, 1381 tLoading: JACQUELINE_STORAGE['strings']['magnific_loading'], 1382 gallery:{ 1383 enabled: true 1384 }, 1385 image: { 1386 tError: JACQUELINE_STORAGE['strings']['magnific_error'], 1387 verticalFit: true 1388 } 1389 }); 1390 } catch (e) {}; 1391 } 1392 1393 1394 // Add hover icon to products thumbnails 1395 jQuery(".post_item_product .product .images a.woocommerce-main-image:not(.hover_icon)").addClass('hover_icon hover_icon_view'); 1396 1397 1398 // Likes counter 1399 if (jQuery('.post_counters_likes:not(.inited)').length > 0) { 1400 jQuery('.post_counters_likes:not(.inited)') 1401 .addClass('inited') 1402 .on('click', function(e) { 1403 var button = jQuery(this); 1404 var inc = button.hasClass('enabled') ? 1 : -1; 1405 var post_id = button.data('postid'); 1406 var likes = Number(button.data('likes'))+inc; 1407 var cookie_likes = jacqueline_get_cookie('jacqueline_likes'); 1408 if (cookie_likes === undefined || cookie_likes===null) cookie_likes = ''; 1409 jQuery.post(JACQUELINE_STORAGE['ajax_url'], { 1410 action: 'post_counter', 1411 nonce: JACQUELINE_STORAGE['ajax_nonce'], 1412 post_id: post_id, 1413 likes: likes 1414 }).done(function(response) { 1415 var rez = {}; 1416 try { 1417 rez = JSON.parse(response); 1418 } catch (e) { 1419 rez = { error: JACQUELINE_STORAGE['ajax_error'] }; 1420 console.log(response); 1421 } 1422 if (rez.error === '') { 1423 if (inc == 1) { 1424 var title = button.data('title-dislike'); 1425 button.removeClass('enabled').addClass('disabled'); 1426 cookie_likes += (cookie_likes.substr(-1)!=',' ? ',' : '') + post_id + ','; 1427 } else { 1428 var title = button.data('title-like'); 1429 button.removeClass('disabled').addClass('enabled'); 1430 cookie_likes = cookie_likes.replace(','+post_id+',', ','); 1431 }
1432 button.data('likes', likes).attr('title', title).find('.post_counters_number').html(likes); 1433 jacqueline_set_cookie('jacqueline_likes', cookie_likes, 365); 1434 } else { 1435 jacqueline_message_warning(JACQUELINE_STORAGE['strings']['error_like']); 1436 } 1437 }); 1438 e.preventDefault(); 1439 return false; 1440 }); 1441 } 1442 1443 // Social share links 1444 if (jQuery('.sc_socials_share:not(.inited)').length > 0) { 1445 jQuery('.sc_socials_share:not(.inited)').each(function() { 1446 "use strict"; 1447 jQuery(this).addClass('inited').on('click', '.social_item_popup > a.social_icons', function(e) { 1448 "use strict"; 1449 var url = jQuery(this).data('link'); 1450 window.open(url, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=480, height=400, toolbar=0, status=0'); 1451 e.preventDefault(); 1452 return false; 1453 }); 1454 }); 1455 } 1456 1457 // Add video on thumb click 1458 if (jQuery('.sc_video_play_button:not(.inited)').length > 0) { 1459 jQuery('.sc_video_play_button:not(.inited)').each(function() { 1460 "use strict"; 1461 jQuery(this) 1462 .addClass('inited') 1463 .animate({opacity: 1}, 1000) 1464 .on('click', function (e) { 1465 "use strict"; 1466 if (!jQuery(this).hasClass('sc_video_play_button')) return; 1467 var video = jQuery(this).removeClass('sc_video_play_button hover_icon hover_icon_play').data('video'); 1468 if (video!=='') { 1469 jQuery(this).empty().html(video); 1470 jacqueline_video_dimensions(); 1471 var video_tag = jQuery(this).find('video'); 1472 var w = video_tag.width(); 1473 var h = video_tag.height(); 1474 jacqueline_init_media_elements(jQuery(this)); 1475 // Restore WxH attributes, because Chrome broke it! 1476 jQuery(this).find('video').css({'width':w, 'height': h}).attr({'width':w, 'height': h}); 1477 } 1478 e.preventDefault(); 1479 return false; 1480 }); 1481 }); 1482 } 1483 1484 // Tribe Events buttons 1485 jQuery('a.tribe-events-read-more,.tribe-events-button,.tribe-events-nav-previous a,.tribe-events-nav-next a,.tribe-events-widget-link a,.tribe-events-viewmore a').addClass('sc_button sc_button_style_filled'); 1486} 1487 1488 1489function jacqueline_init_media_elements(cont) { 1490 "use strict"; 1491 if (JACQUELINE_STORAGE['media_elements_enabled'] && cont.find('audio,video').length > 0) { 1492 if (window.mejs) { 1493 if (typeof window.mejs.MepDefaults != 'undefined') window.mejs.MepDefaults.enableAutosize = false; 1494 if (typeof window.mejs.MediaElementDefaults != 'undefined') window.mejs.MediaElementDefaults.enableAutosize = false; 1495 cont.find('audio:not(.wp-audio-shortcode),video:not(.wp-video-shortcode)').each(function() { 1496 if (jQuery(this).parents('.mejs-mediaelement').length == 0) { 1497 var media_tag = jQuery(this); 1498 var settings = { 1499 enableAutosize: true, 1500 videoWidth: -1, // if set, overrides <video width> 1501 videoHeight: -1, // if set, overrides <video height> 1502 audioWidth: '100%', // width of audio player 1503 audioHeight: 30, // height of audio player 1504 success: function(mejs) { 1505 var autoplay, loop; 1506 if ( 'flash' === mejs.pluginType ) { 1507 autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; 1508 loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop; 1509 autoplay && mejs.addEventListener( 'canplay', function () { 1510 mejs.play(); 1511 }, false ); 1512 loop && mejs.addEventListener( 'ended', function () { 1513 mejs.play(); 1514 }, false ); 1515 } 1516 media_tag.parents('.sc_audio,.sc_video').addClass('inited sc_show'); 1517 } 1518 }; 1519 jQuery(this).mediaelementplayer(settings); 1520 } 1521 }); 1522 } else 1523 setTimeout(function() { jacqueline_init_media_elements(cont); }, 400); 1524 } 1525} 1526 1527 1528 1529 1530 1531 1532// Popups and system messages 1533//============================================== 1534 1535// Show system message (bubble from previous page) 1536function jacqueline_show_system_message() { 1537 "use strict"; 1538 if (JACQUELINE_STORAGE['system_message'] && JACQUELINE_STORAGE['system_message']['message']) { 1539 if (JACQUELINE_STORAGE['system_message']['status'] == 'success') 1540 jacqueline_message_success(JACQUELINE_STORAGE['system_message']['message'], JACQUELINE_STORAGE['system_message']['header']); 1541 else if (JACQUELINE_STORAGE['system_message']['status'] == 'info') 1542 jacqueline_message_info(JACQUELINE_STORAGE['system_message']['message'], JACQUELINE_STORAGE['system_message']['header']); 1543 else if (JACQUELINE_STORAGE['system_message']['status'] == 'error' || JA
1543CQUELINE_STORAGE['system_message']['status'] == 'warning') 1544 jacqueline_message_warning(JACQUELINE_STORAGE['system_message']['message'], JACQUELINE_STORAGE['system_message']['header']); 1545 } 1546} 1547 1548// Toggle popups 1549function jacqueline_toggle_popup(popup) { 1550 "use strict"; 1551 if (popup.css('display')!='none') 1552 jacqueline_hide_popup(popup); 1553 else 1554 jacqueline_show_popup(popup); 1555} 1556 1557// Show popups 1558function jacqueline_show_popup(popup) { 1559 "use strict"; 1560 if (popup.css('display')=='none') { 1561 if (false && JACQUELINE_STORAGE['css_animation']) 1562 popup.show().removeClass('animated fast fadeOut').addClass('animated fast fadeIn'); 1563 else 1564 popup.slideDown(); 1565 } 1566} 1567 1568// Hide popups 1569function jacqueline_hide_popup(popup) { 1570 "use strict"; 1571 if (popup.css('display')!='none') { 1572 if (false && JACQUELINE_STORAGE['css_animation']) 1573 popup.removeClass('animated fast '+JACQUELINE_STORAGE['menu_animation_in']).addClass('animated fast '+JACQUELINE_STORAGE['menu_animation_out']).delay(500).hide(); 1574 else 1575 popup.fadeOut(); 1576 } 1577}
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.