Skip to content

Commit

Permalink
v1.0.6 - Fix code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
igorantun committed Aug 16, 2015
1 parent 6dcf8f7 commit ded3279
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Node.JS Chat
============
[![GitHub Stars](https://img.shields.io/github/stars/IgorAntun/node-chat.svg)](https://github.com/IgorAntun/node-chat/stargazers) [![GitHub Issues](https://img.shields.io/github/issues/IgorAntun/node-chat.svg)](https://github.com/IgorAntun/node-chat/issues) [![Current Version](https://img.shields.io/badge/version-1.0.4-green.svg)](https://github.com/IgorAntun/node-chat) [![Live Demo](https://img.shields.io/badge/demo-online-green.svg)](https://igorantun.com/chat) " [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/IgorAntun/node-chat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![GitHub Stars](https://img.shields.io/github/stars/IgorAntun/node-chat.svg)](https://github.com/IgorAntun/node-chat/stargazers) [![GitHub Issues](https://img.shields.io/github/issues/IgorAntun/node-chat.svg)](https://github.com/IgorAntun/node-chat/issues) [![Current Version](https://img.shields.io/badge/version-1.0.6-green.svg)](https://github.com/IgorAntun/node-chat) [![Live Demo](https://img.shields.io/badge/demo-online-green.svg)](https://igorantun.com/chat) " [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/IgorAntun/node-chat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

This is a node.js chat application powered by SockJS and Express that provides the main functions you'd expect from a chat, such as emojis, private messages, an admin system, etc.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-chat",
"version": "1.0.4",
"version": "1.0.6",
"private": true,
"scripts": {
"start": "node app.js"
Expand Down
24 changes: 14 additions & 10 deletions public/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ var settings = {
'name': null,
'emoji': true,
'greentext': true,
'inline': true,
'sound': true,
'desktop': false,
'synthesis': false,
'recognition': false,
'inline': false
'recognition': false
};


Expand Down Expand Up @@ -301,16 +301,17 @@ function showChat(type, user, message, subtxt, mid) {
updateStyle();
nmr++;

//Inline imgs
if(settings.inline){
if(settings.inline) {
var m = message.match(/(https?|ftp):\/\/[^\s/$.?#].[^\s]*/gmi);

if(m) {
m.forEach(function(e, i, a){
//Gfycat support
if(e.indexOf('//gfycat') != -1){
m.forEach(function(e, i, a) {
// Gfycat Support
if(e.indexOf('//gfycat') !== -1) {
var oldUrl = e;
e = e.replace('//gfycat.com', '//gfycat.com/cajax/get').replace('http://', 'https://');
$.getJSON(e, function(data){

$.getJSON(e, function(data) {
testImage(data.gfyItem.gifUrl.replace('http://', 'https://'), mid, oldUrl);
});
} else {
Expand All @@ -323,10 +324,12 @@ function showChat(type, user, message, subtxt, mid) {

function testImage(url, mid, oldUrl) {
var img = new Image();

img.onload = function() {
$('div[data-mid=' + mid + '] .msg a[href="' + oldUrl.replace('https://', 'http://') + '"]').html(img);
$('#panel').animate({scrollTop: $('#panel').prop('scrollHeight')}, 500);
};

img.src = url;
}

Expand Down Expand Up @@ -693,14 +696,15 @@ if(typeof(Storage) !== 'undefined') {
settings = JSON.parse(localStorage.settings);
document.getElementById('emoji').checked = settings.emoji;
document.getElementById('greentext').checked = settings.greentext;
document.getElementById('inline').checked = settings.inline;
document.getElementById('sound').checked = settings.sound;
document.getElementById('desktop').checked = settings.desktop;
document.getElementById('synthesis').checked = settings.synthesis;
document.getElementById('recognition').checked = settings.recognition;
document.getElementById('inline').checked = settings.inline;

if(settings.recognition)
if(settings.recognition) {
$('#audio').show();
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@
<div class="togglebutton">
<label>Greentext<input id="greentext" type="checkbox"></label>
</div>
<div class="togglebutton" id="toggle-inline">
<label>Inline Images<input id="inline" type="checkbox"></label>
</div>
<div class="togglebutton">
<label>Mention Sound<input id="sound" type="checkbox"></label>
</div>
Expand All @@ -204,9 +207,6 @@
<div class="togglebutton" id="toggle-recognition" style="display:none">
<label>Speech Recognition [Experimental]<input id="recognition" type="checkbox"></label>
</div>
<div class="togglebutton" id="toggle-inline">
<label>In-line images<input id="inline" type="checkbox"></label>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit ded3279

Please sign in to comment.