-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add emoji picker, sidebarHandlers.js, client.js refactoring, update s…
…creenshot
- Loading branch information
Showing
11 changed files
with
150 additions
and
30 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var $ = require('jquery'); | ||
var highlightInput = require('./utils/highlightInput.js'); | ||
|
||
var emojiPicker = function() { | ||
var pickerButton = $('.emoji-picker-button'); | ||
var pickerList = $('.emoji-picker-list'); | ||
var userMessageInput = $('#user-message'); | ||
|
||
pickerButton.on('click', function() { | ||
pickerList.toggle(); | ||
}); | ||
|
||
pickerList.on('click', 'span', function() { | ||
var pickedEmoji = $(this).text(); | ||
userMessageInput.val(userMessageInput.val() + pickedEmoji); | ||
|
||
highlightInput(userMessageInput[0]); | ||
userMessageInput.focus(); | ||
}); | ||
|
||
// prevent text selection on doubleclick | ||
$('.emoji-picker-list span, .emoji-picker-button').on('mousedown', function(e) { | ||
e.preventDefault(); | ||
}); | ||
}; | ||
|
||
module.exports = emojiPicker(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var $ = require('jquery'); | ||
|
||
var modalHandlers = function() { | ||
$('.modal-button .button-close').on('click', function() { | ||
$('.modal-overlay').hide(); | ||
}); | ||
}; | ||
|
||
module.exports = modalHandlers(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var $ = require('jquery'); | ||
var highlightInput = require('./utils/highlightInput.js'); | ||
|
||
var sidebarHandlers = function() { | ||
|
||
var addSidebarUserToInput = function() { | ||
$('.sidebar-users-items').on('click', '.sidebar-user', function() { | ||
var userMessageInput = $('#user-message'); | ||
var userName = $(this).text(); | ||
|
||
userMessageInput.val(userMessageInput.val() + '@' + userName + ' '); | ||
|
||
highlightInput(userMessageInput[0]); | ||
userMessageInput.focus(); | ||
}); | ||
}; | ||
|
||
var toggleSidebarOnMobile = function() { | ||
var sidebarToggle = $('.sidebar-toggle'); | ||
var sidebar = $('.sidebar'); | ||
|
||
sidebarToggle.on('click', function() { | ||
sidebar.toggleClass('sidebar--visible'); | ||
}); | ||
}; | ||
|
||
addSidebarUserToInput(); | ||
toggleSidebarOnMobile(); | ||
}; | ||
|
||
module.exports = sidebarHandlers(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
var soundOfMessage = new Audio('css/sounds/new-message.mp3'); | ||
soundOfMessage.volume = 0.5; | ||
|
||
module.exports = soundOfMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var $ = require('jquery'); | ||
|
||
var highlightInput = function(element) { | ||
$(element).addClass('highlighted'); | ||
|
||
setTimeout(function() { | ||
$(element).removeClass('highlighted'); | ||
}, 100); | ||
}; | ||
|
||
module.exports = highlightInput; |