summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone <26844016+simonebortolin@users.noreply.github.com>2023-01-17 18:06:18 +0100
committerGitHub <noreply@github.com>2023-01-17 18:06:18 +0100
commit31ceda14a4a747e0c4ba2f34ab63d9639975f367 (patch)
tree841e0c347412a30c7610becfee7724c38f3885b3
parentAdd page "SFP standard and ONT" with SFP with MAC vs SFP w/o MAC (#91) (diff)
downloadhack-gpon.github.io-31ceda14a4a747e0c4ba2f34ab63d9639975f367.tar
hack-gpon.github.io-31ceda14a4a747e0c4ba2f34ab63d9639975f367.tar.gz
hack-gpon.github.io-31ceda14a4a747e0c4ba2f34ab63d9639975f367.tar.bz2
hack-gpon.github.io-31ceda14a4a747e0c4ba2f34ab63d9639975f367.tar.lz
hack-gpon.github.io-31ceda14a4a747e0c4ba2f34ab63d9639975f367.tar.xz
hack-gpon.github.io-31ceda14a4a747e0c4ba2f34ab63d9639975f367.tar.zst
hack-gpon.github.io-31ceda14a4a747e0c4ba2f34ab63d9639975f367.zip
-rw-r--r--_tools/ascii-hex.md6
-rw-r--r--_tools/speed-gpon-eth.md8
2 files changed, 9 insertions, 5 deletions
diff --git a/_tools/ascii-hex.md b/_tools/ascii-hex.md
index ef0d8ef..6c550bc 100644
--- a/_tools/ascii-hex.md
+++ b/_tools/ascii-hex.md
@@ -61,8 +61,10 @@ layout: default
asciiToHexForm.addEventListener('submit',(event) => {
if (!asciiToHexForm.checkValidity()) {
event.preventDefault();
+ [...asciiToHexForm.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true));
} else {
event.preventDefault();
+ [...hexToAsciiForm.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', false));
var fomrdata = new FormData(asciiToHexForm);
var str = fomrdata.get('ascii-to-hex');
var glue = fomrdata.get('ascii-to-hex-glue');
@@ -71,22 +73,22 @@ layout: default
var hex = prefix + ([...str].map((elem, n) => prefixi+Number(str.charCodeAt(n)).toString(16)).join(glue));
document.getElementById('hex-result').value = hex;
}
- [...asciiToHexForm.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true));
});
var hexToAsciiForm = document.getElementById('hex-to-ascii');
hexToAsciiForm.addEventListener('submit',(event) => {
if (!hexToAsciiForm.checkValidity()) {
event.preventDefault();
+ [...hexToAsciiForm.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true));
} else {
event.preventDefault();
+ [...hexToAsciiForm.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', false));
var fomrdata = new FormData(hexToAsciiForm);
var str = fomrdata.get('hex-to-ascii');
var separator = fomrdata.get('hex-to-ascii-separator');
var ascii = separator === "" ? getChunks(str.substring(2),2).map(el => String.fromCharCode(parseInt(el, 16))).join('') : str.split(separator).map(el => String.fromCharCode(Number(el))).join('');
document.getElementById('ascii-result').value = ascii;
}
- [...hexToAsciiForm.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true));
});
diff --git a/_tools/speed-gpon-eth.md b/_tools/speed-gpon-eth.md
index a180c72..7033b75 100644
--- a/_tools/speed-gpon-eth.md
+++ b/_tools/speed-gpon-eth.md
@@ -130,7 +130,9 @@ layout: default
form.addEventListener('submit',(event) => {
if (!form.checkValidity()) {
event.preventDefault();
- } else {
+ [...form.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true));
+ } else {
+ [...form.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', false));
event.preventDefault();
var formdata = new FormData(form);
@@ -168,7 +170,6 @@ layout: default
document.getElementById('maxSpeed').value = (th * formdata.get('speed')).toFixed(2);
}
- [...form.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true));
});
var formgpon = document.getElementById('gpon-speed-mtu');
var radioIp = document.getElementsByName('gpon-ip');
@@ -182,8 +183,10 @@ layout: default
formgpon.addEventListener('submit',(event) => {
if (!formgpon.checkValidity()) {
event.preventDefault();
+ [...formgpon.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true));
} else {
event.preventDefault();
+ [...formgpon.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', false));
var formdata = new FormData(formgpon);
var gtc = 38880;
var overheadgem = 5;
@@ -220,6 +223,5 @@ layout: default
document.getElementById('gpon-maxSpeed').value = (th * formdata.get('gpon-speed')).toFixed(2);
}
- [...formgpon.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true));
});
</script>