Permalink
Browse files

Fix vogue root URL detection.

  • Loading branch information...
1 parent a65e88b commit ed4d8a36aa3025213285aa8346afd86ec44fd06b @andrewdavey committed Jul 21, 2011
Showing with 4 additions and 8 deletions.
  1. +4 −8 src/client/vogue-client.js
View
@@ -6,12 +6,12 @@
var script = getScriptInfo();
loadScripts({
- io: script.url + 'socket.io/socket.io.js'
+ io: script.rootUrl + 'socket.io/socket.io.js'
}, vogue);
function vogue() {
var stylesheets = getLocalStylesheets();
- var socket = io.connect("http://" + script.domain + ":" + script.port);
+ var socket = io.connect(script.rootUrl);
socket.on('connect', watchAllStylesheets);
socket.on('update', handleMessage);
@@ -104,19 +104,15 @@ function getScriptInfo() {
var scripts = document.getElementsByTagName("script");
var src = scripts[scripts.length - 1].getAttribute("src");
- var rootMatch = src.match(/https?\:\/\/(.*?)\//);
- var url = rootMatch[0];
- var domain = rootMatch[1];
+ var rootUrl = src.match(/^https?\:\/\/(.*?)\//)[0];
var baseMatch = src.match(/\bbase=(.*)(&|$)/);
if (baseMatch) {
bases = bases.concat(baseMatch[1].split(','));
}
return {
- url: url,
- domain: domain,
- port: getPort(url),
+ rootUrl: rootUrl,
bases: bases
};
} else {

0 comments on commit ed4d8a3

Please sign in to comment.