1 2 3 4 5 6 7 8 9 10 11 12 |
|
function noop() {}
$(document).ready(function() {
function xhr(method, url, data, callback){
jQuery.getJSON(url, function() {
callback.apply(this, arguments);
scope.updateView();
});
}
var resourceFactory = new ResourceFactory(xhr);
var Tweeter = resourceFactory.route("http://twitter.com/statuses/:service:username.json", {}, {
home: {method:'GET', params: {service:'home_timeline'}, isArray:true },
user: {method:'GET', params: {service:'user_timeline/'}, isArray:true }
});
var scope = window.scope = angular.compile(document, {
location:angular.startUrlWatcher()
});
function fetchTweets(username){
return username ? Tweeter.user({username: username}) : Tweeter.home();
}
scope.set('fetchTweets', fetchTweets);
scope.set('users', [
{screen_name:'mhevery', name:'Mi\u0161ko Hevery',
notes:'Author of