octopress 3.0.0.alpha1 → 3.0.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/octopress.rb +3 -2
- data/lib/octopress/commands/build_jekyll.rb +17 -0
- data/lib/octopress/commands/build_stylesheets.rb +1 -1
- data/lib/octopress/commands/install.rb +2 -3
- data/lib/octopress/commands/new.rb +1 -1
- data/lib/octopress/commands/scaffold.rb +3 -2
- data/lib/octopress/commands/serve.rb +1 -1
- data/lib/octopress/configuration.rb +7 -1
- data/lib/octopress/installer.rb +15 -11
- data/lib/octopress/{js_asset_manager.rb → js_assets_manager.rb} +0 -1
- data/lib/octopress/scaffold/site/config.ru +25 -0
- data/lib/octopress/version.rb +1 -1
- data/octopress.gemspec +1 -1
- metadata +5 -161
- data/.themes/classic/.editorconfig +0 -44
- data/.themes/classic/_config/adn-timeline.yml +0 -10
- data/.themes/classic/_config/delicious-feed.yml +0 -4
- data/.themes/classic/_config/deploy/gh_pages.yml +0 -9
- data/.themes/classic/_config/deploy/rsync.yml +0 -14
- data/.themes/classic/_config/disqus.yml +0 -11
- data/.themes/classic/_config/facebook-like.yml +0 -2
- data/.themes/classic/_config/gauges-analytics.yml +0 -6
- data/.themes/classic/_config/github-repos.yml +0 -24
- data/.themes/classic/_config/google-analytics.yml +0 -6
- data/.themes/classic/_config/google-plus.yml +0 -13
- data/.themes/classic/_config/jekyll.yml +0 -37
- data/.themes/classic/_config/pinboard-feed.yml +0 -4
- data/.themes/classic/_config/require-js.yml +0 -19
- data/.themes/classic/_config/theme.yml +0 -54
- data/.themes/classic/_config/twitter-timeline.yml +0 -9
- data/.themes/classic/assets/javascripts/lib/ios-rotate-scaling-fix.js +0 -18
- data/.themes/classic/assets/javascripts/lib/jquery.cookie.js +0 -92
- data/.themes/classic/assets/javascripts/lib/modernizr.js +0 -447
- data/.themes/classic/assets/javascripts/lib/octopress.js +0 -83
- data/.themes/classic/assets/javascripts/modules/adn-timeline.coffee +0 -68
- data/.themes/classic/assets/javascripts/modules/delicious-feed.coffee +0 -38
- data/.themes/classic/assets/javascripts/modules/github-repos.coffee +0 -60
- data/.themes/classic/assets/javascripts/modules/github.coffee +0 -60
- data/.themes/classic/assets/javascripts/modules/helpers.coffee +0 -96
- data/.themes/classic/assets/javascripts/modules/pinboard-feed.coffee +0 -42
- data/.themes/classic/assets/javascripts/modules/site.coffee +0 -11
- data/.themes/classic/assets/stylesheets/_base.scss +0 -5
- data/.themes/classic/assets/stylesheets/_partials.scss +0 -8
- data/.themes/classic/assets/stylesheets/base/_layout.scss +0 -191
- data/.themes/classic/assets/stylesheets/base/_solarized.scss +0 -75
- data/.themes/classic/assets/stylesheets/base/_theme.scss +0 -92
- data/.themes/classic/assets/stylesheets/base/_typography.scss +0 -168
- data/.themes/classic/assets/stylesheets/base/_utilities.scss +0 -27
- data/.themes/classic/assets/stylesheets/custom/_colors.scss +0 -49
- data/.themes/classic/assets/stylesheets/custom/_fonts.scss +0 -10
- data/.themes/classic/assets/stylesheets/custom/_layout.scss +0 -17
- data/.themes/classic/assets/stylesheets/custom/_styles.scss +0 -2
- data/.themes/classic/assets/stylesheets/partials/_archive.scss +0 -77
- data/.themes/classic/assets/stylesheets/partials/_blog.scss +0 -165
- data/.themes/classic/assets/stylesheets/partials/_footer.scss +0 -19
- data/.themes/classic/assets/stylesheets/partials/_header.scss +0 -18
- data/.themes/classic/assets/stylesheets/partials/_navigation.scss +0 -136
- data/.themes/classic/assets/stylesheets/partials/_sharing.scss +0 -73
- data/.themes/classic/assets/stylesheets/partials/_sidebar.scss +0 -4
- data/.themes/classic/assets/stylesheets/partials/_syntax.scss +0 -234
- data/.themes/classic/assets/stylesheets/partials/sidebar/_base.scss +0 -106
- data/.themes/classic/assets/stylesheets/partials/sidebar/_delicious.scss +0 -4
- data/.themes/classic/assets/stylesheets/partials/sidebar/_googleplus.scss +0 -26
- data/.themes/classic/assets/stylesheets/partials/sidebar/_pinboard.scss +0 -12
- data/.themes/classic/assets/stylesheets/plugins/_plugins.scss +0 -5
- data/.themes/classic/assets/stylesheets/screen.scss +0 -11
- data/.themes/classic/source/404.markdown +0 -9
- data/.themes/classic/source/_includes/after_footer.html +0 -7
- data/.themes/classic/source/_includes/archive_post.html +0 -12
- data/.themes/classic/source/_includes/article.html +0 -23
- data/.themes/classic/source/_includes/comments.html +0 -9
- data/.themes/classic/source/_includes/custom/after_footer.html +0 -3
- data/.themes/classic/source/_includes/custom/after_page.html +0 -1
- data/.themes/classic/source/_includes/custom/after_post.html +0 -0
- data/.themes/classic/source/_includes/custom/comments.html +0 -5
- data/.themes/classic/source/_includes/custom/footer.html +0 -4
- data/.themes/classic/source/_includes/custom/head.html +0 -7
- data/.themes/classic/source/_includes/custom/header.html +0 -6
- data/.themes/classic/source/_includes/custom/navigation.html +0 -4
- data/.themes/classic/source/_includes/custom/page_meta.html +0 -1
- data/.themes/classic/source/_includes/custom/post_meta.html +0 -1
- data/.themes/classic/source/_includes/custom/sharing.html +0 -3
- data/.themes/classic/source/_includes/disqus.html +0 -22
- data/.themes/classic/source/_includes/facebook_like.html +0 -10
- data/.themes/classic/source/_includes/feed_entry.xml +0 -10
- data/.themes/classic/source/_includes/footer.html +0 -1
- data/.themes/classic/source/_includes/gauges_analytics.html +0 -15
- data/.themes/classic/source/_includes/google_analytics.html +0 -13
- data/.themes/classic/source/_includes/google_plus_one.html +0 -9
- data/.themes/classic/source/_includes/head.html +0 -33
- data/.themes/classic/source/_includes/header.html +0 -1
- data/.themes/classic/source/_includes/navigation.html +0 -15
- data/.themes/classic/source/_includes/post/author.html +0 -8
- data/.themes/classic/source/_includes/post/categories.html +0 -10
- data/.themes/classic/source/_includes/post/date.html +0 -15
- data/.themes/classic/source/_includes/post/disqus_thread.html +0 -1
- data/.themes/classic/source/_includes/post/meta.html +0 -3
- data/.themes/classic/source/_includes/post/sharing.html +0 -36
- data/.themes/classic/source/_includes/post/title.html +0 -5
- data/.themes/classic/source/_includes/post/variables.html +0 -14
- data/.themes/classic/source/_includes/sidebars/blog_index_default.html +0 -3
- data/.themes/classic/source/_includes/sidebars/page_default.html +0 -4
- data/.themes/classic/source/_includes/sidebars/post_default.html +0 -4
- data/.themes/classic/source/_includes/sidebars/sections/delicious.html +0 -8
- data/.themes/classic/source/_includes/sidebars/sections/github.html +0 -9
- data/.themes/classic/source/_includes/sidebars/sections/google_plus.html +0 -5
- data/.themes/classic/source/_includes/sidebars/sections/pinboard.html +0 -17
- data/.themes/classic/source/_includes/sidebars/sections/recent_posts.html +0 -10
- data/.themes/classic/source/_includes/twitter_sharing.html +0 -11
- data/.themes/classic/source/_layouts/category_feed.xml +0 -24
- data/.themes/classic/source/_layouts/category_index.html +0 -19
- data/.themes/classic/source/_layouts/default.html +0 -14
- data/.themes/classic/source/_layouts/page.html +0 -34
- data/.themes/classic/source/_layouts/post.html +0 -39
- data/.themes/classic/source/archives/index.html +0 -20
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/background.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/blankButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/divider.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/fullscreenButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/fullscreenButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/muteButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/muteButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/normalscreenButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/normalscreenButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/pauseButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/pauseButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/playButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/playButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderBuffer.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderCapLeft.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderCapRight.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderProgress.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderRail.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/unmuteButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/unmuteButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/background.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/bufferIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/muteIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/playIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/dock/button.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/glow.xml +0 -115
- data/.themes/classic/source/assets/jwplayer/glow/playlist/item.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/itemOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderCapBottom.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderCapTop.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderRail.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderThumb.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/embedIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/embedScreen.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/shareIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/shareScreen.png +0 -0
- data/.themes/classic/source/assets/jwplayer/player.swf +0 -0
- data/.themes/classic/source/atom.xml +0 -23
- data/.themes/classic/source/images/bird_32_gray.png +0 -0
- data/.themes/classic/source/images/bird_32_gray_fail.png +0 -0
- data/.themes/classic/source/images/code_bg.png +0 -0
- data/.themes/classic/source/images/dotted-border.png +0 -0
- data/.themes/classic/source/images/email.png +0 -0
- data/.themes/classic/source/images/icon/facebook.png +0 -0
- data/.themes/classic/source/images/icon/github.png +0 -0
- data/.themes/classic/source/images/icon/googleplus.png +0 -0
- data/.themes/classic/source/images/icon/twitter-bird.png +0 -0
- data/.themes/classic/source/images/icon/twitter.png +0 -0
- data/.themes/classic/source/images/line-tile.png +0 -0
- data/.themes/classic/source/images/noise.png +0 -0
- data/.themes/classic/source/images/rss.png +0 -0
- data/.themes/classic/source/images/search.png +0 -0
- data/.themes/classic/source/index.html +0 -30
- data/.themes/classic/source/javascripts/jquery.min.js +0 -5
- data/.themes/classic/source/octopress-favicon.png +0 -0
- data/.themes/classic/source/robots.txt +0 -7
@@ -1,83 +0,0 @@
|
|
1
|
-
var octopress = (function(){
|
2
|
-
return {
|
3
|
-
addMobileNav: function () {
|
4
|
-
var mainNav = $('ul.main-navigation, ul[role=main-navigation]').before('<fieldset class="mobile-nav">')
|
5
|
-
var mobileNav = $('fieldset.mobile-nav').append('<select>');
|
6
|
-
mobileNav.find('select').append('<option value="">Navigate…</option>');
|
7
|
-
var addOption = function(i, option) {
|
8
|
-
mobileNav.find('select').append('<option value="' + this.href + '">» ' + $(this).text() + '</option>');
|
9
|
-
}
|
10
|
-
mainNav.find('a').each(addOption);
|
11
|
-
$('ul.subscription a').each(addOption);
|
12
|
-
mobileNav.find('select').bind('change', function(event) {
|
13
|
-
if (event.target.value) { window.location.href = event.target.value; }
|
14
|
-
});
|
15
|
-
}
|
16
|
-
|
17
|
-
, addSidebarToggler: function () {
|
18
|
-
if(!$('body').hasClass('sidebar-footer')) {
|
19
|
-
$('#content').append('<span class="toggle-sidebar"></span>');
|
20
|
-
$('.toggle-sidebar').bind('click', function(e) {
|
21
|
-
e.preventDefault();
|
22
|
-
if ($('body').hasClass('collapse-sidebar')) {
|
23
|
-
$('body').removeClass('collapse-sidebar');
|
24
|
-
} else {
|
25
|
-
$('body').addClass('collapse-sidebar');
|
26
|
-
}
|
27
|
-
});
|
28
|
-
}
|
29
|
-
var sections = $('.sidebar section');
|
30
|
-
if (sections.length > 1) {
|
31
|
-
sections.each(function(index){
|
32
|
-
if ((sections.length >= 3) && index % 3 === 0) {
|
33
|
-
$(this).addClass("first");
|
34
|
-
}
|
35
|
-
var count = ((index +1) % 2) ? "odd" : "even";
|
36
|
-
$(this).addClass(count);
|
37
|
-
});
|
38
|
-
}
|
39
|
-
if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); }
|
40
|
-
}
|
41
|
-
|
42
|
-
, testFeature: function (features) {
|
43
|
-
getTestClasses = function (tests) {
|
44
|
-
classes = '';
|
45
|
-
if (typeof(tests.join) == 'function') {
|
46
|
-
for (var i=0; i < features.length; i++)
|
47
|
-
classes += getClass(features[i]) + ' ';
|
48
|
-
} else {
|
49
|
-
classes = getClass(tests);
|
50
|
-
}
|
51
|
-
return classes;
|
52
|
-
}
|
53
|
-
|
54
|
-
getClass = function (test) {
|
55
|
-
return ((Modernizr.testAllProps(test) ? test : "no-"+test).toLowerCase())
|
56
|
-
}
|
57
|
-
|
58
|
-
$('html').addClass(getTestClasses(features));
|
59
|
-
}
|
60
|
-
|
61
|
-
, wrapFlashVideos: function () {
|
62
|
-
$('object').each(function(i, object) {
|
63
|
-
if( $(object).find('param[name=movie]').length ){
|
64
|
-
o = $(object)
|
65
|
-
ratio = (o.height()/o.width()*100)+'%';
|
66
|
-
o.wrap('<div class="flash-video"><div style="padding-bottom: '+ratio+'">')
|
67
|
-
}
|
68
|
-
});
|
69
|
-
$('iframe[src*=vimeo],iframe[src*=youtube]').each(function(i, video) {
|
70
|
-
v = $(video)
|
71
|
-
ratio = (v.height()/v.width()*100)+'%';
|
72
|
-
$(video).wrap('<div class="flash-video"><div style="padding-bottom: '+ratio+'">')
|
73
|
-
});
|
74
|
-
}
|
75
|
-
}
|
76
|
-
})();
|
77
|
-
|
78
|
-
$(document).ready(function() {
|
79
|
-
octopress.wrapFlashVideos();
|
80
|
-
octopress.testFeature(['maskImage', 'transform']);
|
81
|
-
octopress.addMobileNav();
|
82
|
-
octopress.addSidebarToggler();
|
83
|
-
});
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# App.net fetcher for Octopress (c) Brandon Mathis // MIT License
|
2
|
-
helpers = require('helpers')
|
3
|
-
|
4
|
-
Adn =
|
5
|
-
timeline: []
|
6
|
-
cookie: 'adn-feed'
|
7
|
-
classname: 'adn-feed'
|
8
|
-
|
9
|
-
template: ->
|
10
|
-
helpers.statusFeed @timeline, @classname
|
11
|
-
|
12
|
-
errorTemplate: ->
|
13
|
-
helpers.errorTemplate "Failed to load posts.", @classname
|
14
|
-
|
15
|
-
parseHtml: (post)->
|
16
|
-
text = helpers.trimDisplayUrls post.html
|
17
|
-
text = text.replace "@#{mention.name}", "<a href='https://alpha.app.net/#{mention.name}'>@#{mention.name}</a>" for mention in post.entities.mentions
|
18
|
-
text = text.replace "##{hashtag.name}", "<a href='https://alpha.app.net/hashtags/#{hashtag.name}'>##{hashtag.name}</a>" for hashtag in post.entities.hashtags
|
19
|
-
text
|
20
|
-
|
21
|
-
getPost: (post) ->
|
22
|
-
type = if post.repost_of then 'repost' else 'post'
|
23
|
-
post = if type is 'repost' then post.repost_of else post
|
24
|
-
{
|
25
|
-
type: type
|
26
|
-
url: post.canonical_url
|
27
|
-
date: post.created_at
|
28
|
-
author: { user: post.user.username, name: post.user.name, url: post.user.canonical_url } if type is 'repost'
|
29
|
-
text: @parseHtml post
|
30
|
-
}
|
31
|
-
|
32
|
-
format: (posts, user, options) ->
|
33
|
-
postList = []
|
34
|
-
for post in posts
|
35
|
-
postList.push @getPost(post) unless post.repost_of and !options.reposts
|
36
|
-
postList
|
37
|
-
|
38
|
-
init: (user, options, callback) ->
|
39
|
-
posts = $.cookie @cookie
|
40
|
-
if posts
|
41
|
-
@timeline = JSON.parse(posts)
|
42
|
-
if @timeline.length isnt options.count
|
43
|
-
$.removeCookie @cookie
|
44
|
-
@timeline = []
|
45
|
-
init user, options, callback
|
46
|
-
else
|
47
|
-
callback @template()
|
48
|
-
else
|
49
|
-
url = "https://alpha-api.app.net/stream/0/users/@#{user}/posts?"
|
50
|
-
url += "&max_id=#{options.max_id}" if options.max_id
|
51
|
-
url += "&include_directed_posts=0" unless options.replies
|
52
|
-
url += "&callback=?"
|
53
|
-
|
54
|
-
$.ajax
|
55
|
-
url: url
|
56
|
-
dataType: 'jsonp'
|
57
|
-
error: (err) => callback @errorTemplate
|
58
|
-
success: (response) =>
|
59
|
-
@timeline = @timeline.concat response.data
|
60
|
-
if @timeline.length < options.count
|
61
|
-
options.max_id = response.meta.max_id
|
62
|
-
init user, options, callback
|
63
|
-
else
|
64
|
-
@timeline = @format @timeline.slice(0, options.count), user, options
|
65
|
-
$.cookie @cookie, JSON.stringify @timeline, { path: '/' }
|
66
|
-
callback @template()
|
67
|
-
|
68
|
-
module.exports = Adn
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# Delicious fetcher for Octopress (c) Brandon Mathis // MIT License
|
2
|
-
helpers = require('helpers')
|
3
|
-
|
4
|
-
Delicious =
|
5
|
-
cookie: 'delicious-feed'
|
6
|
-
classname: 'delicious-feed'
|
7
|
-
|
8
|
-
template: (data) ->
|
9
|
-
helpers.linkFeed data, @classname
|
10
|
-
|
11
|
-
errorTemplate: ->
|
12
|
-
helpers.errorTemplate "Failed to load bookmarks.", @classname
|
13
|
-
|
14
|
-
format: (feed) ->
|
15
|
-
for item in feed
|
16
|
-
{
|
17
|
-
url: item.u
|
18
|
-
date: item.dt
|
19
|
-
title: item.d
|
20
|
-
text: item.n
|
21
|
-
meta: "Tagged: " + ("<a title='view items #{item.a} tagged #{tag}' href='http://delicious.com/#{item.a}/#{tag}'>#{tag}</a>" for tag in item.t).join ' '
|
22
|
-
}
|
23
|
-
|
24
|
-
init: (user, options, callback) ->
|
25
|
-
feed = $.cookie @cookie
|
26
|
-
if feed
|
27
|
-
callback @template JSON.parse(feed)
|
28
|
-
else
|
29
|
-
$.ajax
|
30
|
-
url: "http://feeds.delicious.com/v2/json/#{user}?&count=#{options.count}&callback=?"
|
31
|
-
dataType: 'jsonp'
|
32
|
-
error: (err) => callback @errorTemplate
|
33
|
-
success: (data) =>
|
34
|
-
data = @format data
|
35
|
-
$.cookie @cookie, JSON.stringify data, { path: '/' }
|
36
|
-
callback @template data
|
37
|
-
|
38
|
-
module.exports = Delicious
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# Github fetcher for Octopress (c) Brandon Mathis // MIT License
|
2
|
-
helpers = require('helpers')
|
3
|
-
|
4
|
-
GitHub =
|
5
|
-
cookie: 'github-feed'
|
6
|
-
classname: 'github-feed'
|
7
|
-
|
8
|
-
template: (data)->
|
9
|
-
helpers.linkFeed data, @classname
|
10
|
-
|
11
|
-
errorTemplate: ->
|
12
|
-
helpers.errorTemplate "Failed to load repo list.", @classname
|
13
|
-
|
14
|
-
addRepo: (repo)->
|
15
|
-
title: repo.name
|
16
|
-
url: repo.url
|
17
|
-
text: repo.description
|
18
|
-
meta: repo.meta
|
19
|
-
|
20
|
-
format: (repos, options) ->
|
21
|
-
repoList = []
|
22
|
-
|
23
|
-
if options.repos
|
24
|
-
filter = []
|
25
|
-
filter.push i.trim().toLowerCase() for i in options.repos.split ','
|
26
|
-
|
27
|
-
for repo in repos
|
28
|
-
unless repoList.length is options.count
|
29
|
-
if options.forks or options.watchers
|
30
|
-
repo.meta = ''
|
31
|
-
if options.watchers
|
32
|
-
repo.meta += "Watchers: #{repo.watchers}"
|
33
|
-
if options.forks
|
34
|
-
repo.meta += ' ,' if repo.meta.length > 0
|
35
|
-
repo.meta += "Forks: #{repo.forks}"
|
36
|
-
|
37
|
-
if filter and filter.indexOf repo.name.toLowerCase() > -1
|
38
|
-
# repo order should match list
|
39
|
-
repoList[filter.indexOf repo.name] = @addRepo repo, options
|
40
|
-
else if !filter
|
41
|
-
repoList.push @addRepo repo, options unless options.skipForks and repo.fork
|
42
|
-
|
43
|
-
repoList
|
44
|
-
|
45
|
-
init: (user, options, callback) ->
|
46
|
-
if options.count or options.repos
|
47
|
-
feed = $.cookie @cookie
|
48
|
-
if feed
|
49
|
-
callback @template JSON.parse(feed)
|
50
|
-
else
|
51
|
-
$.ajax
|
52
|
-
url: "https://api.github.com/users/#{user}/repos?callback=?"
|
53
|
-
dataType: 'jsonp'
|
54
|
-
error: (err) => callback @errorTemplate
|
55
|
-
success: (data) =>
|
56
|
-
data = @format(data.data, options)
|
57
|
-
$.cookie @cookie, JSON.stringify data, { path: '/' }
|
58
|
-
callback @template data
|
59
|
-
|
60
|
-
module.exports = GitHub
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# Github fetcher for Octopress (c) Brandon Mathis // MIT License
|
2
|
-
helpers = require('helpers')
|
3
|
-
|
4
|
-
GitHub =
|
5
|
-
cookie: 'github-feed'
|
6
|
-
classname: 'github-feed'
|
7
|
-
|
8
|
-
template: (data)->
|
9
|
-
helpers.linkFeed data, @classname
|
10
|
-
|
11
|
-
errorTemplate: ->
|
12
|
-
helpers.errorTemplate "Failed to load repo list.", @classname
|
13
|
-
|
14
|
-
addRepo: (repo)->
|
15
|
-
title: repo.name
|
16
|
-
url: repo.url
|
17
|
-
text: repo.description
|
18
|
-
meta: repo.meta
|
19
|
-
|
20
|
-
format: (repos, options) ->
|
21
|
-
repoList = []
|
22
|
-
|
23
|
-
if options.repos
|
24
|
-
filter = []
|
25
|
-
filter.push i.trim().toLowerCase() for i in options.repos.split ','
|
26
|
-
|
27
|
-
for repo in repos
|
28
|
-
unless repoList.length is options.count and options.count > 1
|
29
|
-
if options.forks or options.watchers
|
30
|
-
repo.meta = ''
|
31
|
-
if options.watchers
|
32
|
-
repo.meta += "Watchers: #{repo.watchers}"
|
33
|
-
if options.forks
|
34
|
-
repo.meta += ' ,' if repo.meta.length > 0
|
35
|
-
repo.meta += "Forks: #{repo.forks}"
|
36
|
-
|
37
|
-
if filter and filter.indexOf repo.name.toLowerCase() > -1
|
38
|
-
# repo order should match list
|
39
|
-
repoList[filter.indexOf repo.name] = @addRepo repo, options
|
40
|
-
else if !filter
|
41
|
-
repoList.push @addRepo repo, options unless options.skipForks and repo.fork
|
42
|
-
|
43
|
-
repoList
|
44
|
-
|
45
|
-
init: (user, options, callback) ->
|
46
|
-
if options.count or options.repos
|
47
|
-
feed = $.cookie @cookie
|
48
|
-
if feed
|
49
|
-
callback @template JSON.parse(feed)
|
50
|
-
else
|
51
|
-
$.ajax
|
52
|
-
url: "https://api.github.com/users/#{user}/repos?callback=?"
|
53
|
-
dataType: 'jsonp'
|
54
|
-
error: (err) => callback @errorTemplate
|
55
|
-
success: (data) =>
|
56
|
-
data = @format(data.data, options)
|
57
|
-
$.cookie @cookie, JSON.stringify data, { path: '/' }
|
58
|
-
callback @template data
|
59
|
-
|
60
|
-
module.exports = GitHub
|
@@ -1,96 +0,0 @@
|
|
1
|
-
# Helper methods for Octopress (c) 2013 Brandon Mathis // MIT License
|
2
|
-
|
3
|
-
Helpers =
|
4
|
-
# Template helpers
|
5
|
-
|
6
|
-
linkFeed: (feed, classname)->
|
7
|
-
"<ul class='#{classname}'>" + (for item in feed
|
8
|
-
text = "<li class='feed-item'>"
|
9
|
-
text += "<p class='title'><a href='#{item.url}'>#{item.title.replace '<','<'}</a></p>"
|
10
|
-
text += "<p class='text'>#{item.text.replace '<','<'}</p>"
|
11
|
-
text += "<p class='meta'>#{item.meta}</p>" if item.meta
|
12
|
-
text += "</li>"
|
13
|
-
).join('') + "</ul>"
|
14
|
-
|
15
|
-
statusFeed: (feed, classname = '')->
|
16
|
-
"<ul class='#{classname}'>" + (for post in feed
|
17
|
-
text = "<li class='status-item'>"
|
18
|
-
text += "<p><a href='#{post.url}'>#{@timeago post.date}</a>#{post.text}</p>"
|
19
|
-
text += "</li>"
|
20
|
-
).join('') + "</ul>"
|
21
|
-
|
22
|
-
errorTemplate: (message, service = '') ->
|
23
|
-
"<p class='#{service} feed-error'>#{message}</p>"
|
24
|
-
|
25
|
-
htmlEscape: (str) ->
|
26
|
-
return String(str)
|
27
|
-
.replace(/&/g, '&')
|
28
|
-
.replace(/"/g, '"')
|
29
|
-
.replace(/'/g, ''')
|
30
|
-
.replace(/</g, '<')
|
31
|
-
.replace(/>/g, '>')
|
32
|
-
|
33
|
-
# Url helpers
|
34
|
-
|
35
|
-
trimUrl: (url)->
|
36
|
-
parts = []
|
37
|
-
for part in url.split '/'
|
38
|
-
parts.push part if parts.concat(part).join('/').length < 35
|
39
|
-
parts = parts.join('/')
|
40
|
-
if parts.length < url.length then parts + '…' else parts
|
41
|
-
|
42
|
-
linkify: (text, marker, url) ->
|
43
|
-
text.replace new RegExp("(^|\\W|>)(#{marker})([^\\s<]+)", 'g'), "$1<a href='#{url}$3'>$2$3</a>"
|
44
|
-
|
45
|
-
trimDisplayUrls: (text)->
|
46
|
-
text.replace />https?:\/\/([^\s<]+)/gi, (match, p1)=>
|
47
|
-
">#{@trimUrl(p1)}"
|
48
|
-
|
49
|
-
# ----------#
|
50
|
-
# Utilities #
|
51
|
-
# ----------#
|
52
|
-
|
53
|
-
# Sort an array of objects on a given key
|
54
|
-
|
55
|
-
sortByKey: (list, key, order='asc') ->
|
56
|
-
list = list.sort (a,b)->
|
57
|
-
if a[key] > b[key] then 1 else if b[key] > a[key] then -1 else 0
|
58
|
-
if order is 'desc' then list.reverse() else list
|
59
|
-
|
60
|
-
|
61
|
-
# Timeago based on JavaScript Pretty Date Copyright (c) 2011 John Resig
|
62
|
-
|
63
|
-
timeago: (time)->
|
64
|
-
say =
|
65
|
-
just_now: "now"
|
66
|
-
minute_ago: "1m"
|
67
|
-
minutes_ago: "m"
|
68
|
-
hour_ago: "1h"
|
69
|
-
hours_ago: "h"
|
70
|
-
yesterday: "1d"
|
71
|
-
days_ago: "d"
|
72
|
-
last_week: "1w"
|
73
|
-
weeks_ago: "w"
|
74
|
-
|
75
|
-
time = time.replace(/-/g,"/").replace(/[TZ]/g," ")
|
76
|
-
secs = ((new Date().getTime() - new Date(time).getTime()) / 1000)
|
77
|
-
mins = Math.floor secs / 60
|
78
|
-
hours = Math.floor secs / 3600
|
79
|
-
days = Math.floor secs / 86400
|
80
|
-
weeks = Math.floor days / 7
|
81
|
-
|
82
|
-
return '#' if isNaN(secs) or days < 0
|
83
|
-
|
84
|
-
if days is 0
|
85
|
-
if secs < 60 then say.just_now
|
86
|
-
else if secs < 120 then say.minute_ago
|
87
|
-
else if secs < 3600 then mins + say.minutes_ago
|
88
|
-
else if secs < 7200 then say.hour_ago
|
89
|
-
else hours + say.hours_ago
|
90
|
-
else
|
91
|
-
if days is 1 then say.yesterday
|
92
|
-
else if days < 7 then days + say.days_ago
|
93
|
-
else if days is 7 then say.last_week
|
94
|
-
else weeks + say.weeks_ago
|
95
|
-
|
96
|
-
module.exports = Helpers
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# Pinboard fetcher for Octopress (c) Brandon Mathis // MIT License
|
2
|
-
helpers = require('helpers')
|
3
|
-
|
4
|
-
Pinboard =
|
5
|
-
cookie: 'pinboard-feed'
|
6
|
-
classname: 'pinboard-feed'
|
7
|
-
|
8
|
-
template: (data) ->
|
9
|
-
helpers.linkFeed data, @classname
|
10
|
-
|
11
|
-
errorTemplate: ->
|
12
|
-
helpers.errorTemplate "Failed to load pins.", @classname
|
13
|
-
|
14
|
-
format: (feed) ->
|
15
|
-
for item in feed
|
16
|
-
{
|
17
|
-
url: item.u
|
18
|
-
date: item.dt
|
19
|
-
title: item.d
|
20
|
-
text: item.n
|
21
|
-
meta: "Tagged: " + ("<a title='view items #{item.a} tagged #{tag}' href='http://pinboard.in/u:#{item.a}/t:#{tag}'>#{tag}</a>" for tag in item.t).join ' '
|
22
|
-
}
|
23
|
-
|
24
|
-
init: (user, options, callback) ->
|
25
|
-
feed = $.cookie @cookie
|
26
|
-
if feed
|
27
|
-
callback @template JSON.parse(feed)
|
28
|
-
else
|
29
|
-
url = "http://feeds.pinboard.in/json/v1/u:#{user}"
|
30
|
-
url += "&count=#{options.count}"
|
31
|
-
|
32
|
-
$.ajax
|
33
|
-
url: url
|
34
|
-
dataType: 'jsonp'
|
35
|
-
jsonp: 'cb'
|
36
|
-
error: (err) => callback @errorTemplate
|
37
|
-
success: (data) =>
|
38
|
-
data = @format data
|
39
|
-
$.cookie @cookie, JSON.stringify data, { path: '/' }
|
40
|
-
callback @template data
|
41
|
-
|
42
|
-
module.exports = Pinboard
|