Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0ca9909

Browse files
committed
show coderstats link after user navigation tab is clicked
1 parent606a0fd commit0ca9909

File tree

2 files changed

+43
-20
lines changed

2 files changed

+43
-20
lines changed

‎coderstats/data/coderstats.js‎

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

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

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

18-
varsvg=link.cloneNode();
19-
svg.appendChild(link.childNodes[0].cloneNode())
24+
varli=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+
vara=document.createElement('a');
30+
a.setAttribute('href',url);
31+
a.textContent="CoderStats('"+login+"')";
32+
33+
varsvg=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+
functionnavClick(){
44+
document.removeEventListener('DOMSubtreeModified',navClick);
45+
setTimeout(function(){
46+
addLink();
47+
document.addEventListener('DOMSubtreeModified',navClick,false);
48+
},500);
49+
}

‎coderstats/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description":"Display a link to the CoderStats page for the currently displayed GitHub user when browsing github.com.",
66
"author":"CoderStats",
77
"license":"MIT",
8-
"version":"1.0.0",
8+
"version":"1.1.0",
99
"homepage":"http://coderstats.net/",
1010
"icon64":"static/logo-64x64.png"
1111
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp