Created
January 10, 2009 15:47
-
-
Save maccman/45474 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>twitter</title> | |
<meta name="generator" content="TextMate http://macromates.com/"> | |
<meta name="author" content="Alex MacCaw"> | |
<!-- Date: 2009-01-10 --> | |
<script src="jquery.js" type="text/javascript" charset="utf-8"></script> | |
<script src="chain.js" type="text/javascript" charset="utf-8"></script> | |
<script src="binder.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
jQuery(function($){ | |
var tweets = $('#tweets').items('source', 'TwitterBinder'); | |
var isLoggedIn = function(){ | |
return tweets.invoke('logged_in?') | |
} | |
var logIn = function(){ | |
var user = $('user').val(); | |
var pass = $('pass').val(); | |
tweets.invoke('login', user, pass); | |
if(isLoggedIn()){ | |
$('#loginForm').hide(); | |
tweets.invoke('index'); | |
} else { | |
alert('Wrong credentials'); | |
} | |
} | |
// Update status | |
var update = function(){ | |
tweets.invoke('update', $('#update').val()); | |
} | |
// Add event handlers | |
$('#loginForm').submit(logIn); | |
$('#updateForm').submit(update); | |
if(isLoggedIn()){ | |
tweets.invoke('index'); | |
} else { | |
$('#loginForm').show(); | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="tweets"> | |
<div class="item"> | |
<img class="profile_image_url" /> | |
<span class="text">Loading...</span> | |
</div> | |
</div> | |
<form action="updateForm" method="get" accept-charset="utf-8"> | |
<input type="text" name="update" id="update"> | |
<input type="submit" value="Update →"> | |
</form> | |
<form action="loginForm" method="get" style="display:none"> | |
<input type="text" name="user" id="user"> | |
<input type="password" name="pass" id="pass"> | |
<p><input type="submit" value="Login →"></p> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment