Add query string syntax to testclient.html

This commit is contained in:
Cathy J. Fitzpatrick 2013-02-20 03:55:26 -07:00
parent 7917f89a49
commit 6ed5c51aeb
2 changed files with 18 additions and 1 deletions

View File

@ -13,10 +13,13 @@ Testing
------------------------------------------------------------------------
You can make and test client changes simply by opening `testclient.html`.
This will allow you to test changes to the client without setting up your
own login server.
You can connect to an arbitrary server by navigating to
`testclient.html?~~host:port`. For example, to connect to a server running
locally on port 8000, you can navigate to `testclient.html?~~localhost:8000`.
Certain things will fail:
+ Registering

View File

@ -19,6 +19,20 @@
serverprotocol: 'ws',
testclient: true
};
(function() {
if (location.search !== '') {
var m = /\?~~(([^:\/]*)(:[0-9]*)?)/.exec(location.search);
if (m) {
Config.serverid = m[1];
Config.server = m[2];
if (m[3]) {
Config.serverport = m[3];
}
} else {
alert('Unrecognised query string syntax: ' + location.search);
}
}
})();
</script>
<!--[if lte IE 8]><script>
oldie = true;