PageSourceSearch

https://donnaherula.com/wp-content/plugins/woocommerce-currency-switcher/js/front.js?ver=1.5.4

js donnaherula.com collected 2026-09-26 16:23:08 UTC 32,125 bytes, 763 lines download raw bytes

1"use strict";
2var woocs_loading_first_time = true;//simply flag var
3var woocs_sumbit_currency_changing = true;//just a flag variable for drop-down redraws when prices redraws by AJAX
4
5
6// Unique per-browser storage key. Generated once and kept in localStorage forever.
7// Used ONLY in browser key mode as the storage key instead of the visitor IP.
8// IMPORTANT: the value must stay lowercase. The PHP side runs it through
9// sanitize_key(), which lowercases, so an uppercase character here would produce
10// a different md5 on the server and silently split the storage bucket in two.
11var woocs_sk = '';
12if (typeof woocs_browser_key_mode !== 'undefined' && woocs_browser_key_mode) {
13    try {
14        woocs_sk = localStorage.getItem('woocs_sk') || '';
15        if (!woocs_sk) {
16            woocs_sk = (window.crypto && crypto.randomUUID)
17                    ? crypto.randomUUID().replace(/-/g, '')
18                    : String(Date.now()) + Math.random().toString(36).slice(2, 12);
19            localStorage.setItem('woocs_sk', woocs_sk);
20        }
21    } catch (e) {
22        woocs_sk = ''; // private mode / storage disabled: silently fall back to the IP based key
23    }
24}
25
26// Must run at top level, NOT on document ready: WooCommerce Blocks and the Store API
27// start calling fetch() before ready fires, and anything sent earlier misses the key.
28// jQuery covers admin-ajax and wc-ajax (see ajaxSend below); fetch() based callers -
29// Blocks, the Store API, PayPal PPCP - never pass through jQuery, so the key has to
30// travel as a request header. A header, not a query argument: a per visitor query
31// argument would fragment the page cache per visitor.
32if (woocs_sk && window.fetch) {
33    var woocs_native_fetch = window.fetch;
34    window.fetch = function (input, init) {
35
36        var url = (typeof input === 'string') ? input : (input && input.url) || '';
37
38        // Same origin only. A custom header on a cross origin request triggers a
39        // preflight and can break payment SDKs loaded from third party domains.
40        if (url.indexOf('http') === 0 && url.indexOf(window.location.origin) !== 0) {
41            return woocs_native_fetch(input, init);
42        }
43
44        init = init || {};
45        init.headers = new Headers(init.headers || (input && input.headers) || {});
46        if (!init.headers.has('X-WOOCS-SK')) {
47            init.headers.set('X-WOOCS-SK', woocs_sk);
48        }
49        return woocs_native_fetch(input, init);
50    };
51}
52
53jQuery(function ($) {
54
55    if (typeof woocs_array_of_get === 'undefined') {
56        return;//to avoid notices and errors
57    }
58
59    woocs_array_of_get = JSON.parse(woocs_array_of_get);
60
61    // Attach the browser key to every AJAX request (admin-ajax and wc-ajax),
62    // so the cart and the checkout resolve the same currency as the catalog pages.
63    if (woocs_sk) {
64        $(document).ajaxSend(function (e, xhr, settings) {
65            if (typeof settings.data === 'string' && settings.data.indexOf('woocs_sk=') === -1) {
66                settings.data += (settings.data ? '&' : '') + 'woocs_sk=' + encodeURIComponent(woocs_sk);
67            }
68        });
69
70
71        // A currency arrived in the URL, but a plain page load carries no browser key,
72        // so the value was stored under the IP key. Mirror it to the browser key bucket
73        // before any redraw runs, otherwise the redraw reads an empty bucket and falls
74        // back to the base currency.
75        // Uppercased on purpose: the URL handler uses strtoupper() while set_currency()
76        // stores whatever it is given, so a lowercase code would be saved as is and then
77        // never match the currency array keys.
78        if (woocs_array_of_get.currency !== undefined) {
79            jQuery.post(woocs_ajaxurl, {
80                action: 'woocs_set_currency_ajax',
81                currency: String(woocs_array_of_get.currency).toUpperCase()
82            }, function () {
83                // The mini cart HTML is cached in sessionStorage keyed by the CART hash,
84                // and the currency is not part of that hash - so the stale fragment would
85                // otherwise survive every later navigation. Refresh it now that the
86                // storage bucket already holds the new currency.
87                jQuery(document.body).trigger('wc_fragment_refresh');
88            });
89        }
90    }
91
92    //wp-content\plugins\woocommerce\assets\js\frontend\cart.js
93    if (Object.keys(woocs_array_of_get).length !== 0) {
94        if ('currency' in woocs_array_of_get) {
95            //this code nessesary for correct redrawing of the shipping methods while currency changes on the cart page
96            $('body.woocommerce-cart .shop_table.cart').closest('form').find('input[name="update_cart"]').prop('disabled', false);
97            $('body.woocommerce-cart .shop_table.cart').closest('form').find('input[name="update_cart"]').trigger('click');
98        }
99    }
100
101    //keeps data of $_GET array
102
103    if (Object.keys(woocs_array_of_get).length == 0) {
104        woocs_array_of_get = {};
105    }
106
107    //***
108    woocs_array_no_cents = JSON.parse(woocs_array_no_cents);
109
110    //***
111
112    //emptying cart widget after checkout
113    if (!parseInt(woocs_get_cookie('woocommerce_items_in_cart'), 10)) {
114        $('.widget_shopping_cart_content').empty();
115        $(document.body).trigger('wc_fragment_refresh');
116    }
117
118    if (woocs_array_of_get.currency != undefined || woocs_array_of_get.removed_item != undefined || woocs_array_of_get.key != undefined)
119    {
120        woocs_refresh_mini_cart(555);
121    }
122    if (woocs_redraw_cart) {
123        //intercept adding to cart event to redraw mini-cart widget
124        jQuery(document).on("adding_to_cart", function () {
125            woocs_refresh_mini_cart(999);
126        });
127    }
128
129    //to make price popup mobile friendly
130    jQuery('body').on('click', '.woocs_price_info', function () {
131        return false;
132    });
133
134    //+++++++++++++++++++++++++++++++++++++++++++++++
135
136    if (woocs_drop_down_view == 'chosen' || woocs_drop_down_view == 'chosen_dark') {
137        try {
138            if (jQuery("select.woocommerce-currency-switcher").not('.woocs_clean_select').length) {
139                jQuery("select.woocommerce-currency-switcher").not('.woocs_clean_select').chosen({
140                    disable_search_threshold: 10
141                });
142
143                jQuery.each(jQuery('.woocommerce-currency-switcher-form .chosen-container'), function (index, obj) {
144                    jQuery(obj).css({'width': jQuery(this).prev('select').data('width')});
145                });
146            }
147        } catch (e) {
148            console.log(e);
149        }
150    }
151
152
153
154    if (woocs_drop_down_view == 'ddslick') {
155        try {
156            woocs_init_ddslick_select();
157
158        } catch (e) {
159            console.log(e);
160        }
161    }
162
163    woocs_loading_first_time = false;
164
165
166    if (woocs_drop_down_view == 'wselect' && woocs_is_mobile != 1) {
167        try {
168            //https://github.com/websanova/wSelect#wselectjs
169            jQuery('select.woocommerce-currency-switcher').not('.woocs_clean_select').wSelect({
170                size: 7
171            });
172        } catch (e) {
173            console.log(e);
174        }
175    }
176
177    //for flags view instead of drop-down
178    jQuery('.woocs_flag_view_item').on("click", function () {
179        if (woocs_sumbit_currency_changing) {
180            if (jQuery(this).hasClass('woocs_flag_view_item_current')) {
181                return false;
182            }
183            //***
184
185            if (Object.keys(woocs_array_of_get).length == 0) {
186                window.location = window.location.href + '?currency=' + jQuery(this).data('currency');
187            } else {
188
189                woocs_redirect(jQuery(this).data('currency'));
190
191            }
192        }
193
194        return false;
195    });
196
197    //for converter
198    if (jQuery('.woocs_converter_shortcode').length) {
199        jQuery('.woocs_converter_shortcode_button').on("click", function () {
200            var amount = jQuery(this).parent('.woocs_converter_shortcode').find('.woocs_converter_shortcode_amount').eq(0).val();
201            var from = jQuery(this).parent('.woocs_converter_shortcode').find('.woocs_converter_shortcode_from').eq(0).val();
202            var to = jQuery(this).parent('.woocs_converter_shortcode').find('.woocs_converter_shortcode_to').eq(0).val();
203            var precision = jQuery(this).parent('.woocs_converter_shortcode').find('.woocs_converter_shortcode_precision').eq(0).val();
204            var results_obj = jQuery(this).parent('.woocs_converter_shortcode').find('.woocs_converter_shortcode_results').eq(0);
205            jQuery(results_obj).val(woocs_lang_loading + ' ...');
206            var data = {
207                action: "woocs_convert_currency",
208                amount: amount,
209                from: from,
210                to: to,
211                precision: precision
212            };
213
214            jQuery.post(woocs_ajaxurl, data, function (value) {
215                jQuery(results_obj).val(value);
216            });
217
218            return false;
219
220        });
221    }
222
223    //for rates
224    if (jQuery('.woocs_rates_shortcode').length) {
225        jQuery('body').on('change', '.woocs_rates_current_currency', function () {
226            var _this = this;
227            var data = {
228                action: "woocs_rates_current_currency",
229                current_currency: jQuery(this).val(),
230                precision: jQuery(this).data('precision'),
231                exclude: jQuery(this).data('exclude')
232            };
233
234            jQuery.post(woocs_ajaxurl, data, function (html) {
235                jQuery(_this).parent('.woocs_rates_shortcode').html(html);
236            });
237
238            return false;
239
240        });
241    }
242
243    //if we using js price update while the site is cached
244    if (typeof woocs_shop_is_cached !== 'undefined') {
245        if (woocs_shop_is_cached) {
246
247            setTimeout(function () {
248
249                woocs_sumbit_currency_changing = false;
250                if (typeof woocs_array_of_get.currency === 'undefined') {
251
252                    if (jQuery('body').hasClass('single')) {
253                        // jQuery('.woocs_price_info').remove();
254                    }
255
256                    /****/
257                    var custom_prices = [];
258                    jQuery.each(jQuery('.woocs_amount_custom_price'), function (index, item) {
259                        let decimals = jQuery(item).data('decimals');
260                        let value = jQuery(item).data('value');
261                        let currency = jQuery(item).data('currency');
262                        custom_prices.push({
263                            decimals: decimals,
264                            value: value,
265                            currency: currency
266                        });
267                    });
268                    if (custom_prices.length != 0) {
269
270                        var data = {
271                            action: "woocs_get_custom_price_html",
272                            custom_prices: custom_prices,
273                            current_currency: woocs_current_currency['name']
274                        };
275                        jQuery.post(woocs_ajaxurl, data, function (data) {
276                            // The server answers with wp_send_json (already parsed by jQuery)
277                            // in one branch and with wp_die(json_encode()) (plain string) in another.
278                            if (typeof data === 'string') {
279                                data = JSON.parse(data);
280                            }
281                            if (!jQuery.isEmptyObject(data)) {
282                                jQuery.each(data, function (val, price) {
283                                    jQuery(".woocs_amount_custom_price[data-value='" + val + "']").replaceWith(price);
284                                });
285
286                            }
287                        });
288                    }
289
290
291                    /****/
292
293                    var variation_ids = [];
294                    var var_data = jQuery("form.variations_form").data("product_variations");
295                    if (typeof var_data != "undefined") {
296                        jQuery.each(var_data, function (indx, attr) {
297                            variation_ids.push(attr['variation_id']);
298                        });
299                        if (variation_ids.length != 0) {
300                            var data_var = {
301                                action: "woocs_get_variation_products_price_html",
302                                var_products_ids: variation_ids,
303                                current_currency: woocs_current_currency['name']
304                            };
305
306                            jQuery.post(woocs_ajaxurl, data_var, function (data) {
307                                // The server answers with wp_send_json (already parsed by jQuery)
308                                // in one branch and with wp_die(json_encode()) (plain string) in another.
309                                if (typeof data === 'string') {
310                                    data = JSON.parse(data);
311                                }
312
313                                if (!jQuery.isEmptyObject(data)) {
314                                    jQuery.each(var_data, function (indx, attr) {
315                                        if (typeof data[attr['variation_id']] != "undefined") {
316                                            var_data[indx]['price_html'] = data[attr['variation_id']];
317                                        }
318                                    });
319                                    jQuery("form.variations_form").data("product_variations", var_data);
320                                }
321                            });
322                        }
323                    }
324
325                    //***
326                    var products_ids = {};
327                    var products_currency = {};
328                    jQuery.each(jQuery('.woocs_price_code'), function (index, item) {
329                        products_ids[jQuery(item).data('redraw-id')] = jQuery(item).data('product-id');
330                        if (jQuery(item).data('currency')) {
331                            products_currency[jQuery(item).data('redraw-id')] = jQuery(item).data('currency');
332                        }
333
334                    });
335
336                    //if no prices on the page - do nothing
337                    if (Object.keys(products_ids).length === 0) {
338                        woocs_sumbit_currency_changing = true;
339                        return;
340                    }
341
342                    var data = {
343                        action: "woocs_get_products_price_html",
344                        products_ids: products_ids,
345                        products_currency: products_currency,
346                        current_currency: woocs_current_currency['name']
347                    };
348
349                    jQuery.post(woocs_ajaxurl, data, function (data) {
350
351                        // The server answers with wp_send_json (already parsed by jQuery)
352                        // in one branch and with wp_die(json_encode()) (plain string) in another.
353                        if (typeof data === 'string') {
354                            data = JSON.parse(data);
355                        }
356
357                        if (jQuery.isEmptyObject(data)) {
358                            woocs_sumbit_currency_changing = true;
359                        }
360                        if (!jQuery.isEmptyObject(data)) {
361                            jQuery('.woocs_price_info').remove();
362                            jQuery('.woocs_price_approx.woocs_cart_item_price').remove();
363                            jQuery.each(jQuery('.woocs_price_code'), function (index, item) {
364                                if (data.ids[jQuery(item).data('redraw-id')] != undefined) {
365                                    jQuery(item).replaceWith(data.ids[jQuery(item).data('redraw-id')]);
366                                }
367
368
369                            });
370                            jQuery('.woocs_price_code').removeClass('woocs_preloader_ajax');
371                            //***
372                            jQuery('.woocommerce-currency-switcher').val(data.current_currency);
373                            //***
374                            if (woocs_drop_down_view == 'chosen' || woocs_drop_down_view == 'chosen_dark') {
375                                try {
376                                    if (jQuery("select.woocommerce-currency-switcher").not('.woocs_clean_select').length) {
377                                        jQuery("select.woocommerce-currency-switcher").not('.woocs_clean_select').chosen({
378                                            disable_search_threshold: 10
379                                        });
380                                        jQuery('select.woocommerce-currency-switcher').trigger("chosen:updated");
381                                    }
382                                } catch (e) {
383                                    console.log(e);
384                                }
385                            }
386                            if (typeof data.currency_data != "undefined") {
387                                woocs_current_currency = data.currency_data;
388                                /* Price  slider */
389                                var min = jQuery('.price_slider_amount #min_price').val();
390                                var max = jQuery('.price_slider_amount #max_price').val();
391                                if (typeof max != 'undefined' && typeof min != 'undefined') {
392                                    max = woocs_convert_price_slider(max);
393                                    min = woocs_convert_price_slider(min);
394                                    jQuery(document.body).trigger('price_slider_create', [min, max]);
395                                }
396                            }
397                            //***
398                            if (woocs_drop_down_view == 'ddslick') {
399                                try {
400                                    jQuery('div.dd-container').ddslick('destroy');
401                                    jQuery('select.woocommerce-currency-switcher').not('.woocs_clean_select').val(data.current_currency);
402                                    woocs_init_ddslick_select();
403                                } catch (e) {
404                                    console.log(e);
405                                }
406                            }
407                            //***
408                            if (woocs_drop_down_view == 'wselect' && woocs_is_mobile != 1) {
409                                //https://github.com/websanova/wSelect
410                                try {
411                                    jQuery('select.woocommerce-currency-switcher').not('.woocs_clean_select').val(data.current_currency).trigger("change");
412                                } catch (e) {
413                                    console.log(e);
414                                }
415                            }
416                            //***
417                            /* auto switcher*/
418
419                            var auto_switcher = jQuery('.woocs_auto_switcher');
420                            if (auto_switcher.length > 0) {
421                                woocs_auto_switcher_redraw(data.current_currency, auto_switcher);
422                            }
423                            woocs_sumbit_currency_changing = true;
424
425                            var shortcode_currency = jQuery('strong.woocs_current_currency_code');
426                            if (shortcode_currency.length) {
427                                shortcode_currency.text(data.current_currency);
428                            }
429
430
431                            //***
432                            //for another woocs switchers styles
433                            document.dispatchEvent(new CustomEvent('after_woocs_get_products_price_html', {detail: {
434                                    current_currency: data.current_currency
435                                }}));
436                        }
437
438                    });
439
440                } else {
441                    woocs_sumbit_currency_changing = true;
442
443                }
444                jQuery(".single_variation_wrap").on("show_variation", function (event, variation) {
445                    jQuery('.woocs_price_code').removeClass('woocs_preloader_ajax');
446                });
447                jQuery('.woocs_price_code').removeClass('woocs_preloader_ajax');
448            }, 300);
449
450        }
451    }
452
453    //***
454    //removing price info on single page near variation prices
455    setTimeout(function () {
456        //jQuery('body.single-product .woocommerce-variation-price').find('.woocs_price_info').remove();
457    }, 300);
458    //***
459
460    //fix: https://pluginus.net/support/topic/wrong-currency-displayed/#postid-100678
461    //for shortcode [woocs_show_custom_price value="100"] when sites has cache enabled
462    setTimeout(function () {
463        // Check if cache mode is enabled
464        if (typeof woocs_shop_is_cached !== 'undefined' && woocs_shop_is_cached) {
465
466            // Recalculate custom prices function
467            function woocs_recalculate_custom_prices() {
468                jQuery('.woocs_amount_custom_price').each(function () {
469                    var $item = jQuery(this);
470                    var base_value = parseFloat($item.data('value'));
471                    var decimals = parseInt($item.data('decimals'));
472
473                    if (isNaN(base_value)) {
474                        return;
475                    }
476
477                    // Convert to current currency
478                    var converted_value = base_value * woocs_current_currency.rate;
479
480                    // Determine decimals
481                    if (decimals === -1 || isNaN(decimals)) {
482                        decimals = parseInt(woocs_current_currency.decimals);
483                    }
484
485                    // Apply hide_cents setting
486                    if (woocs_current_currency.hide_cents == 1) {
487                        decimals = 0;
488                    }
489
490                    // Format number
491                    var price_formatted = converted_value.toFixed(decimals);
492
493                    // Apply separators
494                    if (woocs_current_currency.separators === "1") {
495                        // European format: 1.234,56
496                        price_formatted = price_formatted.replace('.', ',');
497                        var parts = price_formatted.split(',');
498                        parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, '.');
499                        price_formatted = parts.join(',');
500                    } else {
501                        // American format: 1,234.56
502                        var parts = price_formatted.split('.');
503                        parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
504                        price_formatted = parts.join('.');
505                    }
506
507                    // Build HTML with currency symbol
508                    var symbol = woocs_current_currency.symbol;
509                    var position = woocs_current_currency.position;
510                    var final_html = '';
511
512                    switch (position) {
513                        case 'left':
514                            final_html = symbol + price_formatted;
515                            break;
516                        case 'left_space':
517                            final_html = symbol + ' ' + price_formatted;
518                            break;
519                        case 'right':
520                            final_html = price_formatted + symbol;
521                            break;
522                        case 'right_space':
523                            final_html = price_formatted + ' ' + symbol;
524                            break;
525                        default:
526                            final_html = symbol + price_formatted;
527                    }
528
529                    // Update inner span with class woocs_amount
530                    $item.find('.woocs_amount').html(final_html);
531                });
532
533                console.log('WOOCS custom prices recalculated');
534            }
535
536            // Run on page load
537            woocs_recalculate_custom_prices();
538
539            // Run on currency change
540            jQuery(document).on('woocs_currencies_changed', function () {
541                setTimeout(woocs_recalculate_custom_prices, 100);
542            });
543        }
544    }, 500);
545});
546
547
548function woocs_redirect(currency) {
549    if (!woocs_sumbit_currency_changing) {
550        return;
551    }
552
553    //***
554    var l = window.location.href;
555    //  l = l.replace('#', '');
556    var l_tmp = l.split('#');
557    l = l_tmp[0];
558    var id_key = "";
559    if (l_tmp.length > 1) {
560        id_key = "#" + l_tmp[1]
561    }
562    //for #id navigation     l = l.replace(/(#.+$)/gi, '');
563
564    l = l.split('?');
565    l = l[0];
566    var string_of_get = '?';
567    woocs_array_of_get.currency = currency;
568
569    /*
570     l = l.replace(/(\?currency=[a-zA-Z]+)/g, '?');
571     l = l.replace(/(&currency=[a-zA-Z]+)/g, '');
572     */
573
574    if (woocs_special_ajax_mode) {
575        string_of_get = "";
576
577        var data = {
578            action: "woocs_set_currency_ajax",
579            currency: currency
580        };
581
582        jQuery.post(woocs_ajaxurl, data, function (value) {
583            location.reload();
584        });
585
586    } else {
587
588        if (Object.keys(woocs_array_of_get).length > 0) {
589            let get_values = [];
590            jQuery.each(woocs_array_of_get, function (index, value) {
591                get_values.push(index + "=" + value);
592            });
593            string_of_get += get_values.join("&");
594        }
595
596        if (woocs_sk) {
597            jQuery.post(woocs_ajaxurl, {
598                action: "woocs_set_currency_ajax",
599                currency: currency,
600                woocs_sk
601            }, function (value) {
602                window.location = l + string_of_get + id_key;
603            });
604
605        } else {
606            window.location = l + string_of_get + id_key;
607        }
608
609    }
610}
611
612function woocs_refresh_mini_cart(delay) {
613    /** Cart Handling */
614    setTimeout(function () {
615        try {
616
617            //for refreshing mini cart
618            $fragment_refresh = {
619                url: wc_cart_fragments_params.ajax_url,
620                type: 'POST',
621                data: {action: 'woocommerce_get_refreshed_fragments', woocs_woocommerce_before_mini_cart: 'mini_cart_refreshing'},
622                success: function (data) {
623                    if (data && data.fragments) {
624
625                        jQuery.each(data.fragments, function (key, value) {
626                            jQuery(key).replaceWith(value);
627                        });
628
629                        try {
630                            if ($supports_html5_storage) {
631                                sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(data.fragments));
632                                sessionStorage.setItem('wc_cart_hash', data.cart_hash);
633                            }
634                        } catch (e) {
635
636                        }
637
638                        jQuery('body').trigger('wc_fragments_refreshed');
639                    }
640                }
641            };
642
643            jQuery.ajax($fragment_refresh);
644
645
646            /* Cart hiding */
647            try {
648                if (woocs_get_cookie('woocommerce_items_in_cart') > 0)
649                {
650                    jQuery('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').show();
651                } else {
652                    jQuery('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').hide();
653                }
654            } catch (e) {
655                //***
656            }
657
658
659            jQuery('body').on('adding_to_cart', function () {
660                jQuery('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').show();
661            });
662
663        } catch (e) {
664            //***
665        }
666
667    }, delay);
668
669}
670
671function woocs_get_cookie(name) {
672    var matches = document.cookie.match(new RegExp(
673            "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
674            ));
675    return matches ? decodeURIComponent(matches[1]) : undefined;
676}
677
678/*auto switcher*/
679
680jQuery(function () {
681    jQuery('.woocs_auto_switcher_link').on('click', function () {
682        woocs_redirect(jQuery(this).data('currency'));
683        return false;
684    });
685
686    jQuery('.woocs_auto_switcher li').on('click', function (e) {
687        woocs_redirect(jQuery(this).find('a.woocs_auto_switcher_link').data('currency'));
688        return false;
689    });
690});
691
692function woocs_auto_switcher_redraw(curr_curr, switcher) {
693    var view = switcher.data('view');
694    switch (view) {
695        case 'classic_blocks':
696            switcher.find('a').removeClass('woocs_curr_curr');
697            switcher.find('a[data-currency="' + curr_curr + '"]').addClass('woocs_curr_curr');
698            break;
699        case 'roll_blocks':
700            switcher.find('a').removeClass('woocs_curr_curr');
701            switcher.find('li').removeClass('woocs_auto_bg_woocs_curr_curr');
702            var current_link = switcher.find('a[data-currency="' + curr_curr + '"]');
703            current_link.addClass('woocs_curr_curr');
704            current_link.parents('li').addClass('woocs_auto_bg_woocs_curr_curr');
705            break;
706        case 'round_select':
707            switcher.find('a').removeClass('woocs_curr_curr');
708            var current_link = switcher.find('a[data-currency="' + curr_curr + '"]');
709            current_link.addClass('woocs_curr_curr');
710            jQuery('.woocs_current_text').html(current_link.find('.woocs_base_text').html());
711            break;
712        default:
713            break;
714    }
715
716}
717
718function woocs_remove_link_param(key, sourceURL) {
719    var rtn = sourceURL.split("?")[0],
720            param,
721            params_arr = [],
722            queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
723    if (queryString !== "") {
724        params_arr = queryString.split("&");
725        for (var i = params_arr.length - 1; i >= 0; i -= 1) {
726            param = params_arr[i].split("=")[0];
727            if (param === key) {
728                params_arr.splice(i, 1);
729            }
730        }
731        rtn = rtn + "?" + params_arr.join("&");
732    }
733    return rtn;
734}
735
736function woocs_init_ddslick_select() {
737    jQuery.each(jQuery('select.woocommerce-currency-switcher').not('.woocs_clean_select'), function (index, obj) {
738        var width = jQuery(obj).data('width');
739        var flag_position = jQuery(obj).data('flag-position');
740        jQuery(obj).ddslick({
741            //data: ddData,
742            width: width,
743            imagePosition: flag_position,
744            selectText: "Select currency",
745            //background:'#ff0000',
746            onSelected: function (data) {
747                if (!woocs_loading_first_time)
748                {
749                    var form = jQuery(data.selectedItem).closest('form.woocommerce-currency-switcher-form');
750                    jQuery(form).find('input[name="woocommerce-currency-switcher"]').eq(0).val(data.selectedData.value);
751
752                    if (Object.keys(woocs_array_of_get).length == 0) {
753                        //jQuery(form).submit();
754                        woocs_redirect(data.selectedData.value);
755                    } else {
756                        woocs_redirect(data.selectedData.value);
757                    }
758                }
759
760            }
761        });
762    });
vendor: 3 bytes, line 763
763}

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.