From e71f2610091960a66a3b237cc1054f444b7b94a7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 15 Jan 2010 11:46:20 +0300 Subject: [PATCH] replace some theme-specific frontend hooks with theme options --- feedlist.js | 4 ++-- functions.js | 4 ++-- functions.php | 17 +++++++++++++++++ themes/graycube/theme.ini | 1 + themes/triple-pane/theme.ini | 1 + tt-rss.css | 6 ------ tt-rss.js | 22 ++++------------------ 7 files changed, 27 insertions(+), 28 deletions(-) diff --git a/feedlist.js b/feedlist.js index 927b6b8a..bb3f3bf7 100644 --- a/feedlist.js +++ b/feedlist.js @@ -467,8 +467,8 @@ function feedlist_init() { } } - if (getInitParam("theme") == "" || getInitParam("theme") == "lejla" || - getInitParam("theme") == "neon") { + if (getInitParam("theme") == "" || + getInitParam("theme_options").match("hide_footer")) { setTimeout("hide_footer()", 5000); } diff --git a/functions.js b/functions.js index 7a43212d..0c4eaf35 100644 --- a/functions.js +++ b/functions.js @@ -526,8 +526,8 @@ function parse_counters(reply, scheduled_call) { } - if (row_needs_hl && getInitParam("theme") != 'neon' && - getInitParam("theme") != 'lejla') { + if (row_needs_hl && + !getInitParam("theme_option").match('no_highlights')) { new Effect.Highlight(feedr, {duration: 1, startcolor: "#fff7d5", queue: { position:'end', scope: 'EFQ-' + id, limit: 1 } } ); diff --git a/functions.php b/functions.php index f32ff8c9..78107456 100644 --- a/functions.php +++ b/functions.php @@ -2037,6 +2037,21 @@ return $theme_path; } + function get_user_theme_options($link) { + $t = get_user_theme_path($link); + + if ($t) { + if (is_file("$t/theme.ini")) { + $ini = parse_ini_file("$t/theme.ini", true); + if ($ini['theme']['version']) { + return $ini['theme']['options']; + } + } + } + return false; + } + + function get_all_themes() { $themes = glob("themes/*"); @@ -2054,6 +2069,7 @@ $entry["name"] = $ini['theme']['name']; $entry["version"] = $ini['theme']['version']; $entry["author"] = $ini['theme']['author']; + $entry["options"] = $ini['theme']['options']; array_push($rv, $entry); } } @@ -3133,6 +3149,7 @@ } print ""; + print ""; print ""; print ""; print ""; diff --git a/themes/graycube/theme.ini b/themes/graycube/theme.ini index 4a6eda0c..8c3863f5 100644 --- a/themes/graycube/theme.ini +++ b/themes/graycube/theme.ini @@ -1,3 +1,4 @@ [theme] name=Graycube version=1.0 +options=hide_footer diff --git a/themes/triple-pane/theme.ini b/themes/triple-pane/theme.ini index 4be8589a..a66e7171 100644 --- a/themes/triple-pane/theme.ini +++ b/themes/triple-pane/theme.ini @@ -1,3 +1,4 @@ [theme] name=Triple Pane version=1.0 +options=horiz_resize diff --git a/tt-rss.css b/tt-rss.css index 8ed41876..23ff92d1 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -1577,12 +1577,6 @@ div.return a:hover { right : 2px; } -a.feedUpdErrLink { - color : #ff0000; - display : block; - margin-bottom : 0.5em; -} - .catCtrHasUnread, .feedCtrHasUnread { font-weight : bold; color : #707070; diff --git a/tt-rss.js b/tt-rss.js index 2782cc72..8b04eae6 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -409,11 +409,11 @@ function resize_headlines(delta_x, delta_y) { if (!c_frame || !h_frame) return; - if (feeds_frame && getInitParam("theme") == "compat") { + if (feeds_frame && getInitParam("theme") == "old-skool") { feeds_frame.style.bottom = f_frame.offsetHeight + "px"; } - if (getInitParam("theme") == "triple-pane") { + if (getInitParam("theme_options").match("horiz_resize")) { if (delta_x != undefined) { if (c_frame.offsetLeft - delta_x > feeds_frame.offsetWidth + feeds_frame.offsetLeft + 100 && c_frame.offsetWidth + delta_x > 100) { @@ -431,7 +431,7 @@ function resize_headlines(delta_x, delta_y) { 4) + "px"; resize_grab.style.display = "block"; - resize_handle.src = "themes/triple-pane/images/resize_handle_vert.png"; + resize_handle.src = "themes/"+getInitParam('theme')+"/images/resize_handle_vert.png"; resize_handle.style.paddingTop = (resize_grab.offsetHeight / 2 - 7) + "px"; } else { @@ -448,21 +448,7 @@ function resize_headlines(delta_x, delta_y) { c_frame.style.top = (h_frame.offsetTop + h_frame.offsetHeight + 0) + "px"; h_frame.style.height = h_frame.offsetHeight + "px"; - - var theme_c = 0; - - if (getInitParam("theme") == "graycube") { - theme_c = 1; - } - if (getInitParam("theme") == "graycube" || getInitParam("theme") == "compat") { - resize_handle.src = "themes/graycube/images/resize_handle_horiz.png"; - } - -/* resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - - 4 - theme_c) + "px"; - resize_grab.style.display = "block"; */ - } if (getInitParam("cookie_lifetime") != 0) { @@ -903,7 +889,7 @@ function collapse_feedlist() { var theme = getInitParam("theme"); if (theme != "" && theme != "compact" && theme != "graycube" && - theme != "compat") return; + theme != "old-skool") return; var fl = $("feeds-holder"); var fh = $("headlines-frame"); -- 2.39.5