-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcoderstats.js
More file actions
30 lines (24 loc) · 949 Bytes
/
coderstats.js
File metadata and controls
30 lines (24 loc) · 949 Bytes
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
const meta_profile = document.querySelector('meta[property="profile:username"]');
if (login = meta_profile.getAttribute('content')) {
if (details = document.getElementsByClassName('vcard-details')) {
addLink('http://coderstats.github.io/github#' + login);
}
}
function addLink(url) {
const cslink = document.getElementById('coderstats');
if (cslink) return;
const li = document.createElement('li');
li.setAttribute('id', 'coderstats');
li.setAttribute('class', 'vcard-detail pt-1');
li.setAttribute('itemprop', 'url');
const span = document.createElement('span');
span.setAttribute('class', 'octicon');
span.setAttribute('style', 'margin-top:-2px;');
span.textContent = "📊";
li.appendChild(span)
const a = document.createElement('a');
a.setAttribute('href', url);
a.textContent = "CoderStats('" + login + "')";
li.appendChild(a);
details[0].appendChild(li);
}