Team:TU Delft/pages/blog
From 2010.igem.org
(Difference between revisions)
Line 19: | Line 19: | ||
<html> | <html> | ||
- | <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui | + | <!-- <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.js"></script> --> |
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> | <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> | ||
Line 28: | Line 28: | ||
</style> | </style> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
- | |||
+ | var datePickerLoaded = false; | ||
+ | |||
+ | function dbgout(msg) { | ||
+ | var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; | ||
+ | if(is_chrome) console.log(msg); | ||
+ | } | ||
+ | |||
+ | function blog_loadDate(date) { | ||
+ | var datestr = jQuery.datepicker.formatDate("d_MM_yy", date); | ||
+ | var url = "/Team:TU_Delft/"+datestr+"_content?action=render"; | ||
+ | |||
+ | dbgout('blog_loadDate: ' + date); | ||
+ | |||
+ | $.get(url, function(response) { | ||
+ | $("#blog_item_container").fadeOut(200).queue(function(next) { | ||
+ | $(this).html(response); | ||
+ | var refURL = "https://2010.igem.org/Team:TU_Delft#/blog?blog=" + datestr; | ||
+ | $("#blog_item_date").text(jQuery.datepicker.formatDate("d MM yy", date)); | ||
+ | $("#blog_item_fbcomments").html('<fb:comments url="' + refURL + '" xid="igemblog' + datestr +'" numposts="10" width="450"></fb:comments>'); | ||
+ | FB.XFBML.parse(document.getElementById('blog_item_fbcomments')); | ||
+ | next(); | ||
+ | }).fadeIn(200); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | |||
+ | function blog_hashchange_cb() | ||
+ | { | ||
+ | // alert('blog hash update ' + location.hash); | ||
+ | |||
+ | dbgout('blog_hashchange'); | ||
+ | |||
+ | hash = location.hash.substring(1); | ||
+ | var kvmap = splitHash(hash); | ||
+ | |||
+ | if (kvmap.blog) { | ||
+ | blog_loadDate($.datepicker.parseDate('d_MM_yy', kvmap.blog)); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function blogInit() { | ||
+ | |||
+ | dbgout('blogInit'); | ||
+ | |||
var datemap = { | var datemap = { | ||
hasDate: function(d) { | hasDate: function(d) { | ||
Line 51: | Line 94: | ||
// find the last day with a blog item | // find the last day with a blog item | ||
var c=new Date(); | var c=new Date(); | ||
- | + | ||
- | if ( | + | var kvmap = splitHash(location.hash.substring(1)); |
- | c = $.datepicker.parseDate('d_MM_yy', | + | if (kvmap.blog) { |
+ | c = $.datepicker.parseDate('d_MM_yy', kvmap.blog); | ||
} else while(c.getDate() > 1) { | } else while(c.getDate() > 1) { | ||
if (datemap.hasDate(c)) | if (datemap.hasDate(c)) | ||
break; | break; | ||
c.setDate(c.getDate()-1); | c.setDate(c.getDate()-1); | ||
- | } | + | } |
$("#calendar_container").empty().datepicker( { | $("#calendar_container").empty().datepicker( { | ||
Line 66: | Line 110: | ||
}); | }); | ||
+ | dbgout('sethash: ' + $.datepicker.formatDate("d_MM_yy", c)); | ||
+ | setHash('pages/blogtest', { blog: $.datepicker.formatDate("d_MM_yy", c) } ); | ||
+ | blog_loadDate(c); | ||
- | + | dbgout('bind hashupdate'); | |
- | + | $(window).bind('hashupdate', blog_hashchange_cb); | |
- | + | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
function dp_onSelect(dateText, inst) { | function dp_onSelect(dateText, inst) { | ||
var date = $(this).datepicker("getDate"); | var date = $(this).datepicker("getDate"); | ||
- | + | //alert("selected: " +dateText); | |
+ | setHash('pages/blogtest', { blog: $.datepicker.formatDate("d_MM_yy", date) } ); | ||
} | } | ||
Line 92: | Line 128: | ||
return [wgUserName ? true : hasBlogItem, hasBlogItem ? 'day_with_blog' : 'day_no_blog']; | return [wgUserName ? true : hasBlogItem, hasBlogItem ? 'day_with_blog' : 'day_no_blog']; | ||
} | } | ||
+ | |||
+ | return c; | ||
+ | } | ||
+ | |||
+ | $(function() { | ||
+ | loadScript('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.js', function() { | ||
if (jQuery.support.boxModel) { | if (jQuery.support.boxModel) { | ||
// facebook initialization code | // facebook initialization code | ||
window.fbAsyncInit = function() { | window.fbAsyncInit = function() { | ||
- | |||
FB.init({appId: '132572820109093', status: true, cookie: true, xfbml: true}); | FB.init({appId: '132572820109093', status: true, cookie: true, xfbml: true}); | ||
+ | blogInit(); | ||
}; | }; | ||
Line 105: | Line 147: | ||
} else { | } else { | ||
$("#blog_item_fbcomments").text("Facebook comments unsupported on this browser."); | $("#blog_item_fbcomments").text("Facebook comments unsupported on this browser."); | ||
+ | blogInit(); | ||
} | } | ||
+ | }); | ||
}); | }); | ||
+ | |||
+ | var blogpage_close = function() { | ||
+ | dbgout('unbind hashupdate'); | ||
+ | $(window).unbind('hashupdate', blog_hashchange_cb); | ||
+ | }; | ||
+ | |||
+ | $(window).bind('page_close', blogpage_close); | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 11:57, 3 August 2010
Blog
Follow our progress day by day via our blog. Also don't forget to become a fan of our [http://tiny.cc/igemtudelft Facebook page] or [http://twitter.com/igemtudelft2010 follow us on Twitter].
Calendar
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
Today's post