]> git.example.dev Git - binbsis50.git/commitdiff
beautified some files
authorLuigi Pinca <luigipinca@gmail.com>
Sat, 18 Feb 2012 19:41:48 +0000 (20:41 +0100)
committerLuigi Pinca <luigipinca@gmail.com>
Sat, 18 Feb 2012 19:41:48 +0000 (20:41 +0100)
config.js
index.html
package.json
public/static/css/style.css
public/static/js/client.js
server.js

index e288666e5226c2643b4b20130cee32f79b655f0d..a7e3c671bfeb3221d045c104f37c002ce4b1d05c 100644 (file)
--- a/config.js
+++ b/config.js
@@ -4,5 +4,5 @@ exports.configure = function() {
        this.port = 80;
        this.redisurl = '';
        this.songsinarun = 15;
-    return this;
+       return this;
 };
index 4d3c1499a7379451b89500194563f09f93dc9f69..79497cb90d09d2f2c148dae6ab270c8c7759b0ad 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html>
-    <head>
-        <title>Binb</title>
+       <head>
+           <title>Binb</title>
                <link href="/static/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
                <link href="/static/css/style.css" rel="stylesheet" type="text/css"/>
                <script src="/static/js/jquery.min.js" type="text/javascript"></script>
@@ -10,8 +10,8 @@
                <script src="/socket.io/socket.io.js" type="text/javascript"></script>
                <script src="/static/js/client.js" type="text/javascript"></script>
                <script type="text/javascript">$(function() {App.init();});</script>
-    </head>
-    <body>
+       </head>
+       <body>
                <script type="text/javascript">
                        var uvOptions = {};
                        (function() {
                                </div>
                        </footer>
                </div>
-    </body>
+       </body>
 </html>
index 6576cb202c1c3b98d01480bc1b44a08fedade705..1a8b145e0dd5211e1e74e22123e38f4cb9165560 100644 (file)
@@ -12,5 +12,5 @@
   "engine": {
     "node": "0.6.x"
   },
-  "version": "0.1.1-1"
+  "version": "0.1.1-4"
 }
\ No newline at end of file
index cdb1979038e6477dcd50894c488423d3dc64497b..1e05cadc040884c4274a6870a419a89d5703f990 100644 (file)
@@ -78,7 +78,7 @@ input {
        background-color: black;
        -webkit-border-radius: 70px;
        -moz-border-radius: 70px;
-    border-radius: 70px;
+       border-radius: 70px;
        z-index:-1;
 }
 #tape-left {
@@ -192,10 +192,10 @@ input {
        border: 1px solid #ccc;
        -webkit-border-radius: 6px;
        -moz-border-radius: 6px;
-    border-radius: 6px;
+       border-radius: 6px;
        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.075);
-    -moz-box-shadow: 0 1px 2px rgba(0,0,0,.075);
-    box-shadow: 0 1px 2px rgba(0,0,0,.075);
+       -moz-box-shadow: 0 1px 2px rgba(0,0,0,.075);
+       box-shadow: 0 1px 2px rgba(0,0,0,.075);
 }
 #chat .join, #chat .left {
        font-style: italic;
