Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix twitter widget

  • Loading branch information...
commit 43c542573360701877425b1c89cf3932137334ac 1 parent b08ca1a
@dwradcliffe dwradcliffe authored
View
2  app/assets/javascripts/application.js
@@ -6,10 +6,8 @@
//
//= require jquery
//= require jquery_ujs
-//= require jquery.tweet
//= require_tree .
$(document).ready(function() {
StatusTimer.init();
- $('#tweets').tweet();
});
View
54 app/assets/stylesheets/status.css.scss
@@ -61,12 +61,12 @@ a {
padding-top: 20px;
.main {
- width: 620px;
+ width: 520px;
float: left;
}
.sidebar {
- width: 250px;
+ width: 350px;
float: right;
}
}
@@ -130,30 +130,6 @@ span.status-partial { background: url('/assets/yellow.png') no-repeat 0px center
border: 1px solid #EFF2C7;
}
-#tweets {
- .tweet {
- padding: 4px 0px;
- border-bottom: 1px solid #ddd;
-
- p {
- margin: 4px 0px;
- }
-
- p.meta {
- margin: 4px 0px;
- font-size: pem(12);
-
- a {
- color: #777;
- }
- }
- }
-
- .tweet:last-child {
- border: 0px none;
- }
-}
-
/* -------------------------------------------------------------------------- */
/* Services Status Table */
/* -------------------------------------------------------------------------- */
@@ -198,32 +174,6 @@ table.services {
}
/* -------------------------------------------------------------------------- */
-/* Sidebar Styles */
-/* -------------------------------------------------------------------------- */
-
-.sidebar {
- color: #333;
- font-size: pem(13);
-
- .module {
- background: #f1f1f1;
- padding: 12px;
- border-radius: 4px;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
-
- h2 {
- font-size: pem(13);
- line-height: pem(20);
- margin: 0px;
- border-bottom: 1px solid #ccc;
- padding-bottom: 6px;
- margin-bottom: 6px;
- }
- }
-}
-
-/* -------------------------------------------------------------------------- */
/* Media Queries */
/* -------------------------------------------------------------------------- */
View
8 app/views/status/show.html.erb
@@ -2,11 +2,7 @@
<%= render :partial => 'pings' %>
</div>
<div class="sidebar">
- <div class="module">
- <h2>Instant updates <a href="http://twitter.com/rubygems_status">@rubygems_status</a></h2>
- <div class="module-content">
- <div id="tweets"></div>
- </div>
- </div>
+ <a class="twitter-timeline" data-dnt="true" href="https://twitter.com/rubygems_status" data-widget-id="320697714532814848">Tweets by @rubygems_status</a>
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
<div class="clear"></div>
View
100 vendor/assets/javascripts/jquery.tweet.js
@@ -1,100 +0,0 @@
-// Based on http://github.com/seaofclouds/tweet/
-
-(function($) {
-
- $.fn.tweet = function(o){
- var s = {
- username: ["rubygems_status"], // [string] required, unless you want to display our tweets. :) it can be an array, just do ["username1","username2","etc"]
- count: 8, // [integer] how many tweets to display?
- loading_text: null // [string] optional loading text, displayed while tweets load
- }
-
- if(o) $.extend(s, o);
-
- $.fn.extend({
- linkUrl: function() {
- var returning = [];
- var regexp = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
- this.each(function() {
- returning.push(this.replace(regexp,"<a href=\"$1\">$1</a>"))
- });
- return $(returning);
- },
- linkUser: function() {
- var returning = [];
- var regexp = /[\@]+([A-Za-z0-9-_]+)/gi;
- this.each(function() {
- returning.push(this.replace(regexp,"<a href=\"http://twitter.com/$1\">@$1</a>"))
- });
- return $(returning);
- },
- linkHash: function() {
- var returning = [];
- var regexp = / [\#]+([A-Za-z0-9-_]+)/gi;
- this.each(function() {
- returning.push(this.replace(regexp, ' <a href="https://search.twitter.com/search?q=&tag=$1&lang=all&from='+s.username.join("%2BOR%2B")+'">#$1</a>'))
- });
- return $(returning);
- }
- });
-
- function relative_time(time_value) {
- var parsed_date = Date.parse(time_value);
- var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
- var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
- if(delta < 60) {
- return 'less than a minute ago';
- } else if(delta < 120) {
- return 'about a minute ago';
- } else if(delta < (45*60)) {
- return (parseInt(delta / 60)).toString() + ' minutes ago';
- } else if(delta < (90*60)) {
- return 'about an hour ago';
- } else if(delta < (24*60*60)) {
- return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
- } else if(delta < (48*60*60)) {
- return '1 day ago';
- } else {
- return (parseInt(delta / 86400)).toString() + ' days ago';
- }
- }
-
- return this.each(function(){
- var list = $(this);
- var loading = $('<p class="loading">'+s.loading_text+'</p>');
- if(typeof(s.username) == "string"){
- s.username = [s.username];
- }
- var query = '';
- if(s.query) {
- query += 'q='+s.query;
- }
- query += '&q=from:'+s.username.join('%20OR%20from:');
- var url = 'https://search.twitter.com/search.json?&'+query+'&rpp=20&callback=?';
- if (s.loading_text) $(this).append(loading);
- $.getJSON(url, function(data){
- if (s.loading_text) loading.remove();
- var itemsShown = 0;
- $.each(data.results, function(i,item){
- if (itemsShown >= s.count) return
-
- if (item.text.match(/^(@([A-Za-z0-9-_]+)) .*/i)) { // reply (don't show)
- return
- } else if (item.text.match(/^RT (@([A-Za-z0-9-_]+)).*/i)) { // retweets (don't show)
- return
- }
-
- var join = ((s.join_text) ? join_template : ' ')
- var date = '<p class="meta"><a href="http://twitter.com/'+item.from_user+'/statuses/'+item.id+'" title="view tweet on twitter">'+relative_time(item.created_at)+'</a></p>';
- var text = '<p>' +$([item.text]).linkUrl().linkUser().linkHash()[0]+ '</p>';
-
- // until we create a template option, arrange the items below to alter a tweet's display.
- list.append('<div class="tweet">' + text + date + '</div>');
-
- itemsShown++;
- });
- });
-
- });
- };
-})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.