Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better 404

  • Loading branch information...
commit 334874935ca99fdcca02b10cbe4422b5c7c4466a 1 parent 74cbd8a
@benbalter authored
Showing with 5 additions and 2 deletions.
  1. +4 −1 _cs/application.coffee
  2. +1 −1  _includes/js/application.js
View
5 _cs/application.coffee
@@ -318,11 +318,13 @@ class Router extends Backbone.Router
Application.tags = new Application.Collections.Tags
Application.tags.on "reset", ->
new Application.Views.Tag( model: Application.tags.get tag ).render()
+ @setNav ''
category: (category) ->
Application.categories = new Application.Collections.Categories
Application.categories.on "reset", ->
new Application.Views.Category( model: Application.categories.get category ).render()
+ @setNav ''
redirect: ->
document.location = Application.url + "/" + Backbone.history.fragment
@@ -340,7 +342,8 @@ Backbone.history.start pushState: true, silent: true
if window.is404? and window.is404
window.is404 = null
- Application.router.navigate document.location.pathname.replace("/",""), trigger: true
+ Application.router.navigate "", replace: true
+ Application.router.navigate document.location.pathname.replace("/",""), trigger: true, replace: true
jQuery(document).ready ->
View
2  _includes/js/application.js
@@ -1 +1 @@
-(function(){var t,e={}.hasOwnProperty,o=function(t,o){function n(){this.constructor=t}for(var i in o)e.call(o,i)&&(t[i]=o[i]);return n.prototype=o.prototype,t.prototype=new n,t.__super__=o.prototype,t},n=function(t,e){return function(){return t.apply(e,arguments)}};window.Application={Models:{},Collections:{},Views:{},router:{},tags:{},categories:{},url:"{{ site.url }}",name:"{{ site.name }}",disqus:{name:"{{ site.disqus.shortname }}",api_key:"{{ site.disqus.api_key }}",count:"{{ site.disqus.count }}"},twitter:{count:"{{ site.twitter.count }}",username:"{{ site.twitter.username }}"}},Application.Models.Post=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.url=function(){return Application.url+"/"+this.id+".json"},e.prototype.defaults={author:"Benjamin J. Balter",title:"",url:"",content:"",tags:[],category:"",date:""},e}(Backbone.Model),Application.Models.Page=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.url=function(){return Application.url+"/"+this.id+".json"},e}(Backbone.Model),Application.Models.Thread=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.url=function(){var t;return t="https://disqus.com/api/3.0/threads/details.json?",t+="thread="+this.id,t+="&api_key="+Application.disqus.api_key,t+="&callback=?"},e.prototype.parse=function(t){return t.response},e}(Backbone.Model),Application.Models.Comment=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.initialize=function(){var t=this;return this.set("thread",new Application.Models.Thread({id:this.get("thread")})),this.get("thread").fetch({success:function(){return t.collection.trigger("change")}})},e}(Backbone.Model),Application.Models.Tweet=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e}(Backbone.Model),Application.Models.Tag=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e}(Backbone.Model),Application.Models.Category=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e}(Backbone.Model),Application.Collections.Comments=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Comment,e.prototype.url=function(){var t;return t="https://disqus.com/api/3.0/posts/list.json?",t+="forum="+Application.disqus.name,t+="&limit="+Application.disqus.count,t+="&api_key="+Application.disqus.api_key,t+="&callback=?"},e.prototype.parse=function(t){return t.response},e}(Backbone.Collection),Application.Collections.Tweets=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Tweet,e.prototype.url=function(){var t;return t="https://api.twitter.com/1/statuses/user_timeline.json?include_rts=true",t+="&screen_name="+Application.twitter.username,t+="&count="+Application.twitter.count,t+="&callback=?"},e}(Backbone.Collection),Application.Collections.Posts=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Post,e.prototype.url=function(){return Application.url+"/"+"pages.json"},e.prototype.comparator=function(t,e){var o;return t=t.get("date"),e=e.get("date"),t===e?o=1:t>e?o=-1:e>t&&(o=1),o},e}(Backbone.Collection),Application.Collections.Pages=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Page,e.prototype.url=function(){return Application.url+"/"+"pages.json"},e}(Backbone.Collection),Application.Collections.Tags=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Tag,e.prototype.url=function(){return Application.url+"/tags.json"},e.prototype.initialize=function(){return this.fetch()},e.prototype.parse=function(t){var e,o,n;for(o=0,n=t.length;n>o;o++)e=t[o],e.posts=new Application.Collections.Posts(e.posts);return t},e}(Backbone.Collection),Application.Collections.Categories=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Category,e.prototype.url=function(){return Application.url+"/categories.json"},e.prototype.initialize=function(){return this.fetch()},e.prototype.parse=function(t){var e,o,n;for(o=0,n=t.length;n>o;o++)e=t[o],e.posts=new Application.Collections.Posts(e.posts);return t},e}(Backbone.Collection),Application.Views.Post=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#main",e.prototype.tagName="article",e.prototype["class"]="post",e.prototype.template=JST.post,e.prototype.render=function(){return this.$el.append(this.template(this.model.toJSON())),this.model.get("comments")?this.loadDisqus():void 0},e.prototype.loadDisqus=function(){var t;return window.disqus_shortname=Application.disqus.name,window.disqus_identifier=this.model.get("id"),window.disqus_url=Application.url+"/"+this.model.get("id"),window.disqus_title=this.model.get("title")+" » "+Application.name,"undefined"!=typeof DISQUS&&null!==DISQUS?DISQUS.reset({reload:!0,config:function(){return this.page.identifier=disqus_identifier,this.page.url=disqus_url,this.page.title=disqus_title}}):(t=document.createElement("script"),t.type="text/javascript",t.async=!0,t.src="http://"+disqus_shortname+".disqus.com/embed.js",(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(t))},e}(Backbone.View),Application.Views.PostExcerpt=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el=".posts",e.prototype.tagName="article",e.prototype["class"]="post",e.prototype.template=JST.post_excerpt,e.prototype.initialize=function(){return this.model.on("change",this.render)},e.prototype.render=function(){var t;return t=this.getExcerpted(),this.$el.append(this.template(t.toJSON()))},e.prototype.getExcerpted=function(){var t;return t=this.model.clone(),t.set("content",this.model.get("content").split("<!-- more -->")[0]),t},e}(Backbone.View),Application.Views.Page=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#main",e.prototype.tagName="article",e.prototype["class"]="page",e.prototype.template=JST.page,e.prototype.render=function(){return this.$el.html(this.template(this.model.toJSON())),"undefined"!=typeof DISQUS&&null!==DISQUS&&DISQUS.reset(),this.resume_resize()},e.prototype.resume_resize=function(){return $(".page-resume .bar").height($(".content").height()-15)},e}(Backbone.View),Application.Views.Single=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#content",e.prototype.template=JST.single,e.prototype.initialize=function(){return this.model.on("change",this.render)},e.prototype.render=function(){var t;return this.$el.html(this.template(this.model.toJSON())),"post"===this.model.get("layout")?t=new Application.Views.Post({model:this.model}):"page"===this.model.get("layout")&&(t=new Application.Views.Page({model:this.model})),document.title=this.model.get("title")+" » "+Application.name,t.render(),$.smoothScroll({scrollTarget:".title",offset:-60}),jQuery("#content").infinitescroll("destory")},e}(Backbone.View),Application.Views.Index=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#content",e.prototype.template=$("#index_layout").html(),e.prototype.render=function(){var t,e,o;return this.$el.html(this.template),this.collection.sort(),this.collection.slice(0,10).forEach(function(t){var e;return t.fetch(),e=new Application.Views.PostExcerpt({model:t})}),t=new Application.Collections.Comments,o=new Application.Views.CommentView({collection:t}),t.fetch(),e=new Application.Collections.Tweets,o=new Application.Views.TweetView({collection:e}),e.fetch()},e}(Backbone.View),Application.Views.CommentView=function(t){function e(){return this.render=n(this.render,this),this.initialize=n(this.initialize,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#recentcomments",e.prototype.template=JST.recent_comments,e.prototype.initialize=function(){return this.collection.on("change",this.render)},e.prototype.render=function(){return this.$el.html(this.template({comments:this.collection.toJSON()}))},e}(Backbone.View),Application.Views.TweetView=function(t){function e(){return this.render=n(this.render,this),this.initialize=n(this.initialize,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#tweets",e.prototype.template=JST.recent_tweets,e.prototype.initialize=function(){return this.collection.on("all",this.render)},e.prototype.render=function(){return this.$el.html(this.template({tweets:this.collection.toJSON()}))},e}(Backbone.View),Application.Views.Tag=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#content",e.prototype.template=JST.tag,e.prototype.render=function(){return this.$el.html(this.template({tag:this.model.toJSON()})),$.smoothScroll({scrollTarget:".title",offset:-60}),jQuery("#content").infinitescroll("destory"),document.title="Posts tagged '"+this.model.get("id")+"'' » "+Application.name},e}(Backbone.View),Application.Views.Category=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#content",e.prototype.template=JST.category,e.prototype.render=function(){return this.$el.html(this.template({category:this.model.toJSON()})),$.smoothScroll({scrollTarget:".title",offset:-60}),jQuery("#content").infinitescroll("destory"),document.title="Posts categorized '"+this.model.get("id")+"'' » "+Application.name},e}(Backbone.View),t=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.routes={":year/:month/:day/:slug/":"post","tags/:tag/":"tag","categories/:category/":"category",":slug/":"page","":"index"},e.prototype.post=function(t,e,o,n){var i,r;return i=new Application.Models.Post({id:t+"/"+e+"/"+o+"/"+n}),Application.posts.add(i),r=new Application.Views.Single({model:i}),i.fetch({error:this.redirect}),this.setNav("")},e.prototype.page=function(t){var e,o;return e=new Application.Models.Page({id:t}),Application.pages.add(e),o=new Application.Views.Single({model:e}),e.fetch({error:this.redirect}),this.setNav(t.replace("/",""))},e.prototype.index=function(){var t;return t=new Application.Views.Index({collection:Application.posts}),Application.posts.fetch({error:this.redirect,success:function(){return t.render()}}),this.setNav("home")},e.prototype.tag=function(t){return Application.tags=new Application.Collections.Tags,Application.tags.on("reset",function(){return new Application.Views.Tag({model:Application.tags.get(t)}).render()})},e.prototype.category=function(t){return Application.categories=new Application.Collections.Categories,Application.categories.on("reset",function(){return new Application.Views.Category({model:Application.categories.get(t)}).render()})},e.prototype.redirect=function(){return document.location=Application.url+"/"+Backbone.history.fragment},e.prototype.setNav=function(t){return $(".nav .active").removeClass("active"),t.length?$(".nav #"+t).addClass("active"):void 0},e}(Backbone.Router),Application.posts=new Application.Collections.Posts,Application.pages=new Application.Collections.Pages,Application.router=new t,Backbone.history.start({pushState:!0,silent:!0}),null!=window.is404&&window.is404&&(window.is404=null,Application.router.navigate(document.location.pathname.replace("/",""),{trigger:!0})),jQuery(document).ready(function(){return window.resume_resize=function(){return $(".page-resume .bar").height($(".content").height()-15)},$(window).resize(resume_resize),resume_resize(),$('a[href^="{{ site.url }}/"]').live("click",function(t){return t.preventDefault(),Application.router.navigate($(this).attr("href").replace("{{ site.url }}/",""),{trigger:!0}),!1}),""===Backbone.history.fragment?jQuery("#content").infinitescroll({navSelector:"nav.pagination",nextSelector:"nav.pagination #next",itemSelector:"article.post"}):void 0})}).call(this);
+(function(){var t,e={}.hasOwnProperty,o=function(t,o){function n(){this.constructor=t}for(var i in o)e.call(o,i)&&(t[i]=o[i]);return n.prototype=o.prototype,t.prototype=new n,t.__super__=o.prototype,t},n=function(t,e){return function(){return t.apply(e,arguments)}};window.Application={Models:{},Collections:{},Views:{},router:{},tags:{},categories:{},url:"{{ site.url }}",name:"{{ site.name }}",disqus:{name:"{{ site.disqus.shortname }}",api_key:"{{ site.disqus.api_key }}",count:"{{ site.disqus.count }}"},twitter:{count:"{{ site.twitter.count }}",username:"{{ site.twitter.username }}"}},Application.Models.Post=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.url=function(){return Application.url+"/"+this.id+".json"},e.prototype.defaults={author:"Benjamin J. Balter",title:"",url:"",content:"",tags:[],category:"",date:""},e}(Backbone.Model),Application.Models.Page=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.url=function(){return Application.url+"/"+this.id+".json"},e}(Backbone.Model),Application.Models.Thread=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.url=function(){var t;return t="https://disqus.com/api/3.0/threads/details.json?",t+="thread="+this.id,t+="&api_key="+Application.disqus.api_key,t+="&callback=?"},e.prototype.parse=function(t){return t.response},e}(Backbone.Model),Application.Models.Comment=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.initialize=function(){var t=this;return this.set("thread",new Application.Models.Thread({id:this.get("thread")})),this.get("thread").fetch({success:function(){return t.collection.trigger("change")}})},e}(Backbone.Model),Application.Models.Tweet=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e}(Backbone.Model),Application.Models.Tag=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e}(Backbone.Model),Application.Models.Category=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e}(Backbone.Model),Application.Collections.Comments=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Comment,e.prototype.url=function(){var t;return t="https://disqus.com/api/3.0/posts/list.json?",t+="forum="+Application.disqus.name,t+="&limit="+Application.disqus.count,t+="&api_key="+Application.disqus.api_key,t+="&callback=?"},e.prototype.parse=function(t){return t.response},e}(Backbone.Collection),Application.Collections.Tweets=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Tweet,e.prototype.url=function(){var t;return t="https://api.twitter.com/1/statuses/user_timeline.json?include_rts=true",t+="&screen_name="+Application.twitter.username,t+="&count="+Application.twitter.count,t+="&callback=?"},e}(Backbone.Collection),Application.Collections.Posts=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Post,e.prototype.url=function(){return Application.url+"/"+"pages.json"},e.prototype.comparator=function(t,e){var o;return t=t.get("date"),e=e.get("date"),t===e?o=1:t>e?o=-1:e>t&&(o=1),o},e}(Backbone.Collection),Application.Collections.Pages=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Page,e.prototype.url=function(){return Application.url+"/"+"pages.json"},e}(Backbone.Collection),Application.Collections.Tags=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Tag,e.prototype.url=function(){return Application.url+"/tags.json"},e.prototype.initialize=function(){return this.fetch()},e.prototype.parse=function(t){var e,o,n;for(o=0,n=t.length;n>o;o++)e=t[o],e.posts=new Application.Collections.Posts(e.posts);return t},e}(Backbone.Collection),Application.Collections.Categories=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.model=Application.Models.Category,e.prototype.url=function(){return Application.url+"/categories.json"},e.prototype.initialize=function(){return this.fetch()},e.prototype.parse=function(t){var e,o,n;for(o=0,n=t.length;n>o;o++)e=t[o],e.posts=new Application.Collections.Posts(e.posts);return t},e}(Backbone.Collection),Application.Views.Post=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#main",e.prototype.tagName="article",e.prototype["class"]="post",e.prototype.template=JST.post,e.prototype.render=function(){return this.$el.append(this.template(this.model.toJSON())),this.model.get("comments")?this.loadDisqus():void 0},e.prototype.loadDisqus=function(){var t;return window.disqus_shortname=Application.disqus.name,window.disqus_identifier=this.model.get("id"),window.disqus_url=Application.url+"/"+this.model.get("id"),window.disqus_title=this.model.get("title")+" » "+Application.name,"undefined"!=typeof DISQUS&&null!==DISQUS?DISQUS.reset({reload:!0,config:function(){return this.page.identifier=disqus_identifier,this.page.url=disqus_url,this.page.title=disqus_title}}):(t=document.createElement("script"),t.type="text/javascript",t.async=!0,t.src="http://"+disqus_shortname+".disqus.com/embed.js",(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(t))},e}(Backbone.View),Application.Views.PostExcerpt=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el=".posts",e.prototype.tagName="article",e.prototype["class"]="post",e.prototype.template=JST.post_excerpt,e.prototype.initialize=function(){return this.model.on("change",this.render)},e.prototype.render=function(){var t;return t=this.getExcerpted(),this.$el.append(this.template(t.toJSON()))},e.prototype.getExcerpted=function(){var t;return t=this.model.clone(),t.set("content",this.model.get("content").split("<!-- more -->")[0]),t},e}(Backbone.View),Application.Views.Page=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#main",e.prototype.tagName="article",e.prototype["class"]="page",e.prototype.template=JST.page,e.prototype.render=function(){return this.$el.html(this.template(this.model.toJSON())),"undefined"!=typeof DISQUS&&null!==DISQUS&&DISQUS.reset(),this.resume_resize()},e.prototype.resume_resize=function(){return $(".page-resume .bar").height($(".content").height()-15)},e}(Backbone.View),Application.Views.Single=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#content",e.prototype.template=JST.single,e.prototype.initialize=function(){return this.model.on("change",this.render)},e.prototype.render=function(){var t;return this.$el.html(this.template(this.model.toJSON())),"post"===this.model.get("layout")?t=new Application.Views.Post({model:this.model}):"page"===this.model.get("layout")&&(t=new Application.Views.Page({model:this.model})),document.title=this.model.get("title")+" » "+Application.name,t.render(),$.smoothScroll({scrollTarget:".title",offset:-60}),jQuery("#content").infinitescroll("destory")},e}(Backbone.View),Application.Views.Index=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#content",e.prototype.template=$("#index_layout").html(),e.prototype.render=function(){var t,e,o;return this.$el.html(this.template),this.collection.sort(),this.collection.slice(0,10).forEach(function(t){var e;return t.fetch(),e=new Application.Views.PostExcerpt({model:t})}),t=new Application.Collections.Comments,o=new Application.Views.CommentView({collection:t}),t.fetch(),e=new Application.Collections.Tweets,o=new Application.Views.TweetView({collection:e}),e.fetch()},e}(Backbone.View),Application.Views.CommentView=function(t){function e(){return this.render=n(this.render,this),this.initialize=n(this.initialize,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#recentcomments",e.prototype.template=JST.recent_comments,e.prototype.initialize=function(){return this.collection.on("change",this.render)},e.prototype.render=function(){return this.$el.html(this.template({comments:this.collection.toJSON()}))},e}(Backbone.View),Application.Views.TweetView=function(t){function e(){return this.render=n(this.render,this),this.initialize=n(this.initialize,this),e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#tweets",e.prototype.template=JST.recent_tweets,e.prototype.initialize=function(){return this.collection.on("all",this.render)},e.prototype.render=function(){return this.$el.html(this.template({tweets:this.collection.toJSON()}))},e}(Backbone.View),Application.Views.Tag=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#content",e.prototype.template=JST.tag,e.prototype.render=function(){return this.$el.html(this.template({tag:this.model.toJSON()})),$.smoothScroll({scrollTarget:".title",offset:-60}),jQuery("#content").infinitescroll("destory"),document.title="Posts tagged '"+this.model.get("id")+"'' » "+Application.name},e}(Backbone.View),Application.Views.Category=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.el="#content",e.prototype.template=JST.category,e.prototype.render=function(){return this.$el.html(this.template({category:this.model.toJSON()})),$.smoothScroll({scrollTarget:".title",offset:-60}),jQuery("#content").infinitescroll("destory"),document.title="Posts categorized '"+this.model.get("id")+"'' » "+Application.name},e}(Backbone.View),t=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.routes={":year/:month/:day/:slug/":"post","tags/:tag/":"tag","categories/:category/":"category",":slug/":"page","":"index"},e.prototype.post=function(t,e,o,n){var i,r;return i=new Application.Models.Post({id:t+"/"+e+"/"+o+"/"+n}),Application.posts.add(i),r=new Application.Views.Single({model:i}),i.fetch({error:this.redirect}),this.setNav("")},e.prototype.page=function(t){var e,o;return e=new Application.Models.Page({id:t}),Application.pages.add(e),o=new Application.Views.Single({model:e}),e.fetch({error:this.redirect}),this.setNav(t.replace("/",""))},e.prototype.index=function(){var t;return t=new Application.Views.Index({collection:Application.posts}),Application.posts.fetch({error:this.redirect,success:function(){return t.render()}}),this.setNav("home")},e.prototype.tag=function(t){return Application.tags=new Application.Collections.Tags,Application.tags.on("reset",function(){return new Application.Views.Tag({model:Application.tags.get(t)}).render()}),this.setNav("")},e.prototype.category=function(t){return Application.categories=new Application.Collections.Categories,Application.categories.on("reset",function(){return new Application.Views.Category({model:Application.categories.get(t)}).render()})},e.setNav(""),e.prototype.redirect=function(){return document.location=Application.url+"/"+Backbone.history.fragment},e.prototype.setNav=function(t){return $(".nav .active").removeClass("active"),t.length?$(".nav #"+t).addClass("active"):void 0},e}(Backbone.Router),Application.posts=new Application.Collections.Posts,Application.pages=new Application.Collections.Pages,Application.router=new t,Backbone.history.start({pushState:!0,silent:!0}),null!=window.is404&&window.is404&&(window.is404=null,Application.router.navigate("",{replace:!0}),Application.router.navigate(document.location.pathname.replace("/",""),{trigger:!0,replace:!0})),jQuery(document).ready(function(){return window.resume_resize=function(){return $(".page-resume .bar").height($(".content").height()-15)},$(window).resize(resume_resize),resume_resize(),$('a[href^="{{ site.url }}/"]').live("click",function(t){return t.preventDefault(),Application.router.navigate($(this).attr("href").replace("{{ site.url }}/",""),{trigger:!0}),!1}),""===Backbone.history.fragment?jQuery("#content").infinitescroll({navSelector:"nav.pagination",nextSelector:"nav.pagination #next",itemSelector:"article.post"}):void 0})}).call(this);
Please sign in to comment.
Something went wrong with that request. Please try again.