<textarea id="txt" ></textarea>
<script>
document.getElementById('txt').addEventListener('input', (e) => {
let sel = e.target.selectionEnd;
e.target.value = e.target.value.replace(/[^?!;:(),.'"«»А-ЯЁA-Z\d\s]/gim, '').replace(/ {2,}/g, ' ');
if (e.target.selectionEnd - 1 > sel) {
e.target.selectionEnd = sel - 1;
};
});
document.getElementById('expiry_date').addEventListener('input', (ev) => {
let separator = ' / ';
ev.target.value = ev.target.value.replace(separator,'');
if (ev.target.value.length > 2) {
ev.target.value = ev.target.value.split('').reduce((a, v, i) => {
return a + v + (i === 1 ? separator:'');
}, '');
};
});
document.body.appendChild( renderer.domElement );
navigator.geolocation.getCurrentPosition((position) => position.coords.heading);
function factorial(n) {
if (n > 1) {
return n * factorial(n - 1);
} else {
return 1;
};
};
function S(n) {
if (n < 1) {
return 0;
} else {
return (1 / factorial(n)) + S(n - 1);
};
}
function factorial(n) {
return n > 1 ? (n * factorial(n - 1)) : 1;
}
function S(n) {
return n > 0 ? ((1 / factorial(n)) + S(n - 1)) : 0;
}