Я новичок в JavaScript может кто подсказать как уменьшить код ?
Вот код
window.onload = function() {
let a = document.getElementById('button');
let vidos = document.getElementById('mesto');
let b = document.getElementById('select').options.selectedIndex;
let text1 = document.getElementById('text1');
let text2 = document.getElementById('text2');
let text3 = document.getElementById('text3');
let text4 = document.getElementById('text4');
let text5 = document.getElementById('text5');
let textButton = document.getElementById('buttonText');
let video = function() {
vidos.classList.remove("nety");
if (b == 0) {
let textT1 = text1.getAttribute('text1');
let textT2 = text2.getAttribute('text2');
let textT3 = text3.getAttribute('text3');
let textT4 = text4.getAttribute('text4');
let textT5 = text5.getAttribute('text5');
let textButton1 = textButton.getAttribute('text');
text1.innerHTML = textT1;
text2.innerHTML = textT2;
text3.innerHTML = textT3;
text4.innerHTML = textT4;
text5.innerHTML = textT5;
textButton.innerHTML = textButton1;
};
};
a.onclick = video;
}
А вот сам HTML
<body>
<section class="video-block">
<div class="information">
<select id="select">
<option disabled selected>Выберите язык</option>
<option>Английский язык</option>
</select>
<a id="text1" text1="Video information:">Информация о видео:</a>
<a id="text2" text2="Title: All For The Sake Of Hype">Название: Всё Ради Хайпа</a>
<a id="text3" text3="№1 in YouTube trends">№1 в трендах YouTube</a>
<a id="text4" text4="Number of views: 1.5 million">Количество просмотров: 1.5млн</a>
<a id="text5" text5="Number of likes: 10 chiliad">Количество лайков: 10тыч</a>
</div>
<figure>
<video id="mesto" class="vidos nety" controls="controls" copreload="auto" autoplay="true" loop="true" muted="muted">
<source src="src/video.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
</video>
</figure>
</section>
<section class="button-block">
<div id="button" class="button">
<a id="buttonText" text="Watch video" href="#">Смотреть видео</a>
</div>
</section>
<script src="js/script.js"></script>
</body>