mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-04 21:53:25 +01:00
88 lines
2.0 KiB
HTML
88 lines
2.0 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Doedel Drie Dee</title>
|
|
<script src="library/jquery.js"></script>
|
|
<script src="src/utils.js"></script>
|
|
<script src="src/box.js"></script>
|
|
|
|
<style>
|
|
.hidden {display: none;}
|
|
</style>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<script>
|
|
var api = "http://connect.doodle3d.com/api/";
|
|
var printers = [];
|
|
|
|
$(document).ready(function () {
|
|
"use strict";
|
|
|
|
var known = [];
|
|
|
|
var listSliceTest = $("#printers-slicetest");
|
|
var listSliceWebworker = $("#printers-webworker");
|
|
var listEditor = $("#printers-editor");
|
|
|
|
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>");
|
|
var editor = $("<li class='hidden'><a href='three.js-master/editor_slicer#" + localip + "'>" + name + "</a></li>");
|
|
|
|
listSliceTest.append(slice);
|
|
listSliceWebworker.append(webworker);
|
|
listEditor.append(editor);
|
|
|
|
var box = new D3D.Box(localip).init();
|
|
box.onconnect = function () {
|
|
slice.removeClass('hidden');
|
|
webworker.removeClass('hidden');
|
|
editor.removeClass('hidden');
|
|
};
|
|
box.ondisconnect = function () {
|
|
slice.addClass('hidden');
|
|
webworker.addClass('hidden');
|
|
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();
|
|
});
|
|
</script>
|
|
|
|
<p>Slice Test</p>
|
|
<ul id="printers-slicetest"></ul>
|
|
|
|
<p>Webworkers</p>
|
|
<ul id="printers-webworker"></ul>
|
|
|
|
<p>Editor</p>
|
|
<ul id="printers-editor"></ul>
|
|
|
|
</body>
|
|
</html> |