-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprofiles_card.html
196 lines (165 loc) · 5.49 KB
/
profiles_card.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Linkedin Fetch</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--<script src="https://platform.linkedin.com/badges/js/profile.js" async defer type="text/javascript"></script>-->
</head>
<style>
.card {
background-color: #393B45;
height: auto;
width: 350px;
margin: 10vh auto;
border-radius: 25px;
padding-bottom: 1px;
box-shadow: 2px 2px 5px #393B45;
display:inline-block;
margin:12px;
}
.card .name{
color: white;
text-align: center;
width: 100%;
background-color: #E6EBEE;
border-radius: 25px 25px 0 0;
color: #393B45;
padding: 30px 0;
font-weight: 800;
margin: 0;
font-size:32px;
}
.image-crop {
display: block;
position: relative;
background-color: #E6EBEE;
width: 150px;
height: 150px;
margin: 0 auto;
margin-top: 30px;
overflow: hidden;
border-radius: 50%;
box-shadow: 1px 1px 5px #4069E2;
}
.avatar {
display: inline;
height: 230px;
width: auto;
margin-left: -34px;
}
.title {
display: block;
margin: 30px auto;
width: 280px;
font-size:20px;
text-align:center;
height: auto;
}
.button {
display: block;
position: relative;
padding: 10px 32px;
width:fit-content;
margin: auto;
margin-bottom: 18px;
margin-top: -8px;
border-radius: 25px;
border: none;
font-size: 20px;
letter-spacing: 0.2px;
font-weight: 500;
background-color: #4069E2;
color: #E6EBEE;
}
.button:focus {
display: none;
}
.button:hover {
transform: scale(1.03);
cursor: pointer;
transition: all 0.2s ease-in-out;
}
.col0{
border: 1px solid #c5c5c5;
font-size: 16px;
padding: 8px 48px;
background: #1ed2a8;
margin: 6px;
}
.col1{
padding: 10px 16px;
}<style>
<body>
<!--<div class="badge-base LI-profile-badge" data-locale="en_US" data-size="medium" data-theme="light" data-type="VERTICAL" data-vanity="ravi95" data-version="v1"><a class="badge-base__link LI-simple-link" href="https://in.linkedin.com/in/ravi95?trk=profile-badge">Ravi Agarwal</a></div>-->
<div id="output" style="padding: 12px;"></div>
<div id="hideBadgeElm" style="display: none;"></div>
<script>
let lkList = ["salman", "ravi95","devsalmanshaikh"];
let linkedinid = "";
let idx = 0;
let badgeElm = document.getElementById("hideBadgeElm");
let waitObserver;
getData();
function getData() {
linkedinid = lkList[idx];
badgeElm.innerHTML = `<div class="badge-base LI-profile-badge" data-locale="en_US" data-size="medium" data-theme="light" data-type="VERTICAL" data-vanity="${linkedinid}" data-version="v1"><a class="badge-base__link LI-simple-link" href="https://in.linkedin.com/in/${linkedinid}?trk=profile-badge">.</a></div>`;
loadProfileJs();
}
function loadProfileJs() {
var script = document.createElement("script");
script.onload = function () {
waitObserver = setInterval(domObserve, 1000);
};
script.src = "https://platform.linkedin.com/badges/js/profile.js";
document.head.appendChild(script);
}
function domObserve() {
let state = badgeElm.querySelector(".LI-profile-badge .profile-badge__header");
if (state) {
clearInterval(waitObserver);
console.log(state);
let json = {
id: linkedinid,
img: "#",
name: "Not available",
title: "Not available",
info: "Not available",
};
if (badgeElm.querySelector("img.profile-badge__content-profile-image")) {
json.img = badgeElm.querySelector("img.profile-badge__content-profile-image").src;
}
if (badgeElm.querySelector(".profile-badge__content-profile-name")) {
json.name = badgeElm.querySelector(".profile-badge__content-profile-name").innerText;
}
if (badgeElm.querySelector(".profile-badge__content-profile-headline")) {
json.title = badgeElm.querySelector(".profile-badge__content-profile-headline").innerText;
}
if (badgeElm.querySelector(".profile-badge__content-profile-company-school-info")) {
json.info = badgeElm.querySelector(".profile-badge__content-profile-company-school-info").innerText;
}
console.log(json);
showData(json);
}
}
function showData(json) {
let tmp = `<div class="card">
<div class='name'>${json.name}</div>
<div class="image-crop">
<img class="avatar" src="${json.img}"></img>
</div>
<div class="title">
${json.title.split(',')[0].split('at')[0]}
</div>0
<a href="https://www.linkedin.com/in/${json.id}"><div class="button">
Linkedin Profile
</div></a>
</div>`;
output.innerHTML += tmp;
idx++;
if (idx < lkList.length) getData();
}
</script>
</body>
</html>