formatting
This commit is contained in:
parent
86a741e542
commit
b47b1e2073
@ -68,7 +68,7 @@
|
||||
<legend>Bank details</legend>
|
||||
<label class="item">
|
||||
<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]+" />
|
||||
</label>
|
||||
<label class="item">
|
||||
|
@ -26,7 +26,7 @@ function luhnValidate(cardNumber) {
|
||||
|
||||
return (total !== 0 && (total % 10) === 0);
|
||||
}
|
||||
function ibanLatinCharId(chr){
|
||||
function ibanLatinCharId(chr) {
|
||||
c = chr.charCodeAt(0);
|
||||
if (c > 0x40 && c <= 0x5a) {
|
||||
return chr.charCodeAt(0) - 0x40 + 9;
|
||||
@ -35,7 +35,7 @@ function ibanLatinCharId(chr){
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function ibanValidate(iban){
|
||||
function ibanValidate(iban) {
|
||||
iban = iban.toUpperCase();
|
||||
countryId = iban.slice(0, 2);
|
||||
checksum = iban.slice(2, 4);
|
||||
@ -45,19 +45,19 @@ function ibanValidate(iban){
|
||||
resultingNumber = BigInt(processing, 10);
|
||||
mod = resultingNumber % 97n;
|
||||
return mod == 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function putError(s){
|
||||
function putError(s) {
|
||||
document.querySelector('#errors').textContent += s;
|
||||
}
|
||||
function clearError(){
|
||||
function clearError() {
|
||||
document.querySelector('#errors').textContent = "";
|
||||
}
|
||||
|
||||
async function saveValueIfNotEmpty(k, v){
|
||||
if (v!==""){
|
||||
return browser.storage.sync.set({k:v})
|
||||
async function saveValueIfNotEmpty(k, v) {
|
||||
if (v !== "") {
|
||||
return browser.storage.sync.set({ k: v })
|
||||
}
|
||||
return false
|
||||
}
|
||||
@ -71,7 +71,7 @@ async function saveOptions(ev) {
|
||||
return;
|
||||
}
|
||||
let bDay = this.querySelector('#birthday').value;
|
||||
if (bDay == ""){
|
||||
if (bDay == "") {
|
||||
putError("Please enter a birthday.");
|
||||
return;
|
||||
}
|
||||
@ -85,7 +85,7 @@ async function saveOptions(ev) {
|
||||
let postCode = this.querySelector('#postcode').value;
|
||||
let placeName = this.querySelector('#placename').value;
|
||||
let iban = this.querySelector('#iban').value;
|
||||
if (iban != "" && !ibanValidate(iban)){
|
||||
if (iban != "" && !ibanValidate(iban)) {
|
||||
putError("Please check your IBAN for typing errors.");
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user