]> git.wh0rd.org - tt-rss.git/blobdiff - js/functions.js
notify fixes
[tt-rss.git] / js / functions.js
index c5194d2d10c743a1e77807d59ab28353495efd14..98a531851683b241f26a88db56880cef2b45bf92 100644 (file)
@@ -44,11 +44,8 @@ function exception_error(location, e, ext_info) {
 
        try {
 
-               if (ext_info) {
-                       if (ext_info.responseText) {
-                               ext_info = ext_info.responseText;
-                       }
-               }
+               if (ext_info)
+                       ext_info = JSON.stringify(ext_info);
 
                try {
                        new Ajax.Request("backend.php", {
@@ -185,11 +182,6 @@ function param_unescape(arg) {
                return unescape(arg);
 }
 
-
-function hide_notify() {
-       Element.hide('notify');
-}
-
 function notify_real(msg, no_hide, n_type) {
 
        var n = $("notify");
@@ -201,12 +193,11 @@ function notify_real(msg, no_hide, n_type) {
        }
 
        if (msg == "") {
-               if (Element.visible(n)) {
-                       notify_hide_timerid = window.setTimeout("hide_notify()", 0);
+               if (n.hasClassName("visible")) {
+                       notify_hide_timerid = window.setTimeout(function() {
+                               n.removeClassName("visible") }, 0);
                }
                return;
-       } else {
-               Element.show(n);
        }
 
        /* types:
@@ -220,30 +211,40 @@ function notify_real(msg, no_hide, n_type) {
 
        msg = "<span class=\"msg\"> " + __(msg) + "</span>";
 
-       if (n_type == 1) {
-               n.className = "notify";
-       } else if (n_type == 2) {
-               n.className = "notify progress";
+       if (n_type == 2) {
                msg = "<span><img src='images/indicator_white.gif'></span>" + msg;
                no_hide = true;
        } else if (n_type == 3) {
-               n.className = "notify error";
                msg = "<span><img src='images/alert.png'></span>" + msg;
        } else if (n_type == 4) {
-               n.className = "notify info";
                msg = "<span><img src='images/information.png'></span>" + msg;
        }
 
        msg += " <span><img src=\"images/cross.png\" class=\"close\" title=\"" +
                __("Click to close") + "\" onclick=\"notify('')\"></span>";
 
-//     msg = "<img src='images/live_com_loading.gif'> " + msg;
-
        n.innerHTML = msg;
 
-       if (!no_hide) {
-               notify_hide_timerid = window.setTimeout("hide_notify()", 5*1000);
-       }
+       window.setTimeout(function() {
+               // goddamnit firefox
+               if (n_type == 2) {
+               n.className = "notify notify_progress visible";
+                       } else if (n_type == 3) {
+                       n.className = "notify notify_error visible";
+                       msg = "<span><img src='images/alert.png'></span>" + msg;
+               } else if (n_type == 4) {
+                       n.className = "notify notify_info visible";
+               } else {
+                       n.className = "notify visible";
+               }
+
+               if (!no_hide) {
+                       notify_hide_timerid = window.setTimeout(function() {
+                               n.removeClassName("visible") }, 5*1000);
+               }
+
+       }, 10);
+
 }
 
 function notify(msg, no_hide) {
@@ -1296,10 +1297,8 @@ function backend_sanity_check_callback(transport) {
                        console.log('reading init-params...');
 
                        for (k in params) {
-                               var v = params[k];
-                               console.log("IP: " + k + " => " + v);
-
-                               if (k == "label_base_index") _label_base_index = parseInt(v);
+                               console.log("IP: " + k + " => " + JSON.stringify(params[k]));
+                               if (k == "label_base_index") _label_base_index = parseInt(params[k]);
                        }
 
                        init_params = params;