Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (36 sloc) 956 Bytes
<html>
<head>
<title>Hub</title>
<script src="jschannel/src/jschannel.js"></script>
<script type='application/javascript'>
var chan = Channel.build({
window: window.parent,
origin: "*",
scope: "hub"
});
chan.bind("badge_put", function(trans, badge) {
try {
if (!localStorage.badges)
localStorage.badges = "{}";
var badges = JSON.parse(localStorage.badges);
badges[badge.badgeURL] = badge;
localStorage.badges = JSON.stringify(badges);
return true;
} catch (e) {
return false;
}
});
chan.bind("badge_get", function(trans, filter) {
if (!localStorage.badges)
return [];
filter = filter? filter : "";
var badges = JSON.parse(localStorage.badges);
return [i for each (i in badges) if (i.badgeURL.indexOf(filter) >= 0)];
});
chan.bind("badge_clear", function(trans) {
localStorage.badges = "{}";
return true;
});
</script>
</head>
</html>
Something went wrong with that request. Please try again.