Added eslit and circle.yml

This commit is contained in:
AlexKvazos
2015-04-30 14:01:19 -05:00
parent 7794cbf56d
commit 48eb590c32
18 changed files with 67 additions and 41 deletions
+2
View File
@@ -1,3 +1,5 @@
var angular = angular;
// initialize angular application
var app = angular.module('chat', []);
+1 -3
View File
@@ -7,7 +7,7 @@ module.exports = function($scope, socket, servers) {
$scope.servers = servers.get();
$scope.select = function(id) {
$scope.ip = servers.select(id).ip;
$scope.ip = servers.select(id).ip;
$scope.port = servers.select(id).port;
if ($scope.username.length > 0 && $scope.password.length > 0) {
@@ -27,8 +27,6 @@ module.exports = function($scope, socket, servers) {
password: $scope.password,
hostname: $scope.ip,
port: $scope.port || 25565
}, function(response) {
});
} else {
+1 -1
View File
@@ -36,4 +36,4 @@ module.exports = function($scope, socket) {
});
});
};
};
+5 -15
View File
@@ -1,26 +1,16 @@
module.exports = function() {
// initialize servers store if doesn't exist
localStorage.servers = localStorage.servers || "[]";
localStorage.servers = localStorage.servers || '[]';
// function to save servers into localStorage
function save() {
localStorage.servers = JSON.stringify(servers);
}
// default servers
var defaultServers = [
{name: 'LattyCraft', ip: 'us.latty.info', port: 25565}
];
// load servers from localstorage
var servers = JSON.parse(localStorage.servers);
// if no servers are saved, load the default ones
if (!servers || servers.length === 0) {
servers = defaultServers;
save();
// function to save servers into localStorage
function save() {
localStorage.servers = JSON.stringify(servers);
}
@@ -41,4 +31,4 @@ module.exports = function() {
}
};
};
};
+2
View File
@@ -4,6 +4,8 @@
module.exports = function() {
var io = io;
var socket = io(window.location.host);
return socket;
+4 -3
View File
@@ -1,9 +1,10 @@
module.exports = function() {
var connected = "connected";
var error = "error";
var createjs = createjs;
createjs.Sound.registerSound("/sounds/connected.mp3", connected);
var connected = 'connected';
createjs.Sound.registerSound('/sounds/connected.mp3', connected);
return {
connected: function() {
+1 -1
View File
@@ -41,7 +41,7 @@ module.exports = function(socket) {
// format the buffer with the correct coloring
buffer = buffer.replace(/§([0-9abcdef])([^§]*)/ig, function replace(regex, color, msg) {
return '<span class="color-'+color+'">'+msg.replace(/ /g, '&nbsp;')+'</span>';
return '<span class="color-' + color + '">' + msg.replace(/ /g, '&nbsp;') + '</span>';
});
// send line back to the client
+9 -7
View File
@@ -3,7 +3,7 @@ var parseExtra = require('../parsers/extra');
module.exports = function(jsonMsg) {
var buffer = '';
var username, msg, sender, broadcast, connected, max, current, pages, player, victim, killer, achievement;
var color = stringToCode(jsonMsg.color);
switch (jsonMsg.translate) {
@@ -11,13 +11,13 @@ module.exports = function(jsonMsg) {
case 'chat.type.text':
username = jsonMsg.with[0].text;
msg = jsonMsg.with[1];
return '§' + color + '<'+username+'> ' + msg;
return '§' + color + '<' + username + '> ' + msg;
case 'chat.type.announcement':
sender = jsonMsg.with[0];
broadcast = parseExtra(jsonMsg.with[1].extra);
return '§' + color + '['+sender+'] ' + broadcast;
return '§' + color + '[' + sender + '] ' + broadcast;
case 'commands.generic.notFound':
@@ -27,13 +27,13 @@ module.exports = function(jsonMsg) {
case 'commands.players.list':
connected = jsonMsg.with[0];
max = jsonMsg.with[1];
return '§' + color + 'There are '+connected+'/'+max+' players online:';
return '§' + color + 'There are ' + connected + '/' + max + ' players online:';
case 'commands.help.header':
current = jsonMsg.with[0];
pages = jsonMsg.with[1];
return '§' + color + '--- Showing help page '+current+' of '+pages+' (/help <page>) ---';
return '§' + color + '--- Showing help page ' + current + ' of ' + pages + ' (/help <page>) ---';
case 'commands.generic.usage':
@@ -81,7 +81,7 @@ module.exports = function(jsonMsg) {
case 'chat.type.achievement':
player = jsonMsg.with[0].text;
achievement = jsonMsg.with[1].extra[0].translate;
return '§' + color + player + ' has just earned the achievement ' + '§a['+parseAchievement(achievement)+']' ;
return '§' + color + player + ' has just earned the achievement ' + '§a[' + parseAchievement(achievement) + ']';
}
@@ -95,6 +95,8 @@ module.exports = function(jsonMsg) {
function parseAdmin(command) {
var player, gamemode;
switch (command.translate) {
case 'commands.downfall.success':
@@ -278,4 +280,4 @@ function parseCommandUsage(commandId) {
return commands[commandId] || 'Unknown command usage';
}
}
+1 -1
View File
@@ -6,4 +6,4 @@ module.exports = function(socket) {
}
});
};
};
+1 -1
View File
@@ -3,7 +3,7 @@ var events = require('../../bot');
module.exports = function(socket) {
socket.on('server:connect', function(data, response) {
socket.on('server:connect', function(data) {
if (socket.mcbot) {
socket.emit('buffer:error', 'Pleae disconnect before connecting again');
+1 -1
View File
@@ -17,4 +17,4 @@ module.exports = function(socket) {
});
};
};
+1 -1
View File
@@ -6,4 +6,4 @@ module.exports = function(socket) {
}
});
};
};
+5 -5
View File
@@ -1,8 +1,8 @@
module.exports = function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
};
+1 -1
View File
@@ -1,2 +1,2 @@
exports.escapeHtml = require('./escapeHtml');
exports.stringToCode = require('./stringToCode');
exports.stringToCode = require('./stringToCode');