]> git.wh0rd.org Git - tt-rss.git/commitdiff
persist widescreen mode in session
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 19 Jan 2013 06:55:51 +0000 (10:55 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 19 Jan 2013 06:55:51 +0000 (10:55 +0400)
classes/rpc.php
include/functions.php
js/tt-rss.js

index 9ed05bae74225f587ecbd218fc77b8a94948ca0e..33e500edfe72eb12d6e94d0ab6dd31c86b1c7622 100644 (file)
@@ -637,5 +637,13 @@ class RPC extends Handler_Protected {
                        "score_pic" => theme_image($link, get_score_pic($score))));
        }
 
+       function setpanelmode() {
+               $wide = (int) $_REQUEST["wide"];
+
+               $_SESSION["widescreen"] = $wide;
+
+               print json_encode(array("wide" => $wide));
+       }
+
 }
 ?>
index b46e1a28c96e0e4fa8c50c565a71e5166783b784..b564caf1efc1b2dba92d7de374c57bcbc199a1db 100644 (file)
                $params["hotkeys"] = get_hotkeys_map($link);
 
                $params["csrf_token"] = $_SESSION["csrf_token"];
+               $params["widescreen"] = (int) $_SESSION["widescreen"];
 
                return $params;
        }
index 3a83644d40b7eeb2fe6d090e592b657b996443b5..78f7a867d07cd41d14b976538d8ee85531f918b5 100644 (file)
@@ -336,6 +336,12 @@ function init_second_stage() {
                        updateFeedList();
                        closeArticlePanel();
 
+                       _widescreen_mode = getInitParam("widescreen");
+
+                       if (_widescreen_mode) {
+                               switchPanelMode(_widescreen_mode);
+                       }
+
                        if (typeof themeAfterLayout == 'function') {
                                themeAfterLayout();
                        }
@@ -1007,6 +1013,13 @@ function switchPanelMode(wide) {
 
                if (article_id) view(article_id);
 
+               new Ajax.Request("backend.php", {
+                       parameters: "op=rpc&method=setpanelmode&wide=" + (wide ? 1 : 0),
+                       onComplete: function(transport) {
+                               console.log(transport.responseText);
+                       } });
+
+
        } catch (e) {
                exception_error("switchPanelMode", e);
        }