function encode (text, openAlph, secureAlph) {
let result = '', len1 = openAlph.length, len2 = secureAlph.length, alph = {}, textLen = text.length;
if (len1 != len2) throw new Error('Invalid input data');
for (let i=0; i < len1; i++) {
alph[openAlph[i]] = secureAlph[i];
}
for (let i=0; i < textLen; i++) {
if (!alph[text[i]]) throw new Error(`Symbol "${text[i]}" not found in openAlph.`);
result += alph[text[i]];
}
return result;
}
console.log(encode(
"message",
"abcdefghijklmnopqrstuvwxyz",
"rsyxuqldnmzvpofceiwktjgabh"
));
document.getElementById('video').style.css = 'height:90%;width:100%;';
document.getElementById('video').style.cssText = 'height:90%;width:100%;';
let videoElem = document.getElementById('video');
videoElem.style.height = '90%';
videoElem.style.width = '100%';
document.getElementById('video').classList.add('fullscreen');
<style>
.fullscreen {
height: 90%;
width: 100%;
}
</style>
<head>
)<script>
document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script');
script.src = '/path/to/script';
document.head.appendChild(script);
});
</script>
<head>
<!-- ... -->
<!-- Скрипт, который надо загрузить после загрузки страницы -->
<script data-src="/path/to/script"></script>
<!-- ... -->
<script>
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('script[data-src]').forEach(elem => {
elem.src = elem.dataset.src;
});
});
</script>
<!-- ... -->
</head>
history.pushState(null, '', '../detskaya-krovat');
history.replaceState(null, '', '../detskaya-krovat');
send.addEventListener('click' , function () {
var saving = Number(document.getElementById('saving').innerText);
var saving2 = Number(document.getElementById('saving2').innerText);
document.getElementById('sendOTVET').innerHTML = saving2 - saving;
});
clicker.addEventListener('mousedown' , a);
document.getElementById("clicker").addEventListener('mousedown' , a);