index cca77ccee96b2497d8e817559773ca66237bb1dd..6d4293bd6e5424d189a54a2050e661696d5410b5 100644 (file)
@@ -1,7 +1,7 @@
 var App = {
 
-    nickname: null,
-    socket: null,
+       nickname: null,
+       socket: null,
        pvtmgsto: null,
        roundpoints: 0,
        stopanimation: false,
@@ -9,16 +9,16 @@ var App = {
                        'Game is about to start...', 'Game is over', 'New game will start soon...'],
        tmstrings: ['Yes, you guessed the title. Who is the artist?', 'Now tell me the artist!',
                                        'Correct, do you also know the artist?'],
-    amstrings: ['Yes, that\'s the artist. What about the title?', 'Exactly, now tell me the title!',
+       amstrings: ['Yes, that\'s the artist. What about the title?', 'Exactly, now tell me the title!',
                                        'Do you also know the title?'],
-    bmstrings: ['Yeah true! do you like this track?', 'Good job!', 'Great!',
+       bmstrings: ['Yeah true! do you like this track?', 'Good job!', 'Great!',
                                        'Very well done!', 'Exactly!', 'Excellent!'],
        nmstrings: ['Nope, sorry!', 'No way!', 'Fail', 'Nope', 'No', 'That\'s wrong', 'What?!',
                                'Wrong', 'Haha, what?!', 'You kidding?', 'Don\'t make me laugh', 'You mad?'],
        
        // Prompt for name and send it.
-    setNickName: function(msg) {
-        if (!msg) {
+       setNickName: function(msg) {
+           if (!msg) {
                        msg = "What's your name?";
 
                        var html = '<div class="modal-header"><h3>Welcome to Binb</h3></div>';
@@ -56,12 +56,12 @@ var App = {
                        $('.modal-body p').html(msg);
                        $('#login').focus();
                }
-    },
+       },
 
        // Your submitted name was invalid
-    invalidNickName: function(data) {
-        App.setNickName(data.feedback+"<br/>Try again:");
-    },
+       invalidNickName: function(data) {
+           App.setNickName(data.feedback+"<br/>Try again:");
+       },
        
        // You joined the game
        ready: function(data) {
@@ -73,7 +73,7 @@ var App = {
                App.addChatEntry(joinspan);
                App.updateUsers(data);
 
-        var messagebox = $("#message");
+           var messagebox = $("#message");
                messagebox.keyup(function(event) {
                        if (event.keyCode === 13) {
                                var val = $.trim(messagebox.val());
@@ -164,9 +164,9 @@ var App = {
        },
 
        // Update the list of users
-    updateUsers: function(data) {
-        var elem = $("#users");
-        elem.empty();
+       updateUsers: function(data) {
+           var elem = $("#users");
+           elem.empty();
                var users = [];
                for (var key in data.users) {
                        users.push(data.users[key]);
@@ -174,16 +174,16 @@ var App = {
                users.sort(function(a, b) {return b.points - a.points;});
                // Flag to test if our private recipient is in the list of active users
                var found = false;
-        for (var i=0; i<users.length; i++) {
-            var user = users[i];
-            var li = $('<li></li>');
+           for (var i=0; i<users.length; i++) {
+                  var user = users[i];
+                  var li = $('<li></li>');
                        var pvt = $('<span class="private label label-info">P</span>');
                        var username = $('<span class="name"></span>').text(user.nickname);
                        var points = $('<span class="points">('+user.points+')</span>');
                        var roundrank = $('<span></span>');
                        var roundpoints = $('<span class="round-points"></span>');
                        li.append(pvt, username, points, roundrank, roundpoints);
-            elem.append(li);
+                  elem.append(li);
                        if (App.pvtmsgto === user.nickname) {
                                pvt.show();
                                username.click(App.clearPrivate);
@@ -213,7 +213,7 @@ var App = {
                                        username.addClass("correct");
                                }
                        }
-        }
+           }
                if (!found && App.pvtmsgto) {
                        var recipient = $('#recipient');
                        var width = recipient.outerWidth(true) + 1;
@@ -223,7 +223,7 @@ var App = {
                        App.pvtmsgto = null;
                        $("#message").focus();
                }
-    },
+       },
        
        addPrivate: function(nickname) {
                if (App.pvtmsgto) {
@@ -234,32 +234,32 @@ var App = {
                }
                var recipient = $("#recipient");
                recipient.css('margin-right','4px');
-        recipient.text("To "+nickname+":");
+           recipient.text("To "+nickname+":");
                var width = recipient.outerWidth(true) + 1;
                recipient.hide();
                $('#message').animate({'width':'-='+width+'px'}, "fast", function() {recipient.show();});
-        var el = $("span.name:contains("+nickname+")");
+           var el = $("span.name:contains("+nickname+")");
                el.prev().show();
                el.unbind('click');
                el.click(App.clearPrivate);
-        App.pvtmsgto = nickname;
-        $("#message").focus();
+           App.pvtmsgto = nickname;
+           $("#message").focus();
        },
 
        clearPrivate: function() {
                var recipient = $("#recipient");
                var width = recipient.outerWidth(true) + 1;
                recipient.css('margin-right','0');
-        recipient.text("");
+           recipient.text("");
                $('#message').animate({'width':'+='+width+'px'}, "fast");
                var el = $("span.name:contains("+App.pvtmsgto+")");
                el.prev().hide();
                el.unbind("click");
-        el.click(function() {
+           el.click(function() {
                        App.addPrivate($(this).text());
                });
                App.pvtmsgto = null;
-        $("#message").focus();
+           $("#message").focus();
        },
 
        // Receive a chat message
@@ -271,9 +271,9 @@ var App = {
                        prefix = (App.nickname === data.from) ? '(To '+data.to+')' : '(From '+prefix+')';
                        msgspan.addClass("private");
                }
-        var msg = prefix+": "+data.chatmsg;
-        msgspan.text(msg);
-        App.addChatEntry(msgspan);
+           var msg = prefix+": "+data.chatmsg;
+           msgspan.text(msg);
+           App.addChatEntry(msgspan);
        },
 
        loadTrack: function(data) {
@@ -407,28 +407,28 @@ var App = {
                App.countDown(Date.now()+10000);
        },
 
-    // Let the user know when he / she has disconnected
-    disconnect: function() {
+       // Let the user know when he / she has disconnected
+       disconnect: function() {
                App.stopanimation = true;
                $('#player').jPlayer("stop");
                var errormsg = "ERROR: You have disconnected.";
-        var errorspan = $("<span class='error'></span>");
+           var errorspan = $("<span class='error'></span>");
                errorspan.text(errormsg);
-        App.addChatEntry(errorspan);
+           App.addChatEntry(errorspan);
                App.addFeedback('Something wrong happened');
-        var users = $("#users");
-        users.empty();
-    },
+           var users = $("#users");
+           users.empty();
+       },
 
-    // Add a chat entry, whether message, notification, etc.
-    addChatEntry: function(childNode) {
-        var li = $("<li class='entry'></li>");
-        li.append(childNode);
-        var chat = $("#chat");
-        chat.append(li);
-        var chatRaw = document.getElementById("chat");
-        chatRaw.scrollTop = chatRaw.scrollHeight;
-    },
+       // Add a chat entry, whether message, notification, etc.
+       addChatEntry: function(childNode) {
+           var li = $("<li class='entry'></li>");
+           li.append(childNode);
+           var chat = $("#chat");
+           chat.append(li);
+           var chatRaw = document.getElementById("chat");
+           chatRaw.scrollTop = chatRaw.scrollHeight;
+       },
 
        addFeedback: function(txt, style) {
                if (typeof style === 'string') {
@@ -440,8 +440,8 @@ var App = {
                $('#feedback').text(txt);
        },
 
-    // Set up the App object.
-    init: function() {
+       // Set up the App object.
+       init: function() {
                $('#modal').modal({keyboard:false,show:false,backdrop:"static"});
                if ($.browser.mozilla) {
                        // Block ESC button in firefox (it breaks all socket connection).
@@ -451,7 +451,7 @@ var App = {
                                }
                        });
                }
-        App.socket = io.connect("http://binb.nodejitsu.com/", {'reconnect':false});
+           App.socket = io.connect("http://binb.nodejitsu.com/", {'reconnect':false});
                App.socket.on("connect", function() {
                        $("#player").jPlayer({
                                ready: function() {
@@ -465,6 +465,6 @@ var App = {
                });
                App.socket.on('invalidnickname', App.invalidNickName);
                App.socket.on('ready', App.ready);
-        App.socket.on("disconnect", App.disconnect);
-    }
+           App.socket.on("disconnect", App.disconnect);
+       }
 };
index 28fc02585805223c09a1d101b41b6d197d0775cc..b355da1f5a25b9a3e716700787e924d754d550bf 100644 (file)
--- a/server.js
+++ b/server.js
@@ -9,7 +9,7 @@ http.set("view options", { layout: false });
 
 // Routes
 http.get("/", function(req, res) {
-    res.sendfile("index.html");
+       res.sendfile("index.html");
 });
 
 // Starting HTTP server
@@ -25,10 +25,10 @@ redis.on('error', function(err) {
 // Setting up Socket.IO
 var io = require("socket.io").listen(http);
 
-io.enable('browser client minification');  // send minified client
-io.enable('browser client etag');          // apply etag caching logic based on version number
-io.enable('browser client gzip');          // gzip the file
-io.set('log level', 1);                    // reduce logging
+io.enable('browser client minification');      // send minified client
+io.enable('browser client etag');                      // apply etag caching logic based on version number
+io.enable('browser client gzip');                      // gzip the file
+io.set('log level', 1);                                        // reduce logging
 // enable transports
 io.set('transports', ['websocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']);
 
@@ -36,11 +36,11 @@ var Game = {
 
        sockets : Object.create(null),
        usersData : Object.create(null),
-       playedtracks: [],       // Used to prevent the same song from playing twice in one game
+       playedtracks: [], // Used to prevent the same song from playing twice in one game
        
        artistName: null,
        trackName: null,        
-    collectionName: null,
+       collectionName: null,
        previewUrl: null,
        artworkUrl: null,
        trackViewUrl: null,
@@ -81,35 +81,35 @@ var Game = {
 
        // A user is submitting a name
        setNickName: function(socket, data) {
-        var feedback = null;
-        if (Game.userExists(data.nickname)) {
-            feedback = '<span class="label label-important">That name is alredy taken.</span>';
+           var feedback = null;
+           if (Game.userExists(data.nickname)) {
+                  feedback = '<span class="label label-important">That name is alredy taken.</span>';
                }
-        if (feedback) {
-            return Game.invalidNickName(socket, feedback);
+           if (feedback) {
+                  return Game.invalidNickName(socket, feedback);
                }
 
-        socket.nickname = data.nickname;
+           socket.nickname = data.nickname;
                
                // Add user to the list of active users and broadcast the event
                Game.addUser(socket);
                socket.emit('ready', {users:Game.usersData,trackscount:Game.trackscount});
                socket.broadcast.emit('newuser', {nickname:socket.nickname,users:Game.usersData});
-    },
+       },
 
        // A user requested an invalid name
-    invalidNickName: function(socket, feedback) {
+       invalidNickName: function(socket, feedback) {
                socket.emit('invalidnickname', {feedback:feedback});
-    },
+       },
 
        // A user has left (DCed, etc.)
-    userLeft: function(socket) {
+       userLeft: function(socket) {
                if (socket.nickname !== undefined) {
                        var leftname = socket.nickname;
                        Game.removeUser(socket);
                        io.sockets.emit('userleft', {nickname:leftname,users:Game.usersData});
                }
-    },
+       },
        
        sendChatMessage: function (socket, data) {
                if (data.to) {
@@ -378,7 +378,7 @@ io.sockets.on("connection", function(socket) {
        socket.on('guess', function(data) {
                Game.guess(socket, data);
        });
-    socket.on("disconnect", function() {
-        Game.userLeft(socket);
-    });
+       socket.on("disconnect", function() {
+           Game.userLeft(socket);
+       });
 });