2012-08-05 08:29:21 +00:00
|
|
|
function load_slides() {
|
|
|
|
|
var filelist = [
|
|
|
|
|
"What is the world made of",
|
2012-08-05 08:53:04 +00:00
|
|
|
"The strong interaction",
|
|
|
|
|
"The electromagnetic interaction",
|
|
|
|
|
"The weak interaction",
|
|
|
|
|
"Three Generations",
|
|
|
|
|
"Antimatter",
|
|
|
|
|
"The Higgs"
|
2012-08-05 11:47:02 +00:00
|
|
|
];
|
2012-08-05 08:29:21 +00:00
|
|
|
|
|
|
|
|
//$(filelist).each(function(){alert($(this).html());});
|
2012-08-05 10:00:11 +00:00
|
|
|
var last = false;
|
|
|
|
|
|
2012-08-05 08:29:21 +00:00
|
|
|
for (var i = 0; i < filelist.length; i++ ) {
|
2012-08-05 10:00:11 +00:00
|
|
|
|
|
|
|
|
if (i == filelist.length - 1 ) {
|
|
|
|
|
last = true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-05 08:29:21 +00:00
|
|
|
var filename = to_filename(filelist[i]);
|
|
|
|
|
// get
|
2012-08-05 10:00:11 +00:00
|
|
|
var chapter = get_html(filename, "chapter", "html", last);
|
2012-08-05 08:29:21 +00:00
|
|
|
//var readmore = get_html(filelist[i], "readmore", "html");
|
|
|
|
|
// here we just need the URL
|
|
|
|
|
//var icon = get_html(filelist[i], "img", "png");
|
|
|
|
|
//
|
2012-08-05 10:00:11 +00:00
|
|
|
//alert (chapter);
|
|
|
|
|
|
2012-08-05 08:29:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function to_filename(title) {
|
|
|
|
|
return title.toLowerCase().replace(/ /g, '_');
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-05 10:00:11 +00:00
|
|
|
function get_html(file, prefix, extension, last ){
|
|
|
|
|
|
2012-08-05 11:47:02 +00:00
|
|
|
$.ajax( {
|
|
|
|
|
url :"./" + prefix + "/" + file + "." + extension,
|
|
|
|
|
dataType: "html"
|
|
|
|
|
}
|
|
|
|
|
).done( function(data) {
|
2012-08-05 10:00:11 +00:00
|
|
|
//alert('<li class="slide"><div>' + data + "</div></li>");
|
2012-08-05 11:47:02 +00:00
|
|
|
$("#slider").append('<li class="slide"><div class="span12">' + data + "</div></li>");
|
2012-08-05 13:19:11 +00:00
|
|
|
//$("ul.nav-pills").append('<li><a href="#">' + $(data).find('h1').text() + '</a></li>');
|
2012-08-05 10:00:11 +00:00
|
|
|
if (last) {
|
|
|
|
|
set_sliders();
|
2012-08-05 13:19:11 +00:00
|
|
|
fill_menu();
|
2012-08-05 10:00:11 +00:00
|
|
|
}
|
|
|
|
|
//return data;
|
|
|
|
|
});
|
2012-08-05 08:29:21 +00:00
|
|
|
|
|
|
|
|
}
|
2012-08-05 13:19:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
function fill_menu() {
|
|
|
|
|
$($(".slide").get()).each(function() {
|
|
|
|
|
$("ul.nav-pills").append('<li><a href="#">' + $(this).find('h1').html() + '</a></li>');
|
|
|
|
|
});
|
|
|
|
|
}
|