]> git.wh0rd.org - tt-rss.git/blobdiff - functions.js
rework loading progressbar
[tt-rss.git] / functions.js
index 40779a06e9df1870f3a630a4c83ea2c26e9f2550..48a9ef230fed360a1fd0a13ad28d2b76cbd44e66 100644 (file)
@@ -1,8 +1,7 @@
 var hotkeys_enabled = true;
 var notify_silent = false;
-var last_progress_point = 0;
+var loading_progress = 0;
 var sanity_check_done = false;
-var dialogs = [];
 
 /* add method to remove element from array */
 
@@ -307,10 +306,28 @@ function toggleSelectListRow(sender) {
        return toggleSelectRow(sender, row);
 }
 
+/* this is for dijit Checkbox */
+function toggleSelectListRow2(sender) {
+       var row = sender.domNode.parentNode;
+       return toggleSelectRow(sender, row);
+}
+
 function tSR(sender, row) {
        return toggleSelectRow(sender, row);
 }
 
+/* this is for dijit Checkbox */
+function toggleSelectRow2(sender, row) {
+
+       if (!row) row = sender.domNode.parentNode.parentNode;
+
+       if (sender.checked && !row.hasClassName('Selected'))
+               row.addClassName('Selected');
+       else
+               row.removeClassName('Selected');
+}
+
+
 function toggleSelectRow(sender, row) {
 
        if (!row) row = sender.parentNode.parentNode;
@@ -392,12 +409,9 @@ function closeInfoBox(cleanup) {
        try {
                enableHotkeys();
 
-               var dialog = dialogs.pop();
+               dialog = dijit.byId("infoBox");
 
-               if (dialog) {
-                       dialog.attr('content', '');
-                       dialog.hide();
-               }
+               if (dialog)     dialog.hide();
 
        } catch (e) {
                //exception_error("closeInfoBox", e);
@@ -410,9 +424,6 @@ function displayDlg(id, param, callback) {
 
        notify_progress("Loading, please wait...", true);
 
-       while (dialogs.length > 0)
-               closeInfoBox();
-
        var query = "?op=dlg&id=" +
                param_escape(id) + "&param=" + param_escape(param);
 
@@ -443,6 +454,11 @@ function infobox_submit_callback2(transport) {
 
 function infobox_callback2(transport) {
        try {
+               var dialog = false;
+
+               if (dijit.byId("infoBox")) {
+                       dialog = dijit.byId("infoBox");
+               }
 
                //console.log("infobox_callback2");
                notify('');
@@ -465,30 +481,28 @@ function infobox_callback2(transport) {
                        content = transport.responseText;
                }
 
-               var dialog = new dijit.Dialog({
-                       title: title,
-                       style: "width: 600px",
-                       onCancel: function() {
-                               dialogs.remove(this);
-                               this.attr('content', '');
-                               return true;
-                       },
-                       onExecute: function() {
-                               dialogs.remove(this);
-                               this.attr('content', '');
-                               return true;
-                       },
-                       onClose: function() {
-                               dialogs.remove(this);
-                               this.attr('content', '');
-                               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);
@@ -578,8 +592,6 @@ function subscribeToFeed() {
        new Ajax.Request("backend.php", {
                parameters: query,
                onComplete: function(transport) { 
-                       //dlg_frefresh_callback(transport); 
-
                        try {
 
                                if (!transport.responseXML) {
@@ -867,21 +879,13 @@ function displayHelpInfobox(topic_id) {
 
 function loading_set_progress(p) {
        try {
-               if (p < last_progress_point || !Element.visible("overlay")) return;
-
-               console.log("loading_set_progress : " + p + " (" + last_progress_point + ")");
+               loading_progress += p;
 
-               var o = $("l_progress_i");
+               if (dijit.byId("loading_bar"))
+                       dijit.byId("loading_bar").update({progress: loading_progress});
 
-//             o.style.width = (p * 2) + "px";
-
-               new Effect.Scale(o, p, { 
-                       scaleY : false,
-                       scaleFrom : last_progress_point,
-                       scaleMode: { originalWidth : 200 },
-                       queue: { position: 'end', scope: 'LSP-Q', limit: 3 } }); 
-
-               last_progress_point = p;
+               if (loading_progress >= 90)
+                       remove_splash();
 
        } catch (e) {
                exception_error("loading_set_progress", e);
@@ -889,6 +893,7 @@ function loading_set_progress(p) {
 }
 
 function remove_splash() {
+
        if (Element.visible("overlay")) {
                console.log("about to remove splash, OMG!");
                Element.hide("overlay");