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

View File

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

View File

@ -5,8 +5,12 @@
<li class="loading">Status updating...</li>
</ul>
<script type="text/javascript">
$.domReady(function(){
getTwitterFeed("{{site.twitter_user}}", {{site.twitter_tweet_count}}, {{site.twitter_show_replies}});
$(document).ready(function(){
twitter.getFeed({
user: "{{site.twitter_user}}"
, count: {{site.twitter_tweet_count}}
, replies: {{site.twitter_show_replies}}
});
});
</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 }}/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/ender.js"></script>
<script src="{{ root_url }}/javascripts/jquery.min.js"></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">
{% include custom/head.html %}

View File

@ -3,22 +3,22 @@ var github = (function(){
var i = 0, fragment = '', t = $(target)[0];
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;
}
return {
showRepos: function(options){
$.ajax({
url: "http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?"
, type: 'jsonp'
url: "https://api.github.com/users/"+options.user+"/repos?callback=?"
, dataType: 'jsonp'
, error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
, success: function(data) {
var repos = [];
if (!data || !data.repositories) { return; }
for (var i = 0; i < data.repositories.length; i++) {
if (options.skip_forks && data.repositories[i].fork) { continue; }
repos.push(data.repositories[i]);
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(),

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() {
var mobileNav = $('nav[role=navigation] ul.main-navigation').before('<fieldset class="mobile-nav"></fieldset>').next().append('<select></select>');
mobileNav.children('select').append('<option value="">Navigate&hellip;</option>');
$('ul[role=main-navigation]').addClass('main-navigation');
$('ul.main-navigation a').each(function(link) {
mobileNav.children('select').append('<option value="'+link.href+'">&raquo; '+link.text+'</option>');
var mainNav = $('ul.main-navigation, ul[role=main-navigation]').before('<fieldset class="mobile-nav">')
var mobileNav = $('fieldset.mobile-nav').append('<select>');
mobileNav.find('select').append('<option value="">Navigate&hellip;</option>');
mainNav.find('a').each(function() {
mobileNav.find('select').append('<option value="'+this.href+'">&raquo; '+this.text+'</option>');
});
$('ul.subscription a').each(function(link) {
mobileNav.children('select').append('<option value="'+link.href+'">&raquo; '+link.text+'</option>');
$('ul.subscription a').each(function() {
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; }
});
}
@ -25,35 +25,19 @@ function addSidebarToggler() {
}
});
}
var sections = $('aside.sidebar > section');
var sections = $('.sidebar section');
if (sections.length > 1) {
sections.each(function(section, index){
sections.each(function(index){
if ((sections.length >= 3) && index % 3 === 0) {
$(section).addClass("first");
$(this).addClass("first");
}
var count = ((index +1) % 2) ? "odd" : "even";
$(section).addClass(count);
$(this).addClass(count);
});
}
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() {
if (navigator.appName === 'Microsoft Internet Explorer') { return; }
$('div.gist-highlight').each(function(code) {
@ -116,8 +100,7 @@ function renderDeliciousLinks(items) {
$('#delicious').html(output);
}
$.domReady(function() {
testFeatures();
$(document).ready(function() {
wrapFlashVideos();
flashVideoFallback();
addCodeLineNumbers();

View File

@ -1,5 +1,5 @@
function pinboardNS_fetch_script(url) {
//document.writeln('<s'+'cript type="text/javascript" src="' + url + '"></s'+'cript>');
var pinboard = (function(){
function fetch(url) {
(function(){
var pinboardLinkroll = document.createElement('script');
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;
this.set_items = function(i) {
@ -28,7 +23,7 @@ function Pinboard_Linkroll() {
var str = this.format_item(item);
lines.push(str);
}
document.getElementById(linkroll).innerHTML = lines.join("\n");
document.getElementById(element).innerHTML = lines.join("\n");
}
this.cook = function(v) {
return v.replace('<', '&lt;').replace('>', '&gt>');
@ -51,6 +46,17 @@ function Pinboard_Linkroll() {
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
/* 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.
@ -39,6 +40,8 @@ function prettyDate(time) {
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>')
@ -57,7 +60,7 @@ function linkifyTweet(text, url) {
return text
}
function showTwitterFeed(tweets, twitter_user) {
function render(tweets, twitter_user) {
var timeline = document.getElementById('tweets'),
content = '';
@ -67,12 +70,15 @@ function showTwitterFeed(tweets, twitter_user) {
timeline.innerHTML = content;
}
function getTwitterFeed(user, count, replies) {
count = parseInt(count, 10);
return {
getFeed: function(options){
count = parseInt(options.count, 10);
$.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=?"
, type: 'jsonp'
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) { showTwitterFeed(data.slice(0, count), user); }
})
, success: function(data) { render(data.slice(0, count), options.user); }
});
}
}
})();