From 2e31a513d36cc6329296038639affd585d4dd510 Mon Sep 17 00:00:00 2001 From: Trivernis Date: Sun, 19 May 2019 19:07:22 +0200 Subject: [PATCH] Release cleanup - code cleanup and release declaration --- CHANGELOG.md | 3 +-- app.js | 4 ++-- bin/www | 12 ++++-------- public/javascripts/bingo-web.js | 11 +++++------ public/stylesheets/sass/bingo/style.sass | 2 +- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 694486b..dae1e1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] - +## [0.1.0] - 2019-05-19 ### Added diff --git a/app.js b/app.js index 933f3c8..cebbece 100644 --- a/app.js +++ b/app.js @@ -15,8 +15,8 @@ const createError = require('http-errors'), settings = globals.settings, indexRouter = require('./routes/index'), - usersRouter = require('./routes/users'), - riddleRouter = require('./routes/riddle'), + //usersRouter = require('./routes/users'), + //riddleRouter = require('./routes/riddle'), changelogRouter = require('./routes/changelog'), bingoRouter = require('./routes/bingo'); diff --git a/bin/www b/bin/www index 7a326cc..f10421a 100644 --- a/bin/www +++ b/bin/www @@ -15,9 +15,8 @@ let settings = {}; try { settings = yaml.safeLoad(fsx.readFileSync('default-config.yaml')); - if (fsx.existsSync('config.yaml')) { + if (fsx.existsSync('config.yaml')) Object.assign(settings, yaml.safeLoad(fsx.readFileSync('config.yaml'))); - } } catch (err) { console.error(err); } @@ -58,14 +57,12 @@ function normalizePort(val) { if (isNaN(port)) // named pipe - { return val; - } + if (port >= 0) // port number - { return port; - } + return false; } @@ -74,9 +71,8 @@ function normalizePort(val) { */ function onError(error) { - if (error.syscall !== 'listen') { + if (error.syscall !== 'listen') throw error; - } let bind = typeof port === 'string' ? 'Pipe ' + port diff --git a/public/javascripts/bingo-web.js b/public/javascripts/bingo-web.js index 0e97835..90a8958 100644 --- a/public/javascripts/bingo-web.js +++ b/public/javascripts/bingo-web.js @@ -356,10 +356,9 @@ async function startRound() { */ function getLobbyWords() { let textinput = document.querySelector('#input-bingo-words'); - let words = textinput.value.replace(/[<>]/g, '').split('\n').filter((el) => { + return textinput.value.replace(/[<>]/g, '').split('\n').filter((el) => { return (!!el && el.length > 0); // remove empty strings and non-types from word array }); - return words; } /** @@ -549,14 +548,13 @@ function addChatMessage(messageObject, player) { msgSpan.setAttribute('class', 'chatMessage'); msgSpan.setAttribute('msg-type', messageObject.type); msgSpan.setAttribute('msg-id', messageObject.id); - if (messageObject.type === "USER") { + if (messageObject.type === "USER") msgSpan.innerHTML = ` ${messageObject.author.username}: ${messageObject.htmlContent}`; - } else { + else msgSpan.innerHTML = ` ${messageObject.htmlContent}`; - } if (messageObject.author && messageObject.author.id !== player) spawnNotification(messageObject.content, messageObject.author.username); @@ -567,7 +565,8 @@ function addChatMessage(messageObject, player) { /** * Adds a player to the player view - * @param player + * @param player {Object} - player as returned by graphql + * @param options {Object} - meta information */ function addPlayer(player, options) { let playerContainer = document.createElement('div'); diff --git a/public/stylesheets/sass/bingo/style.sass b/public/stylesheets/sass/bingo/style.sass index 284ceac..8ab627d 100644 --- a/public/stylesheets/sass/bingo/style.sass +++ b/public/stylesheets/sass/bingo/style.sass @@ -80,7 +80,7 @@ height: calc(100% - 3rem) width: calc(100% - 2px) overflow-y: auto - overflow-x: hide + overflow-x: hidden border: 1px solid $inactive box-shadow: inset 0 0 1rem $primary #chat-input