Doodle3D-Slicer/index.html

80 lines
1.8 KiB
HTML
Raw Normal View History

2015-04-24 16:12:48 +02:00
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Doedel Drie Dee</title>
<script src="library/jquery.js"></script>
2015-04-24 21:32:39 +02:00
<script src="src/utils.js"></script>
<script src="src/box.js"></script>
<style>
.hidden {display: none;}
</style>
2015-04-24 16:12:48 +02:00
</head>
<body>
<script>
var api = "http://connect.doodle3d.com/api/";
var printers = [];
$(document).ready(function () {
"use strict";
var known = [];
2015-04-24 16:12:48 +02:00
var listSliceTest = $("#printers-slicetest");
var listSliceWebworker = $("#printers-webworker");
2015-04-24 16:12:48 +02:00
function addPrinter (name, localip) {
known.push(localip);
var slice = $("<li class='hidden'><a href='slice_test.html#" + localip + "'>" + name + "</a></li>");
var webworker = $("<li class='hidden'><a href='webworker_test.html#" + localip + "'>" + name + "</a></li>");
listSliceTest.append(slice);
listSliceWebworker.append(webworker);
var box = new D3D.Box(localip).init();
box.onconnect = function () {
slice.removeClass('hidden');
webworker.removeClass('hidden');
};
box.ondisconnect = function () {
slice.addClass('hidden');
webworker.addClass('hidden');
};
}
function checkNewBoxes () {
getAPI(api + "list.php", function (error, boxes) {
if (error) {
console.warn('It appears that you are not connected to the internet, or the Doodle3D servers are down');
return;
}
for (var i = 0; i < boxes.length; i ++) {
var box = boxes[i];
if (known.indexOf(box.localip) === -1) {
addPrinter(box.wifiboxid, box.localip);
}
}
});
}
addPrinter('Wired Printer', '192.168.5.1');
addPrinter('Node Server', window.location.host + ":3000");
setInterval(checkNewBoxes, 10000);
checkNewBoxes();
2015-04-24 16:12:48 +02:00
});
</script>
<p>Slice Test</p>
<ul id="printers-slicetest"></ul>
<p>Webworkers</p>
<ul id="printers-webworker"></ul>
2015-04-24 16:12:48 +02:00
</body>
</html>