Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bouchon/TarHeelReaderTheme
Browse files Browse the repository at this point in the history
…into paul2
  • Loading branch information
gbishop committed Mar 14, 2012
2 parents f732a49 + ff9b091 commit 96a44a5
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion 404.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php thr_header(false, '', true); ?>
<?php thr_header('', true); ?>

<h2><?php _e('Error 404 - Page Not Found','html5reset'); ?></h2>

Expand Down
2 changes: 1 addition & 1 deletion archive.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php thr_header(false, '', true); ?>
<?php thr_header('', true); ?>
<?php if (have_posts()) : ?>

<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
Expand Down
6 changes: 3 additions & 3 deletions find.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
}
$searchFormData = setFormFromState($Templates['searchForm']);
?>
<?php thr_header(true, 'find-page', true);
<?php thr_header('find-page', true);
$view = array();
$view['searchForm'] = template_render('form', $searchFormData);
// edit the data to create the view for the template
Expand All @@ -123,7 +123,7 @@
$c['pw'] = 100*$c['width']/$c['height'];
$c['pm'] = 0;
}
}
}
$view['bookList'] = template_render('bookList', $result);
if ($page > 1) {
$view['backLink'] = get_find_url($page-1);
Expand All @@ -133,5 +133,5 @@
}
echo template_render('find', $view);

thr_footer(false, false);
thr_footer(false, false);
?>
12 changes: 3 additions & 9 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function is_ajax() {
}

