[CODEFMT]

This commit is contained in:
2019-06-05 11:46:55 +01:00
parent 98d2c4d220
commit fcaf15e030

View File

@ -1,33 +1,33 @@
window.ChatHubHandler = (function ($) {
/*
# chat control ids
/*
# chat control ids
## inputs
## inputs
* msg_<rname> : input providing a room message
* pv_<uname> : input providing a private message
* command : input providing server command
* roomname : input (hidden or not) providing a room name
* msg_<rname> : input providing a room message
* pv_<uname> : input providing a private message
* command : input providing server command
* roomname : input (hidden or not) providing a room name
## persistent containers
## persistent containers
* chatview : the global container
* rooms : container from room displays
* pvs : container from pv displays
* server : container for server messages
* chatview : the global container
* rooms : container from room displays
* pvs : container from pv displays
* server : container for server messages
## temporary containers
## temporary containers
* room_<rname> : room message list
* pv_<uname> : private discussion display
* room_<rname> : room message list
* pv_<uname> : private discussion display
## css classes
## css classes
* form-control
* btn btn-default
* form-control
* btn btn-default
*/
*/
$.fn.filterByData = function (prop, val) {
return this.filter(function () { return $(this).data(prop) == val; });
};
@ -78,7 +78,7 @@ window.ChatHubHandler = (function ($) {
$('<li></li>').append(tag + ': ' + targetid).append(message).addClass(tag).appendTo(notifications);
};
var setActiveRoom = function(room) {
var setActiveRoom = function (room) {
var frontRoom;
if (frontRoomName !== '') {
frontRoom = $('#vroom_' + frontRoomName);
@ -110,7 +110,7 @@ window.ChatHubHandler = (function ($) {
chatlist.appendTo($view);
var buildRoom = function (room) {
var roomTag = $('<a>' + room + '</a>').addClass('btn');
roomTag.prop('id', 'sel_' + room).click(function() {
roomTag.prop('id', 'sel_' + room).click(function () {
setActiveRoom(room);
$(this).removeClass('btn-primary');
});
@ -128,7 +128,7 @@ window.ChatHubHandler = (function ($) {
.prop('hint', 'hello')
.prop('title', 'send to ' + room)
.addClass('form-control')
.keydown(function(ev) {
.keydown(function (ev) {
if (ev.which == 13) {
if (this.value.length == 0) return;
chat.server.send(room, this.value);
@ -139,25 +139,25 @@ window.ChatHubHandler = (function ($) {
setActiveRoom(room);
};
$view.data('chans').split(',').forEach(function(chan) {
$view.data('chans').split(',').forEach(function (chan) {
buildRoom(chan);
});
function onCx () {
function onCx() {
setTimeout(function () {
getUsers();
}, 120);
$('#chatview').removeClass('disabled');
chans.forEach(function(room) {
chat.server.join(room).done(function(chatInfo) {
chans.forEach(function (room) {
chat.server.join(room).done(function (chatInfo) {
setActiveRoom(chatInfo.Name);
});
});
}
function onDisCx () {
function onDisCx() {
$('#chatview').addClass('disabled');
}
@ -181,7 +181,7 @@ window.ChatHubHandler = (function ($) {
if (event.which == 13) {
if (this.value.length == 0) return;
buildRoom(this.value);
chat.server.join(this.value).done(function(chatInfo) {
chat.server.join(this.value).done(function (chatInfo) {
setActiveRoom(chatInfo.Name);
});
this.value = '';
@ -240,7 +240,7 @@ window.ChatHubHandler = (function ($) {
};
// This optional function html-encodes messages for display in the page.
function htmlEncode (value) {
function htmlEncode(value) {
var encodedValue = $('<div />').text(value).html();
return encodedValue;
}
@ -275,7 +275,7 @@ window.ChatHubHandler = (function ($) {
};
$(document).ready(function($) {
$(document).ready(function ($) {
ChatView($('#chatview'), true);
});