Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

94 lines (84 sloc) 2.836 kb
<!doctype html>
<head>
<title>Bonsai Movie Library</title>
<meta name=viewport content=width=device-width,initial-scale=1>
<script src=../../lib/requirejs/require.js></script>
<!--<script src="http://localhost:8080/socket.io/socket.io.js"></script>-->
<style type="text/css">
body, html { margin: 0; font-family: sans-serif; font-size: 14px; }
#head {
background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
padding: 10px;
width:100%;
border-bottom: solid 1px #9E9E9E;
position:fixed;
left:0;
top:0;
}
#bs {
margin: 45px 0 0 0;
}
</style>
</head>
<body>
<div id="head">
<span id="selectContainer"></span>
<!--Width <input id="width" value="700">-->
<!--Height <input id="height" value="600">-->
<button id="next">Next</button>
</div>
<div id="bs"></div>
<script>
var movieList = (function() {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'movies/movie_list.json', false);
xhr.send(null);
return eval('(' + xhr.responseText + ')');
}());
require.config({
baseUrl: '../../src',
paths: {
bonsai: '.'
},
urlArgs: +new Date
});
require(['bonsai/bootstrapper/_dev/iframe'], function(player) {
var dropdown = '<select>' +
'<option disabled>Choose a movie &#x2026;</option>';
for (var groupName in movieList) {
var group = movieList[groupName];
dropdown += '<optgroup label="'+groupName+'">';
group.forEach(function(fileName){
dropdown += '<option>'+fileName+'</option>'
});
dropdown += '</optgroup>';
}
dropdown += '</select>';
document.getElementById('selectContainer').innerHTML = dropdown;
var selectNode = document.getElementsByTagName('select')[0];
selectNode.onchange = function() {
location.search = '?' + this.value;
};
var stageNode = document.getElementById('bs');
var nextNode = document.getElementById('next');
var script = location.search.length ? location.search.substr(1) : null;
nextNode.onclick = function() {
selectNode.selectedIndex = selectNode.selectedIndex + 1;
selectNode.onchange();
};
if (script) {
[].slice.call(selectNode).forEach(function(option, index) { if (option.value === script) selectNode.selectedIndex = index; })
}
player.setup({
noCache: true
}).run(stageNode, {
url: 'movies/' + script + '?' + new Date().getTime(),
width: document.width,
height: document.height - 50,
framerate: 60,
fpsLog: /animation/.test(script) // only show FPS log on animations
});
});
</script>
</body>
Jump to Line
Something went wrong with that request. Please try again.