Created
September 19, 2010 04:36
-
-
Save RedWolves/586394 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<!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("<br />","<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment