-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aniliyidogan
committed
Sep 24, 2016
0 parents
commit 5c3f482
Showing
8 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## Github Activity ![Github Activity](/img/icon64.png "Github Activity") | ||
![Github Activity](/img/github_activity.png "Github Activity") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
body{ | ||
padding: 10px; | ||
min-width:400px; | ||
min-height:400px; | ||
} | ||
#username{ | ||
padding-top: 5px; | ||
font-size: 30px; | ||
} | ||
.chip{ | ||
color:#fff; | ||
padding: 10px; | ||
border-radius: 30px; | ||
display: inline-block; | ||
margin-bottom: 10px; | ||
margin-right: 10px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"manifest_version": 2, | ||
|
||
"name": "Github Activity", | ||
"description": "activities of GitHub users", | ||
"version": "0.1", | ||
|
||
"browser_action": { | ||
"default_icon": "icon.png", | ||
"default_popup": "popup.html" | ||
}, | ||
"permissions": [ | ||
"https://api.github.com/users/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Github Activity</title> | ||
<link rel="stylesheet" href="css/popup.css"> | ||
<script src="popup.js"></script> | ||
</head> | ||
<body> | ||
<center> | ||
<img id="avatar"> | ||
<br> | ||
<div id="username"> | ||
</div> | ||
</center> | ||
<div id="repo"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
chrome.tabs.getSelected(null,function(tab) { | ||
|
||
var tablink = tab.url.split('/'); | ||
if (tablink[tablink.length - 1] === "") tablink.pop(); // url sonunda '/' olma durumu | ||
if (tablink[tablink.length - 2] != "github.com") return; // farklı bir sayfada istek atma durumu | ||
|
||
var xhr = new XMLHttpRequest(); | ||
xhr.open("GET", "https://api.github.com/users/" + tablink[tablink.length-1] + "/events", true); | ||
xhr.onreadystatechange = function() { | ||
if (xhr.readyState == 4) { | ||
|
||
var color = {"Watch": "#ffeb3b", "Push": "#4caf50", "PullRequest": "#03a9f4", "PullRequestReviewComment": "#0288d1", | ||
"IssueComment": "#d32f2f", "Issues": "#f44336", "Create": "#ff5722", "Fork": "#9c27b0"} | ||
|
||
data = JSON.parse(xhr.responseText) | ||
|
||
document.getElementById("username").innerText = data[0]['actor']['login'] | ||
document.getElementById("avatar").src = data[0]['actor']['avatar_url'] | ||
document.getElementById("avatar").style = "width:60px;height:60px;border-radius:5px;" | ||
|
||
div = document.getElementById("repo"); | ||
|
||
for(i = 0; i < 30; i++){ | ||
var type = data[i]['type'].split("Event")[0] | ||
|
||
div.insertAdjacentHTML('beforeend', | ||
"<div class='chip' style='background-color:" | ||
+ color[type] | ||
+ "'>" | ||
+ type | ||
+ "</div>") | ||
div.insertAdjacentHTML('beforeend', | ||
"<span style='font-size:16px'>" | ||
+ data[i]['repo']['name'] | ||
+ "</span>" | ||
+ "<br>") | ||
|
||
} | ||
} | ||
} | ||
xhr.send(); | ||
}) |