]> git.wh0rd.org - tt-rss.git/blobdiff - js/tt-rss.js
mail plugin: use dijit.form.ComboBox to allow random email input instead of only...
[tt-rss.git] / js / tt-rss.js
index 46e282351d595b95ca660e2b075836aa674c5c35..c6414515944abf7b85afae92d1a248724312ba4d 100644 (file)
@@ -231,6 +231,7 @@ function init() {
                dojo.require("dijit.form.Select");
                dojo.require("dijit.form.SimpleTextarea");
                dojo.require("dijit.form.TextBox");
+               dojo.require("dijit.form.ComboBox");
                dojo.require("dijit.form.ValidationTextBox");
                dojo.require("dijit.InlineEditBox");
                dojo.require("dijit.layout.AccordionContainer");
@@ -500,6 +501,10 @@ function init() {
                                if (!isCdmMode()) {
                                        _widescreen_mode = !_widescreen_mode;
 
+                                       // reset stored sizes because geometry changed
+                                       setCookie("ttrss_ci_width", 0);
+                                       setCookie("ttrss_ci_height", 0);
+
                                        switchPanelMode(_widescreen_mode);
                                }
                };
@@ -550,36 +555,26 @@ 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" });
                        }
 
-                       if (parseInt(getCookie("ttrss_ci_width")) > 0) {
-                               if (_widescreen_mode) {
-                                       dijit.byId("content-insert").domNode.setStyle(
-                                               {width: getCookie("ttrss_ci_width") + "px" });
-
-                               } else {
-                                       dijit.byId("content-insert").domNode.setStyle(
-                                               {height: getCookie("ttrss_ci_height") + "px" });
-                               }
-                       }
-
                        dijit.byId("main").resize();
 
                        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 +615,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")) {
@@ -702,6 +700,10 @@ function quickMenuGo(opid) {
                        if (!isCdmMode()) {
                                _widescreen_mode = !_widescreen_mode;
 
+                               // reset stored sizes because geometry changed
+                               setCookie("ttrss_ci_width", 0);
+                               setCookie("ttrss_ci_height", 0);
+
                                switchPanelMode(_widescreen_mode);
                        }
                        break;
@@ -985,6 +987,12 @@ function handle_rpc_json(transport, scheduled_call) {
        try {
                var reply = JSON.parse(transport.responseText);
 
+               var netalert_dijit = dijit.byId("net-alert");
+               var netalert = false;
+
+               if (netalert_dijit)
+                       netalert = netalert_dijit.domNode;
+
                if (reply) {
 
                        var error = reply['error'];
@@ -1031,16 +1039,21 @@ function handle_rpc_json(transport, scheduled_call) {
                        if (runtime_info)
                                parse_runtime_info(runtime_info);
 
-                       Element.hide(dijit.byId("net-alert").domNode);
+                       if (netalert) Element.hide(netalert);
 
                } else {
-                       //notify_error("Error communicating with server.");
-                       Element.show(dijit.byId("net-alert").domNode);
+                       if (netalert)
+                               Element.show(netalert);
+                       else
+                               notify_error("Communication problem with server.");
                }
 
        } catch (e) {
-               Element.show(dijit.byId("net-alert").domNode);
-               //notify_error("Error communicating with server.");
+               if (netalert)
+                       Element.show(netalert);
+               else
+                       notify_error("Communication problem with server.");
+
                console.log(e);
                //exception_error("handle_rpc_json", e, transport);
        }
@@ -1060,11 +1073,13 @@ function switchPanelMode(wide) {
 
                        dijit.byId("content-insert").domNode.setStyle({width: '50%',
                                height: 'auto',
-                               borderLeftWidth: '1px',
-                               borderLeftColor: '#c0c0c0',
                                borderTopWidth: '0px' });
 
-                       $("headlines-toolbar").setStyle({ borderBottomWidth: '0px' });
+                       if (parseInt(getCookie("ttrss_ci_width")) > 0) {
+                               dijit.byId("content-insert").domNode.setStyle(
+                                       {width: getCookie("ttrss_ci_width") + "px" });
+                       }
+
                        $("headlines-frame").setStyle({ borderBottomWidth: '0px' });
                        $("headlines-frame").addClassName("wide");
 
@@ -1074,10 +1089,12 @@ function switchPanelMode(wide) {
 
                        dijit.byId("content-insert").domNode.setStyle({width: 'auto',
                                height: '50%',
-                               borderLeftWidth: '0px',
-                               borderTopWidth: '1px'});
+                               borderTopWidth: '0px'});
 
-                       $("headlines-toolbar").setStyle({ borderBottomWidth: '1px' });
+                       if (parseInt(getCookie("ttrss_ci_height")) > 0) {
+                               dijit.byId("content-insert").domNode.setStyle(
+                                       {height: getCookie("ttrss_ci_height") + "px" });
+                       }
 
                        $("headlines-frame").setStyle({ borderBottomWidth: '1px' });
                        $("headlines-frame").removeClassName("wide");