customized twitter feed script

by Chris Buttery

HTML

<div class="tw-feed">  
<a class="twitter-timeline" href="https://twitter.com/segment"
   data-theme="dark"
   data-link-color="#ccc"
   background="#333"
   border-radius="none"
   data-chrome="nofooter noborders"
   data-widget-id="413723523169787904"
   data-screen-name="segment" data-show-replies="false"
   data-tweet-limit="3"
   width="860"
   >@Twitter Feed</a>
</div>

CSS

.tw-feed {width:860px;color:#fff;background: #333;padding:10px;border: solid 5px #333;}
.tw-feed a {color:#fff;text-decoration:none;}
.tw-feed a:hover {color:#ccc;text-decoration:none;}
.twitter-timeline {position:relative;}

JavaScript

!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");


var feed = document.querySelector('.tw-feed');
var iframe;

function applyStyles (iframe) {
  var style = document.createElement('style');
  style.textContent =
    '.timeline-TweetList-tweet {' +
    '  float: left;' +
    '  width: 33%;' +
    ' font-size: 12px;' +
    '}' 
  ;
  iframe.contentDocument.head.appendChild(style);
}

setTimeout(function(){
  iframe = feed.querySelector('iframe');
  //applyStyles(iframe);
}, 1000);