updated source to latest

This commit is contained in:
Brandon Mathis 2012-05-24 23:05:33 -05:00
parent 4efb88c72a
commit a15cecf323
10 changed files with 150 additions and 150 deletions

View File

@ -8,7 +8,7 @@
<a href="https://github.com/{{site.github_user}}">@{{site.github_user}}</a> on GitHub <a href="https://github.com/{{site.github_user}}">@{{site.github_user}}</a> on GitHub
{% endif %} {% endif %}
<script type="text/javascript"> <script type="text/javascript">
$.domReady(function(){ $(document).ready(function(){
if (!window.jXHR){ if (!window.jXHR){
var jxhr = document.createElement('script'); var jxhr = document.createElement('script');
jxhr.type = 'text/javascript'; jxhr.type = 'text/javascript';
@ -18,10 +18,10 @@
} }
github.showRepos({ github.showRepos({
user: '{{site.github_user}}', user: '{{site.github_user}}'
count: {{site.github_repo_count}}, , count: {{site.github_repo_count}}
skip_forks: {{site.github_skip_forks}}, , skip_forks: {{site.github_skip_forks}}
target: '#gh_repos' , target: '#gh_repos'
}); });
}); });
</script> </script>

View File

@ -5,15 +5,13 @@
<p><a href="http://pinboard.in/u:{{ site.pinboard_user }}">My Pinboard Bookmarks &raquo;</a></p> <p><a href="http://pinboard.in/u:{{ site.pinboard_user }}">My Pinboard Bookmarks &raquo;</a></p>
</section> </section>
<script type="text/javascript"> <script type="text/javascript">
var linkroll = 'pinboard_linkroll'; //id target for pinboard list $(document).ready(function(){
var pinboard_user = "{{ site.pinboard_user }}"; //id target for pinboard list pinboard.getFeed({
var pinboard_count = {{ site.pinboard_count }}; //id target for pinboard list target: 'pinboard_linkroll' //id target for pinboard list
(function(){ , user: "{{ site.pinboard_user }}"
var pinboardInit = document.createElement('script'); , count: {{ site.pinboard_count }}
pinboardInit.type = 'text/javascript'; });
pinboardInit.async = true; });
pinboardInit.src = '{{ root_url }}/javascripts/pinboard.js';
document.getElementsByTagName('head')[0].appendChild(pinboardInit);
})();
</script> </script>
<script src="{{ root_url }}/javascripts/pinboard.js" type="text/javascript"></script>
{% endif %} {% endif %}

View File

@ -5,8 +5,12 @@
<li class="loading">Status updating...</li> <li class="loading">Status updating...</li>
</ul> </ul>
<script type="text/javascript"> <script type="text/javascript">
$.domReady(function(){ $(document).ready(function(){
getTwitterFeed("{{site.twitter_user}}", {{site.twitter_tweet_count}}, {{site.twitter_show_replies}}); twitter.getFeed({
user: "{{site.twitter_user}}"
, count: {{site.twitter_tweet_count}}
, replies: {{site.twitter_show_replies}}
});
}); });
</script> </script>
<script src="{{ root_url }}/javascripts/twitter.js" type="text/javascript"> </script> <script src="{{ root_url }}/javascripts/twitter.js" type="text/javascript"> </script>

View File

@ -22,7 +22,7 @@
<link href="{{ root_url }}/favicon.png" rel="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="{{ root_url }}/javascripts/ender.js"></script> <script src="{{ root_url }}/javascripts/jquery.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 %}

View File

