| ... | ... |
@@ -1,43 +1,39 @@ |
| 1 |
-github = (function(){
|
|
| 2 |
- function render(target, repos){
|
|
| 3 |
- var i = 0, fragment = '', t = $(target)[0]; |
|
| 1 |
+var github = (function(){
|
|
| 2 |
+ function render(target, repos){
|
|
| 3 |
+ var i = 0, fragment = '', t = $(target)[0]; |
|
| 4 | 4 |
|
| 5 |
- for(i = 0; i < repos.length; i++) |
|
| 6 |
- fragment += '<li><a href="'+repos[i].url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>'; |
|
| 7 |
- |
|
| 8 |
- t.innerHTML = fragment; |
|
| 5 |
+ for(i = 0; i < repos.length; i++) {
|
|
| 6 |
+ fragment += '<li><a href="'+repos[i].url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>'; |
|
| 9 | 7 |
} |
| 10 |
- return {
|
|
| 11 |
- showRepos: function(options){
|
|
| 12 |
- var feed = new jXHR(); |
|
| 13 |
- feed.onerror = function (msg,url) {
|
|
| 14 |
- $(options.target + ' li.loading').addClass('error').text("Error loading feed");
|
|
| 15 |
- } |
|
| 16 |
- feed.onreadystatechange = function(data){
|
|
| 17 |
- if (feed.readyState === 4) {
|
|
| 18 |
- var repos = []; |
|
| 19 |
- var i; |
|
| 20 |
- for (i = 0; i < data.repositories.length; i++){
|
|
| 21 |
- if (options.skip_forks && data.repositories[i].fork) |
|
| 22 |
- continue; |
|
| 23 |
- repos.push(data.repositories[i]); |
|
| 24 |
- } |
|
| 25 |
- repos.sort(function(a, b){
|
|
| 26 |
- var a = new Date(a.pushed_at), |
|
| 27 |
- b = new Date(b.pushed_at); |
|
| 28 |
- |
|
| 29 |
- if (a.valueOf() == b.valueOf()) return 0; |
|
| 30 |
- return a.valueOf() > b.valueOf() ? -1 : 1; |
|
| 31 |
- }); |
|
| 8 |
+ t.innerHTML = fragment; |
|
| 9 |
+ } |
|
| 10 |
+ return {
|
|
| 11 |
+ showRepos: function(options){
|
|
| 12 |
+ var feed = new jXHR(); |
|
| 13 |
+ feed.onerror = function (msg,url) {
|
|
| 14 |
+ $(options.target + ' li.loading').addClass('error').text("Error loading feed");
|
|
| 15 |
+ }; |
|
| 16 |
+ feed.onreadystatechange = function(data) {
|
|
| 17 |
+ if (feed.readyState === 4) {
|
|
| 18 |
+ var repos = []; |
|
| 19 |
+ for (var i = 0; i < data.repositories.length; i++){
|
|
| 20 |
+ if (options.skip_forks && data.repositories[i].fork) { continue; }
|
|
| 21 |
+ repos.push(data.repositories[i]); |
|
| 22 |
+ } |
|
| 23 |
+ repos.sort(function(a, b) {
|
|
| 24 |
+ var aDate = new Date(a.pushed_at).valueOf(), |
|
| 25 |
+ bDate = new Date(b.pushed_at).valueOf(); |
|
| 32 | 26 |
|
| 33 |
- if (options.count) |
|
| 34 |
- repos.splice(options.count); |
|
| 27 |
+ if (aDate === bDate) { return 0; }
|
|
| 28 |
+ return aDate > bDate ? -1 : 1; |
|
| 29 |
+ }); |
|
| 35 | 30 |
|
| 36 |
- render(options.target, repos) |
|
| 37 |
- } |
|
| 38 |
- }; |
|
| 39 |
- feed.open("GET","http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?");
|
|
| 40 |
- feed.send(); |
|
| 31 |
+ if (options.count) { repos.splice(options.count); }
|
|
| 32 |
+ render(options.target, repos); |
|
| 41 | 33 |
} |
| 42 |
- }; |
|
| 34 |
+ }; |
|
| 35 |
+ feed.open("GET","http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?");
|
|
| 36 |
+ feed.send(); |
|
| 37 |
+ } |
|
| 38 |
+ }; |
|
| 43 | 39 |
})(); |
| 44 | 40 |
\ No newline at end of file |
| ... | ... |
@@ -6,7 +6,7 @@ function getNav() {
|
| 6 | 6 |
mobileNav.children('select').append('<option value="'+link.href+'">• '+link.text+'</option>');
|
| 7 | 7 |
}); |
| 8 | 8 |
mobileNav.children('select').bind('change', function(event) {
|
| 9 |
- if (event.target.value) window.location.href = event.target.value; |
|
| 9 |
+ if (event.target.value) { window.location.href = event.target.value; }
|
|
| 10 | 10 |
}); |
| 11 | 11 |
} |
| 12 | 12 |
|
| ... | ... |
@@ -52,7 +52,7 @@ function testFeatures() {
|
| 52 | 52 |
} |
| 53 | 53 |
|
| 54 | 54 |
function addCodeLineNumbers() {
|
| 55 |
- if (navigator.appName == 'Microsoft Internet Explorer') { return; }
|
|
| 55 |
+ if (navigator.appName === 'Microsoft Internet Explorer') { return; }
|
|
| 56 | 56 |
$('div.gist-highlight').each(function(code) {
|
| 57 | 57 |
var tableStart = '<table><tbody><tr><td class="gutter">', |
| 58 | 58 |
lineNumbers = '<pre class="line-numbers">', |
| ... | ... |
@@ -72,7 +72,7 @@ function flashVideoFallback(){
|
| 72 | 72 |
flashplayerskin = "/assets/jwplayer/glow/glow.xml"; |
| 73 | 73 |
$('video').each(function(video){
|
| 74 | 74 |
video = $(video); |
| 75 |
- if (!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") != -1){
|
|
| 75 |
+ if (!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") !== -1){
|
|
| 76 | 76 |
video.children('source[src$=mp4]').first().map(function(source){
|
| 77 | 77 |
var src = $(source).attr('src'),
|
| 78 | 78 |
id = 'video_'+Math.round(1 + Math.random()*(100000)), |
| ... | ... |
@@ -30,9 +30,9 @@ module Jekyll |
| 30 | 30 |
@img['title'] = title |
| 31 | 31 |
@img['alt'] = alt |
| 32 | 32 |
else |
| 33 |
- @img['alt'] = @img['title'].gsub!(/"/, '"') |
|
| 33 |
+ @img['alt'] = @img['title'].gsub!(/"/, '"') if @img['title'] |
|
| 34 | 34 |
end |
| 35 |
- @img['class'].gsub!(/"/, '') |
|
| 35 |
+ @img['class'].gsub!(/"/, '') if @img['class'] |
|
| 36 | 36 |
end |
| 37 | 37 |
super |
| 38 | 38 |
end |