Doodle3D-Slicer/index.html

88 lines
2.0 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-06-12 15:58:26 +02:00
var listEditor = $("#printers-editor");
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>");
2015-06-12 21:19:56 +02:00
var editor = $("<li class='hidden'><a href='three.js-master/editor_slicer#" + localip + "'>" + name + "</a></li>");
listSliceTest.append(slice);
listSliceWebworker.append(webworker);
2015-06-12 15:58:26 +02:00
listEditor.append(editor);
var box = new D3D.Box(localip).init();
box.onconnect = function () {
slice.removeClass('hidden');
webworker.removeClass('hidden');
2015-06-12 15:58:26 +02:00
editor.removeClass('hidden');
};
box.ondisconnect = function () {
slice.addClass('hidden');
webworker.addClass('hidden');
2015-06-12 15:58:26 +02:00
editor.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-06-12 15:58:26 +02:00
<p>Editor</p>
<ul id="printers-editor"></ul>
2015-04-24 16:12:48 +02:00
</body>
</html>