formatting
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user