// output the header with some tweaks
function thr_header($colors, $pageType, $heading, $disableCache=true) {
function thr_header($pageType, $heading, $disableCache=true) {
// tell IE8 how to render and to prefer chrome frame
header('X-UA_Compatible: IE=edge,chrome=1');

Expand All @@ -105,24 +105,18 @@ function thr_header($colors, $pageType, $heading, $disableCache=true) {
if ($disableCache) {
header('Cache-Control: max-age=10'); // 10 seconds should allow a quick forward and back without a trip to the server
}
$style = '';
if ($colors) {
$pc = THR('pageColor');
$tc = THR('textColor');
$style = "style=\"color: #$tc; background-color: #$pc; border-color: #$tc;\"";
}

if (is_ajax()) {
// this is a ajax request for the page, give it the mininimum header
echo "<div class=\"$pageType page-wrap\" data-title=\"";
thr_title();
echo "\" $style>\n";
echo "\">\n";

} else {
// this is a request from a browser for the full page.
get_header();
echo "<body>\n";
echo "<div class=\"$pageType page-wrap active-page\" $style >\n";
echo "<div class=\"$pageType page-wrap active-page\" >\n";
}
if ($heading) {
echo template_render('heading');
Expand Down
5 changes: 5 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@

<!-- CSS: screen, mobile & print are all in the same file -->
<link rel="stylesheet" href="/theme/style.css">
<style type="text/css"><?php
$pc = THR('pageColor');
$tc = THR('textColor');
echo ".thr-colors { color: #$tc; background-color: #$pc; border-color: #$tc; }";
?></style>

<!--[if IE 7 ]>
<script src="/theme/js/json2.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php thr_header(false, '', true, false); ?>
<?php thr_header('', true, false); ?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Expand Down
1 change: 0 additions & 1 deletion js/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ define(["jquery",
margin: 0,
zIndex: 10
})
.css('background-color', '#' + state.get('pageColor')) // make the background solid
.css(toSelect.offset()) // position it over the original
.delay(200) // wait a bit so we can see the highlight move
.animate({ // animate the book zooming up to final size
Expand Down
2 changes: 1 addition & 1 deletion js/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ define(["jquery", "state"], function($, state) {
options = $.extend({title:null, effect:'fade'}, options);
$('.active-page').fadeOut(0, function() {
if (options.colors) {
$page.css({
$('.thr-colors').css({
color: '#' + state.get('textColor'),
backgroundColor: '#' + state.get('pageColor'),
borderColor: '#' + state.get('textColor')
Expand Down
2 changes: 2 additions & 0 deletions js/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ define(["jquery",
newContent = templates.render('choicePage', view);
}
var $oldPage = page.getInactive('thr-book-page');
$oldPage.addClass('thr-colors');
$oldPage.empty().append('<div class="content-wrap">' + newContent + '</div>');
$def.resolve($oldPage);
});
Expand Down Expand Up @@ -122,6 +123,7 @@ define(["jquery",
var $page = $(this);
scalePicture($page);
$page.find('.thr-pic').fadeIn(1000);

}

route.add('render', /^\/\d+\/\d+\/\d+\/([^\/]+)\/(?:(\d+)\/(\?rating=\d)?)?$/, renderBook);
Expand Down
2 changes: 1 addition & 1 deletion login.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
}
?>
<?php thr_header(false, '', true); ?>
<?php thr_header('', true); ?>
<h1>Login to Tar Heel Reader</h1>
<p><?php echo $msg ?></p>
<form class="loginForm" action="/login/" method="post">
Expand Down
2 changes: 1 addition & 1 deletion page.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php thr_header(false, '', true, false); ?>
<?php thr_header('', true, false); ?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Expand Down
2 changes: 1 addition & 1 deletion reading-controls.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Allow users to configure reading
*/
?>
<?php thr_header(false, '', true); ?>
<?php thr_header('', true); ?>
<?php

// get the id if any
Expand Down
2 changes: 1 addition & 1 deletion search.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php thr_header(false, '', true); ?>
<?php thr_header('', true); ?>
<?php if (have_posts()) : ?>

<h2>Search Results</h2>
Expand Down
6 changes: 3 additions & 3 deletions single-book.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php thr_header(true, 'thr-book-page', false); ?>
<?php thr_header('thr-book-page thr-colors', false); ?>

<?php if (have_posts()):
while (have_posts()):
<?php if (have_posts()):
while (have_posts()):
the_post();

$book = ParseBookPost($post);
Expand Down
3 changes: 2 additions & 1 deletion style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ h2 {
*/
.thr-book-page {
text-align: center;
height: 100%;

h1 {
font-size: 2em;
Expand Down Expand Up @@ -603,7 +604,7 @@ and (orientation: landscape) {
height: 1px;
}

@import "image-gallery";
@import "image-gallery"; // should this be dynamic?

.myThumbnail {
width: 12%;
Expand Down
4 changes: 2 additions & 2 deletions templates/bookList.mustache
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<ul class="thr-book-list">
{{#books}}
<li class="selectable" data-preview="{{preview.url}}" data-id="{{ID}}" lang="{{language}}" data-has-speech="{{has_speech}}" >
<li class="selectable thr-colors" data-preview="{{preview.url}}" data-id="{{ID}}" lang="{{language}}" data-has-speech="{{has_speech}}" >
<a href="{{link}}">
<h2>{{title}}</h2>
<p class="thr-author">_(by {{author}}|short for written by author name)</p>
<img src="/theme/images/{{rating}}stars_t.png" class="thr-stars"
<img src="/theme/images/{{rating}}stars_t.png" class="thr-stars"
{{#rating}}
alt="{{rating}} stars" title="_({{rating}} stars)"
{{/rating}}
Expand Down
2 changes: 1 addition & 1 deletion templates/sidebar.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<li><a href="/login/">_(Log In|link label)</a></li>
{{/loggedIn}}
{{#loggedIn}}
<li><a href="/wp-admin/">_(Site Admin|link label)</a></li>
<li><a href="/wp-admin/" class="no-ajaxy">_(Site Admin|link label)</a></li>
<li><a href="/wp-login.php?action=logout">_(Log out|link label)</a></li>
{{/loggedIn}}
</ul>
Expand Down
2 changes: 1 addition & 1 deletion write.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Allow users to write books
*/
?>
<?php thr_header(false, 'write-page', true); ?>
<?php thr_header('write-page', true); ?>
<?php

// get the id if any
Expand Down

0 comments on commit 96a44a5

Please sign in to comment.