Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a28676d

Browse files
committed
show coderstats link after user navigation tab is clicked
updated screenshots and added xcf files
1 parent f4f56e6 commit a28676d

8 files changed

+43
-155
lines changed

Screenshot_Coderstats_yaph.png

-10.8 KB
Loading

Screenshot_Coderstats_yaph.xcf

259 KB
Binary file not shown.

Screenshot_Github_Coderstats_yaph.png

-34.9 KB
Loading

Screenshot_Github_Coderstats_yaph.xcf

332 KB
Binary file not shown.

arrow.png

567 Bytes
Loading

coderstats/coderstats.js

+42-19
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,49 @@
1-
var path = document.location.pathname;
1+
var link = document.getElementsByClassName('octicon-link')[0],
2+
path = document.location.pathname,
3+
details,
4+
login,
5+
url;
6+
27
if (m = path.match(/^\/([\w-]+)\??.*?/)) {
3-
var login = m[1];
8+
login = m[1].trim();
49
if (-1 === ['timeline', 'languages', 'blog', 'explore'].indexOf(login)) {
5-
var url = 'http://coderstats.net/github/' + login.trim() + '/';
6-
var details = document.getElementsByClassName('vcard-details');
10+
url = 'http://coderstats.net/github/' + login + '/';
11+
details = document.getElementsByClassName('vcard-details');
712
if (details.length > 0) {
8-
var link = document.getElementsByClassName('octicon-link')[0];
13+
addLink();
14+
document.addEventListener('DOMSubtreeModified', navClick, false);
15+
}
16+
}
17+
}
918

10-
var li = document.createElement('li');
11-
li.setAttribute('class', 'vcard-detail pt-1');
12-
li.setAttribute('itemprop', 'url');
1319

14-
var a = document.createElement('a');
15-
a.setAttribute('href', url);
16-
a.textContent = "CoderStats('" + login + "')";
20+
function addLink() {
21+
let cslink = document.getElementById('coderstats');
22+
if (cslink) return;
1723

18-
var svg = link.cloneNode();
19-
svg.appendChild(link.childNodes[0].cloneNode())
24+
var li = document.createElement('li');
25+
li.setAttribute('id', 'coderstats');
26+
li.setAttribute('class', 'vcard-detail pt-1');
27+
li.setAttribute('itemprop', 'url');
2028

21-
li.appendChild(svg);
22-
li.appendChild(a);
23-
details[0].appendChild(li);
24-
}
25-
}
26-
}
29+
var a = document.createElement('a');
30+
a.setAttribute('href', url);
31+
a.textContent = "CoderStats('" + login + "')";
32+
33+
var svg = link.cloneNode();
34+
svg.appendChild(link.childNodes[0].cloneNode())
35+
36+
li.appendChild(svg);
37+
li.appendChild(a);
38+
details[0].appendChild(li);
39+
}
40+
41+
42+
// https://github.com/KyroChi/GitHub-Profile-Fluency/blob/Google-Chrome/chrome/content.js
43+
function navClick() {
44+
document.removeEventListener('DOMSubtreeModified', navClick);
45+
setTimeout(function() {
46+
addLink();
47+
document.addEventListener('DOMSubtreeModified', navClick, false);
48+
}, 500);
49+
}

coderstats/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"manifest_version": 2,
3-
"version": "1.15",
3+
"version": "1.16",
44
"name": "CoderStats link for Github Coders",
55
"description": "Display a link to the CoderStats page for the currently displayed GitHub user when browsing github.com.",
66
"icons": {

promo_small.svg

-135
This file was deleted.

0 commit comments

Comments
 (0)