PageSourceSearch

https://kendormusic.com/wp-content/plugins/wpc-grouped-product-premium/assets/js/frontend.js?ver=5.3.3

js kendormusic.com collected 2026-10-02 10:55:27 UTC 26,626 bytes, 668 lines download raw bytes

1'use strict';
2
3(function ($) {
4    $(function () {
5        if ($('.woosg-wrap').length) {
6            $('.woosg-wrap').each(function () {
7                woosg_init($(this));
8            });
9        }
10    });
11
12    $(document).on('woosq_loaded', function () {
13        // WPC Smart Quick View
14        woosg_init($('#woosq-popup .woosg-wrap'));
15    });
16
17    $(document).on('woovr_selected', function (e, selected, variations) {
18        // WPC Variations Radio Buttons
19        var $wrap = variations.closest('.woosg-wrap');
20        var $product = variations.closest('.woosg-product');
21
22        if ($product.length) {
23            var _id = selected.attr('data-id');
24            var _sku = selected.attr('data-sku');
25            var _price = selected.attr('data-price');
26            var _regular_price = selected.attr('data-regular-price');
27            var _price_html = selected.attr('data-pricehtml');
28            var _image_src = selected.attr('data-imagesrc');
29            var _purchasable = selected.attr('data-purchasable');
30            var _attrs = selected.attr('data-attrs');
31
32            if (_purchasable === 'yes') {
33                // change data
34                $product.attr('data-id', _id);
35                $product.attr('data-price', _price);
36                $product.attr('data-regular-price', _regular_price);
37
38                // change image
39                $product.find('.woosg-thumb-ori').hide();
40                $product.find('.woosg-thumb-new').html('<img src="' + _image_src + '"/>').show();
41
42                // change price
43                $product.find('.woosg-price-ori').hide();
44                $product.find('.woosg-price-new').html(_price_html).show();
45
46                // change attributes
47                $product.attr('data-attrs', _attrs.replace(/\/$/, ''));
48
49                // change add to cart button
50                $product.find('.add_to_cart_button').attr('data-product_id', _id).attr('data-product_sku', _sku).attr('data-quantity', $product.attr('data-qty')).removeClass('product_type_variable').addClass('product_type_simple ajax_add_to_cart').html(woosg_vars.add_to_cart);
51
52                // single add-to-cart
53                if ($product.find('.woosg-atc').length) {
54                    $product.find('.woosg-atc [name="variation_id"]').val(_id);
55                    $product.find('.woosg_single_add_to_cart_button').prop('disabled', false).removeClass('woosg-disabled');
56
57                    let attrs = $.parseJSON(_attrs);
58
59                    $.each(attrs, function (key, val) {
60                        $product.find('.woosg-atc input[name="' + key + '"]').val(val);
61                    });
62                }
63            } else {
64                // reset data
65                $product.attr('data-id', 0);
66                $product.attr('data-attrs', '');
67
68                if ($product.attr('data-o-price') !== undefined) {
69                    $product.attr('data-price', $product.attr('data-o-price'));
70                } else {
71                    $product.attr('data-price', 0);
72                }
73
74                if ($product.attr('data-o-regular-price') !== undefined) {
75                    $product.attr('data-regular-price', $product.attr('data-o-price'));
76                } else {
77                    $product.attr('data-regular-price', 0);
78                }
79
80                // reset image
81                $product.find('.woosg-thumb-new').html('').hide();
82                $product.find('.woosg-thumb-ori').show();
83
84                // reset price
85                $product.find('.woosg-price-ori').show();
86                $product.find('.woosg-price-new').html('').hide();
87
88                // reset availability
89                $product.find('.woosg-availability').html('').hide();
90
91                // reset add to cart button
92                $product.find('.add_to_cart_button').attr('data-product_id', 0).attr('data-product_sku', '').removeClass('product_type_simple ajax_add_to_cart').addClass('product_type_variable').html(woosg_vars.select_options);
93
94                // single add-to-cart
95                if ($product.find('.woosg-atc').length) {
96                    $product.find('.woosg-atc [name="variation_id"]').val(0);
97                    $product.find('.woosg_single_add_to_cart_button').prop('disabled', true).addClass('woosg-disabled');
98                    $product.find('.woosg-atc input[name^="attribute_"]').val('');
99                }
100            }
101
102            // reset sku, weight & dimensions
103            $('.product_meta .sku').wc_reset_content();
104            $('.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value').wc_reset_content();
105            $('.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value').wc_reset_content();
106        }
107
108        if ($wrap.length) {
109            woosg_init($wrap);
110        }
111    });
112
113    $(document).on('found_variation', function (e, t) {
114        var $wrap = $(e['target']).closest('.woosg-wrap');
115        var $products = $(e['target']).closest('.woosg-products');
116        var $product = $(e['target']).closest('.woosg-product');
117        var $qty = $product.find('.woosg-quantity .woosg-qty').length ? $product.find('.woosg-quantity .woosg-qty') : $product.find('.woosg-quantity .qty');
118
119        if ($product.length) {
120            if (t['woosg_image'] !== undefined && t['woosg_image'] !== '') {
121                // change item image
122                $product.find('.woosg-thumb-ori').hide();
123                $product.find('.woosg-thumb-new').html(t['woosg_image']).show();
124            }
125
126            if (t['price_html']) {
127                // change item price
128                $product.find('.woosg-price-ori').hide();
129                $product.find('.woosg-price-new').html(t['price_html']).show();
130            }
131
132            // set max quantity
133            if (t['max_qty'] !== undefined && t['max_qty'] !== '') {
134                $product.find('.woosg-quantity').attr('data-max', t['max_qty']);
135                $qty.attr('max', t['max_qty']);
136
137                if (parseFloat($qty.val()) > parseFloat(t['max_qty'])) {
138                    $qty.val(t['max_qty']).trigger('change');
139                }
140            } else {
141                $product.find('.woosg-quantity').attr('data-max', '');
142                $qty.attr('max', '');
143            }
144
145            if (t['is_purchasable']) {
146                // change stock notice
147                if (t['is_in_stock']) {
148                    $products.next('p.stock').show();
149                    $product.attr('data-id', t['variation_id']);
150                    $product.attr('data-price', t['display_price']);
151                    $product.attr('data-regular-price', t['display_regular_price']);
152
153                    // change add to cart button
154                    $product.find('.add_to_cart_button').attr('data-product_id', t['variation_id']).attr('data-product_sku', t['sku']).attr('data-quantity', $product.attr('data-qty')).removeClass('product_type_variable').addClass('product_type_simple ajax_add_to_cart').html(woosg_vars.add_to_cart);
155
156                    // single add-to-cart
157                    if ($product.find('.woosg-atc').length) {
158                        $product.find('.woosg-atc [name="variation_id"]').val(t['variation_id']);
159                        $product.find('.woosg_single_add_to_cart_button').prop('disabled', false).removeClass('woosg-disabled');
160
161                        $product.find('select[name^="attribute_"]').each(function () {
162                            let attr_name = $(this).attr('name');
163                            let attr_val = $(this).val();
164
165                            $product.find('.woosg-atc input[name="' + attr_name + '"]').val(attr_val);
166                        });
167                    }
168                } else {
169                    $products.next('p.stock').hide();
170                    $product.attr('data-id', 0);
171
172                    if ($product.attr('data-o-price') !== undefined) {
173                        $product.attr('data-price', $product.attr('data-o-price'));
174                    } else {
175                        $product.attr('data-price', 0);
176                    }
177
178                    if ($product.attr('data-o-regular-price') !== undefined) {
179                        $product.attr('data-regular-price', $product.attr('data-o-price'));
180                    } else {
181                        $product.attr('data-regular-price', 0);
182                    }
183
184                    // reset add to cart button
185                    $product.find('.add_to_cart_button').attr('data-product_id', 0).attr('data-product_sku', '').removeClass('product_type_simple ajax_add_to_cart').addClass('product_type_variable').html(woosg_vars.select_options);
186
187                    // single add-to-cart
188                    if ($product.find('.woosg-atc').length) {
189                        $product.find('.woosg-atc [name="variation_id"]').val(0);
190                        $product.find('.woosg_single_add_to_cart_button').prop('disabled', true).addClass('woosg-disabled');
191                        $product.find('.woosg-atc input[name^="attribute_"]').val('');
192                    }
193                }
194
195                // change availability text
196                if (t['availability_html'] && t['availability_html'] !== '') {
197                    $product.find('.woosg-availability').html(t['availability_html']).show();
198                } else {
199                    $product.find('.woosg-availability').html('').hide();
200                }
201            }
202
203            if (t['variation_description'] !== '') {
204                $product.find('.woosg-variation-description').html(t['variation_description']).show();
205            } else {
206                $product.find('.woosg-variation-description').html('').hide();
207            }
208
209            // change attributes
210            var attrs = {};
211
212            $product.find('select[name^="attribute_"]').each(function () {
213                var name = $(this).attr('name');
214
215                attrs[name] = $(this).val();
216            });
217
218            $product.attr('data-attrs', JSON.stringify(attrs));
219
220            if (woosg_vars.change_image === 'no') {
221                // prevent changing the main image
222                $(e['target']).closest('.variations_form').trigger('reset_image');
223            }
224
225            // reset sku, weight & dimensions
226            $('.product_meta .sku').wc_reset_content();
227            $('.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value').wc_reset_content();
228            $('.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value').wc_reset_content();
229
230            if ($wrap.length) {
231                woosg_init($wrap);
232            }
233        }
234    });
235
236    $(document).on('reset_data', function (e) {
237        var $wrap = $(e['target']).closest('.woosg-wrap');
238        var $product = $(e['target']).closest('.woosg-product');
239        var $qty = $product.find('.woosg-quantity .woosg-qty').length ? $product.find('.woosg-quantity .woosg-qty') : $product.find('.woosg-quantity .qty');
240
241        if ($product.length) {
242            // reset item image
243            $product.find('.woosg-thumb-new').html('').hide();
244            $product.find('.woosg-thumb-ori').show();
245
246            // reset item price
247            $product.find('.woosg-price-new').html('').hide();
248            $product.find('.woosg-price-ori').show();
249
250            // reset max quantity
251            $product.find('.woosg-quantity').attr('data-max', $product.find('.woosg-quantity').attr('data-o_max'));
252            $qty.attr('max', $product.find('.woosg-quantity').attr('data-o_max'));
253
254            if (parseFloat($qty.val()) > parseFloat($product.find('.woosg-quantity').attr('data-o_max'))) {
255                $qty.val($product.find('.woosg-quantity').attr('data-o_max')).trigger('change');
256            }
257
258            // reset item availability
259            $product.find('.woosg-availability').html('').hide();
260
261            // reset item desc
262            $product.find('.woosg-variation-description').html('').hide();
263
264            // reset item data
265            $product.attr('data-id', 0);
266            $product.attr('data-attrs', '');
267
268            if ($product.attr('data-o-price') !== undefined) {
269                $product.attr('data-price', $product.attr('data-o-price'));
270            } else {
271                $product.attr('data-price', 0);
272            }
273
274            if ($product.attr('data-o-regular-price') !== undefined) {
275                $product.attr('data-regular-price', $product.attr('data-o-price'));
276            } else {
277                $product.attr('data-regular-price', 0);
278            }
279
280            // reset add to cart button
281            $product.find('.add_to_cart_button').attr('data-product_id', 0).attr('data-product_sku', '').removeClass('product_type_simple ajax_add_to_cart').addClass('product_type_variable').html(woosg_vars.select_options);
282
283            // single add-to-cart
284            if ($product.find('.woosg-atc').length) {
285                $product.find('.woosg-atc [name="variation_id"]').val(0);
286                $product.find('.woosg_single_add_to_cart_button').prop('disabled', true).addClass('woosg-disabled');
287                $product.find('.woosg-atc input[name^="attribute_"]').val('');
288            }
289
290            if ($wrap.length) {
291                woosg_init($wrap);
292            }
293        }
294    });
295
296    $(document).on('click touch', '.single_add_to_cart_button', function (e) {
297        var $this = $(this);
298
299        if ($this.hasClass('woosg-disabled')) {
300            e.preventDefault();
301        }
302    });
303
304    $(document).on('change', '.woosg-checkbox', function () {
305        var $this = $(this);
306        var $wrap = $this.closest('.woosg-wrap');
307
308        if ($this.prop('checked')) {
309            $this.closest('.woosg-product').attr('data-qty', 1);
310        } else {
311            $this.closest('.woosg-product').attr('data-qty', 0);
312        }
313
314        woosg_init($wrap);
315    });
316
317    $(document).on('keyup change', '.woosg-quantity .woosg-qty', function () {
318        var $this = $(this);
319        var $wrap = $this.closest('.woosg-wrap');
320        var qty = parseFloat($this.val());
321        var min = parseFloat($this.closest('.woosg-quantity').attr('data-min'));
322        var max = parseFloat($this.closest('.woosg-quantity').attr('data-max'));
323
324        if ((qty > 0) && (qty < min)) {
325            qty = min;
326            $this.val(qty);
327        }
328
329        if ((max > 0) && (qty > max)) {
330            qty = max;
331            $this.val(qty);
332        }
333
334        $this.closest('.woosg-product').attr('data-qty', qty);
335        $this.closest('.woosg-product').find('.add_to_cart_button').attr('data-quantity', qty);
336
337        woosg_init($wrap);
338    });
339
340    $(document).on('change', '.woosg-quantity input[type=radio]', function () {
341        var $this = $(this);
342        var $wrap = $this.closest('.woosg-wrap');
343        var qty = parseFloat($this.val());
344        var min = parseFloat($this.closest('.woosg-quantity').attr('data-min'));
345
346        if ((qty > 0) && (qty < min)) {
347            qty = min;
348            $this.val(qty);
349        }
350
351        $this.closest('.woosg-product').attr('data-qty', qty);
352
353        woosg_init($wrap);
354    });
355
356    $(document).on('click touch', '.woosg-quantity-plus, .woosg-quantity-minus', function () {
357        // get values
358        var $qty = $(this).closest('.woosg-quantity').find('.woosg-qty').length ? $(this).closest('.woosg-quantity').find('.woosg-qty') : $(this).closest('.woosg-quantity').find('.qty');
359
360        var val = parseFloat($qty.val()), max = parseFloat($qty.attr('max')), min = parseFloat($qty.attr('min')),
361            step = $qty.attr('step');
362
363        // format values
364        if (!val || val === '' || val === 'NaN') {
365            val = 0;
366        }
367
368        if (max === '' || max === 'NaN') {
369            max = '';
370        }
371
372        if (min === '' || min === 'NaN') {
373            min = 0;
374        }
375
376        if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') {
377            step = 1;
378        } else {
379            step = parseFloat(step);
380        }
381
382        // change the value
383        if ($(this).is('.woosg-quantity-plus')) {
384            if (max && (max == val || val > max)) {
385                $qty.val(max);
386            } else {
387                $qty.val((val + step).toFixed(woosg_decimal_places(step)));
388            }
389        } else {
390            if (min && (min == val || val < min)) {
391                $qty.val(min);
392            } else if (val > 0) {
393                $qty.val((val - step).toFixed(woosg_decimal_places(step)));
394            }
395        }
396
397        // trigger change event
398        $qty.trigger('change');
399    });
400})(jQuery);
401
402function woosg_init($wrap) {
403    var wid = $wrap.attr('data-id');
404    var is_selection = false;
405    var selection_name = '';
406    var is_empty = true;
407    var $products = $wrap.find('.woosg-products');
408    var $alert = $wrap.find('.woosg-alert');
409    var $ids = jQuery('.woosg-ids-' + wid);
410    var $btn = $ids.closest('form.cart').find('.single_add_to_cart_button:not(.woosg_single_add_to_cart_button)');
411
412    if ($products.hasClass('woosg-show-atc-each') || $products.hasClass('woosg-show-atc-no')) {
413        return;
414    }
415
416    $products.find('.woosg-product').each(function () {
417        var $this = jQuery(this);
418
419        if (($this.attr('data-qty') > 0) && ($this.attr('data-id') == 0)) {
420            is_selection = true;
421
422            if (selection_name === '') {
423                selection_name = $this.attr('data-name');
424            }
425        }
426
427        if ($this.attr('data-qty') > 0) {
428            is_empty = false;
429        }
430    });
431
432    if (is_selection || is_empty) {
433        $btn.addClass('woosg-disabled');
434
435        if (is_selection) {
436            $alert.html(woosg_vars.alert_selection.replace('[name]', '<strong>' + selection_name + '</strong>')).slideDown();
437        } else if (is_empty) {
438            $alert.html(woosg_vars.alert_empty).slideDown();
439        }
440
441        jQuery(document).trigger('woosg_check_ready', [false, is_selection, is_empty, $wrap]);
442    } else {
443        $alert.html('').slideUp();
444        $btn.removeClass('woosg-disabled');
445
446        // ready
447        jQuery(document).trigger('woosg_check_ready', [true, is_selection, is_empty, $wrap]);
448    }
449
450    woosg_carousel($wrap);
451    woosg_calc_price($wrap);
452    woosg_save_ids($wrap);
453
454    jQuery(document).trigger('woosg_init', [$wrap]);
455}
456
457function woosg_carousel($wrap) {
458    if (!$wrap.hasClass('woosg-carousel-initialized')) {
459        let slides = 2;
460        let carousel = JSON.parse(woosg_vars.carousel_params);
461
462        if ($wrap.hasClass('woosg-wrap-layout-carousel-2') || $wrap.hasClass('woosg-wrap-layout-carousel-3') || $wrap.hasClass('woosg-wrap-layout-carousel-4')) {
463            if ($wrap.hasClass('woosg-wrap-layout-carousel-3')) {
464                slides = 3;
465            } else if ($wrap.hasClass('woosg-wrap-layout-carousel-4')) {
466                slides = 4;
467            }
468
469            if (slides > $wrap.find('.woosg-product').length) {
470                slides = $wrap.find('.woosg-product').length;
471            }
472
473            carousel.slidesToShow = slides;
474            carousel.slidesToScroll = slides;
475
476            $wrap.addClass('woosg-carousel-initialized').find('.woosg-products').slick(carousel);
477            jQuery(document).trigger('woosg_carousel', [$wrap]);
478        }
479    }
480}
481
482function woosg_calc_price($wrap) {
483    var total = 0;
484    var total_regular = 0;
485    var wid = $wrap.attr('data-id');
486    var $woobt = jQuery('.woobt-wrap-' + wid);
487    var $woofs = jQuery('.woofs-wrap-' + wid);
488    var $price = jQuery('.woosg-price-' + wid);
489    var $products = $wrap.find('.woosg-products');
490    var $total = $wrap.find('.woosg-total');
491    var suffix = $products.attr('data-price-suffix');
492
493    // main price
494    total = parseFloat($products.attr('data-price'));
495    total_regular = parseFloat($products.attr('data-regular-price'));
496
497    $products.find('.woosg-product').each(function () {
498        var $this = jQuery(this);
499        var price = parseFloat($this.attr('data-price'));
500        var regular_price = parseFloat($this.attr('data-regular-price'));
501        var qty = parseFloat($this.attr('data-qty'));
502        var wpcpq = $this.data('wpcpq');
503
504        if ((price > 0) && (regular_price > 0) && (qty > 0)) {
505            // price by quantity
506            if ((wpcpq.tiers !== undefined) && wpcpq.tiers.length) {
507                var tiers = wpcpq.tiers.sort((a, b) => (parseFloat(a.quantity) < parseFloat(b.quantity)) ? 1 : ((parseFloat(b.quantity) < parseFloat(a.quantity)) ? -1 : 0));
508
509                for (let tier of tiers) {
510                    if (qty >= parseFloat(tier.quantity)) {
511                        if (/\%$/gm.test(tier.price)) {
512                            price = parseFloat(tier.price.replace('%', '')) * price / 100;
513                        } else {
514                            price = parseFloat(tier.price);
515                        }
516
517                        break;
518                    }
519                }
520
521                // update product price
522                var price_html = woosg_price_html(regular_price, price);
523
524                $this.find('.woosg-price-ori').hide();
525                $this.find('.woosg-price-new').html(price_html).show();
526            }
527
528            total += price * qty;
529            total_regular += regular_price * qty;
530        }
531    });
532
533    var total_html = woosg_price_html(total_regular, total) + suffix;
534
535    $total.html(woosg_vars.total_text + ' ' + total_html).slideDown();
536
537    if (woosg_vars.change_price !== 'no') {
538        // change the main price
539        if ((woosg_vars.change_price === 'yes_custom') && (woosg_vars.price_selector !== null) && (woosg_vars.price_selector !== '')) {
540            $price = jQuery(woosg_vars.price_selector);
541        }
542
543        $price.html(total_html);
544    }
545
546    if ($woobt.length) {
547        $woobt.find('.woobt-products').attr('data-product-price-html', total_html);
548        $woobt.find('.woobt-product-this').attr('data-price', total).attr('data-regular-price', total_regular);
549
550        woobt_init($woobt);
551    }
552
553    if ($woofs.length) {
554        $woofs.find('.woofs-products').attr('data-product-price', total);
555        $woofs.find('.woofs-products').attr('data-product-regular-price', total_regular);
556
557        woofs_init($woofs);
558    }
559
560    jQuery(document).trigger('woosg_calc_price', [total, total_regular, total_html, $wrap]);
561}
562
563function woosg_save_ids($wrap) {
564    var ids = Array();
565    var wid = $wrap.attr('data-id');
566    var $products = $wrap.find('.woosg-products');
567    var $ids = jQuery('.woosg-ids-' + wid);
568
569    $products.find('.woosg-product').each(function () {
570        var $this = jQuery(this);
571        var id = parseInt($this.attr('data-id'));
572        var qty = parseFloat($this.attr('data-qty'));
573        var attrs = $this.attr('data-attrs');
574
575        if ((id > 0) && (qty > 0)) {
576            if (attrs != undefined) {
577                attrs = encodeURIComponent(attrs);
578            } else {
579                attrs = '';
580            }
581
582            ids.push(id + '/' + qty + '/' + attrs);
583        }
584    });
585
586    $ids.val(ids.join(','));
587    jQuery(document).trigger('woosg_save_ids', [ids, $wrap]);
588}
589
590function woosg_decimal_places(num) {
591    var match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
592
593    if (!match) {
594        return 0;
595    }
596
597    return Math.max(0, // Number of digits right of decimal point.
598        (match[1] ? match[1].length : 0)
599        // Adjust for scientific notation.
600        - (match[2] ? +match[2] : 0));
601}
602
603function woosg_format_money(number, places, symbol, thousand, decimal) {
604    number = number || 0;
605    places = !isNaN(places = Math.abs(places)) ? places : 2;
606    symbol = symbol !== undefined ? symbol : '$';
607    thousand = thousand !== undefined ? thousand : ',';
608    decimal = decimal !== undefined ? decimal : '.';
609
610    var negative = number < 0 ? '-' : '', i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + '', j = 0;
611
612    if (i.length > 3) {
613        j = i.length % 3;
614    }
615
616    if (woosg_vars.trim_zeros === '1') {
617        return symbol + negative + (j ? i.substr(0, j) + thousand : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousand) + (places && (parseFloat(number) > parseFloat(i)) ? decimal + Math.abs(number - i).toFixed(places).slice(2).replace(/(\d*?[1-9])0+$/g, '$1') : '');
618    } else {
619        return symbol + negative + (j ? i.substr(0, j) + thousand : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : '');
620    }
621}
622
623function woosg_format_price(price) {
624    var price_html = '<span class="woocommerce-Price-amount amount">';
625    var price_formatted = woosg_format_money(price, woosg_vars.price_decimals, '', woosg_vars.price_thousand_separator, woosg_vars.price_decimal_separator);
626
627    switch (woosg_vars.price_format) {
628        case '%1$s%2$s':
629            //left
630            price_html += '<span class="woocommerce-Price-currencySymbol">' + woosg_vars.currency_symbol + '</span>' + price_formatted;
631            break;
632        case '%1$s %2$s':
633            //left with space
634            price_html += '<span class="woocommerce-Price-currencySymbol">' + woosg_vars.currency_symbol + '</span> ' + price_formatted;
635            break;
636        case '%2$s%1$s':
637            //right
638            price_html += price_formatted + '<span class="woocommerce-Price-currencySymbol">' + woosg_vars.currency_symbol + '</span>';
639            break;
640        case '%2$s %1$s':
641            //right with space
642            price_html += price_formatted + ' <span class="woocommerce-Price-currencySymbol">' + woosg_vars.currency_symbol + '</span>';
643            break;
644        default:
645            //default
646            price_html += '<span class="woocommerce-Price-currencySymbol">' + woosg_vars.currency_symbol + '</span>' + price_formatted;
647    }
648
649    price_html += '</span>';
650
651    return price_html;
652}
653
654function woosg_price_html(regular_price, sale_price) {
655    var price_html = '';
656
657    if (parseFloat(woosg_round(sale_price)) < parseFloat(woosg_round(regular_price))) {
658        price_html = '<del>' + woosg_format_price(regular_price) + '</del> <ins>' + woosg_format_price(sale_price) + '</ins>';
659    } else {
660        price_html = woosg_format_price(regular_price);
661    }
662
663    return price_html;
664}
665
666function woosg_round(value) {
667    return Number(Math.round(value + 'e' + woosg_vars.price_decimals) + 'e-' + woosg_vars.price_decimals);
668}

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.