Skip to content

Commit 5ed40e0

Browse files
committed
Updating Demos
1 parent 236ee02 commit 5ed40e0

File tree

161 files changed

+7444
-7469
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+7444
-7469
lines changed

demos/emoji.dart

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ import "common.dart";
55

66
GitHub github;
77
DivElement $emoji;
8+
Map<String, String> emojis;
89

910
void main() {
1011
initGitHub();
1112
init("emoji.dart", onReady: () {
1213
$emoji = querySelector("#emojis");
1314
loadEmojis();
15+
var searchBox = querySelector("#search-box");
16+
searchBox.onKeyUp.listen((event) {
17+
filter(searchBox.value);
18+
});
1419
});
1520
}
1621

@@ -26,14 +31,36 @@ void loadEmojis() {
2631
github = new GitHub(auth: new Authentication.withToken(token));
2732

2833
github.emojis().then((info) {
34+
emojis = info;
2935
info.forEach((name, url) {
3036
var h = new DivElement();
3137
h.classes.add("box");
38+
h.classes.add("item");
3239
h.classes.add("emoji-box");
3340
h.style.textAlign = "center";
3441
h.append(new ImageElement(src: url, width: 64, height: 64)..classes.add("emoji"));
35-
h.append(new ParagraphElement()..text = name);
42+
h.append(new ParagraphElement()..text = ":${name}:");
3643
$emoji.append(h);
3744
});
3845
});
3946
}
47+
48+
String lastQuery;
49+
50+
void filter(String query) {
51+
if (lastQuery != null && lastQuery == query) {
52+
return;
53+
}
54+
lastQuery = query;
55+
var boxes = $emoji.children;
56+
for (var box in boxes) {
57+
var boxName = box.querySelector("p");
58+
var t = boxName.text;
59+
var name = t.substring(1, t.length - 1);
60+
if (name.contains(query)) {
61+
box.style.display = "inline";
62+
} else {
63+
box.style.display = "none";
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy