@@ -63,7 +63,7 @@ const { initialMode = 'normal' } = Astro.props;
6363 </div >
6464 </div >
6565
66- <!-- Обратный режим -->
66+ <!-- Backwards Mode -->
6767 <div id =" backwardsMode" class =" calculator-mode" style ={ initialMode !== ' backwards' ? ' display: none;' : ' ' } >
6868 <div class =" input-group" >
6969 <label for =" bw" >Bandwidth:</label >
@@ -97,7 +97,7 @@ const { initialMode = 'normal' } = Astro.props;
9797 </div >
9898 </div >
9999
100- <!-- Кнопка расчета -->
100+ <!-- Calculate button -->
101101 <button id =" calculateBtn" class =" calculate-btn" >Calculate</button >
102102
103103 <!-- Блоки для вывода -->
@@ -108,7 +108,7 @@ const { initialMode = 'normal' } = Astro.props;
108108</div >
109109
110110<script is:inline >
111- // Базовые скорости передачи
111+ // Basic rates
112112const baseRates = {
113113 20: {
114114 long: [6500, 12000, 15500, 20000, 25000, 42000, 47500, 55000],
@@ -120,7 +120,7 @@ const baseRates = {
120120 }
121121};
122122
123- // Функция расчета
123+ // Calculate function
124124function computeFinal(bw, gi, mcs, fec_n, fec_k, cap) {
125125 const rates = baseRates[bw][gi];
126126 if (!rates || mcs < 0 || mcs >= rates.length) {
@@ -136,7 +136,7 @@ function computeFinal(bw, gi, mcs, fec_n, fec_k, cap) {
136136 return Math.min(final, cap);
137137}
138138
139- // Инициализация при загрузке
139+ // Initialization
140140document.addEventListener('DOMContentLoaded', () => {
141141 const normalModeBtn = document.getElementById('normalModeBtn');
142142 const backwardsModeBtn = document.getElementById('backwardsModeBtn');
@@ -146,7 +146,7 @@ document.addEventListener('DOMContentLoaded', () => {
146146 const errorElement = document.getElementById('error');
147147 const resultText = document.getElementById('resultText');
148148
149- // Переключение режимов
149+ // Made switch
150150 normalModeBtn.addEventListener('click', () => {
151151 normalMode.style.display = 'block';
152152 backwardsMode.style.display = 'none';
@@ -165,21 +165,21 @@ document.addEventListener('DOMContentLoaded', () => {
165165 normalModeBtn.setAttribute('aria-pressed', 'false');
166166 });
167167
168- // Обработка расчета
168+ // Calculation parsing
169169 calculateBtn.addEventListener('click', () => {
170170 try {
171171 errorElement.style.display = 'none';
172172
173173 if (normalMode.style.display !== 'none') {
174- // Нормальный режим
174+ // Normal mode
175175 const target = parseInt(document.getElementById('targetBitrate').value);
176176 const fec = document.getElementById('fecRatio').value;
177177 const maxMcs = parseInt(document.getElementById('maxMcs').value);
178178 const cap = parseInt(document.getElementById('cap').value);
179179 const gi = document.getElementById('guardInterval').value;
180180 const maxBw = document.getElementById('maxBandwidth').value;
181181
182- // Валидация
182+ // Validation
183183 if (isNaN(target) || isNaN(maxMcs) || isNaN(cap)) {
184184 throw new Error('Please enter valid numbers');
185185 }
@@ -196,7 +196,7 @@ document.addEventListener('DOMContentLoaded', () => {
196196 throw new Error('Invalid FEC values');
197197 }
198198
199- // Расчет
199+ // Calculation
200200 const bandwidths = maxBw === '20' ? [20] : [20, 40];
201201 const gis = gi ? [gi] : ['long', 'short'];
202202
@@ -219,14 +219,14 @@ document.addEventListener('DOMContentLoaded', () => {
219219 resultText.textContent = 'No combination found';
220220 }
221221 } else {
222- // Обратный режим
222+ // Backwards mode
223223 const bw = document.getElementById('bw').value;
224224 const mcs = parseInt(document.getElementById('mcs').value);
225225 const guard = document.getElementById('guard').value;
226226 const backwardsFec = document.getElementById('backwardsFec').value;
227227 const backwardsCap = parseInt(document.getElementById('backwardsCap').value);
228228
229- // Валидация
229+ // Validation
230230 if (isNaN(mcs) || isNaN(backwardsCap)) {
231231 throw new Error('Please enter valid numbers');
232232 }
@@ -243,7 +243,7 @@ document.addEventListener('DOMContentLoaded', () => {
243243 throw new Error('Invalid FEC values');
244244 }
245245
246- // Расчет
246+ // Calculation
247247 const rate = computeFinal(bw, guard, mcs, fec_n, fec_k, backwardsCap);
248248 resultText.textContent = `${rate} kbps`;
249249 }
0 commit comments