Skip to content

Instantly share code, notes, and snippets.

@ashaw
Created October 7, 2010 21:52
Show Gist options
  • Save ashaw/615960 to your computer and use it in GitHub Desktop.
Save ashaw/615960 to your computer and use it in GitHub Desktop.
<script type="text/jst" id="live_update_tmpl">
<% _(window.mw_check_for_updates.new_updates).each(function(update) { %>
<% var twitter; %>
<% if (update.via === "twitter") { twitter = true; } %>
<div class="topic_story_wrap <% if (twitter) { %>twitter_story_wrap<% } %>">
<% if (!twitter) { %>
<h2 class="eyebrow updating_wire_eyebrow"><%= update.item_create_time %> | <%= update.author_display_name %></h2>
<% } %>
<h2 class="topic_story_hed">
<% if (twitter) { %>
<a href="http://twitter.com/<%= update.author_username %>"><img class="twitter_story_author_img" src="<%= update.author_img %>"></a>
<span class="twitter_author_username"><a href="http://twitter.com/<%= update.author_username %>"><%= update.author_username %></a></span>
<% } %>
<% if (!twitter) { %>
<% if (update.refer_url) { %>
<a href="<%= update.refer_url %>"><%= update.title %></a>
<% } else { %>
<%= update.title %>
<% } %>
<% } else { %><!-- if twitter -->
<span class="mw_tweet"><%= update.title %></span>
<% if (update.refer_url) { %>
<span class="twitter_refer_btn twitter_story_read_more"><a href="<%= update.refer_url %>">Read More &raquo;</a></span>
<% } %>
<span class="twitter_refer_btn twitter_story_rt"><a href="http://twitter.com/?status=RT%20@<%= update.author_username %>%20<%= encodeURIComponent(update.body).replace(/\+/g,'%20') %>">RT</a></span>
<% } %>
</h2>
<% if (update.body && !twitter) { %>
<p><%= update.body %></p>
<% } %>
</div>
<% }); %>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment