Set title, updated help, cleanup
This commit is contained in:
parent
c74d265579
commit
88382a0a2b
|
@ -1,8 +1,9 @@
|
||||||
// Main cryptalk module
|
// Main cryptalk module
|
||||||
define({
|
define({
|
||||||
compiles: ['$'],
|
compiles: ['$'],
|
||||||
requires: ['mediator','hosts', 'templates', 'audio', 'fandango','notifications','sounds']
|
requires: ['mediator','hosts', 'templates', 'audio', 'fandango','notifications','sounds','win']
|
||||||
}, function ($, requires, data) {
|
}, function ($, requires, data) {
|
||||||
|
|
||||||
var socket,
|
var socket,
|
||||||
key,
|
key,
|
||||||
host,
|
host,
|
||||||
|
@ -31,6 +32,7 @@ define({
|
||||||
templates = requires.templates,
|
templates = requires.templates,
|
||||||
sounds = requires.sounds,
|
sounds = requires.sounds,
|
||||||
channel = requires.mediator(),
|
channel = requires.mediator(),
|
||||||
|
win = requires.win,
|
||||||
|
|
||||||
lockInput = function () {
|
lockInput = function () {
|
||||||
components.input[0].setAttribute('disabled', 'disabled');
|
components.input[0].setAttribute('disabled', 'disabled');
|
||||||
|
@ -346,10 +348,17 @@ define({
|
||||||
|
|
||||||
mute: function () {
|
mute: function () {
|
||||||
mute = true;
|
mute = true;
|
||||||
|
return post('info', templates.messages.muted);
|
||||||
},
|
},
|
||||||
|
|
||||||
unmute: function () {
|
unmute: function () {
|
||||||
mute = false;
|
mute = false;
|
||||||
|
return post('info', templates.messages.unmuted);
|
||||||
|
},
|
||||||
|
|
||||||
|
title: function (payload) {
|
||||||
|
win.setTitle(payload);
|
||||||
|
return post('info', $.template(templates.messages.title_set, { title: payload}));
|
||||||
},
|
},
|
||||||
|
|
||||||
join: function (payload) {
|
join: function (payload) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ Usage
|
||||||
channel.emit('notification:off');
|
channel.emit('notification:off');
|
||||||
|
|
||||||
*/
|
*/
|
||||||
define(['mediator','window'],function (mediator,win){
|
define(['mediator','win'],function (mediator,win){
|
||||||
|
|
||||||
var enabled = true,
|
var enabled = true,
|
||||||
|
|
||||||
|
|
|
@ -23,17 +23,25 @@ define({
|
||||||
' \n' +
|
' \n' +
|
||||||
'---------------------------------------------------------------------- \n' +
|
'---------------------------------------------------------------------- \n' +
|
||||||
' \n' +
|
' \n' +
|
||||||
'Available commands: \n' +
|
'Client: \n' +
|
||||||
' /generate Generate random room \n' +
|
' /key StrongPassphrase Sets encryption key \n' +
|
||||||
' /join RoomId Join a room \n' +
|
|
||||||
' /count Count participants of room \n' +
|
|
||||||
' /nick NickName Sets an optional nick \n' +
|
' /nick NickName Sets an optional nick \n' +
|
||||||
' /mute Toggle notification sounds \n' +
|
' /mute Audio on \n' +
|
||||||
' /key OurStrongPassphrase Sets encryption key \n' +
|
' /unmute Audio off \n' +
|
||||||
' /leave Leave the room \n' +
|
|
||||||
' /clear Clear on-screen buffer \n' +
|
' /clear Clear on-screen buffer \n' +
|
||||||
' /help This \n' +
|
' /help This \n' +
|
||||||
|
' /title Set your local page title \n' +
|
||||||
' \n' +
|
' \n' +
|
||||||
|
'Room: \n' +
|
||||||
|
' /generate Generate random room \n' +
|
||||||
|
' /join RoomId Join a room \n' +
|
||||||
|
' /leave Leave the room \n' +
|
||||||
|
' /count Count participants \n' +
|
||||||
|
' \n' +
|
||||||
|
'Host: \n' +
|
||||||
|
' /hosts List available hosts \n' +
|
||||||
|
' /connect HostIndex Connect to selected host \n' +
|
||||||
|
' /disconnect Disconnect from host \n' +
|
||||||
' \n' +
|
' \n' +
|
||||||
'You can select any of the five last commands/messages with up/down key.\n' +
|
'You can select any of the five last commands/messages with up/down key.\n' +
|
||||||
' \n' +
|
' \n' +
|
||||||
|
@ -78,11 +86,11 @@ define({
|
||||||
msg_no_key: 'You have to set an encryption key before sending a message. See /help.',
|
msg_no_key: 'You have to set an encryption key before sending a message. See /help.',
|
||||||
leave_from_nowhere: 'How are you supposed to leave, while being nowhere?',
|
leave_from_nowhere: 'How are you supposed to leave, while being nowhere?',
|
||||||
|
|
||||||
// Sounds
|
title_set: 'The title of this window is now \'{title}\'.',
|
||||||
|
|
||||||
muted: 'Notifications and sounds are now muted.',
|
muted: 'Notifications and sounds are now muted.',
|
||||||
unmuted: 'Notifications and sounds are now on.',
|
unmuted: 'Notifications and sounds are now on.',
|
||||||
|
|
||||||
// Extra variables: 'commandName'
|
|
||||||
unrecognized_command: 'Unrecognized command: "{commandName}"',
|
unrecognized_command: 'Unrecognized command: "{commandName}"',
|
||||||
|
|
||||||
joined_room: 'Joined room {room}',
|
joined_room: 'Joined room {room}',
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
Emits:
|
||||||
|
'window:focused'
|
||||||
|
'window:blurred'
|
||||||
|
|
||||||
|
Exports:
|
||||||
|
title = window.getTitle();
|
||||||
|
window.setTitle(title);
|
||||||
|
|
||||||
|
*/
|
||||||
|
define(['mediator'],function (mediator){
|
||||||
|
|
||||||
|
var exports = {},
|
||||||
|
channel = mediator(),
|
||||||
|
|
||||||
|
focusCallback = function() {
|
||||||
|
channel.emit('window:focused');
|
||||||
|
},
|
||||||
|
|
||||||
|
blurCallback = function() {
|
||||||
|
channel.emit('window:blurred');
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.setTitle = function(t) { document.title = t; },
|
||||||
|
exports.getTitle = function() { return document.title; };
|
||||||
|
|
||||||
|
// Keep track of document focus/blur
|
||||||
|
if (window.addEventListener){
|
||||||
|
// Normal browsers
|
||||||
|
window.addEventListener("focus", focusCallback, true);
|
||||||
|
window.addEventListener("blur", blurCallback, true);
|
||||||
|
} else {
|
||||||
|
// IE
|
||||||
|
window.observe("focusin", focusCallback);
|
||||||
|
window.observe("focusout", blurCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
return exports;
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue