]> git.wh0rd.org - tt-rss.git/blobdiff - js/functions.js
fix some remaining old-style viewfeed() calls
[tt-rss.git] / js / functions.js
index 93b0371524f8e797b8cbc68a7ba44ef3d8963fc2..8e5694960154d3aa8d6cdf506972d4b86df59f3d 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", {
@@ -104,13 +101,15 @@ function exception_error(location, e, ext_info) {
                        title: "Unhandled exception",
                        style: "width: 600px",
                        report: function() {
-                               if (confirm(__("Are you sure to report this exception to tt-rss.org? The report will include your browser information. Your IP would be saved in the database."))) {
+                               if (confirm(__("Are you sure to report this exception to tt-rss.org? The report will include information about your web browser and tt-rss configuration. Your IP will be saved in the database."))) {
 
                                        document.forms['exceptionForm'].params.value = $H({
                                                browserName: navigator.appName,
                                                browserVersion: navigator.appVersion,
                                                browserPlatform: navigator.platform,
                                                browserCookies: navigator.cookieEnabled,
+                                               ttrssVersion: __ttrss_version,
+                                               initParams: JSON.stringify(init_params),
                                        }).toQueryString();
 
                                        document.forms['exceptionForm'].submit();
@@ -183,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");
@@ -199,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:
@@ -218,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) {
@@ -499,27 +502,6 @@ function infobox_callback2(transport, title) {
        }
 }
 
-function filterCR(e, f)
-{
-     var key;
-
-     if(window.event)
-          key = window.event.keyCode;     //IE
-     else
-          key = e.which;     //firefox
-
-       if (key == 13) {
-               if (typeof f != 'undefined') {
-                       f();
-                       return false;
-               } else {
-                       return false;
-               }
-       } else {
-               return true;
-       }
-}
-
 function getInitParam(key) {
        return init_params[key];
 }
@@ -588,15 +570,21 @@ function filterDlgCheckAction(sender) {
                }
 
                // if selected action supports parameters, enable params field
-               if (action == 4 || action == 6 || action == 7) {
+               if (action == 4 || action == 6 || action == 7 || action == 9) {
                        new Effect.Appear(action_param, {duration : 0.5});
-                       if (action != 7) {
-                               Element.show(dijit.byId("filterDlg_actionParam").domNode);
-                               Element.hide(dijit.byId("filterDlg_actionParamLabel").domNode);
-                       } else {
+
+                       Element.hide(dijit.byId("filterDlg_actionParam").domNode);
+                       Element.hide(dijit.byId("filterDlg_actionParamLabel").domNode);
+                       Element.hide(dijit.byId("filterDlg_actionParamPlugin").domNode);
+
+                       if (action == 7) {
                                Element.show(dijit.byId("filterDlg_actionParamLabel").domNode);
-                               Element.hide(dijit.byId("filterDlg_actionParam").domNode);
+                       } else if (action == 9) {
+                               Element.show(dijit.byId("filterDlg_actionParamPlugin").domNode);
+                       } else {
+                               Element.show(dijit.byId("filterDlg_actionParam").domNode);
                        }
+
                } else {
                        Element.hide(action_param);
                }
@@ -833,7 +821,7 @@ function quickAddFeed() {
                                                                        var reply = JSON.parse(transport.responseText);
                                                                } catch (e) {
                                                                        Element.hide("feed_add_spinner");
-                                                                       alert(__("Failed to parse output. This can indicate server timeout and/or network issues. Backend output was logged to the browser console."));
+                                                                       alert(__("Failed to parse output. This can indicate server timeout and/or network issues. Backend output was logged to browser console."));
                                                                        console.log('quickAddFeed, backend returned:' + transport.responseText);
                                                                        return;
                                                                }
@@ -963,6 +951,8 @@ function createNewActionElement(parentNode, replaceNode) {
 
                if (form.action_id.value == 7) {
                        form.action_param.value = form.action_param_label.value;
+               } else if (form.action_id.value == 9) {
+                       form.action_param.value = form.action_param_plugin.value;
                }
 
                var query = "backend.php?op=pref-filters&method=printactionname&action="+
@@ -1250,7 +1240,7 @@ function unsubscribeFeed(feed_id, title) {
                                                updateFeedList();
                                        } else {
                                                if (feed_id == getActiveFeedId())
-                                                       setTimeout("viewfeed(-5)", 100);
+                                                       setTimeout("viewfeed({feed:-5})", 100);
 
                                                if (feed_id < 0) updateFeedList();
                                        }
@@ -1294,10 +1284,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;