Tone.js/examples/index.html

95 lines
2.3 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>EXAMPLES</title>
2014-09-09 19:30:53 +00:00
2015-06-27 22:10:18 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
2015-12-08 05:06:58 +00:00
<link rel="icon" type="image/png" sizes="174x174" href="./style/favicon.png">
2014-09-05 05:31:10 +00:00
<script src="./scripts/jquery.min.js"></script>
<script src="https://tonejs.github.io/Logo/build/Logo.js"></script>
<script src="./scripts/ExampleList.js"></script>
2015-02-26 16:25:16 +00:00
<link rel="stylesheet" type="text/css" href="./style/examples.css">
2016-12-22 18:21:46 +00:00
<link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet">
2014-09-05 05:31:10 +00:00
</head>
<body>
2016-12-22 18:21:46 +00:00
<div id="Content" class="Example">
<iframe></iframe>
<div id="Sidebar"></div>
</div>
2016-12-22 18:21:46 +00:00
<script>
2014-09-05 05:31:10 +00:00
2016-12-22 18:21:46 +00:00
var container = $("#Sidebar");
2015-06-27 21:25:01 +00:00
2017-03-26 20:39:19 +00:00
var topbar = $("<div>").attr("id", "TopBar");
$("body").prepend(topbar);
// make the hamburger menu
var hamburger = $("<div>").attr("id", "Hamburger")
.appendTo(topbar);
for (var i = 0; i < 3; i++){
$("<span>").appendTo(hamburger);
}
hamburger.on("click", function(){
$("#Sidebar").toggleClass("Open");
});
2017-03-26 20:39:19 +00:00
//add the Logo
Logo({
"container" : topbar.get(0),
"height" : topbar.height() - 6,
"width" : 140
});
2016-12-22 18:21:46 +00:00
2017-03-26 20:39:19 +00:00
for (var catName in ExampleList){
$("<div>").addClass("Category").text(catName).appendTo(container);
var category = ExampleList[catName];
for (var example in category){
$("<div>").addClass("Item")
.appendTo(container)
.html($("<a>").attr("href", "#" + category[example]).text(example));
2016-12-22 18:21:46 +00:00
}
2017-03-26 20:39:19 +00:00
}
2016-12-22 18:21:46 +00:00
2017-03-26 20:39:19 +00:00
$(window).on("hashchange", setHash);
2015-06-27 22:10:18 +00:00
2017-03-26 20:39:19 +00:00
function setHash(){
var hash = window.location.hash.substring(1);
if (hash === ""){
return;
2016-12-22 18:21:46 +00:00
}
2017-03-26 20:39:19 +00:00
var exampleName;
//split hash at the .
if (hash.split(".").length === 2){
var split = hash.split(".");
hash = split[0];
exampleName = split[1];
}
var url = location.protocol+'//'+location.host+location.pathname + hash + ".html";
$("iframe").attr("src", url);
2016-12-22 18:21:46 +00:00
2017-03-26 20:39:19 +00:00
// close the sidebar if it's open
if ($("#Sidebar").hasClass("Open")){
$("#Sidebar").removeClass("Open");
}
2016-12-22 18:21:46 +00:00
2017-03-26 20:39:19 +00:00
// add the source link
var srcUrl = "https://github.com/Tonejs/Tone.js/blob/master/examples/"+hash+".html"
if (!$("#Source").length){
$("<a id=\"Source\"></a>").appendTo("#Content");
2015-06-27 21:25:01 +00:00
}
2017-03-26 20:39:19 +00:00
$("#Source").attr("href", srcUrl);
}
2015-06-27 22:10:18 +00:00
2017-03-26 20:39:19 +00:00
//set it initially
setHash();
2016-12-22 18:21:46 +00:00
2014-09-05 05:31:10 +00:00
</script>
</body>
</html>