mirror of
https://github.com/beetbox/beets.git
synced 2026-01-02 14:03:12 +01:00
use official Twitter timeline
This has started to suck a lot less over the last few months if I'm not mistaken.
This commit is contained in:
parent
701b856874
commit
092d48192e
2 changed files with 7 additions and 55 deletions
|
|
@ -153,12 +153,14 @@ or <a href="http://news.ycombinator.com/submitlink?u={{ site.url | cgi_escape }}
|
|||
<section>
|
||||
{% if page.section == 'main' %}
|
||||
<h3><a href="http://twitter.com/b33ts">News from @b33ts</a></h3>
|
||||
<ul id="twitterStatus" class="newslist">
|
||||
</ul>
|
||||
<a class="twitter-timeline" href="https://twitter.com/b33ts"
|
||||
data-widget-id="374710568583573504"
|
||||
height="300"
|
||||
data-chrome="nofooter noheader noscrollbar"
|
||||
data-tweet-limit="2"
|
||||
>Tweets by @b33ts</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
||||
{% endif %}
|
||||
<p id="twitterFollow">
|
||||
<a href="http://twitter.com/b33ts" class="twitter-follow-button">Follow @b33ts</a>
|
||||
</p>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Contact</h3>
|
||||
|
|
@ -176,8 +178,6 @@ or <a href="http://news.ycombinator.com/submitlink?u={{ site.url | cgi_escape }}
|
|||
data-text="Beets: an awesome open-source music library manager and MusicBrainz tagger."
|
||||
data-count="none" data-via="b33ts"
|
||||
data-url="http://beets.radbox.org/">tweet beets</a>
|
||||
<script type="text/javascript"
|
||||
src="http://platform.twitter.com/widgets.js"></script>
|
||||
|
||||
<!-- google +1 button -->
|
||||
<g:plusone count="false" size="medium"
|
||||
|
|
|
|||
48
beets.js
48
beets.js
|
|
@ -25,54 +25,6 @@ function updateBeetsis() {
|
|||
});
|
||||
}
|
||||
|
||||
// Fetch and display the latest messages from the Twitter account.
|
||||
var NEWS_COUNT = 3;
|
||||
var MONTH_NAMES = [ "January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December" ];
|
||||
var urlre = /(http:\/\/([^ \/]+)(\/\S+)?)\b/g;
|
||||
function getNews() {
|
||||
var url = 'http://pipes.yahoo.com/pipes/pipe.run'
|
||||
var args = {
|
||||
_id: '6a14ac0e3884a3913d16bbc4d0811322',
|
||||
_render: 'json',
|
||||
_callback: 'jsonpCallback'
|
||||
};
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: args,
|
||||
type: 'GET',
|
||||
dataType: 'jsonp',
|
||||
jsonpCallback: 'jsonpCallback',
|
||||
success: function(data) {
|
||||
// Find the first non-reply status. This assumes there's at least
|
||||
// one non-reply in this chunk... probably a reasonable assumption.
|
||||
$('#twitterStatus').empty();
|
||||
var count = 0;
|
||||
$.each(data['value']['items'], function(i, status) {
|
||||
console.log(status);
|
||||
if (status.in_reply_to_screen_name == null) {
|
||||
// Not a reply.
|
||||
|
||||
var text = status.text;
|
||||
text = text.replace(urlre, "<a href=\"$1\">link »</a>");
|
||||
|
||||
var date = new Date(Date.parse(status.created_at));
|
||||
date = MONTH_NAMES[date.getMonth()] + ' ' + date.getDate();
|
||||
|
||||
$('#twitterStatus').append(
|
||||
'<li><span class="date">' + date + ':</span> ' +
|
||||
text + '</li>'
|
||||
);
|
||||
count++;
|
||||
if (count >= NEWS_COUNT)
|
||||
return false; // break
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
setTimeout(updateBeetsis, INTERVAL_INITIAL);
|
||||
getNews();
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue