PageSourceSearch

https://sportsleadersac.com/wp-content/plugins/woo-smart-compare/assets/js/frontend.js

js sportsleadersac.com collected 2026-10-06 08:12:23 UTC 30,981 bytes, 1,079 lines download raw bytes

1'use strict';
2
3(function($) {
4  var woosc_timer = 0;
5
6  // ready
7  $(function() {
8    woosc_load_color();
9    woosc_change_count('first');
10    woosc_check_buttons();
11    woosc_hide_empty();
12    woosc_hide_similarities();
13    woosc_highlight_differences();
14
15    if (woosc_vars.reload_count === 'yes') {
16      // reload the count
17      woosc_load_data('count');
18    }
19
20    if (woosc_vars.open_bar === 'yes') {
21      woosc_load_data('bar');
22      woosc_open_bar();
23    }
24
25    $('.woosc-settings-fields').sortable({
26      handle: '.move', update: function(event, ui) {
27        woosc_save_settings();
28      },
29    });
30
31    if (woosc_vars.button_action === 'show_message') {
32      $.notiny.addTheme('woosc', {
33        notification_class: 'notiny-theme-woosc',
34      });
35    }
36
37    woosc_quick_table();
38  });
39
40  // resize
41  $(window).on('resize', function() {
42    woosc_quick_table();
43  });
44
45  // quick view
46  $(document).
47      on('click touch', '.woosc_table .woosq-btn, .woosc_table .woosq-link',
48          function(e) {
49            e.preventDefault();
50            woosc_close();
51          });
52
53  $(document).
54      on('click touch', '.woosc-sidebar .woosq-btn, .woosc-sidebar .woosq-link',
55          function(e) {
56            e.preventDefault();
57            woosc_close_sidebar();
58          });
59
60  // settings
61  $(document).on('click touch', '.woosc-table-settings', function(e) {
62    e.preventDefault();
63    $('.woosc-settings').toggleClass('open');
64  });
65
66  $(document).on('click touch', '.woosc-bar-print', function(e) {
67    e.preventDefault();
68    $.print('#woosc-area');
69  });
70
71  $(document).on('keydown', function(e) {
72    if ((e.ctrlKey == true || e.metaKey == true) && (e.which == '80')) {
73      //ctrl+p or command+p
74      if ($('.woosc-area').hasClass('woosc-area-open-table')) {
75        e.preventDefault();
76        $.print('#woosc-area');
77      }
78    }
79  });
80
81  $(document).on('click touch', '.woosc-bar-share', function(e) {
82    e.preventDefault();
83    $('.woosc-share').toggleClass('open');
84    $('.woosc-share-content').addClass('woosc-loading');
85
86    var data = {
87      action: 'woosc_share', nonce: woosc_vars.nonce,
88    };
89
90    jQuery.post(woosc_vars.wc_ajax_url.toString().
91        replace('%%endpoint%%', 'woosc_share'), data, function(response) {
92      $('.woosc-share-content').html(response).removeClass('woosc-loading');
93    });
94  });
95
96  // copy link
97  $(document).
98      on('click touch', '#woosc_copy_url, #woosc_copy_btn', function(e) {
99        e.preventDefault();
100        let $link = $('#woosc_copy_url');
101        let link = $link.val();
102
103        navigator.clipboard.writeText(link).then(function() {
104          alert(woosc_vars.copied_text.replace('%s', link));
105        }, function() {
106          alert('Failure to copy!');
107        });
108
109        $link.select();
110      });
111
112  // search
113  $(document).on('click touch', '.woosc-bar-search', function(e) {
114    e.preventDefault();
115    $('.woosc-search').toggleClass('open');
116
117    if ($('.woosc-search-result').text() === '') {
118      if (woosc_timer != null) {
119        clearTimeout(woosc_timer);
120      }
121
122      woosc_timer = setTimeout(woosc_search, 300);
123      return false;
124    }
125  });
126
127  // popup
128  $(document).on('click touch', '.woosc-popup', function(e) {
129    if ($(e.target).closest('.woosc-popup-content').length === 0) {
130      $(this).toggleClass('open');
131    }
132  });
133
134  $(document).on('keyup', '#woosc_search_input', function() {
135    if ($('#woosc_search_input').val() !== '') {
136      if (woosc_timer != null) {
137        clearTimeout(woosc_timer);
138      }
139
140      woosc_timer = setTimeout(woosc_search, 300);
141      return false;
142    }
143  });
144
145  $(document).on('click touch', '.woosc-item-add', function(e) {
146    e.preventDefault();
147    var product_id = $(this).attr('data-id');
148
149    $('.woosc-search').toggleClass('open');
150    woosc_add_product(product_id);
151    woosc_load_data('table');
152    woosc_open_table();
153  });
154
155  $(document).on('click touch', '.woosc-popup-close', function(e) {
156    e.preventDefault();
157    $(this).closest('.woosc-popup').toggleClass('open');
158  });
159
160  // woovr
161  $(document).on('woovr_selected', function(e, selected) {
162    if (woosc_vars.variations === 'yes') {
163      var id = selected.attr('data-id');
164      var pid = selected.attr('data-pid');
165
166      if (id > 0) {
167        $('.woosc-btn-' + pid).
168            removeClass('woosc-btn-added woosc-added').
169            attr('data-id', id);
170      } else {
171        $('.woosc-btn-' + pid).
172            removeClass('woosc-btn-added woosc-added').
173            attr('data-id', pid);
174      }
175    }
176  });
177
178  // found variation
179  $(document).on('found_variation', function(e, t) {
180    if (woosc_vars.variations === 'yes') {
181      var product_id = $(e['target']).attr('data-product_id');
182
183      $('.woosc-btn-' + product_id).
184          removeClass('woosc-btn-added woosc-added').
185          attr('data-id', t.variation_id);
186
187      $('.woosc-btn-' + product_id + ':not(.woosc-btn-has-icon)').
188          html(woosc_vars.button_text);
189      $('.woosc-btn-has-icon.woosc-btn-' + product_id).
190          find('.woosc-btn-icon').
191          removeClass(woosc_vars.button_added_icon).
192          addClass(woosc_vars.button_normal_icon);
193      $('.woosc-btn-has-icon.woosc-btn-' + product_id).
194          find('.woosc-btn-text').
195          html(woosc_vars.button_text);
196    }
197  });
198
199  // reset data
200  $(document).on('reset_data', function(e) {
201    if (woosc_vars.variations === 'yes') {
202      var product_id = $(e['target']).attr('data-product_id');
203
204      $('.woosc-btn-' + product_id).
205          removeClass('woosc-btn-added woosc-added').
206          attr('data-id', product_id);
207
208      $('.woosc-btn-' + product_id + ':not(.woosc-btn-has-icon)').
209          html(woosc_vars.button_text);
210      $('.woosc-btn-has-icon.woosc-btn-' + product_id).
211          find('.woosc-btn-icon').
212          removeClass(woosc_vars.button_added_icon).
213          addClass(woosc_vars.button_normal_icon);
214      $('.woosc-btn-has-icon.woosc-btn-' + product_id).
215          find('.woosc-btn-text').
216          html(woosc_vars.button_text);
217    }
218  });
219
220  // remove all
221  $(document).on('click touch', '.woosc-bar-remove', function(e) {
222    e.preventDefault();
223    var r = confirm(woosc_vars.remove_all);
224
225    if (r == true) {
226      woosc_remove_product('all');
227      woosc_load_data('table');
228    }
229  });
230
231  // add
232  $(document).on('click touch', '.woosc-btn', function(e) {
233    e.preventDefault();
234    var $this = $(this);
235    var id = $this.attr('data-id');
236    var pid = $this.attr('data-pid');
237    var product_id = $this.attr('data-product_id');
238    var product_name = $this.attr('data-product_name');
239    var product_image = $this.attr('data-product_image');
240
241    if (typeof pid !== typeof undefined && pid !== false) {
242      id = pid;
243    }
244
245    if (typeof product_id !== typeof undefined && product_id !== false) {
246      id = product_id;
247    }
248
249    $this.addClass('');
250
251    if ($this.hasClass('woosc-btn-added woosc-added')) {
252      if (woosc_vars.click_again === 'yes') {
253        // remove
254        woosc_remove_product(id);
255
256        if (woosc_vars.button_action === 'show_message') {
257          $.notiny({
258            theme: 'woosc',
259            position: woosc_vars.message_position,
260            image: product_image,
261            text: woosc_vars.message_removed.replace('{name}',
262                '<strong>' + product_name + '</strong>'),
263          });
264        }
265      } else {
266        if (woosc_vars.button_action === 'show_message') {
267          $.notiny({
268            theme: 'woosc',
269            position: woosc_vars.message_position,
270            image: product_image,
271            text: woosc_vars.message_exists.replace('{name}',
272                '<strong>' + product_name + '</strong>'),
273          });
274        }
275      }
276    } else {
277      $this.addClass('woosc-btn-adding woosc-adding');
278      woosc_add_product(id);
279
280      if (woosc_vars.button_action === 'show_message') {
281        $.notiny({
282          theme: 'woosc',
283          position: woosc_vars.message_position,
284          image: product_image,
285          text: woosc_vars.message_added.replace('{name}',
286              '<strong>' + product_name + '</strong>'),
287        });
288      }
289    }
290
291    if (woosc_vars.button_action === 'show_bar') {
292      // show bar only
293      woosc_load_data('bar');
294      woosc_open_bar();
295    }
296
297    if (woosc_vars.button_action === 'show_table') {
298      // show bar & table
299      woosc_load_data('table');
300      woosc_open_bar();
301      woosc_open_table();
302    }
303
304    if ((woosc_vars.button_action === 'show_message') ||
305        (woosc_vars.button_action === 'none')) {
306      // load bar again
307      if ($('.woosc-bar').hasClass('woosc-bar-open')) {
308        woosc_load_data('bar');
309      }
310    }
311
312    if (woosc_vars.button_action === 'show_sidebar') {
313      woosc_load_data('sidebar');
314      woosc_open_sidebar();
315    }
316  });
317
318  // remove on popup
319  $(document).
320      on('click touch',
321          '#woosc-area .woosc-bar-item-remove, #woosc-area .woosc-remove',
322          function(e) {
323            e.preventDefault();
324            var product_id = $(this).attr('data-id');
325
326            $(this).parent().addClass('removing');
327            woosc_remove_product(product_id);
328            woosc_load_data('table');
329            woosc_check_buttons();
330          });
331
332  // remove on page
333  $(document).
334      on('click touch', '.woosc-page .woosc-remove', function(e) {
335        e.preventDefault();
336        var product_id = $(this).attr('data-id');
337
338        woosc_remove_product(product_id);
339        location.reload();
340      });
341
342  // remove all on page
343  $(document).
344      on('click touch', '.woosc-page .woosc-remove-all', function(e) {
345        e.preventDefault();
346        var r = confirm(woosc_vars.remove_all);
347
348        if (r == true) {
349          woosc_remove_product('all');
350        }
351
352        location.reload();
353      });
354
355  // remove on sidebar
356  $(document).on('click touch', '.woosc-sidebar-item-remove', function(e) {
357    e.preventDefault();
358    var product_id = $(this).closest('.woosc-sidebar-item').attr('data-id');
359
360    woosc_remove_product(product_id);
361    $(this).closest('.woosc-sidebar-item').slideUp();
362    woosc_check_buttons();
363  });
364
365  // bar button
366  $(document).on('click touch', '.woosc-bar-btn', function(e) {
367    e.preventDefault();
368
369    if (!$('.woosc-table-items').hasClass('woosc-table-items-loaded')) {
370      woosc_load_data('table');
371    }
372
373    woosc_toggle_table();
374  });
375
376  // close
377  $(document).on('click touch', function(e) {
378    if (((woosc_vars.click_outside === 'yes') ||
379            ((woosc_vars.click_outside === 'yes_empty') &&
380                (parseInt($('.woosc-bar').attr('data-count')) === 0))) &&
381        ($(e.target).closest('.wpc_compare_count').length === 0) &&
382        ($(e.target).closest('.woosc-popup').length === 0) &&
383        ($(e.target).closest('.woosc-btn').length === 0) &&
384        ($(e.target).closest('.woosc-table').length === 0) &&
385        ($(e.target).closest('.woosc-bar').length === 0) &&
386        ($(e.target).closest('.woosc-menu-item a').length === 0) &&
387        ($(e.target).closest('.woosc-link a').length === 0) &&
388        ($(e.target).closest('.woosc-menu a').length === 0) &&
389        ($(e.target).closest('.woosc-sidebar-btn').length === 0) &&
390        ((woosc_vars.open_button === '') ||
391            ($(e.target).closest(woosc_vars.open_button).length === 0))) {
392      woosc_close();
393    }
394  });
395
396  // close sidebar
397  $(document).on('click touch', '.woosc-area-open-sidebar', function(e) {
398    if (($(e.target).closest('.woosc-sidebar').length === 0)) {
399      woosc_close_sidebar();
400    }
401  });
402
403  $(document).
404      on('click touch', '.woosc-sidebar-close, .woosc-sidebar-continue',
405          function(e) {
406            woosc_close_sidebar();
407          });
408
409  // let compare
410  $(document).on('click touch', '.woosc-sidebar-btn', function(e) {
411    e.preventDefault();
412    woosc_close_sidebar();
413    woosc_toggle();
414  });
415
416  // close
417  $(document).on('click touch', '#woosc-table-close', function(e) {
418    e.preventDefault();
419    woosc_close_table();
420  });
421
422  // change settings
423  $(document).
424      on('change', '.woosc-settings-field, .woosc-settings-tool', function() {
425        woosc_save_settings();
426      });
427
428  // open button
429  if (woosc_vars.open_button !== '') {
430    $(document).on('click touch', woosc_vars.open_button, function(e) {
431      e.preventDefault();
432
433      if (woosc_vars.open_button_action === 'open_page') {
434        // open page
435        if ((woosc_vars.page_url !== '') && (woosc_vars.page_url !== '#')) {
436          window.location.href = woosc_vars.page_url;
437        }
438      } else {
439        if (woosc_vars.open_button_action === 'open_popup') {
440          // open compare popup
441          if (!$('.woosc-table-items').hasClass('woosc-table-items-loaded')) {
442            woosc_load_data('table');
443          }
444
445          woosc_open_bar();
446          woosc_open_table();
447        }
448
449        if (woosc_vars.open_button_action === 'open_sidebar') {
450          // open sidebar
451          if (!$('.woosc-sidebar-items').
452              hasClass('woosc-sidebar-items-loaded')) {
453            woosc_load_data('sidebar');
454          }
455
456          woosc_open_sidebar();
457        }
458      }
459    });
460  }
461
462  // menu item
463  $(document).
464      on('click touch', '.woosc-menu-item a, .woosc-menu a, .woosc-link a',
465          function(e) {
466            if (woosc_vars.menu_action === 'open_popup') {
467              e.preventDefault();
468
469              // open compare popup
470              if (!$('.woosc-table-items').
471                  hasClass('woosc-table-items-loaded')) {
472                woosc_load_data('table');
473              }
474
475              woosc_open_bar();
476              woosc_open_table();
477            }
478
479            if (woosc_vars.menu_action === 'open_sidebar') {
480              e.preventDefault();
481
482              // open sidebar
483              if (!$('.woosc-sidebar-items').
484                  hasClass('woosc-sidebar-items-loaded')) {
485                woosc_load_data('sidebar');
486              }
487
488              woosc_open_sidebar();
489            }
490          });
491
492  function woosc_search() {
493    $('.woosc-search-result').html('').addClass('woosc-loading');
494    // ajax search product
495    woosc_timer = null;
496
497    var data = {
498      action: 'woosc_search',
499      keyword: $('#woosc_search_input').val(),
500      nonce: woosc_vars.nonce,
501    };
502
503    $.post(woosc_vars.wc_ajax_url.toString().
504        replace('%%endpoint%%', 'woosc_search'), data, function(response) {
505      $('.woosc-search-result').
506          html(response).
507          removeClass('woosc-loading');
508    });
509  }
510
511  function woosc_set_cookie(cname, cvalue, exdays) {
512    var d = new Date();
513
514    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
515
516    var expires = 'expires=' + d.toUTCString();
517
518    document.cookie = cname + '=' + cvalue + '; ' + expires + '; path=/';
519  }
520
521  function woosc_get_cookie(cname) {
522    var name = cname + '=';
523    var ca = document.cookie.split(';');
524
525    for (var i = 0; i < ca.length; i++) {
526      var c = ca[i];
527
528      while (c.charAt(0) == ' ') {
529        c = c.substring(1);
530      }
531
532      if (c.indexOf(name) == 0) {
533        return decodeURIComponent(c.substring(name.length, c.length));
534      }
535    }
536
537    return '';
538  }
539
540  function woosc_get_products() {
541    var cookie_products = woosc_get_cookie_products();
542
543    if (woosc_get_cookie(cookie_products) != '') {
544      return woosc_get_cookie(cookie_products);
545    } else {
546      return '';
547    }
548  }
549
550  function woosc_save_products() {
551    var cookie_products = woosc_get_cookie_products();
552    var products = [];
553
554    $('.woosc-bar-item').each(function() {
555      var pid = $(this).attr('data-id');
556
557      if (pid !== '') {
558        products.push(pid);
559      }
560    });
561
562    var products_str = products.join();
563
564    woosc_set_cookie(cookie_products, products_str, 7);
565    woosc_load_data('table');
566  }
567
568  function woosc_save_settings() {
569    var fields = [];
570    var settings = [];
571    var cookie_fields = 'woosc_fields_' + woosc_vars.hash;
572    var cookie_settings = 'woosc_settings_' + woosc_vars.hash;
573
574    if (woosc_vars.user_id !== '') {
575      cookie_fields += '_' + woosc_vars.user_id;
576      cookie_settings += '_' + woosc_vars.user_id;
577    }
578
579    // fields
580    $('.woosc-settings-field').each(function() {
581      var _val = $(this).val();
582
583      if ($(this).prop('checked')) {
584        fields.push(_val);
585        $('.woosc_table .tr-' + _val).removeClass('tr-hide');
586      } else {
587        $('.woosc_table .tr-' + _val).addClass('tr-hide');
588      }
589    });
590
591    // tools
592    $('.woosc-settings-tool').each(function() {
593      var _val = $(this).val();
594
595      if ($(this).prop('checked')) {
596        settings.push(_val);
597      }
598    });
599
600    woosc_set_cookie(cookie_fields, fields.join(','), 7);
601    woosc_set_cookie(cookie_settings, settings.join(','), 7);
602    woosc_load_data('table');
603  }
604
605  function woosc_add_product(product_id) {
606    var count;
607    var limit = false;
608    var limit_notice = woosc_vars.limit_notice;
609    var cookie_products = woosc_get_cookie_products();
610
611    if (woosc_get_cookie(cookie_products) !== '') {
612      var products = woosc_get_cookie(cookie_products).split(',');
613
614      if (products.length < woosc_vars.limit) {
615        products = $.grep(products, function(value) {
616          return value != product_id;
617        });
618
619        if (woosc_vars.adding === 'append') {
620          products.push(product_id);
621        } else {
622          products.unshift(product_id);
623        }
624
625        var products_str = products.join();
626
627        woosc_set_cookie(cookie_products, products_str, 7);
628      } else {
629        limit = true;
630        limit_notice = limit_notice.replace('{limit}', woosc_vars.limit);
631      }
632
633      count = products.length;
634    } else {
635      woosc_set_cookie(cookie_products, product_id, 7);
636      count = 1;
637    }
638
639    woosc_change_count(count);
640    $(document.body).trigger('woosc_added', [count]);
641
642    if (limit) {
643      $('.woosc-btn[data-id="' + product_id + '"]').
644          removeClass('woosc-btn-adding woosc-adding');
645      alert(limit_notice);
646    } else {
647      $('.woosc-btn[data-id="' + product_id + '"]').
648          removeClass('woosc-btn-adding woosc-adding').
649          addClass('woosc-btn-added woosc-added');
650
651      $('.woosc-btn[data-id="' + product_id + '"]:not(.woosc-btn-has-icon)').
652          html(woosc_vars.button_text_added);
653      $('.woosc-btn-has-icon[data-id="' + product_id + '"]').
654          find('.woosc-btn-icon').
655          removeClass(woosc_vars.button_normal_icon).
656          addClass(woosc_vars.button_added_icon);
657      $('.woosc-btn-has-icon[data-id="' + product_id + '"]').
658          find('.woosc-btn-text').
659          html(woosc_vars.button_text_added);
660    }
661  }
662
663  function woosc_remove_product(product_id) {
664    var count = 0;
665    var cookie_products = woosc_get_cookie_products();
666
667    if (product_id !== 'all') {
668      // remove one
669      if (woosc_get_cookie(cookie_products) != '') {
670        var products = woosc_get_cookie(cookie_products).split(',');
671
672        products = $.grep(products, function(value) {
673          return value != product_id;
674        });
675
676        var products_str = products.join();
677
678        woosc_set_cookie(cookie_products, products_str, 7);
679        count = products.length;
680      }
681
682      $('.woosc-btn[data-id="' + product_id + '"]').
683          removeClass('woosc-btn-added woosc-added');
684
685      $('.woosc-btn[data-id="' + product_id + '"]:not(.woosc-btn-has-icon)').
686          html(woosc_vars.button_text);
687      $('.woosc-btn-has-icon[data-id="' + product_id + '"]').
688          find('.woosc-btn-icon').
689          removeClass(woosc_vars.button_added_icon).
690          addClass(woosc_vars.button_normal_icon);
691      $('.woosc-btn-has-icon[data-id="' + product_id + '"]').
692          find('.woosc-btn-text').
693          html(woosc_vars.button_text);
694    } else {
695      // remove all
696      if (woosc_get_cookie(cookie_products) != '') {
697        woosc_set_cookie(cookie_products, '', 7);
698        count = 0;
699      }
700
701      $('.woosc-btn').removeClass('woosc-btn-added woosc-added');
702
703      $('.woosc-btn:not(.woosc-btn-has-icon)').html(woosc_vars.button_text);
704      $('.woosc-btn-has-icon').
705          find('.woosc-btn-icon').
706          removeClass(woosc_vars.button_added_icon).
707          addClass(woosc_vars.button_normal_icon);
708      $('.woosc-btn-has-icon').
709          find('.woosc-btn-text').
710          html(woosc_vars.button_text);
711    }
712
713    woosc_change_count(count);
714    $(document.body).trigger('woosc_removed', [count]);
715  }
716
717  function woosc_check_buttons() {
718    var cookie_products = woosc_get_cookie_products();
719
720    if (woosc_get_cookie(cookie_products) != '') {
721      var products = woosc_get_cookie(cookie_products).split(',');
722
723      $('.woosc-btn').removeClass('woosc-btn-added woosc-added');
724      $('.woosc-btn:not(.woosc-btn-has-icon)').html(woosc_vars.button_text);
725      $('.woosc-btn.woosc-btn-has-icon').
726          find('.woosc-btn-icon').
727          removeClass(woosc_vars.button_added_icon).
728          addClass(woosc_vars.button_normal_icon);
729      $('.woosc-btn.woosc-btn-has-icon').
730          find('.woosc-btn-text').
731          html(woosc_vars.button_text);
732
733      products.forEach(function(entry) {
734        $('.woosc-btn-' + entry).addClass('woosc-btn-added woosc-added');
735        $('.woosc-btn-' + entry + ':not(.woosc-btn-has-icon)').
736            html(woosc_vars.button_text_added);
737        $('.woosc-btn-has-icon.woosc-btn-' + entry).
738            find('.woosc-btn-icon').
739            removeClass(woosc_vars.button_normal_icon).
740            addClass(woosc_vars.button_added_icon);
741        $('.woosc-btn-has-icon.woosc-btn-' + entry).
742            find('.woosc-btn-text').
743            html(woosc_vars.button_text_added);
744      });
745    }
746  }
747
748  function woosc_load_data(get_data) {
749    var data = {
750      action: 'woosc_load', get_data: get_data, nonce: woosc_vars.nonce,
751    };
752
753    if (get_data === 'table') {
754      $('.woosc-table-inner').addClass('woosc-loading');
755    }
756
757    if (get_data === 'sidebar') {
758      $('.woosc-sidebar').addClass('woosc-loading');
759    }
760
761    $.post(woosc_vars.wc_ajax_url.toString().
762        replace('%%endpoint%%', 'woosc_load'), data, function(response) {
763      if (get_data === 'bar' || get_data === 'table') {
764        // load bar
765        $('.woosc-bar-items').
766            html(response.bar).
767            addClass('woosc-bar-items-loaded');
768
769        $(document.body).trigger('woosc_bar_loaded');
770      }
771
772      if (get_data === 'table') {
773        // load table
774        $('.woosc-table-items').
775            html(response.table).
776            addClass('woosc-table-items-loaded');
777
778        if ($(window).width() >= 768) {
779          if ((woosc_vars.freeze_column === 'yes') &&
780              (woosc_vars.freeze_row === 'yes')) {
781            // freeze row and column
782            $('#woosc_table').tableHeadFixer({'head': true, left: 1});
783          } else if (woosc_vars.freeze_column === 'yes') {
784            // freeze column
785            $('#woosc_table').tableHeadFixer({'head': false, left: 1});
786          } else if (woosc_vars.freeze_row === 'yes') {
787            // freeze row
788            $('#woosc_table').tableHeadFixer({'head': true});
789          }
790        } else {
791          if (woosc_vars.freeze_row === 'yes') {
792            // freeze row
793            $('#woosc_table').tableHeadFixer({'head': true});
794          }
795        }
796
797        if (woosc_vars.scrollbar === 'yes') {
798          $('.woosc-table-items').perfectScrollbar({theme: 'wpc'});
799        }
800
801        $('.woosc-table-inner').removeClass('woosc-loading');
802        woosc_hide_empty();
803        woosc_hide_similarities();
804        woosc_highlight_differences();
805
806        $(document.body).trigger('woosc_table_loaded');
807      }
808
809      if (get_data === 'sidebar') {
810        // load sidebar
811        $('.woosc-sidebar-items').
812            html(response.sidebar).
813            addClass('woosc-sidebar-items-loaded');
814        $('.woosc-sidebar').removeClass('woosc-loading');
815
816        if (woosc_vars.scrollbar === 'yes') {
817          $('.woosc-sidebar-items').perfectScrollbar({theme: 'wpc'});
818        }
819
820        $(document.body).trigger('woosc_sidebar_loaded');
821      }
822
823      if (get_data === 'count') {
824        // load count
825        if (response.count != null) {
826          var count = parseInt(response.count);
827
828          woosc_change_count(count);
829          $(document.body).trigger('woosc_count_loaded', [count]);
830        }
831      }
832    });
833  }
834
835  function woosc_quick_table() {
836    let ww = $(window).width();
837
838    if (ww >= 1024) {
839      $('.woosc-quick-table .woosc_table').
840          tableHeadFixer({'head': false, left: 2});
841    }
842
843    if (ww >= 768 && ww < 1024) {
844      $('.woosc-quick-table .woosc_table').
845          tableHeadFixer({'head': false, left: 1});
846    }
847
848    if (ww < 768) {
849      $('.woosc-quick-table .woosc_table').
850          tableHeadFixer({'head': false, left: 0});
851    }
852  }
853
854  function woosc_open_bar() {
855    woosc_close_sidebar();
856
857    $('#woosc-area').addClass('woosc-area-open-bar');
858    $('.woosc-bar').addClass('woosc-bar-open');
859
860    $('.woosc-bar-items').sortable({
861      handle: 'img', update: function(event, ui) {
862        woosc_save_products();
863      },
864    });
865
866    $(document.body).trigger('woosc_bar_open');
867  }
868
869  function woosc_close_bar() {
870    $('#woosc-area').removeClass('woosc-area-open-bar');
871    $('.woosc-bar').removeClass('woosc-bar-open');
872
873    $(document.body).trigger('woosc_bar_close');
874  }
875
876  function woosc_open_sidebar() {
877    woosc_close_bar();
878    woosc_close_table();
879
880    $('#woosc-area').addClass('woosc-area-open-sidebar');
881    $('.woosc-sidebar').addClass('woosc-sidebar-open');
882
883    $(document.body).trigger('woosc_sidebar_open');
884  }
885
886  function woosc_close_sidebar() {
887    $('#woosc-area').removeClass('woosc-area-open-sidebar');
888    $('.woosc-sidebar').removeClass('woosc-sidebar-open');
889
890    $(document.body).trigger('woosc_sidebar_close');
891  }
892
893  function woosc_open_table() {
894    woosc_close_sidebar();
895
896    $('#woosc-area').addClass('woosc-area-open-table');
897    $('.woosc-table').addClass('woosc-table-open');
898    $('.woosc-bar-btn').addClass('woosc-bar-btn-open');
899
900    if (woosc_vars.bar_bubble === 'yes') {
901      $('.woosc-bar').removeClass('woosc-bar-bubble');
902    }
903
904    $(document.body).trigger('woosc_table_open');
905  }
906
907  function woosc_close_table() {
908    $('#woosc-area').removeClass('woosc-area-open woosc-area-open-table');
909    $('.woosc-table').removeClass('woosc-table-open');
910    $('.woosc-bar-btn').removeClass('woosc-bar-btn-open');
911
912    if (woosc_vars.bar_bubble === 'yes') {
913      $('.woosc-bar').addClass('woosc-bar-bubble');
914    }
915
916    $(document.body).trigger('woosc_table_close');
917  }
918
919  function woosc_toggle_table() {
920    if ($('.woosc-table').hasClass('woosc-table-open')) {
921      woosc_close_table();
922    } else {
923      woosc_open_table();
924    }
925  }
926
927  function woosc_open() {
928    $('#woosc-area').addClass('woosc-area-open');
929    woosc_load_data('table');
930    woosc_open_bar();
931    woosc_open_table();
932
933    $(document.body).trigger('woosc_open');
934  }
935
936  function woosc_close() {
937    $('#woosc-area').removeClass('woosc-area-open');
938    woosc_close_bar();
939    woosc_close_table();
940
941    $(document.body).trigger('woosc_close');
942  }
943
944  function woosc_toggle() {
945    if ($('#woosc-area').hasClass('woosc-area-open')) {
946      woosc_close();
947    } else {
948      woosc_open();
949    }
950
951    $(document.body).trigger('woosc_toggle');
952  }
953
954  function woosc_load_color() {
955    var bg_color = $('#woosc-area').attr('data-bg-color');
956    var btn_color = $('#woosc-area').attr('data-btn-color');
957
958    $('.woosc-table').css('background-color', bg_color);
959    $('.woosc-bar').css('background-color', bg_color);
960    $('.woosc-bar-btn').css('background-color', btn_color);
961    $('.woosc-sidebar-btn').css('background-color', btn_color);
962  }
963
964  function woosc_change_count(count) {
965    if (count === 'first') {
966      var products = woosc_get_products();
967
968      if (products != '') {
969        var products_arr = products.split(',');
970
971        count = products_arr.length;
972      } else {
973        count = 0;
974      }
975    }
976
977    $('.woosc-menu-item').each(function() {
978      if ($(this).hasClass('menu-item-type-woosc')) {
979        $(this).find('.woosc-menu-item-inner').attr('data-count', count);
980      } else {
981        $(this).
982            addClass('menu-item-type-woosc').
983            find('a').
984            wrapInner(
985                '<span class="woosc-menu-item-inner" data-count="' + count +
986                '"></span>');
987      }
988    });
989
990    $('#woosc-area').attr('data-count', count);
991    $('.woosc-bar').attr('data-count', count);
992    $('.woosc-sidebar-count').html(' (' + count + ')');
993    $('.woosc-link .woosc-link-inner').attr('data-count', count);
994
995    $('.woosc-bar-items').removeClass('woosc-bar-items-loaded');
996    $('.woosc-sidebar-items').removeClass('woosc-sidebar-items-loaded');
997    $('.woosc-table-items').removeClass('woosc-table-items-loaded');
998
999    $(document.body).trigger('woosc_change_count', [count]);
1000  }
1001
1002  function woosc_hide_empty() {
1003    if (woosc_vars.hide_empty_row === 'yes') {
1004      $('.woosc_table > tbody > tr').each(function() {
1005        var $tr = $(this);
1006        var _td = 0;
1007        var _empty = true;
1008
1009        $tr.children('td').each(function() {
1010          if ((_td > 0) && ($(this).html().length > 0)) {
1011            _empty = false;
1012            return false;
1013          }
1014          _td++;
1015        });
1016
1017        if (_empty) {
1018          $tr.addClass('tr-empty').remove();
1019        }
1020      });
1021    }
1022  }
1023
1024  function woosc_highlight_differences() {
1025    if ($('#woosc_highlight_differences').prop('checked')) {
1026      $('.woosc_table > tbody > tr').each(function() {
1027        var $tr = $(this);
1028        var _td = 0;
1029        var _val = $(this).children('td').eq(1).html();
1030        var _differences = false;
1031
1032        $tr.children('td:not(.td-placeholder)').each(function() {
1033          if ((_td > 1) && ($(this).html() !== _val)) {
1034            _differences = true;
1035            return false;
1036          }
1037          _td++;
1038        });
1039
1040        if (_differences) {
1041          $tr.addClass('tr-highlight');
1042        }
1043      });
1044    } else {
1045      $('.woosc_table tr').removeClass('tr-highlight');
1046    }
1047  }
1048
1049  function woosc_hide_similarities() {
1050    if ($('#woosc_hide_similarities').prop('checked')) {
1051      $('.woosc_table > tbody > tr').each(function() {
1052        var $tr = $(this);
1053        var _td = 0;
1054        var _val = $(this).children('td').eq(1).html();
1055        var _similarities = true;
1056
1057        $tr.children('td:not(.td-placeholder)').each(function() {
1058          if ((_td > 1) && ($(this).html() !== _val)) {
1059            _similarities = false;
1060            return false;
1061          }
1062          _td++;
1063        });
1064
1065        if (_similarities) {
1066          $tr.addClass('tr-similar');
1067        }
1068      });
1069    } else {
1070      $('.woosc_table tr').removeClass('tr-similar');
1071    }
1072  }
1073
1074  function woosc_get_cookie_products() {
1075    return woosc_vars.user_id !== ''
1076        ? 'woosc_products_' + woosc_vars.user_id
1077        : 'woosc_products';
1078  }
1079})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.