updated to latest theme

This commit is contained in:
Brandon Mathis 2012-06-07 00:05:12 -05:00
parent c66aa08ed2
commit 08de4df657
7 changed files with 251 additions and 253 deletions

View File

@ -117,7 +117,7 @@ body > nav {
} }
&:hover:after { background-color: lighten($nav-color, 20); } &:hover:after { background-color: lighten($nav-color, 20); }
} }
.cssmask { .maskimage {
body > nav { body > nav {
@media only screen and (min-width: 550px) { @media only screen and (min-width: 550px) {
ul[data-subscription$=email] + form { ul[data-subscription$=email] + form {

View File

@ -5,9 +5,3 @@
{% include twitter_sharing.html %} {% include twitter_sharing.html %}
{% endunless %} {% endunless %}
{% include custom/after_footer.html %} {% include custom/after_footer.html %}
{% if site.github_user %}
<script src="{{ root_url }}/javascripts/github.js" type="text/javascript"></script>
{% endif %}
{% if site.twitter_user %}
<script src="{{ root_url }}/javascripts/twitter.js" type="text/javascript"> </script>
{% endif %}

View File

@ -2,7 +2,7 @@
<section> <section>
<h1>On Delicious</h1> <h1>On Delicious</h1>
<div id="delicious"></div> <div id="delicious"></div>
<script type="text/javascript" src="http://feeds.delicious.com/v2/json/{{ site.delicious_user }}?count={{ site.delicious_count }}&amp;sort=date&amp;callback=renderDeliciousLinks"></script> <script type="text/javascript" src="http://feeds.delicious.com/v2/json/{{ site.delicious_user }}?count={{ site.delicious_count }}&amp;sort=date&amp;callback=octopress.renderDeliciousLinks"></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

@ -1,48 +0,0 @@
var github = (function(){
function render(target, data){
var i = 0, repos = '';
for(i = 0; i < data.length; i++) {
repos += '<li><a href="'+data[i].html_url+'">'+data[i].name+'</a><p>'+data[i].description+'</p></li>';
}
target.html(repos);
}
return {
showRepos: function(options){
$.ajax({
url: "https://api.github.com/users/"+options.user+"/repos?callback=?"
, dataType: 'jsonp'
, error: function (err) { options.target.find('.loading').addClass('error').text("Error loading feed"); }
, success: function(data) {
var repos = [];
if (!data.data) { return; }
for (var i = 0; i < data.data.length; i++) {
if (options.skip_forks && data.data[i].fork) { continue; }
repos.push(data.data[i]);
}
repos.sort(function(a, b) {
var aDate = new Date(a.pushed_at).valueOf(),
bDate = new Date(b.pushed_at).valueOf();
if (aDate === bDate) { return 0; }
return aDate > bDate ? -1 : 1;
});
if (options.count) { repos.splice(options.count); }
render(options.target, repos);
}
});
}
};
})();
$(document).ready(function(){
g = $('#gh_repos');
github.showRepos({
user: g.attr('data-user')
, count: parseInt(g.attr('data-count'))
, skip_forks: g.attr('data-skip') == 'true'
, target: g
});
});

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,6 @@
function getNav() { var octopress = (function(){
return {
getNav: function() {
var mainNav = $('ul.main-navigation, ul[role=main-navigation]').before('<fieldset class="mobile-nav">') var mainNav = $('ul.main-navigation, ul[role=main-navigation]').before('<fieldset class="mobile-nav">')
var mobileNav = $('fieldset.mobile-nav').append('<select>'); var mobileNav = $('fieldset.mobile-nav').append('<select>');
mobileNav.find('select').append('<option value="">Navigate&hellip;</option>'); mobileNav.find('select').append('<option value="">Navigate&hellip;</option>');
@ -11,9 +13,9 @@ function getNav() {
mobileNav.find('select').bind('change', function(event) { mobileNav.find('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() { , addSidebarToggler: function () {
if(!$('body').hasClass('sidebar-footer')) { if(!$('body').hasClass('sidebar-footer')) {
$('#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) {
@ -36,9 +38,8 @@ function addSidebarToggler() {
}); });
} }
if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); } if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); }
} }
, addCodeLineNumbers: function () {
function addCodeLineNumbers() {
if (navigator.appName === 'Microsoft Internet Explorer') { return; } if (navigator.appName === 'Microsoft Internet Explorer') { return; }
$('div.gist-highlight').each(function(index) { $('div.gist-highlight').each(function(index) {
var tableStart = '<table><tbody><tr><td class="gutter">', var tableStart = '<table><tbody><tr><td class="gutter">',
@ -52,9 +53,17 @@ function addCodeLineNumbers() {
var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', this).html()+'</pre>' + tableEnd; var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', this).html()+'</pre>' + tableEnd;
$(this).html(table); $(this).html(table);
}); });
} }
function flashVideoFallback(){ , testFeatures: function () {
if (Modernizr.testAllProps('maskImage')) {
$('html').addClass('maskimage')
} else {
$('html').addClass('no-maskimage')
}
}
, flashVideoFallback: function (){
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){
@ -74,9 +83,9 @@ function flashVideoFallback(){
video.remove(); video.remove();
} }
}); });
} }
function wrapFlashVideos() { , wrapFlashVideos: function () {
$('object').each(function(object) { $('object').each(function(object) {
object = $(object); object = $(object);
if ( $('param[name=movie]', object).length ) { if ( $('param[name=movie]', object).length ) {
@ -89,23 +98,160 @@ function wrapFlashVideos() {
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);
}); });
} }
function renderDeliciousLinks(items) { /* Sky Slavin, Ludopoli. MIT license. * based on JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */
/* Updated considerably by Brandon Mathis */
, prettyDate: function (time) {
if (navigator.appName === 'Microsoft Internet Explorer') {
return "<span>&infin;</span>"; // because IE date parsing isn't fun.
}
var say = {
just_now: " now",
minute_ago: "1m",
minutes_ago: "m",
hour_ago: "1h",
hours_ago: "h",
yesterday: "1d",
days_ago: "d",
last_week: "1w",
weeks_ago: "w"
};
var current_date = new Date(),
current_date_time = current_date.getTime(),
current_date_full = current_date_time + (1 * 60000),
date = new Date(time),
diff = ((current_date_full - date.getTime()) / 1000),
day_diff = Math.floor(diff / 86400);
if (isNaN(day_diff) || day_diff < 0) { return "<span>&infin;</span>"; }
return day_diff === 0 && (
diff < 60 && say.just_now ||
diff < 120 && say.minute_ago ||
diff < 3600 && Math.floor(diff / 60) + say.minutes_ago ||
diff < 7200 && say.hour_ago ||
diff < 86400 && Math.floor(diff / 3600) + say.hours_ago) ||
day_diff === 1 && say.yesterday ||
day_diff < 7 && day_diff + say.days_ago ||
day_diff === 7 && say.last_week ||
day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago;
}
, renderDeliciousLinks: function (items) {
var output = "<ul>"; var output = "<ul>";
for (var i=0,l=items.length; i<l; i++) { for (var i=0,l=items.length; i<l; i++) {
output += '<li><a href="' + items[i].u + '" title="Tags: ' + (items[i].t == "" ? "" : items[i].t.join(', ')) + '">' + items[i].d + '</a></li>'; output += '<li><a href="' + items[i].u + '" title="Tags: ' + (items[i].t == "" ? "" : items[i].t.join(', ')) + '">' + items[i].d + '</a></li>';
} }
output += "</ul>"; output += "</ul>";
$('#delicious').html(output); $('#delicious').html(output);
} }
// Twitter fetcher for Octopress (c) Brandon Mathis // MIT License
, twitter: (function(){
function linkifyTweet(text, url) {
// Linkify urls, usernames, hashtags
text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
.replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
// Use twitter's api to replace t.co shortened urls with expanded ones.
for (var u in url) {
if(url[u].expanded_url != null){
var shortUrl = new RegExp(url[u].url, 'g');
text = text.replace(shortUrl, url[u].expanded_url);
var shortUrl = new RegExp(">"+(url[u].url.replace(/https?:\/\//, '')), 'g');
text = text.replace(shortUrl, ">"+url[u].display_url);
}
}
return text
}
function render(tweets, twitter_user) {
var timeline = document.getElementById('tweets'),
content = '';
for (var t in tweets) {
content += '<li>'+'<p>'+'<a href="http://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+octopress.prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>';
}
timeline.innerHTML = content;
}
return {
getFeed: function(target){
target = $(target);
if (target.length == 0) return;
var user = target.attr('data-user');
var count = parseInt(target.attr('data-count'), 10);
var replies = target.attr('data-replies') == 'true';
$.ajax({
url: "http://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (count + 20) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
, dataType: 'jsonp'
, error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
, success: function(data) { render(data.slice(0, count), user); }
});
}
}
})()
, github: (function(){
function render(target, data){
var i = 0, repos = '';
for(i = 0; i < data.length; i++) {
repos += '<li><a href="'+data[i].html_url+'">'+data[i].name+'</a><p>'+data[i].description+'</p></li>';
}
target.html(repos);
}
return {
showRepos: function(target){
target = $(target);
if (target.length == 0) return;
var user = target.attr('data-user')
var count = parseInt(target.attr('data-count'))
var skip_forks = target.attr('data-skip') == 'true'
$.ajax({
url: "https://api.github.com/users/"+user+"/repos?callback=?"
, dataType: 'jsonp'
, error: function (err) { target.find('.loading').addClass('error').text("Error loading feed"); }
, success: function(data) {
var repos = [];
if (!data.data) { return; }
for (var i = 0; i < data.data.length; i++) {
if (skip_forks && data.data[i].fork) { continue; }
repos.push(data.data[i]);
}
repos.sort(function(a, b) {
var aDate = new Date(a.pushed_at).valueOf(),
bDate = new Date(b.pushed_at).valueOf();
if (aDate === bDate) { return 0; }
return aDate > bDate ? -1 : 1;
});
if (count) { repos.splice(count); }
render(target, repos);
}
});
}
};
})()
}
})();
$(document).ready(function() { $(document).ready(function() {
wrapFlashVideos(); octopress.wrapFlashVideos();
flashVideoFallback(); octopress.testFeatures();
addCodeLineNumbers(); octopress.flashVideoFallback();
getNav(); octopress.addCodeLineNumbers();
addSidebarToggler(); octopress.getNav();
octopress.addSidebarToggler();
octopress.twitter.getFeed('#tweets')
octopress.github.showRepos('#gh_repos');
}); });
// iOS scaling bug fix // iOS scaling bug fix

View File

@ -1,94 +0,0 @@
// JSON-P Twitter fetcher for Octopress
// (c) Brandon Mathis // MIT License
/* Sky Slavin, Ludopoli. MIT license. * based on JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */
/* Updated considerably by Brandon Mathis */
function prettyDate(time) {
if (navigator.appName === 'Microsoft Internet Explorer') {
return "<span>&infin;</span>"; // because IE date parsing isn't fun.
}
var say = {
just_now: " now",
minute_ago: "1m",
minutes_ago: "m",
hour_ago: "1h",
hours_ago: "h",
yesterday: "1d",
days_ago: "d",
last_week: "1w",
weeks_ago: "w"
};
var current_date = new Date(),
current_date_time = current_date.getTime(),
current_date_full = current_date_time + (1 * 60000),
date = new Date(time),
diff = ((current_date_full - date.getTime()) / 1000),
day_diff = Math.floor(diff / 86400);
if (isNaN(day_diff) || day_diff < 0) { return "<span>&infin;</span>"; }
return day_diff === 0 && (
diff < 60 && say.just_now ||
diff < 120 && say.minute_ago ||
diff < 3600 && Math.floor(diff / 60) + say.minutes_ago ||
diff < 7200 && say.hour_ago ||
diff < 86400 && Math.floor(diff / 3600) + say.hours_ago) ||
day_diff === 1 && say.yesterday ||
day_diff < 7 && day_diff + say.days_ago ||
day_diff === 7 && say.last_week ||
day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago;
}
var twitter = (function(){
function linkifyTweet(text, url) {
// Linkify urls, usernames, hashtags
text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
.replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
// Use twitter's api to replace t.co shortened urls with expanded ones.
for (var u in url) {
if(url[u].expanded_url != null){
var shortUrl = new RegExp(url[u].url, 'g');
text = text.replace(shortUrl, url[u].expanded_url);
var shortUrl = new RegExp(">"+(url[u].url.replace(/https?:\/\//, '')), 'g');
text = text.replace(shortUrl, ">"+url[u].display_url);
}
}
return text
}
function render(tweets, twitter_user) {
var timeline = document.getElementById('tweets'),
content = '';
for (var t in tweets) {
content += '<li>'+'<p>'+'<a href="http://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>';
}
timeline.innerHTML = content;
}
return {
getFeed: function(options){
count = options.count;
console.log(options);
$.ajax({
url: "http://api.twitter.com/1/statuses/user_timeline/" + options.user + ".json?trim_user=true&count=" + (count + 20) + "&include_entities=1&exclude_replies=" + (options.replies ? "0" : "1") + "&callback=?"
, dataType: 'jsonp'
, error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
, success: function(data) { render(data.slice(0, count), options.user); }
});
}
}
})();
$(document).ready(function(){
t = $('#tweets');
twitter.getFeed({
user: t.attr('data-user')
, count: parseInt(t.attr('data-count'), 10)
, replies: t.attr('data-replies') == 'true'
});
});