<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ecs-rust web examples</title>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="./index.css">
</head>
<body>
<div id="panel">
<div id="header">
<h1><a href="https://github.com/takahirox/ecs-rust" target="_blank">ecs-rust</a></h1>
<div id="expandButton"></div>
</div>
<div id="panelScrim"></div>
<div id="contentWrapper">
<div id="content"></div>
</div>
</div>
<iframe id="viewer" name="viewer" onmousewheel=""></iframe>
<script>
const exampleNames = [
'canvas',
'collision'
];
const content = document.getElementById('content');
const viewer = document.getElementById('viewer');
const panel = document.getElementById('panel');
const panelScrim = document.getElementById('panelScrim');
const expandButton = document.getElementById('expandButton');
const openExample = exampleName => {
viewer.src = exampleName + '/index.html';
window.location.hash = exampleName;
viewer.focus();
panel.classList.remove('open');
};
exampleNames.forEach(name => {
const a = document.createElement('a');
a.innerText = name;
a.href = name + '.html';
a.target = 'viewer';
a.addEventListener('click', event => {
if (event.button !== 0 || event.ctrlKey || event.altKey ||
event.shiftKey || event.metaKey) {
return;
}
event.preventDefault();
openExample(name);
});
content.appendChild(a);
content.appendChild(document.createElement('br'));
});
const onClickForOpen = event => {
event.preventDefault();
panel.classList.toggle('open');
};
expandButton.addEventListener('click', onClickForOpen);
panelScrim.addEventListener('click', onClickForOpen);
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) {
viewer.style.width = getComputedStyle(viewer).width;
viewer.style.height = getComputedStyle(viewer).height;
viewer.setAttribute('scrolling', 'no');
}
if (window.location.hash !== '') {
const hash = window.location.hash.substring(1);
if (exampleNames.includes(hash)) {
openExample(hash);
}
}
</script>
</body>
</html>