forked from ericmandel/js9
-
Notifications
You must be signed in to change notification settings - Fork 1
/
js9create.html
executable file
·212 lines (208 loc) · 7.22 KB
/
js9create.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http:https://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=1" >
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type="image/x-icon" rel="shortcut icon" href="./favicon.ico">
<link type="text/css" rel="stylesheet" href="js9support.css">
<link type="text/css" rel="stylesheet" href="js9.css">
<script type="text/javascript" src="js9prefs.js"></script>
<script type="text/javascript" src="js9support.min.js"></script>
<script type="text/javascript" src="js9.min.js"></script>
<script type="text/javascript" src="js9plugins.js"></script>
<style type="text/css">
.colA {
position: absolute;
top: 0;
left: 0;
width: 10px;
}
.colB {
position: absolute;
top: 0;
left: 20px;
width: 130px;
}
.colC {
position: absolute;
top: 0;
left: 150px;
width: 500px;
}
</style>
<title>JS9 create</title>
</head>
<body onload="myLoadInit()">
<script type="text/javascript">
var loadtype;
var ndiv = 0;
var nwin=1;
var lastid;
function myLoadInit() {
loadtype = "standard";
$(".loadLabel").html("");
$("#standardLabel").html("<font size='+1'>*<\/font>");
$("#standardButton").on("click", function(evt){
loadtype = "standard";
$(".loadLabel").html("");
$("#standardLabel").html("<font size='+1'>*<\/font>");
});
$("#divButton").on("click", function(evt){
loadtype = "div";
$(".loadLabel").html("");
$("#divLabel").html("<font size='+1'>*<\/font>");
});
$("#lightButton").on("click", function(evt){
loadtype = "light";
$(".loadLabel").html("");
$("#lightLabel").html("<font size='+1'>*<\/font>");
});
$("#newButton").on("click", function(evt){
loadtype = "new";
$(".loadLabel").html("");
$("#newLabel").html("<font size='+1'>*<\/font>");
});
}
// create js9 instance, if necessary, and load image
function myLoad(file, opts){
var id, did, head, body, html, doc;
var myopts = opts || {};
switch(loadtype){
// regular old div in this page: JS9 must be installed on this page
case "standard":
// just the standard load
JS9.Load(file, myopts, {display: "standard"});
break;
// lightweight window in this page
case "light":
myopts.id = "mylight" + nwin++;
lastid = JS9.LoadWindow(file, myopts, "light");
break;
// completely new window
case "new":
myopts.id = "mynew" + nwin++;
lastid = JS9.LoadWindow(file, myopts, "new");
break;
case "div":
// make a reasonably unique id for the JS9 divs
id = "divJS9_" + ndiv++;
// make up the html with the unique id
html = sprintf("<p><div class='JS9Menubar' id='%sMenubar'><\/div><div class='JS9' id='%s'><\/div>", id, id);
// append to end of page
$(html).appendTo($("body"));
// create the new JS9 display, with associated plugins
JS9.AddDivs(id);
// just a standard load to that display
JS9.Load(file, myopts, {display: id});
break;
default:
alert("unknown load type: "+loadtype);
}
}
</script>
<center><font size="+1">
<b>JS9 Demo: creating a JS9 instance dynamically</b>
</font></center>
<p>
Choose a method of creating a JS9 instance:
<div class="linegroup">
<span class="colA">
<label class="loadLabel" id="standardLabel"></label>
</span>
<span class="colB">
<button id="standardButton">Standard Div</button>
</span>
<span class="colC">
display image in the existing visible canvas below
</span>
</div>
<p>
<div class="linegroup">
<span class="colA">
<label class="loadLabel" id="lightLabel"></label>
</span>
<span class="colB">
<button id="lightButton">Light Window</button>
</span>
<span class="colC">
display image in a dynamically created light-weight window
</span>
</div>
<div class="linegroup">
<span class="colA">
<label class="loadLabel" id="newLabel"></label>
</span>
<span class="colB">
<button id="newButton">New Window</button>
</span>
<span class="colC">
display image in a dynamically created new window
</span>
</div>
<p>
<div class="linegroup">
<span class="colA">
<label class="loadLabel" id="divLabel"></label>
</span>
<span class="colB">
<button id="divButton">Append Div</button>
</span>
<span class="colC">
display image in a new div, which is appended to the page
</span>
</div>
<p>
Choose an image to load using the current method:
<table cellspacing="10">
<tr valign="top">
<td>
PNG files (converted from FITS):
<ul> <li> <a href='javascript:myLoad("png/casa.png");'>CAS-A (Chandra)</a>
<li> <a href='javascript:myLoad("png/snr.png", {colormap:"heat"});'>CTB 109 (Einstein)</a>
<li> <a href='javascript:myLoad("png/m13.png", {scale:"linear", colormap:"sls"});'>m13 (via SkyView)</a>
<li> <a href='javascript:myLoad("png/i1000.png", {scale:"linear", colormap:"grey"});'>i1000 (v=x*1000+y)</a>
</ul>
</td>
<td>
FITS files:
<ul>
<li> <a href='javascript:myLoad("fits/3c273.fits");'>3c273 (Chandra)</a>
<li> <a href='javascript:myLoad("fits/ngkper.fits");'>gkper (Chandra)</a>
<li> <a href='javascript:myLoad("fits/3c58.fits");'>3c58 (Chandra)</a>
<li> <a href='javascript:myLoad("fits/ngc1316.fits", {scale:"linear"});'>ngc1316 (AIPS)</a>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="2">
<div class="JS9Menubar" id="standardMenubar"></div>
<div class="JS9" id="standard"></div>
</td>
</tr>
</table>
<p>
JS9 Demos:
<ul>
<li><a href='js9basics.html'>JS9 Demo: the basics</a>
<li><a href='js9bespoke.html'>JS9 Demo: web page control of JS9</a>
<li><a href='js9sizes.html'>JS9 Demo: setting the size of the JS9 display</a>
<li><a href='js9large.html'>JS9 Demo: support for large FITS files</a>
<li><a href='js9plugins.html'>JS9 Demo: adding plugins to JS9</a>
<li><a href='js9imexam.html'>JS9 Demo: the imexam plugin for JS9</a>
<li><a href='js9blend.html'>JS9 Demo: image blending</a>
<li><a href='js9cat.html'>JS9 Demo: overlaying catalogs</a>
<li><a href='js9panzoom.html'>JS9 Demo: pan and zoom</a>
<li><a href='js9rgb.html'>JS9 Demo: RGB composite images</a>
<li><a href='js9multi.html'>JS9 Demo: independent instances of JS9</a>
<li><a href='js9analysis.html'>JS9 Demo: remote data analysis</a>
<li><a href='js9onchange.html'>JS9 Demo: running tasks when a region changes</a>
<li><a href='js9create.html'>JS9 Demo: creating a JS9 instance dynamically</a>
<li><a href='js9preload.html'>JS9 Demo: preloading images into JS9</a>
<li><a href='js9bitpix.html'>JS9 Demo: displaying different FITS datatypes</a>
<li><a href='js9allinone.html'>JS9 Demo: using the all-in-one files</a>
<li><a href='js9pngvsfits.html'>JS9 Demo: PNG representation files vs FITS files</a>
</ul>
</body>
</html>