forked from jscad/OpenJSCAD.org
-
Notifications
You must be signed in to change notification settings - Fork 1
/
min.html
113 lines (92 loc) · 3.59 KB
/
min.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html>
<!--
== OpenJSCAD.org, Copyright (c) 2016, Licensed under MIT License ==
in conjunction with other libraries by various authors (see the individual files)
Purpose:
This application provides an example of how to show JSCAD designs with minimal HTML and CSS.
History:
2016/06/27: 0.5.1: Changes for 0.5.1 libraries by Z3 Dev
2016/05/01: 0.5.0: Changes for 0.5.0 libraries by Z3 Dev
2016/02/02: 0.4.0: Initial version by Z3 Dev
-->
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Allwine Designs OpenJSCAD Widget</title>
<script src="js/iframeResizer.contentWindow.min.js"></script>
<script src="jquery/jquery-1.9.1.js?0.5.1"></script>
<script src="jquery/jquery.hammer.js?0.5.1"></script>
<script src="lightgl.js"></script>
<script src="csg.js?0.5.1"></script>
<script src="formats.js?0.5.1"></script>
<script src="openjscad.js?0.5.1"></script>
<script src="openscad.js?0.5.1"></script>
<script src="js/jscad-worker.js?0.5.1" charset="utf-8"></script>
<script src="js/jscad-function.js?0.5.1" charset="utf-8"></script>
<link rel="stylesheet" href="min.css?0.5.1" type="text/css">
</head>
<body onload="loadProcessor()">
<!-- setup display of the errors as required by OpenJSCAD.js -->
<div class="jscad-container">
<!-- setup display of the viewer, i.e. canvas -->
<div style="position: relative;">
<div oncontextmenu="return false;" id="viewerContext"></div>
<!-- setup display of the status, as required by OpenJSCAD.js -->
<!-- set display: block to display this -->
<div id="tail" style="display: none; position: absolute; top: 5px; left: 5px;">
<div id="statusdiv"></div>
</div>
</idv>
<!-- setup display of the design parameters, as required by OpenJSCAD.js -->
<!-- set display: block to display this -->
<div id="parametersdiv" style="display: none;">
</div>
<br style="clear: both"/>
<div id="header">
<div id="errordiv"></div>
</div>
</div>
<!-- define the design and the parameters -->
<script type="text/javascript">
// from stackoverflow: http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
var urlParams;
(window.onpopstate = function () {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
urlParams = {};
while (match = search.exec(query))
urlParams[decode(match[1])] = decode(match[2]);
})();
//////////////
var gProcessor = null; // required by OpenJScad.org
function loadProcessor() {
gProcessor = new OpenJsCad.Processor(document.getElementById("viewerContext"));
loadJSCAD(urlParams["file"]);
if(urlParams["instantUpdate"] == "1") {
document.getElementById("instantUpdate").checked = true;
}
if(urlParams["generatestlbutton"]) {
$("#tail").css("display", "block");
}
}
function loadJSCAD(file) {
var filepath = "examples/" + file;
var xhr = new XMLHttpRequest();
xhr.open("GET", filepath, true);
gProcessor.setStatus("Loading "+filepath+" <img id=busy src='imgs/busy.gif'>");
xhr.onload = function() {
var source = this.responseText;
//console.log(source);
if(filepath.match(/\.jscad$/i)||filepath.match(/\.js$/i)) {
gProcessor.setStatus("Processing "+filepath+" <img id=busy src='imgs/busy.gif'>");
gProcessor.setJsCad(source,filepath);
}
}
xhr.send();
}
</script>
</body>
</html>