2015-04-24 16:12:48 +02:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<title>Doedel Drie Dee</title>
|
2015-05-08 10:07:26 +02:00
|
|
|
<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>
|
2015-06-11 11:08:56 +02:00
|
|
|
|
|
|
|
<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";
|
|
|
|
|
2015-06-11 11:08:56 +02:00
|
|
|
var known = [];
|
|
|
|
|
2015-04-24 16:12:48 +02:00
|
|
|
var listSliceTest = $("#printers-slicetest");
|
2015-05-27 12:25:51 +02:00
|
|
|
var listSliceWebworker = $("#printers-webworker");
|
2015-06-12 15:58:26 +02:00
|
|
|
var listEditor = $("#printers-editor");
|
2015-04-24 16:12:48 +02:00
|
|
|
|
2015-06-11 11:08:56 +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>");
|
2015-06-11 11:08:56 +02:00
|
|
|
|
|
|
|
listSliceTest.append(slice);
|
|
|
|
listSliceWebworker.append(webworker);
|
2015-06-12 15:58:26 +02:00
|
|
|
listEditor.append(editor);
|
2015-06-11 11:08:56 +02:00
|
|
|
|
|
|
|
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');
|
2015-06-11 11:08:56 +02:00
|
|
|
};
|
|
|
|
box.ondisconnect = function () {
|
|
|
|
slice.addClass('hidden');
|
|
|
|
webworker.addClass('hidden');
|
2015-06-12 15:58:26 +02:00
|
|
|
editor.addClass('hidden');
|
2015-06-11 11:08:56 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
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>
|
2015-05-27 12:25:51 +02:00
|
|
|
|
|
|
|
<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>
|