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