replace some theme-specific frontend hooks with theme options

This commit is contained in:
Andrew Dolgov 2010-01-15 11:46:20 +03:00
parent 8d66a48a6d
commit e71f261009
7 changed files with 27 additions and 28 deletions

View file

@ -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);
}

View file

@ -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 } } );

View file

@ -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 "<param key=\"theme\" value=\"".get_user_theme($link)."\"/>";
print "<param key=\"theme_options\" value=\"".get_user_theme_options($link)."\"/>";
print "<param key=\"daemon_enabled\" value=\"" . ENABLE_UPDATE_DAEMON . "\"/>";
print "<param key=\"feeds_frame_refresh\" value=\"" . FEEDS_FRAME_REFRESH . "\"/>";
print "<param key=\"daemon_refresh_only\" value=\"true\"/>";

View file

@ -1,3 +1,4 @@
[theme]
name=Graycube
version=1.0
options=hide_footer

View file

@ -1,3 +1,4 @@
[theme]
name=Triple Pane
version=1.0
options=horiz_resize

View file

@ -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;

View file

@ -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");