Sfoglia il codice sorgente

Merge branch 'february_release' of https://github.com/Musare/Musare into february_release

Akira Laine 9 anni fa
parent
commit
251b8e79e2

+ 2 - 2
app/client/scripts/helpers.js

@@ -313,7 +313,7 @@ Template.room.helpers({
         if (Meteor.userId()) {
             var currentSong = Session.get("currentSong");
             if (currentSong && Meteor.user().profile.liked.indexOf(currentSong.mid) !== -1) {
-                return "active";
+                return "liked";
             } else {
                 return "";
             }
@@ -325,7 +325,7 @@ Template.room.helpers({
         if (Meteor.userId()) {
             var currentSong = Session.get("currentSong");
             if (currentSong && Meteor.user().profile.disliked.indexOf(currentSong.mid) !== -1) {
-                return "active";
+                return "disliked";
             } else {
                 return "";
             }

+ 15 - 3
app/client/scripts/onCreated.js

@@ -167,9 +167,9 @@ Template.room.onCreated(function () {
 
     var currentSong = undefined;
     var currentSongR = undefined;
-    var type = Session.get("type");
 
     function getTimeElapsed() {
+        var type = Session.get("type");
         if (currentSong !== undefined) {
             var room = Rooms.findOne({type: type});
             if (room !== undefined) {
@@ -188,12 +188,24 @@ Template.room.onCreated(function () {
         var d = moment.duration(parseInt(songData.duration), 'seconds');
         $("#time-total").text(d.minutes() + ":" + ("0" + d.seconds()).slice(-2));
         Session.set("timeFormat", d.minutes() + ":" + ("0" + d.seconds()).slice(-2));
-        document.title = Session.get("title") + " - " + Session.get("artist") + " - Musare"
+        document.title = Session.get("title") + " - " + Session.get("artist") + " - ";
+        var title = Session.get("title") + " - " + Session.get("artist") + " - ";
+        if (Session.get("titleScroller") !== undefined) {
+            Meteor.clearInterval(Session.get("titleScroller"));
+        }
+        Session.set("titleScroller", Meteor.setInterval(function() {
+             title = title.split("");
+             var last = title.shift();
+             title.push(last);
+             title = title.join("");
+             document.title = title;
+        }, 500));
     }
 
+
     function resizeSeekerbar() {
         if (Session.get("state") === "playing") {
-            $("#seeker-bar").width(((getTimeElapsed() / 1000) / Session.get("duration") * 100) + "%");
+            $(".seeker-bar").width(((getTimeElapsed() / 1000) / Session.get("duration") * 100) + "%");
         }
     }
 

+ 4 - 4
app/client/stylesheets/app.css

@@ -190,12 +190,12 @@ textarea{
   cursor: pointer;
 }
 
-#thumbs_up:hover {
-  color: #00bfa5;
+#thumbs_up:hover, .liked {
+  color: #00bfa5 !important;
 }
 
-#thumbs_down:hover {
-  color: #e53935;
+#thumbs_down:hover, .disliked {
+  color: #e53935 !important;
 }
 
 .feedback-message{

+ 2 - 2
app/client/templates/room.html

@@ -80,8 +80,8 @@
                                     </form>
                                     <div class="right col s4 m2 l2">
                                         <ul>
-                                            <li class="left"><i id="thumbs_up" class="material-icons">thumb_up</i></li>
-                                            <li class="right"><i id="thumbs_down" class="material-icons">thumb_down</i>
+                                            <li id="like" class="left"><i id="thumbs_up" class="material-icons {{liked}}">thumb_up</i></li>
+                                            <li id="dislike" class="right"><i id="thumbs_down" class="material-icons {{disliked}}">thumb_down</i>
                                             </li>
                                         </ul>
                                     </div>

+ 6 - 6
app/server/server.js

@@ -806,15 +806,15 @@ Meteor.methods({
             var user = Meteor.user();
             if (user.profile.liked.indexOf(mid) === -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$push: {"profile.liked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.likes": 1}})
+                Songs.update({mid: mid}, {$inc: {"likes": 1}})
             } else {
                 Meteor.users.update({"profile.username": user.profile.username}, {$pull: {"profile.liked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.likes": -1}})
+                Songs.update({mid: mid}, {$inc: {likes: -1}})
             }
 
             if (user.profile.disliked.indexOf(mid) !== -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$pull: {"profile.disliked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.dislikes": -1}})
+                Songs.update({mid: mid}, {$inc: {dislikes: -1}})
             }
             return true;
         } else {
@@ -826,15 +826,15 @@ Meteor.methods({
             var user = Meteor.user();
             if (user.profile.disliked.indexOf(mid) === -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$push: {"profile.disliked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.dislikes": 1}});
+                Songs.update({mid: mid}, {$inc: {dislikes: 1}});
             } else {
                 Meteor.users.update({"profile.username": user.profile.username}, {$pull: {"profile.disliked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.dislikes": -1}});
+                Songs.update({mid: mid}, {$inc: {dislikes: -1}});
             }
 
             if (user.profile.liked.indexOf(mid) !== -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$pull: {"profile.liked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.likes": -1}});
+                Songs.update({mid: mid}, {$inc: {likes: -1}});
             }
             return true;
         } else {