]> git.wh0rd.org - tt-rss.git/blobdiff - js/functions.js
Merge branch 'PrefFeedTree_no_favicon' into 'master'
[tt-rss.git] / js / functions.js
index 134ce0b18f51ae2764e34d2c76e756de120d3011..934f69e96c7f5db1aa5ea9ce1780577d3de4b636 100755 (executable)
@@ -32,57 +32,43 @@ Array.prototype.remove = function(s) {
 
 
 function report_error(message, filename, lineno, colno, error) {
-       exception_error(error);
+       exception_error(error, null, filename, lineno);
 }
 
-function exception_error(e, e_compat) {
+function exception_error(e, e_compat, filename, lineno, colno) {
        if (typeof e == "string") e = e_compat;
 
        if (!e) return; // no exception object, nothing to report.
 
        try {
+               console.error(e);
+               var msg = e.toString();
 
                try {
                        new Ajax.Request("backend.php", {
-                               parameters: {op: "rpc", method: "log", logmsg: msg},
+                               parameters: {op: "rpc", method: "log",
+                                       file: e.fileName ? e.fileName : filename,
+                                       line: e.lineNumber ? e.lineNumber : lineno,
+                                       msg: msg, context: e.stack},
                                onComplete: function (transport) {
-                                       console.log(transport.responseText);
+                                       console.warn(transport.responseText);
                                } });
 
                } catch (e) {
                        console.error("Exception while trying to log the error.", e);
                }
 
-               var msg = e.toString();
-
-               msg += "<p>"+ __("The error will be reported to the configured log destination.") +
-                       "</p>";
-
-               console.error(msg);
-
-               var content = "<div class=\"fatalError\">" +
-                       "<pre>" + msg + "</pre>";
-
-               content += "<form name=\"exceptionForm\" id=\"exceptionForm\" target=\"_blank\" "+
-                 "action=\"https://tt-rss.org/report.php\" method=\"POST\">";
-
-               content += "<textarea style=\"display : none\" name=\"message\">" + msg + "</textarea>";
-               content += "<textarea style=\"display : none\" name=\"params\">N/A</textarea>";
+               var content = "<div class='fatalError'><p>" + msg + "</p>";
 
-               if (e) {
+               if (e.stack) {
                        content += "<div><b>Stack trace:</b></div>" +
                                "<textarea name=\"stack\" readonly=\"1\">" + e.stack + "</textarea>";
                }
 
-               content += "</form>";
-
                content += "</div>";
 
                content += "<div class='dlgButtons'>";
 
-               content += "<button dojoType=\"dijit.form.Button\""+
-                               "onclick=\"dijit.byId('exceptionDlg').report()\">" +
-                               __('Report to tt-rss.org') + "</button> ";
                content += "<button dojoType=\"dijit.form.Button\" "+
                                "onclick=\"dijit.byId('exceptionDlg').hide()\">" +
                                __('Close') + "</button>";
@@ -95,22 +81,6 @@ function exception_error(e, e_compat) {
                        id: "exceptionDlg",
                        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 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();
-
-                               }
-                       },
                        content: content});
 
                dialog.show();
@@ -1153,27 +1123,6 @@ function quickAddFilter() {
 
 }
 
-function resetPubSub(feed_id, title) {
-
-       var msg = __("Reset subscription? Tiny Tiny RSS will try to subscribe to the notification hub again on next feed update.").replace("%s", title);
-
-       if (title == undefined || confirm(msg)) {
-               notify_progress("Loading, please wait...");
-
-               var query = "?op=pref-feeds&quiet=1&method=resetPubSub&ids=" + feed_id;
-
-               new Ajax.Request("backend.php", {
-                       parameters: query,
-                       onComplete: function(transport) {
-                               dijit.byId("pubsubReset_Btn").attr('disabled', true);
-                               notify_info("Subscription reset.");
-                       } });
-       }
-
-       return false;
-}
-
-
 function unsubscribeFeed(feed_id, title) {
 
        var msg = __("Unsubscribe from %s?").replace("%s", title);