octopress 3.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.editorconfig +22 -0
- data/.gitattributes +1 -0
- data/.gitignore +20 -0
- data/.powrc +4 -0
- data/.rspec +5 -0
- data/.rubocop.yml +119 -0
- data/.slugignore +3 -0
- data/.themes/classic/.editorconfig +44 -0
- data/.themes/classic/_config/adn-timeline.yml +10 -0
- data/.themes/classic/_config/delicious-feed.yml +4 -0
- data/.themes/classic/_config/deploy/gh_pages.yml +9 -0
- data/.themes/classic/_config/deploy/rsync.yml +14 -0
- data/.themes/classic/_config/disqus.yml +11 -0
- data/.themes/classic/_config/facebook-like.yml +2 -0
- data/.themes/classic/_config/gauges-analytics.yml +6 -0
- data/.themes/classic/_config/github-repos.yml +24 -0
- data/.themes/classic/_config/google-analytics.yml +6 -0
- data/.themes/classic/_config/google-plus.yml +13 -0
- data/.themes/classic/_config/jekyll.yml +37 -0
- data/.themes/classic/_config/pinboard-feed.yml +4 -0
- data/.themes/classic/_config/require-js.yml +19 -0
- data/.themes/classic/_config/theme.yml +54 -0
- data/.themes/classic/_config/twitter-timeline.yml +9 -0
- data/.themes/classic/assets/javascripts/lib/ios-rotate-scaling-fix.js +18 -0
- data/.themes/classic/assets/javascripts/lib/jquery.cookie.js +92 -0
- data/.themes/classic/assets/javascripts/lib/modernizr.js +447 -0
- data/.themes/classic/assets/javascripts/lib/octopress.js +83 -0
- data/.themes/classic/assets/javascripts/modules/adn-timeline.coffee +68 -0
- data/.themes/classic/assets/javascripts/modules/delicious-feed.coffee +38 -0
- data/.themes/classic/assets/javascripts/modules/github-repos.coffee +60 -0
- data/.themes/classic/assets/javascripts/modules/github.coffee +60 -0
- data/.themes/classic/assets/javascripts/modules/helpers.coffee +96 -0
- data/.themes/classic/assets/javascripts/modules/pinboard-feed.coffee +42 -0
- data/.themes/classic/assets/javascripts/modules/site.coffee +11 -0
- data/.themes/classic/assets/stylesheets/_base.scss +5 -0
- data/.themes/classic/assets/stylesheets/_partials.scss +8 -0
- data/.themes/classic/assets/stylesheets/base/_layout.scss +191 -0
- data/.themes/classic/assets/stylesheets/base/_solarized.scss +75 -0
- data/.themes/classic/assets/stylesheets/base/_theme.scss +92 -0
- data/.themes/classic/assets/stylesheets/base/_typography.scss +168 -0
- data/.themes/classic/assets/stylesheets/base/_utilities.scss +27 -0
- data/.themes/classic/assets/stylesheets/custom/_colors.scss +49 -0
- data/.themes/classic/assets/stylesheets/custom/_fonts.scss +10 -0
- data/.themes/classic/assets/stylesheets/custom/_layout.scss +17 -0
- data/.themes/classic/assets/stylesheets/custom/_styles.scss +2 -0
- data/.themes/classic/assets/stylesheets/partials/_archive.scss +77 -0
- data/.themes/classic/assets/stylesheets/partials/_blog.scss +165 -0
- data/.themes/classic/assets/stylesheets/partials/_footer.scss +19 -0
- data/.themes/classic/assets/stylesheets/partials/_header.scss +18 -0
- data/.themes/classic/assets/stylesheets/partials/_navigation.scss +136 -0
- data/.themes/classic/assets/stylesheets/partials/_sharing.scss +73 -0
- data/.themes/classic/assets/stylesheets/partials/_sidebar.scss +4 -0
- data/.themes/classic/assets/stylesheets/partials/_syntax.scss +234 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_base.scss +106 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_delicious.scss +4 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_googleplus.scss +26 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_pinboard.scss +12 -0
- data/.themes/classic/assets/stylesheets/plugins/_plugins.scss +5 -0
- data/.themes/classic/assets/stylesheets/screen.scss +11 -0
- data/.themes/classic/source/404.markdown +9 -0
- data/.themes/classic/source/_includes/after_footer.html +7 -0
- data/.themes/classic/source/_includes/archive_post.html +12 -0
- data/.themes/classic/source/_includes/article.html +23 -0
- data/.themes/classic/source/_includes/comments.html +9 -0
- data/.themes/classic/source/_includes/custom/after_footer.html +3 -0
- data/.themes/classic/source/_includes/custom/after_page.html +1 -0
- data/.themes/classic/source/_includes/custom/after_post.html +0 -0
- data/.themes/classic/source/_includes/custom/comments.html +5 -0
- data/.themes/classic/source/_includes/custom/footer.html +4 -0
- data/.themes/classic/source/_includes/custom/head.html +7 -0
- data/.themes/classic/source/_includes/custom/header.html +6 -0
- data/.themes/classic/source/_includes/custom/navigation.html +4 -0
- data/.themes/classic/source/_includes/custom/page_meta.html +1 -0
- data/.themes/classic/source/_includes/custom/post_meta.html +1 -0
- data/.themes/classic/source/_includes/custom/sharing.html +3 -0
- data/.themes/classic/source/_includes/disqus.html +22 -0
- data/.themes/classic/source/_includes/facebook_like.html +10 -0
- data/.themes/classic/source/_includes/feed_entry.xml +10 -0
- data/.themes/classic/source/_includes/footer.html +1 -0
- data/.themes/classic/source/_includes/gauges_analytics.html +15 -0
- data/.themes/classic/source/_includes/google_analytics.html +13 -0
- data/.themes/classic/source/_includes/google_plus_one.html +9 -0
- data/.themes/classic/source/_includes/head.html +33 -0
- data/.themes/classic/source/_includes/header.html +1 -0
- data/.themes/classic/source/_includes/navigation.html +15 -0
- data/.themes/classic/source/_includes/post/author.html +8 -0
- data/.themes/classic/source/_includes/post/categories.html +10 -0
- data/.themes/classic/source/_includes/post/date.html +15 -0
- data/.themes/classic/source/_includes/post/disqus_thread.html +1 -0
- data/.themes/classic/source/_includes/post/meta.html +3 -0
- data/.themes/classic/source/_includes/post/sharing.html +36 -0
- data/.themes/classic/source/_includes/post/title.html +5 -0
- data/.themes/classic/source/_includes/post/variables.html +14 -0
- data/.themes/classic/source/_includes/sidebars/blog_index_default.html +3 -0
- data/.themes/classic/source/_includes/sidebars/page_default.html +4 -0
- data/.themes/classic/source/_includes/sidebars/post_default.html +4 -0
- data/.themes/classic/source/_includes/sidebars/sections/delicious.html +8 -0
- data/.themes/classic/source/_includes/sidebars/sections/github.html +9 -0
- data/.themes/classic/source/_includes/sidebars/sections/google_plus.html +5 -0
- data/.themes/classic/source/_includes/sidebars/sections/pinboard.html +17 -0
- data/.themes/classic/source/_includes/sidebars/sections/recent_posts.html +10 -0
- data/.themes/classic/source/_includes/twitter_sharing.html +11 -0
- data/.themes/classic/source/_layouts/category_feed.xml +24 -0
- data/.themes/classic/source/_layouts/category_index.html +19 -0
- data/.themes/classic/source/_layouts/default.html +14 -0
- data/.themes/classic/source/_layouts/page.html +34 -0
- data/.themes/classic/source/_layouts/post.html +39 -0
- data/.themes/classic/source/archives/index.html +20 -0
- 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 +115 -0
- 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 +23 -0
- 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 +30 -0
- data/.themes/classic/source/javascripts/jquery.min.js +5 -0
- data/.themes/classic/source/octopress-favicon.png +0 -0
- data/.themes/classic/source/robots.txt +7 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.markdown +46 -0
- data/CONTRIBUTING.markdown +17 -0
- data/Gemfile +2 -0
- data/README.markdown +37 -0
- data/Rakefile +76 -0
- data/bin/octopress +66 -0
- data/lib/console +17 -0
- data/lib/guard/jekyll.rb +33 -0
- data/lib/octopress.rb +89 -0
- data/lib/octopress/command.rb +9 -0
- data/lib/octopress/commands.rb +14 -0
- data/lib/octopress/commands/build.rb +17 -0
- data/lib/octopress/commands/build_javascripts.rb +11 -0
- data/lib/octopress/commands/build_jekyll.rb +25 -0
- data/lib/octopress/commands/build_stylesheets.rb +13 -0
- data/lib/octopress/commands/install.rb +45 -0
- data/lib/octopress/commands/new.rb +21 -0
- data/lib/octopress/commands/scaffold.rb +101 -0
- data/lib/octopress/commands/serve.rb +25 -0
- data/lib/octopress/configuration.rb +231 -0
- data/lib/octopress/core_ext.rb +44 -0
- data/lib/octopress/dependency_installer.rb +287 -0
- data/lib/octopress/errors.rb +3 -0
- data/lib/octopress/filters/content.rb +66 -0
- data/lib/octopress/filters/date.rb +46 -0
- data/lib/octopress/filters/post.rb +175 -0
- data/lib/octopress/filters/url.rb +34 -0
- data/lib/octopress/formatters.rb +9 -0
- data/lib/octopress/formatters/base_formatter.rb +17 -0
- data/lib/octopress/formatters/simple_formatter.rb +9 -0
- data/lib/octopress/formatters/verbose_formatter.rb +9 -0
- data/lib/octopress/generators/category_generator.rb +196 -0
- data/lib/octopress/generators/sitemap_generator.rb +308 -0
- data/lib/octopress/guardfile +43 -0
- data/lib/octopress/helpers/titlecase.rb +37 -0
- data/lib/octopress/ink.rb +12 -0
- data/lib/octopress/inquirable_string.rb +12 -0
- data/lib/octopress/installer.rb +92 -0
- data/lib/octopress/js_asset_manager.rb +98 -0
- data/lib/octopress/liquid_helpers/conditional.rb +36 -0
- data/lib/octopress/liquid_helpers/config.rb +58 -0
- data/lib/octopress/liquid_helpers/include.rb +33 -0
- data/lib/octopress/liquid_helpers/url.rb +29 -0
- data/lib/octopress/liquid_helpers/vars.rb +30 -0
- data/lib/octopress/plugin.rb +33 -0
- data/lib/octopress/rake.rb +16 -0
- data/lib/octopress/scaffold/.gitignore +18 -0
- data/lib/octopress/scaffold/site/Gemfile +3 -0
- data/lib/octopress/scaffold/site/config/compass.rb +27 -0
- data/lib/octopress/scaffold/site/config/rack.rb +25 -0
- data/lib/octopress/scaffold/site/config/site.yml +0 -0
- data/lib/octopress/scaffold/site/javascripts/lib/ios-rotate-scaling-fix.js +19 -0
- data/lib/octopress/scaffold/site/javascripts/lib/jquery-1.9.1.js +9598 -0
- data/lib/octopress/scaffold/site/javascripts/lib/jquery.cookie.js +93 -0
- data/lib/octopress/scaffold/site/stylesheets/_config.scss +1 -0
- data/lib/octopress/scaffold/site/stylesheets/_style.scss +1 -0
- data/lib/octopress/scaffold/site/stylesheets/site.scss +16 -0
- data/lib/octopress/tags/assign.rb +34 -0
- data/lib/octopress/tags/capture.rb +31 -0
- data/lib/octopress/tags/config-tag.rb +23 -0
- data/lib/octopress/tags/include.rb +63 -0
- data/lib/octopress/tags/js-assets.rb +23 -0
- data/lib/octopress/tags/puts.rb +39 -0
- data/lib/octopress/tags/render-partial.rb +89 -0
- data/lib/octopress/tags/return.rb +21 -0
- data/lib/octopress/version.rb +3 -0
- data/lib/rake/clean.rake +8 -0
- data/lib/rake/clobber.rake +5 -0
- data/lib/rake/console.rake +5 -0
- data/lib/rake/deploy.rake +4 -0
- data/lib/rake/gen_deploy.rake +2 -0
- data/lib/rake/generate.rake +4 -0
- data/lib/rake/generate_only.rake +14 -0
- data/lib/rake/hygiene.rake +29 -0
- data/lib/rake/install.rake +8 -0
- data/lib/rake/integrate.rake +4 -0
- data/lib/rake/isolate.rake +13 -0
- data/lib/rake/list_drafts.rake +7 -0
- data/lib/rake/new.rake +7 -0
- data/lib/rake/new_page.rake +49 -0
- data/lib/rake/new_post.rake +32 -0
- data/lib/rake/nuke.rake +4 -0
- data/lib/rake/preview.rake +4 -0
- data/lib/rake/push.rake +37 -0
- data/lib/rake/rsync.rake +20 -0
- data/lib/rake/set_root_dir.rake +35 -0
- data/lib/rake/setup_github_pages.rake +115 -0
- data/lib/rake/watch.rake +11 -0
- data/lib/scaffold/Rakefile +142 -0
- data/lib/scaffold/plugin-name.gemspec +43 -0
- data/lib/spec/fixtures/env/defaults/classic.yml +2 -0
- data/lib/spec/fixtures/no_override/defaults/classic.yml +11 -0
- data/lib/spec/fixtures/override/defaults/classic.yml +11 -0
- data/lib/spec/fixtures/override/site.yml +11 -0
- data/lib/spec/octopress/configuration_spec.rb +67 -0
- data/lib/spec/octopress/dependency_installer_spec.rb +66 -0
- data/lib/spec/octopress/ink_spec.rb +10 -0
- data/lib/spec/octopress/octopress_spec.rb +97 -0
- data/lib/spec/spec_helper.rb +22 -0
- data/lib/spec/support/env.rb +36 -0
- data/lib/spec/support/simplecov.rb +52 -0
- data/octopress.gemspec +52 -0
- metadata +697 -0
@@ -0,0 +1,83 @@
|
|
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
|
+
});
|
@@ -0,0 +1,68 @@
|
|
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
|
@@ -0,0 +1,38 @@
|
|
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
|
@@ -0,0 +1,60 @@
|
|
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
|
@@ -0,0 +1,60 @@
|
|
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
|
@@ -0,0 +1,96 @@
|
|
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
|
@@ -0,0 +1,42 @@
|
|
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
|