summaryrefslogtreecommitdiff
path: root/public/js/lib/views
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-08-09 18:12:46 -0400
committerJules Laplace <jules@okfoc.us>2015-08-09 18:12:46 -0400
commit92c289e25642b99c498412c49a37eff1c59b4ced (patch)
tree4755e69bab46e38feb8870f8d2695e074f3525b8 /public/js/lib/views
parentd51849ad72d841d60d5d9cd2793e78577fa85bd9 (diff)
thinkin about the video
Diffstat (limited to 'public/js/lib/views')
-rw-r--r--public/js/lib/views/lobby/lobby.js2
-rw-r--r--public/js/lib/views/room/playlist.js31
-rw-r--r--public/js/lib/views/room/room.js6
-rw-r--r--public/js/lib/views/room/userlist.js7
4 files changed, 37 insertions, 9 deletions
diff --git a/public/js/lib/views/lobby/lobby.js b/public/js/lib/views/lobby/lobby.js
index 6821436..ef03e55 100644
--- a/public/js/lib/views/lobby/lobby.js
+++ b/public/js/lib/views/lobby/lobby.js
@@ -11,10 +11,8 @@ var LobbyView = View.extend({
},
join: function(e){
- console.log("hwat")
e && e.preventDefault()
var name = this.$createRoom.sanitizeName()
- console.log("name")
if (! name) { return }
window.location.href = "/v/" + name
diff --git a/public/js/lib/views/room/playlist.js b/public/js/lib/views/room/playlist.js
index 6da6ff9..6d81bf0 100644
--- a/public/js/lib/views/room/playlist.js
+++ b/public/js/lib/views/room/playlist.js
@@ -4,14 +4,43 @@ var PlaylistView = View.extend({
playlist: [],
- initialize: function(){
+ index: 0,
+ video: null,
+
+ initialize: function(opt){
+ this.video = new VideoView ()
+
+ opt.socket.on("add", function(){
+ })
+ opt.socket.on("position", function(){
+ })
+ opt.socket.on("remove", function(){
+ })
+ },
+
+ load: function(data){
+ this.playlist = data.playlist
+ },
+
+ add: function(media){
+ this.playlist.push(media)
+ },
+ remove: function(){
+ },
+
+ position: function(){
},
prev: function(){
+ this.go( mod(this.index-1, playlist.length) )
},
next: function(){
+ this.go( mod(this.index+1, playlist.length) )
},
+
go: function(n){
+ this.index = isNaN(n) ? n : this.index
+ this.video.load( playlist[this.index] )
},
}) \ No newline at end of file
diff --git a/public/js/lib/views/room/room.js b/public/js/lib/views/room/room.js
index a98bd7a..4231c2b 100644
--- a/public/js/lib/views/room/room.js
+++ b/public/js/lib/views/room/room.js
@@ -11,15 +11,15 @@ var RoomView = View.extend({
this.name = name
this.chat = new ChatView (app.socket)
this.userlist = new UserlistView (app.socket)
+ this.playlist = new PlaylistView (app.socket)
this.settings = new SettingsView (app.socket)
app.socket.emit("join", { nick: user.username })
app.socket.on("welcome", function(room){
console.log(room)
- base.chat.addMany( room.messages )
- base.userlist.users = room.users
- base.userlist.update()
+ base.chat.addMany(room.messages)
+ base.userlist.update(room.users)
base.settings.update(room.settings)
})
}
diff --git a/public/js/lib/views/room/userlist.js b/public/js/lib/views/room/userlist.js
index 43a3a1f..0157cad 100644
--- a/public/js/lib/views/room/userlist.js
+++ b/public/js/lib/views/room/userlist.js
@@ -8,17 +8,18 @@ var UserlistView = View.extend({
users: {},
initialize: function(){
var base = this
- app.socket.on("joined", function(data){
+ app.socket.on("joins", function(data){
base.users[data.nick] = true
base.update()
})
- app.socket.on("parted", function(data){
+ app.socket.on("parts", function(data){
delete base.users[data.nick]
base.update()
})
},
- update: function(){
+ update: function(users){
+ if (users) { this.users = users }
var base = this
this.$el.empty()
Object.keys(base.users).sort().forEach(function(nick){