mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2025-02-28 08:21:52 -05:00
Merge pull request #1101 from imathis/bye-twitter
Bye, Twitter Timeline
This commit is contained in:
commit
81ea4ae9bb
@ -5,15 +5,5 @@
|
||||
|
||||
twitter:
|
||||
user:
|
||||
|
||||
timeline:
|
||||
tweet-count: 4
|
||||
show-replies: false
|
||||
show-rts: false
|
||||
|
||||
follow-button:
|
||||
show: true
|
||||
follower-count: false
|
||||
|
||||
# Sharing button on posts
|
||||
tweet-button: true
|
||||
# tweet-button: true
|
||||
|
@ -1,4 +1,3 @@
|
||||
twitter = require('twitter')
|
||||
adn = require('adn')
|
||||
pinboard = require('pinboard')
|
||||
delicious = require('delicious')
|
||||
|
@ -1,74 +0,0 @@
|
||||
# Twitter fetcher for Octopress (c) Brandon Mathis // MIT License
|
||||
helpers = require('helpers')
|
||||
|
||||
Twitter =
|
||||
timeline: []
|
||||
cookie: 'twitter-feed'
|
||||
classname: 'twitter-feed'
|
||||
|
||||
template: ->
|
||||
helpers.statusFeed @timeline, @classname
|
||||
|
||||
errorTemplate: ->
|
||||
helpers.errorTemplate "Failed to load tweets.", @classname
|
||||
|
||||
parseHtml: (text, urls)->
|
||||
# Use twitter entities to replace t.co shortened urls with expanded ones.
|
||||
for url in urls
|
||||
text = text.replace new RegExp(url.url, 'g'), "<a href='#{url.expanded_url}'>#{url.display_url}</a>" if url.expanded_url
|
||||
|
||||
# Trim up and link urls which aren't included in Twitters url entities
|
||||
text = text.replace /([^'"])(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, (p...) ->
|
||||
"#{p[1]}<a href='#{p[2]+p[3]}'>#{helpers.trimUrl(p[3])}</a>"
|
||||
|
||||
# Link up user mentions and hashtags
|
||||
text = helpers.linkify text, '@', 'http://twitter.com/'
|
||||
text = helpers.linkify text, '#', 'http://search.twitter.com/search?q=%23'
|
||||
|
||||
getTweet: (tweet, user) ->
|
||||
type = if tweet.retweeted_status then 'repost' else 'post'
|
||||
user = if type is 'repost' then tweet.entities.user_mentions[0].screen_name else user
|
||||
post = if type is 'repost' then tweet.retweeted_status else tweet
|
||||
{
|
||||
url: "https://twitter.com/#{user}/status/#{tweet.id_str}"
|
||||
type: type
|
||||
date: tweet.created_at
|
||||
author: { user: user, url: "http://twitter.com/#{user}" } if type is 'repost'
|
||||
text: @parseHtml tweet.text.replace(/\n/g, '<br>'), tweet.entities.urls
|
||||
}
|
||||
|
||||
format: (tweets, user) ->
|
||||
(@getTweet(tweet, user) for tweet in tweets)
|
||||
|
||||
init: (user, options, callback) ->
|
||||
tweets = $.cookie('twitter-feed')
|
||||
if tweets
|
||||
@timeline = JSON.parse(tweets)
|
||||
if @timeline.length isnt options.count
|
||||
$.removeCookie('twitter-feed')
|
||||
@timeline = []
|
||||
@init user, options, callback
|
||||
else
|
||||
callback @template()
|
||||
else
|
||||
url = "http://api.twitter.com/1/statuses/user_timeline/#{user}.json?trim_user=true&include_entities=1"
|
||||
url += "&exclude_replies=1" unless options.replies
|
||||
url += "&include_rts=true" if options.include_rts
|
||||
url += "&max_id=#{options.max_id}" if options.max_id
|
||||
url += "&callback=?"
|
||||
|
||||
$.ajax
|
||||
url: url
|
||||
dataType: 'jsonp'
|
||||
error: (err) => callback @errorTemplate
|
||||
success: (data) =>
|
||||
@timeline = @timeline.concat data
|
||||
if @timeline.length < options.count
|
||||
options.max_id = data.slice(-1)[0].id
|
||||
@init user, options, callback
|
||||
else
|
||||
@timeline = @format @timeline.slice(0, options.count), user
|
||||
$.cookie @cookie, JSON.stringify @timeline, { path: '/' }
|
||||
callback @template()
|
||||
|
||||
module.exports = Twitter
|
@ -41,7 +41,6 @@ $sidebar-border: desaturate(darken($sidebar-bg, 7), 10) !default;
|
||||
$sidebar-border-hover: darken($sidebar-bg, 7) !default;
|
||||
$sidebar-link-color-subdued: lighten($sidebar-color, 20) !default;
|
||||
$sidebar-link-color-subdued-hover: $sidebar-link-color-hover !default;
|
||||
$twitter-status-link: lighten($sidebar-link-color-subdued, 15) !default;
|
||||
|
||||
$footer-color: #888 !default;
|
||||
$footer-bg: #ccc !default;
|
||||
|
@ -1,5 +1,4 @@
|
||||
@import "sidebar/base";
|
||||
@import "sidebar/twitter";
|
||||
@import "sidebar/googleplus";
|
||||
@import "sidebar/pinboard";
|
||||
@import "sidebar/delicious";
|
||||
|
@ -1,42 +0,0 @@
|
||||
#tweets {
|
||||
.loading {
|
||||
&:before {
|
||||
content: "";
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
@extend .icon-twitter-bird;
|
||||
}
|
||||
color: darken($sidebar-bg, 18);
|
||||
text-shadow: $main-bg 0 1px;
|
||||
text-align: center;
|
||||
padding: .5em 0;
|
||||
.transform &.error {
|
||||
@include rotate(180deg);
|
||||
@include box-shadow(lighten($sidebar-bg, 5) 0 -1px);
|
||||
border-bottom: 0;
|
||||
border-top: 1px solid $sidebar-border;
|
||||
}
|
||||
}
|
||||
p {
|
||||
position: relative;
|
||||
padding-right: 1em;
|
||||
}
|
||||
a[href*=status]:first-child {
|
||||
color: $twitter-status-link;
|
||||
float: right;
|
||||
padding: 0 0 .1em 1em;
|
||||
position: relative; right: -1.3em;
|
||||
text-shadow: #fff 0 1px;
|
||||
font-size: .7em;
|
||||
span { font-size: 1.5em; }
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
color: $sidebar-link-color-subdued-hover;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
a[href*='twitter.com/search']{
|
||||
@extend .aside-alt-link;
|
||||
@include hover-link;
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
{% include sidebars/sections/twitter.html %}
|
||||
{% include sidebars/sections/delicious.html %}
|
||||
{% include sidebars/sections/pinboard.html %}
|
||||
{% include sidebars/sections/google_plus.html %}
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% include sidebars/sections/recent_posts.html %}
|
||||
{% include sidebars/sections/twitter.html %}
|
||||
{% include sidebars/sections/delicious.html %}
|
||||
{% include sidebars/sections/pinboard.html %}
|
||||
{% include sidebars/sections/google_plus.html %}
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% include sidebars/sections/recent_posts.html %}
|
||||
{% include sidebars/sections/twitter.html %}
|
||||
{% include sidebars/sections/delicious.html %}
|
||||
{% include sidebars/sections/pinboard.html %}
|
||||
{% include sidebars/sections/google_plus.html %}
|
||||
|
@ -1,13 +0,0 @@
|
||||
{% if site.twitter_user %}
|
||||
<section>
|
||||
<h1>Latest Tweets</h1>
|
||||
<ul id="tweets" data-user="{{site.twitter_user}}" data-count="{{site.twitter_tweet_count}}" data-replies="{{site.twitter_show_replies}}">
|
||||
<li class="loading">Status updating...</li>
|
||||
</ul>
|
||||
{% if site.twitter_follow_button %}
|
||||
<a href="//twitter.com/{{ site.twitter_user }}" class="twitter-follow-button" data-show-count="{{ site.twitter_show_follower_count }}">Follow @{{ site.twitter_user }}</a>
|
||||
{% else %}
|
||||
<p>Follow <a href="//twitter.com/{{site.twitter_user}}">@{{ site.twitter_user }}</a></p>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endif %}
|
@ -4,7 +4,7 @@ Octopress is [Jekyll](https://github.com/mojombo/jekyll) blogging at its finest.
|
||||
|
||||
1. **Octopress sports a clean responsive theme** written in semantic HTML5, focused on readability and friendliness toward mobile devices.
|
||||
2. **Code blogging is easy and beautiful.** Embed code (with [Solarized](http://ethanschoonover.com/solarized) styling) in your posts from gists, jsFiddle or from your filesystem.
|
||||
3. **Third party integration is simple** with built-in support for Twitter, Pinboard, Delicious, GitHub Repositories, Disqus Comments and Google Analytics.
|
||||
3. **Third party integration is simple** with built-in support for Pinboard, Delicious, GitHub Repositories, Disqus Comments and Google Analytics.
|
||||
4. **It's easy to use.** A collection of rake tasks simplifies development and makes deploying a cinch.
|
||||
5. **Ships with great plug-ins** some original and others from the Jekyll community — tested and improved.
|
||||
|
||||
|
@ -5,7 +5,6 @@ module Jekyll
|
||||
#
|
||||
# Examples:
|
||||
# https://github.com/tedkulp/octopress/blob/master/plugins/post_metaweblog.rb
|
||||
# https://github.com/tedkulp/octopress/blob/master/plugins/post_twitter.rb
|
||||
class PostFilter < Plugin
|
||||
|
||||
#Called before post is sent to the converter. Allows
|
||||
|
Loading…
x
Reference in New Issue
Block a user