-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
127 lines (93 loc) · 3.67 KB
/
index.html
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html lang="pl">
<head>
<!------------- BASIC -------------->
<meta charset="UTF-8">
<title>Facebook Likes Counter</title>
<meta name="description" content="">
<meta name="author" content="Bartłomiej Walasik">
<!------------- MOBILE -------------->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!------------- FONT -------------->
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,400i,700,700i&subset=latin-ext" rel="stylesheet">
<!------------- BOOSTRAP -------------->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<!------------- JQUERY -------------->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
html {
font-family: 'Montserrat', sans-serif;
}
span[class^="fb-num-"] {
color: #FFF !important;
margin: 0 18px 0px 0px;
text-shadow: 4px 2px 5px #000f;
font-size: 2.5em;
background: url('img/02.png');
}
.fb-c {
background-color: #eceef5;
box-sizing: border-box;
padding: 15px;
border: 3px solid #ced7e9;
border-radius: 5px;
}
.fb-num {
display: flex;
align-items: flex-end;
background: url("./img/02.png") 50% 50%;
}
.fb-c-num {
color: #fff;
position: relative;
bottom: 15%;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="xs-12 sm-12 md-12 lg-12 xl-12">
<div class="fb-c">
<div class="row" style="padding:15px;">
<div class="col-xs-3">
<img src="./img/01.png" alt="">
</div>
<div class="col-xs-8 fb-num">
<span class="fb-c-num">
</span>
</div>
<div class="col-xs-1">
<img src="./img/03.png" alt="">
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Change these token to your token,
// pageId is your page(use fb id from web)
var token = 'YOUR_ACCESS_TOKEN';
var pageId = 'YOUR_PAGE_ID';
// Function will get the fb likes
$(document).ready(() => {
fbCount();
setInterval(fbCount, 3000);
});
var fbCount = () => {
$.ajax({
url: `https://graph.facebook.com/${pageId}/?fields=fan_count&access_token=${token}`,
dataType: 'json',
success: (data, status) => {
$(".fb-c-num").text(data.fan_count);
},
error: (data) => {
$('.fb-c-num').html("This page doesn't exist or your data are wrong :P");
}
});
}
</script>
</body>
</html>