diff --git a/src/public/main.js b/src/public/main.js
index 2d0c243..a55d294 100644
--- a/src/public/main.js
+++ b/src/public/main.js
@@ -35,6 +35,8 @@ $(function() {
var lastTypingTime;
var $currentInput = $usernameInput.focus();
+ var clipboard = new Clipboard('.copyable');
+
var roomId = window.location.pathname.length ? window.location.pathname : null;
if (!roomId) return;
@@ -101,7 +103,13 @@ $(function() {
// Log a message
function log (message, options) {
- var $el = $('
').addClass('log').text(message);
+ var html = options && options.html === true || false;
+ var $el;
+ if (html) {
+ $el = $('').addClass('log').html(message);
+ } else {
+ $el = $('').addClass('log').text(message);
+ }
addMessageElement($el, options);
}
@@ -251,9 +259,10 @@ $(function() {
socket.on('login', function (data) {
connected = true;
// Display the welcome message
- var message = "Fatty.chat - Anonymous Chat - Room ID: " + roomId.replace('/', '');
+ var message = "Fatty.chat - Anonymous Chat - Room ID: " + roomId.replace('/', '') + ' ';
log(message, {
- prepend: true
+ prepend: true,
+ html: true
});
message = "This chatroom is destroyed after all participants exit. Chat history is client side only and not persistent.";
@@ -318,5 +327,16 @@ $(function() {
isActive = false;
};
+ clipboard.on('success', function(e) {
+ $(e.trigger).tooltip({
+ title: 'Copied!',
+ trigger: 'manual',
+ placement: 'auto'
+ });
+ $(e.trigger).tooltip('show');
+ setTimeout(function() {
+ $(e.trigger).tooltip('hide');
+ }, 2000);
+ });
});
diff --git a/src/views/index.mustache b/src/views/index.mustache
index 47f6e28..5416512 100644
--- a/src/views/index.mustache
+++ b/src/views/index.mustache
@@ -5,9 +5,9 @@
FattyChat - Anonomous Chat
-
+
@@ -48,6 +48,7 @@
+