diff options
author | Stefan Radomski <github@mintwerk.de> | 2013-11-07 00:00:47 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2013-11-07 00:00:47 (GMT) |
commit | b2d7e26223288d0e555e8b72ef987be93d2d89ba (patch) | |
tree | fdd78fe7f47bfbbeaac32514d89fcafc1da45200 /apps/samples/miles/miles.js | |
parent | 62eed0a72b0a133bcec94131e7fd74415b87ba90 (diff) | |
parent | c3238c9a5c627491d26ad527f99a08ccfd218c29 (diff) | |
download | uscxml-b2d7e26223288d0e555e8b72ef987be93d2d89ba.zip uscxml-b2d7e26223288d0e555e8b72ef987be93d2d89ba.tar.gz uscxml-b2d7e26223288d0e555e8b72ef987be93d2d89ba.tar.bz2 |
Merge pull request #6 from mathiasjohanson/master
text messaging
Diffstat (limited to 'apps/samples/miles/miles.js')
-rw-r--r-- | apps/samples/miles/miles.js | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/apps/samples/miles/miles.js b/apps/samples/miles/miles.js index f979266..451306b 100644 --- a/apps/samples/miles/miles.js +++ b/apps/samples/miles/miles.js @@ -12,8 +12,8 @@ function Miles(element, params) { this.connected = false; this.imageIteration = 0; - this.width = 300; - this.height = 200; + this.width = 320; + this.height = 240; // private attributes var scxmlURL = "localhost:8080" @@ -93,10 +93,25 @@ function Miles(element, params) { } this.disconnect = function() { - self.connected = false; - hideChat(); - self.controlDropDown.dropDown.onCancel(true); - self.controlElem.replaceChild(self.connectDropDown.domNode, self.controlDropDown.domNode); + var query = ""; + query += "?reflector=" + encodeURIComponent(reflectorIp); + query += "&userid=" + encodeURIComponent(email); + query += "&session=" + encodeURIComponent(problemName); + + self.xhr.get({ + // The URL to request + url: "http://" + scxmlURL + "/miles/stop" + query, + // handleAs:"text", + error: function(err) { + console.log(err); + }, + load: function(result) { + self.connected = false; + hideChat(); + self.controlDropDown.dropDown.onCancel(true); + self.controlElem.replaceChild(self.connectDropDown.domNode, self.controlDropDown.domNode); + } + }); } var hideChat = function() { @@ -176,7 +191,7 @@ function Miles(element, params) { }, load: function(result) { if (result.message) { - self.chatOutputElem.innerHTML += stopChatScrolling + " " + Math.random() + ": " + result.message + '<br />'; + self.chatOutputElem.innerHTML += result.message + '<br />'; if (!stopChatScrolling) self.chatOutputElem.scrollTop = self.chatOutputElem.scrollHeight; } @@ -283,7 +298,7 @@ function Miles(element, params) { self.chatSendButton = new Button({ label: "Send", onClick: function(){ - alert(self.chatInput.value); + //alert(self.chatInput.value); self.xhr.post({ // The URL to request url: "http://" + scxmlURL + "/miles/text", |