Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7c2fb4dab3
Fetching contributors…

Cannot retrieve contributors at this time

156 lines (136 sloc) 4.359 kb
{% extends "base.html" %}
{% block extra_head %}
<style>
div.clearer {clear: both; line-height: 0; height: 0;}
#followsyounot {
float:right;
width:50%;
border-left: 1px solid #ccc;
}
#split div { padding:20px; }
a.profile {
font-weight:bold;
text-decoration: none;
color:black;
}
a.profile:hover { text-decoration:underline; }
a.compare { font-size: 0.7em; }
ul li { list-style: none; margin:1px 10px; clear:left; }
li a.thumbnail { float:left; padding:3px; margin:0 5px 0 0; }
#error {
padding:50px;
color:red;
}
</style>
{% end %}
{% block content %}
<h2>{{ page_title }} <span class="total"></span></h2>
<div id="split">
<div id="followsyounot">
<h3 class="followsyounot">Too cool for me <span class="total"></span></h3>
<ul>
</ul>
</div>
<div id="followsyou">
<h3 class="followsyou">Follows me! <span class="total"></span></h3>
<ul>
</ul>
</div>
</div>
<div id="error" style="display:none">
<h3>Sorry, an error happened</h3>
<code class="message" style="font-weight:bold"></code>
<p>Most likely, these errors are just temporary and you can either just
try to reload the page or just wait a couple of minutes and <a href="">try again</a>.
</div>
<div class="clearer">&nbsp;</div>
<p id="pleasewait"><img src="{{ static_url("images/loading.gif") }}" alt="waiting...">
Please wait whilst we figure out every one you follow...</p>
<ul id="users" style="display:none">
{% if 0%}{% for username in screen_names %}
<li id="user__{{ username }}">
<a href="https://twitter.com/#!{{ username }}" class="thumbnail"
><img width="48" height="48"
src="http://api.twitter.com/1/users/profile_image/{{ username }}.png"></a>
<a href="https://twitter.com/#!{{ username }}" class="profile"
>{{ username }}</a><br>
<a href="/following/{{ username }}" class="compare">compare</a>
</li>
{% end %}{%end%}
</ul>
{% end %}
{% block extra_js %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
function lookup(usernames) {
$.getJSON('/json', {'usernames': usernames.join(',')}, function (response) {
if (response.ERROR) {
alert('ERROR: ' + response.ERROR);
return;
}
var c;
$.each(response, function(x, y) {
if (y)
c = $('#followsyou ul');
else
c = $('#followsyounot ul');
$('#user__' + x).detach().appendTo(c);
});
var t0 = $('#followsyounot li').size(),
t1 = $('#followsyou li').size();
$('#followsyounot .total').text('(' + t0 + ')');
$('#followsyou .total').text('(' + t1 + ')');
$('h2 .total').text('(' + t1 + '+' + t0 + '=' + (t1 + t0) + ')');
});
}
function post_load_usernames(all_usernames) {
var buckets = [], username, usernames = [];
$.each(all_usernames, function(i, username) {
usernames.push(username);
if (usernames.length == MAX) {
buckets.push(usernames);
usernames = [];
}
});
if (usernames.length) buckets.push(usernames);
for (var i in buckets) {
lookup(buckets[i]);
}
}
var MAX = 100;
$(function() {
$.getJSON('/everyone.json', function (response) {
if (response.ERROR) {
$('#error .message').text(response.ERROR);
$('#split').hide();
$('#error').show();
$('#pleasewait').remove();
return;
}
var li, p = $('#users');
$.each(response, function(i, username) {
li = $('<li>').attr('id', 'user__' + username);
li.append($('<a>')
.attr('href', 'http://twitter.com/#!' + username)
.addClass('thumbnail')
.append($('<img>')
.attr('width', '48')
.attr('height', '48')
.attr('src', 'http://api.twitter.com/1/users/profile_image/' + username + '.png')));
li.append($('<a>')
.attr('href', 'http://twitter.com/#!' + username)
.addClass('profile')
.text(username));
li.append($('<br>'));
li.append($('<a>')
.attr('href', '/following/' + username)
.addClass('compare')
.text('compare'));
li.appendTo(p);
});
post_load_usernames(response);
$('#pleasewait').remove();
});
});
</script>
{% end %}
Jump to Line
Something went wrong with that request. Please try again.