PageSourceSearch

https://www.destechpub.com/wp-content/plugins/currency-exchange-for-woocommerce/js/currency_exchange.js?x23609

js destechpub.com collected 2026-09-24 21:15:06 UTC 6,095 bytes, 133 lines download raw bytes

1var brjsf_ce;
2(function ($){
3    brjsf_ce = function ( block ) {
4        if ( typeof(block) != 'undefined' ) {
5            brjsf_ce_reload(block);
6        }
7        $('.brjsf_ce').each( function( i, o ) {
8            var width = 200;
9            if ( $(o).data('width') ) {
10                width = $(o).data('width');
11            } 
12            var html = '<div class="brjsf_ce_select"><span class="brjsf_ce_text">'+$(o).find('option:selected').data('text')+'</span> <i class="fa fa-caret-down"></i><ul>';
13            $(o).find('option').each( function ( i_option, o_option ) {
14                html += '<li data-value="'+$(o_option).val()+'">'+$(o_option).data('text')+'</li>';
15            });
16            html += '</ul></div>';
17            $(o).after( html );
18            $(o).removeClass('brjsf_ce').addClass('brjsf_ce_ready');
19        });
20    }
21    function brjsf_ce_reload ( input ) {
22        if ( $(input).is('.brjsf_ce_ready') ) {
23            $(input).removeClass('brjsf_ce_ready').addClass('brjsf_ce').next().remove();
24        } else if ( !$(input).is('.brjsf_ce') ) {
25            $(input).addClass('brjsf_ce');
26        }
27    }
28    $(document).on( 'click', '.brjsf_ce_select', function (event) {
29        event.preventDefault();
30        if ( $(this).is('.brjsf_ce_show') ) {
31            $(this).removeClass('brjsf_ce_show');
32            $(this).find('.fa').removeClass('fa-caret-up').addClass('fa-caret-down');
33        } else {
34            $('.brjsf_ce_show').removeClass('brjsf_ce_show');
35            $(this).addClass('brjsf_ce_show');
36            $(this).find('.fa').removeClass('fa-caret-down').addClass('fa-caret-up');
37            $(this).find('ul').attr('style', '');
38            if( ( jQuery(this).offset().top - jQuery(window).scrollTop() ) > ( jQuery(window).height() / 2 ) ) {
39                $(this).find('ul').css('bottom', '100%').css('top', 'initial');
40            } else {
41                $(this).find('ul').css('bottom', 'initial').css('top', '100%');
42            }
43        }
44    });
45    $(document).on( 'click', '.brjsf_ce_select ul li', function(event) {
46        var $select = $(this).parents('.brjsf_ce_select');
47        $select.find('span.brjsf_ce_text').html($(this).html());
48        $select.prev().val($(this).data('value')).trigger('change');
49        
50    });
51    $(document).on( 'mousedown', '.brjsf_ce_select ul li, .brjsf_ce_select', function(event) {
52        event.preventDefault();
53        event.stopPropagation();
54    });
55    $(document).on( 'mousedown', function(event) {
56        $('.brjsf_ce_show').removeClass('brjsf_ce_show').find('.fa').removeClass('fa-caret-up').addClass('fa-caret-down');
57    });
58    $(document).ready( function () {
59        ce_execute_func( the_ce_js_data.script.js_page_load );
60        jQuery(document).trigger('berocket_ce-js_page_load');
61        $(document).on( 'change', '.br_ce_currency_select, .br_ce_select_currency', function(event){
62            ce_execute_func( the_ce_js_data.script.js_before_set );
63            jQuery(document).trigger('berocket_ce-js_before_set');
64            var val = $(this).val();
65            $.cookie( 'br_ce_language', val, { path: '/', domain: document.domain } );
66            $('.br_ce_currency_select').val(val);
67            $('.br_ce_'+val).prop('checked', true);
68            try {
69                sessionStorage.removeItem('wc_fragments');
70                sessionStorage.removeItem('wc_cart_hash');
71                localStorage.removeItem('wc_cart_hash');
72                sessionStorage.removeItem(wc_cart_fragments_params.fragment_name);
73            } catch (e) {}
74            jQuery(document).trigger('berocket_ce-js_after_set');
75            ce_execute_func( the_ce_js_data.script.js_after_set );
76        });
77        if( the_ce_js_data.visual_only ) {
78            fx.base = the_ce_js_data.base;
79            fx.rates = the_ce_js_data.rates;
80            if( the_ce_js_data.current != 'none' ) {
81                fx.settings = {
82                    from : fx.base,
83                    to : the_ce_js_data.current
84                };
85                ce_money_replace();
86            }
87            jQuery(document).on('berocket_ajax_filtering_end', ce_money_replace);
88            jQuery(document).on('berocket_lmp_end', ce_money_replace);
89            jQuery(document).on('berocket_product_preview-popup_open', ce_money_replace);
90            jQuery(document).on('wc_fragments_refreshed', ce_money_replace);
91            jQuery(document).on('wc_fragments_loaded', ce_money_replace);
92        }
93        brjsf_ce();
94        jQuery(document).ajaxComplete(function() {
95            if( the_ce_js_data.visual_only ) {
96                ce_money_replace();
97            }
98        });
99        if( the_ce_js_data.visual_only ) {
100            ce_money_replace();
101        }
102    });
103    if( the_ce_js_data.visual_only ) {
104        $(document).on('change', '.variations select', ce_money_replace);
105        $(document).on('br_popup-show_popup', ce_money_replace);
106        $(document).on('berocket_product_preview-popup_open', ce_money_replace);
107    }
108})(jQuery);
109function ce_money_replace() {
110    if( the_ce_js_data.current != 'none' ) {
111        jQuery('span.amount').each(function(i, o) {
112            if( ! jQuery(o).is('.exchanged') ) {
113                jQuery(o).find('.woocommerce-Price-currencySymbol').remove();
114                var money = accounting.unformat(jQuery(o).text(), the_ce_js_data.accounting.decimal);
115                money = fx.convert(money);
116                money = accounting.formatMoney(money, the_ce_js_data.accounting);
117                jQuery(o).html(money).addClass('exchanged');
118            }
119        });
120    }
121}
122function ce_execute_func ( func ) {
123    if( the_ce_js_data.script != 'undefined'
124        && the_ce_js_data.script != null
125        && typeof func != 'undefined' 
126        && func.length > 0 ) {
127        try{
128            eval( func );
129        } catch(err){
130            alert('You have some incorrect JavaScript code (Currency Exchange)');
131        }
132    }
133}

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.