summaryrefslogtreecommitdiff
path: root/index.html
blob: 0d889e11589e7bb046e516a1ba4e83b22b9921ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="apple-mobile-web-app-title" content="WhatZap">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <title>Direct link to your WhatsApp contacts | WhatZap.space</title>
  <link rel="stylesheet" type="text/css" href="style.css">
  <script src="cc.js"></script>
  <script src="vue.min.js"></script>
</head>
<body>
  <div id="app">
    <h1>Direct link to your WhatsApp contacts</h1>
    <div id="input">
      <input v-model="number" pattern="\d*">
    </div>
    <div id="link">
       <a v-bind:href="href">+{{ number }}</a>
    </div>
  </div>

  <script>
    var app = new Vue({
      el: '#app',
      data: {
        number: '',
      },
      computed: {
        href: function () {
          return 'whatsapp://send?phone=+' + this.number + '&text=abc'
        }
      },
      methods: {
        getLocation: function() {
          var tag = document.createElement('script');
          tag.src = "https://ipinfo.io/?callback=locationCallback";
          document.querySelector('head').appendChild(tag);
        }
      },
      beforeMount: function() {
        this.getLocation();
      }
    });
    function locationCallback(res) {
      app.number = cc[res['country']];
    }
  </script>
</body>
</html>