1var woof_redirect = '';//if we use redirect attribute in shortcode [woof] 2//*** 3 4jQuery(function ($) { 5 jQuery('body').append('<div id="woof_html_buffer" class="woof_info_popup" style="display: none;"></div>'); 6 jQuery.fn.life = function (types, data, fn) { 7 jQuery(this.context).on(types, this.selector, data, fn); 8 return this; 9 }; 10//http://stackoverflow.com/questions/2389540/jquery-hasparent 11 jQuery.extend(jQuery.fn, { 12 within: function (pSelector) { 13 // Returns a subset of items using jQuery.filter 14 return this.filter(function () { 15 // Return truthy/falsey based on presence in parent 16 return jQuery(this).closest(pSelector).length; 17 }); 18 } 19 }); 20 21 //+++ 22 23 if (jQuery('#woof_results_by_ajax').length > 0) { 24 woof_is_ajax = 1; 25 } 26 27 //listening attributes in shortcode [woof] 28 woof_autosubmit = parseInt(jQuery('.woof').eq(0).data('autosubmit'), 10); 29 woof_ajax_redraw = parseInt(jQuery('.woof').eq(0).data('ajax-redraw'), 10); 30 31 32 33 //+++ 34 35 woof_ext_init_functions = jQuery.parseJSON(woof_ext_init_functions); 36 37 //fix for native woo price range 38 woof_init_native_woo_price_filter(); 39 40 41 jQuery('body').bind('price_slider_change', function (event, min, max) { 42 if (woof_autosubmit && !woof_show_price_search_button && jQuery('.price_slider_wrapper').length < 2) { 43 44 jQuery('.woof .widget_price_filter form').trigger('submit'); 45 46 } else { 47 var min_price = jQuery(this).find('.price_slider_amount #min_price').val(); 48 var max_price = jQuery(this).find('.price_slider_amount #max_price').val(); 49 woof_current_values.min_price = min_price; 50 woof_current_values.max_price = max_price; 51 } 52 }); 53 54 jQuery('.woof_price_filter_dropdown').life('change', function () { 55 var val = jQuery(this).val(); 56 if (parseInt(val, 10) == -1) { 57 delete woof_current_values.min_price; 58 delete woof_current_values.max_price; 59 } else { 60 var val = val.split("-"); 61 woof_current_values.min_price = val[0]; 62 woof_current_values.max_price = val[1]; 63 } 64 65 if (woof_autosubmit || jQuery(this).within('.woof').length == 0) { 66 woof_submit_link(woof_get_submit_link()); 67 } 68 }); 69 70 71 72 73 74 //change value in textinput price filter if WOOCS is installed 75 woof_recount_text_price_filter(); 76 //+++ 77 jQuery('.woof_price_filter_txt').life('change', function () { 78 79 var from = parseInt(jQuery(this).parent().find('.woof_price_filter_txt_from').val(), 10); 80 var to = parseInt(jQuery(this).parent().find('.woof_price_filter_txt_to').val(), 10); 81 82 if (to < from || from < 0) { 83 delete woof_current_values.min_price; 84 delete woof_current_values.max_price; 85 } else { 86 if (typeof woocs_current_currency !== 'undefined') { 87 from = Math.ceil(from / parseFloat(woocs_current_currency.rate)); 88 to = Math.ceil(to / parseFloat(woocs_current_currency.rate)); 89 } 90 91 woof_current_values.min_price = from; 92 woof_current_values.max_price = to; 93 } 94 95 if (woof_autosubmit || jQuery(this).within('.woof').length == 0) { 96 woof_submit_link(woof_get_submit_link()); 97 } 98 }); 99 100 101 //*** 102 103 jQuery('.woof_open_hidden_li_btn').life('click', function () { 104 var state = jQuery(this).data('state'); 105 var type = jQuery(this).data('type'); 106 107 if (state == 'closed') { 108 jQuery(this).parents('.woof_list').find('.woof_hidden_term').addClass('woof_hidden_term2'); 109 jQuery(this).parents('.woof_list').find('.woof_hidden_term').removeClass('woof_hidden_term'); 110 if (type == 'image') { 111 jQuery(this).find('img').attr('src', jQuery(this).data('opened')); 112 } else { 113 jQuery(this).html(jQuery(this).data('opened')); 114 } 115 116 jQuery(this).data('state', 'opened'); 117 } else { 118 jQuery(this).parents('.woof_list').find('.woof_hidden_term2').addClass('woof_hidden_term'); 119 jQuery(this).parents('.woof_list').find('.woof_hidden_term2').removeClass('woof_hidden_term2'); 120 121 if (type == 'image') { 122 jQuery(this).find('img').attr('src', jQuery(this).data('closed')); 123 } else { 124 jQuery(this).text(jQuery(this).data('closed')); 125 } 126 127 jQuery(this).data('state', 'closed'); 128 } 129 130 131 return false; 132 });
133 //open hidden block 134 woof_open_hidden_li(); 135 136 //*** woocommerce native "AVERAGE RATING" widget synchronizing 137 jQuery('.widget_rating_filter li.wc-layered-nav-rating a').click(function () { 138 var is_chosen = jQuery(this).parent().hasClass('chosen'); 139 var parsed_url = woof_parse_url(jQuery(this).attr('href')); 140 var rate = 0; 141 if (parsed_url.query !== undefined) { 142 if (parsed_url.query.indexOf('min_rating') !== -1) { 143 var arrayOfStrings = parsed_url.query.split('min_rating='); 144 rate = parseInt(arrayOfStrings[1], 10); 145 } 146 } 147 jQuery(this).parents('ul').find('li').removeClass('chosen'); 148 if (is_chosen) { 149 delete woof_current_values.min_rating; 150 } else { 151 woof_current_values.min_rating = rate; 152 jQuery(this).parent().addClass('chosen'); 153 } 154 155 woof_submit_link(woof_get_submit_link()); 156 157 return false; 158 }); 159 160 //WOOF start filtering button action 161 jQuery('.woof_start_filtering_btn').life('click', function () { 162 163 var shortcode = jQuery(this).parents('.woof').data('shortcode'); 164 jQuery(this).html(woof_lang_loading); 165 jQuery(this).addClass('woof_start_filtering_btn2'); 166 jQuery(this).removeClass('woof_start_filtering_btn'); 167 //redrawing [woof ajax_redraw=1] only 168 var data = { 169 action: "woof_draw_products", 170 page: 1, 171 shortcode: 'woof_nothing', //we do not need get any products, seacrh form data only 172 woof_shortcode: shortcode 173 }; 174 console.log(data); 175 jQuery.post(woof_ajaxurl, data, function (content) { 176 content = jQuery.parseJSON(content); 177 jQuery('div.woof_redraw_zone').replaceWith(jQuery(content.form).find('.woof_redraw_zone')); 178 woof_mass_reinit(); 179 }); 180 181 182 return false; 183 }); 184 185 //*** 186 var str = window.location.href; 187 window.onpopstate = function (event) { 188 try { 189 console.log(woof_current_values) 190 if (Object.keys(woof_current_values).length) { 191 192 var temp = str.split('?'); 193 var get1=""; 194 if(temp[1]!=undefined){ 195 get1 = temp[1].split('#'); 196 } 197 var str2 = window.location.href; 198 var temp2 = str2.split('?'); 199 if(temp2[1]==undefined){ 200 //return false; 201 var get2={0:"",1:""}; 202 203 }else{ 204 var get2 = temp2[1].split('#'); 205 } 206 207 if (get2[0] != get1[0]) { 208 woof_show_info_popup(woof_lang_loading); 209 window.location.reload(); 210 } 211 return false; 212 } 213 } catch (e) { 214 console.log(e); 215 } 216 }; 217 //*** 218 219 //ion-slider price range slider 220 woof_init_ion_sliders(); 221 222 //*** 223 224 woof_init_show_auto_form(); 225 woof_init_hide_auto_form(); 226 227 //*** 228 woof_remove_empty_elements(); 229 230 woof_init_search_form(); 231 woof_init_pagination(); 232 woof_init_orderby(); 233 woof_init_reset_button(); 234 woof_init_beauty_scroll(); 235 //+++ 236 woof_draw_products_top_panel(); 237 woof_shortcode_observer(); 238 239 //tooltip 240 woof_init_tooltip(); 241 242 243//+++ 244 //if we use redirect attribute in shortcode [woof is_ajax=0] 245 //not for ajax, for redirect mode only 246 if (!woof_is_ajax) { 247 woof_redirect_init(); 248 } 249 250 woof_init_toggles(); 251 252}); 253 254//if we use redirect attribute in shortcode [woof is_ajax=0] 255//not for ajax, for redirect mode only 256function woof_redirect_init() { 257 258 try { 259 if (jQuery('.woof').length ) { 260 //https://wordpress.org/support/topic/javascript-error-in-frontjs?replies=1 261 if (undefined !== jQuery('.woof').val()) { 262 woof_redirect = jQuery('.woof').eq(0).data('redirect');//default value 263 if (woof_redirect.length > 0) { 264 woof_shop_page = woof_current_page_link = woof_redirect; 265 } 266 267 268 //*** 269 /* 270 var events = ['click', 'change', 'ifChecked', 'ifUnchecked']; 271 272 for (var i = 0; i < events.length; i++) { 273 274 jQuery('div.woof input, div.woof option, div.woof div, div.woof label').live(events[i], function (e) { 275 try { 276 if (jQuery(this).parents('.woof').data('redirect').length > 0) { 277 woof_redirect = jQuery(this).parents('.woof').data('redirect'); 278 } 279 } catch (e) { 280 console.log('Error: attribute redirection doesn works!'); 281 } 282 e.stopPropagation(); 283 }); 284 285 } 286 */ 287 //*** 288 289 290 return woof_redirect; 291 } 292 } 293 } catch (e) { 294 console.log(e); 295 } 296 297} 298 299function woof_init_orderby() { 300 jQuery('form.woocommerce-ordering').life('submit', function () { 301 /* woo3.3 */ 302 if(!jQuery("#is_woo_shortcode").length){ 303 return false; 304 } 305 /* +++ */ 306 });
307 jQuery('form.woocommerce-ordering select.orderby').life('change', function () { 308 /* woo3.3 */ 309 if(!jQuery("#is_woo_shortcode").length){ 310 woof_current_values.orderby = jQuery(this).val(); 311 woof_ajax_page_num = 1; 312 woof_submit_link(woof_get_submit_link()); 313 return false; 314 } 315 /* +++ */ 316 }); 317} 318 319function woof_init_reset_button() { 320 jQuery('.woof_reset_search_form').life('click', function () { 321 //var link = jQuery(this).data('link'); 322 woof_ajax_page_num = 1; 323 woof_ajax_redraw = 0; 324 if (woof_is_permalink) { 325 woof_current_values = {}; 326 woof_submit_link(woof_get_submit_link().split("page/")[0]); 327 } else { 328 var link = woof_shop_page; 329 if (woof_current_values.hasOwnProperty('page_id')) { 330 link = location.protocol + '//' + location.host + "/?page_id=" + woof_current_values.page_id; 331 woof_current_values = {'page_id': woof_current_values.page_id}; 332 woof_get_submit_link(); 333 } 334 //*** 335 woof_submit_link(link); 336 if (woof_is_ajax) { 337 history.pushState({}, "", link); 338 if (woof_current_values.hasOwnProperty('page_id')) { 339 woof_current_values = {'page_id': woof_current_values.page_id}; 340 } else { 341 woof_current_values = {}; 342 } 343 } 344 } 345 return false; 346 }); 347} 348 349function woof_init_pagination() { 350 351 if (woof_is_ajax === 1) { 352 //jQuery('.woocommerce-pagination ul.page-numbers a.page-numbers').life('click', function () { 353 jQuery('a.page-numbers').life('click', function () { 354 var l = jQuery(this).attr('href'); 355 356 if (woof_ajax_first_done) { 357 //http://woocommerce-filter.pluginus.net/wp-admin/admin-ajax.php?paged=2 358 var res = l.split("paged="); 359 if (typeof res[1] !== 'undefined') { 360 woof_ajax_page_num = parseInt(res[1]); 361 } else { 362 woof_ajax_page_num = 1; 363 } 364 var res2 = l.split("product-page="); 365 if (typeof res2[1] !== 'undefined') { 366 woof_ajax_page_num = parseInt(res2[1]); 367 } 368 } else { 369 //http://woocommerce-filter.pluginus.net/tester/page/2/ 370 var res = l.split("page/"); 371 if (typeof res[1] !== 'undefined') { 372 woof_ajax_page_num = parseInt(res[1]); 373 } else { 374 woof_ajax_page_num = 1; 375 } 376 var res2 = l.split("product-page="); 377 if (typeof res2[1] !== 'undefined') { 378 woof_ajax_page_num = parseInt(res2[1]); 379 } 380 } 381 382 //+++ 383 384 //if (woof_autosubmit) - pagination doesn need pressing any submit button!! 385 { 386 woof_submit_link(woof_get_submit_link()); 387 } 388 389 return false; 390 }); 391 } 392} 393 394function woof_init_search_form() { 395 woof_init_checkboxes(); 396 woof_init_mselects(); 397 woof_init_radios(); 398 woof_price_filter_radio_init(); 399 woof_init_selects(); 400 401 402 //for extensions 403 if (woof_ext_init_functions !== null) { 404 jQuery.each(woof_ext_init_functions, function (type, func) { 405 eval(func + '()'); 406 }); 407 } 408 //+++ 409 //var containers = jQuery('.woof_container'); 410 411 //+++ 412 jQuery('.woof_submit_search_form').click(function () { 413 414 if (woof_ajax_redraw) { 415 //[woof redirect="http://www.dev.woocommerce-filter.com/test-all/" autosubmit=1 ajax_redraw=1 is_ajax=1 tax_only="locations" by_only="none"] 416 woof_ajax_redraw = 0; 417 woof_is_ajax = 0; 418 } 419 //*** 420 woof_submit_link(woof_get_submit_link()); 421 return false; 422 }); 423 424 425 426 //*** 427 jQuery('ul.woof_childs_list').parent('li').addClass('woof_childs_list_li'); 428 429 //*** 430 431 woof_remove_class_widget(); 432 woof_checkboxes_slide(); 433} 434 435var woof_submit_link_locked = false; 436function woof_submit_link(link) { 437 438 439 if (woof_submit_link_locked) { 440 return; 441 } 442 443 woof_submit_link_locked = true; 444 woof_show_info_popup(woof_lang_loading); 445 446 if (woof_is_ajax === 1 && !woof_ajax_redraw) { 447 448 woof_ajax_first_done = true; 449 var data = { 450 action: "woof_draw_products", 451 link: link, 452 page: woof_ajax_page_num, 453 shortcode: jQuery('#woof_results_by_ajax').data('shortcode'), 454 woof_shortcode: jQuery('div.woof').data('shortcode') 455 }; 456 457 jQuery.post(woof_ajaxurl, data, function (content) { 458 content = jQuery.parseJSON(content); 459 if (jQuery('.woof_results_by_ajax_shortcode').length) { 460 jQuery('#woof_results_by_ajax').replaceWith(content.products); 461 } else { 462 jQuery('.woof_shortcode_output').replaceWith(content.products); 463 } 464 465 jQuery('div.woof_redraw_zone').replaceWith(jQuery(content.form).find('.woof_redraw_zone')); 466 woof_draw_products_top_panel(); 467 woof_mass_reinit(); 468 woof_submit_link_locked = false; 469 //removing id woof_results_by_ajax - multi in ajax mode sometimes 470 //when uses shorcode woof_products in ajax and in settings try ajaxify shop is Yes 471 jQuery.each(jQuery('#woof_results_by_ajax'), function (index, item) { 472 if (index == 0) { 473 return; 474 } 475 476 jQuery(item).removeAttr('id'); 477 }); 478 //infinite scroll 479 woof_infinite();
480 //*** script after ajax loading here 481 woof_js_after_ajax_done(); 482 //*** change link in button "add to cart" 483 woof_change_link_addtocart(); 484 485 /*tooltip*/ 486 woof_init_tooltip(); 487 488 }); 489 490 } else { 491 492 if (woof_ajax_redraw) { 493 //redrawing [woof ajax_redraw=1] only 494 var data = { 495 action: "woof_draw_products", 496 link: link, 497 page: 1, 498 shortcode: 'woof_nothing', //we do not need get any products, seacrh form data only 499 woof_shortcode: jQuery('div.woof').eq(0).data('shortcode') 500 }; 501 jQuery.post(woof_ajaxurl, data, function (content) { 502 content = jQuery.parseJSON(content); 503 jQuery('div.woof_redraw_zone').replaceWith(jQuery(content.form).find('.woof_redraw_zone')); 504 woof_mass_reinit(); 505 woof_submit_link_locked = false; 506 }); 507 } else { 508 509 window.location = link; 510 woof_show_info_popup(woof_lang_loading); 511 } 512 } 513} 514 515function woof_remove_empty_elements() { 516 // lets check for empty drop-downs 517 jQuery.each(jQuery('.woof_container select'), function (index, select) { 518 var size = jQuery(select).find('option').length; 519 if (size === 0) { 520 jQuery(select).parents('.woof_container').remove(); 521 } 522 }); 523 //+++ 524 // lets check for empty checkboxes, radio, color conatiners 525 jQuery.each(jQuery('ul.woof_list'), function (index, ch) { 526 var size = jQuery(ch).find('li').length; 527 if (size === 0) { 528 jQuery(ch).parents('.woof_container').remove(); 529 } 530 }); 531} 532 533function woof_get_submit_link() { 534//filter woof_current_values values 535 if (woof_is_ajax) { 536 woof_current_values.page = woof_ajax_page_num; 537 } 538//+++ 539 if (Object.keys(woof_current_values).length > 0) { 540 jQuery.each(woof_current_values, function (index, value) { 541 if (index == swoof_search_slug) { 542 delete woof_current_values[index]; 543 } 544 if (index == 's') { 545 delete woof_current_values[index]; 546 } 547 if (index == 'product') { 548//for single product page (when no permalinks) 549 delete woof_current_values[index]; 550 } 551 if (index == 'really_curr_tax') { 552 delete woof_current_values[index]; 553 } 554 }); 555 } 556 557 558 //*** 559 if (Object.keys(woof_current_values).length === 2) { 560 if (('min_price' in woof_current_values) && ('max_price' in woof_current_values)) { 561 var l = woof_current_page_link + '?min_price=' + woof_current_values.min_price + '&max_price=' + woof_current_values.max_price; 562 if (woof_is_ajax) { 563 history.pushState({}, "", l); 564 } 565 return l; 566 } 567 } 568 569 570 571 //*** 572 573 if (Object.keys(woof_current_values).length === 0) { 574 if (woof_is_ajax) { 575 history.pushState({}, "", woof_current_page_link); 576 } 577 return woof_current_page_link; 578 } 579 //+++ 580 if (Object.keys(woof_really_curr_tax).length > 0) { 581 woof_current_values['really_curr_tax'] = woof_really_curr_tax.term_id + '-' + woof_really_curr_tax.taxonomy; 582 } 583 //+++ 584 var link = woof_current_page_link + "?" + swoof_search_slug + "=1"; 585 //console.log(woof_current_page_link); 586 //just for the case when no permalinks enabled 587 if (!woof_is_permalink) { 588 589 if (woof_redirect.length > 0) { 590 link = woof_redirect + "?" + swoof_search_slug + "=1"; 591 if (woof_current_values.hasOwnProperty('page_id')) { 592 delete woof_current_values.page_id; 593 } 594 } else { 595 link = location.protocol + '//' + location.host + "?" + swoof_search_slug + "=1"; 596 /* 597 if (!woof_is_ajax) { 598 link = location.protocol + '//' + location.host + "?" + swoof_search_slug + "=1"; 599 } 600 601 if (woof_current_values.hasOwnProperty('page_id')) { 602 link = location.protocol + '//' + location.host + "?" + swoof_search_slug + "=1"; 603 } 604 */ 605 } 606 } 607 //console.log(link); 608 //throw('STOP!'); 609 610 //any trash for different sites, useful for quick support 611 var woof_exclude_accept_array = ['path']; 612 613 if (Object.keys(woof_current_values).length > 0) { 614 jQuery.each(woof_current_values, function (index, value) { 615 if (index == 'page' && woof_is_ajax) { 616 index = 'paged';//for right pagination if copy/paste this link and send somebody another by email for example 617 } 618 619 //http://www.dev.woocommerce-filter.com/?swoof=1&woof_author=3&woof_sku&woof_text=single 620 //avoid links where values is empty 621 if (typeof value !== 'undefined') { 622 if ((typeof value && value.length > 0) || typeof value == 'number') 623 { 624 if (jQuery.inArray(index, woof_exclude_accept_array) == -1) { 625 link = link + "&" + index + "=" + value; 626 } 627 } 628 } 629 630 }); 631 } 632 633 //+++ 634 //remove wp pagination like 'page/2' 635 link = link.replace(new RegExp(/page\/(\d+)\//), ""); 636 if (woof_is_ajax) { 637 history.pushState({}, "", link); 638 639 } 640 641 //throw ("STOP!"); 642 return link; 643} 644 645 646 647function woof_show_info_popup(text) { 648 if (woof_overlay_skin == 'default') { 649 jQuery("#woof_html_buffer").text(text); 650 jQuery("#woof_html_buffer").fadeTo(200, 0.9); 651 } else {
652 //http://jxnblk.com/loading/ 653 switch (woof_overlay_skin) { 654 case 'loading-balls': 655 case 'loading-bars': 656 case 'loading-bubbles': 657 case 'loading-cubes': 658 case 'loading-cylon': 659 case 'loading-spin': 660 case 'loading-spinning-bubbles': 661 case 'loading-spokes': 662 jQuery('body').plainOverlay('show', {progress: function () { 663 return jQuery('<div id="woof_svg_load_container"><img style="height: 100%;width: 100%" src="' + woof_link + 'img/loading-master/' + woof_overlay_skin + '.svg" alt=""></div>'); 664 }}); 665 break; 666 default: 667 jQuery('body').plainOverlay('show', {duration: -1}); 668 break; 669 } 670 } 671} 672 673 674function woof_hide_info_popup() { 675 if (woof_overlay_skin == 'default') { 676 window.setTimeout(function () { 677 jQuery("#woof_html_buffer").fadeOut(400); 678 }, 200); 679 } else { 680 jQuery('body').plainOverlay('hide'); 681 } 682} 683 684function woof_draw_products_top_panel() { 685 686 if (woof_is_ajax) { 687 jQuery('#woof_results_by_ajax').prev('.woof_products_top_panel').remove(); 688 } 689 690 var panel = jQuery('.woof_products_top_panel'); 691 692 panel.html(''); 693 if (Object.keys(woof_current_values).length > 0) { 694 panel.show(); 695 panel.html('<ul></ul>'); 696 var is_price_in = false; 697 //lets show this on the panel 698 jQuery.each(woof_current_values, function (index, value) { 699 //lets filter data for the panel 700 if (jQuery.inArray(index, woof_accept_array) == -1) { 701 return; 702 } 703 704 //*** 705 706 if ((index == 'min_price' || index == 'max_price') && is_price_in) { 707 return; 708 } 709 710 if ((index == 'min_price' || index == 'max_price') && !is_price_in) { 711 is_price_in = true; 712 index = 'price'; 713 value = woof_lang_pricerange; 714 } 715 //+++ 716 value = value.toString().trim(); 717 if (value.search(',')) { 718 value = value.split(','); 719 } 720 //+++ 721 jQuery.each(value, function (i, v) { 722 if (index == 'page') { 723 return; 724 } 725 726 if (index == 'post_type') { 727 return; 728 } 729 730 var txt = v; 731 if (index == 'orderby') { 732 if (woof_lang[v] !== undefined) { 733 txt = woof_lang.orderby + ': ' + woof_lang[v]; 734 } else { 735 txt = woof_lang.orderby + ': ' + v; 736 } 737 } else if (index == 'perpage') { 738 txt = woof_lang.perpage; 739 } else if (index == 'price') { 740 txt = woof_lang.pricerange; 741 } else { 742 743 var is_in_custom = false; 744 if (Object.keys(woof_lang_custom).length > 0) { 745 jQuery.each(woof_lang_custom, function (i, tt) { 746 if (i == index) { 747 is_in_custom = true; 748 txt = tt; 749 if (index == 'woof_sku') { 750 txt += " " + v;//because search by SKU can by more than 1 value 751 } 752 } 753 }); 754 } 755 756 if (!is_in_custom) { 757 try { 758 //txt = jQuery('.woof_n_' + index + '_' + v).val(); 759 txt = jQuery("input[data-anchor='woof_n_" + index + '_' + v + "']").val(); 760 //console.log("input[data-anchor='woof_n_" + index + '_' + v + "']") 761 } catch (e) { 762 console.log(e); 763 } 764 765 if (typeof txt === 'undefined') 766 { 767 txt = v; 768 } 769 } 770 771 772 /* hidden feature 773 if (jQuery('input[name=woof_t_' + index + ']').length > 0) { 774 txt = jQuery('input[name=woof_t_' + index + ']').val() + ': ' + txt; 775 } 776 */ 777 778 779 } 780 781 panel.find('ul').append( 782 jQuery('<li>').append( 783 jQuery('<a>').attr('href', v).attr('data-tax', index).append( 784 jQuery('<span>').attr('class', 'woof_remove_ppi').append(txt) 785 ))); 786 787 }); 788 789 790 }); 791 } 792 793 794 if (jQuery(panel).find('li').length == 0 || !jQuery('.woof_products_top_panel').length) { 795 panel.hide(); 796 } 797 798 //+++ 799 jQuery('.woof_remove_ppi').parent().click(function () { 800 var tax = jQuery(this).data('tax'); 801 var name = jQuery(this).attr('href'); 802 803 //*** 804 805 if (tax != 'price') { 806 values = woof_current_values[tax]; 807 values = values.split(','); 808 var tmp = []; 809 jQuery.each(values, function (index, value) { 810 if (value != name) { 811 tmp.push(value); 812 } 813 }); 814 values = tmp; 815 if (values.length) { 816 woof_current_values[tax] = values.join(','); 817 } else { 818 delete woof_current_values[tax]; 819 } 820 } else { 821 delete woof_current_values['min_price']; 822 delete woof_current_values['max_price']; 823 } 824 825 woof_ajax_page_num = 1; 826 //if (woof_autosubmit) 827 { 828 woof_submit_link(woof_get_submit_link()); 829 } 830 jQuery('.woof_products_top_panel').find("[data-tax='" + tax + "'][href='" + name + "']").hide(333); 831 return false; 832 });
833 834} 835 836//control conditions if proucts shortcode uses on the page 837function woof_shortcode_observer() { 838 839 var redirect=true; 840 if(jQuery('.woof_shortcode_output').length || (jQuery('.woocommerce .products').length && !jQuery('.single-product').length)){ 841 redirect=false; 842 } 843 if(jQuery('.woocommerce .woocommerce-info').length ){ 844 redirect=false; 845 } 846 if( typeof woof_not_redirect!== 'undefined' && woof_not_redirect==1 ){ 847 redirect=false; 848 } 849 850 if (!redirect) { 851 woof_current_page_link = location.protocol + '//' + location.host + location.pathname; 852 } 853 854 if (jQuery('#woof_results_by_ajax').length) { 855 woof_is_ajax = 1; 856 } 857} 858 859 860 861function woof_init_beauty_scroll() { 862 if (woof_use_beauty_scroll) { 863 try { 864 var anchor = ".woof_section_scrolled, .woof_sid_auto_shortcode .woof_container_radio .woof_block_html_items, .woof_sid_auto_shortcode .woof_container_checkbox .woof_block_html_items, .woof_sid_auto_shortcode .woof_container_label .woof_block_html_items"; 865 jQuery("" + anchor).mCustomScrollbar('destroy'); 866 jQuery("" + anchor).mCustomScrollbar({ 867 scrollButtons: { 868 enable: true 869 }, 870 advanced: { 871 updateOnContentResize: true, 872 updateOnBrowserResize: true 873 }, 874 theme: "dark-2", 875 horizontalScroll: false, 876 mouseWheel: true, 877 scrollType: 'pixels', 878 contentTouchScroll: true 879 }); 880 } catch (e) { 881 console.log(e); 882 } 883 } 884} 885 886//just for inbuilt price range widget 887function woof_remove_class_widget() { 888 jQuery('.woof_container_inner').find('.widget').removeClass('widget'); 889} 890 891function woof_init_show_auto_form() { 892 jQuery('.woof_show_auto_form').unbind('click'); 893 jQuery('.woof_show_auto_form').click(function () { 894 var _this = this; 895 jQuery(_this).addClass('woof_hide_auto_form').removeClass('woof_show_auto_form'); 896 jQuery(".woof_auto_show").show().animate( 897 { 898 height: (jQuery(".woof_auto_show_indent").height() + 20) + "px", 899 opacity: 1 900 }, 377, function () { 901 //jQuery(_this).text(woof_lang_hide_products_filter); 902 woof_init_hide_auto_form(); 903 jQuery('.woof_auto_show').removeClass('woof_overflow_hidden'); 904 jQuery('.woof_auto_show_indent').removeClass('woof_overflow_hidden'); 905 jQuery(".woof_auto_show").height('auto'); 906 }); 907 908 909 return false; 910 }); 911 912 913} 914 915function woof_init_hide_auto_form() { 916 jQuery('.woof_hide_auto_form').unbind('click'); 917 jQuery('.woof_hide_auto_form').click(function () { 918 var _this = this; 919 jQuery(_this).addClass('woof_show_auto_form').removeClass('woof_hide_auto_form'); 920 jQuery(".woof_auto_show").show().animate( 921 { 922 height: "1px", 923 opacity: 0 924 }, 377, function () { 925 //jQuery(_this).text(woof_lang_show_products_filter); 926 jQuery('.woof_auto_show').addClass('woof_overflow_hidden'); 927 jQuery('.woof_auto_show_indent').addClass('woof_overflow_hidden'); 928 woof_init_show_auto_form(); 929 }); 930 931 return false; 932 }); 933 934 935} 936 937//if we have mode - child checkboxes closed - append openers buttons by js 938function woof_checkboxes_slide() { 939 if (woof_checkboxes_slide_flag == true) { 940 var childs = jQuery('ul.woof_childs_list'); 941 if (childs.length) { 942 jQuery.each(childs, function (index, ul) { 943 944 if (jQuery(ul).parents('.woof_no_close_childs').length) { 945 return; 946 } 947 948 949 var span_class = 'woof_is_closed'; 950 if(woof_supports_html5_storage()){ 951 //test mode from 06.11.2017 952 var preulstate=localStorage.getItem( jQuery(ul).closest('li').find('label').first().text()); 953 if(preulstate && preulstate=='woof_is_opened'){ 954 var span_class='woof_is_opened'; 955 jQuery(ul).show(); 956 } 957 jQuery(ul).before('<a href="javascript:void(0);" class="woof_childs_list_opener"><span class="' + span_class + '"></span></a>'); 958 //++ 959 }else{ 960 if (jQuery(ul).find('input[type=checkbox],input[type=radio]').is(':checked')) { 961 jQuery(ul).show(); 962 span_class = 'woof_is_opened'; 963 } 964 jQuery(ul).before('<a href="javascript:void(0);" class="woof_childs_list_opener"><span class="' + span_class + '"></span></a>'); 965 966 } 967 968 }); 969 970 jQuery.each(jQuery('a.woof_childs_list_opener'), function (index, a) { 971 jQuery(a).click(function () { 972 var span = jQuery(this).find('span'); 973 if (span.hasClass('woof_is_closed')) { 974 //lets open 975 jQuery(this).parent().find('ul.woof_childs_list').first().show(333); 976 span.removeClass('woof_is_closed'); 977 span.addClass('woof_is_opened'); 978 } else { 979 //lets close 980 jQuery(this).parent().find('ul.woof_childs_list').first().hide(333); 981 span.removeClass('woof_is_opened'); 982 span.addClass('woof_is_closed'); 983 } 984 985 if(woof_supports_html5_storage()){ 986 //test mode from 06.11.2017 987 var ullabel=jQuery(this).closest("li").find("label").first().text(); 988 var ullstate=jQuery(this).children("span").attr("class"); 989 localStorage.setItem(ullabel,ullstate); 990 //++ 991 } 992 return false; 993 }); 994 }); 995 } 996 } 997} 998 999function woof_init_ion_sliders() { 1000 jQuery.each(jQuery('.woof_range_slider'), function (index, input) { 1001 try { 1002 1003 jQuery(input).ionRangeSlider({ 1004 min: jQuery(input).data('min'), 1005 max: jQuery(input).data('max'), 1006 from: jQuery(input).data('min-now'), 1007 to: jQuery(input).data('max-now'), 1008 type: 'double', 1009 prefix: jQuery(input).data('slider-prefix'), 1010 postfix: jQuery(input).data('slider-postfix'), 1011 prettify: true, 1012 hideMinMax: false, 1013 hideFromTo: false, 1014 grid: true,
1015 step: jQuery(input).data('step'), 1016 onFinish: function (ui) { 1017 var tax=jQuery(input).data('taxes'); 1018 woof_current_values.min_price = (parseInt(ui.from, 10)/tax); 1019 woof_current_values.max_price = (parseInt(ui.to, 10)/tax); 1020 //woocs adaptation 1021 if (typeof woocs_current_currency !== 'undefined') { 1022 woof_current_values.min_price = Math.ceil(woof_current_values.min_price / parseFloat(woocs_current_currency.rate)); 1023 woof_current_values.max_price = Math.ceil(woof_current_values.max_price / parseFloat(woocs_current_currency.rate)); 1024 } 1025 //*** 1026 woof_ajax_page_num = 1; 1027 //jQuery(input).within('.woof').length -> if slider is as shortcode 1028 if (woof_autosubmit || jQuery(input).within('.woof').length == 0) { 1029 woof_submit_link(woof_get_submit_link()); 1030 } 1031 return false; 1032 } 1033 }); 1034 } catch (e) { 1035 1036 } 1037 }); 1038} 1039 1040function woof_init_native_woo_price_filter() { 1041 jQuery('.widget_price_filter form').unbind('submit'); 1042 jQuery('.widget_price_filter form').submit(function () { 1043 var min_price = jQuery(this).find('.price_slider_amount #min_price').val(); 1044 var max_price = jQuery(this).find('.price_slider_amount #max_price').val(); 1045 woof_current_values.min_price = min_price; 1046 woof_current_values.max_price = max_price; 1047 woof_ajax_page_num = 1; 1048 if (woof_autosubmit || jQuery(input).within('.woof').length == 0) { 1049 //comment next code row to avoid endless ajax requests 1050 woof_submit_link(woof_get_submit_link()); 1051 } 1052 return false; 1053 }); 1054 1055} 1056 1057//we need after ajax redrawing of the search form 1058function woof_reinit_native_woo_price_filter() { 1059 1060 // woocommerce_price_slider_params is required to continue, ensure the object exists 1061 if (typeof woocommerce_price_slider_params === 'undefined') { 1062 return false; 1063 } 1064 1065 // Get markup ready for slider 1066 jQuery('input#min_price, input#max_price').hide(); 1067 jQuery('.price_slider, .price_label').show(); 1068 1069 // Price slider uses jquery ui 1070 var min_price = jQuery('.price_slider_amount #min_price').data('min'), 1071 max_price = jQuery('.price_slider_amount #max_price').data('max'), 1072 current_min_price = parseInt(min_price, 10), 1073 current_max_price = parseInt(max_price, 10); 1074 1075 if (woof_current_values.hasOwnProperty('min_price')) { 1076 current_min_price = parseInt(woof_current_values.min_price, 10); 1077 current_max_price = parseInt(woof_current_values.max_price, 10); 1078 } else { 1079 if (woocommerce_price_slider_params.min_price) { 1080 current_min_price = parseInt(woocommerce_price_slider_params.min_price, 10); 1081 } 1082 if (woocommerce_price_slider_params.max_price) { 1083 current_max_price = parseInt(woocommerce_price_slider_params.max_price, 10); 1084 } 1085 } 1086 1087 //*** 1088 1089 var currency_symbol = woocommerce_price_slider_params.currency_symbol; 1090 if (typeof currency_symbol == undefined) { 1091 currency_symbol = woocommerce_price_slider_params.currency_format_symbol; 1092 } 1093 jQuery(document.body).bind('price_slider_create price_slider_slide', function (event, min, max) { 1094 1095 if (typeof woocs_current_currency !== 'undefined') { 1096 var label_min = min; 1097 var label_max = max; 1098 1099 1100 if (woocs_current_currency.rate !== 1) { 1101 label_min = Math.ceil(label_min * parseFloat(woocs_current_currency.rate)); 1102 label_max = Math.ceil(label_max * parseFloat(woocs_current_currency.rate)); 1103 } 1104 1105 //+++ 1106 label_min = woof_front_number_format(label_min, 2, '.', ','); 1107 label_max = woof_front_number_format(label_max, 2, '.', ','); 1108 if (jQuery.inArray(woocs_current_currency.name, woocs_array_no_cents) || woocs_current_currency.hide_cents == 1) { 1109 label_min = label_min.replace('.00', ''); 1110 label_max = label_max.replace('.00', ''); 1111 } 1112 //+++ 1113 1114 1115 if (woocs_current_currency.position === 'left') { 1116 1117 jQuery('.price_slider_amount span.from').html(currency_symbol + label_min); 1118 jQuery('.price_slider_amount span.to').html(currency_symbol + label_max); 1119 1120 } else if (woocs_current_currency.position === 'left_space') { 1121 1122 jQuery('.price_slider_amount span.from').html(currency_symbol + " " + label_min); 1123 jQuery('.price_slider_amount span.to').html(currency_symbol + " " + label_max); 1124 1125 } else if (woocs_current_currency.position === 'right') { 1126 1127 jQuery('.price_slider_amount span.from').html(label_min + currency_symbol); 1128 jQuery('.price_slider_amount span.to').html(label_max + currency_symbol); 1129 1130 } else if (woocs_current_currency.position === 'right_space') { 1131 1132 jQuery('.price_slider_amount span.from').html(label_min + " " + currency_symbol); 1133 jQuery('.price_slider_amount span.to').html(label_max + " " + currency_symbol); 1134 1135 } 1136 1137 } else { 1138 1139 if (woocommerce_price_slider_params.currency_pos === 'left') { 1140 1141 jQuery('.price_slider_amount span.from').html(currency_symbol + min); 1142 jQuery('.price_slider_amount span.to').html(currency_symbol + max); 1143 1144 } else if (woocommerce_price_slider_params.currency_pos === 'left_space') { 1145 1146 jQuery('.price_slider_amount span.from').html(currency_symbol + ' ' + min); 1147 jQuery('.price_slider_amount span.to').html(currency_symbol + ' ' + max); 1148 1149 } else if (woocommerce_price_slider_params.currency_pos === 'right') { 1150 1151 jQuery('.price_slider_amount span.from').html(min + currency_symbol); 1152 jQuery('.price_slider_amount span.to').html(max + currency_symbol); 1153 1154 } else if (woocommerce_price_slider_params.currency_pos === 'right_space') { 1155 1156 jQuery('.price_slider_amount span.from').html(min + ' ' + currency_symbol); 1157 jQuery('.price_slider_amount span.to').html(max + ' ' + currency_symbol); 1158 1159 } 1160 } 1161 1162 jQuery(document.body).trigger('price_slider_updated', [min, max]); 1163 });
1164 1165 jQuery('.price_slider').slider({ 1166 range: true, 1167 animate: true, 1168 min: min_price, 1169 max: max_price, 1170 values: [current_min_price, current_max_price], 1171 create: function () { 1172 1173 jQuery('.price_slider_amount #min_price').val(current_min_price); 1174 jQuery('.price_slider_amount #max_price').val(current_max_price); 1175 1176 jQuery(document.body).trigger('price_slider_create', [current_min_price, current_max_price]); 1177 }, 1178 slide: function (event, ui) { 1179 1180 jQuery('input#min_price').val(ui.values[0]); 1181 jQuery('input#max_price').val(ui.values[1]); 1182 1183 jQuery(document.body).trigger('price_slider_slide', [ui.values[0], ui.values[1]]); 1184 }, 1185 change: function (event, ui) { 1186 jQuery(document.body).trigger('price_slider_change', [ui.values[0], ui.values[1]]); 1187 } 1188 }); 1189 1190 1191 //*** 1192 woof_init_native_woo_price_filter(); 1193} 1194 1195function woof_mass_reinit() { 1196 woof_remove_empty_elements(); 1197 woof_open_hidden_li(); 1198 woof_init_search_form(); 1199 woof_hide_info_popup(); 1200 woof_init_beauty_scroll(); 1201 woof_init_ion_sliders(); 1202 woof_reinit_native_woo_price_filter();//native woo price range slider reinit 1203 woof_recount_text_price_filter(); 1204 woof_draw_products_top_panel(); 1205} 1206 1207function woof_recount_text_price_filter() { 1208 //change value in textinput price filter if WOOCS is installed 1209 if (typeof woocs_current_currency !== 'undefined') { 1210 jQuery.each(jQuery('.woof_price_filter_txt_from, .woof_price_filter_txt_to'), function (i, item) { 1211 jQuery(this).val(Math.ceil(jQuery(this).data('value'))); 1212 }); 1213 } 1214} 1215 1216function woof_init_toggles() { 1217 jQuery('.woof_front_toggle').life('click', function () { 1218 if (jQuery(this).data('condition') == 'opened') { 1219 jQuery(this).removeClass('woof_front_toggle_opened'); 1220 jQuery(this).addClass('woof_front_toggle_closed'); 1221 jQuery(this).data('condition', 'closed'); 1222 if (woof_toggle_type == 'text') { 1223 jQuery(this).text(woof_toggle_closed_text); 1224 } else { 1225 jQuery(this).find('img').prop('src', woof_toggle_closed_image); 1226 } 1227 } else { 1228 jQuery(this).addClass('woof_front_toggle_opened'); 1229 jQuery(this).removeClass('woof_front_toggle_closed'); 1230 jQuery(this).data('condition', 'opened'); 1231 if (woof_toggle_type == 'text') { 1232 jQuery(this).text(woof_toggle_opened_text); 1233 } else { 1234 jQuery(this).find('img').prop('src', woof_toggle_opened_image); 1235 } 1236 } 1237 1238 1239 jQuery(this).parents('.woof_container_inner').find('.woof_block_html_items').toggle(500); 1240 return false; 1241 }); 1242} 1243 1244//for "Show more" blocks 1245function woof_open_hidden_li() { 1246 if (jQuery('.woof_open_hidden_li_btn').length > 0) { 1247 jQuery.each(jQuery('.woof_open_hidden_li_btn'), function (i, b) { 1248 if (jQuery(b).parents('ul').find('li.woof_hidden_term input[type=checkbox],li.woof_hidden_term input[type=radio]').is(':checked')) { 1249 jQuery(b).trigger('click'); 1250 } 1251 }); 1252 } 1253} 1254 1255//http://stackoverflow.com/questions/814613/how-to-read-get-data-from-a-url-using-javascript 1256function $_woof_GET(q, s) { 1257 s = (s) ? s : window.location.search; 1258 var re = new RegExp('&' + q + '=([^&]*)', 'i'); 1259 return (s = s.replace(/^\?/, '&').match(re)) ? s = s[1] : s = ''; 1260} 1261 1262function woof_parse_url(url) { 1263 var pattern = RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"); 1264 var matches = url.match(pattern); 1265 return { 1266 scheme: matches[2], 1267 authority: matches[4], 1268 path: matches[5], 1269 query: matches[7], 1270 fragment: matches[9] 1271 }; 1272} 1273 1274 1275// woof price radio; 1276function woof_price_filter_radio_init() { 1277 if (icheck_skin != 'none') { 1278 jQuery('.woof_price_filter_radio').iCheck('destroy'); 1279 1280 jQuery('.woof_price_filter_radio').iCheck({ 1281 radioClass: 'iradio_' + icheck_skin.skin + '-' + icheck_skin.color, 1282 //radioClass: 'iradio_square-green' 1283 }); 1284 1285 jQuery('.woof_price_filter_radio').siblings('div').removeClass('checked'); 1286 1287 jQuery('.woof_price_filter_radio').unbind('ifChecked'); 1288 jQuery('.woof_price_filter_radio').on('ifChecked', function (event) { 1289 jQuery(this).attr("checked", true); 1290 jQuery('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible'); 1291 jQuery(this).parents('.woof_list').find('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible'); 1292 jQuery(this).parents('.woof_list').find('.woof_radio_price_reset').hide(); 1293 jQuery(this).parents('li').eq(0).find('.woof_radio_price_reset').eq(0).addClass('woof_radio_term_reset_visible'); 1294 var val = jQuery(this).val(); 1295 if (parseInt(val, 10) == -1) { 1296 delete woof_current_values.min_price; 1297 delete woof_current_values.max_price; 1298 jQuery(this).removeAttr('checked'); 1299 jQuery(this).siblings('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible'); 1300 } else { 1301 var val = val.split("-"); 1302 woof_current_values.min_price = val[0]; 1303 woof_current_values.max_price = val[1]; 1304 jQuery(this).siblings('.woof_radio_price_reset').addClass('woof_radio_term_reset_visible'); 1305 jQuery(this).attr("checked", true); 1306 } 1307 if (woof_autosubmit || jQuery(this).within('.woof').length == 0) { 1308 woof_submit_link(woof_get_submit_link()); 1309 } 1310 }); 1311 1312 } else { 1313 jQuery('.woof_price_filter_radio').life('change', function () { 1314 var val = jQuery(this).val(); 1315 jQuery('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible'); 1316 if (parseInt(val, 10) == -1) { 1317 delete woof_current_values.min_price; 1318 delete woof_current_values.max_price; 1319 jQuery(this).removeAttr('checked'); 1320 jQuery(this).siblings('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible'); 1321 } else { 1322 var val = val.split("-"); 1323 woof_current_values.min_price = val[0]; 1324 woof_current_values.max_price = val[1]; 1325 jQuery(this).siblings('.woof_radio_price_reset').addClass('woof_radio_term_reset_visible'); 1326 jQuery(this).attr("checked", true); 1327 } 1328 if (woof_autosubmit || jQuery(this).within('.woof').length == 0) { 1329 woof_submit_link(woof_get_submit_link()); 1330 } 1331 }); 1332 } 1333 //*** 1334 jQuery('.woof_radio_price_reset').click(function () { 1335 delete woof_current_values.min_price; 1336 delete woof_current_values.max_price; 1337 jQuery(this).siblings('div').removeClass('checked'); 1338 jQuery(this).parents('.woof_list').find('input[type=radio]').removeAttr('checked'); 1339 //jQuery(this).remove(); 1340 jQuery(this).removeClass('woof_radio_term_reset_visible'); 1341 if (woof_autosubmit) { 1342 woof_submit_link(woof_get_submit_link()); 1343 } 1344 return false; 1345 });
1346} 1347// END woof price radio; 1348 1349 1350 1351//compatibility with YITH Infinite Scrolling 1352function woof_serialize(serializedString) { 1353 var str = decodeURI(serializedString); 1354 var pairs = str.split('&'); 1355 var obj = {}, p, idx, val; 1356 for (var i = 0, n = pairs.length; i < n; i++) { 1357 p = pairs[i].split('='); 1358 idx = p[0]; 1359 1360 if (idx.indexOf("[]") == (idx.length - 2)) { 1361 // Eh um vetor 1362 var ind = idx.substring(0, idx.length - 2) 1363 if (obj[ind] === undefined) { 1364 obj[ind] = []; 1365 } 1366 obj[ind].push(p[1]); 1367 } else { 1368 obj[idx] = p[1]; 1369 } 1370 } 1371 return obj; 1372} 1373 1374 1375//compatibility with YITH Infinite Scrolling 1376function woof_infinite() { 1377 1378 if (typeof yith_infs === 'undefined') { 1379 return; 1380 } 1381 1382 1383 //*** 1384 var infinite_scroll1 = { 1385 //'nextSelector': ".woof_infinity .nav-links .next", 1386 'nextSelector': '.woocommerce-pagination li .next', 1387 'navSelector': yith_infs.navSelector, 1388 'itemSelector': yith_infs.itemSelector, 1389 'contentSelector': yith_infs.contentSelector, 1390 'loader': '<img src="' + yith_infs.loader + '">', 1391 'is_shop': yith_infs.shop 1392 }; 1393var curr_l = window.location.href; 1394var curr_link = curr_l.split('?'); 1395var get=""; 1396 if (curr_link[1] != undefined) { 1397 var temp = woof_serialize(curr_link[1]); 1398 delete temp['paged']; 1399 get = decodeURIComponent(jQuery.param(temp)) 1400 } 1401 1402 var page_link = jQuery('.woocommerce-pagination li .next').attr("href"); 1403 //console.log(page_link); 1404 if(page_link==undefined){ 1405 page_link=curr_link+"page/1/" 1406 } 1407console.log(page_link ); 1408var ajax_link=page_link.split('?'); 1409var page=""; 1410 if (ajax_link[1] != undefined) { 1411 var temp1 = woof_serialize(ajax_link[1]); 1412 if(temp1['paged']!=undefined){ 1413 page= "page/"+ temp1['paged']+"/"; 1414 } 1415 } 1416 1417 page_link = curr_link[0] +page+ '?' + get; 1418 //console.log(page_link); 1419 jQuery('.woocommerce-pagination li .next').attr('href', page_link); 1420 1421 jQuery(window).unbind("yith_infs_start"), jQuery(yith_infs.contentSelector).yit_infinitescroll(infinite_scroll1) 1422} 1423//End infinity scroll 1424 1425//fix if woof - is ajax and cart - is redirect 1426function woof_change_link_addtocart(){ 1427 if(!woof_is_ajax){ 1428 return; 1429 } 1430 jQuery(".add_to_cart_button").each(function(i,elem) { 1431 var link = jQuery(elem).attr('href'); 1432 var link_items =link.split("?"); 1433 var site_link_items = window.location.href.split("?"); 1434 if(link_items[1]!=undefined){ 1435 link= site_link_items[0]+"?"+link_items[1]; 1436 jQuery(elem).attr('href',link); 1437 } 1438 }); 1439 1440} 1441//https://github.com/kvz/phpjs/blob/master/functions/strings/number_format.js 1442function woof_front_number_format(number, decimals, dec_point, thousands_sep) { 1443 number = (number + '') 1444 .replace(/[^0-9+\-Ee.]/g, ''); 1445 var n = !isFinite(+number) ? 0 : +number, 1446 prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), 1447 sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, 1448 dec = (typeof dec_point === 'undefined') ? '.' : dec_point, 1449 s = '', 1450 toFixedFix = function (n, prec) { 1451 var k = Math.pow(10, prec); 1452 return '' + (Math.round(n * k) / k) 1453 .toFixed(prec); 1454 }; 1455// Fix for IE parseFloat(0.55).toFixed(0) = 0; 1456 s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)) 1457 .split('.'); 1458 if (s[0].length > 3) { 1459 s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); 1460 } 1461 if ((s[1] || '') 1462 .length < prec) { 1463 s[1] = s[1] || ''; 1464 s[1] += new Array(prec - s[1].length + 1) 1465 .join('0'); 1466 } 1467 return s.join(dec); 1468} 1469 1470//additional function to check local storage 1471 1472function woof_supports_html5_storage() { 1473 try { 1474 return 'localStorage' in window && window['localStorage'] !== null; 1475} catch (e) { 1476 return false; 1477 } 1478} 1479 1480function woof_init_tooltip(){ 1481 jQuery(".woof_tooltip_header").tooltipster({ 1482 theme: 'tooltipster-noir', 1483 side: 'right' 1484 }); 1485 1486}
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.