Skip to content

Commit

Permalink
Showing 45 changed files with 2,394 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/leaderboard/.skybreak/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local
6 changes: 6 additions & 0 deletions examples/leaderboard/.skybreak/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Skybreak packages used by this project, one per line.
#
# 'skybreak add' and 'skybreak remove' will edit this file for you,
# but you can also edit it by hand.

jquery
56 changes: 56 additions & 0 deletions examples/leaderboard/leaderboard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
body {
font-family: 'Helvetica Neue', Helvetica, Arial, san-serif;
margin: 50px auto;
width: 420px;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}

.leaderboard {
margin: 50px 0px;
}

.player {
padding: 5px 10px;
}

.player .name {
display: inline-block;
width: 300px;
font-weight: 200;
font-size: 1.75em;
}

.player .score {
font-weight: bold;
display: inline-block;
width: 100px;
color: #777;
font-size: 2em;
text-align: right;
}

.player.selected {
background-color: yellow;
}

.player.selected .score {
color: black;
}

.details, .none {
font-weight: bold;
font-size: 2em;
border-style: dashed none none none;
border-color: #ccc;
border-width: 4px;
margin: 50px 10px;
padding: 10px 0px;
}

.none {
color: #777;
}
6 changes: 6 additions & 0 deletions examples/leaderboard/leaderboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<head>
<title>Leaderboard</title>
</head>

<body>
</body>
74 changes: 74 additions & 0 deletions examples/leaderboard/leaderboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Set up a collection to contain player information. On the server,
// it is backed by a MongoDB collection named "players."
Players = Sky.Collection("players");

/*** Client ***/

if (Sky.is_client) {
// Get the top 10 players from the server, updated continuously.
Sky.subscribe("top10");

// Start with no player selected.
Session.set("selected_player", null);

$(document).ready(function () {
// List the players by score. You can click to select a player.
var leaderboard_elt = $('<div class="leaderboard"></div>')[0];
Sky.ui.renderList(Players, leaderboard_elt, {
sort: {score: -1}, // sort from high to low score
render: function (player) {
if (Session.equals("selected_player", player._id))
var style = "player selected";
else
var style = "player";

return $('<div class="' + style + '">' +
'<div class="name">' + player.name + '</div>' +
'<div class="score">' + player.score + '</div></div>')[0];
},
events: {
"click": function () {
Session.set("selected_player", this._id);
}
}
});
$('body').append(leaderboard_elt);

// Details area, showing the currently selected player.
var details_elt = Sky.ui.render(function () {
var selected_player = Session.get("selected_player");
if (!selected_player)
return $('<div class="none">Click a player to select</div>')[0];

var player = Players.find(selected_player);
return $('<div class="details"><div class="name">' + player.name +
'</div><input type="button" value="Give 5 points"></div>')[0];
}, {
'click input': function () {
Players.update(Session.get("selected_player"), {$inc: {score: 5}});
}
});
$('body').append(details_elt);
});
}

/*** Server ***/

if (Sky.is_server) {
// Publish the top 10 players, live, to any client that wants them.
Sky.publish("top10", {collection: Players, sort: {score: -1},
limit: 10});

// On server startup, create some players if the database is empty.
Sky.startup(function () {
if (Players.find().length === 0) {
var names = ["Glinnes Hulden", "Shira Hulden", "Denzel Warhound",
"Lute Casagave", "Akadie", "Thammas, Lord Gensifer",
"Ervil Savat", "Duissane Trevanyi", "Sagmondo Bandolio",
"Rhyl Shermatz", "Yalden Wirp", "Tyran Lucho",
"Bump Candolf", "Wilmer Guff", "Carbo Gilweg"];
for (var i = 0; i < names.length; i++)
Players.insert({name: names[i], score: Math.floor(Math.random()*10)*5});
}
});
}
1 change: 1 addition & 0 deletions examples/todos/.skybreak/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local
7 changes: 7 additions & 0 deletions examples/todos/.skybreak/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Skybreak packages used by this project, one per line.
#
# 'skybreak add' and 'skybreak remove' will edit this file for you,
# but you can also edit it by hand.

jquery-layout
backbone
30 changes: 30 additions & 0 deletions examples/todos/client/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
line-height: 1;
color: black;
background: white;
}
ol, ul {
list-style: none;
}
a img {
border: none;
}

205 changes: 205 additions & 0 deletions examples/todos/client/todos.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.4em;
background: #eeeeee;
color: #333333;
}

.hidden {
display: none;
}

.ui-layout-north {
background: #dddddd;
}

#tag-filter {
margin: 8px;
}

#items-view {
margin: 10px;
}

#new-todo {
width: 466px;
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
border: 0;
outline: none;
padding: 6px;
border: 1px solid #999999;
margin-left: 75px;
}

.ui-layout-west {
padding: 10px;
border-right: solid 1px #cccccc;
}

.ui-layout-south {
border-top: solid 1px black;
padding: 10px;
background: #cccccc;
}

#help p {
margin: 8px;
}

.ui-layout-center {
overflow: auto;
}

#lists .list {
margin: 2px;
font-weight: bold;
}

#lists .list-name .empty {
font-size: 0.9em;
font-style: italic;
}

#lists .editing input {
font-family: inherit;
margin: 0;
line-height: 1.6em;
border: 0;
outline: none;
padding: 10px 7px 0px 27px;
border: 1px solid #999999;
}
#lists .selected {
background-color: lightblue;
}

/* todo items */

#item-list {
margin-top: 10px;
}

#item-list li {
margin: 12px;
font-size: 24px;
line-height: 1.1em;
border-bottom: 1px solid #cccccc;
height: 50px;
}

#item-list li:after {
content: "\0020";
display: block;
height: 0;
clear: both;
overflow: hidden;
visibility: hidden;
}

#item-list .destroy {
float: left;
width: 20px;
height: 20px;
cursor: pointer;
margin-top: 12px;
margin-left: 5px;
}

#item-list li:hover .destroy {
background: url('/destroy.png') no-repeat 0 0;
}

#item-list li .destroy:hover {
background-position: 0 -20px;
}

#item-list .display {
float: left;
margin: 9px;
}

#item-list .check {
float: left;
margin: 9px;
}

#item-list .edit {
float: left;
}

#item-list .todo-text {
float: left;
}

#item-list li.editing {
padding: 0;
}

#item-list .editing input {
width: 444px;
font-size: 24px;
font-family: inherit;
margin-left: 38px;
line-height: 1.6em;
border: 0;
outline: none;
border: 1px solid #999999;
}

#item-list .done .todo-text {
text-decoration: line-through;
color: #777777;
}

#item-list .item-tags {
float: right;
}

/* tags */

.tag {
float: left;

color: black;
background: #aaaaaa;
font-size: 16px;
font-weight: bold;

cursor: pointer;

border: 1px solid black;
border-radius: 2px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;

padding: 1px 3px 1px 3px;
margin: 4px;
}

.tag.addtag {
background: lightblue;
border: 1px dashed black;
}

.tag.edittag {
}

.tag.selected {
background: lightblue;
}

.tag .name {
float: left;
}

.tag .remove {
margin-top: 5px;
margin-left: 5px;
float: left;
width: 16px;
height: 16px;
background-image: url("/close_16.png");
}
Loading

0 comments on commit 0599d51

Please sign in to comment.