Permalink
Browse files

added script.js to load gists.

  • Loading branch information...
1 parent 4ede18d commit 8856da8e699021cfb8f42cbe8cb7447f57f91170 @mikevalstar committed Nov 11, 2011
Showing with 29 additions and 5 deletions.
  1. +11 −0 htdocs/js/mikevalstar.js
  2. +12 −0 htdocs/js/script.min.js
  3. +1 −0 views/layout.jade
  4. +5 −5 views/post/bp_103.jade
View
@@ -9,6 +9,9 @@ var disqus_shortname = 'mikevalstar'; // required: replace example with your for
var disqus_identifier = 'bp_0';
var disqus_url = 'http://mikevalstar.com/';
+script.defaults.defer = true;
+script.defaults.base = 'http://gist.github.com';
+
var MV = {};
MV.nav = {
@@ -47,6 +50,7 @@ MV.content = {
if($('#disqus_thread').length == 1)
MV.content.loadDisqus();
+ MV.content.loadGist();
$(document).attr('title', $(responseText).filter('title').text());
if(fn) fn();
@@ -65,6 +69,13 @@ MV.content = {
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}
+
+ , loadGist: function(){
+ var gists = $('.gistC');
+ $.each(gists, function(){
+ script({src: $(this).attr('id'), append: $(this).attr('id')});
+ });
+ }
}
View
Oops, something went wrong.
View
@@ -7,6 +7,7 @@ html(lang="en")
script(src='http://code.jquery.com/jquery-1.7.min.js', type='text/javascript')
script(src='/js/jquery.tweet.js', type='text/javascript')
script(src='/js/jquery.ba-hashchange.min.js', type='text/javascript')
+ script(src='/js/script.min.js', type='text/javascript')
script(src='/js/mikevalstar.js', type='text/javascript')
//if lt IE 9
View
@@ -65,22 +65,22 @@
The base express install comes with a simple layout & page combo to get you started. Lets start by modifying them slightly:
#### layout.jade
- script(src="https://gist.github.com/1358857.js?file=layout.jade")
+ .gistC(id="1358857.js?file=layout.jade"): script(src="https://gist.github.com/1358857.js?file=layout.jade")
:markdown
#### index.jade
- script(src="https://gist.github.com/1358857.js?file=index.jade")
+ .gistC(id="1358857.js?file=index.jade"): script(src="https://gist.github.com/1358857.js?file=index.jade")
h3 Writing a Simple Page Router
:markdown
To start lets build a simple static page router for a few more pages of the site:
#### lib/StaticPages.js
- script(src="https://gist.github.com/1358857.js?file=StaticPages.js")
+ .gistC(id="1358857.js?file=StaticPages.js"): script(src="https://gist.github.com/1358857.js?file=StaticPages.js")
:markdown
And alter app.js to use this new router.
#### app.js
- script(src="https://gist.github.com/1358857.js?file=app.js")
+ .gistC(id="1358857.js?file=app.js"): script(src="https://gist.github.com/1358857.js?file=app.js")
:markdown
What we are doing now is loading up the StaticPage.js file as a variable "static_pages" and calling the initPages() function in order to init these new routes.
@@ -91,7 +91,7 @@
Now that we have the basic pages setup we can add in a semi-dynamic route for our blog pages.
#### lib/StaticPages.js
- script(src="https://gist.github.com/1358857.js?file=StaticPagesv2.js")
+ .gistC(id="1358857.js?file=StaticPagesv2.js"): script(src="https://gist.github.com/1358857.js?file=StaticPagesv2.js")
:markdown
The ":id" and ":title" variables allow us to use portions of the URI in order to determine content and we are using them to load the blog posts from the **posts** folder located in the **views** directory

0 comments on commit 8856da8

Please sign in to comment.