@ -3,22 +3,22 @@ var github = (function(){
var i = 0, fragment = '', t = $(target)[0]; var i = 0, fragment = '', t = $(target)[0];
for(i = 0; i < repos.length; i++) { for(i = 0; i < repos.length; i++) {
fragment += '<li><a href="'+repos[i].url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>'; fragment += '<li><a href="'+repos[i].html_url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>';
} }
t.innerHTML = fragment; t.innerHTML = fragment;
} }
return { return {
showRepos: function(options){ showRepos: function(options){
$.ajax({ $.ajax({
url: "http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?" url: "https://api.github.com/users/"+options.user+"/repos?callback=?"
, type: 'jsonp' , dataType: 'jsonp'
, error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); } , error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
, success: function(data) { , success: function(data) {
var repos = []; var repos = [];
if (!data || !data.repositories) { return; } if (!data.data) { return; }
for (var i = 0; i < data.repositories.length; i++) { for (var i = 0; i < data.data.length; i++) {
if (options.skip_forks && data.repositories[i].fork) { continue; } if (options.skip_forks && data.data[i].fork) { continue; }
repos.push(data.repositories[i]); repos.push(data.data[i]);
} }
repos.sort(function(a, b) { repos.sort(function(a, b) {
var aDate = new Date(a.pushed_at).valueOf(), var aDate = new Date(a.pushed_at).valueOf(),

4
source/javascripts/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,14 @@
function getNav() { function getNav() {
var mobileNav = $('nav[role=navigation] ul.main-navigation').before('<fieldset class="mobile-nav"></fieldset>').next().append('<select></select>'); var mainNav = $('ul.main-navigation, ul[role=main-navigation]').before('<fieldset class="mobile-nav">')
mobileNav.children('select').append('<option value="">Navigate&hellip;</option>'); var mobileNav = $('fieldset.mobile-nav').append('<select>');
$('ul[role=main-navigation]').addClass('main-navigation'); mobileNav.find('select').append('<option value="">Navigate&hellip;</option>');
$('ul.main-navigation a').each(function(link) { mainNav.find('a').each(function() {
mobileNav.children('select').append('<option value="'+link.href+'">&raquo; '+link.text+'</option>'); mobileNav.find('select').append('<option value="'+this.href+'">&raquo; '+this.text+'</option>');
}); });
$('ul.subscription a').each(function(link) { $('ul.subscription a').each(function() {
mobileNav.children('select').append('<option value="'+link.href+'">&raquo; '+link.text+'</option>'); mobileNav.find('select').append('<option value="'+this.href+'">&raquo; '+this.text+'</option>');
}); });
mobileNav.children('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; }
}); });
} }
@ -25,35 +25,19 @@ function addSidebarToggler() {
} }
}); });
} }
var sections = $('aside.sidebar > section'); var sections = $('.sidebar section');
if (sections.length > 1) { if (sections.length > 1) {
sections.each(function(section, index){ sections.each(function(index){
if ((sections.length >= 3) && index % 3 === 0) { if ((sections.length >= 3) && index % 3 === 0) {
$(section).addClass("first"); $(this).addClass("first");
} }
var count = ((index +1) % 2) ? "odd" : "even"; var count = ((index +1) % 2) ? "odd" : "even";
$(section).addClass(count); $(this).addClass(count);
}); });
} }
if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); } if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); }
} }
function testFeatures() {
var features = ['maskImage'];
$(features).map(function(feature) {
if (Modernizr.testAllProps(feature)) {
$('html').addClass(feature);
} else {
$('html').addClass('no-'+feature);
}
});
if ("placeholder" in document.createElement("input")) {
$('html').addClass('placeholder');
} else {
$('html').addClass('no-placeholder');
}
}
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) {
@ -116,8 +100,7 @@ function renderDeliciousLinks(items) {
$('#delicious').html(output); $('#delicious').html(output);
} }
$.domReady(function() { $(document).ready(function() {
testFeatures();
wrapFlashVideos(); wrapFlashVideos();
flashVideoFallback(); flashVideoFallback();
addCodeLineNumbers(); addCodeLineNumbers();

View File

@ -1,5 +1,5 @@
function pinboardNS_fetch_script(url) { var pinboard = (function(){
//document.writeln('<s'+'cript type="text/javascript" src="' + url + '"></s'+'cript>'); function fetch(url) {
(function(){ (function(){
var pinboardLinkroll = document.createElement('script'); var pinboardLinkroll = document.createElement('script');
pinboardLinkroll.type = 'text/javascript'; pinboardLinkroll.type = 'text/javascript';
@ -9,13 +9,8 @@ function pinboardNS_fetch_script(url) {
})(); })();
} }
function pinboardNS_show_bmarks(r) {
var lr = new Pinboard_Linkroll();
lr.set_items(r);
lr.show_bmarks();
}
function Pinboard_Linkroll() { function linkroll(element) {
var items; var items;
this.set_items = function(i) { this.set_items = function(i) {
@ -28,7 +23,7 @@ function Pinboard_Linkroll() {
var str = this.format_item(item); var str = this.format_item(item);
lines.push(str); lines.push(str);
} }
document.getElementById(linkroll).innerHTML = lines.join("\n"); document.getElementById(element).innerHTML = lines.join("\n");
} }
this.cook = function(v) { this.cook = function(v) {
return v.replace('<', '&lt;').replace('>', '&gt>'); return v.replace('<', '&lt;').replace('>', '&gt>');
@ -51,6 +46,17 @@ function Pinboard_Linkroll() {
return str; return str;
} }
} }
Pinboard_Linkroll.prototype = new Pinboard_Linkroll();
pinboardNS_fetch_script("http://feeds.pinboard.in/json/v1/u:"+pinboard_user+"/?cb=pinboardNS_show_bmarks\&count="+pinboard_count);
return {
getFeed: function(options) {
this.element = options.target;
fetch("http://feeds.pinboard.in/json/v1/u:"+options.user+"/?cb=pinboard.render\&count="+options.count);
},
render: function(data) {
var lr = new linkroll(this.element);
lr.set_items(data);
lr.show_bmarks();
}
}
})();

View File

@ -2,6 +2,7 @@
// (c) Brandon Mathis // MIT License // (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. */ /* 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) { function prettyDate(time) {
if (navigator.appName === 'Microsoft Internet Explorer') { if (navigator.appName === 'Microsoft Internet Explorer') {
return "<span>&infin;</span>"; // because IE date parsing isn't fun. return "<span>&infin;</span>"; // because IE date parsing isn't fun.
@ -39,6 +40,8 @@ function prettyDate(time) {
day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago; day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago;
} }
var twitter = (function(){
function linkifyTweet(text, url) { function linkifyTweet(text, url) {
// Linkify urls, usernames, hashtags // Linkify urls, usernames, hashtags
text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>') text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
@ -57,7 +60,7 @@ function linkifyTweet(text, url) {
return text return text
} }
function showTwitterFeed(tweets, twitter_user) { function render(tweets, twitter_user) {
var timeline = document.getElementById('tweets'), var timeline = document.getElementById('tweets'),
content = ''; content = '';
@ -67,12 +70,15 @@ function showTwitterFeed(tweets, twitter_user) {
timeline.innerHTML = content; timeline.innerHTML = content;
} }
function getTwitterFeed(user, count, replies) { return {
count = parseInt(count, 10); getFeed: function(options){
count = parseInt(options.count, 10);
$.ajax({ $.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=?" 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=?"
, type: 'jsonp' , dataType: 'jsonp'
, error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); } , error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
, success: function(data) { showTwitterFeed(data.slice(0, count), user); } , success: function(data) { render(data.slice(0, count), options.user); }
}) });
} }
}
})();