PageSourceSearch

https://cacef.coop/wp-content/plugins/bcb-indicators/assets/js/bcb-indicators.js?ver=1.0.1

js cacef.coop collected 2026-09-24 14:59:09 UTC 2,972 bytes, 82 lines download raw bytes

1// BCB Indicators - JavaScript - SIN REDONDEO
2(function($) {
3    'use strict';
4    
5    $(document).ready(function() {
6        if (typeof bcbIndicators === 'undefined') {
7            return;
8        }
9        
10        if ($('.bcb-indicators-container').length > 0) {
11            loadBCBIndicators();
12        }
13    });
14    
15    function loadBCBIndicators() {
16        $.ajax({
17            url: bcbIndicators.ajaxUrl,
18            type: 'POST',
19            data: {
20                action: 'bcb_get_indicators',
21                nonce: bcbIndicators.nonce
22            },
23            success: function(response) {
24                if (response.success && response.data.indicators) {
25                    updateIndicatorsDisplay(response.data);
26                }
27            },
28            error: function(xhr, status, error) {
29                console.error('BCB Indicators Error:', error);
30            }
31        });
32    }
33    
34    function updateIndicatorsDisplay(data) {
35        $.each(data.indicators, function(key, indicator) {
36            var $element = $('[data-indicator="' + key + '"]');
37            if ($element.length) {
38                var value = formatIndicatorValue(indicator, key);
39                $element.find('.bcb-indicator-value').text(value);
40            }
41        });
42        
43        if (data.cache_time) {
44            var date = new Date(data.cache_time * 1000);
45            var formattedDate = date.toLocaleString('es-BO');
46            $('.bcb-last-update').text('Actualizado: ' + formattedDate);
47        }
48    }
49    
50    function formatIndicatorValue(indicator, type) {
51        // NO REDONDEAR - mostrar valores exactos
52        if (['exchange_rate', 'ufv', 'gold'].includes(type)) {
53            if (indicator.value !== null && indicator.value !== undefined) {
54                return indicator.value; // Valor exacto como string
55            }
56        }
57        
58        if (type === 'inflation') {
59            var parts = [];
60            if (indicator.ipc) parts.push('IPC: ' + indicator.ipc);
61            if (indicator.mensual) parts.push('Mensual: ' + indicator.mensual + '%');
62            if (indicator.doce_meses) parts.push('12 meses: ' + indicator.doce_meses + '%');
63            return parts.length > 0 ? parts.join(' | ') : 'N/A';
64        }
65        
66        if (type === 'tre') {
67            var parts = [];
68            if (indicator.mn) parts.push('MN: ' + indicator.mn + '%');
69            if (indicator.mvdol) parts.push('MVDOL: ' + indicator.mvdol + '%');
70            if (indicator.mn_ufv) parts.push('MN-UFV: ' + indicator.mn_ufv + '%');
71            if (indicator.me) parts.push('ME: ' + indicator.me + '%');
72            return parts.length > 0 ? parts.join(' | ') : 'N/A';
73        }
74        
75        if (indicator.value !== null && indicator.value !== undefined) {
76            return indicator.value;
77        }
78        
79        return 'N/A';
80    }
81    
82})(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.