Nicer autoconnect, minor fixes

This commit is contained in:
Hexagon 2014-09-23 18:41:59 +02:00
parent d878e30a78
commit 29d1799d56
2 changed files with 14 additions and 9 deletions

View File

@ -26,7 +26,7 @@ define({
}, },
// Shortcut // Shortcut
hosts = requires.hosts.hosts, hosts = requires.hosts,
fandango = requires.fandango, fandango = requires.fandango,
templates = requires.templates, templates = requires.templates,
sound = requires.sound, sound = requires.sound,
@ -95,7 +95,7 @@ define({
hosts: function (force, done) { hosts: function (force, done) {
var i = 0, var i = 0,
left = hosts.length, left = hosts.hosts.length,
host, host,
strhosts = '\n', strhosts = '\n',
callback = function (host, index, isUp) { callback = function (host, index, isUp) {
@ -119,7 +119,7 @@ define({
force = (force && force.toLowerCase() === 'force'); force = (force && force.toLowerCase() === 'force');
// Loop through all the hosts // Loop through all the hosts
while (host = hosts[i]) { while (host = hosts.hosts[i]) {
if (!force && host.settings !== undefined) { if (!force && host.settings !== undefined) {
if (host.settings) { if (host.settings) {
callback(host, i, 1)(); callback(host, i, 1)();
@ -145,7 +145,7 @@ define({
} }
if ($.isDigits(toHost)) { if ($.isDigits(toHost)) {
if (host = hosts[+toHost]) { if (host = hosts.hosts[+toHost]) {
if (host.settings) { if (host.settings) {
settings = host.settings; settings = host.settings;
} else { } else {
@ -523,7 +523,7 @@ define({
// It's possible to provide room and key using the hashtag. // It's possible to provide room and key using the hashtag.
// The room and key is then seperated by semicolon (room:key). // The room and key is then seperated by semicolon (room:key).
// If there is no semicolon present, the complete hash will be treated as the room name and the key has to be set manually. // If there is no semicolon present, the complete hash will be treated as the room name and the key has to be set manually.
commands.connect(0, function() { commands.connect(hosts.autoconnect, function() {
if (host && (hash = window.location.hash)) { if (host && (hash = window.location.hash)) {
parts = hash.slice(1).split(':'); parts = hash.slice(1).split(':');

View File

@ -7,9 +7,14 @@ define({
// A collection of hosts to choose from // A collection of hosts to choose from
hosts: [ hosts: [
{ {
name: 'localhost', name: 'default',
host: 'http://localhost:8080', host: '',
path: 'http://localhost:8080/js/cryptalk_modules/settings.js' path: '/js/cryptalk_modules/settings.js'
} }/*,
{
name: 'Example',
host: 'http://www.example.com',
path: 'http://www.example.com/js/cryptalk_modules/settings.js'
}*/
] ]
}); });