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
var static = require('node-static'); | |
var file = new(static.Server)('./public', {cache: 1}); | |
require('http').createServer(function (request, response) { | |
request.addListener('end', function () { | |
file.serve(request, response, function (e, res) { | |
if (e && (e.status === 404)) { //still serve the index file | |
file.serveFile('/index.html', 200, {cache: 84000}, request, response); | |
} | |
}); | |
}); |
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
var bootstrap = { | |
loginSuccessful: function() { | |
FB.api('/me', function (resp) { | |
userid = resp.id; | |
}); | |
$('#message').text("Successfully logged in.").addClass('animated fadeIn'); | |
a = new A(); | |
// Start it motherfuckers | |
Backbone.history.start({pushState: true}) | |
}, |
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
var bootstrap = { | |
loginSuccessful: function() { | |
FB.api('/me', function (resp) { | |
userid = resp.id; | |
}); | |
$('#message').text("Successfully logged in.").addClass('animated fadeIn'); | |
a = new A(); | |
// Start it motherfuckers | |
Backbone.history.start({pushState: true}) | |
}, |
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
newsfeed: function () { | |
// save current mainpanemodel | |
a.mainpane.saveState(); | |
// we never fetch the newsfeed to get the latest stuff | |
var feed = new Feed(); | |
feed.bind('load:finished', this.loadFinished, this); | |
feed.bind('load:start', this.loadStart, this); | |
feed.bind('load:end', this.loadEnd, this); | |
feed.fetch(); | |
a.mainpane.addModel(feed, 0); |
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
newsfeed: function () { | |
// save current mainpanemodel | |
a.mainpane.saveState(); | |
// we never fetch the newsfeed to get the latest stuff | |
var feed = new Feed(); | |
feed.bind('load:finished', this.loadFinished, this); | |
feed.bind('load:start', this.loadStart, this); | |
feed.bind('load:end', this.loadEnd, this); | |
feed.fetch(); | |
a.mainpane.addModel(feed, 0); |
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
addModel: function (model, scroll) { | |
// remove the old model | |
var old = $(this.contentview).children(); | |
old.addClass('animated bounceOutLeft'); | |
window.setTimeout(function () { | |
old.removeClass('animated bounceOutLeft'); | |
old.remove(); | |
}, 1000); | |
// attach the new model | |
this.model = model; |
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
// fetch paged responses | |
sync: function(method, model, options) { | |
this.trigger('load:start', this); | |
if (!this.next) | |
FB.api('/me/home', {'limit': '100'}, options.success) | |
else | |
FB.api(this.next.replace(/^(?:\/\/|[^\/]+)*\//, '/'), options.success); | |
}, |
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
parse: function(resp, xhr){ | |
// create scope | |
var that = this; | |
// proper parsing of the response paging fields | |
if (resp.paging && resp.paging.next) | |
{ | |
this.next = resp.paging.next; | |
} | |
else | |
{ |
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
//CollectionView | |
addItem: function (item) { | |
// receive the appropriate view from the map in the application object | |
var view = new a.modelmap[item.get('type')].thumbView({model: item}); | |
// append it to the view | |
$(this.el).append(view.el); | |
// update masonry | |
this.update(); | |
}, |
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
// PhotoThumbView | |
showPhoto: function () { | |
// remove the selected class from other elements | |
$(this.el).siblings().removeClass('selected'); | |
// add it | |
$(this.el).addClass('selected'); | |
// add the photo to the viewer | |
a.viewer.addModel(this.model, $(a.mainpane.el).scrollTop()); | |
// add object to history | |
a.navigate('photo/'+this.model.get('id'), false); |
OlderNewer