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

Commit3715c1e

Browse files
committed
Update manifest to version 3 and simplify extension code.
1 parent62f9c2c commit3715c1e

File tree

2 files changed

+12
-32
lines changed

2 files changed

+12
-32
lines changed

‎coderstats/coderstats.js‎

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,30 @@
1-
varpath=document.location.pathname,
2-
details,
3-
login,
4-
url;
5-
6-
if(m=path.match(/^\/([\w-]+)\??.*?/)){
7-
login=m[1].trim();
8-
if(-1===['timeline','languages','blog','explore'].indexOf(login)){
9-
url='http://coderstats.github.io/github#'+login;
10-
details=document.getElementsByClassName('vcard-details');
11-
if(details.length>0){
12-
addLink();
13-
document.addEventListener('DOMSubtreeModified',navClick,false);
14-
}
1+
constmeta_profile=document.querySelector('meta[property="profile:username"]');
2+
if(login=meta_profile.getAttribute('content')){
3+
if(details=document.getElementsByClassName('vcard-details')){
4+
addLink('http://coderstats.github.io/github#'+login);
155
}
166
}
177

188

19-
functionaddLink(){
20-
letcslink=document.getElementById('coderstats');
9+
functionaddLink(url){
10+
constcslink=document.getElementById('coderstats');
2111
if(cslink)return;
2212

23-
varli=document.createElement('li');
13+
constli=document.createElement('li');
2414
li.setAttribute('id','coderstats');
2515
li.setAttribute('class','vcard-detail pt-1');
2616
li.setAttribute('itemprop','url');
2717

28-
letspan=document.createElement('span');
18+
constspan=document.createElement('span');
2919
span.setAttribute('class','octicon');
3020
span.setAttribute('style','margin-top:-2px;');
3121
span.textContent="📊";
3222
li.appendChild(span)
3323

34-
leta=document.createElement('a');
24+
consta=document.createElement('a');
3525
a.setAttribute('href',url);
3626
a.textContent="CoderStats('"+login+"')";
3727

3828
li.appendChild(a);
3929
details[0].appendChild(li);
4030
}
41-
42-
43-
// https://github.com/KyroChi/GitHub-Profile-Fluency/blob/Google-Chrome/chrome/content.js
44-
functionnavClick(){
45-
document.removeEventListener('DOMSubtreeModified',navClick);
46-
setTimeout(function(){
47-
addLink();
48-
document.addEventListener('DOMSubtreeModified',navClick,false);
49-
},500);
50-
}

‎coderstats/manifest.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"manifest_version":2,
3-
"version":"2.0.0",
2+
"manifest_version":3,
3+
"version":"3.0.0",
44
"homepage_url":"http://coderstats.github.io/",
5-
"name":"CoderStats link for Github Coders",
5+
"name":"DEVCoderStats link for Github Coders",
66
"description":"Display a link to the CoderStats page for the currently displayed GitHub user when browsing github.com.",
77
"icons": {
88
"48":"logo-48x48.png",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp