From 7d8f56571bd5f64241c903f7b619771758b95c37 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 19 Jan 2013 10:55:51 +0400 Subject: [PATCH] persist widescreen mode in session --- classes/rpc.php | 8 ++++++++ include/functions.php | 1 + js/tt-rss.js | 13 +++++++++++++ 3 files changed, 22 insertions(+) diff --git a/classes/rpc.php b/classes/rpc.php index 9ed05bae..33e500ed 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -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)); + } + } ?> diff --git a/include/functions.php b/include/functions.php index b46e1a28..b564caf1 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1966,6 +1966,7 @@ $params["hotkeys"] = get_hotkeys_map($link); $params["csrf_token"] = $_SESSION["csrf_token"]; + $params["widescreen"] = (int) $_SESSION["widescreen"]; return $params; } diff --git a/js/tt-rss.js b/js/tt-rss.js index 3a83644d..78f7a867 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -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); } -- 2.39.5