]> git.wh0rd.org - tt-rss.git/blobdiff - js/tt-rss.js
add a less intimidating error message when backend times out and/or fails to return...
[tt-rss.git] / js / tt-rss.js
index 46e282351d595b95ca660e2b075836aa674c5c35..3b7793553a94b13dcb8a659f86717d1fe0fa723c 100644 (file)
@@ -550,9 +550,6 @@ function init_second_stage() {
                        updateFeedList();
                        closeArticlePanel();
 
-                       _widescreen_mode = getInitParam("widescreen");
-                       switchPanelMode(_widescreen_mode);
-
                        if (parseInt(getCookie("ttrss_fh_width")) > 0) {
                                dijit.byId("feeds-holder").domNode.setStyle(
                                        {width: getCookie("ttrss_fh_width") + "px" });
@@ -573,13 +570,17 @@ function init_second_stage() {
 
                        var tmph = dojo.connect(dijit.byId('feeds-holder'), 'resize',
                                function (args) {
-                                       setCookie("ttrss_fh_width", args.w, getInitParam("cookie_lifetime"));
+                                       if (args && args.w >= 0) {
+                                               setCookie("ttrss_fh_width", args.w, getInitParam("cookie_lifetime"));
+                                       }
                        });
 
                        var tmph = dojo.connect(dijit.byId('content-insert'), 'resize',
                                function (args) {
-                                       setCookie("ttrss_ci_width", args.w, getInitParam("cookie_lifetime"));
-                                       setCookie("ttrss_ci_height", args.h, getInitParam("cookie_lifetime"));
+                                       if (args && args.w >= 0 && args.h >= 0) {
+                                               setCookie("ttrss_ci_width", args.w, getInitParam("cookie_lifetime"));
+                                               setCookie("ttrss_ci_height", args.h, getInitParam("cookie_lifetime"));
+                                       }
                        });
 
                });
@@ -620,6 +621,9 @@ function init_second_stage() {
                hotkeys[1] = tmp;
                setInitParam("hotkeys", hotkeys);
 
+               _widescreen_mode = getInitParam("widescreen");
+               switchPanelMode(_widescreen_mode);
+
                console.log("second stage ok");
 
                if (getInitParam("simple_update")) {
@@ -983,7 +987,12 @@ function newVersionDlg() {
 
 function handle_rpc_json(transport, scheduled_call) {
        try {
-               var reply = JSON.parse(transport.responseText);
+               try {
+                       var reply = JSON.parse(transport.responseText);
+               } catch (e) {
+                       alert(__("Failed to parse server reply. This could be caused by a server or network timeout. Backend output was logged to the browser console."));
+                       console.log("handle_rpc_json, received: " + transport.responseText);
+               }
 
                if (reply) {
 
@@ -1060,11 +1069,8 @@ function switchPanelMode(wide) {
 
                        dijit.byId("content-insert").domNode.setStyle({width: '50%',
                                height: 'auto',
-                               borderLeftWidth: '1px',
-                               borderLeftColor: '#c0c0c0',
                                borderTopWidth: '0px' });
 
-                       $("headlines-toolbar").setStyle({ borderBottomWidth: '0px' });
                        $("headlines-frame").setStyle({ borderBottomWidth: '0px' });
                        $("headlines-frame").addClassName("wide");
 
@@ -1074,10 +1080,7 @@ function switchPanelMode(wide) {
 
                        dijit.byId("content-insert").domNode.setStyle({width: 'auto',
                                height: '50%',
-                               borderLeftWidth: '0px',
-                               borderTopWidth: '1px'});
-
-                       $("headlines-toolbar").setStyle({ borderBottomWidth: '1px' });
+                               borderTopWidth: '0px'});
 
                        $("headlines-frame").setStyle({ borderBottomWidth: '1px' });
                        $("headlines-frame").removeClassName("wide");