updated to latest octopress

This commit is contained in:
Brandon Mathis 2011-09-21 15:43:34 -05:00
parent 480b60ddf1
commit 98d2b410fe
18 changed files with 132 additions and 126 deletions

View File

@ -41,7 +41,7 @@ body {
max-width: $max-width; max-width: $max-width;
position: relative; position: relative;
margin: 0 auto; margin: 0 auto;
> header, > nav, > footer, #content > article, #content > div > article, #content > div > section, nav[role=pagination] { > header, > nav, > footer, #content > article, #content > div > article, #content > div > section, nav.pagination {
@extend .group; @extend .group;
padding-left: $pad-min; padding-left: $pad-min;
padding-right: $pad-min; padding-right: $pad-min;
@ -67,7 +67,7 @@ body {
#content { > div, > article { width: 100%; }} #content { > div, > article { width: 100%; }}
aside[role=sidebar] { aside.sidebar {
float: none; float: none;
padding: 0 $pad-min 1px; padding: 0 $pad-min 1px;
background-color: lighten($sidebar-bg, 2); background-color: lighten($sidebar-bg, 2);
@ -88,7 +88,7 @@ aside[role=sidebar] {
body.sidebar-footer { body.sidebar-footer {
@media only screen and (min-width: 750px) { @media only screen and (min-width: 750px) {
aside[role=sidebar]{ @include collapse-sidebar; } aside.sidebar{ @include collapse-sidebar; }
} }
#content { margin-right: 0px; } #content { margin-right: 0px; }
.toggle-sidebar { display: none; } .toggle-sidebar { display: none; }
@ -98,7 +98,7 @@ body.sidebar-footer {
body > header { font-size: 1em; } body > header { font-size: 1em; }
} }
@media only screen and (min-width: 750px) { @media only screen and (min-width: 750px) {
aside[role=sidebar] { @include collapse-sidebar; } aside.sidebar { @include collapse-sidebar; }
} }
@media only screen and (min-width: 768px) { @media only screen and (min-width: 768px) {
body { -webkit-text-size-adjust: auto; } body { -webkit-text-size-adjust: auto; }
@ -120,7 +120,7 @@ body.sidebar-footer {
float: left; float: left;
} }
} }
aside[role=sidebar] { aside.sidebar {
@extend .group; @extend .group;
width: $sidebar-width-medium - $sidebar-pad-medium*2; width: $sidebar-width-medium - $sidebar-pad-medium*2;
padding: 0 $sidebar-pad-medium $sidebar-pad-medium; padding: 0 $sidebar-pad-medium $sidebar-pad-medium;
@ -147,7 +147,7 @@ body.sidebar-footer {
padding-bottom: $pad-wide/2; padding-bottom: $pad-wide/2;
} }
} }
aside[role=sidebar] { aside.sidebar {
width: $sidebar-width-wide - $sidebar-pad-wide*2; width: $sidebar-width-wide - $sidebar-pad-wide*2;
padding: 1.2em $sidebar-pad-wide $sidebar-pad-wide; padding: 1.2em $sidebar-pad-wide $sidebar-pad-wide;
.collapse-sidebar & { .collapse-sidebar & {

View File

@ -60,7 +60,7 @@ $page-border-bottom: darken($footer-bg, 5) !default;
a { a {
@include link-colors($link-color, $hover: $link-color-hover, $focus: $link-color-hover, $visited: $link-color-visited, $active: $link-color-active); @include link-colors($link-color, $hover: $link-color-hover, $focus: $link-color-hover, $visited: $link-color-visited, $active: $link-color-active);
} }
aside[role=sidebar] a { aside.sidebar a {
@include link-colors($sidebar-link-color, $hover: $sidebar-link-color-hover, $focus: $sidebar-link-color-hover, $active: $sidebar-link-color-active); @include link-colors($sidebar-link-color, $hover: $sidebar-link-color-hover, $focus: $sidebar-link-color-hover, $active: $sidebar-link-color-active);
} }
a { a {

View File

@ -86,7 +86,7 @@ del, s { text-decoration: line-through; }
abbr, acronym { border-bottom: 1px dotted; cursor: help; } abbr, acronym { border-bottom: 1px dotted; cursor: help; }
pre, code, tt { @extend .mono-font; } pre, code, tt { @extend .mono; }
sub, sup { line-height: 0; } sub, sup { line-height: 0; }

View File

@ -121,7 +121,7 @@ article + article {
display: inline-block; display: inline-block;
} }
#content nav[role=pagination] { #content nav.pagination {
text-align: center; text-align: center;
font-size: .95em; font-size: .95em;
div { div {

View File

@ -31,8 +31,8 @@ body > nav {
} }
} }
} }
fieldset[role=site-search]{ float: right; width: 48%; } fieldset[role=search]{ float: right; width: 48%; }
fieldset[role=mobile-nav]{ float: left; width: 48%; fieldset.mobile-nav{ float: left; width: 48%;
select{ width: 100%; font-size: .8em; border: 1px solid #888;} select{ width: 100%; font-size: .8em; border: 1px solid #888;}
} }
ul { display: none; } ul { display: none; }
@ -44,7 +44,7 @@ body > nav {
display: block; display: block;
padding-top: .15em; padding-top: .15em;
} }
ul[role=subscription] { ul.subscription {
margin-left: .8em; margin-left: .8em;
float: right; float: right;
li:last-child a { padding-right: 0; } li:last-child a { padding-right: 0; }
@ -85,8 +85,8 @@ body > nav {
width: $sidebar-width-medium - $pad-medium*2 - $sidebar-pad-medium - 58px; width: $sidebar-width-medium - $pad-medium*2 - $sidebar-pad-medium - 58px;
.search { width: 91%; } .search { width: 91%; }
} }
fieldset[role=mobile-nav] { display: none; } fieldset.mobile-nav { display: none; }
fieldset[role=site-search]{ width: 99%; } fieldset[role=search]{ width: 99%; }
} }
@media only screen and (min-width: 992px) { @media only screen and (min-width: 992px) {
form { form {
@ -130,7 +130,7 @@ body > nav {
} }
} }
} }
ul[role=subscription] { position: relative; top: .2em; li, a { border: 0; padding: 0; }} ul.subscription { position: relative; top: .2em; li, a { border: 0; padding: 0; }}
a[rel=subscribe-rss]{ @include mask-subscription-nav('rss.png'); } a[rel=subscribe-rss]{ @include mask-subscription-nav('rss.png'); }
a[rel=subscribe-email]{ @include mask-subscription-nav('email.png'); } a[rel=subscribe-email]{ @include mask-subscription-nav('email.png'); }
} }

View File

@ -177,7 +177,7 @@ li code {
.s1 { color: $solar-cyan !important; } /* Literal.String.Single */ .s1 { color: $solar-cyan !important; } /* Literal.String.Single */
//.ss { color: #990073 } /* Literal.String.Symbol */ //.ss { color: #990073 } /* Literal.String.Symbol */
//.il { color: #009999 } /* Literal.Number.Integer.Long */ //.il { color: #009999 } /* Literal.Number.Integer.Long */
div { .gd, .gd .x, .gi, .gi .x { display: block; }} div { .gd, .gd .x, .gi, .gi .x { display: inline-block; width: 100%; }}
} }
.highlight, .gist-highlight { .highlight, .gist-highlight {
@ -201,7 +201,7 @@ pre, .highlight, .gist-highlight {
} }
.highlight code { @extend .pre-code; background: #000;} .highlight code { @extend .pre-code; background: #000;}
figure[role=code] { figure.code {
background: none; background: none;
padding: 0; padding: 0;
border: 0; border: 0;

View File

@ -1,7 +1,7 @@
.side-shadow-border { .side-shadow-border {
@include box-shadow(lighten($sidebar-bg, 5) 0 1px); @include box-shadow(lighten($sidebar-bg, 5) 0 1px);
} }
aside[role=sidebar] { aside.sidebar {
color: $sidebar-color; color: $sidebar-color;
text-shadow: lighten($sidebar-bg, 8) 0 1px; text-shadow: lighten($sidebar-bg, 8) 0 1px;
a { @extend .force-wrap; } a { @extend .force-wrap; }

View File

@ -6,7 +6,12 @@
<h1 class="entry-title">{{ page.title | titlecase }}</h1> <h1 class="entry-title">{{ page.title | titlecase }}</h1>
{% endif %} {% endif %}
{% unless page.meta == false %} {% unless page.meta == false %}
<p class="meta">{% include post/date.html %}{{ time }}</p> <p class="meta">
{% include post/date.html %}{{ time }}
{% if site.disqus_short_name and page.comments != false and site.disqus_show_comment_count == true %}
| <a href="{% if index %}{{ root_url }}{{ post.url }}{% endif %}#disqus_thread">Comments</a>
{% endif %}
</p>
{% endunless %} {% endunless %}
</header> </header>
{% endunless %} {% endunless %}

View File

@ -1,7 +1,7 @@
{% if site.delicious_user %} {% if site.delicious_user %}
<section> <section>
<h1>On Delicious</h1> <h1>On Delicious</h1>
<script type="text/javascript" src="http://feeds.delicious.com/v2/js/{{ site.delicious_user }}?title=&count={{ site.delicious_count }}&sort=date&extended"></script> <script type="text/javascript" src="http://feeds.delicious.com/v2/js/{{ site.delicious_user }}?title=&amp;count={{ site.delicious_count }}&amp;sort=date&amp;extended"></script>
<p><a href="http://delicious.com/{{ site.delicious_user }}">My Delicious Bookmarks &raquo;</a></p> <p><a href="http://delicious.com/{{ site.delicious_user }}">My Delicious Bookmarks &raquo;</a></p>
</section> </section>
{% endif %} {% endif %}

View File

@ -0,0 +1,22 @@
{% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %}
{% if site.disqus_short_name and page.comments != false %}
<script type="text/javascript">
(function () {
var disqus_shortname = '{{ site.disqus_short_name }}';
{% if page.comments == true %}
{% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %}
// var disqus_developer = 1;
var disqus_identifier = '{{ site.url }}{{ page.url }}';
var disqus_url = '{{ site.url }}{{ page.url }}';
var disqus_script = 'embed.js'
{% else %}
{% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %}
var disqus_script = 'count.js'
{% endif %}
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
{% endif %}

View File

@ -4,27 +4,25 @@
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]--> <!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>{% if page.title %}{{page.title}} - {% endif %}{{site.title}}</title> <title>{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}</title>
<meta name="author" content="{{site.author}}"> <meta name="author" content="{{ site.author }}">
{% if page.description %}
<meta name="description" content="{{page.description}}"/> {% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ content | raw_content }}{% endif %}{% endcapture %}
{% endif %} <meta name="description" content="{{ description | strip_newlines | strip_html | truncate:150 }}">
{% if page.keywords %}<meta name="keywords" content="{{ page.keywords }}">{% endif %}
<!-- http://t.co/dKP3o1e --> <!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True"> <meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320"> <meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
{% if page.keywords %}
<meta name="keywords" content="{{page.keywords}}"/>
{% endif %}
{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %} {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %}
<link rel="canonical" href="{{ canonical }}"> <link rel="canonical" href="{{ canonical }}">
<link href="{{ root_url }}/favicon.png" rel="shortcut icon" /> <link href="{{ root_url }}/favicon.png" rel="icon">
<link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> <link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script> <script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script>
<script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script> <script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script>
<script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script> <script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script>
<link href="{{ site.subscribe_rss }}" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> <link href="{{ site.subscribe_rss }}" rel="alternate" title="{{site.title}}" type="application/atom+xml">
{% include custom/head.html %} {% include custom/head.html %}
</head> </head>

View File

@ -1,11 +1,11 @@
<ul role=subscription data-subscription="rss{% if site.subscribe_email %} email{% endif %}"> <ul class="subscription" data-subscription="rss{% if site.subscribe_email %} email{% endif %}">
<li><a href="{{ site.subscribe_rss }}" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li> <li><a href="{{ site.subscribe_rss }}" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
{% if site.subscribe_email %} {% if site.subscribe_email %}
<li><a href="{{ site.subscribe_email }}" rel="subscribe-email" title="subscribe via email">Email</a></li> <li><a href="{{ site.subscribe_email }}" rel="subscribe-email" title="subscribe via email">Email</a></li>
{% endif %} {% endif %}
</ul> </ul>
<form action="{{ site.simple_search }}" method="get"> <form action="{{ site.simple_search }}" method="get">
<fieldset role="site-search"> <fieldset role="search">
<input type="hidden" name="q" value="site:{{ site.url | shorthand_url }}" /> <input type="hidden" name="q" value="site:{{ site.url | shorthand_url }}" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/> <input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset> </fieldset>

View File

@ -1,13 +1 @@
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = '{{ site.disqus_short_name }}';
var disqus_identifier = '{{ site.url }}{{ page.url }}';
var disqus_url = '{{ site.url }}{{ page.url }}';
//var disqus_developer = 1;
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

View File

@ -1,14 +1,15 @@
{% capture root_url %}{{ site.root | strip_slash }}{% endcapture %} {% capture root_url %}{{ site.root | strip_slash }}{% endcapture %}
{% include head.html %} {% include head.html %}
<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %}> <body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %}>
<header>{% include header.html %}</header> <header role="banner">{% include header.html %}</header>
<nav role=navigation>{% include navigation.html %}</nav> <nav role="navigation">{% include navigation.html %}</nav>
<div id="main"> <div id="main">
<div id="content"> <div id="content">
{{ content | expand_urls: root_url }} {{ content | expand_urls: root_url }}
</div> </div>
</div> </div>
<footer>{% include footer.html %}</footer> <footer role="contentinfo">{% include footer.html %}</footer>
{% include disqus.html %}
{% include google_analytics.html %} {% include google_analytics.html %}
{% include google_plus_one.html %} {% include google_plus_one.html %}
{% include twitter_sharing.html %} {% include twitter_sharing.html %}

View File

@ -3,7 +3,7 @@ layout: default
--- ---
<div> <div>
<article> <article role="article">
{% if page.title %} {% if page.title %}
<header> <header>
<h1 class="entry-title">{{ page.title | titlecase }}</h1> <h1 class="entry-title">{{ page.title | titlecase }}</h1>
@ -27,12 +27,12 @@ layout: default
{% if site.disqus_short_name and page.comments == true %} {% if site.disqus_short_name and page.comments == true %}
<section> <section>
<h1>Comments</h1> <h1>Comments</h1>
<div id="disqus_thread">{% include post/disqus_thread.html %}</div> <div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div>
</section> </section>
{% endif %} {% endif %}
</div> </div>
{% unless page.sidebar == false %} {% unless page.sidebar == false %}
<aside role=sidebar> <aside class="sidebar">
{% if site.page_asides.size %} {% if site.page_asides.size %}
{% include_array page_asides %} {% include_array page_asides %}
{% else %} {% else %}

View File

@ -4,7 +4,7 @@ single: true
--- ---
<div> <div>
<article class="hentry"> <article class="hentry" role="article">
{% include article.html %} {% include article.html %}
<footer> <footer>
<p class="meta"> <p class="meta">
@ -17,15 +17,15 @@ single: true
{% endunless %} {% endunless %}
</footer> </footer>
</article> </article>
{% if site.disqus_short_name and page.comments != false %} {% if site.disqus_short_name and page.comments == true %}
<section> <section>
<h1>Comments</h1> <h1>Comments</h1>
<div id="disqus_thread">{% include post/disqus_thread.html %}</div> <div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div>
</section> </section>
{% endif %} {% endif %}
</div> </div>
{% unless page.sidebar == false %} {% unless page.sidebar == false %}
<aside role=sidebar> <aside class="sidebar">
{% if site.post_asides.size %} {% if site.post_asides.size %}
{% include_array post_asides %} {% include_array post_asides %}
{% else %} {% else %}

View File

@ -3,37 +3,26 @@ layout: default
--- ---
<div class="blog-index"> <div class="blog-index">
{% assign index = true %} {% assign index = true %}
{% for post in paginator.posts %} {% for post in paginator.posts %}
{% assign content = post.content %} {% assign content = post.content %}
<article> <article>
{% include article.html %} {% include article.html %}
</article> </article>
{% endfor %} {% endfor %}
<nav role="pagination"> <nav class="pagination">
<div> <div>
{% if paginator.next_page %} {% if paginator.next_page %}
<a class="prev" href="{{paginator.next_page}}">&larr; Older</a> <a class="prev" href="{{paginator.next_page}}">&larr; Older</a>
{% endif %} {% endif %}
<a href="/blog/archives">Blog Archives</a> <a href="/blog/archives">Blog Archives</a>
{% if paginator.previous_page %} {% if paginator.previous_page %}
<a class="next" href="{{paginator.previous_page}}">Newer &rarr;</a> <a class="next" href="{{paginator.previous_page}}">Newer &rarr;</a>
{% endif %} {% endif %}
</div> </div>
</nav> </nav>
{% if site.disqus_short_name %}
<script type="text/javascript">
var disqus_shortname = '{{ site.disqus_short_name }}';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
{% endif %}
</div> </div>
<aside role=sidebar> <aside class="sidebar">
{% if site.blog_index_asides.size %} {% if site.blog_index_asides.size %}
{% include_array blog_index_asides %} {% include_array blog_index_asides %}
{% else %} {% else %}

View File

@ -1,38 +1,40 @@
function getNav(){ function getNav() {
var mobileNav = $('nav[role=navigation] fieldset[role=site-search]').after('<fieldset role="mobile-nav"></fieldset>').next().append('<select></select>'); var mobileNav = $('nav[role=navigation] fieldset[role=search]').after('<fieldset class="mobile-nav"></fieldset>').next().append('<select></select>');
mobileNav.children('select').append('<option value="">Navigate&hellip;</option>'); mobileNav.children('select').append('<option value="">Navigate&hellip;</option>');
$($('ul[role=main-navigation] a')).each(function(link) { $('ul.main-navigation a').each(function(link) {
mobileNav.children('select').append('<option value="'+link.href+'">&bull; '+link.text+'</option>') mobileNav.children('select').append('<option value="'+link.href+'">&bull; '+link.text+'</option>');
}); });
mobileNav.children('select').bind('change', function(event){ mobileNav.children('select').bind('change', function(event) {
if (event.target.value) window.location.href = event.target.value; if (event.target.value) window.location.href = event.target.value;
}); });
} }
function addSidebarToggler() { function addSidebarToggler() {
$('#content').append('<span class="toggle-sidebar"></span>'); $('#content').append('<span class="toggle-sidebar"></span>');
$('.toggle-sidebar').bind('click', function(e){ $('.toggle-sidebar').bind('click', function(e) {
e.preventDefault(); e.preventDefault();
if($('body').hasClass('collapse-sidebar')){ if ($('body').hasClass('collapse-sidebar')) {
$('body').removeClass('collapse-sidebar'); $('body').removeClass('collapse-sidebar');
} else { } else {
$('body').addClass('collapse-sidebar'); $('body').addClass('collapse-sidebar');
} }
}); });
sections = $('aside[role=sidebar] > section') var sections = $('aside.sidebar > section');
if(sections.length > 1){ if (sections.length > 1) {
sections.each(function(section, index){ sections.each(function(section, index){
if ((sections.length >= 3) && index % 3 == 0) { if ((sections.length >= 3) && index % 3 === 0) {
$(section).addClass("first"); $(section).addClass("first");
} }
count = ((index +1) % 2) ? "odd" : "even"; var count = ((index +1) % 2) ? "odd" : "even";
$(section).addClass(count); $(section).addClass(count);
}); });
} }
if(sections.length >= 3){ $('aside[role=sidebar]').addClass('thirds') } if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); }
} }
function testFeatures() { function testFeatures() {
var features = ['maskImage']; var features = ['maskImage'];
$(features).map(function(feature){ $(features).map(function(feature) {
if (Modernizr.testAllProps(feature)) { if (Modernizr.testAllProps(feature)) {
$('html').addClass(feature); $('html').addClass(feature);
} else { } else {
@ -46,59 +48,60 @@ function testFeatures() {
} }
} }
function addCodeLineNumbers(){ function addCodeLineNumbers() {
if (navigator.appName == 'Microsoft Internet Explorer') { return } if (navigator.appName == 'Microsoft Internet Explorer') { return; }
$('div.gist-highlight').each(function(code){ $('div.gist-highlight').each(function(code) {
var tableStart = '<table cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter">'; var tableStart = '<table><tbody><tr><td class="gutter">',
var lineNumbers = '<pre class="line-numbers">'; lineNumbers = '<pre class="line-numbers">',
var tableMiddle = '</pre></td><td class="code" width="100%">'; tableMiddle = '</pre></td><td class="code">',
var tableEnd = '</td></tr></tbody></table>'; tableEnd = '</td></tr></tbody></table>',
var count = $('div.line', code).length; count = $('span.line', code).length;
for (i=1;i<=count; i++){ for (var i=1;i<=count; i++) {
lineNumbers += '<span class="line">'+i+'</span>\n'; lineNumbers += '<span class="line-number">'+i+'</span>\n';
} }
table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd; var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd;
$(code).html(table); $(code).html(table);
}); });
} }
function flashVideoFallback(){ function flashVideoFallback(){
var flashplayerlocation = "/assets/jwplayer/player.swf", var flashplayerlocation = "/assets/jwplayer/player.swf",
flashplayerskin = "/assets/jwplayer/glow/glow.xml"; flashplayerskin = "/assets/jwplayer/glow/glow.xml";
$('video').each(function(video){ $('video').each(function(video){
video = $(video); video = $(video);
if(!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") != -1){ if (!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") != -1){
video.children('source[src$=mp4]').first().map(function(source){; video.children('source[src$=mp4]').first().map(function(source){
var src = $(source).attr('src'), var src = $(source).attr('src'),
id = 'video_'+Math.round(1 + Math.random()*(100000)), id = 'video_'+Math.round(1 + Math.random()*(100000)),
width = video.attr('width'), width = video.attr('width'),
height = parseInt(video.attr('height')) + 30; height = parseInt(video.attr('height'), 10) + 30;
video.after('<div class="flash-video"><div><div id='+id+'>'); video.after('<div class="flash-video"><div><div id='+id+'>');
swfobject.embedSWF(flashplayerlocation, id, width, height + 30, "9.0.0", swfobject.embedSWF(flashplayerlocation, id, width, height + 30, "9.0.0",
{ file : src, image : video.attr('poster'), skin : flashplayerskin } , { file : src, image : video.attr('poster'), skin : flashplayerskin } ,
{ movie : src, wmode : "opaque", allowfullscreen : "true" }); { movie : src, wmode : "opaque", allowfullscreen : "true" }
);
}); });
video.remove(); video.remove();
} }
}); });
} }
function wrapFlashVideos(){ function wrapFlashVideos() {
$('object').each(function(object){ $('object').each(function(object) {
object = $(object); object = $(object);
if(object.children('param[name=movie]')){ if (object.children('param[name=movie]')) {
var wrapper = object.before('<div class="flash-video"><div>').previous(); var wrapper = object.before('<div class="flash-video"><div>').previous();
$(wrapper).children().append(object); $(wrapper).children().append(object);
} }
}); });
$('iframe[src*=vimeo],iframe[src*=youtube]').each(function(iframe){ $('iframe[src*=vimeo],iframe[src*=youtube]').each(function(iframe) {
iframe = $(iframe); iframe = $(iframe);
var wrapper = iframe.before('<div class="flash-video"><div>').previous(); var wrapper = iframe.before('<div class="flash-video"><div>').previous();
$(wrapper).children().append(iframe); $(wrapper).children().append(iframe);
}); });
} }
$.domReady(function(){ $.domReady(function() {
testFeatures(); testFeatures();
wrapFlashVideos(); wrapFlashVideos();
flashVideoFallback(); flashVideoFallback();
@ -113,17 +116,17 @@ $.domReady(function(){
// Source url: https://gist.github.com/901295 // Source url: https://gist.github.com/901295
(function(doc) { (function(doc) {
var addEvent = 'addEventListener', var addEvent = 'addEventListener',
type = 'gesturestart', type = 'gesturestart',
qsa = 'querySelectorAll', qsa = 'querySelectorAll',
scales = [1, 1], scales = [1, 1],
meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : []; meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
function fix() { function fix() {
meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1]; meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
doc.removeEventListener(type, fix, true); doc.removeEventListener(type, fix, true);
} }
if ((meta = meta[meta.length - 1]) && addEvent in doc) { if ((meta = meta[meta.length - 1]) && addEvent in doc) {
fix(); fix();
scales = [.25, 1.6]; scales = [0.25, 1.6];
doc[addEvent](type, fix, true); doc[addEvent](type, fix, true);
} }
}(document)); }(document));