Skip to content

Instantly share code, notes, and snippets.

View scottharvey's full-sized avatar

Scott Harvey scottharvey

View GitHub Profile
window.rooms = [];
$(".room").each(function() {
rooms.push(new Room(this.id));
});
<script type='text/javascript'>
var views = {};
</script>
if (views.rooms == undefined) { views.rooms = {}; }
views.rooms.room = function(name) {
return "<div class='room' id='room_"+(Room.count() + 1)+"'>\
<p>"+name+"</p>\
</div>";
};
if (views.rooms == undefined) { views.rooms = {}; }
views.rooms.room = function(name) {
return "<div class='room' id='room_"+(Room.count() + 1)+"'>\
<p>"+name+"</p>\
</div>";
};
views.rooms.room("Seaside room");
// "<div class='room' id='room_5'> <p>Seaside room</p> </div>"
var app = {
flash: function(message) {
$("#flash").html(message);
}
}
app.flash("You have signed in.");
$.extend(Room.prototype, {
roomText: function () {
return this.element.find("p").text();
},
next: function () {
return this.element.next();
};
});
$.extend(true, views, { rooms: {
tooltip: function(name) {
return "<div class='room' id='room_"+(Room.count() + 1)+"'>\
<p>"+name+"</p>\
</div>";
}
}});