]> git.wh0rd.org Git - tt-rss.git/commitdiff
resize_headlines: add exception handling
authorAndrew Dolgov <fox@bah.spb.su>
Tue, 20 May 2008 10:41:00 +0000 (11:41 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Tue, 20 May 2008 10:41:00 +0000 (11:41 +0100)
tt-rss.js

index d27a94af62db56d98456c01fec7263342df1b6a7..c29d74dec64c3ef978dd8f7dfa73a626009d6ad9 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -361,71 +361,77 @@ function init() {
 
 function resize_headlines(delta_x, delta_y) {
 
-       debug("resize_headlines: " + delta_x + ":" + delta_y);
-
-       var h_frame = document.getElementById("headlines-frame");
-       var c_frame = document.getElementById("content-frame");
-       var f_frame = document.getElementById("footer");
-       var feeds_frame = document.getElementById("feeds-holder");
-       var resize_grab = document.getElementById("resize-grabber");
-
-       if (!c_frame || !h_frame) return;
-
-       if (feeds_frame && getInitParam("theme") == "compat") {
-                       feeds_frame.style.bottom = f_frame.offsetHeight + "px";         
-       }
-
-       if (getInitParam("theme") == "3pane") {
+       try {
 
-               if (delta_x != undefined) {
-                       if (c_frame.offsetLeft - delta_x > feeds_frame.offsetWidth + feeds_frame.offsetLeft + 100 && c_frame.offsetWidth + delta_x > 100) {
-                               hor_offset = hor_offset + delta_x;
-                       }
+               debug("resize_headlines: " + delta_x + ":" + delta_y);
+       
+               var h_frame = document.getElementById("headlines-frame");
+               var c_frame = document.getElementById("content-frame");
+               var f_frame = document.getElementById("footer");
+               var feeds_frame = document.getElementById("feeds-holder");
+               var resize_grab = document.getElementById("resize-grabber");
+       
+               if (!c_frame || !h_frame) return;
+       
+               if (feeds_frame && getInitParam("theme") == "compat") {
+                               feeds_frame.style.bottom = f_frame.offsetHeight + "px";         
                }
-
-               debug("resize_headlines: HOR-mode: " + hor_offset);
-
-               c_frame.style.width = (400 + hor_offset) + "px";
-               h_frame.style.right = c_frame.offsetWidth - 1 + "px";
-
-               resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - 60) + "px";
-               resize_grab.style.left = (h_frame.offsetLeft + h_frame.offsetWidth - 
-                       4) + "px";
-               resize_grab.style.display = "block";
-
-       } else {
-
-               if (delta_y != undefined) {
-                       if (c_frame.offsetHeight + delta_y > 100 && h_frame.offsetHeight - delta_y > 100) {
-                               ver_offset = ver_offset + delta_y;
+       
+               if (getInitParam("theme") == "3pane") {
+       
+                       if (delta_x != undefined) {
+                               if (c_frame.offsetLeft - delta_x > feeds_frame.offsetWidth + feeds_frame.offsetLeft + 100 && c_frame.offsetWidth + delta_x > 100) {
+                                       hor_offset = hor_offset + delta_x;
+                               }
                        }
+       
+                       debug("resize_headlines: HOR-mode: " + hor_offset);
+       
+                       c_frame.style.width = (400 + hor_offset) + "px";
+                       h_frame.style.right = c_frame.offsetWidth - 1 + "px";
+       
+                       resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - 60) + "px";
+                       resize_grab.style.left = (h_frame.offsetLeft + h_frame.offsetWidth - 
+                               4) + "px";
+                       resize_grab.style.display = "block";
+       
+               } else {
+       
+                       if (delta_y != undefined) {
+                               if (c_frame.offsetHeight + delta_y > 100 && h_frame.offsetHeight - delta_y > 100) {
+                                       ver_offset = ver_offset + delta_y;
+                               }
+                       }
+       
+                       debug("resize_headlines: VER-mode: " + ver_offset);
+       
+                       h_frame.style.height = (300 - ver_offset) + "px";
+       
+                       c_frame.style.top = (h_frame.offsetTop + h_frame.offsetHeight + 1) + "px";
+                       h_frame.style.height = h_frame.offsetHeight + "px";
+       
+                       var theme_c = 0;
+       
+                       if (getInitParam("theme") == "graycube") theme_c = 1;
+       
+                       resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - 
+                               4 - theme_c) + "px";
+                       resize_grab.style.display = "block";
+       
+               }
+       
+               if (getInitParam("cookie_lifetime") != 0) {
+                       setCookie("ttrss_offset_ver", ver_offset, 
+                               getInitParam("cookie_lifetime"));
+                       setCookie("ttrss_offset_hor", hor_offset, 
+                               getInitParam("cookie_lifetime"));
+               } else {
+                       setCookie("ttrss_offset_ver", ver_offset);
+                       setCookie("ttrss_offset_hor", hor_offset);
                }
 
-               debug("resize_headlines: VER-mode: " + ver_offset);
-
-               h_frame.style.height = (300 - ver_offset) + "px";
-
-               c_frame.style.top = (h_frame.offsetTop + h_frame.offsetHeight + 1) + "px";
-               h_frame.style.height = h_frame.offsetHeight + "px";
-
-               var theme_c = 0;
-
-               if (getInitParam("theme") == "graycube") theme_c = 1;
-
-               resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - 
-                       4 - theme_c) + "px";
-               resize_grab.style.display = "block";
-
-       }
-
-       if (getInitParam("cookie_lifetime") != 0) {
-               setCookie("ttrss_offset_ver", ver_offset, 
-                       getInitParam("cookie_lifetime"));
-               setCookie("ttrss_offset_hor", hor_offset, 
-                       getInitParam("cookie_lifetime"));
-       } else {
-               setCookie("ttrss_offset_ver", ver_offset);
-               setCookie("ttrss_offset_hor", hor_offset);
+       } catch (e) {
+               exception_error("resize_headlines", e);
        }
 
 }