From: Andrew Dolgov Date: Sat, 19 Jan 2013 06:55:51 +0000 (+0400) Subject: persist widescreen mode in session X-Git-Tag: 1.7.0~49 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7d8f56571bd5f64241c903f7b619771758b95c37;p=tt-rss.git persist widescreen mode in session --- 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); }