PageSourceSearch

https://agroportal.su/wp-content/plugins/strip-foundation-calc/strip-foundation-calc.js?ver=1.0

js agroportal.su collected 2026-10-08 18:49:51 UTC 3,136 bytes, 89 lines download raw bytes

1jQuery(document).ready(function($) {
2    let foundationChart = null;
3
4    function calculateFoundation() {
5        let length = parseFloat($('#sf_length').val()) || 0;
6        let width = parseFloat($('#sf_width').val()) || 0;
7        let height = parseFloat($('#sf_height').val()) || 0;
8        let rebarLong = parseFloat($('#sf_rebar_long').val()) || 4;
9        let hookLen = parseFloat($('#sf_hook_len').val()) || 1.2;
10        let hookStep = parseFloat($('#sf_hook_step').val()) || 0.5;
11
12        // Объем бетона
13        let volume = length * width * height;
14        let weight = volume * 2400; // кг
15        
16        // Продольная арматура
17        let rebarLongM = length * rebarLong;
18        
19        // Поперечная арматура (хомутов)
20        let hooksQty = Math.ceil(length / hookStep) + 1;
21        let rebarHookM = hooksQty * hookLen;
22        
23        let totalRebarM = rebarLongM + rebarHookM;
24        
25        // Стоимость
26        let concretePricePerCube = 5500;
27        let rebarPricePerM = 60;
28        
29        let costConcrete = volume * concretePricePerCube;
30        let costRebar = totalRebarM * rebarPricePerM;
31        let totalCost = costConcrete + costRebar;
32        
33        // Вывод результатов
34        $('#sf_volume').text(volume.toFixed(2));
35        $('#sf_weight').text(weight.toFixed(0));
36        $('#sf_rebar_long_m').text(rebarLongM.toFixed(1));
37        $('#sf_hooks_qty').text(hooksQty);
38        $('#sf_rebar_hook_m').text(rebarHookM.toFixed(1));
39        $('#sf_cost_concrete').text(costConcrete.toFixed(0));
40        $('#sf_cost_rebar').text(costRebar.toFixed(0));
41        $('#sf_total').text(totalCost.toFixed(0));
42        
43        // Обновляем график
44        if(foundationChart) {
45            foundationChart.data.datasets[0].data = [costConcrete, costRebar];
46            foundationChart.update();
47        }
48    }
49    
50    function initFoundationChart() {
51        let ctx = document.getElementById('sf_costChart').getContext('2d');
52        foundationChart = new Chart(ctx, {
53            type: 'bar',
54            data: {
55                labels: ['Бетон', 'Арматура'],
56                datasets: [{
57                    label: 'Стоимость (руб)',
58                    data: [0, 0],
59                    backgroundColor: ['#4caf50', '#ffa726'],
60                    borderRadius: 12
61                }]
62            },
63            options: {
64                responsive: true,
65                plugins: {
66                    legend: { position: 'top' },
67                }
68            }
69        });
70        calculateFoundation();
71    }
72    
73    $('#sf_calc_btn').on('click', function(e) {
74        e.preventDefault();
75        calculateFoundation();
76        $(this).css('transform', 'scale(0.98)');
77        setTimeout(() => $(this).css('transform', ''), 150);
78    });
79    
80    if($('#sf_costChart').length) {
81        initFoundationChart();
82    }
83    
84    // FAQ анимация
85    $('.faq-q').on('click', function() {
86        $(this).next('.faq-a').slideToggle(200);
87    });
88    $('.faq-a').hide();
89});

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.