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
+19
View File
@@ -0,0 +1,19 @@
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"rules": {
"quotes": [2, "single"],
"strict": [2, "never"],
"no-multi-spaces": false,
"no-alert": false,
"key-spacing": false,
"curly": false,
"no-octal-escape": false
},
"globals": {
"$": true
}
}
+5
View File
@@ -50,6 +50,10 @@ module.exports = function(grunt) {
watch: ['app/server']
}
}
},
eslint: {
src: ["app"]
}
});
@@ -58,6 +62,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-eslint');
grunt.registerTask('build', ['browserify:pro', 'uglify']);
grunt.registerTask('debug', ['browserify:dev']);
+2
View File
@@ -1,3 +1,5 @@
var angular = angular;
// initialize angular application
var app = angular.module('chat', []);
@@ -27,8 +27,6 @@ module.exports = function($scope, socket, servers) {
password: $scope.password,
hostname: $scope.ip,
port: $scope.port || 25565
}, function(response) {
});
} else {
+4 -14
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);
}
+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
+8 -6
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':
+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');
+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;');
};
+6
View File
@@ -0,0 +1,6 @@
machine:
node:
version: 0.10.32
dependencies:
pre:
- npm install grunt-cli -g
+2 -1
View File
@@ -9,6 +9,7 @@
"express": "^4.12.3",
"grunt": "^0.4.5",
"grunt-browserify": "^3.7.0",
"grunt-contrib-eslint": "0.0.5",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-nodemon": "^0.4.0",
@@ -18,7 +19,7 @@
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "grunt eslint",
"start": "node app/server"
},
"repository": {