]> git.wh0rd.org Git - tt-rss.git/commitdiff
dialog behaviour fixes
authorAndrew Dolgov <fox@fakecake.org>
Wed, 17 Nov 2010 07:12:50 +0000 (10:12 +0300)
committerAndrew Dolgov <fox@fakecake.org>
Wed, 17 Nov 2010 07:12:50 +0000 (10:12 +0300)
functions.js
prefs.js
tt-rss.js

index a040ae65dfe5c7fb653c18139d8a703715b1efeb..96c5fce2ab894aeed96bb1753dc894d2f353caac 100644 (file)
@@ -2,7 +2,6 @@ var hotkeys_enabled = true;
 var notify_silent = false;
 var last_progress_point = 0;
 var sanity_check_done = false;
-var dialogs = [];
 
 /* add method to remove element from array */
 
@@ -392,10 +391,9 @@ function closeInfoBox(cleanup) {
        try {
                enableHotkeys();
 
-               var dialog = dialogs.pop();
+               dialog = dijit.byId("infoBox");
 
-               if (dialog)
-                       dialog.hide();
+               if (dialog)     dialog.hide();
 
        } catch (e) {
                //exception_error("closeInfoBox", e);
@@ -438,9 +436,10 @@ function infobox_submit_callback2(transport) {
 
 function infobox_callback2(transport) {
        try {
+               var dialog = false;
+
                if (dijit.byId("infoBox")) {
-                       dialogs.pop();
-                       dijit.byId("infoBox").destroy();
+                       dialog = dijit.byId("infoBox");
                }
 
                //console.log("infobox_callback2");
@@ -464,28 +463,28 @@ function infobox_callback2(transport) {
                        content = transport.responseText;
                }
 
-               var dialog = new dijit.Dialog({
-                       title: title,
-                       id: 'infoBox',
-                       style: "width: 600px",
-                       onCancel: function() {
-                               dialogs.remove(this);
-                               return true;
-                       },
-                       onExecute: function() {
-                               dialogs.remove(this);
-                               return true;
-                       },
-                       onClose: function() {
-                               dialogs.remove(this);
-                               return true;
-                       },
-                       content: content});
+               if (!dialog) {
+                       dialog = new dijit.Dialog({
+                               title: title,
+                               id: 'infoBox',
+                               style: "width: 600px",
+                               onCancel: function() {
+                                       return true;
+                               },
+                               onExecute: function() {
+                                       return true;
+                               },
+                               onClose: function() {
+                                       return true;
+                                       },
+                               content: content});
+               } else {
+                       dialog.attr('title', title);
+                       dialog.attr('content', content);
+               }
 
                dialog.show();
 
-               dialogs.push(dialog);
-
                notify("");
        } catch (e) {
                exception_error("infobox_callback2", e);
index 05c437fa3f5451100a165cd582d487141c590801..e9cb8d3649341bfa1242a208cc48fa986edea61a 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -1230,7 +1230,13 @@ function pref_hotkey_handler(e) {
                        closeInfoBox();
                } 
 
-               if (dialogs.length > 0 || !hotkeys_enabled) {
+               var dialog = dijit.byId("infoBox");
+               var dialog_visible = false;
+
+               if (dialog)
+                       dialog_visible = Element.visible(dialog.domNode);
+
+               if (dialog_visible || !hotkeys_enabled) {
                        console.log("hotkeys disabled");
                        return;
                }
index bf963d6ea4ec5c657c4d5e40ca4d0fa2d7721a86..3bbd77f9331e323f00f8aaadb1d0061a978fc7e4 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -743,7 +743,13 @@ function hotkey_handler(e) {
                        closeInfoBox();
                } 
 
-               if (dialogs.length > 0 || !hotkeys_enabled) {
+               var dialog = dijit.byId("infoBox");
+               var dialog_visible = false;
+
+               if (dialog)
+                       dialog_visible = Element.visible(dialog.domNode);
+
+               if (dialog_visible || !hotkeys_enabled) {
                        console.log("hotkeys disabled");
                        return;
                }