This commit is contained in:
obenland 2013-02-27 13:36:08 -08:00
commit a1b163e8ea
9 changed files with 58 additions and 50 deletions

View File

@ -13,7 +13,7 @@ get_header(); ?>
<article id="post-0" class="post error404 not-found"> <article id="post-0" class="post error404 not-found">
<header class="entry-header"> <header class="entry-header">
<h1 class="entry-title"><?php _e( 'Oops! That page can&apos;t be found.', '_s' ); ?></h1> <h1 class="entry-title"><?php _e( 'Oops! That page can&rsquo;t be found.', '_s' ); ?></h1>
</header><!-- .entry-header --> </header><!-- .entry-header -->
<div class="entry-content"> <div class="entry-content">

View File

@ -15,6 +15,6 @@
<div class="entry-content"> <div class="entry-content">
<?php the_content(); ?> <?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', '_s' ), 'after' => '</div>' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', '_s' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', '_s' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-content --> </div><!-- .entry-content -->
<?php edit_post_link( __( 'Edit', '_s' ), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>' ); ?>
</article><!-- #post-<?php the_ID(); ?> --> </article><!-- #post-<?php the_ID(); ?> -->

View File

@ -138,7 +138,7 @@ add_action( 'widgets_init', '_s_widgets_init' );
function _s_scripts() { function _s_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() ); wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true ); wp_enqueue_script( 'navigation', get_template_directory_uri() . '/js/navigation.js', null, '20120206', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );

View File

@ -31,8 +31,8 @@
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2> <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup> </hgroup>
<nav role="navigation" class="site-navigation main-navigation"> <nav role="navigation" class="site-navigation main-navigation" id="site-navigation">
<h1 class="assistive-text"><?php _e( 'Menu', '_s' ); ?></h1> <h1 class="menu-toggle"><?php _e( 'Menu', '_s' ); ?></h1>
<div class="assistive-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', '_s' ); ?>"><?php _e( 'Skip to content', '_s' ); ?></a></div> <div class="assistive-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', '_s' ); ?>"><?php _e( 'Skip to content', '_s' ); ?></a></div>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?> <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>

View File

@ -3,7 +3,7 @@
* Jetpack Compatibility File * Jetpack Compatibility File
* See: http://jetpack.me/ * See: http://jetpack.me/
* *
* @package: _s * @package _s
*/ */
/** /**

32
js/navigation.js Normal file
View File

@ -0,0 +1,32 @@
/**
* navigation.js
*
* Handles toggling the navigation menu for small screens.
*/
( function() {
var button = document.getElementById( 'site-navigation' ).getElementsByTagName( 'h1' )[0],
menu = document.getElementById( 'site-navigation' ).getElementsByTagName( 'ul' )[0];
container = document.getElementById( 'site-navigation' );
if ( undefined == button || undefined == menu )
return false;
button.onclick = function() {
if ( -1 == menu.className.indexOf( 'nav-menu' ) )
menu.className = 'nav-menu';
if ( -1 != button.className.indexOf( 'toggled-on' ) ) {
button.className = button.className.replace( ' toggled-on', '' );
menu.className = menu.className.replace( ' toggled-on', '' );
container.className = container.className.replace( ' main-small-navigation', ' main-navigation' );
} else {
button.className += ' toggled-on';
menu.className += ' toggled-on';
container.className = container.className.replace( ' main-navigation', ' main-small-navigation' );
}
};
// Hide menu toggle button if menu is empty.
if ( ! menu.childNodes.length )
button.style.display = 'none';
} )();

View File

@ -1,39 +0,0 @@
/**
* Handles toggling the main navigation menu for small screens.
*/
jQuery( document ).ready( function( $ ) {
var $masthead = $( '#masthead' ),
timeout = false;
$.fn.smallMenu = function() {
$masthead.find( '.site-navigation' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' );
$masthead.find( '.site-navigation h1' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );
$( '.menu-toggle' ).unbind( 'click' ).click( function() {
$masthead.find( '.menu' ).toggle();
$( this ).toggleClass( 'toggled-on' );
} );
};
// Check viewport width on first load.
if ( $( window ).width() < 600 )
$.fn.smallMenu();
// Check viewport width when user resizes the browser window.
$( window ).resize( function() {
var browserWidth = $( window ).width();
if ( false !== timeout )
clearTimeout( timeout );
timeout = setTimeout( function() {
if ( browserWidth < 600 ) {
$.fn.smallMenu();
} else {
$masthead.find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' );
$masthead.find( '.site-navigation h1' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' );
$masthead.find( '.menu' ).removeAttr( 'style' );
}
}, 200 );
} );
} );

View File

@ -8,6 +8,6 @@
?> ?>
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search"> <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search">
<label for="s" class="assistive-text"><?php _e( 'Search', '_s' ); ?></label> <label for="s" class="assistive-text"><?php _e( 'Search', '_s' ); ?></label>
<input type="text" class="field" name="s" value="<?php echo esc_attr( get_search_query() ); ?>" id="s" placeholder="<?php esc_attr_e( 'Search &hellip;', '_s' ); ?>" /> <input type="search" class="field" name="s" value="<?php echo esc_attr( get_search_query() ); ?>" id="s" placeholder="<?php esc_attr_e( 'Search &hellip;', '_s' ); ?>" />
<input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', '_s' ); ?>" /> <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', '_s' ); ?>" />
</form> </form>

View File

@ -233,9 +233,9 @@ input[type="submit"] {
cursor: pointer; /* Improves usability and consistency of cursor style between image-type 'input' and others */ cursor: pointer; /* Improves usability and consistency of cursor style between image-type 'input' and others */
-webkit-appearance: button; /* Corrects inability to style clickable 'input' types in iOS */ -webkit-appearance: button; /* Corrects inability to style clickable 'input' types in iOS */
font-size: 12px; font-size: 12px;
font-size: 1.4rem; font-size: 1.2rem;
line-height: 1; line-height: 1;
padding: 1.12em 1.5em 1em; padding: .6em 1em .4em;
text-shadow: 0 1px 0 rgba(255,255,255,.8); text-shadow: 0 1px 0 rgba(255,255,255,.8);
} }
button:hover, button:hover,
@ -282,6 +282,7 @@ input::-moz-focus-inner { /* Corrects inner padding and border displayed oddly i
input[type=text], input[type=text],
input[type=email], input[type=email],
input[type=password], input[type=password],
input[type=search],
textarea { textarea {
color: #666; color: #666;
border: 1px solid #ccc; border: 1px solid #ccc;
@ -290,12 +291,14 @@ textarea {
input[type=text]:focus, input[type=text]:focus,
input[type=email]:focus, input[type=email]:focus,
input[type=password]:focus, input[type=password]:focus,
input[type=search]:focus,
textarea:focus { textarea:focus {
color: #111; color: #111;
} }
input[type=text], input[type=text],
input[type=email], input[type=email],
input[type=password] { input[type=password],
input[type=search] {
padding: 3px; padding: 3px;
} }
textarea { textarea {
@ -400,12 +403,24 @@ a:active {
/* Small menu */ /* Small menu */
.menu-toggle { .menu-toggle {
display: none;
cursor: pointer; cursor: pointer;
} }
.main-small-navigation .menu {
.main-small-navigation ul {
display: none; display: none;
} }
@media screen and (max-width: 600px) {
.menu-toggle,
.main-small-navigation ul.nav-menu.toggled-on {
display: block;
}
.main-navigation ul {
display: none;
}
}
/* =Content /* =Content
----------------------------------------------- */ ----------------------------------------------- */