Skip to content

Commit

Permalink
ratings
Browse files Browse the repository at this point in the history
  • Loading branch information
comster committed Aug 2, 2012
1 parent 7e364f5 commit 5013093
Show file tree
Hide file tree
Showing 14 changed files with 817 additions and 246 deletions.
5 changes: 0 additions & 5 deletions apps/jukebox/web/backbone-house.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ var getValue = function(object, prop) {
// TODO sync with offline storage

Backbone.sync = function(method, model, options) {
console.log('backbone.sync');
//if(navigator && navigator.hasOwnProperty('onLine') && !navigator.onLine) {
// return;
//}
console.log(arguments)
var type = methodMap[method];

// Default options, unless specified.
Expand All @@ -29,7 +27,6 @@ Backbone.sync = function(method, model, options) {
var params = {type: type, dataType: 'json'};

// Ensure that we have a URL.
//console.log(options);
if (!options.url) {
params.url = getValue(model, 'url') || urlError();
}
Expand Down Expand Up @@ -61,8 +58,6 @@ Backbone.sync = function(method, model, options) {
params.xhrFields = {
withCredentials: true
}
//console.log(params)
//console.log(options)
// Make the request, allowing the user to override any Ajax options.
return $.ajax(_.extend(params, options));
};
Expand Down
28 changes: 28 additions & 0 deletions apps/jukebox/web/cache.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
CACHE MANIFEST
# ver 0.5

CACHE:
index.css
index.js
jquery.js
require.js
underscore.js
backbone.js
backbone-house.js
jukebox.js
houseAuth.js
houseChat.js
aurora.js
mp3.js
alac.js
flac.js
aac.js
moment.min.js
dancer.js
id3v2.js

NETWORK:
/
*
//jukeboxjs.com
//j.jukeboxjs.com
5 changes: 3 additions & 2 deletions apps/jukebox/web/houseAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@
var users = {};

users.AvatarView = Backbone.View.extend({
tagName: 'span',
render: function() {
var self = this;
if(this.model.has('avatar')) {
this.$el.html('<img src="/api/files/'+this.model.get('avatar')+'" />');
} else {
this.$el.html('<img src="/jukebox/assets/img/icons/chat.png" />');
this.$el.html('<img src="/jukebox/assets/img/stylistica-icons-set/png/64x64/user.png" />');
}
this.setElement(this.$el);
return this;
Expand Down Expand Up @@ -355,9 +356,9 @@
tagName: "span",
className: "profile",
htmlTemplate: '<span class="user">\
<span class="avatar"></span>\
<span class="name"><%= name %></span>\
<button class="logout" title="Log off">✌</button>\
<span class="avatar"></span>\
</span>',
template: function(doc) {
return $(_.template(this.htmlTemplate, doc));
Expand Down
18 changes: 6 additions & 12 deletions apps/jukebox/web/houseChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@
},
submit: function(el) {
var self = this;
console.log(this.$msg.val())
var m = new chat.MessageModel({}, {collection: this.collection});
m.set({msg: this.$msg.val()});
var s = m.save(null, {silent: true, wait: true})
Expand Down Expand Up @@ -403,7 +402,7 @@
tag: 'span',
className: 'msg',
render: function() {
this.$el.html(this.model.get('msg'));
this.$el.html('<span class="msg">'+this.model.get('msg')+'</span>');
this.$el.prepend('<span data-id="'+this.model.get('user').id+'" class="'+this.model.get('user').name+'">'+this.model.get('user').name+'</span> ');
//this.$el.append('<span class="at" title="'+this.model.get('at')+'">'+moment(this.model.get('at')).fromNow()+'</span>');
this.$el.attr('data-id', this.model.get('id'));
Expand Down Expand Up @@ -507,7 +506,6 @@
self.rooms[data.room_id].userCollection.add(data.user);
});
socket.on('exited', function (data) {
console.log(data);
if(data.user) {
var u = self.rooms[data.room_id].userCollection.get(data.user.id);
if(u) u.trigger('remove');
Expand All @@ -523,29 +521,25 @@
window.chatSocket = socket;

socket.on('song', function (filename) {
console.log('socket song '+filename)
//console.log('socket song '+filename)
window.mediaPlayer.loadSong(filename)
});
socket.on('loadSong', function (song) {
console.log('socket song '+song.filename)
//console.log('socket song '+song.filename)
window.mediaPlayer.preloadSong(song)
});

socket.on('songqPlay', function (songq) {
// check the currently playing song in the Queue and slide it into the played pile


console.log('socket song '+songq.song.filename)
//console.log('socket song '+songq.song.filename)
window.mediaPlayer.loadSong('/api/files/'+songq.song.filename, songq.song)

// insert chat msg that song is playing
var djUser = {name:'~',id:''};
/*var djUser = {name:'~',id:''};
if(songq.dj) {
djUser = {name:songq.dj.name, id:songq.dj.id}
}
self.rooms[songq.room_id].messageCollection.add({user:djUser,room_id:songq.room_id,at:new Date(), msg:' playing '+songq.song.ss});
self.rooms[songq.room_id].messageCollection.add({user:djUser,room_id:songq.room_id,at:new Date(), msg:' playing '+songq.song.ss});*/

// Look for it in the Queue and select it as playing
});

self.initialized = true;
Expand Down
4 changes: 2 additions & 2 deletions apps/jukebox/web/id3v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ parseFile: function(file, onComplete){

function fileSlice(file, start, length){
if(file.mozSlice) return file.mozSlice(start, start + length);
if(file.webkitSlice) return file.webkitSlice(start, start + length);
if(file.slice) return file.slice(start, start + length);
if(file.slice) return file.slice(start, length);
}

Expand Down Expand Up @@ -680,4 +680,4 @@ function guessSong(n){
Artist: artist,
Album: album
}
}
}
Loading

0 comments on commit 5013093

Please sign in to comment.