From 29d1799d563d7c65dec7e09bdcb9f67bf807901d Mon Sep 17 00:00:00 2001 From: Hexagon Date: Tue, 23 Sep 2014 18:41:59 +0200 Subject: [PATCH] Nicer autoconnect, minor fixes --- public/js/cryptalk_modules/cryptalk.js | 10 +++++----- public/js/cryptalk_modules/hosts.js | 13 +++++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/public/js/cryptalk_modules/cryptalk.js b/public/js/cryptalk_modules/cryptalk.js index 775bd7d..3c9f0a5 100644 --- a/public/js/cryptalk_modules/cryptalk.js +++ b/public/js/cryptalk_modules/cryptalk.js @@ -26,7 +26,7 @@ define({ }, // Shortcut - hosts = requires.hosts.hosts, + hosts = requires.hosts, fandango = requires.fandango, templates = requires.templates, sound = requires.sound, @@ -95,7 +95,7 @@ define({ hosts: function (force, done) { var i = 0, - left = hosts.length, + left = hosts.hosts.length, host, strhosts = '\n', callback = function (host, index, isUp) { @@ -119,7 +119,7 @@ define({ force = (force && force.toLowerCase() === 'force'); // Loop through all the hosts - while (host = hosts[i]) { + while (host = hosts.hosts[i]) { if (!force && host.settings !== undefined) { if (host.settings) { callback(host, i, 1)(); @@ -145,7 +145,7 @@ define({ } if ($.isDigits(toHost)) { - if (host = hosts[+toHost]) { + if (host = hosts.hosts[+toHost]) { if (host.settings) { settings = host.settings; } else { @@ -523,7 +523,7 @@ define({ // It's possible to provide room and key using the hashtag. // 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. - commands.connect(0, function() { + commands.connect(hosts.autoconnect, function() { if (host && (hash = window.location.hash)) { parts = hash.slice(1).split(':'); diff --git a/public/js/cryptalk_modules/hosts.js b/public/js/cryptalk_modules/hosts.js index 256731a..59dc995 100644 --- a/public/js/cryptalk_modules/hosts.js +++ b/public/js/cryptalk_modules/hosts.js @@ -7,9 +7,14 @@ define({ // A collection of hosts to choose from hosts: [ { - name: 'localhost', - host: 'http://localhost:8080', - path: 'http://localhost:8080/js/cryptalk_modules/settings.js' - } + name: 'default', + host: '', + path: '/js/cryptalk_modules/settings.js' + }/*, + { + name: 'Example', + host: 'http://www.example.com', + path: 'http://www.example.com/js/cryptalk_modules/settings.js' + }*/ ] });