From 99c341722508b5663b811e67932976fe00f3e70e Mon Sep 17 00:00:00 2001 From: effi Date: Fri, 29 Oct 2021 13:32:07 +0300 Subject: [PATCH 1/3] init --- whatsapp/index.html | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 whatsapp/index.html diff --git a/whatsapp/index.html b/whatsapp/index.html new file mode 100644 index 0000000..f2a5399 --- /dev/null +++ b/whatsapp/index.html @@ -0,0 +1,41 @@ + + + + +
+ + + + \ No newline at end of file From 10887736e37a44d59da739983f6528957bb26ee1 Mon Sep 17 00:00:00 2001 From: effi Date: Fri, 29 Oct 2021 16:32:33 +0300 Subject: [PATCH 2/3] area code --- whatsapp/index.html | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/whatsapp/index.html b/whatsapp/index.html index f2a5399..c0691b8 100644 --- a/whatsapp/index.html +++ b/whatsapp/index.html @@ -1,13 +1,26 @@
+ - From d8509850884f1fe3131d5f965a330056a1ee3282 Mon Sep 17 00:00:00 2001 From: effi Date: Sun, 31 Oct 2021 12:07:00 +0200 Subject: [PATCH 3/3] Check if string is a number - copy & paste --- whatsapp/index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/whatsapp/index.html b/whatsapp/index.html index c0691b8..50dd4f2 100644 --- a/whatsapp/index.html +++ b/whatsapp/index.html @@ -7,10 +7,10 @@ function goToWhatsApp() { const phone = refit(document.getElementById("nPhone").value); - if (len(phone) !== 9) { - alert("Invalid number :("); - } else { + if (len(phone) === 9 && +phone !== 0) { window.location.href = 'http://api.whatsapp.com/send?phone=' + getCode() + phone + } else { + alert("Invalid Number"); } } @@ -18,16 +18,16 @@ const urlParams = new URLSearchParams(window.location.search); const code = urlParams.get('code'); if (code !== null && code !== "") { - return code + return code; } - return "972" + return "972"; } function refit(phone) { if (phone.charAt(0) === "0") { return phone.substring(1); } - return phone + return phone; } function len(phone) {