]> git.babelmonkeys.de Git - xmppchat.git/commitdiff
Add a disconnect button
authorFlorian Zeitz <florob@babelmonkeys.de>
Fri, 12 Nov 2010 23:19:26 +0000 (00:19 +0100)
committerFlorian Zeitz <florob@babelmonkeys.de>
Fri, 12 Nov 2010 23:19:26 +0000 (00:19 +0100)
* Disconnect button added
* updated strophe.js version

index.html
js/main.js
js/strophejs
style.css

index 2beef88f5e8af482f52f14937efb97924b449447..71297ad5c5d1ab685c1267088ba1a95974dc96f8 100644 (file)
@@ -31,6 +31,7 @@
   <form id="textForm" onsubmit="return sendMessage(this);" action="#">
     <input type="text" name="text" id ="text" />
     <input type="submit" id="text_submit" value="Send"/>
+    <input type="button" onclick="return doDisconnect(this);" id="disc_submit" value="Disconnect" />
   </form>
 </div>
 
index e6e88fb8e7a304f490d93690b51cb81624d2958f..9588826df689e99d1a9086f20d5b8d7963bea319 100644 (file)
@@ -242,6 +242,16 @@ function doLogin(aForm) {
        }
 }
 
+function doDisconnect(aForm) {
+       if (connection) {
+               connection.send($pres({to: room, type: 'unavailable'}).tree());
+               connection.flush();
+               connection.disconnect();
+               connection = null;
+       }
+       return false;
+}
+
 var dragElement = null;
 var mouseX = 0;
 var mouseY = 0;
@@ -268,13 +278,7 @@ function stopDrag(eve) {
        dragElement = null;
 }
 
-window.onunload = window.onbeforeunload = function() {
-       if (connection) {
-               connection.send($pres({to: room, type: 'unavailable'}).tree());
-               connection.disconnect();
-               connection = null;
-       }
-};
+window.onunload = window.onbeforeunload = doDisconnect;
 
 window.onmousemove = doDrag;
 
index 6d7b8863f0f36f73c0b65686956437d26bd93c01..119805c4163344fb1147131d6b9bc65702616c34 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 6d7b8863f0f36f73c0b65686956437d26bd93c01
+Subproject commit 119805c4163344fb1147131d6b9bc65702616c34
index 32b7afca6065c4a53aeba941cb94ff94c0b22d5c..54148133ea1e6b9680ddeb10352d31b1f6069b2f 100644 (file)
--- a/style.css
+++ b/style.css
@@ -61,18 +61,22 @@ html, body {
        padding-right: 0px;
        margin-left: 0px;
        margin-right: 0px;
-       position: absolute;
-       right: 0px;
 }
 
 #text {
-       width: 89%;
+       width: 80%;
        padding-left: 0px;
        padding-right: 0px;
        margin-left: 0px;
        margin-right: 0px;
 }
 
+#disc_submit {
+       width: 7%;
+       position: absolute;
+       right: 0px
+}
+
 .msg {
        margin: 2px;
 }