Merge close_on_esc.js into xorg.js.
[platal.git] / htdocs / javascript / xorg.js
index 192d1ca..7b49f17 100644 (file)
@@ -414,6 +414,14 @@ function checkPassword(box, okLabel) {
 
         xpost: function(source, data, onSuccess, onError, type) {
             return $.xajax(source, 'POST', data, onSuccess, onError, type);
+        },
+
+        closeOnEsc: function() {
+            return $(window).keydown(function (e) {
+                if (e.keyCode == 27) {
+                    window.close();
+                }
+            });
         }
     });