Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (56 sloc) 1.43 KB
<!DOCTYPE html>
<html>
<head>
<title>PoofViewer</title>
<style type="text/css">
body {
margin: 0px !important;
background: black;
}
#img {
position:absolute;
}
#center {
left: 50%;
position: absolute;
width: 2px;
height: 100%;
margin-left: 0px;
background-color: red;
}
</style>
<script src="ui/js/jquery.js"></script>
<script>
setInterval("reload()", 5000);
function reload() {
$("#img").attr("src",$("#img").attr("src"));
}
var angleOffset = 0; // get this from robot code (camera misalignment correction factor)
var realign = function() {
var w = $(window).width();
var h = $(window).height();
var r = w/h;
var newW = 0;
if (r >= (320.0/240.0)) { // wider than tall
newW = h* (320.0/240.0);
$("#img").attr('height', h);
$("#img").attr('width', newW);
} else { // taller than wide
newW = w;
$("#img").attr('height', w * 240.0 / 320.0);
$("#img").attr('width', newW);
}
$("#img").css('left', ((w - newW)/2.0) + "px");
$("#center").css('margin-left', newW * (-angleOffset / 47.0));
}
$(function() {
$(window).resize(realign);
realign();
});
</script>
</head>
<body>
<img id="img" src="http://10.2.54.11/mjpg/video.mjpg" />
<div id="center"></div>
</body>
</html>