formatting

This commit is contained in:
iw0 2023-11-13 22:06:21 +01:00
parent 86a741e542
commit b47b1e2073
2 changed files with 11 additions and 11 deletions

View File

@ -68,7 +68,7 @@
<legend>Bank details</legend> <legend>Bank details</legend>
<label class="item"> <label class="item">
<span class="fh">IBAN</span><br> <span class="fh">IBAN</span><br>
<span class="sh">Please make sure to enter any letters in upper case.</span> <span class="sh">Please make sure to enter any letters in upper case.</span><br>
<input name="iban" id="iban" pattern="[A-Z]{2}\d{2}[A-Z0-9]+" /> <input name="iban" id="iban" pattern="[A-Z]{2}\d{2}[A-Z0-9]+" />
</label> </label>
<label class="item"> <label class="item">

View File

@ -26,7 +26,7 @@ function luhnValidate(cardNumber) {
return (total !== 0 && (total % 10) === 0); return (total !== 0 && (total % 10) === 0);
} }
function ibanLatinCharId(chr){ function ibanLatinCharId(chr) {
c = chr.charCodeAt(0); c = chr.charCodeAt(0);
if (c > 0x40 && c <= 0x5a) { if (c > 0x40 && c <= 0x5a) {
return chr.charCodeAt(0) - 0x40 + 9; return chr.charCodeAt(0) - 0x40 + 9;
@ -35,7 +35,7 @@ function ibanLatinCharId(chr){
} }
return false; return false;
} }
function ibanValidate(iban){ function ibanValidate(iban) {
iban = iban.toUpperCase(); iban = iban.toUpperCase();
countryId = iban.slice(0, 2); countryId = iban.slice(0, 2);
checksum = iban.slice(2, 4); checksum = iban.slice(2, 4);
@ -45,19 +45,19 @@ function ibanValidate(iban){
resultingNumber = BigInt(processing, 10); resultingNumber = BigInt(processing, 10);
mod = resultingNumber % 97n; mod = resultingNumber % 97n;
return mod == 1; return mod == 1;
} }
function putError(s){ function putError(s) {
document.querySelector('#errors').textContent += s; document.querySelector('#errors').textContent += s;
} }
function clearError(){ function clearError() {
document.querySelector('#errors').textContent = ""; document.querySelector('#errors').textContent = "";
} }
async function saveValueIfNotEmpty(k, v){ async function saveValueIfNotEmpty(k, v) {
if (v!==""){ if (v !== "") {
return browser.storage.sync.set({k:v}) return browser.storage.sync.set({ k: v })
} }
return false return false
} }
@ -71,7 +71,7 @@ async function saveOptions(ev) {
return; return;
} }
let bDay = this.querySelector('#birthday').value; let bDay = this.querySelector('#birthday').value;
if (bDay == ""){ if (bDay == "") {
putError("Please enter a birthday."); putError("Please enter a birthday.");
return; return;
} }
@ -85,7 +85,7 @@ async function saveOptions(ev) {
let postCode = this.querySelector('#postcode').value; let postCode = this.querySelector('#postcode').value;
let placeName = this.querySelector('#placename').value; let placeName = this.querySelector('#placename').value;
let iban = this.querySelector('#iban').value; let iban = this.querySelector('#iban').value;
if (iban != "" && !ibanValidate(iban)){ if (iban != "" && !ibanValidate(iban)) {
putError("Please check your IBAN for typing errors."); putError("Please check your IBAN for typing errors.");
return; return;
} }