RedWolves
9/19/2010 - 4:36 AM

talkabstracts.html

<!DOCTYPE html>
<html>
	<head>
		<meta charset=utf-8 />
		<title>TalkAbstracts</title>
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
		<script src="http://github.com/nje/jquery-tmpl/raw/master/jquery.tmpl.js"></script>
		<script type="text/javascript">
			$(function() {
				$.ajax({
					dataType: 	"json",
					url: 		"../htdocs/2010/boston/data/speakers.json",
					success: 	function(data) {
									var talks = $(data).toArray().sort(function(a,b){
																			var titleA = a.title.toLowerCase(), 
																				titleB = b.title.toLowerCase();
																			if (titleA < titleB) //sort string ascending
																			  return -1
																			 if (titleA > titleB)
																			  return 1
																			 return 0
																	   });
									for (talk in talks) {
										talks[talk].abstract = talks[talk].abstract.replace("\n","<" + "br />");
									}
									
									$("#talks")
										.tmpl(talks)
										.appendTo("#abstracts");
								},
					complete: function(){
						var tmplDiv = $("#abstracts div");
						tmplDiv.each(function(){
							var html = $(this).html().replace("&lt;br /&gt;","<br /><br />");
							$(this).html(html);
						});
					}
				});
			});
			
			
		</script>
		<script id="talks" type="text/x-jquery-tmpl">
			{{if abstract }}
			<div>
				<h3>${title}</h3>
				${abstract}
			</div>
			{{/if}}
		</script>
		<!--[if IE]>
  			<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
		<![endif]-->
		<style>
  			article, aside, figure, footer, header, hgroup, 
  			menu, nav, section { display: block; }
		</style>
	</head>
<body>
  <div id="abstracts"></div>
</body>
</html>​