-
Notifications
You must be signed in to change notification settings - Fork 142
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
Showing
3 changed files
with
94 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,42 @@ | ||
import "dart:html"; | ||
|
||
import "package:github/browser.dart"; | ||
import "common.dart"; | ||
|
||
GitHub github; | ||
DivElement $emoji; | ||
|
||
void main() { | ||
initGitHub(); | ||
init("emoji.dart", onReady: () { | ||
$emoji = querySelector("#emojis"); | ||
loadEmojis(); | ||
}); | ||
} | ||
|
||
void loadEmojis() { | ||
var token = "5fdec2b77527eae85f188b7b2bfeeda170f26883"; | ||
var url = window.location.href; | ||
|
||
if (url.contains("?")) { | ||
var params = Uri.splitQueryString(url.substring(url.indexOf('?') + 1)); | ||
|
||
if (params.containsKey("token")) { | ||
token = params["token"]; | ||
} | ||
} | ||
|
||
github = new GitHub(auth: new Authentication.withToken(token)); | ||
|
||
github.emojis().then((info) { | ||
info.forEach((name, url) { | ||
var h = new DivElement(); | ||
h.classes.add("box"); | ||
h.classes.add("emoji-box"); | ||
h.style.textAlign = "center"; | ||
h.append(new ImageElement(src: url, width: 64, height: 64)..classes.add("emoji")); | ||
h.append(new ParagraphElement()..text = name); | ||
$emoji.append(h); | ||
}); | ||
}); | ||
} |
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,43 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>GitHub Emoji</title> | ||
|
||
<style> | ||
.line { | ||
border-top: 1px; | ||
border-style: solid; | ||
} | ||
|
||
.box { | ||
border: 2px solid; | ||
} | ||
|
||
.emoji-box { | ||
display: inline-block; | ||
margin-top: 5px; | ||
margin-left: 5px; | ||
width: 256px; | ||
} | ||
|
||
.emoji { | ||
margin-top: 5px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="header"> | ||
<h1>GitHub Emoji</h1> | ||
<button id="view-source">View the Source</button> | ||
<p></p> | ||
</div> | ||
|
||
<div id="emojis"></div> | ||
|
||
<script type="application/dart" src="emoji.dart"></script> | ||
<script src="packages/browser/dart.js"></script> | ||
</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